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-nrf/src/rng.rs | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-nrf/src/rng.rs')
| -rw-r--r-- | embassy-nrf/src/rng.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/embassy-nrf/src/rng.rs b/embassy-nrf/src/rng.rs index 7a98ab2fb..e75ffda00 100644 --- a/embassy-nrf/src/rng.rs +++ b/embassy-nrf/src/rng.rs | |||
| @@ -10,11 +10,11 @@ use core::task::Poll; | |||
| 10 | 10 | ||
| 11 | use critical_section::{CriticalSection, Mutex}; | 11 | use critical_section::{CriticalSection, Mutex}; |
| 12 | use embassy_hal_internal::drop::OnDrop; | 12 | use embassy_hal_internal::drop::OnDrop; |
| 13 | use embassy_hal_internal::{into_ref, PeripheralRef}; | 13 | use embassy_hal_internal::{Peri, PeripheralType}; |
| 14 | use embassy_sync::waitqueue::WakerRegistration; | 14 | use embassy_sync::waitqueue::WakerRegistration; |
| 15 | 15 | ||
| 16 | use crate::interrupt::typelevel::Interrupt; | 16 | use crate::interrupt::typelevel::Interrupt; |
| 17 | use crate::{interrupt, pac, Peripheral}; | 17 | use crate::{interrupt, pac}; |
| 18 | 18 | ||
| 19 | /// Interrupt handler. | 19 | /// Interrupt handler. |
| 20 | pub struct InterruptHandler<T: Instance> { | 20 | pub struct InterruptHandler<T: Instance> { |
| @@ -56,7 +56,7 @@ impl<T: Instance> interrupt::typelevel::Handler<T::Interrupt> for InterruptHandl | |||
| 56 | /// | 56 | /// |
| 57 | /// It has a non-blocking API, and a blocking api through `rand`. | 57 | /// It has a non-blocking API, and a blocking api through `rand`. |
| 58 | pub struct Rng<'d, T: Instance> { | 58 | pub struct Rng<'d, T: Instance> { |
| 59 | _peri: PeripheralRef<'d, T>, | 59 | _peri: Peri<'d, T>, |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | impl<'d, T: Instance> Rng<'d, T> { | 62 | impl<'d, T: Instance> Rng<'d, T> { |
| @@ -67,11 +67,9 @@ impl<'d, T: Instance> Rng<'d, T> { | |||
| 67 | /// | 67 | /// |
| 68 | /// The synchronous API is safe. | 68 | /// The synchronous API is safe. |
| 69 | pub fn new( | 69 | pub fn new( |
| 70 | rng: impl Peripheral<P = T> + 'd, | 70 | rng: Peri<'d, T>, |
| 71 | _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, | 71 | _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, |
| 72 | ) -> Self { | 72 | ) -> Self { |
| 73 | into_ref!(rng); | ||
| 74 | |||
| 75 | let this = Self { _peri: rng }; | 73 | let this = Self { _peri: rng }; |
| 76 | 74 | ||
| 77 | this.stop(); | 75 | this.stop(); |
| @@ -250,7 +248,7 @@ pub(crate) trait SealedInstance { | |||
| 250 | 248 | ||
| 251 | /// RNG peripheral instance. | 249 | /// RNG peripheral instance. |
| 252 | #[allow(private_bounds)] | 250 | #[allow(private_bounds)] |
| 253 | pub trait Instance: Peripheral<P = Self> + SealedInstance + 'static + Send { | 251 | pub trait Instance: SealedInstance + PeripheralType + 'static + Send { |
| 254 | /// Interrupt for this peripheral. | 252 | /// Interrupt for this peripheral. |
| 255 | type Interrupt: interrupt::typelevel::Interrupt; | 253 | type Interrupt: interrupt::typelevel::Interrupt; |
| 256 | } | 254 | } |
