[][src]Struct rmicrobit::buttons::core::Button

pub struct Button<T: InputPin, D: Debounce> { /* fields omitted */ }

A button based on a GPIO pin.

Requires an implementation of Debounce as a type parameter. Use TrivialDebouncer if you don't want any debouncing.

The button behaves as if its switch was in released state before the first call to a poll method, so in practice if the button is pressed when new() is called then the first poll_event() will report Press.

Methods

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

pub fn new(pin: T) -> Button<T, D>[src]

Takes ownership of a GPIO pin and returns a Button.

pub fn free(self) -> T[src]

Gives the underlying InputPin instance back.

Trait Implementations

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

Auto Trait Implementations

impl<T, D> Unpin for Button<T, D> where
    D: Unpin,
    T: Unpin

impl<T, D> Send for Button<T, D> where
    D: Send,
    T: Send

impl<T, D> Sync for Button<T, D> where
    D: Sync,
    T: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self