pub struct MoveToFuture<Driver: MotionControl> { /* private fields */ }
Expand description
The “future” returned by Stepper::move_to_position
Please note that this type provides a custom API and does not implement
core::future::Future
. This might change, when using futures for embedded
development becomes more practical.
Implementations§
Source§impl<Driver> MoveToFuture<Driver>where
Driver: MotionControl,
impl<Driver> MoveToFuture<Driver>where
Driver: MotionControl,
Sourcepub fn new(
driver: Driver,
max_velocity: Driver::Velocity,
target_step: i32,
) -> Self
pub fn new( driver: Driver, max_velocity: Driver::Velocity, target_step: i32, ) -> Self
Create new instance of MoveToFuture
This constructor is public to provide maximum flexibility for
non-standard use cases. Most users can ignore this and just use
Stepper::move_to_position
instead.
Sourcepub fn poll(&mut self) -> Poll<Result<(), Driver::Error>>
pub fn poll(&mut self) -> Poll<Result<(), Driver::Error>>
Poll the future
The future must be polled for the operation to make progress. The
operation won’t start, until this method has been called once. Returns
Poll::Pending
, if the operation is not finished yet, or
Poll::Ready
, once it is.
If this method returns Poll::Pending
, the user can opt to keep
calling it at a high frequency (see Self::wait
) until the operation
completes, or set up an interrupt that fires once the timer finishes
counting down, and call this method again once it does.