pub struct SetStepModeFuture<Driver, Timer, const TIMER_HZ: u32>where
Driver: SetStepMode,{ /* private fields */ }
Expand description
The “future” returned by Stepper::set_step_mode
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, Timer, const TIMER_HZ: u32> SetStepModeFuture<Driver, Timer, TIMER_HZ>where
Driver: SetStepMode,
Timer: Timer<TIMER_HZ>,
impl<Driver, Timer, const TIMER_HZ: u32> SetStepModeFuture<Driver, Timer, TIMER_HZ>where
Driver: SetStepMode,
Timer: Timer<TIMER_HZ>,
Sourcepub fn new(
step_mode: <Driver as SetStepMode>::StepMode,
driver: Driver,
timer: Timer,
) -> SetStepModeFuture<Driver, Timer, TIMER_HZ>
pub fn new( step_mode: <Driver as SetStepMode>::StepMode, driver: Driver, timer: Timer, ) -> SetStepModeFuture<Driver, Timer, TIMER_HZ>
Create new instance of SetStepModeFuture
This constructor is public to provide maximum flexibility for
non-standard use cases. Most users can ignore this and just use
Stepper::set_step_mode
instead.
Sourcepub fn poll(
&mut self,
) -> Poll<Result<(), SignalError<Infallible, <Driver as SetStepMode>::Error, <Timer as Timer<TIMER_HZ>>::Error>>>
pub fn poll( &mut self, ) -> Poll<Result<(), SignalError<Infallible, <Driver as SetStepMode>::Error, <Timer as Timer<TIMER_HZ>>::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.
Sourcepub fn wait(
&mut self,
) -> Result<(), SignalError<Infallible, <Driver as SetStepMode>::Error, <Timer as Timer<TIMER_HZ>>::Error>>
pub fn wait( &mut self, ) -> Result<(), SignalError<Infallible, <Driver as SetStepMode>::Error, <Timer as Timer<TIMER_HZ>>::Error>>
Wait until the operation completes
This method will call Self::poll
in a busy loop until the operation
has finished.
Sourcepub fn release(self) -> (Driver, Timer)
pub fn release(self) -> (Driver, Timer)
Drop the future and release the resources that were moved into it