pub fn init(time_driver: impl TimerCollection)Expand description
Initialize embassy.
Call this as soon as possible, before the first timer-related operation.
The time driver can be one of a number of different options:
- A timg
Timerinstance - A systimer
Alarminstance - An
AnyTimerinstance - A
OneShotTimerinstance - A mutable static slice of
OneShotTimerinstances - A mutable static array of
OneShotTimerinstances - A 2, 3, 4 element array of
AnyTimerinstances
ยงExamples
use esp_hal::timer::timg::TimerGroup;
let timg0 = TimerGroup::new(peripherals.TIMG0);
esp_hal_embassy::init(timg0.timer0);
// ... now you can spawn embassy tasks or use `Timer::after` etc.