diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-08-22 15:51:44 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-08-22 16:11:40 +0200 |
| commit | 478f4727846f6a43c28fff3b09cb639c0b800465 (patch) | |
| tree | b1b3f644b77c6fcf4a0bbe2eabe19caba27c4c08 /examples/stm32f3/src | |
| parent | 1b9599025868d3a5d0d8e773593b05df8b2fecf2 (diff) | |
Remove Forever, switch to static_cell.
Diffstat (limited to 'examples/stm32f3/src')
| -rw-r--r-- | examples/stm32f3/src/bin/multiprio.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/stm32f3/src/bin/multiprio.rs b/examples/stm32f3/src/bin/multiprio.rs index e96c31249..9e8228a4b 100644 --- a/examples/stm32f3/src/bin/multiprio.rs +++ b/examples/stm32f3/src/bin/multiprio.rs | |||
| @@ -63,7 +63,7 @@ use embassy_stm32::executor::{Executor, InterruptExecutor}; | |||
| 63 | use embassy_stm32::interrupt; | 63 | use embassy_stm32::interrupt; |
| 64 | use embassy_stm32::interrupt::InterruptExt; | 64 | use embassy_stm32::interrupt::InterruptExt; |
| 65 | use embassy_time::{Duration, Instant, Timer}; | 65 | use embassy_time::{Duration, Instant, Timer}; |
| 66 | use embassy_util::Forever; | 66 | use static_cell::StaticCell; |
| 67 | use {defmt_rtt as _, panic_probe as _}; | 67 | use {defmt_rtt as _, panic_probe as _}; |
| 68 | 68 | ||
| 69 | #[embassy_executor::task] | 69 | #[embassy_executor::task] |
| @@ -108,9 +108,9 @@ async fn run_low() { | |||
| 108 | } | 108 | } |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static EXECUTOR_HIGH: Forever<InterruptExecutor<interrupt::UART4>> = Forever::new(); | 111 | static EXECUTOR_HIGH: StaticCell<InterruptExecutor<interrupt::UART4>> = StaticCell::new(); |
| 112 | static EXECUTOR_MED: Forever<InterruptExecutor<interrupt::UART5>> = Forever::new(); | 112 | static EXECUTOR_MED: StaticCell<InterruptExecutor<interrupt::UART5>> = StaticCell::new(); |
| 113 | static EXECUTOR_LOW: Forever<Executor> = Forever::new(); | 113 | static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new(); |
| 114 | 114 | ||
| 115 | #[entry] | 115 | #[entry] |
| 116 | fn main() -> ! { | 116 | fn main() -> ! { |
| @@ -121,19 +121,19 @@ fn main() -> ! { | |||
| 121 | // High-priority executor: SWI1_EGU1, priority level 6 | 121 | // High-priority executor: SWI1_EGU1, priority level 6 |
| 122 | let irq = interrupt::take!(UART4); | 122 | let irq = interrupt::take!(UART4); |
| 123 | irq.set_priority(interrupt::Priority::P6); | 123 | irq.set_priority(interrupt::Priority::P6); |
| 124 | let executor = EXECUTOR_HIGH.put(InterruptExecutor::new(irq)); | 124 | let executor = EXECUTOR_HIGH.init(InterruptExecutor::new(irq)); |
| 125 | let spawner = executor.start(); | 125 | let spawner = executor.start(); |
| 126 | unwrap!(spawner.spawn(run_high())); | 126 | unwrap!(spawner.spawn(run_high())); |
| 127 | 127 | ||
| 128 | // Medium-priority executor: SWI0_EGU0, priority level 7 | 128 | // Medium-priority executor: SWI0_EGU0, priority level 7 |
| 129 | let irq = interrupt::take!(UART5); | 129 | let irq = interrupt::take!(UART5); |
| 130 | irq.set_priority(interrupt::Priority::P7); | 130 | irq.set_priority(interrupt::Priority::P7); |
| 131 | let executor = EXECUTOR_MED.put(InterruptExecutor::new(irq)); | 131 | let executor = EXECUTOR_MED.init(InterruptExecutor::new(irq)); |
| 132 | let spawner = executor.start(); | 132 | let spawner = executor.start(); |
| 133 | unwrap!(spawner.spawn(run_med())); | 133 | unwrap!(spawner.spawn(run_med())); |
| 134 | 134 | ||
| 135 | // Low priority executor: runs in thread mode, using WFE/SEV | 135 | // Low priority executor: runs in thread mode, using WFE/SEV |
| 136 | let executor = EXECUTOR_LOW.put(Executor::new()); | 136 | let executor = EXECUTOR_LOW.init(Executor::new()); |
| 137 | executor.run(|spawner| { | 137 | executor.run(|spawner| { |
| 138 | unwrap!(spawner.spawn(run_low())); | 138 | unwrap!(spawner.spawn(run_low())); |
| 139 | }); | 139 | }); |
