diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-06-08 16:08:40 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-06-08 18:00:48 +0200 |
| commit | 921780e6bfb9bcb2cd087b8aa8b094d792c99fa2 (patch) | |
| tree | bd21fba9800471b860ca44e05567588dcc1afef7 /embassy-stm32/src/timer/mod.rs | |
| parent | 87ad66f2b4a5bfd36dfc8d8aad5492e9e3f915e6 (diff) | |
Make interrupt module more standard.
- Move typelevel interrupts to a special-purpose mod: `embassy_xx::interrupt::typelevel`.
- Reexport the PAC interrupt enum in `embassy_xx::interrupt`.
This has a few advantages:
- The `embassy_xx::interrupt` module is now more "standard".
- It works with `cortex-m` functions for manipulating interrupts, for example.
- It works with RTIC.
- the interrupt enum allows holding value that can be "any interrupt at runtime", this can't be done with typelevel irqs.
- When "const-generics on enums" is stable, we can remove the typelevel interrupts without disruptive changes to `embassy_xx::interrupt`.
Diffstat (limited to 'embassy-stm32/src/timer/mod.rs')
| -rw-r--r-- | embassy-stm32/src/timer/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-stm32/src/timer/mod.rs b/embassy-stm32/src/timer/mod.rs index 772c67686..14db97024 100644 --- a/embassy-stm32/src/timer/mod.rs +++ b/embassy-stm32/src/timer/mod.rs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | use stm32_metapac::timer::vals; | 1 | use stm32_metapac::timer::vals; |
| 2 | 2 | ||
| 3 | use crate::interrupt::Interrupt; | 3 | use crate::interrupt; |
| 4 | use crate::rcc::sealed::RccPeripheral as __RccPeri; | 4 | use crate::rcc::sealed::RccPeripheral as __RccPeri; |
| 5 | use crate::rcc::RccPeripheral; | 5 | use crate::rcc::RccPeripheral; |
| 6 | use crate::time::Hertz; | 6 | use crate::time::Hertz; |
| @@ -13,7 +13,7 @@ pub mod low_level { | |||
| 13 | pub(crate) mod sealed { | 13 | pub(crate) mod sealed { |
| 14 | use super::*; | 14 | use super::*; |
| 15 | pub trait Basic16bitInstance: RccPeripheral { | 15 | pub trait Basic16bitInstance: RccPeripheral { |
| 16 | type Interrupt: Interrupt; | 16 | type Interrupt: interrupt::typelevel::Interrupt; |
| 17 | 17 | ||
| 18 | fn regs() -> crate::pac::timer::TimBasic; | 18 | fn regs() -> crate::pac::timer::TimBasic; |
| 19 | 19 | ||
| @@ -57,7 +57,7 @@ pub trait Basic16bitInstance: sealed::Basic16bitInstance + 'static {} | |||
| 57 | macro_rules! impl_basic_16bit_timer { | 57 | macro_rules! impl_basic_16bit_timer { |
| 58 | ($inst:ident, $irq:ident) => { | 58 | ($inst:ident, $irq:ident) => { |
| 59 | impl sealed::Basic16bitInstance for crate::peripherals::$inst { | 59 | impl sealed::Basic16bitInstance for crate::peripherals::$inst { |
| 60 | type Interrupt = crate::interrupt::$irq; | 60 | type Interrupt = crate::interrupt::typelevel::$irq; |
| 61 | 61 | ||
| 62 | fn regs() -> crate::pac::timer::TimBasic { | 62 | fn regs() -> crate::pac::timer::TimBasic { |
| 63 | crate::pac::timer::TimBasic(crate::pac::$inst.0) | 63 | crate::pac::timer::TimBasic(crate::pac::$inst.0) |
