Trait StepperMotor

Source
pub trait StepperMotor {
    type Error;

    // Required methods
    fn step(&mut self, this_step: u32) -> Result<(), Self::Error>;
    fn clear(&mut self) -> Result<(), Self::Error>;
}
Expand description

Generic stepper “coil driver” interface (no_std, embedded-hal compatible).

Required Associated Types§

Required Methods§

Source

fn step(&mut self, this_step: u32) -> Result<(), Self::Error>

Drive to a specific step (implementation decides sequence).

Must take a step number, and use this to determine the coil sequence and energise accordingly

Equivalent to the Arduino stepMotor function.

Source

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

De-energize all coils.

Implementors should set all coil pins to low.

Arduino stepper does not have this function, but it may be useful for drivers with no enable-disable

Implementors§

Source§

impl<P1, P2> StepperMotor for StepperMotor2<P1, P2>
where P1: OutputPin, P2: OutputPin<Error = P1::Error>,

Source§

impl<P1, P2, P3, P4> StepperMotor for StepperMotor4<P1, P2, P3, P4>
where P1: OutputPin, P2: OutputPin<Error = P1::Error>, P3: OutputPin<Error = P1::Error>, P4: OutputPin<Error = P1::Error>,

Source§

impl<P1, P2, P3, P4, P5> StepperMotor for StepperMotor5<P1, P2, P3, P4, P5>
where P1: OutputPin, P2: OutputPin<Error = P1::Error>, P3: OutputPin<Error = P1::Error>, P4: OutputPin<Error = P1::Error>, P5: OutputPin<Error = P1::Error>,