Trait drv8825::traits::MotionControl
source · [−]pub trait MotionControl {
type Velocity: Copy;
type Error;
fn move_to_position(
&mut self,
max_velocity: Self::Velocity,
target_step: i32
) -> Result<(), Self::Error>;
fn reset_position(&mut self, step: i32) -> Result<(), Self::Error>;
fn update(&mut self) -> Result<bool, Self::Error>;
}
Expand description
Implemented by drivers that have motion control capabilities
A software-based fallback implementation exists in the motion_control
module, for drivers that implement SetDirection and Step.
Required Associated Types
Required Methods
Move to the given position
This method must arrange for the motion to start, but must not block
until it is completed. If more attention is required during the motion,
this should be handled in MotionControl::update
.
Reset internal position to the given value
This method must not start a motion. Its only purpose is to change the driver’s internal position value, for example for homing.
Update an ongoing motion
This method may contain any code required to maintain an ongoing motion, if required, or it might just check whether a motion is still ongoing.
Return true
, if motion is ongoing, false
otherwise. If false
is
returned, the caller may assume that this method doesn’t need to be
called again, until starting another motion.