Module embassy_time::queue
source · Expand description
Timer queue implementation
This module defines the interface a timer queue needs to implement to power the embassy_time
module.
Implementing a timer queue
- Define a struct
MyTimerQueue
- Implement
TimerQueue
for it - Register it as the global timer queue with
timer_queue_impl
.
Linkage details
Check the documentation of the driver
module for more information.
Similarly to driver, if there is none or multiple timer queues in the crate tree, linking will fail.
Example
use core::task::Waker;
use embassy_time::Instant;
use embassy_time::queue::{TimerQueue};
struct MyTimerQueue{}; // not public!
embassy_time::timer_queue_impl!(static QUEUE: MyTimerQueue = MyTimerQueue{});
impl TimerQueue for MyTimerQueue {
fn schedule_wake(&'static self, at: Instant, waker: &Waker) {
todo!()
}
}
Traits
- Timer queue