@@ -60,29 +60,33 @@ impl InputDevice {
60
60
macro_rules! impl_events_mixin {
61
61
( ) => {
62
62
/// Pause the program until the device is activated, or the timeout is reached.
63
- fn wait_for( & mut self , timeout: Option <f32 >, active: bool ) {
64
- match timeout{
65
- None =>
63
+ fn wait_for( & mut self , timeout: Option <f32 >, active: bool ) {
64
+ match timeout {
65
+ None => {
66
66
if active {
67
67
self . pin. set_interrupt( Trigger :: RisingEdge ) . unwrap( ) ;
68
68
self . pin. poll_interrupt( true , None ) . unwrap( ) ;
69
- } else{
69
+ } else {
70
70
self . pin. set_interrupt( Trigger :: FallingEdge ) . unwrap( ) ;
71
71
self . pin. poll_interrupt( true , None ) . unwrap( ) ;
72
72
}
73
- ,
74
- Some ( n) => if active {
73
+ }
74
+ Some ( n) => {
75
+ if active {
75
76
self . pin. set_interrupt( Trigger :: RisingEdge ) . unwrap( ) ;
76
- self . pin. poll_interrupt( true , Some ( Duration :: from_millis( ( n * 1000.0 ) as u64 ) ) ) . unwrap( ) ;
77
- } else{
77
+ self . pin
78
+ . poll_interrupt( true , Some ( Duration :: from_millis( ( n * 1000.0 ) as u64 ) ) )
79
+ . unwrap( ) ;
80
+ } else {
78
81
self . pin. set_interrupt( Trigger :: FallingEdge ) . unwrap( ) ;
79
- self . pin. poll_interrupt( true , Some ( Duration :: from_millis( ( n * 1000.0 ) as u64 ) ) ) . unwrap( ) ;
82
+ self . pin
83
+ . poll_interrupt( true , Some ( Duration :: from_millis( ( n * 1000.0 ) as u64 ) ) )
84
+ . unwrap( ) ;
80
85
}
86
+ }
81
87
}
82
88
}
83
-
84
-
85
- }
89
+ } ;
86
90
}
87
91
88
92
/// Represents a generic input device with typical on/off behaviour.
@@ -167,6 +171,8 @@ pub struct Button {
167
171
pin : InputPin ,
168
172
active_state : bool ,
169
173
inactive_state : bool ,
174
+ // FIXME: Implement debouncing
175
+ #[ allow( dead_code) ]
170
176
bounce_time : Option < f32 > ,
171
177
}
172
178
0 commit comments