aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2021-02-26 01:55:27 +0100
committerDario Nieuwenhuis <[email protected]>2021-02-26 01:55:27 +0100
commit11be9170ec018dcc9284b413c5313ce7bb07159f (patch)
treeb9a1663a24af2dc0a1c860667d2db00f03d391a7
parent90476ef9005e391e9a9c9e5c4f0d82ceccdf7c11 (diff)
Cleanup interrupt package naming. Fixes #40
The `interrupt` package previously tried to be drop-in compatible with the `interrupt` package from PACs. THis meant that there was both a PAC-style enum value `UARTE0` and an embassy-style owned `UARTE0Interrupt` type. This made things VERY confusing. This drops compatibility with the PAC, improving the names for embassy interrupts.
-rw-r--r--embassy-macros/src/lib.rs10
-rw-r--r--embassy-nrf-examples/src/bin/multiprio.rs6
-rw-r--r--embassy-nrf/src/buffered_uarte.rs8
-rw-r--r--embassy-nrf/src/gpiote.rs4
-rw-r--r--embassy-nrf/src/interrupt.rs4
-rw-r--r--embassy-nrf/src/lib.rs2
-rw-r--r--embassy-nrf/src/qspi.rs4
-rw-r--r--embassy-nrf/src/rtc.rs10
-rw-r--r--embassy-nrf/src/uarte.rs8
-rw-r--r--embassy-nrf/src/util/peripheral.rs4
-rw-r--r--embassy-stm32f4/src/exti.rs350
-rw-r--r--embassy-stm32f4/src/interrupt.rs4
-rw-r--r--embassy-stm32f4/src/lib.rs2
-rw-r--r--embassy-stm32f4/src/rtc.rs16
-rw-r--r--embassy-stm32f4/src/serial.rs14
-rw-r--r--embassy/src/executor/mod.rs6
-rw-r--r--embassy/src/interrupt.rs2
-rw-r--r--embassy/src/util/signal.rs12
18 files changed, 229 insertions, 237 deletions
diff --git a/embassy-macros/src/lib.rs b/embassy-macros/src/lib.rs
index e77cd9bc2..8276f0bbc 100644
--- a/embassy-macros/src/lib.rs
+++ b/embassy-macros/src/lib.rs
@@ -114,17 +114,17 @@ pub fn task(args: TokenStream, item: TokenStream) -> TokenStream {
114pub fn interrupt_declare(item: TokenStream) -> TokenStream { 114pub fn interrupt_declare(item: TokenStream) -> TokenStream {
115 let name = syn::parse_macro_input!(item as syn::Ident); 115 let name = syn::parse_macro_input!(item as syn::Ident);
116 let name = format_ident!("{}", name); 116 let name = format_ident!("{}", name);
117 let name_interrupt = format_ident!("{}Interrupt", name); 117 let name_interrupt = format_ident!("{}", name);
118 let name_handler = format!("__EMBASSY_{}_HANDLER", name); 118 let name_handler = format!("__EMBASSY_{}_HANDLER", name);
119 119
120 let result = quote! { 120 let result = quote! {
121 #[allow(non_camel_case_types)] 121 #[allow(non_camel_case_types)]
122 pub struct #name_interrupt(()); 122 pub struct #name_interrupt(());
123 unsafe impl OwnedInterrupt for #name_interrupt { 123 unsafe impl Interrupt for #name_interrupt {
124 type Priority = Priority; 124 type Priority = crate::interrupt::Priority;
125 fn number(&self) -> u16 { 125 fn number(&self) -> u16 {
126 use cortex_m::interrupt::InterruptNumber; 126 use cortex_m::interrupt::InterruptNumber;
127 let irq = Interrupt::#name; 127 let irq = crate::pac::interrupt::#name;
128 irq.number() as u16 128 irq.number() as u16
129 } 129 }
130 unsafe fn steal() -> Self { 130 unsafe fn steal() -> Self {
@@ -144,7 +144,7 @@ pub fn interrupt_declare(item: TokenStream) -> TokenStream {
144pub fn interrupt_take(item: TokenStream) -> TokenStream { 144pub fn interrupt_take(item: TokenStream) -> TokenStream {
145 let name = syn::parse_macro_input!(item as syn::Ident); 145 let name = syn::parse_macro_input!(item as syn::Ident);
146 let name = format!("{}", name); 146 let name = format!("{}", name);
147 let name_interrupt = format_ident!("{}Interrupt", name); 147 let name_interrupt = format_ident!("{}", name);
148 let name_handler = format!("__EMBASSY_{}_HANDLER", name); 148 let name_handler = format!("__EMBASSY_{}_HANDLER", name);
149 149
150 let result = quote! { 150 let result = quote! {
diff --git a/embassy-nrf-examples/src/bin/multiprio.rs b/embassy-nrf-examples/src/bin/multiprio.rs
index 1791a85e6..850ef8fc0 100644
--- a/embassy-nrf-examples/src/bin/multiprio.rs
+++ b/embassy-nrf-examples/src/bin/multiprio.rs
@@ -68,7 +68,7 @@ use nrf52840_hal::clocks;
68use embassy::executor::{task, Executor, IrqExecutor}; 68use embassy::executor::{task, Executor, IrqExecutor};
69use embassy::time::{Duration, Instant, Timer}; 69use embassy::time::{Duration, Instant, Timer};
70use embassy::util::Forever; 70use embassy::util::Forever;
71use embassy_nrf::interrupt::OwnedInterrupt; 71use embassy_nrf::interrupt::Interrupt;
72use embassy_nrf::{interrupt, pac, rtc}; 72use embassy_nrf::{interrupt, pac, rtc};
73 73
74#[task] 74#[task]
@@ -115,9 +115,9 @@ async fn run_low() {
115 115
116static RTC: Forever<rtc::RTC<pac::RTC1>> = Forever::new(); 116static RTC: Forever<rtc::RTC<pac::RTC1>> = Forever::new();
117static ALARM_HIGH: Forever<rtc::Alarm<pac::RTC1>> = Forever::new(); 117static ALARM_HIGH: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
118static EXECUTOR_HIGH: Forever<IrqExecutor<interrupt::SWI1_EGU1Interrupt>> = Forever::new(); 118static EXECUTOR_HIGH: Forever<IrqExecutor<interrupt::SWI1_EGU1>> = Forever::new();
119static ALARM_MED: Forever<rtc::Alarm<pac::RTC1>> = Forever::new(); 119static ALARM_MED: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
120static EXECUTOR_MED: Forever<IrqExecutor<interrupt::SWI0_EGU0Interrupt>> = Forever::new(); 120static EXECUTOR_MED: Forever<IrqExecutor<interrupt::SWI0_EGU0>> = Forever::new();
121static ALARM_LOW: Forever<rtc::Alarm<pac::RTC1>> = Forever::new(); 121static ALARM_LOW: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
122static EXECUTOR_LOW: Forever<Executor> = Forever::new(); 122static EXECUTOR_LOW: Forever<Executor> = Forever::new();
123 123
diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs
index d1908cf09..26a40507b 100644
--- a/embassy-nrf/src/buffered_uarte.rs
+++ b/embassy-nrf/src/buffered_uarte.rs
@@ -16,7 +16,7 @@ use embedded_hal::digital::v2::OutputPin;
16 16
17use crate::hal::gpio::Port as GpioPort; 17use crate::hal::gpio::Port as GpioPort;
18use crate::hal::ppi::ConfigurablePpi; 18use crate::hal::ppi::ConfigurablePpi;
19use crate::interrupt::{self, OwnedInterrupt}; 19use crate::interrupt::{self, Interrupt};
20use crate::pac; 20use crate::pac;
21use crate::util::peripheral::{PeripheralMutex, PeripheralState}; 21use crate::util::peripheral::{PeripheralMutex, PeripheralState};
22use crate::util::ring_buffer::RingBuffer; 22use crate::util::ring_buffer::RingBuffer;
@@ -449,16 +449,16 @@ mod sealed {
449} 449}
450 450
451pub trait Instance: Deref<Target = pac::uarte0::RegisterBlock> + sealed::Instance { 451pub trait Instance: Deref<Target = pac::uarte0::RegisterBlock> + sealed::Instance {
452 type Interrupt: OwnedInterrupt; 452 type Interrupt: Interrupt;
453} 453}
454 454
455impl Instance for pac::UARTE0 { 455impl Instance for pac::UARTE0 {
456 type Interrupt = interrupt::UARTE0_UART0Interrupt; 456 type Interrupt = interrupt::UARTE0_UART0;
457} 457}
458 458
459#[cfg(any(feature = "52833", feature = "52840", feature = "9160"))] 459#[cfg(any(feature = "52833", feature = "52840", feature = "9160"))]
460impl Instance for pac::UARTE1 { 460impl Instance for pac::UARTE1 {
461 type Interrupt = interrupt::UARTE1Interrupt; 461 type Interrupt = interrupt::UARTE1;
462} 462}
463 463
464pub trait TimerInstance: 464pub trait TimerInstance:
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs
index 0e48a7164..592ca82a7 100644
--- a/embassy-nrf/src/gpiote.rs
+++ b/embassy-nrf/src/gpiote.rs
@@ -9,7 +9,7 @@ use embassy::util::Signal;
9 9
10use crate::hal::gpio::{Input, Level, Output, Pin as GpioPin, Port}; 10use crate::hal::gpio::{Input, Level, Output, Pin as GpioPin, Port};
11use crate::interrupt; 11use crate::interrupt;
12use crate::interrupt::OwnedInterrupt; 12use crate::interrupt::Interrupt;
13use crate::pac; 13use crate::pac;
14use crate::pac::generic::Reg; 14use crate::pac::generic::Reg;
15use crate::pac::gpiote::_TASKS_OUT; 15use crate::pac::gpiote::_TASKS_OUT;
@@ -102,7 +102,7 @@ pub struct Channels {
102} 102}
103 103
104impl Gpiote { 104impl Gpiote {
105 pub fn new(gpiote: GPIOTE, irq: interrupt::GPIOTEInterrupt) -> (Self, Channels) { 105 pub fn new(gpiote: GPIOTE, irq: interrupt::GPIOTE) -> (Self, Channels) {
106 #[cfg(any(feature = "52833", feature = "52840"))] 106 #[cfg(any(feature = "52833", feature = "52840"))]
107 let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] }; 107 let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] };
108 #[cfg(not(any(feature = "52833", feature = "52840")))] 108 #[cfg(not(any(feature = "52833", feature = "52840")))]
diff --git a/embassy-nrf/src/interrupt.rs b/embassy-nrf/src/interrupt.rs
index 90b568573..741dbaee2 100644
--- a/embassy-nrf/src/interrupt.rs
+++ b/embassy-nrf/src/interrupt.rs
@@ -8,10 +8,8 @@ use core::sync::atomic::{compiler_fence, Ordering};
8use crate::pac::NVIC_PRIO_BITS; 8use crate::pac::NVIC_PRIO_BITS;
9 9
10// Re-exports 10// Re-exports
11pub use crate::pac::Interrupt;
12pub use crate::pac::Interrupt::*; // needed for cortex-m-rt #[interrupt]
13pub use cortex_m::interrupt::{CriticalSection, Mutex}; 11pub use cortex_m::interrupt::{CriticalSection, Mutex};
14pub use embassy::interrupt::{declare, take, OwnedInterrupt}; 12pub use embassy::interrupt::{declare, take, Interrupt};
15 13
16#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] 14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
17#[cfg_attr(feature = "defmt", derive(defmt::Format))] 15#[cfg_attr(feature = "defmt", derive(defmt::Format))]
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs
index b137b80c0..59bb0e0cf 100644
--- a/embassy-nrf/src/lib.rs
+++ b/embassy-nrf/src/lib.rs
@@ -60,5 +60,3 @@ pub mod interrupt;
60pub mod qspi; 60pub mod qspi;
61pub mod rtc; 61pub mod rtc;
62pub mod uarte; 62pub mod uarte;
63
64pub use cortex_m_rt::interrupt;
diff --git a/embassy-nrf/src/qspi.rs b/embassy-nrf/src/qspi.rs
index a93b5e891..902d6511b 100644
--- a/embassy-nrf/src/qspi.rs
+++ b/embassy-nrf/src/qspi.rs
@@ -2,7 +2,7 @@ use crate::fmt::{assert, assert_eq, *};
2use core::future::Future; 2use core::future::Future;
3 3
4use crate::hal::gpio::{Output, Pin as GpioPin, Port as GpioPort, PushPull}; 4use crate::hal::gpio::{Output, Pin as GpioPin, Port as GpioPort, PushPull};
5use crate::interrupt::{OwnedInterrupt, QSPIInterrupt}; 5use crate::interrupt::{self, Interrupt};
6use crate::pac::QSPI; 6use crate::pac::QSPI;
7 7
8pub use crate::pac::qspi::ifconfig0::ADDRMODE_A as AddressMode; 8pub use crate::pac::qspi::ifconfig0::ADDRMODE_A as AddressMode;
@@ -58,7 +58,7 @@ fn port_bit(port: GpioPort) -> bool {
58} 58}
59 59
60impl Qspi { 60impl Qspi {
61 pub fn new(qspi: QSPI, irq: QSPIInterrupt, config: Config) -> Self { 61 pub fn new(qspi: QSPI, irq: interrupt::QSPI, config: Config) -> Self {
62 qspi.psel.sck.write(|w| { 62 qspi.psel.sck.write(|w| {
63 let pin = &config.pins.sck; 63 let pin = &config.pins.sck;
64 let w = unsafe { w.pin().bits(pin.pin()) }; 64 let w = unsafe { w.pin().bits(pin.pin()) };
diff --git a/embassy-nrf/src/rtc.rs b/embassy-nrf/src/rtc.rs
index 1ddc460e2..867c710c3 100644
--- a/embassy-nrf/src/rtc.rs
+++ b/embassy-nrf/src/rtc.rs
@@ -5,7 +5,7 @@ use core::sync::atomic::{compiler_fence, AtomicU32, Ordering};
5use embassy::time::Clock; 5use embassy::time::Clock;
6 6
7use crate::interrupt; 7use crate::interrupt;
8use crate::interrupt::{CriticalSection, Mutex, OwnedInterrupt}; 8use crate::interrupt::{CriticalSection, Interrupt, Mutex};
9use crate::pac::rtc0; 9use crate::pac::rtc0;
10 10
11// RTC timekeeping works with something we call "periods", which are time intervals 11// RTC timekeeping works with something we call "periods", which are time intervals
@@ -271,18 +271,18 @@ pub trait Instance:
271 sealed::Instance + Deref<Target = rtc0::RegisterBlock> + Sized + 'static 271 sealed::Instance + Deref<Target = rtc0::RegisterBlock> + Sized + 'static
272{ 272{
273 /// The interrupt associated with this RTC instance. 273 /// The interrupt associated with this RTC instance.
274 type Interrupt: OwnedInterrupt; 274 type Interrupt: Interrupt;
275} 275}
276 276
277impl Instance for crate::pac::RTC0 { 277impl Instance for crate::pac::RTC0 {
278 type Interrupt = interrupt::RTC0Interrupt; 278 type Interrupt = interrupt::RTC0;
279} 279}
280 280
281impl Instance for crate::pac::RTC1 { 281impl Instance for crate::pac::RTC1 {
282 type Interrupt = interrupt::RTC1Interrupt; 282 type Interrupt = interrupt::RTC1;
283} 283}
284 284
285#[cfg(any(feature = "52832", feature = "52833", feature = "52840"))] 285#[cfg(any(feature = "52832", feature = "52833", feature = "52840"))]
286impl Instance for crate::pac::RTC2 { 286impl Instance for crate::pac::RTC2 {
287 type Interrupt = interrupt::RTC2Interrupt; 287 type Interrupt = interrupt::RTC2;
288} 288}
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs
index 9daed2f4a..f029276b2 100644
--- a/embassy-nrf/src/uarte.rs
+++ b/embassy-nrf/src/uarte.rs
@@ -17,7 +17,7 @@ use crate::hal::gpio::Port as GpioPort;
17use crate::hal::pac; 17use crate::hal::pac;
18use crate::hal::prelude::*; 18use crate::hal::prelude::*;
19use crate::hal::target_constants::EASY_DMA_SIZE; 19use crate::hal::target_constants::EASY_DMA_SIZE;
20use crate::interrupt::OwnedInterrupt; 20use crate::interrupt::Interrupt;
21use crate::{interrupt, util}; 21use crate::{interrupt, util};
22 22
23pub use crate::hal::uarte::Pins; 23pub use crate::hal::uarte::Pins;
@@ -422,7 +422,7 @@ mod private {
422pub trait Instance: 422pub trait Instance:
423 Deref<Target = pac::uarte0::RegisterBlock> + Sized + private::Sealed + 'static 423 Deref<Target = pac::uarte0::RegisterBlock> + Sized + private::Sealed + 'static
424{ 424{
425 type Interrupt: OwnedInterrupt; 425 type Interrupt: Interrupt;
426 426
427 #[doc(hidden)] 427 #[doc(hidden)]
428 fn state() -> &'static State; 428 fn state() -> &'static State;
@@ -434,7 +434,7 @@ static UARTE0_STATE: State = State {
434}; 434};
435impl private::Sealed for pac::UARTE0 {} 435impl private::Sealed for pac::UARTE0 {}
436impl Instance for pac::UARTE0 { 436impl Instance for pac::UARTE0 {
437 type Interrupt = interrupt::UARTE0_UART0Interrupt; 437 type Interrupt = interrupt::UARTE0_UART0;
438 438
439 fn state() -> &'static State { 439 fn state() -> &'static State {
440 &UARTE0_STATE 440 &UARTE0_STATE
@@ -450,7 +450,7 @@ static UARTE1_STATE: State = State {
450impl private::Sealed for pac::UARTE1 {} 450impl private::Sealed for pac::UARTE1 {}
451#[cfg(any(feature = "52833", feature = "52840", feature = "9160"))] 451#[cfg(any(feature = "52833", feature = "52840", feature = "9160"))]
452impl Instance for pac::UARTE1 { 452impl Instance for pac::UARTE1 {
453 type Interrupt = interrupt::UARTE1Interrupt; 453 type Interrupt = interrupt::UARTE1;
454 454
455 fn state() -> &'static State { 455 fn state() -> &'static State {
456 &UARTE1_STATE 456 &UARTE1_STATE
diff --git a/embassy-nrf/src/util/peripheral.rs b/embassy-nrf/src/util/peripheral.rs
index 6062c9d32..8cefaeef8 100644
--- a/embassy-nrf/src/util/peripheral.rs
+++ b/embassy-nrf/src/util/peripheral.rs
@@ -4,10 +4,10 @@ use core::pin::Pin;
4use core::sync::atomic::{compiler_fence, Ordering}; 4use core::sync::atomic::{compiler_fence, Ordering};
5 5
6use crate::fmt::*; 6use crate::fmt::*;
7use crate::interrupt::OwnedInterrupt; 7use crate::interrupt::Interrupt;
8 8
9pub trait PeripheralState { 9pub trait PeripheralState {
10 type Interrupt: OwnedInterrupt; 10 type Interrupt: Interrupt;
11 fn on_interrupt(&mut self); 11 fn on_interrupt(&mut self);
12} 12}
13 13
diff --git a/embassy-stm32f4/src/exti.rs b/embassy-stm32f4/src/exti.rs
index 5782b8ebf..6a1e13000 100644
--- a/embassy-stm32f4/src/exti.rs
+++ b/embassy-stm32f4/src/exti.rs
@@ -3,7 +3,7 @@ use core::mem;
3use core::pin::Pin; 3use core::pin::Pin;
4 4
5use embassy::gpio::{WaitForFallingEdge, WaitForRisingEdge}; 5use embassy::gpio::{WaitForFallingEdge, WaitForRisingEdge};
6use embassy::interrupt::OwnedInterrupt; 6use embassy::interrupt::Interrupt;
7use embassy::util::InterruptFuture; 7use embassy::util::InterruptFuture;
8 8
9use crate::hal::gpio; 9use crate::hal::gpio;
@@ -25,7 +25,7 @@ impl<'a> ExtiManager {
25 pub fn new_pin<T, I>(&'static mut self, mut pin: T, interrupt: I) -> ExtiPin<T, I> 25 pub fn new_pin<T, I>(&'static mut self, mut pin: T, interrupt: I) -> ExtiPin<T, I>
26 where 26 where
27 T: HalExtiPin + WithInterrupt<Instance = I>, 27 T: HalExtiPin + WithInterrupt<Instance = I>,
28 I: OwnedInterrupt, 28 I: Interrupt,
29 { 29 {
30 pin.make_interrupt_source(&mut self.syscfg); 30 pin.make_interrupt_source(&mut self.syscfg);
31 31
@@ -37,7 +37,7 @@ impl<'a> ExtiManager {
37 } 37 }
38} 38}
39 39
40pub struct ExtiPin<T: HalExtiPin, I: OwnedInterrupt> { 40pub struct ExtiPin<T: HalExtiPin, I: Interrupt> {
41 pin: T, 41 pin: T,
42 interrupt: I, 42 interrupt: I,
43 _mgr: &'static ExtiManager, 43 _mgr: &'static ExtiManager,
@@ -54,7 +54,7 @@ pub struct ExtiPin<T: HalExtiPin, I: OwnedInterrupt> {
54 EXTI15_10_IRQn EXTI15_10_IRQHandler Handler for pins connected to line 10 to 15 54 EXTI15_10_IRQn EXTI15_10_IRQHandler Handler for pins connected to line 10 to 15
55*/ 55*/
56 56
57impl<T: HalExtiPin + 'static, I: OwnedInterrupt + 'static> WaitForRisingEdge for ExtiPin<T, I> { 57impl<T: HalExtiPin + 'static, I: Interrupt + 'static> WaitForRisingEdge for ExtiPin<T, I> {
58 type Future<'a> = impl Future<Output = ()> + 'a; 58 type Future<'a> = impl Future<Output = ()> + 'a;
59 59
60 fn wait_for_rising_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { 60 fn wait_for_rising_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> {
@@ -74,7 +74,7 @@ impl<T: HalExtiPin + 'static, I: OwnedInterrupt + 'static> WaitForRisingEdge for
74 } 74 }
75} 75}
76 76
77impl<T: HalExtiPin + 'static, I: OwnedInterrupt + 'static> WaitForFallingEdge for ExtiPin<T, I> { 77impl<T: HalExtiPin + 'static, I: Interrupt + 'static> WaitForFallingEdge for ExtiPin<T, I> {
78 type Future<'a> = impl Future<Output = ()> + 'a; 78 type Future<'a> = impl Future<Output = ()> + 'a;
79 79
80 fn wait_for_falling_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { 80 fn wait_for_falling_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> {
@@ -133,22 +133,22 @@ macro_rules! exti {
133 feature = "stm32f479" 133 feature = "stm32f479"
134))] 134))]
135exti! { 135exti! {
136 EXTI0Interrupt => (gpioa, PA0), 136 EXTI0 => (gpioa, PA0),
137 EXTI1Interrupt => (gpioa, PA1), 137 EXTI1 => (gpioa, PA1),
138 EXTI2Interrupt => (gpioa, PA2), 138 EXTI2 => (gpioa, PA2),
139 EXTI3Interrupt => (gpioa, PA3), 139 EXTI3 => (gpioa, PA3),
140 EXTI4Interrupt => (gpioa, PA4), 140 EXTI4 => (gpioa, PA4),
141 EXTI9_5Interrupt => (gpioa, PA5), 141 EXTI9_5 => (gpioa, PA5),
142 EXTI9_5Interrupt => (gpioa, PA6), 142 EXTI9_5 => (gpioa, PA6),
143 EXTI9_5Interrupt => (gpioa, PA7), 143 EXTI9_5 => (gpioa, PA7),
144 EXTI9_5Interrupt => (gpioa, PA8), 144 EXTI9_5 => (gpioa, PA8),
145 EXTI9_5Interrupt => (gpioa, PA9), 145 EXTI9_5 => (gpioa, PA9),
146 EXTI15_10Interrupt => (gpioa, PA10), 146 EXTI15_10 => (gpioa, PA10),
147 EXTI15_10Interrupt => (gpioa, PA11), 147 EXTI15_10 => (gpioa, PA11),
148 EXTI15_10Interrupt => (gpioa, PA12), 148 EXTI15_10 => (gpioa, PA12),
149 EXTI15_10Interrupt => (gpioa, PA13), 149 EXTI15_10 => (gpioa, PA13),
150 EXTI15_10Interrupt => (gpioa, PA14), 150 EXTI15_10 => (gpioa, PA14),
151 EXTI15_10Interrupt => (gpioa, PA15), 151 EXTI15_10 => (gpioa, PA15),
152} 152}
153 153
154#[cfg(any( 154#[cfg(any(
@@ -171,22 +171,22 @@ exti! {
171 feature = "stm32f479" 171 feature = "stm32f479"
172))] 172))]
173exti! { 173exti! {
174 EXTI0Interrupt => (gpiob, PB0), 174 EXTI0 => (gpiob, PB0),
175 EXTI1Interrupt => (gpiob, PB1), 175 EXTI1 => (gpiob, PB1),
176 EXTI2Interrupt => (gpiob, PB2), 176 EXTI2 => (gpiob, PB2),
177 EXTI3Interrupt => (gpiob, PB3), 177 EXTI3 => (gpiob, PB3),
178 EXTI4Interrupt => (gpiob, PB4), 178 EXTI4 => (gpiob, PB4),
179 EXTI9_5Interrupt => (gpiob, PB5), 179 EXTI9_5 => (gpiob, PB5),
180 EXTI9_5Interrupt => (gpiob, PB6), 180 EXTI9_5 => (gpiob, PB6),
181 EXTI9_5Interrupt => (gpiob, PB7), 181 EXTI9_5 => (gpiob, PB7),
182 EXTI9_5Interrupt => (gpiob, PB8), 182 EXTI9_5 => (gpiob, PB8),
183 EXTI9_5Interrupt => (gpiob, PB9), 183 EXTI9_5 => (gpiob, PB9),
184 EXTI15_10Interrupt => (gpiob, PB10), 184 EXTI15_10 => (gpiob, PB10),
185 EXTI15_10Interrupt => (gpiob, PB11), 185 EXTI15_10 => (gpiob, PB11),
186 EXTI15_10Interrupt => (gpiob, PB12), 186 EXTI15_10 => (gpiob, PB12),
187 EXTI15_10Interrupt => (gpiob, PB13), 187 EXTI15_10 => (gpiob, PB13),
188 EXTI15_10Interrupt => (gpiob, PB14), 188 EXTI15_10 => (gpiob, PB14),
189 EXTI15_10Interrupt => (gpiob, PB15), 189 EXTI15_10 => (gpiob, PB15),
190} 190}
191 191
192#[cfg(any( 192#[cfg(any(
@@ -209,22 +209,22 @@ exti! {
209 feature = "stm32f479" 209 feature = "stm32f479"
210))] 210))]
211exti! { 211exti! {
212 EXTI0Interrupt => (gpioc, PC0), 212 EXTI0 => (gpioc, PC0),
213 EXTI1Interrupt => (gpioc, PC1), 213 EXTI1 => (gpioc, PC1),
214 EXTI2Interrupt => (gpioc, PC2), 214 EXTI2 => (gpioc, PC2),
215 EXTI3Interrupt => (gpioc, PC3), 215 EXTI3 => (gpioc, PC3),
216 EXTI4Interrupt => (gpioc, PC4), 216 EXTI4 => (gpioc, PC4),
217 EXTI9_5Interrupt => (gpioc, PC5), 217 EXTI9_5 => (gpioc, PC5),
218 EXTI9_5Interrupt => (gpioc, PC6), 218 EXTI9_5 => (gpioc, PC6),
219 EXTI9_5Interrupt => (gpioc, PC7), 219 EXTI9_5 => (gpioc, PC7),
220 EXTI9_5Interrupt => (gpioc, PC8), 220 EXTI9_5 => (gpioc, PC8),
221 EXTI9_5Interrupt => (gpioc, PC9), 221 EXTI9_5 => (gpioc, PC9),
222 EXTI15_10Interrupt => (gpioc, PC10), 222 EXTI15_10 => (gpioc, PC10),
223 EXTI15_10Interrupt => (gpioc, PC11), 223 EXTI15_10 => (gpioc, PC11),
224 EXTI15_10Interrupt => (gpioc, PC12), 224 EXTI15_10 => (gpioc, PC12),
225 EXTI15_10Interrupt => (gpioc, PC13), 225 EXTI15_10 => (gpioc, PC13),
226 EXTI15_10Interrupt => (gpioc, PC14), 226 EXTI15_10 => (gpioc, PC14),
227 EXTI15_10Interrupt => (gpioc, PC15), 227 EXTI15_10 => (gpioc, PC15),
228} 228}
229 229
230#[cfg(any( 230#[cfg(any(
@@ -246,22 +246,22 @@ exti! {
246 feature = "stm32f479" 246 feature = "stm32f479"
247))] 247))]
248exti! { 248exti! {
249 EXTI0Interrupt => (gpiod, PD0), 249 EXTI0 => (gpiod, PD0),
250 EXTI1Interrupt => (gpiod, PD1), 250 EXTI1 => (gpiod, PD1),
251 EXTI2Interrupt => (gpiod, PD2), 251 EXTI2 => (gpiod, PD2),
252 EXTI3Interrupt => (gpiod, PD3), 252 EXTI3 => (gpiod, PD3),
253 EXTI4Interrupt => (gpiod, PD4), 253 EXTI4 => (gpiod, PD4),
254 EXTI9_5Interrupt => (gpiod, PD5), 254 EXTI9_5 => (gpiod, PD5),
255 EXTI9_5Interrupt => (gpiod, PD6), 255 EXTI9_5 => (gpiod, PD6),
256 EXTI9_5Interrupt => (gpiod, PD7), 256 EXTI9_5 => (gpiod, PD7),
257 EXTI9_5Interrupt => (gpiod, PD8), 257 EXTI9_5 => (gpiod, PD8),
258 EXTI9_5Interrupt => (gpiod, PD9), 258 EXTI9_5 => (gpiod, PD9),
259 EXTI15_10Interrupt => (gpiod, PD10), 259 EXTI15_10 => (gpiod, PD10),
260 EXTI15_10Interrupt => (gpiod, PD11), 260 EXTI15_10 => (gpiod, PD11),
261 EXTI15_10Interrupt => (gpiod, PD12), 261 EXTI15_10 => (gpiod, PD12),
262 EXTI15_10Interrupt => (gpiod, PD13), 262 EXTI15_10 => (gpiod, PD13),
263 EXTI15_10Interrupt => (gpiod, PD14), 263 EXTI15_10 => (gpiod, PD14),
264 EXTI15_10Interrupt => (gpiod, PD15), 264 EXTI15_10 => (gpiod, PD15),
265} 265}
266 266
267#[cfg(any( 267#[cfg(any(
@@ -283,22 +283,22 @@ exti! {
283 feature = "stm32f479" 283 feature = "stm32f479"
284))] 284))]
285exti! { 285exti! {
286 EXTI0Interrupt => (gpioe, PE0), 286 EXTI0 => (gpioe, PE0),
287 EXTI1Interrupt => (gpioe, PE1), 287 EXTI1 => (gpioe, PE1),
288 EXTI2Interrupt => (gpioe, PE2), 288 EXTI2 => (gpioe, PE2),
289 EXTI3Interrupt => (gpioe, PE3), 289 EXTI3 => (gpioe, PE3),
290 EXTI4Interrupt => (gpioe, PE4), 290 EXTI4 => (gpioe, PE4),
291 EXTI9_5Interrupt => (gpioe, PE5), 291 EXTI9_5 => (gpioe, PE5),
292 EXTI9_5Interrupt => (gpioe, PE6), 292 EXTI9_5 => (gpioe, PE6),
293 EXTI9_5Interrupt => (gpioe, PE7), 293 EXTI9_5 => (gpioe, PE7),
294 EXTI9_5Interrupt => (gpioe, PE8), 294 EXTI9_5 => (gpioe, PE8),
295 EXTI9_5Interrupt => (gpioe, PE9), 295 EXTI9_5 => (gpioe, PE9),
296 EXTI15_10Interrupt => (gpioe, PE10), 296 EXTI15_10 => (gpioe, PE10),
297 EXTI15_10Interrupt => (gpioe, PE11), 297 EXTI15_10 => (gpioe, PE11),
298 EXTI15_10Interrupt => (gpioe, PE12), 298 EXTI15_10 => (gpioe, PE12),
299 EXTI15_10Interrupt => (gpioe, PE13), 299 EXTI15_10 => (gpioe, PE13),
300 EXTI15_10Interrupt => (gpioe, PE14), 300 EXTI15_10 => (gpioe, PE14),
301 EXTI15_10Interrupt => (gpioe, PE15), 301 EXTI15_10 => (gpioe, PE15),
302} 302}
303 303
304#[cfg(any( 304#[cfg(any(
@@ -318,22 +318,22 @@ exti! {
318 feature = "stm32f479" 318 feature = "stm32f479"
319))] 319))]
320exti! { 320exti! {
321 EXTI0Interrupt => (gpiof, PF0), 321 EXTI0 => (gpiof, PF0),
322 EXTI1Interrupt => (gpiof, PF1), 322 EXTI1 => (gpiof, PF1),
323 EXTI2Interrupt => (gpiof, PF2), 323 EXTI2 => (gpiof, PF2),
324 EXTI3Interrupt => (gpiof, PF3), 324 EXTI3 => (gpiof, PF3),
325 EXTI4Interrupt => (gpiof, PF4), 325 EXTI4 => (gpiof, PF4),
326 EXTI9_5Interrupt => (gpiof, PF5), 326 EXTI9_5 => (gpiof, PF5),
327 EXTI9_5Interrupt => (gpiof, PF6), 327 EXTI9_5 => (gpiof, PF6),
328 EXTI9_5Interrupt => (gpiof, PF7), 328 EXTI9_5 => (gpiof, PF7),
329 EXTI9_5Interrupt => (gpiof, PF8), 329 EXTI9_5 => (gpiof, PF8),
330 EXTI9_5Interrupt => (gpiof, PF9), 330 EXTI9_5 => (gpiof, PF9),
331 EXTI15_10Interrupt => (gpiof, PF10), 331 EXTI15_10 => (gpiof, PF10),
332 EXTI15_10Interrupt => (gpiof, PF11), 332 EXTI15_10 => (gpiof, PF11),
333 EXTI15_10Interrupt => (gpiof, PF12), 333 EXTI15_10 => (gpiof, PF12),
334 EXTI15_10Interrupt => (gpiof, PF13), 334 EXTI15_10 => (gpiof, PF13),
335 EXTI15_10Interrupt => (gpiof, PF14), 335 EXTI15_10 => (gpiof, PF14),
336 EXTI15_10Interrupt => (gpiof, PF15), 336 EXTI15_10 => (gpiof, PF15),
337} 337}
338 338
339#[cfg(any( 339#[cfg(any(
@@ -353,22 +353,22 @@ exti! {
353 feature = "stm32f479" 353 feature = "stm32f479"
354))] 354))]
355exti! { 355exti! {
356 EXTI0Interrupt => (gpiog, PG0), 356 EXTI0 => (gpiog, PG0),
357 EXTI1Interrupt => (gpiog, PG1), 357 EXTI1 => (gpiog, PG1),
358 EXTI2Interrupt => (gpiog, PG2), 358 EXTI2 => (gpiog, PG2),
359 EXTI3Interrupt => (gpiog, PG3), 359 EXTI3 => (gpiog, PG3),
360 EXTI4Interrupt => (gpiog, PG4), 360 EXTI4 => (gpiog, PG4),
361 EXTI9_5Interrupt => (gpiog, PG5), 361 EXTI9_5 => (gpiog, PG5),
362 EXTI9_5Interrupt => (gpiog, PG6), 362 EXTI9_5 => (gpiog, PG6),
363 EXTI9_5Interrupt => (gpiog, PG7), 363 EXTI9_5 => (gpiog, PG7),
364 EXTI9_5Interrupt => (gpiog, PG8), 364 EXTI9_5 => (gpiog, PG8),
365 EXTI9_5Interrupt => (gpiog, PG9), 365 EXTI9_5 => (gpiog, PG9),
366 EXTI15_10Interrupt => (gpiog, PG10), 366 EXTI15_10 => (gpiog, PG10),
367 EXTI15_10Interrupt => (gpiog, PG11), 367 EXTI15_10 => (gpiog, PG11),
368 EXTI15_10Interrupt => (gpiog, PG12), 368 EXTI15_10 => (gpiog, PG12),
369 EXTI15_10Interrupt => (gpiog, PG13), 369 EXTI15_10 => (gpiog, PG13),
370 EXTI15_10Interrupt => (gpiog, PG14), 370 EXTI15_10 => (gpiog, PG14),
371 EXTI15_10Interrupt => (gpiog, PG15), 371 EXTI15_10 => (gpiog, PG15),
372} 372}
373 373
374#[cfg(any( 374#[cfg(any(
@@ -390,28 +390,28 @@ exti! {
390 feature = "stm32f479" 390 feature = "stm32f479"
391))] 391))]
392exti! { 392exti! {
393 EXTI0Interrupt => (gpioh, PH0), 393 EXTI0 => (gpioh, PH0),
394 EXTI1Interrupt => (gpioh, PH1), 394 EXTI1 => (gpioh, PH1),
395 EXTI2Interrupt => (gpioh, PH2), 395 EXTI2 => (gpioh, PH2),
396 EXTI3Interrupt => (gpioh, PH3), 396 EXTI3 => (gpioh, PH3),
397 EXTI4Interrupt => (gpioh, PH4), 397 EXTI4 => (gpioh, PH4),
398 EXTI9_5Interrupt => (gpioh, PH5), 398 EXTI9_5 => (gpioh, PH5),
399 EXTI9_5Interrupt => (gpioh, PH6), 399 EXTI9_5 => (gpioh, PH6),
400 EXTI9_5Interrupt => (gpioh, PH7), 400 EXTI9_5 => (gpioh, PH7),
401 EXTI9_5Interrupt => (gpioh, PH8), 401 EXTI9_5 => (gpioh, PH8),
402 EXTI9_5Interrupt => (gpioh, PH9), 402 EXTI9_5 => (gpioh, PH9),
403 EXTI15_10Interrupt => (gpioh, PH10), 403 EXTI15_10 => (gpioh, PH10),
404 EXTI15_10Interrupt => (gpioh, PH11), 404 EXTI15_10 => (gpioh, PH11),
405 EXTI15_10Interrupt => (gpioh, PH12), 405 EXTI15_10 => (gpioh, PH12),
406 EXTI15_10Interrupt => (gpioh, PH13), 406 EXTI15_10 => (gpioh, PH13),
407 EXTI15_10Interrupt => (gpioh, PH14), 407 EXTI15_10 => (gpioh, PH14),
408 EXTI15_10Interrupt => (gpioh, PH15), 408 EXTI15_10 => (gpioh, PH15),
409} 409}
410 410
411#[cfg(any(feature = "stm32f401"))] 411#[cfg(any(feature = "stm32f401"))]
412exti! { 412exti! {
413 EXTI0Interrupt => (gpioh, PH0), 413 EXTI0 => (gpioh, PH0),
414 EXTI1Interrupt => (gpioh, PH1), 414 EXTI1 => (gpioh, PH1),
415} 415}
416 416
417#[cfg(any( 417#[cfg(any(
@@ -427,22 +427,22 @@ exti! {
427 feature = "stm32f479" 427 feature = "stm32f479"
428))] 428))]
429exti! { 429exti! {
430 EXTI0Interrupt => (gpioi, PI0), 430 EXTI0 => (gpioi, PI0),
431 EXTI1Interrupt => (gpioi, PI1), 431 EXTI1 => (gpioi, PI1),
432 EXTI2Interrupt => (gpioi, PI2), 432 EXTI2 => (gpioi, PI2),
433 EXTI3Interrupt => (gpioi, PI3), 433 EXTI3 => (gpioi, PI3),
434 EXTI4Interrupt => (gpioi, PI4), 434 EXTI4 => (gpioi, PI4),
435 EXTI9_5Interrupt => (gpioi, PI5), 435 EXTI9_5 => (gpioi, PI5),
436 EXTI9_5Interrupt => (gpioi, PI6), 436 EXTI9_5 => (gpioi, PI6),
437 EXTI9_5Interrupt => (gpioi, PI7), 437 EXTI9_5 => (gpioi, PI7),
438 EXTI9_5Interrupt => (gpioi, PI8), 438 EXTI9_5 => (gpioi, PI8),
439 EXTI9_5Interrupt => (gpioi, PI9), 439 EXTI9_5 => (gpioi, PI9),
440 EXTI15_10Interrupt => (gpioi, PI10), 440 EXTI15_10 => (gpioi, PI10),
441 EXTI15_10Interrupt => (gpioi, PI11), 441 EXTI15_10 => (gpioi, PI11),
442 EXTI15_10Interrupt => (gpioi, PI12), 442 EXTI15_10 => (gpioi, PI12),
443 EXTI15_10Interrupt => (gpioi, PI13), 443 EXTI15_10 => (gpioi, PI13),
444 EXTI15_10Interrupt => (gpioi, PI14), 444 EXTI15_10 => (gpioi, PI14),
445 EXTI15_10Interrupt => (gpioi, PI15), 445 EXTI15_10 => (gpioi, PI15),
446} 446}
447 447
448#[cfg(any( 448#[cfg(any(
@@ -454,22 +454,22 @@ exti! {
454 feature = "stm32f479" 454 feature = "stm32f479"
455))] 455))]
456exti! { 456exti! {
457 EXTI0Interrupt => (gpioj, PJ0), 457 EXTI0 => (gpioj, PJ0),
458 EXTI1Interrupt => (gpioj, PJ1), 458 EXTI1 => (gpioj, PJ1),
459 EXTI2Interrupt => (gpioj, PJ2), 459 EXTI2 => (gpioj, PJ2),
460 EXTI3Interrupt => (gpioj, PJ3), 460 EXTI3 => (gpioj, PJ3),
461 EXTI4Interrupt => (gpioj, PJ4), 461 EXTI4 => (gpioj, PJ4),
462 EXTI9_5Interrupt => (gpioj, PJ5), 462 EXTI9_5 => (gpioj, PJ5),
463 EXTI9_5Interrupt => (gpioj, PJ6), 463 EXTI9_5 => (gpioj, PJ6),
464 EXTI9_5Interrupt => (gpioj, PJ7), 464 EXTI9_5 => (gpioj, PJ7),
465 EXTI9_5Interrupt => (gpioj, PJ8), 465 EXTI9_5 => (gpioj, PJ8),
466 EXTI9_5Interrupt => (gpioj, PJ9), 466 EXTI9_5 => (gpioj, PJ9),
467 EXTI15_10Interrupt => (gpioj, PJ10), 467 EXTI15_10 => (gpioj, PJ10),
468 EXTI15_10Interrupt => (gpioj, PJ11), 468 EXTI15_10 => (gpioj, PJ11),
469 EXTI15_10Interrupt => (gpioj, PJ12), 469 EXTI15_10 => (gpioj, PJ12),
470 EXTI15_10Interrupt => (gpioj, PJ13), 470 EXTI15_10 => (gpioj, PJ13),
471 EXTI15_10Interrupt => (gpioj, PJ14), 471 EXTI15_10 => (gpioj, PJ14),
472 EXTI15_10Interrupt => (gpioj, PJ15), 472 EXTI15_10 => (gpioj, PJ15),
473} 473}
474 474
475#[cfg(any( 475#[cfg(any(
@@ -481,12 +481,12 @@ exti! {
481 feature = "stm32f479" 481 feature = "stm32f479"
482))] 482))]
483exti! { 483exti! {
484 EXTI0Interrupt => (gpiok, PK0), 484 EXTI0 => (gpiok, PK0),
485 EXTI1Interrupt => (gpiok, PK1), 485 EXTI1 => (gpiok, PK1),
486 EXTI2Interrupt => (gpiok, PK2), 486 EXTI2 => (gpiok, PK2),
487 EXTI3Interrupt => (gpiok, PK3), 487 EXTI3 => (gpiok, PK3),
488 EXTI4Interrupt => (gpiok, PK4), 488 EXTI4 => (gpiok, PK4),
489 EXTI9_5Interrupt => (gpiok, PK5), 489 EXTI9_5 => (gpiok, PK5),
490 EXTI9_5Interrupt => (gpiok, PK6), 490 EXTI9_5 => (gpiok, PK6),
491 EXTI9_5Interrupt => (gpiok, PK7), 491 EXTI9_5 => (gpiok, PK7),
492} 492}
diff --git a/embassy-stm32f4/src/interrupt.rs b/embassy-stm32f4/src/interrupt.rs
index 4ecc76254..402aee582 100644
--- a/embassy-stm32f4/src/interrupt.rs
+++ b/embassy-stm32f4/src/interrupt.rs
@@ -8,10 +8,8 @@ use core::sync::atomic::{compiler_fence, Ordering};
8use crate::pac::NVIC_PRIO_BITS; 8use crate::pac::NVIC_PRIO_BITS;
9 9
10// Re-exports 10// Re-exports
11pub use crate::pac::Interrupt;
12pub use crate::pac::Interrupt::*; // needed for cortex-m-rt #[interrupt]
13pub use cortex_m::interrupt::{CriticalSection, Mutex}; 11pub use cortex_m::interrupt::{CriticalSection, Mutex};
14pub use embassy::interrupt::{declare, take, OwnedInterrupt}; 12pub use embassy::interrupt::{declare, take, Interrupt};
15 13
16#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] 14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
17#[cfg_attr(feature = "defmt", derive(defmt::Format))] 15#[cfg_attr(feature = "defmt", derive(defmt::Format))]
diff --git a/embassy-stm32f4/src/lib.rs b/embassy-stm32f4/src/lib.rs
index b0616cb07..aa31951d3 100644
--- a/embassy-stm32f4/src/lib.rs
+++ b/embassy-stm32f4/src/lib.rs
@@ -315,5 +315,3 @@ pub mod exti;
315pub mod interrupt; 315pub mod interrupt;
316pub mod rtc; 316pub mod rtc;
317pub mod serial; 317pub mod serial;
318
319pub use cortex_m_rt::interrupt;
diff --git a/embassy-stm32f4/src/rtc.rs b/embassy-stm32f4/src/rtc.rs
index 283442712..da7702876 100644
--- a/embassy-stm32f4/src/rtc.rs
+++ b/embassy-stm32f4/src/rtc.rs
@@ -7,7 +7,7 @@ use stm32f4xx_hal::bb;
7use stm32f4xx_hal::rcc::Clocks; 7use stm32f4xx_hal::rcc::Clocks;
8 8
9use crate::interrupt; 9use crate::interrupt;
10use crate::interrupt::{CriticalSection, Mutex, OwnedInterrupt}; 10use crate::interrupt::{CriticalSection, Interrupt, Mutex};
11 11
12// RTC timekeeping works with something we call "periods", which are time intervals 12// RTC timekeeping works with something we call "periods", which are time intervals
13// of 2^15 ticks. The RTC counter value is 16 bits, so one "overflow cycle" is 2 periods. 13// of 2^15 ticks. The RTC counter value is 16 bits, so one "overflow cycle" is 2 periods.
@@ -236,7 +236,7 @@ mod sealed {
236} 236}
237 237
238pub trait Instance: sealed::Sealed + Sized + 'static { 238pub trait Instance: sealed::Sealed + Sized + 'static {
239 type Interrupt: OwnedInterrupt; 239 type Interrupt: Interrupt;
240 const REAL_ALARM_COUNT: usize; 240 const REAL_ALARM_COUNT: usize;
241 241
242 fn enable_clock(&self); 242 fn enable_clock(&self);
@@ -489,17 +489,17 @@ macro_rules! impl_timer {
489} 489}
490 490
491#[cfg(not(feature = "stm32f410"))] 491#[cfg(not(feature = "stm32f410"))]
492impl_timer!(tim2: (TIM2, TIM2Interrupt, apb1enr, 0, apb1rstr, 0, ppre1, pclk1), 3); 492impl_timer!(tim2: (TIM2, TIM2, apb1enr, 0, apb1rstr, 0, ppre1, pclk1), 3);
493 493
494#[cfg(not(feature = "stm32f410"))] 494#[cfg(not(feature = "stm32f410"))]
495impl_timer!(tim3: (TIM3, TIM3Interrupt, apb1enr, 1, apb1rstr, 1, ppre1, pclk1), 3); 495impl_timer!(tim3: (TIM3, TIM3, apb1enr, 1, apb1rstr, 1, ppre1, pclk1), 3);
496 496
497#[cfg(not(feature = "stm32f410"))] 497#[cfg(not(feature = "stm32f410"))]
498impl_timer!(tim4: (TIM4, TIM4Interrupt, apb1enr, 2, apb1rstr, 2, ppre1, pclk1), 3); 498impl_timer!(tim4: (TIM4, TIM4, apb1enr, 2, apb1rstr, 2, ppre1, pclk1), 3);
499 499
500impl_timer!(tim5: (TIM5, TIM5Interrupt, apb1enr, 3, apb1rstr, 3, ppre1, pclk1), 3); 500impl_timer!(tim5: (TIM5, TIM5, apb1enr, 3, apb1rstr, 3, ppre1, pclk1), 3);
501 501
502impl_timer!(tim9: (TIM9, TIM1_BRK_TIM9Interrupt, apb2enr, 16, apb2rstr, 16, ppre2, pclk2), 1); 502impl_timer!(tim9: (TIM9, TIM1_BRK_TIM9, apb2enr, 16, apb2rstr, 16, ppre2, pclk2), 1);
503 503
504#[cfg(not(any(feature = "stm32f401", feature = "stm32f410", feature = "stm32f411")))] 504#[cfg(not(any(feature = "stm32f401", feature = "stm32f410", feature = "stm32f411")))]
505impl_timer!(tim12: (TIM12, TIM8_BRK_TIM12Interrupt, apb1enr, 6, apb1rstr, 6, ppre1, pclk1), 1); 505impl_timer!(tim12: (TIM12, TIM8_BRK_TIM12, apb1enr, 6, apb1rstr, 6, ppre1, pclk1), 1);
diff --git a/embassy-stm32f4/src/serial.rs b/embassy-stm32f4/src/serial.rs
index 57fa14175..d84d8cb01 100644
--- a/embassy-stm32f4/src/serial.rs
+++ b/embassy-stm32f4/src/serial.rs
@@ -8,7 +8,7 @@ use core::future::Future;
8use core::ptr; 8use core::ptr;
9use core::sync::atomic::{self, Ordering}; 9use core::sync::atomic::{self, Ordering};
10 10
11use embassy::interrupt::OwnedInterrupt; 11use embassy::interrupt::Interrupt;
12use embassy::uart::{Error, Uart}; 12use embassy::uart::{Error, Uart};
13use embassy::util::Signal; 13use embassy::util::Signal;
14 14
@@ -29,9 +29,9 @@ pub struct Serial<USART: PeriAddress<MemSize = u8>, TSTREAM: Stream, RSTREAM: St
29 tx_stream: Option<TSTREAM>, 29 tx_stream: Option<TSTREAM>,
30 rx_stream: Option<RSTREAM>, 30 rx_stream: Option<RSTREAM>,
31 usart: Option<USART>, 31 usart: Option<USART>,
32 tx_int: interrupt::DMA2_STREAM7Interrupt, 32 tx_int: interrupt::DMA2_STREAM7,
33 rx_int: interrupt::DMA2_STREAM2Interrupt, 33 rx_int: interrupt::DMA2_STREAM2,
34 usart_int: interrupt::USART1Interrupt, 34 usart_int: interrupt::USART1,
35} 35}
36 36
37struct State { 37struct State {
@@ -52,9 +52,9 @@ impl Serial<USART1, Stream7<DMA2>, Stream2<DMA2>> {
52 usart: USART1, 52 usart: USART1,
53 dma: DMA2, 53 dma: DMA2,
54 pins: PINS, 54 pins: PINS,
55 tx_int: interrupt::DMA2_STREAM7Interrupt, 55 tx_int: interrupt::DMA2_STREAM7,
56 rx_int: interrupt::DMA2_STREAM2Interrupt, 56 rx_int: interrupt::DMA2_STREAM2,
57 usart_int: interrupt::USART1Interrupt, 57 usart_int: interrupt::USART1,
58 mut config: SerialConfig, 58 mut config: SerialConfig,
59 clocks: Clocks, 59 clocks: Clocks,
60 ) -> Self 60 ) -> Self
diff --git a/embassy/src/executor/mod.rs b/embassy/src/executor/mod.rs
index 592ab235f..6c42764bb 100644
--- a/embassy/src/executor/mod.rs
+++ b/embassy/src/executor/mod.rs
@@ -17,7 +17,7 @@ mod waker;
17 17
18use self::util::UninitCell; 18use self::util::UninitCell;
19use crate::fmt::panic; 19use crate::fmt::panic;
20use crate::interrupt::OwnedInterrupt; 20use crate::interrupt::Interrupt;
21use crate::time::Alarm; 21use crate::time::Alarm;
22 22
23// repr(C) is needed to guarantee that the raw::Task is located at offset 0 23// repr(C) is needed to guarantee that the raw::Task is located at offset 0
@@ -215,13 +215,13 @@ fn pend_by_number(n: u16) {
215 cortex_m::peripheral::NVIC::pend(N(n)) 215 cortex_m::peripheral::NVIC::pend(N(n))
216} 216}
217 217
218pub struct IrqExecutor<I: OwnedInterrupt> { 218pub struct IrqExecutor<I: Interrupt> {
219 irq: I, 219 irq: I,
220 inner: raw::Executor, 220 inner: raw::Executor,
221 not_send: PhantomData<*mut ()>, 221 not_send: PhantomData<*mut ()>,
222} 222}
223 223
224impl<I: OwnedInterrupt> IrqExecutor<I> { 224impl<I: Interrupt> IrqExecutor<I> {
225 pub fn new(irq: I) -> Self { 225 pub fn new(irq: I) -> Self {
226 let ctx = irq.number() as *mut (); 226 let ctx = irq.number() as *mut ();
227 Self { 227 Self {
diff --git a/embassy/src/interrupt.rs b/embassy/src/interrupt.rs
index db75ffe95..9106def5f 100644
--- a/embassy/src/interrupt.rs
+++ b/embassy/src/interrupt.rs
@@ -29,7 +29,7 @@ unsafe impl cortex_m::interrupt::InterruptNumber for NrWrap {
29 } 29 }
30} 30}
31 31
32pub unsafe trait OwnedInterrupt { 32pub unsafe trait Interrupt {
33 type Priority: From<u8> + Into<u8> + Copy; 33 type Priority: From<u8> + Into<u8> + Copy;
34 fn number(&self) -> u16; 34 fn number(&self) -> u16;
35 unsafe fn steal() -> Self; 35 unsafe fn steal() -> Self;
diff --git a/embassy/src/util/signal.rs b/embassy/src/util/signal.rs
index 75ac12985..9fcfa7ac1 100644
--- a/embassy/src/util/signal.rs
+++ b/embassy/src/util/signal.rs
@@ -1,6 +1,6 @@
1use crate::executor; 1use crate::executor;
2use crate::fmt::panic; 2use crate::fmt::panic;
3use crate::interrupt::OwnedInterrupt; 3use crate::interrupt::Interrupt;
4use core::cell::UnsafeCell; 4use core::cell::UnsafeCell;
5use core::future::Future; 5use core::future::Future;
6use core::mem; 6use core::mem;
@@ -79,18 +79,18 @@ unsafe impl cortex_m::interrupt::Nr for NrWrap {
79 } 79 }
80} 80}
81 81
82pub struct InterruptFuture<'a, I: OwnedInterrupt> { 82pub struct InterruptFuture<'a, I: Interrupt> {
83 interrupt: &'a mut I, 83 interrupt: &'a mut I,
84} 84}
85 85
86impl<'a, I: OwnedInterrupt> Drop for InterruptFuture<'a, I> { 86impl<'a, I: Interrupt> Drop for InterruptFuture<'a, I> {
87 fn drop(&mut self) { 87 fn drop(&mut self) {
88 self.interrupt.disable(); 88 self.interrupt.disable();
89 self.interrupt.remove_handler(); 89 self.interrupt.remove_handler();
90 } 90 }
91} 91}
92 92
93impl<'a, I: OwnedInterrupt> InterruptFuture<'a, I> { 93impl<'a, I: Interrupt> InterruptFuture<'a, I> {
94 pub fn new(interrupt: &'a mut I) -> Self { 94 pub fn new(interrupt: &'a mut I) -> Self {
95 interrupt.disable(); 95 interrupt.disable();
96 interrupt.set_handler(Self::interrupt_handler, ptr::null_mut()); 96 interrupt.set_handler(Self::interrupt_handler, ptr::null_mut());
@@ -114,9 +114,9 @@ impl<'a, I: OwnedInterrupt> InterruptFuture<'a, I> {
114 } 114 }
115} 115}
116 116
117impl<'a, I: OwnedInterrupt> Unpin for InterruptFuture<'a, I> {} 117impl<'a, I: Interrupt> Unpin for InterruptFuture<'a, I> {}
118 118
119impl<'a, I: OwnedInterrupt> Future for InterruptFuture<'a, I> { 119impl<'a, I: Interrupt> Future for InterruptFuture<'a, I> {
120 type Output = (); 120 type Output = ();
121 121
122 fn poll(self: core::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> { 122 fn poll(self: core::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {