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.
This commit is contained in:
parent
90476ef900
commit
11be9170ec
@ -114,17 +114,17 @@ pub fn task(args: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
pub fn interrupt_declare(item: TokenStream) -> TokenStream {
|
pub fn interrupt_declare(item: TokenStream) -> TokenStream {
|
||||||
let name = syn::parse_macro_input!(item as syn::Ident);
|
let name = syn::parse_macro_input!(item as syn::Ident);
|
||||||
let name = format_ident!("{}", name);
|
let name = format_ident!("{}", name);
|
||||||
let name_interrupt = format_ident!("{}Interrupt", name);
|
let name_interrupt = format_ident!("{}", name);
|
||||||
let name_handler = format!("__EMBASSY_{}_HANDLER", name);
|
let name_handler = format!("__EMBASSY_{}_HANDLER", name);
|
||||||
|
|
||||||
let result = quote! {
|
let result = quote! {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub struct #name_interrupt(());
|
pub struct #name_interrupt(());
|
||||||
unsafe impl OwnedInterrupt for #name_interrupt {
|
unsafe impl Interrupt for #name_interrupt {
|
||||||
type Priority = Priority;
|
type Priority = crate::interrupt::Priority;
|
||||||
fn number(&self) -> u16 {
|
fn number(&self) -> u16 {
|
||||||
use cortex_m::interrupt::InterruptNumber;
|
use cortex_m::interrupt::InterruptNumber;
|
||||||
let irq = Interrupt::#name;
|
let irq = crate::pac::interrupt::#name;
|
||||||
irq.number() as u16
|
irq.number() as u16
|
||||||
}
|
}
|
||||||
unsafe fn steal() -> Self {
|
unsafe fn steal() -> Self {
|
||||||
@ -144,7 +144,7 @@ pub fn interrupt_declare(item: TokenStream) -> TokenStream {
|
|||||||
pub fn interrupt_take(item: TokenStream) -> TokenStream {
|
pub fn interrupt_take(item: TokenStream) -> TokenStream {
|
||||||
let name = syn::parse_macro_input!(item as syn::Ident);
|
let name = syn::parse_macro_input!(item as syn::Ident);
|
||||||
let name = format!("{}", name);
|
let name = format!("{}", name);
|
||||||
let name_interrupt = format_ident!("{}Interrupt", name);
|
let name_interrupt = format_ident!("{}", name);
|
||||||
let name_handler = format!("__EMBASSY_{}_HANDLER", name);
|
let name_handler = format!("__EMBASSY_{}_HANDLER", name);
|
||||||
|
|
||||||
let result = quote! {
|
let result = quote! {
|
||||||
|
@ -68,7 +68,7 @@ use nrf52840_hal::clocks;
|
|||||||
use embassy::executor::{task, Executor, IrqExecutor};
|
use embassy::executor::{task, Executor, IrqExecutor};
|
||||||
use embassy::time::{Duration, Instant, Timer};
|
use embassy::time::{Duration, Instant, Timer};
|
||||||
use embassy::util::Forever;
|
use embassy::util::Forever;
|
||||||
use embassy_nrf::interrupt::OwnedInterrupt;
|
use embassy_nrf::interrupt::Interrupt;
|
||||||
use embassy_nrf::{interrupt, pac, rtc};
|
use embassy_nrf::{interrupt, pac, rtc};
|
||||||
|
|
||||||
#[task]
|
#[task]
|
||||||
@ -115,9 +115,9 @@ async fn run_low() {
|
|||||||
|
|
||||||
static RTC: Forever<rtc::RTC<pac::RTC1>> = Forever::new();
|
static RTC: Forever<rtc::RTC<pac::RTC1>> = Forever::new();
|
||||||
static ALARM_HIGH: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
static ALARM_HIGH: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
||||||
static EXECUTOR_HIGH: Forever<IrqExecutor<interrupt::SWI1_EGU1Interrupt>> = Forever::new();
|
static EXECUTOR_HIGH: Forever<IrqExecutor<interrupt::SWI1_EGU1>> = Forever::new();
|
||||||
static ALARM_MED: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
static ALARM_MED: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
||||||
static EXECUTOR_MED: Forever<IrqExecutor<interrupt::SWI0_EGU0Interrupt>> = Forever::new();
|
static EXECUTOR_MED: Forever<IrqExecutor<interrupt::SWI0_EGU0>> = Forever::new();
|
||||||
static ALARM_LOW: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
static ALARM_LOW: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
||||||
static EXECUTOR_LOW: Forever<Executor> = Forever::new();
|
static EXECUTOR_LOW: Forever<Executor> = Forever::new();
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ use embedded_hal::digital::v2::OutputPin;
|
|||||||
|
|
||||||
use crate::hal::gpio::Port as GpioPort;
|
use crate::hal::gpio::Port as GpioPort;
|
||||||
use crate::hal::ppi::ConfigurablePpi;
|
use crate::hal::ppi::ConfigurablePpi;
|
||||||
use crate::interrupt::{self, OwnedInterrupt};
|
use crate::interrupt::{self, Interrupt};
|
||||||
use crate::pac;
|
use crate::pac;
|
||||||
use crate::util::peripheral::{PeripheralMutex, PeripheralState};
|
use crate::util::peripheral::{PeripheralMutex, PeripheralState};
|
||||||
use crate::util::ring_buffer::RingBuffer;
|
use crate::util::ring_buffer::RingBuffer;
|
||||||
@ -449,16 +449,16 @@ mod sealed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub trait Instance: Deref<Target = pac::uarte0::RegisterBlock> + sealed::Instance {
|
pub trait Instance: Deref<Target = pac::uarte0::RegisterBlock> + sealed::Instance {
|
||||||
type Interrupt: OwnedInterrupt;
|
type Interrupt: Interrupt;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Instance for pac::UARTE0 {
|
impl Instance for pac::UARTE0 {
|
||||||
type Interrupt = interrupt::UARTE0_UART0Interrupt;
|
type Interrupt = interrupt::UARTE0_UART0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "52833", feature = "52840", feature = "9160"))]
|
#[cfg(any(feature = "52833", feature = "52840", feature = "9160"))]
|
||||||
impl Instance for pac::UARTE1 {
|
impl Instance for pac::UARTE1 {
|
||||||
type Interrupt = interrupt::UARTE1Interrupt;
|
type Interrupt = interrupt::UARTE1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait TimerInstance:
|
pub trait TimerInstance:
|
||||||
|
@ -9,7 +9,7 @@ use embassy::util::Signal;
|
|||||||
|
|
||||||
use crate::hal::gpio::{Input, Level, Output, Pin as GpioPin, Port};
|
use crate::hal::gpio::{Input, Level, Output, Pin as GpioPin, Port};
|
||||||
use crate::interrupt;
|
use crate::interrupt;
|
||||||
use crate::interrupt::OwnedInterrupt;
|
use crate::interrupt::Interrupt;
|
||||||
use crate::pac;
|
use crate::pac;
|
||||||
use crate::pac::generic::Reg;
|
use crate::pac::generic::Reg;
|
||||||
use crate::pac::gpiote::_TASKS_OUT;
|
use crate::pac::gpiote::_TASKS_OUT;
|
||||||
@ -102,7 +102,7 @@ pub struct Channels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Gpiote {
|
impl Gpiote {
|
||||||
pub fn new(gpiote: GPIOTE, irq: interrupt::GPIOTEInterrupt) -> (Self, Channels) {
|
pub fn new(gpiote: GPIOTE, irq: interrupt::GPIOTE) -> (Self, Channels) {
|
||||||
#[cfg(any(feature = "52833", feature = "52840"))]
|
#[cfg(any(feature = "52833", feature = "52840"))]
|
||||||
let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] };
|
let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] };
|
||||||
#[cfg(not(any(feature = "52833", feature = "52840")))]
|
#[cfg(not(any(feature = "52833", feature = "52840")))]
|
||||||
|
@ -8,10 +8,8 @@ use core::sync::atomic::{compiler_fence, Ordering};
|
|||||||
use crate::pac::NVIC_PRIO_BITS;
|
use crate::pac::NVIC_PRIO_BITS;
|
||||||
|
|
||||||
// Re-exports
|
// Re-exports
|
||||||
pub use crate::pac::Interrupt;
|
|
||||||
pub use crate::pac::Interrupt::*; // needed for cortex-m-rt #[interrupt]
|
|
||||||
pub use cortex_m::interrupt::{CriticalSection, Mutex};
|
pub use cortex_m::interrupt::{CriticalSection, Mutex};
|
||||||
pub use embassy::interrupt::{declare, take, OwnedInterrupt};
|
pub use embassy::interrupt::{declare, take, Interrupt};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
|
@ -60,5 +60,3 @@ pub mod interrupt;
|
|||||||
pub mod qspi;
|
pub mod qspi;
|
||||||
pub mod rtc;
|
pub mod rtc;
|
||||||
pub mod uarte;
|
pub mod uarte;
|
||||||
|
|
||||||
pub use cortex_m_rt::interrupt;
|
|
||||||
|
@ -2,7 +2,7 @@ use crate::fmt::{assert, assert_eq, *};
|
|||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
|
|
||||||
use crate::hal::gpio::{Output, Pin as GpioPin, Port as GpioPort, PushPull};
|
use crate::hal::gpio::{Output, Pin as GpioPin, Port as GpioPort, PushPull};
|
||||||
use crate::interrupt::{OwnedInterrupt, QSPIInterrupt};
|
use crate::interrupt::{self, Interrupt};
|
||||||
use crate::pac::QSPI;
|
use crate::pac::QSPI;
|
||||||
|
|
||||||
pub use crate::pac::qspi::ifconfig0::ADDRMODE_A as AddressMode;
|
pub use crate::pac::qspi::ifconfig0::ADDRMODE_A as AddressMode;
|
||||||
@ -58,7 +58,7 @@ fn port_bit(port: GpioPort) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Qspi {
|
impl Qspi {
|
||||||
pub fn new(qspi: QSPI, irq: QSPIInterrupt, config: Config) -> Self {
|
pub fn new(qspi: QSPI, irq: interrupt::QSPI, config: Config) -> Self {
|
||||||
qspi.psel.sck.write(|w| {
|
qspi.psel.sck.write(|w| {
|
||||||
let pin = &config.pins.sck;
|
let pin = &config.pins.sck;
|
||||||
let w = unsafe { w.pin().bits(pin.pin()) };
|
let w = unsafe { w.pin().bits(pin.pin()) };
|
||||||
|
@ -5,7 +5,7 @@ use core::sync::atomic::{compiler_fence, AtomicU32, Ordering};
|
|||||||
use embassy::time::Clock;
|
use embassy::time::Clock;
|
||||||
|
|
||||||
use crate::interrupt;
|
use crate::interrupt;
|
||||||
use crate::interrupt::{CriticalSection, Mutex, OwnedInterrupt};
|
use crate::interrupt::{CriticalSection, Interrupt, Mutex};
|
||||||
use crate::pac::rtc0;
|
use crate::pac::rtc0;
|
||||||
|
|
||||||
// RTC timekeeping works with something we call "periods", which are time intervals
|
// RTC timekeeping works with something we call "periods", which are time intervals
|
||||||
@ -271,18 +271,18 @@ pub trait Instance:
|
|||||||
sealed::Instance + Deref<Target = rtc0::RegisterBlock> + Sized + 'static
|
sealed::Instance + Deref<Target = rtc0::RegisterBlock> + Sized + 'static
|
||||||
{
|
{
|
||||||
/// The interrupt associated with this RTC instance.
|
/// The interrupt associated with this RTC instance.
|
||||||
type Interrupt: OwnedInterrupt;
|
type Interrupt: Interrupt;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Instance for crate::pac::RTC0 {
|
impl Instance for crate::pac::RTC0 {
|
||||||
type Interrupt = interrupt::RTC0Interrupt;
|
type Interrupt = interrupt::RTC0;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Instance for crate::pac::RTC1 {
|
impl Instance for crate::pac::RTC1 {
|
||||||
type Interrupt = interrupt::RTC1Interrupt;
|
type Interrupt = interrupt::RTC1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "52832", feature = "52833", feature = "52840"))]
|
#[cfg(any(feature = "52832", feature = "52833", feature = "52840"))]
|
||||||
impl Instance for crate::pac::RTC2 {
|
impl Instance for crate::pac::RTC2 {
|
||||||
type Interrupt = interrupt::RTC2Interrupt;
|
type Interrupt = interrupt::RTC2;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ use crate::hal::gpio::Port as GpioPort;
|
|||||||
use crate::hal::pac;
|
use crate::hal::pac;
|
||||||
use crate::hal::prelude::*;
|
use crate::hal::prelude::*;
|
||||||
use crate::hal::target_constants::EASY_DMA_SIZE;
|
use crate::hal::target_constants::EASY_DMA_SIZE;
|
||||||
use crate::interrupt::OwnedInterrupt;
|
use crate::interrupt::Interrupt;
|
||||||
use crate::{interrupt, util};
|
use crate::{interrupt, util};
|
||||||
|
|
||||||
pub use crate::hal::uarte::Pins;
|
pub use crate::hal::uarte::Pins;
|
||||||
@ -422,7 +422,7 @@ mod private {
|
|||||||
pub trait Instance:
|
pub trait Instance:
|
||||||
Deref<Target = pac::uarte0::RegisterBlock> + Sized + private::Sealed + 'static
|
Deref<Target = pac::uarte0::RegisterBlock> + Sized + private::Sealed + 'static
|
||||||
{
|
{
|
||||||
type Interrupt: OwnedInterrupt;
|
type Interrupt: Interrupt;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn state() -> &'static State;
|
fn state() -> &'static State;
|
||||||
@ -434,7 +434,7 @@ static UARTE0_STATE: State = State {
|
|||||||
};
|
};
|
||||||
impl private::Sealed for pac::UARTE0 {}
|
impl private::Sealed for pac::UARTE0 {}
|
||||||
impl Instance for pac::UARTE0 {
|
impl Instance for pac::UARTE0 {
|
||||||
type Interrupt = interrupt::UARTE0_UART0Interrupt;
|
type Interrupt = interrupt::UARTE0_UART0;
|
||||||
|
|
||||||
fn state() -> &'static State {
|
fn state() -> &'static State {
|
||||||
&UARTE0_STATE
|
&UARTE0_STATE
|
||||||
@ -450,7 +450,7 @@ static UARTE1_STATE: State = State {
|
|||||||
impl private::Sealed for pac::UARTE1 {}
|
impl private::Sealed for pac::UARTE1 {}
|
||||||
#[cfg(any(feature = "52833", feature = "52840", feature = "9160"))]
|
#[cfg(any(feature = "52833", feature = "52840", feature = "9160"))]
|
||||||
impl Instance for pac::UARTE1 {
|
impl Instance for pac::UARTE1 {
|
||||||
type Interrupt = interrupt::UARTE1Interrupt;
|
type Interrupt = interrupt::UARTE1;
|
||||||
|
|
||||||
fn state() -> &'static State {
|
fn state() -> &'static State {
|
||||||
&UARTE1_STATE
|
&UARTE1_STATE
|
||||||
|
@ -4,10 +4,10 @@ use core::pin::Pin;
|
|||||||
use core::sync::atomic::{compiler_fence, Ordering};
|
use core::sync::atomic::{compiler_fence, Ordering};
|
||||||
|
|
||||||
use crate::fmt::*;
|
use crate::fmt::*;
|
||||||
use crate::interrupt::OwnedInterrupt;
|
use crate::interrupt::Interrupt;
|
||||||
|
|
||||||
pub trait PeripheralState {
|
pub trait PeripheralState {
|
||||||
type Interrupt: OwnedInterrupt;
|
type Interrupt: Interrupt;
|
||||||
fn on_interrupt(&mut self);
|
fn on_interrupt(&mut self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use core::mem;
|
|||||||
use core::pin::Pin;
|
use core::pin::Pin;
|
||||||
|
|
||||||
use embassy::gpio::{WaitForFallingEdge, WaitForRisingEdge};
|
use embassy::gpio::{WaitForFallingEdge, WaitForRisingEdge};
|
||||||
use embassy::interrupt::OwnedInterrupt;
|
use embassy::interrupt::Interrupt;
|
||||||
use embassy::util::InterruptFuture;
|
use embassy::util::InterruptFuture;
|
||||||
|
|
||||||
use crate::hal::gpio;
|
use crate::hal::gpio;
|
||||||
@ -25,7 +25,7 @@ impl<'a> ExtiManager {
|
|||||||
pub fn new_pin<T, I>(&'static mut self, mut pin: T, interrupt: I) -> ExtiPin<T, I>
|
pub fn new_pin<T, I>(&'static mut self, mut pin: T, interrupt: I) -> ExtiPin<T, I>
|
||||||
where
|
where
|
||||||
T: HalExtiPin + WithInterrupt<Instance = I>,
|
T: HalExtiPin + WithInterrupt<Instance = I>,
|
||||||
I: OwnedInterrupt,
|
I: Interrupt,
|
||||||
{
|
{
|
||||||
pin.make_interrupt_source(&mut self.syscfg);
|
pin.make_interrupt_source(&mut self.syscfg);
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ impl<'a> ExtiManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ExtiPin<T: HalExtiPin, I: OwnedInterrupt> {
|
pub struct ExtiPin<T: HalExtiPin, I: Interrupt> {
|
||||||
pin: T,
|
pin: T,
|
||||||
interrupt: I,
|
interrupt: I,
|
||||||
_mgr: &'static ExtiManager,
|
_mgr: &'static ExtiManager,
|
||||||
@ -54,7 +54,7 @@ pub struct ExtiPin<T: HalExtiPin, I: OwnedInterrupt> {
|
|||||||
EXTI15_10_IRQn EXTI15_10_IRQHandler Handler for pins connected to line 10 to 15
|
EXTI15_10_IRQn EXTI15_10_IRQHandler Handler for pins connected to line 10 to 15
|
||||||
*/
|
*/
|
||||||
|
|
||||||
impl<T: HalExtiPin + 'static, I: OwnedInterrupt + 'static> WaitForRisingEdge for ExtiPin<T, I> {
|
impl<T: HalExtiPin + 'static, I: Interrupt + 'static> WaitForRisingEdge for ExtiPin<T, I> {
|
||||||
type Future<'a> = impl Future<Output = ()> + 'a;
|
type Future<'a> = impl Future<Output = ()> + 'a;
|
||||||
|
|
||||||
fn wait_for_rising_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> {
|
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
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: HalExtiPin + 'static, I: OwnedInterrupt + 'static> WaitForFallingEdge for ExtiPin<T, I> {
|
impl<T: HalExtiPin + 'static, I: Interrupt + 'static> WaitForFallingEdge for ExtiPin<T, I> {
|
||||||
type Future<'a> = impl Future<Output = ()> + 'a;
|
type Future<'a> = impl Future<Output = ()> + 'a;
|
||||||
|
|
||||||
fn wait_for_falling_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> {
|
fn wait_for_falling_edge<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> {
|
||||||
@ -133,22 +133,22 @@ macro_rules! exti {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpioa, PA0),
|
EXTI0 => (gpioa, PA0),
|
||||||
EXTI1Interrupt => (gpioa, PA1),
|
EXTI1 => (gpioa, PA1),
|
||||||
EXTI2Interrupt => (gpioa, PA2),
|
EXTI2 => (gpioa, PA2),
|
||||||
EXTI3Interrupt => (gpioa, PA3),
|
EXTI3 => (gpioa, PA3),
|
||||||
EXTI4Interrupt => (gpioa, PA4),
|
EXTI4 => (gpioa, PA4),
|
||||||
EXTI9_5Interrupt => (gpioa, PA5),
|
EXTI9_5 => (gpioa, PA5),
|
||||||
EXTI9_5Interrupt => (gpioa, PA6),
|
EXTI9_5 => (gpioa, PA6),
|
||||||
EXTI9_5Interrupt => (gpioa, PA7),
|
EXTI9_5 => (gpioa, PA7),
|
||||||
EXTI9_5Interrupt => (gpioa, PA8),
|
EXTI9_5 => (gpioa, PA8),
|
||||||
EXTI9_5Interrupt => (gpioa, PA9),
|
EXTI9_5 => (gpioa, PA9),
|
||||||
EXTI15_10Interrupt => (gpioa, PA10),
|
EXTI15_10 => (gpioa, PA10),
|
||||||
EXTI15_10Interrupt => (gpioa, PA11),
|
EXTI15_10 => (gpioa, PA11),
|
||||||
EXTI15_10Interrupt => (gpioa, PA12),
|
EXTI15_10 => (gpioa, PA12),
|
||||||
EXTI15_10Interrupt => (gpioa, PA13),
|
EXTI15_10 => (gpioa, PA13),
|
||||||
EXTI15_10Interrupt => (gpioa, PA14),
|
EXTI15_10 => (gpioa, PA14),
|
||||||
EXTI15_10Interrupt => (gpioa, PA15),
|
EXTI15_10 => (gpioa, PA15),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -171,22 +171,22 @@ exti! {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpiob, PB0),
|
EXTI0 => (gpiob, PB0),
|
||||||
EXTI1Interrupt => (gpiob, PB1),
|
EXTI1 => (gpiob, PB1),
|
||||||
EXTI2Interrupt => (gpiob, PB2),
|
EXTI2 => (gpiob, PB2),
|
||||||
EXTI3Interrupt => (gpiob, PB3),
|
EXTI3 => (gpiob, PB3),
|
||||||
EXTI4Interrupt => (gpiob, PB4),
|
EXTI4 => (gpiob, PB4),
|
||||||
EXTI9_5Interrupt => (gpiob, PB5),
|
EXTI9_5 => (gpiob, PB5),
|
||||||
EXTI9_5Interrupt => (gpiob, PB6),
|
EXTI9_5 => (gpiob, PB6),
|
||||||
EXTI9_5Interrupt => (gpiob, PB7),
|
EXTI9_5 => (gpiob, PB7),
|
||||||
EXTI9_5Interrupt => (gpiob, PB8),
|
EXTI9_5 => (gpiob, PB8),
|
||||||
EXTI9_5Interrupt => (gpiob, PB9),
|
EXTI9_5 => (gpiob, PB9),
|
||||||
EXTI15_10Interrupt => (gpiob, PB10),
|
EXTI15_10 => (gpiob, PB10),
|
||||||
EXTI15_10Interrupt => (gpiob, PB11),
|
EXTI15_10 => (gpiob, PB11),
|
||||||
EXTI15_10Interrupt => (gpiob, PB12),
|
EXTI15_10 => (gpiob, PB12),
|
||||||
EXTI15_10Interrupt => (gpiob, PB13),
|
EXTI15_10 => (gpiob, PB13),
|
||||||
EXTI15_10Interrupt => (gpiob, PB14),
|
EXTI15_10 => (gpiob, PB14),
|
||||||
EXTI15_10Interrupt => (gpiob, PB15),
|
EXTI15_10 => (gpiob, PB15),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -209,22 +209,22 @@ exti! {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpioc, PC0),
|
EXTI0 => (gpioc, PC0),
|
||||||
EXTI1Interrupt => (gpioc, PC1),
|
EXTI1 => (gpioc, PC1),
|
||||||
EXTI2Interrupt => (gpioc, PC2),
|
EXTI2 => (gpioc, PC2),
|
||||||
EXTI3Interrupt => (gpioc, PC3),
|
EXTI3 => (gpioc, PC3),
|
||||||
EXTI4Interrupt => (gpioc, PC4),
|
EXTI4 => (gpioc, PC4),
|
||||||
EXTI9_5Interrupt => (gpioc, PC5),
|
EXTI9_5 => (gpioc, PC5),
|
||||||
EXTI9_5Interrupt => (gpioc, PC6),
|
EXTI9_5 => (gpioc, PC6),
|
||||||
EXTI9_5Interrupt => (gpioc, PC7),
|
EXTI9_5 => (gpioc, PC7),
|
||||||
EXTI9_5Interrupt => (gpioc, PC8),
|
EXTI9_5 => (gpioc, PC8),
|
||||||
EXTI9_5Interrupt => (gpioc, PC9),
|
EXTI9_5 => (gpioc, PC9),
|
||||||
EXTI15_10Interrupt => (gpioc, PC10),
|
EXTI15_10 => (gpioc, PC10),
|
||||||
EXTI15_10Interrupt => (gpioc, PC11),
|
EXTI15_10 => (gpioc, PC11),
|
||||||
EXTI15_10Interrupt => (gpioc, PC12),
|
EXTI15_10 => (gpioc, PC12),
|
||||||
EXTI15_10Interrupt => (gpioc, PC13),
|
EXTI15_10 => (gpioc, PC13),
|
||||||
EXTI15_10Interrupt => (gpioc, PC14),
|
EXTI15_10 => (gpioc, PC14),
|
||||||
EXTI15_10Interrupt => (gpioc, PC15),
|
EXTI15_10 => (gpioc, PC15),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -246,22 +246,22 @@ exti! {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpiod, PD0),
|
EXTI0 => (gpiod, PD0),
|
||||||
EXTI1Interrupt => (gpiod, PD1),
|
EXTI1 => (gpiod, PD1),
|
||||||
EXTI2Interrupt => (gpiod, PD2),
|
EXTI2 => (gpiod, PD2),
|
||||||
EXTI3Interrupt => (gpiod, PD3),
|
EXTI3 => (gpiod, PD3),
|
||||||
EXTI4Interrupt => (gpiod, PD4),
|
EXTI4 => (gpiod, PD4),
|
||||||
EXTI9_5Interrupt => (gpiod, PD5),
|
EXTI9_5 => (gpiod, PD5),
|
||||||
EXTI9_5Interrupt => (gpiod, PD6),
|
EXTI9_5 => (gpiod, PD6),
|
||||||
EXTI9_5Interrupt => (gpiod, PD7),
|
EXTI9_5 => (gpiod, PD7),
|
||||||
EXTI9_5Interrupt => (gpiod, PD8),
|
EXTI9_5 => (gpiod, PD8),
|
||||||
EXTI9_5Interrupt => (gpiod, PD9),
|
EXTI9_5 => (gpiod, PD9),
|
||||||
EXTI15_10Interrupt => (gpiod, PD10),
|
EXTI15_10 => (gpiod, PD10),
|
||||||
EXTI15_10Interrupt => (gpiod, PD11),
|
EXTI15_10 => (gpiod, PD11),
|
||||||
EXTI15_10Interrupt => (gpiod, PD12),
|
EXTI15_10 => (gpiod, PD12),
|
||||||
EXTI15_10Interrupt => (gpiod, PD13),
|
EXTI15_10 => (gpiod, PD13),
|
||||||
EXTI15_10Interrupt => (gpiod, PD14),
|
EXTI15_10 => (gpiod, PD14),
|
||||||
EXTI15_10Interrupt => (gpiod, PD15),
|
EXTI15_10 => (gpiod, PD15),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -283,22 +283,22 @@ exti! {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpioe, PE0),
|
EXTI0 => (gpioe, PE0),
|
||||||
EXTI1Interrupt => (gpioe, PE1),
|
EXTI1 => (gpioe, PE1),
|
||||||
EXTI2Interrupt => (gpioe, PE2),
|
EXTI2 => (gpioe, PE2),
|
||||||
EXTI3Interrupt => (gpioe, PE3),
|
EXTI3 => (gpioe, PE3),
|
||||||
EXTI4Interrupt => (gpioe, PE4),
|
EXTI4 => (gpioe, PE4),
|
||||||
EXTI9_5Interrupt => (gpioe, PE5),
|
EXTI9_5 => (gpioe, PE5),
|
||||||
EXTI9_5Interrupt => (gpioe, PE6),
|
EXTI9_5 => (gpioe, PE6),
|
||||||
EXTI9_5Interrupt => (gpioe, PE7),
|
EXTI9_5 => (gpioe, PE7),
|
||||||
EXTI9_5Interrupt => (gpioe, PE8),
|
EXTI9_5 => (gpioe, PE8),
|
||||||
EXTI9_5Interrupt => (gpioe, PE9),
|
EXTI9_5 => (gpioe, PE9),
|
||||||
EXTI15_10Interrupt => (gpioe, PE10),
|
EXTI15_10 => (gpioe, PE10),
|
||||||
EXTI15_10Interrupt => (gpioe, PE11),
|
EXTI15_10 => (gpioe, PE11),
|
||||||
EXTI15_10Interrupt => (gpioe, PE12),
|
EXTI15_10 => (gpioe, PE12),
|
||||||
EXTI15_10Interrupt => (gpioe, PE13),
|
EXTI15_10 => (gpioe, PE13),
|
||||||
EXTI15_10Interrupt => (gpioe, PE14),
|
EXTI15_10 => (gpioe, PE14),
|
||||||
EXTI15_10Interrupt => (gpioe, PE15),
|
EXTI15_10 => (gpioe, PE15),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -318,22 +318,22 @@ exti! {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpiof, PF0),
|
EXTI0 => (gpiof, PF0),
|
||||||
EXTI1Interrupt => (gpiof, PF1),
|
EXTI1 => (gpiof, PF1),
|
||||||
EXTI2Interrupt => (gpiof, PF2),
|
EXTI2 => (gpiof, PF2),
|
||||||
EXTI3Interrupt => (gpiof, PF3),
|
EXTI3 => (gpiof, PF3),
|
||||||
EXTI4Interrupt => (gpiof, PF4),
|
EXTI4 => (gpiof, PF4),
|
||||||
EXTI9_5Interrupt => (gpiof, PF5),
|
EXTI9_5 => (gpiof, PF5),
|
||||||
EXTI9_5Interrupt => (gpiof, PF6),
|
EXTI9_5 => (gpiof, PF6),
|
||||||
EXTI9_5Interrupt => (gpiof, PF7),
|
EXTI9_5 => (gpiof, PF7),
|
||||||
EXTI9_5Interrupt => (gpiof, PF8),
|
EXTI9_5 => (gpiof, PF8),
|
||||||
EXTI9_5Interrupt => (gpiof, PF9),
|
EXTI9_5 => (gpiof, PF9),
|
||||||
EXTI15_10Interrupt => (gpiof, PF10),
|
EXTI15_10 => (gpiof, PF10),
|
||||||
EXTI15_10Interrupt => (gpiof, PF11),
|
EXTI15_10 => (gpiof, PF11),
|
||||||
EXTI15_10Interrupt => (gpiof, PF12),
|
EXTI15_10 => (gpiof, PF12),
|
||||||
EXTI15_10Interrupt => (gpiof, PF13),
|
EXTI15_10 => (gpiof, PF13),
|
||||||
EXTI15_10Interrupt => (gpiof, PF14),
|
EXTI15_10 => (gpiof, PF14),
|
||||||
EXTI15_10Interrupt => (gpiof, PF15),
|
EXTI15_10 => (gpiof, PF15),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -353,22 +353,22 @@ exti! {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpiog, PG0),
|
EXTI0 => (gpiog, PG0),
|
||||||
EXTI1Interrupt => (gpiog, PG1),
|
EXTI1 => (gpiog, PG1),
|
||||||
EXTI2Interrupt => (gpiog, PG2),
|
EXTI2 => (gpiog, PG2),
|
||||||
EXTI3Interrupt => (gpiog, PG3),
|
EXTI3 => (gpiog, PG3),
|
||||||
EXTI4Interrupt => (gpiog, PG4),
|
EXTI4 => (gpiog, PG4),
|
||||||
EXTI9_5Interrupt => (gpiog, PG5),
|
EXTI9_5 => (gpiog, PG5),
|
||||||
EXTI9_5Interrupt => (gpiog, PG6),
|
EXTI9_5 => (gpiog, PG6),
|
||||||
EXTI9_5Interrupt => (gpiog, PG7),
|
EXTI9_5 => (gpiog, PG7),
|
||||||
EXTI9_5Interrupt => (gpiog, PG8),
|
EXTI9_5 => (gpiog, PG8),
|
||||||
EXTI9_5Interrupt => (gpiog, PG9),
|
EXTI9_5 => (gpiog, PG9),
|
||||||
EXTI15_10Interrupt => (gpiog, PG10),
|
EXTI15_10 => (gpiog, PG10),
|
||||||
EXTI15_10Interrupt => (gpiog, PG11),
|
EXTI15_10 => (gpiog, PG11),
|
||||||
EXTI15_10Interrupt => (gpiog, PG12),
|
EXTI15_10 => (gpiog, PG12),
|
||||||
EXTI15_10Interrupt => (gpiog, PG13),
|
EXTI15_10 => (gpiog, PG13),
|
||||||
EXTI15_10Interrupt => (gpiog, PG14),
|
EXTI15_10 => (gpiog, PG14),
|
||||||
EXTI15_10Interrupt => (gpiog, PG15),
|
EXTI15_10 => (gpiog, PG15),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -390,28 +390,28 @@ exti! {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpioh, PH0),
|
EXTI0 => (gpioh, PH0),
|
||||||
EXTI1Interrupt => (gpioh, PH1),
|
EXTI1 => (gpioh, PH1),
|
||||||
EXTI2Interrupt => (gpioh, PH2),
|
EXTI2 => (gpioh, PH2),
|
||||||
EXTI3Interrupt => (gpioh, PH3),
|
EXTI3 => (gpioh, PH3),
|
||||||
EXTI4Interrupt => (gpioh, PH4),
|
EXTI4 => (gpioh, PH4),
|
||||||
EXTI9_5Interrupt => (gpioh, PH5),
|
EXTI9_5 => (gpioh, PH5),
|
||||||
EXTI9_5Interrupt => (gpioh, PH6),
|
EXTI9_5 => (gpioh, PH6),
|
||||||
EXTI9_5Interrupt => (gpioh, PH7),
|
EXTI9_5 => (gpioh, PH7),
|
||||||
EXTI9_5Interrupt => (gpioh, PH8),
|
EXTI9_5 => (gpioh, PH8),
|
||||||
EXTI9_5Interrupt => (gpioh, PH9),
|
EXTI9_5 => (gpioh, PH9),
|
||||||
EXTI15_10Interrupt => (gpioh, PH10),
|
EXTI15_10 => (gpioh, PH10),
|
||||||
EXTI15_10Interrupt => (gpioh, PH11),
|
EXTI15_10 => (gpioh, PH11),
|
||||||
EXTI15_10Interrupt => (gpioh, PH12),
|
EXTI15_10 => (gpioh, PH12),
|
||||||
EXTI15_10Interrupt => (gpioh, PH13),
|
EXTI15_10 => (gpioh, PH13),
|
||||||
EXTI15_10Interrupt => (gpioh, PH14),
|
EXTI15_10 => (gpioh, PH14),
|
||||||
EXTI15_10Interrupt => (gpioh, PH15),
|
EXTI15_10 => (gpioh, PH15),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "stm32f401"))]
|
#[cfg(any(feature = "stm32f401"))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpioh, PH0),
|
EXTI0 => (gpioh, PH0),
|
||||||
EXTI1Interrupt => (gpioh, PH1),
|
EXTI1 => (gpioh, PH1),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -427,22 +427,22 @@ exti! {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpioi, PI0),
|
EXTI0 => (gpioi, PI0),
|
||||||
EXTI1Interrupt => (gpioi, PI1),
|
EXTI1 => (gpioi, PI1),
|
||||||
EXTI2Interrupt => (gpioi, PI2),
|
EXTI2 => (gpioi, PI2),
|
||||||
EXTI3Interrupt => (gpioi, PI3),
|
EXTI3 => (gpioi, PI3),
|
||||||
EXTI4Interrupt => (gpioi, PI4),
|
EXTI4 => (gpioi, PI4),
|
||||||
EXTI9_5Interrupt => (gpioi, PI5),
|
EXTI9_5 => (gpioi, PI5),
|
||||||
EXTI9_5Interrupt => (gpioi, PI6),
|
EXTI9_5 => (gpioi, PI6),
|
||||||
EXTI9_5Interrupt => (gpioi, PI7),
|
EXTI9_5 => (gpioi, PI7),
|
||||||
EXTI9_5Interrupt => (gpioi, PI8),
|
EXTI9_5 => (gpioi, PI8),
|
||||||
EXTI9_5Interrupt => (gpioi, PI9),
|
EXTI9_5 => (gpioi, PI9),
|
||||||
EXTI15_10Interrupt => (gpioi, PI10),
|
EXTI15_10 => (gpioi, PI10),
|
||||||
EXTI15_10Interrupt => (gpioi, PI11),
|
EXTI15_10 => (gpioi, PI11),
|
||||||
EXTI15_10Interrupt => (gpioi, PI12),
|
EXTI15_10 => (gpioi, PI12),
|
||||||
EXTI15_10Interrupt => (gpioi, PI13),
|
EXTI15_10 => (gpioi, PI13),
|
||||||
EXTI15_10Interrupt => (gpioi, PI14),
|
EXTI15_10 => (gpioi, PI14),
|
||||||
EXTI15_10Interrupt => (gpioi, PI15),
|
EXTI15_10 => (gpioi, PI15),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -454,22 +454,22 @@ exti! {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpioj, PJ0),
|
EXTI0 => (gpioj, PJ0),
|
||||||
EXTI1Interrupt => (gpioj, PJ1),
|
EXTI1 => (gpioj, PJ1),
|
||||||
EXTI2Interrupt => (gpioj, PJ2),
|
EXTI2 => (gpioj, PJ2),
|
||||||
EXTI3Interrupt => (gpioj, PJ3),
|
EXTI3 => (gpioj, PJ3),
|
||||||
EXTI4Interrupt => (gpioj, PJ4),
|
EXTI4 => (gpioj, PJ4),
|
||||||
EXTI9_5Interrupt => (gpioj, PJ5),
|
EXTI9_5 => (gpioj, PJ5),
|
||||||
EXTI9_5Interrupt => (gpioj, PJ6),
|
EXTI9_5 => (gpioj, PJ6),
|
||||||
EXTI9_5Interrupt => (gpioj, PJ7),
|
EXTI9_5 => (gpioj, PJ7),
|
||||||
EXTI9_5Interrupt => (gpioj, PJ8),
|
EXTI9_5 => (gpioj, PJ8),
|
||||||
EXTI9_5Interrupt => (gpioj, PJ9),
|
EXTI9_5 => (gpioj, PJ9),
|
||||||
EXTI15_10Interrupt => (gpioj, PJ10),
|
EXTI15_10 => (gpioj, PJ10),
|
||||||
EXTI15_10Interrupt => (gpioj, PJ11),
|
EXTI15_10 => (gpioj, PJ11),
|
||||||
EXTI15_10Interrupt => (gpioj, PJ12),
|
EXTI15_10 => (gpioj, PJ12),
|
||||||
EXTI15_10Interrupt => (gpioj, PJ13),
|
EXTI15_10 => (gpioj, PJ13),
|
||||||
EXTI15_10Interrupt => (gpioj, PJ14),
|
EXTI15_10 => (gpioj, PJ14),
|
||||||
EXTI15_10Interrupt => (gpioj, PJ15),
|
EXTI15_10 => (gpioj, PJ15),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -481,12 +481,12 @@ exti! {
|
|||||||
feature = "stm32f479"
|
feature = "stm32f479"
|
||||||
))]
|
))]
|
||||||
exti! {
|
exti! {
|
||||||
EXTI0Interrupt => (gpiok, PK0),
|
EXTI0 => (gpiok, PK0),
|
||||||
EXTI1Interrupt => (gpiok, PK1),
|
EXTI1 => (gpiok, PK1),
|
||||||
EXTI2Interrupt => (gpiok, PK2),
|
EXTI2 => (gpiok, PK2),
|
||||||
EXTI3Interrupt => (gpiok, PK3),
|
EXTI3 => (gpiok, PK3),
|
||||||
EXTI4Interrupt => (gpiok, PK4),
|
EXTI4 => (gpiok, PK4),
|
||||||
EXTI9_5Interrupt => (gpiok, PK5),
|
EXTI9_5 => (gpiok, PK5),
|
||||||
EXTI9_5Interrupt => (gpiok, PK6),
|
EXTI9_5 => (gpiok, PK6),
|
||||||
EXTI9_5Interrupt => (gpiok, PK7),
|
EXTI9_5 => (gpiok, PK7),
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,8 @@ use core::sync::atomic::{compiler_fence, Ordering};
|
|||||||
use crate::pac::NVIC_PRIO_BITS;
|
use crate::pac::NVIC_PRIO_BITS;
|
||||||
|
|
||||||
// Re-exports
|
// Re-exports
|
||||||
pub use crate::pac::Interrupt;
|
|
||||||
pub use crate::pac::Interrupt::*; // needed for cortex-m-rt #[interrupt]
|
|
||||||
pub use cortex_m::interrupt::{CriticalSection, Mutex};
|
pub use cortex_m::interrupt::{CriticalSection, Mutex};
|
||||||
pub use embassy::interrupt::{declare, take, OwnedInterrupt};
|
pub use embassy::interrupt::{declare, take, Interrupt};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
|
@ -315,5 +315,3 @@ pub mod exti;
|
|||||||
pub mod interrupt;
|
pub mod interrupt;
|
||||||
pub mod rtc;
|
pub mod rtc;
|
||||||
pub mod serial;
|
pub mod serial;
|
||||||
|
|
||||||
pub use cortex_m_rt::interrupt;
|
|
||||||
|
@ -7,7 +7,7 @@ use stm32f4xx_hal::bb;
|
|||||||
use stm32f4xx_hal::rcc::Clocks;
|
use stm32f4xx_hal::rcc::Clocks;
|
||||||
|
|
||||||
use crate::interrupt;
|
use crate::interrupt;
|
||||||
use crate::interrupt::{CriticalSection, Mutex, OwnedInterrupt};
|
use crate::interrupt::{CriticalSection, Interrupt, Mutex};
|
||||||
|
|
||||||
// RTC timekeeping works with something we call "periods", which are time intervals
|
// RTC timekeeping works with something we call "periods", which are time intervals
|
||||||
// of 2^15 ticks. The RTC counter value is 16 bits, so one "overflow cycle" is 2 periods.
|
// of 2^15 ticks. The RTC counter value is 16 bits, so one "overflow cycle" is 2 periods.
|
||||||
@ -236,7 +236,7 @@ mod sealed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub trait Instance: sealed::Sealed + Sized + 'static {
|
pub trait Instance: sealed::Sealed + Sized + 'static {
|
||||||
type Interrupt: OwnedInterrupt;
|
type Interrupt: Interrupt;
|
||||||
const REAL_ALARM_COUNT: usize;
|
const REAL_ALARM_COUNT: usize;
|
||||||
|
|
||||||
fn enable_clock(&self);
|
fn enable_clock(&self);
|
||||||
@ -489,17 +489,17 @@ macro_rules! impl_timer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "stm32f410"))]
|
#[cfg(not(feature = "stm32f410"))]
|
||||||
impl_timer!(tim2: (TIM2, TIM2Interrupt, apb1enr, 0, apb1rstr, 0, ppre1, pclk1), 3);
|
impl_timer!(tim2: (TIM2, TIM2, apb1enr, 0, apb1rstr, 0, ppre1, pclk1), 3);
|
||||||
|
|
||||||
#[cfg(not(feature = "stm32f410"))]
|
#[cfg(not(feature = "stm32f410"))]
|
||||||
impl_timer!(tim3: (TIM3, TIM3Interrupt, apb1enr, 1, apb1rstr, 1, ppre1, pclk1), 3);
|
impl_timer!(tim3: (TIM3, TIM3, apb1enr, 1, apb1rstr, 1, ppre1, pclk1), 3);
|
||||||
|
|
||||||
#[cfg(not(feature = "stm32f410"))]
|
#[cfg(not(feature = "stm32f410"))]
|
||||||
impl_timer!(tim4: (TIM4, TIM4Interrupt, apb1enr, 2, apb1rstr, 2, ppre1, pclk1), 3);
|
impl_timer!(tim4: (TIM4, TIM4, apb1enr, 2, apb1rstr, 2, ppre1, pclk1), 3);
|
||||||
|
|
||||||
impl_timer!(tim5: (TIM5, TIM5Interrupt, apb1enr, 3, apb1rstr, 3, ppre1, pclk1), 3);
|
impl_timer!(tim5: (TIM5, TIM5, apb1enr, 3, apb1rstr, 3, ppre1, pclk1), 3);
|
||||||
|
|
||||||
impl_timer!(tim9: (TIM9, TIM1_BRK_TIM9Interrupt, apb2enr, 16, apb2rstr, 16, ppre2, pclk2), 1);
|
impl_timer!(tim9: (TIM9, TIM1_BRK_TIM9, apb2enr, 16, apb2rstr, 16, ppre2, pclk2), 1);
|
||||||
|
|
||||||
#[cfg(not(any(feature = "stm32f401", feature = "stm32f410", feature = "stm32f411")))]
|
#[cfg(not(any(feature = "stm32f401", feature = "stm32f410", feature = "stm32f411")))]
|
||||||
impl_timer!(tim12: (TIM12, TIM8_BRK_TIM12Interrupt, apb1enr, 6, apb1rstr, 6, ppre1, pclk1), 1);
|
impl_timer!(tim12: (TIM12, TIM8_BRK_TIM12, apb1enr, 6, apb1rstr, 6, ppre1, pclk1), 1);
|
||||||
|
@ -8,7 +8,7 @@ use core::future::Future;
|
|||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::sync::atomic::{self, Ordering};
|
use core::sync::atomic::{self, Ordering};
|
||||||
|
|
||||||
use embassy::interrupt::OwnedInterrupt;
|
use embassy::interrupt::Interrupt;
|
||||||
use embassy::uart::{Error, Uart};
|
use embassy::uart::{Error, Uart};
|
||||||
use embassy::util::Signal;
|
use embassy::util::Signal;
|
||||||
|
|
||||||
@ -29,9 +29,9 @@ pub struct Serial<USART: PeriAddress<MemSize = u8>, TSTREAM: Stream, RSTREAM: St
|
|||||||
tx_stream: Option<TSTREAM>,
|
tx_stream: Option<TSTREAM>,
|
||||||
rx_stream: Option<RSTREAM>,
|
rx_stream: Option<RSTREAM>,
|
||||||
usart: Option<USART>,
|
usart: Option<USART>,
|
||||||
tx_int: interrupt::DMA2_STREAM7Interrupt,
|
tx_int: interrupt::DMA2_STREAM7,
|
||||||
rx_int: interrupt::DMA2_STREAM2Interrupt,
|
rx_int: interrupt::DMA2_STREAM2,
|
||||||
usart_int: interrupt::USART1Interrupt,
|
usart_int: interrupt::USART1,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
@ -52,9 +52,9 @@ impl Serial<USART1, Stream7<DMA2>, Stream2<DMA2>> {
|
|||||||
usart: USART1,
|
usart: USART1,
|
||||||
dma: DMA2,
|
dma: DMA2,
|
||||||
pins: PINS,
|
pins: PINS,
|
||||||
tx_int: interrupt::DMA2_STREAM7Interrupt,
|
tx_int: interrupt::DMA2_STREAM7,
|
||||||
rx_int: interrupt::DMA2_STREAM2Interrupt,
|
rx_int: interrupt::DMA2_STREAM2,
|
||||||
usart_int: interrupt::USART1Interrupt,
|
usart_int: interrupt::USART1,
|
||||||
mut config: SerialConfig,
|
mut config: SerialConfig,
|
||||||
clocks: Clocks,
|
clocks: Clocks,
|
||||||
) -> Self
|
) -> Self
|
||||||
|
@ -17,7 +17,7 @@ mod waker;
|
|||||||
|
|
||||||
use self::util::UninitCell;
|
use self::util::UninitCell;
|
||||||
use crate::fmt::panic;
|
use crate::fmt::panic;
|
||||||
use crate::interrupt::OwnedInterrupt;
|
use crate::interrupt::Interrupt;
|
||||||
use crate::time::Alarm;
|
use crate::time::Alarm;
|
||||||
|
|
||||||
// repr(C) is needed to guarantee that the raw::Task is located at offset 0
|
// 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) {
|
|||||||
cortex_m::peripheral::NVIC::pend(N(n))
|
cortex_m::peripheral::NVIC::pend(N(n))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct IrqExecutor<I: OwnedInterrupt> {
|
pub struct IrqExecutor<I: Interrupt> {
|
||||||
irq: I,
|
irq: I,
|
||||||
inner: raw::Executor,
|
inner: raw::Executor,
|
||||||
not_send: PhantomData<*mut ()>,
|
not_send: PhantomData<*mut ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I: OwnedInterrupt> IrqExecutor<I> {
|
impl<I: Interrupt> IrqExecutor<I> {
|
||||||
pub fn new(irq: I) -> Self {
|
pub fn new(irq: I) -> Self {
|
||||||
let ctx = irq.number() as *mut ();
|
let ctx = irq.number() as *mut ();
|
||||||
Self {
|
Self {
|
||||||
|
@ -29,7 +29,7 @@ unsafe impl cortex_m::interrupt::InterruptNumber for NrWrap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe trait OwnedInterrupt {
|
pub unsafe trait Interrupt {
|
||||||
type Priority: From<u8> + Into<u8> + Copy;
|
type Priority: From<u8> + Into<u8> + Copy;
|
||||||
fn number(&self) -> u16;
|
fn number(&self) -> u16;
|
||||||
unsafe fn steal() -> Self;
|
unsafe fn steal() -> Self;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::executor;
|
use crate::executor;
|
||||||
use crate::fmt::panic;
|
use crate::fmt::panic;
|
||||||
use crate::interrupt::OwnedInterrupt;
|
use crate::interrupt::Interrupt;
|
||||||
use core::cell::UnsafeCell;
|
use core::cell::UnsafeCell;
|
||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
@ -79,18 +79,18 @@ unsafe impl cortex_m::interrupt::Nr for NrWrap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct InterruptFuture<'a, I: OwnedInterrupt> {
|
pub struct InterruptFuture<'a, I: Interrupt> {
|
||||||
interrupt: &'a mut I,
|
interrupt: &'a mut I,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, I: OwnedInterrupt> Drop for InterruptFuture<'a, I> {
|
impl<'a, I: Interrupt> Drop for InterruptFuture<'a, I> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
self.interrupt.disable();
|
self.interrupt.disable();
|
||||||
self.interrupt.remove_handler();
|
self.interrupt.remove_handler();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, I: OwnedInterrupt> InterruptFuture<'a, I> {
|
impl<'a, I: Interrupt> InterruptFuture<'a, I> {
|
||||||
pub fn new(interrupt: &'a mut I) -> Self {
|
pub fn new(interrupt: &'a mut I) -> Self {
|
||||||
interrupt.disable();
|
interrupt.disable();
|
||||||
interrupt.set_handler(Self::interrupt_handler, ptr::null_mut());
|
interrupt.set_handler(Self::interrupt_handler, ptr::null_mut());
|
||||||
@ -114,9 +114,9 @@ impl<'a, I: OwnedInterrupt> InterruptFuture<'a, I> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, I: OwnedInterrupt> Unpin for InterruptFuture<'a, I> {}
|
impl<'a, I: Interrupt> Unpin for InterruptFuture<'a, I> {}
|
||||||
|
|
||||||
impl<'a, I: OwnedInterrupt> Future for InterruptFuture<'a, I> {
|
impl<'a, I: Interrupt> Future for InterruptFuture<'a, I> {
|
||||||
type Output = ();
|
type Output = ();
|
||||||
|
|
||||||
fn poll(self: core::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
|
fn poll(self: core::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
|
||||||
|
Loading…
Reference in New Issue
Block a user