stm32: codegen interrupts

This commit is contained in:
Dario Nieuwenhuis
2021-05-01 03:07:17 +02:00
parent 71cf742621
commit 7ef5806168
162 changed files with 63977 additions and 1151 deletions

View File

@ -46,17 +46,17 @@ macro_rules! peripherals {
impl Peripherals {
///Returns all the peripherals *once*
#[inline]
pub fn take() -> Option<Self> {
pub(crate) fn take() -> Self {
#[no_mangle]
static mut _EMBASSY_DEVICE_PERIPHERALS: bool = false;
cortex_m::interrupt::free(|_| {
if unsafe { _EMBASSY_DEVICE_PERIPHERALS } {
None
cortex_m::interrupt::free(|_| unsafe {
if _EMBASSY_DEVICE_PERIPHERALS {
panic!("init called twice")
} else {
unsafe { _EMBASSY_DEVICE_PERIPHERALS = true };
Some(unsafe { <Self as embassy::util::Steal>::steal() })
_EMBASSY_DEVICE_PERIPHERALS = true;
<Self as embassy::util::Steal>::steal()
}
})
}