aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/crc
diff options
context:
space:
mode:
authorJan Špaček <[email protected]>2024-05-24 22:04:04 +0200
committerJan Špaček <[email protected]>2024-05-25 18:44:55 +0200
commit081afca3f065dfd91e157d7c9a9477e2d914c99d (patch)
tree574b29636674d3e5a9e3763d00f709635856403e /embassy-stm32/src/crc
parent01c1cb2764300625f80b24e70052f250de27d814 (diff)
stm32/rcc: replace generated enable/disable code with runtime info
Diffstat (limited to 'embassy-stm32/src/crc')
-rw-r--r--embassy-stm32/src/crc/v1.rs5
-rw-r--r--embassy-stm32/src/crc/v2v3.rs5
2 files changed, 4 insertions, 6 deletions
diff --git a/embassy-stm32/src/crc/v1.rs b/embassy-stm32/src/crc/v1.rs
index e8e0270af..f3d13de7c 100644
--- a/embassy-stm32/src/crc/v1.rs
+++ b/embassy-stm32/src/crc/v1.rs
@@ -2,8 +2,7 @@ use embassy_hal_internal::{into_ref, PeripheralRef};
2 2
3use crate::pac::CRC as PAC_CRC; 3use crate::pac::CRC as PAC_CRC;
4use crate::peripherals::CRC; 4use crate::peripherals::CRC;
5use crate::rcc::SealedRccPeripheral; 5use crate::{rcc, Peripheral};
6use crate::Peripheral;
7 6
8/// CRC driver. 7/// CRC driver.
9pub struct Crc<'d> { 8pub struct Crc<'d> {
@@ -17,7 +16,7 @@ impl<'d> Crc<'d> {
17 16
18 // Note: enable and reset come from RccPeripheral. 17 // Note: enable and reset come from RccPeripheral.
19 // enable CRC clock in RCC. 18 // enable CRC clock in RCC.
20 CRC::enable_and_reset(); 19 rcc::enable_and_reset::<CRC>();
21 // Peripheral the peripheral 20 // Peripheral the peripheral
22 let mut instance = Self { _peri: peripheral }; 21 let mut instance = Self { _peri: peripheral };
23 instance.reset(); 22 instance.reset();
diff --git a/embassy-stm32/src/crc/v2v3.rs b/embassy-stm32/src/crc/v2v3.rs
index ad7c79f12..09d956d7c 100644
--- a/embassy-stm32/src/crc/v2v3.rs
+++ b/embassy-stm32/src/crc/v2v3.rs
@@ -3,8 +3,7 @@ use embassy_hal_internal::{into_ref, PeripheralRef};
3use crate::pac::crc::vals; 3use crate::pac::crc::vals;
4use crate::pac::CRC as PAC_CRC; 4use crate::pac::CRC as PAC_CRC;
5use crate::peripherals::CRC; 5use crate::peripherals::CRC;
6use crate::rcc::SealedRccPeripheral; 6use crate::{rcc, Peripheral};
7use crate::Peripheral;
8 7
9/// CRC driver. 8/// CRC driver.
10pub struct Crc<'d> { 9pub struct Crc<'d> {
@@ -84,7 +83,7 @@ impl<'d> Crc<'d> {
84 pub fn new(peripheral: impl Peripheral<P = CRC> + 'd, config: Config) -> Self { 83 pub fn new(peripheral: impl Peripheral<P = CRC> + 'd, config: Config) -> Self {
85 // Note: enable and reset come from RccPeripheral. 84 // Note: enable and reset come from RccPeripheral.
86 // reset to default values and enable CRC clock in RCC. 85 // reset to default values and enable CRC clock in RCC.
87 CRC::enable_and_reset(); 86 rcc::enable_and_reset::<CRC>();
88 into_ref!(peripheral); 87 into_ref!(peripheral);
89 let mut instance = Self { 88 let mut instance = Self {
90 _peripheral: peripheral, 89 _peripheral: peripheral,