Skip to content

Commit

Permalink
Fix build without any queue impl selected
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Dec 6, 2024
1 parent ab3c3de commit cd40cec
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions esp-hal-embassy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ embassy-executor = { version = "0.6.3", optional = true }
embassy-sync = { version = "0.6.1" }
embassy-time = { version = "0.3.0" }
embassy-time-driver = { version = "0.1.0", features = [ "tick-hz-1_000_000" ] }
embassy-time-queue-driver = { version = "0.1.0" }
embassy-time-queue-driver = { version = "0.1.0", features = ["generic-queue-const-generic"] }
esp-config = { version = "0.2.0", path = "../esp-config" }
esp-hal = { version = "0.22.0", path = "../esp-hal" }
log = { version = "0.4.22", optional = true }
Expand Down Expand Up @@ -53,7 +53,7 @@ executors = ["dep:embassy-executor", "esp-hal/__esp_hal_embassy"]
integrated-timers = ["embassy-executor?/integrated-timers", "executors"]
## Implement a generic timer queue. This option is useful if you intend to use a different executor
## than `embassy-executor`.
generic-queue = ["single-queue", "embassy-time-queue-driver/generic-queue-const-generic"]
generic-queue = ["single-queue"]
## Use a single, global timer queue. This option only needs a single alarm, no matter how many
## executors are used.
single-queue = []
Expand Down
4 changes: 2 additions & 2 deletions esp-hal-embassy/src/time_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,14 @@ fn not_enough_timers() -> ! {
}

pub(crate) struct TimerQueueDriver {
#[cfg(feature = "single-queue")]
#[cfg(any(feature = "single-queue", not(feature = "integrated-timers")))]
pub(crate) inner: crate::timer_queue::TimerQueue,
}

impl TimerQueueDriver {
const fn new() -> Self {
Self {
#[cfg(feature = "single-queue")]
#[cfg(any(feature = "single-queue", not(feature = "integrated-timers")))]
inner: crate::timer_queue::TimerQueue::new(Priority::max()),
}
}
Expand Down
4 changes: 2 additions & 2 deletions esp-hal-embassy/src/timer_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ impl embassy_time_queue_driver::TimerQueue for crate::time_driver::TimerQueueDri
#[cfg(feature = "integrated-timers")]
let waker = embassy_executor::raw::task_from_waker(waker);

#[cfg(not(feature = "single-queue"))]
#[cfg(all(feature = "integrated-timers", not(feature = "single-queue")))]
unsafe {
let executor = &*(waker.executor().unwrap_unchecked()
as *const embassy_executor::raw::Executor)
.cast::<crate::executor::InnerExecutor>();
executor.timer_queue.schedule_wake(waker, at);
}

#[cfg(feature = "single-queue")]
#[cfg(any(feature = "single-queue", not(feature = "integrated-timers")))]
self.inner.schedule_wake(waker, at);
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ esp32s3 = ["esp-hal/esp32s3", "esp-backtrace/esp32s3", "esp-hal-embassy?/esp32s3
esp-wifi = ["dep:esp-wifi"]

embassy = ["dep:esp-hal-embassy"]
embassy-generic-timers = ["embassy-time/generic-queue-8"]
embassy-generic-queue = ["esp-hal-embassy/generic-queue"]

[profile.release]
codegen-units = 1
Expand Down

0 comments on commit cd40cec

Please sign in to comment.