aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/hash
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-stm32/src/hash
parent9edf5b7f049f95742b60b041e4443967d8a6b708 (diff)
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-stm32/src/hash')
-rw-r--r--embassy-stm32/src/hash/mod.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/embassy-stm32/src/hash/mod.rs b/embassy-stm32/src/hash/mod.rs
index 3951e9d63..1258e8923 100644
--- a/embassy-stm32/src/hash/mod.rs
+++ b/embassy-stm32/src/hash/mod.rs
@@ -8,7 +8,7 @@ use core::ptr;
8#[cfg(hash_v2)] 8#[cfg(hash_v2)]
9use core::task::Poll; 9use core::task::Poll;
10 10
11use embassy_hal_internal::{into_ref, PeripheralRef}; 11use embassy_hal_internal::PeripheralType;
12use embassy_sync::waitqueue::AtomicWaker; 12use embassy_sync::waitqueue::AtomicWaker;
13use stm32_metapac::hash::regs::*; 13use stm32_metapac::hash::regs::*;
14 14
@@ -19,7 +19,7 @@ use crate::interrupt::typelevel::Interrupt;
19use crate::mode::Async; 19use crate::mode::Async;
20use crate::mode::{Blocking, Mode}; 20use crate::mode::{Blocking, Mode};
21use crate::peripherals::HASH; 21use crate::peripherals::HASH;
22use crate::{interrupt, pac, peripherals, rcc, Peripheral}; 22use crate::{interrupt, pac, peripherals, rcc, Peri};
23 23
24#[cfg(hash_v1)] 24#[cfg(hash_v1)]
25const NUM_CONTEXT_REGS: usize = 51; 25const NUM_CONTEXT_REGS: usize = 51;
@@ -119,7 +119,7 @@ type HmacKey<'k> = Option<&'k [u8]>;
119 119
120/// HASH driver. 120/// HASH driver.
121pub struct Hash<'d, T: Instance, M: Mode> { 121pub struct Hash<'d, T: Instance, M: Mode> {
122 _peripheral: PeripheralRef<'d, T>, 122 _peripheral: Peri<'d, T>,
123 _phantom: PhantomData<M>, 123 _phantom: PhantomData<M>,
124 #[cfg(hash_v2)] 124 #[cfg(hash_v2)]
125 dma: Option<ChannelAndRequest<'d>>, 125 dma: Option<ChannelAndRequest<'d>>,
@@ -128,11 +128,10 @@ pub struct Hash<'d, T: Instance, M: Mode> {
128impl<'d, T: Instance> Hash<'d, T, Blocking> { 128impl<'d, T: Instance> Hash<'d, T, Blocking> {
129 /// Instantiates, resets, and enables the HASH peripheral. 129 /// Instantiates, resets, and enables the HASH peripheral.
130 pub fn new_blocking( 130 pub fn new_blocking(
131 peripheral: impl Peripheral<P = T> + 'd, 131 peripheral: Peri<'d, T>,
132 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, 132 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
133 ) -> Self { 133 ) -> Self {
134 rcc::enable_and_reset::<HASH>(); 134 rcc::enable_and_reset::<HASH>();
135 into_ref!(peripheral);
136 let instance = Self { 135 let instance = Self {
137 _peripheral: peripheral, 136 _peripheral: peripheral,
138 _phantom: PhantomData, 137 _phantom: PhantomData,
@@ -396,12 +395,11 @@ impl<'d, T: Instance, M: Mode> Hash<'d, T, M> {
396impl<'d, T: Instance> Hash<'d, T, Async> { 395impl<'d, T: Instance> Hash<'d, T, Async> {
397 /// Instantiates, resets, and enables the HASH peripheral. 396 /// Instantiates, resets, and enables the HASH peripheral.
398 pub fn new( 397 pub fn new(
399 peripheral: impl Peripheral<P = T> + 'd, 398 peripheral: Peri<'d, T>,
400 dma: impl Peripheral<P = impl Dma<T>> + 'd, 399 dma: Peri<'d, impl Dma<T>>,
401 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, 400 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
402 ) -> Self { 401 ) -> Self {
403 rcc::enable_and_reset::<HASH>(); 402 rcc::enable_and_reset::<HASH>();
404 into_ref!(peripheral, dma);
405 let instance = Self { 403 let instance = Self {
406 _peripheral: peripheral, 404 _peripheral: peripheral,
407 _phantom: PhantomData, 405 _phantom: PhantomData,
@@ -583,7 +581,7 @@ trait SealedInstance {
583 581
584/// HASH instance trait. 582/// HASH instance trait.
585#[allow(private_bounds)] 583#[allow(private_bounds)]
586pub trait Instance: SealedInstance + Peripheral<P = Self> + crate::rcc::RccPeripheral + 'static + Send { 584pub trait Instance: SealedInstance + PeripheralType + crate::rcc::RccPeripheral + 'static + Send {
587 /// Interrupt for this HASH instance. 585 /// Interrupt for this HASH instance.
588 type Interrupt: interrupt::typelevel::Interrupt; 586 type Interrupt: interrupt::typelevel::Interrupt;
589} 587}