Fix interrupt_take macro by specifying path to panic macro.

This commit is contained in:
Matous Hybl 2021-11-16 12:13:43 +01:00
parent d98d18d2ee
commit 0ca6060bfd
15 changed files with 10 additions and 16 deletions

View File

@ -223,7 +223,11 @@ pub fn interrupt_declare(item: TokenStream) -> TokenStream {
};
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]
pub fn interrupt_take(item: TokenStream) -> TokenStream {
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);
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(()) };

View File

@ -5,7 +5,6 @@
#[path = "../example_common.rs"]
mod example_common;
use defmt::panic;
use embassy::executor::Spawner;
use embassy::io::{AsyncBufReadExt, AsyncWriteExt};
use embassy_nrf::buffered_uarte::State;

View File

@ -62,7 +62,6 @@ mod example_common;
use example_common::*;
use cortex_m_rt::entry;
use defmt::panic;
use embassy::executor::{Executor, InterruptExecutor};
use embassy::interrupt::InterruptExt;
use embassy::time::{Duration, Instant, Timer};

View File

@ -5,7 +5,7 @@
#[path = "../example_common.rs"]
mod example_common;
use defmt::{assert_eq, panic};
use defmt::assert_eq;
use embassy::executor::Spawner;
use embassy::traits::flash::Flash;
use embassy_nrf::Peripherals;

View File

@ -6,7 +6,6 @@
mod example_common;
use core::mem;
use defmt::panic;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy::traits::flash::Flash;

View File

@ -5,7 +5,7 @@
#[path = "../example_common.rs"]
mod example_common;
use defmt::{panic, unwrap};
use defmt::unwrap;
use embassy::executor::Spawner;
use embassy::traits::rng::Rng as _;
use embassy_nrf::interrupt;

View File

@ -4,7 +4,6 @@
#[path = "../example_common.rs"]
mod example_common;
use defmt::panic;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_nrf::saadc::{ChannelConfig, Config, Saadc};

View File

@ -4,7 +4,6 @@
#[path = "../example_common.rs"]
mod example_common;
use defmt::panic;
use embassy::executor::Spawner;
use embassy_nrf::ppi::Ppi;
use embassy_nrf::saadc::{ChannelConfig, Config, Saadc, SamplerState};

View File

@ -5,7 +5,6 @@
#[path = "../example_common.rs"]
mod example_common;
use defmt::panic;
use embassy::executor::Spawner;
use embassy_nrf::gpio::{Level, Output, OutputDrive};
use embassy_nrf::Peripherals;

View File

@ -6,7 +6,6 @@
mod example_common;
use example_common::*;
use defmt::panic;
use embassy::{
executor::Spawner,
time::{Duration, Timer},

View File

@ -9,7 +9,7 @@
#[path = "../example_common.rs"]
mod example_common;
use defmt::{panic, *};
use defmt::*;
use embassy::executor::Spawner;
use embassy_nrf::twim::{self, Twim};
use embassy_nrf::{interrupt, Peripherals};

View File

@ -13,7 +13,7 @@ mod example_common;
use core::mem;
use defmt::{panic, *};
use defmt::*;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_nrf::twim::{self, Twim};

View File

@ -6,7 +6,6 @@
mod example_common;
use example_common::*;
use defmt::panic;
use embassy::executor::Spawner;
use embassy::traits::uart::{Read, Write};
use embassy_nrf::gpio::NoPin;

View File

@ -7,7 +7,6 @@ mod example_common;
use embassy_traits::uart::ReadUntilIdle;
use example_common::*;
use defmt::panic;
use embassy::executor::Spawner;
use embassy::traits::uart::Write;
use embassy_nrf::gpio::NoPin;

View File

@ -7,7 +7,6 @@ mod example_common;
use example_common::*;
use defmt::panic;
use embassy::executor::Spawner;
use embassy::io::{AsyncBufReadExt, AsyncWriteExt};
use embassy_stm32::dma::NoDma;