[][src]Trait rmicrobit::buttons::core::PollButton

pub trait PollButton {
    fn is_pressed(&self) -> bool;
fn poll_transition(&mut self) -> Transition; fn poll_event(&mut self) -> Option<TransitionEvent> { ... } }

A button which can be polled.

A PollButton keeps track of its state (pressed or released), updating it when a poll_ method is called.

The poll_transition() and poll_event() methods have the same effects and return equivalent information; you can use whichever form is more convenient.

The states reported may have had a debouncing algorithm applied to what the underlying device reports.

Required methods

fn is_pressed(&self) -> bool

Reports whether the button was in pressed state when last polled.

fn poll_transition(&mut self) -> Transition

Polls the button and indicates its previous and current state.

The underlying button is read at this point.

Loading content...

Provided methods

fn poll_event(&mut self) -> Option<TransitionEvent>

Polls the button and indicates any change in state.

The underlying button is read at this point.

Loading content...

Implementors

impl<T: InputPin, D: Debounce> PollButton for Button<T, D>[src]

Loading content...