aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/hsem/mod.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-stm32/src/hsem/mod.rs
parent9edf5b7f049f95742b60b041e4443967d8a6b708 (diff)
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-stm32/src/hsem/mod.rs')
-rw-r--r--embassy-stm32/src/hsem/mod.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/embassy-stm32/src/hsem/mod.rs b/embassy-stm32/src/hsem/mod.rs
index 06ab7a9bc..31527bcdb 100644
--- a/embassy-stm32/src/hsem/mod.rs
+++ b/embassy-stm32/src/hsem/mod.rs
@@ -1,13 +1,14 @@
1//! Hardware Semaphore (HSEM) 1//! Hardware Semaphore (HSEM)
2 2
3use embassy_hal_internal::PeripheralType;
4
5use crate::pac;
6use crate::rcc::RccPeripheral;
3// TODO: This code works for all HSEM implemenations except for the STM32WBA52/4/5xx MCUs. 7// TODO: This code works for all HSEM implemenations except for the STM32WBA52/4/5xx MCUs.
4// Those MCUs have a different HSEM implementation (Secure semaphore lock support, 8// Those MCUs have a different HSEM implementation (Secure semaphore lock support,
5// Privileged / unprivileged semaphore lock support, Semaphore lock protection via semaphore attribute), 9// Privileged / unprivileged semaphore lock support, Semaphore lock protection via semaphore attribute),
6// which is not yet supported by this code. 10// which is not yet supported by this code.
7use embassy_hal_internal::{into_ref, PeripheralRef}; 11use crate::Peri;
8
9use crate::rcc::RccPeripheral;
10use crate::{pac, Peripheral};
11 12
12/// HSEM error. 13/// HSEM error.
13#[derive(Debug)] 14#[derive(Debug)]
@@ -73,13 +74,12 @@ fn core_id_to_index(core: CoreId) -> usize {
73 74
74/// HSEM driver 75/// HSEM driver
75pub struct HardwareSemaphore<'d, T: Instance> { 76pub struct HardwareSemaphore<'d, T: Instance> {
76 _peri: PeripheralRef<'d, T>, 77 _peri: Peri<'d, T>,
77} 78}
78 79
79impl<'d, T: Instance> HardwareSemaphore<'d, T> { 80impl<'d, T: Instance> HardwareSemaphore<'d, T> {
80 /// Creates a new HardwareSemaphore instance. 81 /// Creates a new HardwareSemaphore instance.
81 pub fn new(peripheral: impl Peripheral<P = T> + 'd) -> Self { 82 pub fn new(peripheral: Peri<'d, T>) -> Self {
82 into_ref!(peripheral);
83 HardwareSemaphore { _peri: peripheral } 83 HardwareSemaphore { _peri: peripheral }
84 } 84 }
85 85
@@ -177,7 +177,7 @@ trait SealedInstance {
177 177
178/// HSEM instance trait. 178/// HSEM instance trait.
179#[allow(private_bounds)] 179#[allow(private_bounds)]
180pub trait Instance: SealedInstance + RccPeripheral + Send + 'static {} 180pub trait Instance: SealedInstance + PeripheralType + RccPeripheral + Send + 'static {}
181 181
182impl SealedInstance for crate::peripherals::HSEM { 182impl SealedInstance for crate::peripherals::HSEM {
183 fn regs() -> crate::pac::hsem::Hsem { 183 fn regs() -> crate::pac::hsem::Hsem {