Merge pull request #46 from akiles/cm07

Update to cortex-m 0.7
This commit is contained in:
Dario Nieuwenhuis 2021-02-14 23:38:08 +01:00 committed by GitHub
commit e454969000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 20 additions and 18 deletions

View File

@ -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(())

View File

@ -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"

View File

@ -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" }

View File

@ -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"

View File

@ -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"}

View File

@ -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"}

View File

@ -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<I: OwnedInterrupt> IrqExecutor<I> {
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,
}
}

View File

@ -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<u8> + Into<u8> + Copy;
fn number(&self) -> u8;
fn number(&self) -> u16;
unsafe fn steal() -> Self;
/// Implementation detail, do not use outside embassy crates.

View File

@ -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));
}
}