interrupt: transmute instead of steal.
That steal method has a TAKEN=true write [here](6b013138b7/src/peripheral/mod.rs (L180)
).
This is not zero cost, we don't want it. Transmute instead, which is zero cost.
This commit is contained in:
parent
05bc4d198e
commit
4c0fa03c14
1 changed files with 4 additions and 5 deletions
|
@ -1,8 +1,8 @@
|
||||||
|
use atomic_polyfill::{compiler_fence, AtomicPtr, Ordering};
|
||||||
|
use core::mem;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use cortex_m::peripheral::NVIC;
|
use cortex_m::peripheral::NVIC;
|
||||||
|
|
||||||
use atomic_polyfill::{compiler_fence, AtomicPtr, Ordering};
|
|
||||||
|
|
||||||
pub use embassy_macros::interrupt_declare as declare;
|
pub use embassy_macros::interrupt_declare as declare;
|
||||||
pub use embassy_macros::interrupt_take as take;
|
pub use embassy_macros::interrupt_take as take;
|
||||||
|
|
||||||
|
@ -124,9 +124,8 @@ impl<T: Interrupt + ?Sized> InterruptExt for T {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn set_priority(&self, prio: Self::Priority) {
|
fn set_priority(&self, prio: Self::Priority) {
|
||||||
unsafe {
|
unsafe {
|
||||||
cortex_m::peripheral::Peripherals::steal()
|
let mut nvic: cortex_m::peripheral::NVIC = mem::transmute(());
|
||||||
.NVIC
|
nvic.set_priority(NrWrap(self.number()), prio.into())
|
||||||
.set_priority(NrWrap(self.number()), prio.into())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue