File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ pub enum Event {
2424pub enum Error {
2525 /// Max count error
2626 MaxCountError ,
27- /// Wrong GPIO for reading
28- InvalidPin
27+ /// Wrong GPIO for reading - returns the ioccr register
28+ InvalidPin ( u32 )
2929}
3030
3131pub trait SamplePin < TSC > {
@@ -218,7 +218,7 @@ impl<SPIN> Tsc<SPIN> {
218218 break Err ( Error :: MaxCountError )
219219 }
220220 } ;
221-
221+ self . tsc . ioccr . write ( |w| unsafe { w . bits ( 0b0 ) } ) ; // clear channel register
222222 result
223223 }
224224
@@ -233,7 +233,7 @@ impl<SPIN> Tsc<SPIN> {
233233 if channel == ( 1 << bit_pos) {
234234 Ok ( self . read_unchecked ( ) )
235235 } else {
236- Err ( Error :: InvalidPin )
236+ Err ( Error :: InvalidPin ( channel ) )
237237 }
238238 }
239239
@@ -243,6 +243,11 @@ impl<SPIN> Tsc<SPIN> {
243243 self . tsc . iog2cr . read ( ) . cnt ( ) . bits ( )
244244 }
245245
246+ /// Is the tsc performing an aquisition
247+ pub fn in_progress ( & mut self ) -> bool {
248+ self . tsc . cr . read ( ) . start ( ) . bit_is_set ( )
249+ }
250+
246251 /// Enables an interrupt event
247252 pub fn listen ( & mut self , event : Event ) {
248253 match event {
You can’t perform that action at this time.
0 commit comments