aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/crc
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/crc
parent9edf5b7f049f95742b60b041e4443967d8a6b708 (diff)
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-stm32/src/crc')
-rw-r--r--embassy-stm32/src/crc/v1.rs11
-rw-r--r--embassy-stm32/src/crc/v2v3.rs9
2 files changed, 6 insertions, 14 deletions
diff --git a/embassy-stm32/src/crc/v1.rs b/embassy-stm32/src/crc/v1.rs
index f3d13de7c..a78b3c2b7 100644
--- a/embassy-stm32/src/crc/v1.rs
+++ b/embassy-stm32/src/crc/v1.rs
@@ -1,23 +1,18 @@
1use embassy_hal_internal::{into_ref, PeripheralRef};
2
3use crate::pac::CRC as PAC_CRC; 1use crate::pac::CRC as PAC_CRC;
4use crate::peripherals::CRC; 2use crate::peripherals::CRC;
5use crate::{rcc, Peripheral}; 3use crate::{rcc, Peri};
6 4
7/// CRC driver. 5/// CRC driver.
8pub struct Crc<'d> { 6pub struct Crc<'d> {
9 _peri: PeripheralRef<'d, CRC>, 7 _peri: Peri<'d, CRC>,
10} 8}
11 9
12impl<'d> Crc<'d> { 10impl<'d> Crc<'d> {
13 /// Instantiates the CRC32 peripheral and initializes it to default values. 11 /// Instantiates the CRC32 peripheral and initializes it to default values.
14 pub fn new(peripheral: impl Peripheral<P = CRC> + 'd) -> Self { 12 pub fn new(peripheral: Peri<'d, CRC>) -> Self {
15 into_ref!(peripheral);
16
17 // Note: enable and reset come from RccPeripheral. 13 // Note: enable and reset come from RccPeripheral.
18 // enable CRC clock in RCC. 14 // enable CRC clock in RCC.
19 rcc::enable_and_reset::<CRC>(); 15 rcc::enable_and_reset::<CRC>();
20 // Peripheral the peripheral
21 let mut instance = Self { _peri: peripheral }; 16 let mut instance = Self { _peri: peripheral };
22 instance.reset(); 17 instance.reset();
23 instance 18 instance
diff --git a/embassy-stm32/src/crc/v2v3.rs b/embassy-stm32/src/crc/v2v3.rs
index ecb507ff4..c94c9f380 100644
--- a/embassy-stm32/src/crc/v2v3.rs
+++ b/embassy-stm32/src/crc/v2v3.rs
@@ -1,13 +1,11 @@
1use embassy_hal_internal::{into_ref, PeripheralRef};
2
3use crate::pac::crc::vals; 1use crate::pac::crc::vals;
4use crate::pac::CRC as PAC_CRC; 2use crate::pac::CRC as PAC_CRC;
5use crate::peripherals::CRC; 3use crate::peripherals::CRC;
6use crate::{rcc, Peripheral}; 4use crate::{rcc, Peri};
7 5
8/// CRC driver. 6/// CRC driver.
9pub struct Crc<'d> { 7pub struct Crc<'d> {
10 _peripheral: PeripheralRef<'d, CRC>, 8 _peripheral: Peri<'d, CRC>,
11 _config: Config, 9 _config: Config,
12} 10}
13 11
@@ -80,11 +78,10 @@ pub enum PolySize {
80 78
81impl<'d> Crc<'d> { 79impl<'d> Crc<'d> {
82 /// Instantiates the CRC32 peripheral and initializes it to default values. 80 /// Instantiates the CRC32 peripheral and initializes it to default values.
83 pub fn new(peripheral: impl Peripheral<P = CRC> + 'd, config: Config) -> Self { 81 pub fn new(peripheral: Peri<'d, CRC>, config: Config) -> Self {
84 // Note: enable and reset come from RccPeripheral. 82 // Note: enable and reset come from RccPeripheral.
85 // reset to default values and enable CRC clock in RCC. 83 // reset to default values and enable CRC clock in RCC.
86 rcc::enable_and_reset::<CRC>(); 84 rcc::enable_and_reset::<CRC>();
87 into_ref!(peripheral);
88 let mut instance = Self { 85 let mut instance = Self {
89 _peripheral: peripheral, 86 _peripheral: peripheral,
90 _config: config, 87 _config: config,