Fix interrupt_take macro by specifying path to panic macro.
This commit is contained in:
parent
d98d18d2ee
commit
0ca6060bfd
@ -223,7 +223,11 @@ pub fn interrupt_declare(item: TokenStream) -> TokenStream {
|
|||||||
};
|
};
|
||||||
result.into()
|
result.into()
|
||||||
}
|
}
|
||||||
|
/// # interrupt_take procedural macro
|
||||||
|
///
|
||||||
|
/// core::panic! is used as a default way to panic in this macro as there is no sensible way of enabling/disabling defmt for macro generation.
|
||||||
|
/// We are aware that this brings bloat in the form of core::fmt, but the bloat is already included with e.g. array indexing panics.
|
||||||
|
/// To get rid of this bloat, use the compiler flags `-Zbuild-std=core -Zbuild-std-features=panic_immediate_abort`.
|
||||||
#[proc_macro]
|
#[proc_macro]
|
||||||
pub fn interrupt_take(item: TokenStream) -> TokenStream {
|
pub fn interrupt_take(item: TokenStream) -> TokenStream {
|
||||||
let name = syn::parse_macro_input!(item as syn::Ident);
|
let name = syn::parse_macro_input!(item as syn::Ident);
|
||||||
@ -250,7 +254,7 @@ pub fn interrupt_take(item: TokenStream) -> TokenStream {
|
|||||||
static TAKEN: ::embassy::export::atomic::AtomicBool = ::embassy::export::atomic::AtomicBool::new(false);
|
static TAKEN: ::embassy::export::atomic::AtomicBool = ::embassy::export::atomic::AtomicBool::new(false);
|
||||||
|
|
||||||
if TAKEN.compare_exchange(false, true, ::embassy::export::atomic::Ordering::AcqRel, ::embassy::export::atomic::Ordering::Acquire).is_err() {
|
if TAKEN.compare_exchange(false, true, ::embassy::export::atomic::Ordering::AcqRel, ::embassy::export::atomic::Ordering::Acquire).is_err() {
|
||||||
panic!("IRQ Already taken");
|
core::panic!("IRQ Already taken");
|
||||||
}
|
}
|
||||||
|
|
||||||
let irq: interrupt::#name_interrupt = unsafe { ::core::mem::transmute(()) };
|
let irq: interrupt::#name_interrupt = unsafe { ::core::mem::transmute(()) };
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
|
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy::io::{AsyncBufReadExt, AsyncWriteExt};
|
use embassy::io::{AsyncBufReadExt, AsyncWriteExt};
|
||||||
use embassy_nrf::buffered_uarte::State;
|
use embassy_nrf::buffered_uarte::State;
|
||||||
|
@ -62,7 +62,6 @@ mod example_common;
|
|||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::{Executor, InterruptExecutor};
|
use embassy::executor::{Executor, InterruptExecutor};
|
||||||
use embassy::interrupt::InterruptExt;
|
use embassy::interrupt::InterruptExt;
|
||||||
use embassy::time::{Duration, Instant, Timer};
|
use embassy::time::{Duration, Instant, Timer};
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
|
|
||||||
use defmt::{assert_eq, panic};
|
use defmt::assert_eq;
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy::traits::flash::Flash;
|
use embassy::traits::flash::Flash;
|
||||||
use embassy_nrf::Peripherals;
|
use embassy_nrf::Peripherals;
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
mod example_common;
|
mod example_common;
|
||||||
|
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy::time::{Duration, Timer};
|
use embassy::time::{Duration, Timer};
|
||||||
use embassy::traits::flash::Flash;
|
use embassy::traits::flash::Flash;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
|
|
||||||
use defmt::{panic, unwrap};
|
use defmt::unwrap;
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy::traits::rng::Rng as _;
|
use embassy::traits::rng::Rng as _;
|
||||||
use embassy_nrf::interrupt;
|
use embassy_nrf::interrupt;
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy::time::{Duration, Timer};
|
use embassy::time::{Duration, Timer};
|
||||||
use embassy_nrf::saadc::{ChannelConfig, Config, Saadc};
|
use embassy_nrf::saadc::{ChannelConfig, Config, Saadc};
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy_nrf::ppi::Ppi;
|
use embassy_nrf::ppi::Ppi;
|
||||||
use embassy_nrf::saadc::{ChannelConfig, Config, Saadc, SamplerState};
|
use embassy_nrf::saadc::{ChannelConfig, Config, Saadc, SamplerState};
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
|
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy_nrf::gpio::{Level, Output, OutputDrive};
|
use embassy_nrf::gpio::{Level, Output, OutputDrive};
|
||||||
use embassy_nrf::Peripherals;
|
use embassy_nrf::Peripherals;
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
mod example_common;
|
mod example_common;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use defmt::panic;
|
|
||||||
use embassy::{
|
use embassy::{
|
||||||
executor::Spawner,
|
executor::Spawner,
|
||||||
time::{Duration, Timer},
|
time::{Duration, Timer},
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
|
|
||||||
use defmt::{panic, *};
|
use defmt::*;
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy_nrf::twim::{self, Twim};
|
use embassy_nrf::twim::{self, Twim};
|
||||||
use embassy_nrf::{interrupt, Peripherals};
|
use embassy_nrf::{interrupt, Peripherals};
|
||||||
|
@ -13,7 +13,7 @@ mod example_common;
|
|||||||
|
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
|
||||||
use defmt::{panic, *};
|
use defmt::*;
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy::time::{Duration, Timer};
|
use embassy::time::{Duration, Timer};
|
||||||
use embassy_nrf::twim::{self, Twim};
|
use embassy_nrf::twim::{self, Twim};
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
mod example_common;
|
mod example_common;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy::traits::uart::{Read, Write};
|
use embassy::traits::uart::{Read, Write};
|
||||||
use embassy_nrf::gpio::NoPin;
|
use embassy_nrf::gpio::NoPin;
|
||||||
|
@ -7,7 +7,6 @@ mod example_common;
|
|||||||
use embassy_traits::uart::ReadUntilIdle;
|
use embassy_traits::uart::ReadUntilIdle;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy::traits::uart::Write;
|
use embassy::traits::uart::Write;
|
||||||
use embassy_nrf::gpio::NoPin;
|
use embassy_nrf::gpio::NoPin;
|
||||||
|
@ -7,7 +7,6 @@ mod example_common;
|
|||||||
|
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use defmt::panic;
|
|
||||||
use embassy::executor::Spawner;
|
use embassy::executor::Spawner;
|
||||||
use embassy::io::{AsyncBufReadExt, AsyncWriteExt};
|
use embassy::io::{AsyncBufReadExt, AsyncWriteExt};
|
||||||
use embassy_stm32::dma::NoDma;
|
use embassy_stm32::dma::NoDma;
|
||||||
|
Loading…
Reference in New Issue
Block a user