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/time_driver.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/time_driver.rs')
| -rw-r--r-- | embassy-nrf/src/time_driver.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-nrf/src/time_driver.rs b/embassy-nrf/src/time_driver.rs index 4feff8a75..f993d7b2e 100644 --- a/embassy-nrf/src/time_driver.rs +++ b/embassy-nrf/src/time_driver.rs | |||
| @@ -7,7 +7,7 @@ use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; | |||
| 7 | use embassy_sync::blocking_mutex::CriticalSectionMutex as Mutex; | 7 | use embassy_sync::blocking_mutex::CriticalSectionMutex as Mutex; |
| 8 | use embassy_time::driver::{AlarmHandle, Driver}; | 8 | use embassy_time::driver::{AlarmHandle, Driver}; |
| 9 | 9 | ||
| 10 | use crate::interrupt::Interrupt; | 10 | use crate::interrupt::InterruptExt; |
| 11 | use crate::{interrupt, pac}; | 11 | use crate::{interrupt, pac}; |
| 12 | 12 | ||
| 13 | fn rtc() -> &'static pac::rtc0::RegisterBlock { | 13 | fn rtc() -> &'static pac::rtc0::RegisterBlock { |
| @@ -142,8 +142,8 @@ impl RtcDriver { | |||
| 142 | // Wait for clear | 142 | // Wait for clear |
| 143 | while r.counter.read().bits() != 0 {} | 143 | while r.counter.read().bits() != 0 {} |
| 144 | 144 | ||
| 145 | interrupt::RTC1::set_priority(irq_prio); | 145 | interrupt::RTC1.set_priority(irq_prio); |
| 146 | unsafe { interrupt::RTC1::enable() }; | 146 | unsafe { interrupt::RTC1.enable() }; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | fn on_interrupt(&self) { | 149 | fn on_interrupt(&self) { |
