pub struct MotorDriver<D, DIR, STEP, CHIP>{ /* private fields */ }
Expand description
A stepper motor driver generic struct
Implementations§
Source§impl<D, DIR, STEP, CHIP> MotorDriver<D, DIR, STEP, CHIP>
impl<D, DIR, STEP, CHIP> MotorDriver<D, DIR, STEP, CHIP>
Sourcepub fn set_speed(&mut self, rpm: f32)
pub fn set_speed(&mut self, rpm: f32)
Sets the speed in revolutions per minute (1-200 is a reasonable range)
Sourcepub fn move_instant(&mut self, steps_to_move: u64)
pub fn move_instant(&mut self, steps_to_move: u64)
Moves the motor steps_to_move steps
Sourcepub fn move_smooth(
&mut self,
steps_to_move: u64,
steps_acc: u64,
steps_dec: u64,
)
pub fn move_smooth( &mut self, steps_to_move: u64, steps_acc: u64, steps_dec: u64, )
Moves the motor smoothly steps_to_move
steps.
Increasing speed during the steps_acc
and decreasing during steps_dec
steps.
Sourcepub fn set_direction(&mut self, clock_work: bool)
pub fn set_direction(&mut self, clock_work: bool)
Set the direction
Source§impl<D, DIR, STEP> MotorDriver<D, DIR, STEP, a4988>
impl<D, DIR, STEP> MotorDriver<D, DIR, STEP, a4988>
Source§impl<D, DIR, STEP> MotorDriver<D, DIR, STEP, drv8825>
impl<D, DIR, STEP> MotorDriver<D, DIR, STEP, drv8825>
Source§impl<D, DIR, STEP> MotorDriver<D, DIR, STEP, drv8834>
impl<D, DIR, STEP> MotorDriver<D, DIR, STEP, drv8834>
Trait Implementations§
Auto Trait Implementations§
impl<D, DIR, STEP, CHIP> Freeze for MotorDriver<D, DIR, STEP, CHIP>
impl<D, DIR, STEP, CHIP> RefUnwindSafe for MotorDriver<D, DIR, STEP, CHIP>
impl<D, DIR, STEP, CHIP> Send for MotorDriver<D, DIR, STEP, CHIP>
impl<D, DIR, STEP, CHIP> Sync for MotorDriver<D, DIR, STEP, CHIP>
impl<D, DIR, STEP, CHIP> Unpin for MotorDriver<D, DIR, STEP, CHIP>
impl<D, DIR, STEP, CHIP> UnwindSafe for MotorDriver<D, DIR, STEP, CHIP>
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