[−][src]Struct debouncr::DebouncerStateful
A stateful debouncer.
The regular Debouncer
will report any change
from "bouncing" to "stable high/low" as an edge. That means that if a
button is not pressed, bounces twice and then goes back to unpressed, it
will report a falling edge even though there was no rising edge.
This DebouncerStateful
on the other hand stores the previous stable state
and will only report a falling edge if there was previously a rising edge
(and vice versa).
The memory cost for this is storing an extra enum value per debouncer.
Implementations
impl DebouncerStateful<u8, Repeat2>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u8, Repeat3>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u8, Repeat4>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u8, Repeat5>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u8, Repeat6>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u8, Repeat7>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u8, Repeat8>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u16, Repeat9>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u16, Repeat10>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u16, Repeat11>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u16, Repeat12>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u16, Repeat13>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u16, Repeat14>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u16, Repeat15>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
impl DebouncerStateful<u16, Repeat16>
[src]
pub fn update(&mut self, pressed: bool) -> Option<Edge>
[src]
Update the state.
pub fn is_high(&self) -> bool
[src]
Return true
if the debounced state is logical high.
pub fn is_low(&self) -> bool
[src]
Return true
if the debounced state is logical low.
Auto Trait Implementations
impl<S, M> Send for DebouncerStateful<S, M> where
M: Send,
S: Send,
M: Send,
S: Send,
impl<S, M> Sync for DebouncerStateful<S, M> where
M: Sync,
S: Sync,
M: Sync,
S: Sync,
impl<S, M> Unpin for DebouncerStateful<S, M> where
M: Unpin,
S: Unpin,
M: Unpin,
S: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,