Skip to main content

Button

Trait Button 

Source
pub trait Button {
    // Required method
    fn is_pressed_raw(&self) -> bool;
}
Expand description

Button input trait.

Active-low on this hardware: the GPIO reads false when the button is pressed and true when released, because of the pull-up to 3V3. The trait abstracts that away and returns a boolean in the user-friendly direction: true means “user is pressing the button right now”.

Required Methods§

Source

fn is_pressed_raw(&self) -> bool

true if the button is currently pressed at the GPIO level (raw, not yet debounced).

Implementors§