diff options
| author | Dion Dokter <[email protected]> | 2025-09-08 12:33:04 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-09-11 14:45:41 +0200 |
| commit | 09701a339d9085d86a69bf271299d7b59eda9fdc (patch) | |
| tree | 8e0a7439cf887f64e0f5e25309ce52f1ae483d63 /examples | |
| parent | 401fac6ea95b6dd16492d784f99f07fb9a1b318b (diff) | |
Fix example
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/nrf52840-edf/Cargo.toml | 4 | ||||
| -rw-r--r-- | examples/nrf52840-edf/src/bin/basic.rs | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/nrf52840-edf/Cargo.toml b/examples/nrf52840-edf/Cargo.toml index 4c0d910ea..1e8803233 100644 --- a/examples/nrf52840-edf/Cargo.toml +++ b/examples/nrf52840-edf/Cargo.toml | |||
| @@ -6,8 +6,8 @@ license = "MIT OR Apache-2.0" | |||
| 6 | publish = false | 6 | publish = false |
| 7 | 7 | ||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | # NOTE: "edf-scheduler" feature is enabled | 9 | # NOTE: "scheduler-deadline" and "embassy-time-driver" features are enabled |
| 10 | embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "edf-scheduler"] } | 10 | embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "scheduler-deadline", "embassy-time-driver"] } |
| 11 | embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 11 | embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 12 | embassy-nrf = { version = "0.7.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } | 12 | embassy-nrf = { version = "0.7.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } |
| 13 | 13 | ||
diff --git a/examples/nrf52840-edf/src/bin/basic.rs b/examples/nrf52840-edf/src/bin/basic.rs index 8a8e46449..d888e17d1 100644 --- a/examples/nrf52840-edf/src/bin/basic.rs +++ b/examples/nrf52840-edf/src/bin/basic.rs | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | use core::sync::atomic::{compiler_fence, Ordering}; | 15 | use core::sync::atomic::{compiler_fence, Ordering}; |
| 16 | 16 | ||
| 17 | use defmt::unwrap; | 17 | use defmt::unwrap; |
| 18 | use embassy_executor::raw::Deadline; | ||
| 19 | use embassy_executor::Spawner; | 18 | use embassy_executor::Spawner; |
| 20 | use embassy_time::{Duration, Instant, Timer}; | 19 | use embassy_time::{Duration, Instant, Timer}; |
| 21 | use {defmt_rtt as _, panic_probe as _}; | 20 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -127,7 +126,8 @@ async fn main(spawner: Spawner) { | |||
| 127 | let start = Instant::now(); | 126 | let start = Instant::now(); |
| 128 | // Set the deadline to ~2x the theoretical time. In practice, setting any deadline | 127 | // Set the deadline to ~2x the theoretical time. In practice, setting any deadline |
| 129 | // here elevates the current task above all other worker tasks. | 128 | // here elevates the current task above all other worker tasks. |
| 130 | Deadline::set_current_task_deadline_after(theoretical * 2).await; | 129 | let meta = embassy_executor::Metadata::for_current_task().await; |
| 130 | meta.set_deadline_after(theoretical * 2); | ||
| 131 | 131 | ||
| 132 | // Perform the trial | 132 | // Perform the trial |
| 133 | for _ in 0..num_steps { | 133 | for _ in 0..num_steps { |
| @@ -147,7 +147,7 @@ async fn main(spawner: Spawner) { | |||
| 147 | 147 | ||
| 148 | // Unset the deadline, deadlines are not automatically cleared, and if our | 148 | // Unset the deadline, deadlines are not automatically cleared, and if our |
| 149 | // deadline is in the past, then we get very high priority! | 149 | // deadline is in the past, then we get very high priority! |
| 150 | Deadline::clear_current_task_deadline().await; | 150 | meta.unset_deadline(); |
| 151 | 151 | ||
| 152 | Timer::after_millis(500).await; | 152 | Timer::after_millis(500).await; |
| 153 | } | 153 | } |
