pub struct ButtonFsm { /* private fields */ }Expand description
Button event recognition state machine.
Implementations§
Source§impl ButtonFsm
impl ButtonFsm
pub fn new(timings: ButtonTimings) -> Self
Sourcepub fn on_edge(&mut self, edge: ButtonEdge, now_ms: u64) -> Option<ButtonEvent>
pub fn on_edge(&mut self, edge: ButtonEdge, now_ms: u64) -> Option<ButtonEvent>
Feed a debounced edge. Returns an event if one is resolvable purely from the edge (without waiting for a timeout).
Sourcepub fn poll(&mut self, now_ms: u64) -> Option<ButtonEvent>
pub fn poll(&mut self, now_ms: u64) -> Option<ButtonEvent>
Advance time without an edge. Returns an event if a timeout resolves one (long-press while held, or single/double after the inter-click gap).
Sourcepub fn next_deadline(&self) -> Option<u64>
pub fn next_deadline(&self) -> Option<u64>
Returns the absolute monotonic-millisecond deadline at which
poll should next be called, if any.