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-nrf/src/pwm.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-nrf/src/pwm.rs')
| -rw-r--r-- | embassy-nrf/src/pwm.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs index 708f23104..363a255d5 100644 --- a/embassy-nrf/src/pwm.rs +++ b/embassy-nrf/src/pwm.rs | |||
| @@ -8,10 +8,9 @@ use embassy_hal_common::{into_ref, PeripheralRef}; | |||
| 8 | 8 | ||
| 9 | use crate::gpio::sealed::Pin as _; | 9 | use crate::gpio::sealed::Pin as _; |
| 10 | use crate::gpio::{AnyPin, Pin as GpioPin, PselBits}; | 10 | use crate::gpio::{AnyPin, Pin as GpioPin, PselBits}; |
| 11 | use crate::interrupt::Interrupt; | ||
| 12 | use crate::ppi::{Event, Task}; | 11 | use crate::ppi::{Event, Task}; |
| 13 | use crate::util::slice_in_ram_or; | 12 | use crate::util::slice_in_ram_or; |
| 14 | use crate::{pac, Peripheral}; | 13 | use crate::{interrupt, pac, Peripheral}; |
| 15 | 14 | ||
| 16 | /// SimplePwm is the traditional pwm interface you're probably used to, allowing | 15 | /// SimplePwm is the traditional pwm interface you're probably used to, allowing |
| 17 | /// to simply set a duty cycle across up to four channels. | 16 | /// to simply set a duty cycle across up to four channels. |
| @@ -843,7 +842,7 @@ pub(crate) mod sealed { | |||
| 843 | /// PWM peripheral instance. | 842 | /// PWM peripheral instance. |
| 844 | pub trait Instance: Peripheral<P = Self> + sealed::Instance + 'static { | 843 | pub trait Instance: Peripheral<P = Self> + sealed::Instance + 'static { |
| 845 | /// Interrupt for this peripheral. | 844 | /// Interrupt for this peripheral. |
| 846 | type Interrupt: Interrupt; | 845 | type Interrupt: interrupt::typelevel::Interrupt; |
| 847 | } | 846 | } |
| 848 | 847 | ||
| 849 | macro_rules! impl_pwm { | 848 | macro_rules! impl_pwm { |
| @@ -854,7 +853,7 @@ macro_rules! impl_pwm { | |||
| 854 | } | 853 | } |
| 855 | } | 854 | } |
| 856 | impl crate::pwm::Instance for peripherals::$type { | 855 | impl crate::pwm::Instance for peripherals::$type { |
| 857 | type Interrupt = crate::interrupt::$irq; | 856 | type Interrupt = crate::interrupt::typelevel::$irq; |
| 858 | } | 857 | } |
| 859 | }; | 858 | }; |
| 860 | } | 859 | } |
