Struct MotorDriver

Source
pub struct MotorDriver<D, DIR, STEP, CHIP>
where D: DelayUs<u32>, DIR: OutputPin, STEP: OutputPin, CHIP: Params,
{ /* private fields */ }
Expand description

A stepper motor driver generic struct

Implementations§

Source§

impl<D, DIR, STEP, CHIP> MotorDriver<D, DIR, STEP, CHIP>
where D: DelayUs<u32>, DIR: OutputPin, STEP: OutputPin, CHIP: Params,

Source

pub fn set_speed(&mut self, rpm: f32)

Sets the speed in revolutions per minute (1-200 is a reasonable range)

Source

pub fn move_instant(&mut self, steps_to_move: u64)

Moves the motor steps_to_move steps

Source

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.

Source

pub fn set_direction(&mut self, clock_work: bool)

Set the direction

Source§

impl<D, DIR, STEP> MotorDriver<D, DIR, STEP, a4988>
where D: DelayUs<u32>, DIR: OutputPin, STEP: OutputPin,

Source

pub fn a4988( delay: D, dir_pin: DIR, step_pin: STEP, number_of_steps: u16, step_division: u8, rpm: f32, ) -> Self

Specialized constructor

Source§

impl<D, DIR, STEP> MotorDriver<D, DIR, STEP, drv8825>
where D: DelayUs<u32>, DIR: OutputPin, STEP: OutputPin,

Source

pub fn drv8825( delay: D, dir_pin: DIR, step_pin: STEP, number_of_steps: u16, step_division: u8, rpm: f32, ) -> Self

Specialized constructor

Source§

impl<D, DIR, STEP> MotorDriver<D, DIR, STEP, drv8834>
where D: DelayUs<u32>, DIR: OutputPin, STEP: OutputPin,

Source

pub fn drv8834( delay: D, dir_pin: DIR, step_pin: STEP, number_of_steps: u16, step_division: u8, rpm: f32, ) -> Self

Specialized constructor

Source§

impl<D, DIR, STEP> MotorDriver<D, DIR, STEP, drv8880>
where D: DelayUs<u32>, DIR: OutputPin, STEP: OutputPin,

Source

pub fn drv8880( delay: D, dir_pin: DIR, step_pin: STEP, number_of_steps: u16, step_division: u8, rpm: f32, ) -> Self

Specialized constructor

Trait Implementations§

Source§

impl<D, DIR, STEP, CHIP> Debug for MotorDriver<D, DIR, STEP, CHIP>
where D: DelayUs<u32> + Debug, DIR: OutputPin + Debug, STEP: OutputPin + Debug, CHIP: Params + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<D, DIR, STEP, CHIP> Freeze for MotorDriver<D, DIR, STEP, CHIP>
where D: Freeze, DIR: Freeze, STEP: Freeze,

§

impl<D, DIR, STEP, CHIP> RefUnwindSafe for MotorDriver<D, DIR, STEP, CHIP>

§

impl<D, DIR, STEP, CHIP> Send for MotorDriver<D, DIR, STEP, CHIP>
where D: Send, DIR: Send, STEP: Send, CHIP: Send,

§

impl<D, DIR, STEP, CHIP> Sync for MotorDriver<D, DIR, STEP, CHIP>
where D: Sync, DIR: Sync, STEP: Sync, CHIP: Sync,

§

impl<D, DIR, STEP, CHIP> Unpin for MotorDriver<D, DIR, STEP, CHIP>
where D: Unpin, DIR: Unpin, STEP: Unpin, CHIP: Unpin,

§

impl<D, DIR, STEP, CHIP> UnwindSafe for MotorDriver<D, DIR, STEP, CHIP>
where D: UnwindSafe, DIR: UnwindSafe, STEP: UnwindSafe, CHIP: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.