stm32: change interrupt declarations from macrotables to build.rs.

This commit is contained in:
Dario Nieuwenhuis 2022-02-09 00:45:52 +01:00
parent 940412c034
commit d1a9680422
3 changed files with 18 additions and 10 deletions

View file

@ -84,6 +84,23 @@ fn main() {
embassy_hal_common::peripherals!(#(#singleton_tokens),*);
});
// ========
// Generate interrupt declarations
let mut irqs = Vec::new();
for irq in METADATA.interrupts {
irqs.push(format_ident!("{}", irq.name));
}
g.extend(quote! {
pub mod interrupt {
use crate::pac::Interrupt as InterruptEnum;
#(
embassy::interrupt::declare!(#irqs);
)*
}
});
// ========
// Generate DMA IRQs.

View file

@ -3,11 +3,4 @@ pub use critical_section::CriticalSection;
pub use embassy::interrupt::{take, Interrupt};
pub use embassy_hal_common::interrupt::Priority4 as Priority;
use crate::pac::Interrupt as InterruptEnum;
use embassy::interrupt::declare;
crate::pac::interrupts!(
($name:ident) => {
declare!($name);
};
);
pub use crate::generated::interrupt::*;

View file

@ -63,8 +63,6 @@ mod generated {
#![allow(unused_imports)]
#![allow(non_snake_case)]
use crate::interrupt;
include!(concat!(env!("OUT_DIR"), "/generated.rs"));
}
pub use embassy_macros::interrupt;