pub struct Button<P> { /* private fields */ }
Expand description
A generic button that asynchronously detects ButtonEvent
s.
Implementations§
Source§impl<P> Button<P>
impl<P> Button<P>
Sourcepub const fn new(pin: P, config: ButtonConfig) -> Self
pub const fn new(pin: P, config: ButtonConfig) -> Self
Creates a new button with the provided config.
Sourcepub async fn update(&mut self) -> ButtonEvent
pub async fn update(&mut self) -> ButtonEvent
Updates the button and returns the detected event.
Awaiting this blocks execution of the task until a ButtonEvent
is detected so it should
not be called from tasks where blocking for long periods of time is not desireable.
Trait Implementations§
impl<P: Copy> Copy for Button<P>
Auto Trait Implementations§
impl<P> Freeze for Button<P>where
P: Freeze,
impl<P> RefUnwindSafe for Button<P>where
P: RefUnwindSafe,
impl<P> Send for Button<P>where
P: Send,
impl<P> Sync for Button<P>where
P: Sync,
impl<P> Unpin for Button<P>where
P: Unpin,
impl<P> UnwindSafe for Button<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more