diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-03-26 16:01:37 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-03-27 15:18:06 +0100 |
| commit | d41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch) | |
| tree | 678b6fc732216e529dc38e6f65b72a309917ac32 /embassy-rp/src/usb.rs | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-rp/src/usb.rs')
| -rw-r--r-- | embassy-rp/src/usb.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/embassy-rp/src/usb.rs b/embassy-rp/src/usb.rs index 26cb90d89..96541ade6 100644 --- a/embassy-rp/src/usb.rs +++ b/embassy-rp/src/usb.rs | |||
| @@ -5,6 +5,7 @@ use core::slice; | |||
| 5 | use core::sync::atomic::{compiler_fence, Ordering}; | 5 | use core::sync::atomic::{compiler_fence, Ordering}; |
| 6 | use core::task::Poll; | 6 | use core::task::Poll; |
| 7 | 7 | ||
| 8 | use embassy_hal_internal::PeripheralType; | ||
| 8 | use embassy_sync::waitqueue::AtomicWaker; | 9 | use embassy_sync::waitqueue::AtomicWaker; |
| 9 | use embassy_usb_driver as driver; | 10 | use embassy_usb_driver as driver; |
| 10 | use embassy_usb_driver::{ | 11 | use embassy_usb_driver::{ |
| @@ -12,7 +13,7 @@ use embassy_usb_driver::{ | |||
| 12 | }; | 13 | }; |
| 13 | 14 | ||
| 14 | use crate::interrupt::typelevel::{Binding, Interrupt}; | 15 | use crate::interrupt::typelevel::{Binding, Interrupt}; |
| 15 | use crate::{interrupt, pac, peripherals, Peripheral, RegExt}; | 16 | use crate::{interrupt, pac, peripherals, Peri, RegExt}; |
| 16 | 17 | ||
| 17 | trait SealedInstance { | 18 | trait SealedInstance { |
| 18 | fn regs() -> crate::pac::usb::Usb; | 19 | fn regs() -> crate::pac::usb::Usb; |
| @@ -21,7 +22,7 @@ trait SealedInstance { | |||
| 21 | 22 | ||
| 22 | /// USB peripheral instance. | 23 | /// USB peripheral instance. |
| 23 | #[allow(private_bounds)] | 24 | #[allow(private_bounds)] |
| 24 | pub trait Instance: SealedInstance + 'static { | 25 | pub trait Instance: SealedInstance + PeripheralType + 'static { |
| 25 | /// Interrupt for this peripheral. | 26 | /// Interrupt for this peripheral. |
| 26 | type Interrupt: interrupt::typelevel::Interrupt; | 27 | type Interrupt: interrupt::typelevel::Interrupt; |
| 27 | } | 28 | } |
| @@ -107,7 +108,7 @@ pub struct Driver<'d, T: Instance> { | |||
| 107 | 108 | ||
| 108 | impl<'d, T: Instance> Driver<'d, T> { | 109 | impl<'d, T: Instance> Driver<'d, T> { |
| 109 | /// Create a new USB driver. | 110 | /// Create a new USB driver. |
| 110 | pub fn new(_usb: impl Peripheral<P = T> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>>) -> Self { | 111 | pub fn new(_usb: Peri<'d, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>>) -> Self { |
| 111 | T::Interrupt::unpend(); | 112 | T::Interrupt::unpend(); |
| 112 | unsafe { T::Interrupt::enable() }; | 113 | unsafe { T::Interrupt::enable() }; |
| 113 | 114 | ||
