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:
Dario Nieuwenhuis 2021-10-16 04:11:19 +02:00
parent 05bc4d198e
commit 4c0fa03c14

View file

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