[−][src]Struct rmicrobit::buttons::core::Button
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]
fn is_pressed(&self) -> bool
[src]
fn poll_transition(&mut self) -> Transition
[src]
fn poll_event(&mut self) -> Option<TransitionEvent>
[src]
Auto Trait Implementations
impl<T, D> Unpin for Button<T, D> where
D: Unpin,
T: Unpin,
D: Unpin,
T: Unpin,
impl<T, D> Send for Button<T, D> where
D: Send,
T: Send,
D: Send,
T: Send,
impl<T, D> Sync for Button<T, D> where
D: Sync,
T: Sync,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self