pub trait _embedded_hal_timer_CountDown {
type Time;
fn start<T>(&mut self, count: T)
where
T: Into<Self::Time>;
fn wait(&mut self) -> Result<(), Error<Void>>;
}
A count down timer
self.start(count); block!(self.wait());
MUST block for AT LEAST the time specified by
count
.
Note that the implementer doesn't necessarily have to be a downcounting timer; it could also
be an upcounting timer as long as the above contract is upheld.
You can use this timer to create delays
extern crate embedded_hal as hal;
#[macro_use(block)]
extern crate nb;
use hal::prelude::*;
fn main() {
let mut led: Led = {
};
let mut timer: Timer6 = {
};
Led.on();
timer.start(1.s());
block!(timer.wait());
Led.off();
}
The unit of time used by this timer
Loading content...
fn start<T>(&mut self, count: T) where
T: Into<Self::Time>,
Non-blockingly "waits" until the count down finishes
- If
Self: Periodic
, the timer will start a new count down right after the last one
finishes.
- Otherwise the behavior of calling
wait
after the last call returned Ok
is UNSPECIFIED.
Implementers are suggested to panic on this scenario to signal a programmer error.
Loading content...
Use the systick as a timer
Be aware that intervals less than 4 Hertz may not function properly
Start the timer with a timeout
Return Ok
if the timer has wrapped
Automatically clears the flag and restarts the time
Start the timer with a timeout
Return Ok
if the timer has wrapped
Automatically clears the flag and restarts the time
Start the timer with a timeout
Return Ok
if the timer has wrapped
Automatically clears the flag and restarts the time
Start the timer with a timeout
Return Ok
if the timer has wrapped
Automatically clears the flag and restarts the time
Start the timer with a timeout
Return Ok
if the timer has wrapped
Automatically clears the flag and restarts the time
Start the timer with a timeout
Return Ok
if the timer has wrapped
Automatically clears the flag and restarts the time
Start the timer with a timeout
Return Ok
if the timer has wrapped
Automatically clears the flag and restarts the time
Start the timer with a timeout
Return Ok
if the timer has wrapped
Automatically clears the flag and restarts the time
Start the timer with a timeout
Return Ok
if the timer has wrapped
Automatically clears the flag and restarts the time
Start the timer with a timeout
Return Ok
if the timer has wrapped
Automatically clears the flag and restarts the time
Loading content...