pub struct SoftwareMotionControl<Driver, Timer, Profile, Convert, const TIMER_HZ: u32> where
    Profile: MotionProfile
{ /* private fields */ }
Expand description

Software implementation of motion control capability

Some driver natively support motion control capability. This is a software implementation of the MotionControl trait for those drivers that don’t. It wraps a driver that implements SetDirection and Step, and in turn acts like a driver itself, adding to the wrapped driver’s capabilities.

You can use SoftwareMotionControl directly, but like a driver, it is designed to be used through the Stepper API.

Implementations

Construct a new instance of SoftwareMotionControl

Instead of using this constructor directly, you can instead use Stepper::enable_motion_control with any driver that implements SetDirection and Step, providing timer and a motion profile. This module provides a blanket implementation of EnableMotionControl to make this work.

Access a reference to the wrapped driver

This is only possible if there is no ongoing movement.

Access a mutable reference to the wrapped driver

This is only possible if there is no ongoing movement.

Access a reference to the wrapped timer

This is only possible if there is no ongoing movement.

Access a mutable reference to the wrapped timer

This is only possible if there is no ongoing movement.

Access a reference to the wrapped motion profile

Access a mutable reference to the wrapped motion profile

Access the current step

Access the current direction

Set step mode of the wrapped driver

This method is a more convenient alternative to Stepper::set_step_mode, which requires a timer, while this methods reuses the timer that SoftwareMotionControl already owns.

However, while Stepper::set_step_mode is part of the generic API, this method is only available, if you statically know that you’re working with a driver wrapped by SoftwareMotionControl.

Errors

Returns BusyError::Busy, if a motion is ongoing.

Set direction of the wrapped driver

This method is a more convenient alternative to Stepper::set_direction, which requires a timer, while this methods reuses the timer that SoftwareMotionControl already owns.

However, while Stepper::set_direction is part of the generic API, this method is only available, if you statically know that you’re working with a driver wrapped by SoftwareMotionControl.

Errors

Returns BusyError::Busy, if a motion is ongoing.

Tell the wrapped driver to move the motor one step

This method is a more convenient alternative to Stepper::step, which requires a timer, while this methods reuses the timer that SoftwareMotionControl already owns.

However, while Stepper::step is part of the generic API, this method is only available, if you statically know that you’re working with a driver wrapped by SoftwareMotionControl.

Errors

Returns BusyError::Busy, if a motion is ongoing.

Trait Implementations

The type used by the driver to represent velocity

The type error that can happen when using this trait

Move to the given position Read more

Reset internal position to the given value Read more

Update an ongoing motion Read more

The time that the DIR signal must be held for a change to apply

The type of the DIR pin

The error that can occur while accessing the DIR pin

Provides access to the DIR pin

The time the mode signals need to be held before re-enabling the driver

The time the mode signals need to be held after re-enabling the driver

The error that can occur while using this trait

The type that defines the microstepping mode Read more

Apply the new step mode configuration Read more

Re-enable the driver after the mode has been set

The minimum length of a STEP pulse

The type of the STEP pin

The error that can occur while accessing the STEP pin

Provides access to the STEP pin

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Returns the argument unchanged.

Calls U::from(self).

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

Performs the conversion.

Performs the conversion.

Casts the value.

Casts the value.

Should always be Self

Casts the value.

Casts the value.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

Casts the value.

Casts the value.

Casts the value.