Remove Forever, switch to static_cell.
This commit is contained in:
@ -63,7 +63,7 @@ use embassy_stm32::executor::{Executor, InterruptExecutor};
|
||||
use embassy_stm32::interrupt;
|
||||
use embassy_stm32::interrupt::InterruptExt;
|
||||
use embassy_time::{Duration, Instant, Timer};
|
||||
use embassy_util::Forever;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::task]
|
||||
@ -108,9 +108,9 @@ async fn run_low() {
|
||||
}
|
||||
}
|
||||
|
||||
static EXECUTOR_HIGH: Forever<InterruptExecutor<interrupt::UART4>> = Forever::new();
|
||||
static EXECUTOR_MED: Forever<InterruptExecutor<interrupt::UART5>> = Forever::new();
|
||||
static EXECUTOR_LOW: Forever<Executor> = Forever::new();
|
||||
static EXECUTOR_HIGH: StaticCell<InterruptExecutor<interrupt::UART4>> = StaticCell::new();
|
||||
static EXECUTOR_MED: StaticCell<InterruptExecutor<interrupt::UART5>> = StaticCell::new();
|
||||
static EXECUTOR_LOW: StaticCell<Executor> = StaticCell::new();
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
@ -121,19 +121,19 @@ fn main() -> ! {
|
||||
// High-priority executor: SWI1_EGU1, priority level 6
|
||||
let irq = interrupt::take!(UART4);
|
||||
irq.set_priority(interrupt::Priority::P6);
|
||||
let executor = EXECUTOR_HIGH.put(InterruptExecutor::new(irq));
|
||||
let executor = EXECUTOR_HIGH.init(InterruptExecutor::new(irq));
|
||||
let spawner = executor.start();
|
||||
unwrap!(spawner.spawn(run_high()));
|
||||
|
||||
// Medium-priority executor: SWI0_EGU0, priority level 7
|
||||
let irq = interrupt::take!(UART5);
|
||||
irq.set_priority(interrupt::Priority::P7);
|
||||
let executor = EXECUTOR_MED.put(InterruptExecutor::new(irq));
|
||||
let executor = EXECUTOR_MED.init(InterruptExecutor::new(irq));
|
||||
let spawner = executor.start();
|
||||
unwrap!(spawner.spawn(run_med()));
|
||||
|
||||
// Low priority executor: runs in thread mode, using WFE/SEV
|
||||
let executor = EXECUTOR_LOW.put(Executor::new());
|
||||
let executor = EXECUTOR_LOW.init(Executor::new());
|
||||
executor.run(|spawner| {
|
||||
unwrap!(spawner.spawn(run_low()));
|
||||
});
|
||||
|
Reference in New Issue
Block a user