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-rp/src/uart/buffered.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-rp/src/uart/buffered.rs')
| -rw-r--r-- | embassy-rp/src/uart/buffered.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-rp/src/uart/buffered.rs b/embassy-rp/src/uart/buffered.rs index bb808c467..6660d5dc9 100644 --- a/embassy-rp/src/uart/buffered.rs +++ b/embassy-rp/src/uart/buffered.rs | |||
| @@ -3,14 +3,14 @@ use core::slice; | |||
| 3 | use core::task::Poll; | 3 | use core::task::Poll; |
| 4 | 4 | ||
| 5 | use atomic_polyfill::{AtomicU8, Ordering}; | 5 | use atomic_polyfill::{AtomicU8, Ordering}; |
| 6 | use embassy_cortex_m::interrupt::{self, Binding, Interrupt}; | ||
| 7 | use embassy_hal_common::atomic_ring_buffer::RingBuffer; | 6 | use embassy_hal_common::atomic_ring_buffer::RingBuffer; |
| 8 | use embassy_sync::waitqueue::AtomicWaker; | 7 | use embassy_sync::waitqueue::AtomicWaker; |
| 9 | use embassy_time::{Duration, Timer}; | 8 | use embassy_time::{Duration, Timer}; |
| 10 | 9 | ||
| 11 | use super::*; | 10 | use super::*; |
| 12 | use crate::clocks::clk_peri_freq; | 11 | use crate::clocks::clk_peri_freq; |
| 13 | use crate::RegExt; | 12 | use crate::interrupt::typelevel::{Binding, Interrupt}; |
| 13 | use crate::{interrupt, RegExt}; | ||
| 14 | 14 | ||
| 15 | pub struct State { | 15 | pub struct State { |
| 16 | tx_waker: AtomicWaker, | 16 | tx_waker: AtomicWaker, |
| @@ -485,7 +485,7 @@ pub struct BufferedInterruptHandler<T: Instance> { | |||
| 485 | _uart: PhantomData<T>, | 485 | _uart: PhantomData<T>, |
| 486 | } | 486 | } |
| 487 | 487 | ||
| 488 | impl<T: Instance> interrupt::Handler<T::Interrupt> for BufferedInterruptHandler<T> { | 488 | impl<T: Instance> interrupt::typelevel::Handler<T::Interrupt> for BufferedInterruptHandler<T> { |
| 489 | unsafe fn on_interrupt() { | 489 | unsafe fn on_interrupt() { |
| 490 | let r = T::regs(); | 490 | let r = T::regs(); |
| 491 | if r.uartdmacr().read().rxdmae() { | 491 | if r.uartdmacr().read().rxdmae() { |
