pub struct Rotary<A, B> { /* private fields */ }Expand description
Holds current/old state and both InputPin
Implementations§
Source§impl<A, B> Rotary<A, B>
 
impl<A, B> Rotary<A, B>
Sourcepub fn new(pin_a: A, pin_b: B) -> Self
 
pub fn new(pin_a: A, pin_b: B) -> Self
Accepts two InputPins, these will be read on every update()
Sourcepub fn update(&mut self) -> Result<Direction, Either<A::Error, B::Error>>
 
pub fn update(&mut self) -> Result<Direction, Either<A::Error, B::Error>>
Call update to evaluate the next state of the encoder, propagates errors from InputPin read
Sourcepub fn pin_a(&mut self) -> &mut A
 
pub fn pin_a(&mut self) -> &mut A
Returns a reference to the first pin. Can be used to clear interrupt.
Sourcepub fn pin_b(&mut self) -> &mut B
 
pub fn pin_b(&mut self) -> &mut B
Returns a reference to the second pin. Can be used to clear interrupt.
Sourcepub fn pins(&mut self) -> (&mut A, &mut B)
 
pub fn pins(&mut self) -> (&mut A, &mut B)
Returns a reference to both pins. Can be used to clear interrupt.
Sourcepub fn into_inner(self) -> (A, B)
 
pub fn into_inner(self) -> (A, B)
Consumes this Rotary, returning the underlying pins A and B.
Trait Implementations§
impl<A: Eq, B: Eq> Eq for Rotary<A, B>
impl<A, B> StructuralPartialEq for Rotary<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for Rotary<A, B>
impl<A, B> RefUnwindSafe for Rotary<A, B>where
    A: RefUnwindSafe,
    B: RefUnwindSafe,
impl<A, B> Send for Rotary<A, B>
impl<A, B> Sync for Rotary<A, B>
impl<A, B> Unpin for Rotary<A, B>
impl<A, B> UnwindSafe for Rotary<A, B>where
    A: UnwindSafe,
    B: 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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more