diff --git a/embassy-macros/src/lib.rs b/embassy-macros/src/lib.rs index 0708b17e..c3ccb6d0 100644 --- a/embassy-macros/src/lib.rs +++ b/embassy-macros/src/lib.rs @@ -121,10 +121,10 @@ pub fn interrupt_declare(item: TokenStream) -> TokenStream { pub struct #name_interrupt(()); unsafe impl OwnedInterrupt for #name_interrupt { type Priority = Priority; - fn number(&self) -> u8 { - use cortex_m::interrupt::Nr; + fn number(&self) -> u16 { + use cortex_m::interrupt::InterruptNumber; let irq = Interrupt::#name; - irq.nr() as u8 + irq.number() as u16 } unsafe fn steal() -> Self { Self(()) diff --git a/embassy-nrf-examples/Cargo.toml b/embassy-nrf-examples/Cargo.toml index 89d0cabb..21f0bdd9 100644 --- a/embassy-nrf-examples/Cargo.toml +++ b/embassy-nrf-examples/Cargo.toml @@ -23,7 +23,7 @@ embassy-nrf = { version = "0.1.0", path = "../embassy-nrf", features = ["defmt", defmt = "0.1.3" defmt-rtt = "0.1.0" -cortex-m = { version = "0.6.3" } +cortex-m = "0.7.1" cortex-m-rt = "0.6.13" embedded-hal = { version = "0.2.4" } panic-probe = "0.1.0" diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml index eb5370ea..239aa3c4 100644 --- a/embassy-nrf/Cargo.toml +++ b/embassy-nrf/Cargo.toml @@ -24,7 +24,7 @@ embassy = { version = "0.1.0", path = "../embassy" } defmt = { version = "0.1.3", optional = true } log = { version = "0.4.11", optional = true } cortex-m-rt = "0.6.13" -cortex-m = { version = "0.6.4" } +cortex-m = "0.7.1" embedded-hal = { version = "0.2.4" } embedded-dma = { version = "0.1.2" } diff --git a/embassy-stm32f4-examples/Cargo.toml b/embassy-stm32f4-examples/Cargo.toml index dccde1d0..e81f85ff 100644 --- a/embassy-stm32f4-examples/Cargo.toml +++ b/embassy-stm32f4-examples/Cargo.toml @@ -23,7 +23,7 @@ embassy-stm32f4 = { version = "*", path = "../embassy-stm32f4", features = ["stm defmt = "0.1.3" defmt-rtt = "0.1.0" -cortex-m = { version = "0.6.3" } +cortex-m = "0.7.1" cortex-m-rt = "0.6.13" embedded-hal = { version = "0.2.4" } panic-probe = "0.1.0" diff --git a/embassy-stm32f4/Cargo.toml b/embassy-stm32f4/Cargo.toml index a18d16e2..afe6e8cc 100644 --- a/embassy-stm32f4/Cargo.toml +++ b/embassy-stm32f4/Cargo.toml @@ -35,7 +35,7 @@ embassy = { version = "0.1.0", path = "../embassy" } defmt = { version = "0.1.3", optional = true } log = { version = "0.4.11", optional = true } cortex-m-rt = "0.6.13" -cortex-m = { version = "0.6.4" } +cortex-m = "0.7.1" embedded-hal = { version = "0.2.4" } embedded-dma = { version = "0.1.2" } stm32f4xx-hal = { version = "0.8.3", features = ["rt"], git = "https://github.com/stm32-rs/stm32f4xx-hal.git"} diff --git a/embassy/Cargo.toml b/embassy/Cargo.toml index 1d16d111..1799fad2 100644 --- a/embassy/Cargo.toml +++ b/embassy/Cargo.toml @@ -16,7 +16,7 @@ defmt-error = [] defmt = { version = "0.1.3", optional = true } log = { version = "0.4.11", optional = true } -cortex-m = "0.6.4" +cortex-m = "0.7.1" futures = { version = "0.3.5", default-features = false } pin-project = { version = "1.0.2", default-features = false } embassy-macros = { version = "0.1.0", path = "../embassy-macros"} diff --git a/embassy/src/executor/mod.rs b/embassy/src/executor/mod.rs index 65db28fc..592ab235 100644 --- a/embassy/src/executor/mod.rs +++ b/embassy/src/executor/mod.rs @@ -204,10 +204,11 @@ impl Executor { } } -fn pend_by_number(n: u8) { - struct N(u8); - unsafe impl cortex_m::interrupt::Nr for N { - fn nr(&self) -> u8 { +fn pend_by_number(n: u16) { + #[derive(Clone, Copy)] + struct N(u16); + unsafe impl cortex_m::interrupt::InterruptNumber for N { + fn number(self) -> u16 { self.0 } } @@ -225,7 +226,7 @@ impl IrqExecutor { let ctx = irq.number() as *mut (); Self { irq, - inner: raw::Executor::new(|ctx| pend_by_number(ctx as u8), ctx), + inner: raw::Executor::new(|ctx| pend_by_number(ctx as u16), ctx), not_send: PhantomData, } } diff --git a/embassy/src/interrupt.rs b/embassy/src/interrupt.rs index 9ed0d329..db75ffe9 100644 --- a/embassy/src/interrupt.rs +++ b/embassy/src/interrupt.rs @@ -21,16 +21,17 @@ impl Handler { } } -struct NrWrap(u8); -unsafe impl cortex_m::interrupt::Nr for NrWrap { - fn nr(&self) -> u8 { +#[derive(Clone, Copy)] +pub(crate) struct NrWrap(pub(crate) u16); +unsafe impl cortex_m::interrupt::InterruptNumber for NrWrap { + fn number(self) -> u16 { self.0 } } pub unsafe trait OwnedInterrupt { type Priority: From + Into + Copy; - fn number(&self) -> u8; + fn number(&self) -> u16; unsafe fn steal() -> Self; /// Implementation detail, do not use outside embassy crates. diff --git a/embassy/src/util/signal.rs b/embassy/src/util/signal.rs index 89cc03f2..75ac1298 100644 --- a/embassy/src/util/signal.rs +++ b/embassy/src/util/signal.rs @@ -110,7 +110,7 @@ impl<'a, I: OwnedInterrupt> InterruptFuture<'a, I> { executor::raw::wake_task(ptr::NonNull::new_unchecked(ctx as _)); } - NVIC::mask(NrWrap(irq)); + NVIC::mask(crate::interrupt::NrWrap(irq as u16)); } }