diff --git a/embassy-stm32/gen.py b/embassy-stm32/gen.py index 6cbcde7b..7bbf0b52 100644 --- a/embassy-stm32/gen.py +++ b/embassy-stm32/gen.py @@ -197,6 +197,17 @@ for chip in chips.values(): peripherals!({','.join(peripheral_names)}); """) + + + # ========= exti interrupts + + f.write(f""" + use embassy::interrupt::Interrupt; + use embassy::interrupt::InterruptExt; + + impl_exti_irq!({','.join(exti_interrupts)}); + """) + # ========= interrupts irq_variants = [] @@ -235,14 +246,6 @@ for chip in chips.values(): }} {''.join(irq_declares)} - - pub mod exti {{ - use embassy::interrupt::InterruptExt; - use crate::interrupt; - use super::*; - - impl_exti_irq!({','.join(exti_interrupts)}); - }} }} mod interrupt_vector {{ extern "C" {{ diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index ce6673ba..83245f84 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs @@ -4,7 +4,6 @@ use core::future::Future; use core::marker::PhantomData; use core::pin::Pin; use core::task::{Context, Poll}; -use embassy::interrupt::{Interrupt, InterruptExt}; use embassy::traits::gpio::{WaitForAnyEdge, WaitForFallingEdge, WaitForRisingEdge}; use embassy::util::{AtomicWaker, Unborrow}; use embassy_extras::unsafe_impl_unborrow; @@ -12,7 +11,6 @@ use embedded_hal::digital::v2::InputPin; use pac::exti::{regs, vals}; use crate::gpio::{AnyPin, Input, Pin as GpioPin}; -use crate::interrupt; use crate::pac; use crate::pac::{EXTI, SYSCFG}; use crate::peripherals; @@ -217,14 +215,14 @@ impl_exti!(EXTI15, 15); macro_rules! impl_exti_irq { ($($e:ident),+) => { /// safety: must be called only once - pub(crate) unsafe fn init() { + pub(crate) unsafe fn init_exti() { $( crate::interrupt::$e::steal().enable(); )+ } $( - #[interrupt] + #[crate::interrupt] unsafe fn $e() { crate::exti::on_irq() } diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 0751ac0b..860962f5 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs @@ -50,7 +50,7 @@ pub fn init(_config: Config) -> Peripherals { unsafe { dma::init(); - interrupt::exti::init(); + pac::init_exti(); } p