StepperMotorBuilder

Struct StepperMotorBuilder 

Source
pub struct StepperMotorBuilder<STEP, DIR, DELAY>
where STEP: OutputPin, DIR: OutputPin, DELAY: DelayNs,
{ /* private fields */ }
Expand description

Builder for creating StepperMotor instances.

Implementations§

Source§

impl<STEP, DIR, DELAY> StepperMotorBuilder<STEP, DIR, DELAY>
where STEP: OutputPin, DIR: OutputPin, DELAY: DelayNs,

Source

pub fn new() -> Self

Create a new builder.

Source

pub fn step_pin(self, pin: STEP) -> Self

Set the STEP pin.

Source

pub fn dir_pin(self, pin: DIR) -> Self

Set the DIR pin.

Source

pub fn delay(self, delay: DELAY) -> Self

Set the delay provider.

Source

pub fn name(self, name: &str) -> Self

Set the motor name.

Source

pub fn steps_per_revolution(self, steps: u16) -> Self

Set steps per revolution (base motor steps before microstepping).

Source

pub fn microsteps(self, microsteps: Microsteps) -> Self

Set microstep configuration.

Source

pub fn gear_ratio(self, ratio: f32) -> Self

Set gear ratio.

Source

pub fn max_velocity(self, velocity: DegreesPerSec) -> Self

Set maximum velocity in degrees per second.

Source

pub fn max_acceleration(self, acceleration: DegreesPerSecSquared) -> Self

Set maximum acceleration in degrees per second squared.

Source

pub fn invert_direction(self, invert: bool) -> Self

Set direction inversion.

Source

pub fn backlash_steps(self, steps: i64) -> Self

Set backlash compensation in steps.

Backlash is applied on direction changes to compensate for mechanical play.

Source

pub fn from_motor_config(self, config: &MotorConfig) -> Self

Configure from a MotorConfig.

Source

pub fn from_config( self, config: &SystemConfig, motor_name: &str, ) -> Result<Self>

Configure from SystemConfig by motor name.

Source

pub fn build(self) -> Result<StepperMotor<STEP, DIR, DELAY, Idle>>

Build the StepperMotor.

§Errors

Returns an error if required fields are missing.

Trait Implementations§

Source§

impl<STEP, DIR, DELAY> Default for StepperMotorBuilder<STEP, DIR, DELAY>
where STEP: OutputPin, DIR: OutputPin, DELAY: DelayNs,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<STEP, DIR, DELAY> Freeze for StepperMotorBuilder<STEP, DIR, DELAY>
where STEP: Freeze, DIR: Freeze, DELAY: Freeze,

§

impl<STEP, DIR, DELAY> RefUnwindSafe for StepperMotorBuilder<STEP, DIR, DELAY>
where STEP: RefUnwindSafe, DIR: RefUnwindSafe, DELAY: RefUnwindSafe,

§

impl<STEP, DIR, DELAY> Send for StepperMotorBuilder<STEP, DIR, DELAY>
where STEP: Send, DIR: Send, DELAY: Send,

§

impl<STEP, DIR, DELAY> Sync for StepperMotorBuilder<STEP, DIR, DELAY>
where STEP: Sync, DIR: Sync, DELAY: Sync,

§

impl<STEP, DIR, DELAY> Unpin for StepperMotorBuilder<STEP, DIR, DELAY>
where STEP: Unpin, DIR: Unpin, DELAY: Unpin,

§

impl<STEP, DIR, DELAY> UnwindSafe for StepperMotorBuilder<STEP, DIR, DELAY>
where STEP: UnwindSafe, DIR: UnwindSafe, DELAY: 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.