Update to cortex-m 0.7

This commit is contained in:
Dario Nieuwenhuis
2021-02-14 23:26:50 +01:00
parent 957741c10f
commit 7321ddb0b3
9 changed files with 20 additions and 18 deletions

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