diff --git a/Cargo.toml b/Cargo.toml index 4515b020..25e30eff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,7 @@ members = [ panic-probe = { git = "https://github.com/knurling-rs/probe-run", branch="main" } defmt-rtt = { git = "https://github.com/knurling-rs/defmt", branch="cursed-symbol-names-linkers-must-repent-for-their-sins" } defmt = { git = "https://github.com/knurling-rs/defmt", branch="cursed-symbol-names-linkers-must-repent-for-their-sins" } -static-executor = { git = "https://github.com/Dirbaio/static-executor" } -static-executor-cortex-m = { git = "https://github.com/Dirbaio/static-executor" } +static-executor = { git = "https://github.com/Dirbaio/static-executor", branch="multi"} [profile.dev] codegen-units = 1 diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 15716a54..5194e4f4 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -27,5 +27,4 @@ nrf52840-hal = { version = "0.11.0" } embassy = { version = "0.1.0", path = "../embassy" } embassy-nrf = { version = "0.1.0", path = "../embassy-nrf", features = ["defmt-trace", "52840"] } static-executor = { version = "0.1.0", features=["defmt"]} -static-executor-cortex-m = { version = "0.1.0" } futures = { version = "0.3.5", default-features = false } diff --git a/examples/src/bin/gpiote.rs b/examples/src/bin/gpiote.rs index f55b0386..b3a391f1 100644 --- a/examples/src/bin/gpiote.rs +++ b/examples/src/bin/gpiote.rs @@ -13,7 +13,10 @@ use embassy_nrf::gpiote; use futures::pin_mut; use nrf52840_hal::gpio; -#[static_executor::task] +use static_executor::{task, Executor}; +static EXECUTOR: Executor = Executor::new(|| cortex_m::asm::sev()); + +#[task] async fn run() { let p = embassy_nrf::pac::Peripherals::take().dewrap(); let port0 = gpio::p0::Parts::new(p.P0); @@ -78,7 +81,11 @@ fn main() -> ! { info!("Hello World!"); unsafe { - run.spawn().dewrap(); - static_executor::run(); + EXECUTOR.spawn(run()).dewrap(); + + loop { + EXECUTOR.run(); + cortex_m::asm::wfe(); + } } } diff --git a/examples/src/bin/qspi.rs b/examples/src/bin/qspi.rs index 395422e7..4e6ee53e 100644 --- a/examples/src/bin/qspi.rs +++ b/examples/src/bin/qspi.rs @@ -11,6 +11,9 @@ use embassy::flash::Flash; use embassy_nrf::qspi; use nrf52840_hal::gpio; +use static_executor::{task, Executor}; +static EXECUTOR: Executor = Executor::new(|| cortex_m::asm::sev()); + const PAGE_SIZE: usize = 4096; // Workaround for alignment requirements. @@ -18,7 +21,7 @@ const PAGE_SIZE: usize = 4096; #[repr(C, align(4))] struct AlignedBuf([u8; 4096]); -#[static_executor::task] +#[task] async fn run() { let p = embassy_nrf::pac::Peripherals::take().dewrap(); @@ -117,7 +120,11 @@ fn main() -> ! { info!("Hello World!"); unsafe { - run.spawn().dewrap(); - static_executor::run(); + EXECUTOR.spawn(run()).dewrap(); + + loop { + EXECUTOR.run(); + cortex_m::asm::wfe(); + } } } diff --git a/examples/src/bin/uart.rs b/examples/src/bin/uart.rs index 21e26e3a..6b9df380 100644 --- a/examples/src/bin/uart.rs +++ b/examples/src/bin/uart.rs @@ -12,7 +12,10 @@ use embassy_nrf::uarte; use futures::pin_mut; use nrf52840_hal::gpio; -#[static_executor::task] +use static_executor::{task, Executor}; +static EXECUTOR: Executor = Executor::new(|| cortex_m::asm::sev()); + +#[task] async fn run() { let p = embassy_nrf::pac::Peripherals::take().dewrap(); @@ -66,7 +69,11 @@ fn main() -> ! { info!("Hello World!"); unsafe { - run.spawn().dewrap(); - static_executor::run(); + EXECUTOR.spawn(run()).dewrap(); + + loop { + EXECUTOR.run(); + cortex_m::asm::wfe(); + } } } diff --git a/examples/src/example_common.rs b/examples/src/example_common.rs index e9919153..65bfe6bb 100644 --- a/examples/src/example_common.rs +++ b/examples/src/example_common.rs @@ -3,7 +3,6 @@ use defmt_rtt as _; // global logger use nrf52840_hal as _; use panic_probe as _; -use static_executor_cortex_m as _; pub use defmt::{info, intern};