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/hsem | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-stm32/src/hsem')
| -rw-r--r-- | embassy-stm32/src/hsem/mod.rs | 16 |
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 | ||
| 3 | use embassy_hal_internal::PeripheralType; | ||
| 4 | |||
| 5 | use crate::pac; | ||
| 6 | use 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. |
| 7 | use embassy_hal_internal::{into_ref, PeripheralRef}; | 11 | use crate::Peri; |
| 8 | |||
| 9 | use crate::rcc::RccPeripheral; | ||
| 10 | use 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 |
| 75 | pub struct HardwareSemaphore<'d, T: Instance> { | 76 | pub struct HardwareSemaphore<'d, T: Instance> { |
| 76 | _peri: PeripheralRef<'d, T>, | 77 | _peri: Peri<'d, T>, |
| 77 | } | 78 | } |
| 78 | 79 | ||
| 79 | impl<'d, T: Instance> HardwareSemaphore<'d, T> { | 80 | impl<'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)] |
| 180 | pub trait Instance: SealedInstance + RccPeripheral + Send + 'static {} | 180 | pub trait Instance: SealedInstance + PeripheralType + RccPeripheral + Send + 'static {} |
| 181 | 181 | ||
| 182 | impl SealedInstance for crate::peripherals::HSEM { | 182 | impl SealedInstance for crate::peripherals::HSEM { |
| 183 | fn regs() -> crate::pac::hsem::Hsem { | 183 | fn regs() -> crate::pac::hsem::Hsem { |
