enabled triggering of event without pressing button
This commit is contained in:
parent
2cf404da0b
commit
ab0cc33c48
@ -94,6 +94,15 @@ impl<OP: OutputPin, IP: InputPin> LedButton<OP, IP> {
|
||||
self.button.counter
|
||||
}
|
||||
|
||||
pub fn trigger(&mut self, long: bool) {
|
||||
if long {
|
||||
self.state = ButtonState::LongPress;
|
||||
}
|
||||
else {
|
||||
self.state = ButtonState::Pressed;
|
||||
}
|
||||
}
|
||||
|
||||
/// polls the button and read the current state
|
||||
pub fn poll_and_read(&mut self, led_while_pressed: bool) -> ButtonState {
|
||||
self.button.poll();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user