pub struct Rotary<A, B, P> { /* private fields */ }
Expand description
Holds current/old state and both InputPin
Implementations§
Source§impl<A, B> Rotary<A, B, DefaultPhase>
impl<A, B> Rotary<A, B, DefaultPhase>
Source§impl<A, B, P: Phase> Rotary<A, B, P>
impl<A, B, P: Phase> Rotary<A, B, P>
Sourcepub fn with_phase(pin_a: A, pin_b: B, phase: P) -> Self
pub fn with_phase(pin_a: A, pin_b: B, phase: P) -> Self
Accepts two InputPin
s, these will be read on every update()
, while using phase
to determine the direction.
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, P: Eq> Eq for Rotary<A, B, P>
impl<A, B, P> StructuralPartialEq for Rotary<A, B, P>
Auto Trait Implementations§
impl<A, B, P> Freeze for Rotary<A, B, P>
impl<A, B, P> RefUnwindSafe for Rotary<A, B, P>
impl<A, B, P> Send for Rotary<A, B, P>
impl<A, B, P> Sync for Rotary<A, B, P>
impl<A, B, P> Unpin for Rotary<A, B, P>
impl<A, B, P> UnwindSafe for Rotary<A, B, P>
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