Module timer

Source
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 and systimer modules 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(Duration::from_secs(1));
loop {
   periodic.wait();
}

Modules§

systimer
System Timer (SYSTIMER)
timg
Timer Group (TIMG)

Structs§

AnyTimer
Any Timer peripheral.
OneShotTimer
A one-shot timer.
PeriodicTimer
A periodic timer.

Enums§

Error
Timer errors.

Traits§

Timer
Functionality provided by any timer peripheral.