diff --git a/esp-hal-embassy/src/timer_queue.rs b/esp-hal-embassy/src/timer_queue.rs index 35d6d51d0b..15a7ade43b 100644 --- a/esp-hal-embassy/src/timer_queue.rs +++ b/esp-hal-embassy/src/timer_queue.rs @@ -20,7 +20,7 @@ unsafe impl Sync for TimerQueue {} impl TimerQueue { pub(crate) const fn new(prio: Priority) -> Self { Self { - inner: Mutex::const_new(RawPriorityLimitedMutex::new(prio), adapter::new_queue()), + inner: Mutex::const_new(RawPriorityLimitedMutex::new(prio), RawQueue::new()), priority: prio, #[cfg(not(single_queue))] context: Cell::new(core::ptr::null_mut()), @@ -90,10 +90,6 @@ mod adapter { pub(super) type RawQueue = raw::timer_queue::TimerQueue; - pub(super) const fn new_queue() -> RawQueue { - raw::timer_queue::TimerQueue::new() - } - pub(super) fn dequeue(q: &RawQueue, now: u64) -> u64 { unsafe { q.next_expiration(now, embassy_executor::raw::wake_task) } } @@ -111,16 +107,10 @@ mod adapter { mod adapter { use core::{cell::RefCell, task::Waker}; - pub(super) type RawQueue = RefCell< - embassy_time_queue_driver::queue_generic::Queue< - { esp_config::esp_config_int!(usize, "ESP_HAL_EMBASSY_GENERIC_QUEUE_SIZE") }, - >, + pub(super) type RawQueue = embassy_time_queue_driver::queue_generic::RefCellQueue< + { esp_config::esp_config_int!(usize, "ESP_HAL_EMBASSY_GENERIC_QUEUE_SIZE") }, >; - pub(super) const fn new_queue() -> RawQueue { - RefCell::new(embassy_time_queue_driver::queue_generic::Queue::new()) - } - pub(super) fn dequeue(q: &RawQueue, now: u64) -> u64 { q.borrow_mut().next_expiration(now) }