aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/rng.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-03-26 16:01:37 +0100
committerDario Nieuwenhuis <[email protected]>2025-03-27 15:18:06 +0100
commitd41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch)
tree678b6fc732216e529dc38e6f65b72a309917ac32 /embassy-nrf/src/rng.rs
parent9edf5b7f049f95742b60b041e4443967d8a6b708 (diff)
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-nrf/src/rng.rs')
-rw-r--r--embassy-nrf/src/rng.rs12
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
11use critical_section::{CriticalSection, Mutex}; 11use critical_section::{CriticalSection, Mutex};
12use embassy_hal_internal::drop::OnDrop; 12use embassy_hal_internal::drop::OnDrop;
13use embassy_hal_internal::{into_ref, PeripheralRef}; 13use embassy_hal_internal::{Peri, PeripheralType};
14use embassy_sync::waitqueue::WakerRegistration; 14use embassy_sync::waitqueue::WakerRegistration;
15 15
16use crate::interrupt::typelevel::Interrupt; 16use crate::interrupt::typelevel::Interrupt;
17use crate::{interrupt, pac, Peripheral}; 17use crate::{interrupt, pac};
18 18
19/// Interrupt handler. 19/// Interrupt handler.
20pub struct InterruptHandler<T: Instance> { 20pub 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`.
58pub struct Rng<'d, T: Instance> { 58pub struct Rng<'d, T: Instance> {
59 _peri: PeripheralRef<'d, T>, 59 _peri: Peri<'d, T>,
60} 60}
61 61
62impl<'d, T: Instance> Rng<'d, T> { 62impl<'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)]
253pub trait Instance: Peripheral<P = Self> + SealedInstance + 'static + Send { 251pub 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}