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),*); 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. // Generate DMA IRQs.

View File

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

View File

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