Debouncer

Struct Debouncer 

Source
pub struct Debouncer<T> { /* private fields */ }

Implementations§

Source§

impl<T> Debouncer<T>

Source

pub fn new(input: T, debounce_time: Duration) -> Self

Source

pub fn new_asymmetric( input: T, debounce_high_time: Duration, debounce_low_time: Duration, ) -> Self

Trait Implementations§

Source§

impl<T: InputPin> ErrorType for Debouncer<T>

Source§

type Error = <T as ErrorType>::Error

Error type
Source§

impl<T: InputPin> InputPin for Debouncer<T>

Source§

fn is_high(&mut self) -> Result<bool, Self::Error>

Is the input pin high?
Source§

fn is_low(&mut self) -> Result<bool, Self::Error>

Is the input pin low?
Source§

impl<T: Wait + InputPin> Wait for Debouncer<T>

Source§

async fn wait_for_high(&mut self) -> Result<(), T::Error>

Wait until the pin is high. If it is already high, return immediately. Read more
Source§

async fn wait_for_low(&mut self) -> Result<(), T::Error>

Wait until the pin is low. If it is already low, return immediately. Read more
Source§

async fn wait_for_rising_edge(&mut self) -> Result<(), T::Error>

Wait for the pin to undergo a transition from low to high. Read more
Source§

async fn wait_for_falling_edge(&mut self) -> Result<(), T::Error>

Wait for the pin to undergo a transition from high to low. Read more
Source§

async fn wait_for_any_edge(&mut self) -> Result<(), T::Error>

Wait for the pin to undergo any transition, i.e low to high OR high to low.

Auto Trait Implementations§

§

impl<T> Freeze for Debouncer<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Debouncer<T>
where T: RefUnwindSafe,

§

impl<T> Send for Debouncer<T>
where T: Send,

§

impl<T> Sync for Debouncer<T>
where T: Sync,

§

impl<T> Unpin for Debouncer<T>
where T: Unpin,

§

impl<T> UnwindSafe for Debouncer<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.