Crate embassy_time_queue_driver
source ·Expand description
embassy-time-queue-driver
This crate contains the driver trait used by the embassy-time
timer queue.
You should rarely need to use this crate directly. Only use it when implementing your own timer queue.
There is two timer queue implementations, one in embassy-time
enabled by the generic-queue
feature, and
another in embassy-executor
enabled by the integrated-timers
feature.
Implementing a timer queue
- Define a struct
MyTimerQueue
- Implement
TimerQueue
for it - Register it as the global timer queue with
timer_queue_impl
.
Example
use core::task::Waker;
use embassy_time::Instant;
use embassy_time::queue::{TimerQueue};
struct MyTimerQueue{}; // not public!
impl TimerQueue for MyTimerQueue {
fn schedule_wake(&'static self, at: u64, waker: &Waker) {
todo!()
}
}
embassy_time_queue_driver::timer_queue_impl!(static QUEUE: MyTimerQueue = MyTimerQueue{});
Macros
- Set the TimerQueue implementation.
Traits
- Timer queue
Functions
- Schedule the given waker to be woken at
at
.