pub struct Stepper<M: StepperMotor, D: DelayNs> { /* private fields */ }Expand description
High-level stepper controller parameterized by a motor coil driver M and a delay D.
Implementations§
Source§impl<M: StepperMotor, D: DelayNs> Stepper<M, D>
impl<M: StepperMotor, D: DelayNs> Stepper<M, D>
Sourcepub fn new(number_of_steps: u32, motor: M, delay: D) -> Self
pub fn new(number_of_steps: u32, motor: M, delay: D) -> Self
Create a new controller.
number_of_steps: steps per mechanical revolution (as in Arduino stepper constructor)motor: coil driver implementingStepperMotordelay: timing provider implementingDelayNs
Sourcepub fn set_speed(&mut self, speed: u32)
pub fn set_speed(&mut self, speed: u32)
Set speed in RPM.
Equivalent to the Arduino stepper function with the same name except the division by 0 check.
If speed or number_of_steps are 0, the speed is set to 0
Auto Trait Implementations§
impl<M, D> Freeze for Stepper<M, D>
impl<M, D> RefUnwindSafe for Stepper<M, D>where
M: RefUnwindSafe,
D: RefUnwindSafe,
impl<M, D> Send for Stepper<M, D>
impl<M, D> Sync for Stepper<M, D>
impl<M, D> Unpin for Stepper<M, D>
impl<M, D> UnwindSafe for Stepper<M, D>where
M: UnwindSafe,
D: 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