diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-02-09 00:45:52 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-02-09 00:45:52 +0100 |
| commit | d1a968042279152fd8f342406fe89cbe7ad6ce48 (patch) | |
| tree | 1c6f4eb52765f7115afc3f8e69e9bb04959039aa | |
| parent | 940412c034cfc4d86557a3f4669dc9783e89ec22 (diff) | |
stm32: change interrupt declarations from macrotables to build.rs.
| -rw-r--r-- | embassy-stm32/build.rs | 17 | ||||
| -rw-r--r-- | embassy-stm32/src/interrupt.rs | 9 | ||||
| -rw-r--r-- | embassy-stm32/src/lib.rs | 2 |
3 files changed, 18 insertions, 10 deletions
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index c476420d2..8889b0d01 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs | |||
| @@ -85,6 +85,23 @@ fn main() { | |||
| 85 | }); | 85 | }); |
| 86 | 86 | ||
| 87 | // ======== | 87 | // ======== |
| 88 | // Generate interrupt declarations | ||
| 89 | |||
| 90 | let mut irqs = Vec::new(); | ||
| 91 | for irq in METADATA.interrupts { | ||
| 92 | irqs.push(format_ident!("{}", irq.name)); | ||
| 93 | } | ||
| 94 | |||
| 95 | g.extend(quote! { | ||
| 96 | pub mod interrupt { | ||
| 97 | use crate::pac::Interrupt as InterruptEnum; | ||
| 98 | #( | ||
| 99 | embassy::interrupt::declare!(#irqs); | ||
| 100 | )* | ||
| 101 | } | ||
| 102 | }); | ||
| 103 | |||
| 104 | // ======== | ||
| 88 | // Generate DMA IRQs. | 105 | // Generate DMA IRQs. |
| 89 | 106 | ||
| 90 | let mut dma_irqs: HashSet<&str> = HashSet::new(); | 107 | let mut dma_irqs: HashSet<&str> = HashSet::new(); |
diff --git a/embassy-stm32/src/interrupt.rs b/embassy-stm32/src/interrupt.rs index 27e441644..c757b790c 100644 --- a/embassy-stm32/src/interrupt.rs +++ b/embassy-stm32/src/interrupt.rs | |||
| @@ -3,11 +3,4 @@ pub use critical_section::CriticalSection; | |||
| 3 | pub use embassy::interrupt::{take, Interrupt}; | 3 | pub use embassy::interrupt::{take, Interrupt}; |
| 4 | pub use embassy_hal_common::interrupt::Priority4 as Priority; | 4 | pub use embassy_hal_common::interrupt::Priority4 as Priority; |
| 5 | 5 | ||
| 6 | use crate::pac::Interrupt as InterruptEnum; | 6 | pub use crate::generated::interrupt::*; |
| 7 | use embassy::interrupt::declare; | ||
| 8 | |||
| 9 | crate::pac::interrupts!( | ||
| 10 | ($name:ident) => { | ||
| 11 | declare!($name); | ||
| 12 | }; | ||
| 13 | ); | ||
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 75a4d22d8..89b2be582 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs | |||
| @@ -63,8 +63,6 @@ mod generated { | |||
| 63 | #![allow(unused_imports)] | 63 | #![allow(unused_imports)] |
| 64 | #![allow(non_snake_case)] | 64 | #![allow(non_snake_case)] |
| 65 | 65 | ||
| 66 | use crate::interrupt; | ||
| 67 | |||
| 68 | include!(concat!(env!("OUT_DIR"), "/generated.rs")); | 66 | include!(concat!(env!("OUT_DIR"), "/generated.rs")); |
| 69 | } | 67 | } |
| 70 | pub use embassy_macros::interrupt; | 68 | pub use embassy_macros::interrupt; |
