macros/interrupt_take: do not assume embassy-executor is a dependency of the user crate.
This commit is contained in:
parent
2649f13dc7
commit
ef9e373ec4
@ -6,6 +6,12 @@ use cortex_m::peripheral::NVIC;
|
|||||||
use embassy_hal_common::Peripheral;
|
use embassy_hal_common::Peripheral;
|
||||||
pub use embassy_macros::cortex_m_interrupt_take as take;
|
pub use embassy_macros::cortex_m_interrupt_take as take;
|
||||||
|
|
||||||
|
/// Do not use. Used for macros only. Not covered by semver guarantees.
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub mod _export {
|
||||||
|
pub use atomic_polyfill as atomic;
|
||||||
|
}
|
||||||
|
|
||||||
/// Implementation detail, do not use outside embassy crates.
|
/// Implementation detail, do not use outside embassy crates.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub struct Handler {
|
pub struct Handler {
|
||||||
|
@ -16,15 +16,15 @@ pub fn run(name: syn::Ident) -> Result<TokenStream, TokenStream> {
|
|||||||
static HANDLER: interrupt::Handler;
|
static HANDLER: interrupt::Handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
let func = HANDLER.func.load(::embassy_executor::export::atomic::Ordering::Relaxed);
|
let func = HANDLER.func.load(interrupt::_export::atomic::Ordering::Relaxed);
|
||||||
let ctx = HANDLER.ctx.load(::embassy_executor::export::atomic::Ordering::Relaxed);
|
let ctx = HANDLER.ctx.load(interrupt::_export::atomic::Ordering::Relaxed);
|
||||||
let func: fn(*mut ()) = ::core::mem::transmute(func);
|
let func: fn(*mut ()) = ::core::mem::transmute(func);
|
||||||
func(ctx)
|
func(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static TAKEN: ::embassy_executor::export::atomic::AtomicBool = ::embassy_executor::export::atomic::AtomicBool::new(false);
|
static TAKEN: interrupt::_export::atomic::AtomicBool = interrupt::_export::atomic::AtomicBool::new(false);
|
||||||
|
|
||||||
if TAKEN.compare_exchange(false, true, ::embassy_executor::export::atomic::Ordering::AcqRel, ::embassy_executor::export::atomic::Ordering::Acquire).is_err() {
|
if TAKEN.compare_exchange(false, true, interrupt::_export::atomic::Ordering::AcqRel, interrupt::_export::atomic::Ordering::Acquire).is_err() {
|
||||||
core::panic!("IRQ Already taken");
|
core::panic!("IRQ Already taken");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user