pub struct Sequencer { /* private fields */ }Expand description
A position in a drive sequence, walked one step at a time.
Holding the index into the pattern, a sequencer turns each step
into the next coil pattern to apply, wrapping around the cycle so it can run
indefinitely in either direction.
§Examples
use pamoja_actuators::stepper::{Direction, Drive, Sequencer};
let mut sequencer = Sequencer::new(Drive::HalfStep);
assert_eq!(sequencer.coils(), 0b1000);
assert_eq!(sequencer.step(Direction::Forward), 0b1100);
// One full electrical cycle returns to the start.
for _ in 1..Drive::HalfStep.step_count() {
sequencer.step(Direction::Forward);
}
assert_eq!(sequencer.coils(), 0b1000);Implementations§
Trait Implementations§
impl Copy for Sequencer
impl Eq for Sequencer
impl StructuralPartialEq for Sequencer
Auto Trait Implementations§
impl Freeze for Sequencer
impl RefUnwindSafe for Sequencer
impl Send for Sequencer
impl Sync for Sequencer
impl Unpin for Sequencer
impl UnsafeUnpin for Sequencer
impl UnwindSafe for Sequencer
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