Available on crate feature
unstable
only.Expand description
§General-purpose Timers
§Overview
The OneShotTimer and PeriodicTimer types can be backed by any hardware
peripheral which implements the Timer trait. This means that the same API
can be used to interact with different hardware timers, like the TIMG
and
SYSTIMER.
See the timg module for more information.
§Examples
§One-shot Timer
let timg0 = TimerGroup::new(peripherals.TIMG0);
let mut one_shot = OneShotTimer::new(timg0.timer0);
one_shot.delay_millis(500);
§Periodic Timer
let timg0 = TimerGroup::new(peripherals.TIMG0);
let mut periodic = PeriodicTimer::new(timg0.timer0);
periodic.start(1.secs());
loop {
nb::block!(periodic.wait());
}
Modules§
- Timer Group (TIMG)
Structs§
- Any Timer peripheral.
- A one-shot timer.
- A periodic timer.
Enums§
- Timer errors.
Traits§
- Functionality provided by any timer peripheral.