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-stm32/src/rng.rs | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-stm32/src/rng.rs')
| -rw-r--r-- | embassy-stm32/src/rng.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs index b96200e5e..250a08a39 100644 --- a/embassy-stm32/src/rng.rs +++ b/embassy-stm32/src/rng.rs | |||
| @@ -5,12 +5,12 @@ use core::future::poll_fn; | |||
| 5 | use core::marker::PhantomData; | 5 | use core::marker::PhantomData; |
| 6 | use core::task::Poll; | 6 | use core::task::Poll; |
| 7 | 7 | ||
| 8 | use embassy_hal_internal::{into_ref, PeripheralRef}; | 8 | use embassy_hal_internal::PeripheralType; |
| 9 | use embassy_sync::waitqueue::AtomicWaker; | 9 | use embassy_sync::waitqueue::AtomicWaker; |
| 10 | use rand_core::{CryptoRng, RngCore}; | 10 | use rand_core::{CryptoRng, RngCore}; |
| 11 | 11 | ||
| 12 | use crate::interrupt::typelevel::Interrupt; | 12 | use crate::interrupt::typelevel::Interrupt; |
| 13 | use crate::{interrupt, pac, peripherals, rcc, Peripheral}; | 13 | use crate::{interrupt, pac, peripherals, rcc, Peri}; |
| 14 | 14 | ||
| 15 | static RNG_WAKER: AtomicWaker = AtomicWaker::new(); | 15 | static RNG_WAKER: AtomicWaker = AtomicWaker::new(); |
| 16 | 16 | ||
| @@ -43,17 +43,16 @@ impl<T: Instance> interrupt::typelevel::Handler<T::Interrupt> for InterruptHandl | |||
| 43 | 43 | ||
| 44 | /// RNG driver. | 44 | /// RNG driver. |
| 45 | pub struct Rng<'d, T: Instance> { | 45 | pub struct Rng<'d, T: Instance> { |
| 46 | _inner: PeripheralRef<'d, T>, | 46 | _inner: Peri<'d, T>, |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | impl<'d, T: Instance> Rng<'d, T> { | 49 | impl<'d, T: Instance> Rng<'d, T> { |
| 50 | /// Create a new RNG driver. | 50 | /// Create a new RNG driver. |
| 51 | pub fn new( | 51 | pub fn new( |
| 52 | inner: impl Peripheral<P = T> + 'd, | 52 | inner: Peri<'d, T>, |
| 53 | _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, | 53 | _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, |
| 54 | ) -> Self { | 54 | ) -> Self { |
| 55 | rcc::enable_and_reset::<T>(); | 55 | rcc::enable_and_reset::<T>(); |
| 56 | into_ref!(inner); | ||
| 57 | let mut random = Self { _inner: inner }; | 56 | let mut random = Self { _inner: inner }; |
| 58 | random.reset(); | 57 | random.reset(); |
| 59 | 58 | ||
| @@ -228,7 +227,7 @@ trait SealedInstance { | |||
| 228 | 227 | ||
| 229 | /// RNG instance trait. | 228 | /// RNG instance trait. |
| 230 | #[allow(private_bounds)] | 229 | #[allow(private_bounds)] |
| 231 | pub trait Instance: SealedInstance + Peripheral<P = Self> + crate::rcc::RccPeripheral + 'static + Send { | 230 | pub trait Instance: SealedInstance + PeripheralType + crate::rcc::RccPeripheral + 'static + Send { |
| 232 | /// Interrupt for this RNG instance. | 231 | /// Interrupt for this RNG instance. |
| 233 | type Interrupt: interrupt::typelevel::Interrupt; | 232 | type Interrupt: interrupt::typelevel::Interrupt; |
| 234 | } | 233 | } |
