aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/dac
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/dac
parent01c1cb2764300625f80b24e70052f250de27d814 (diff)
stm32/rcc: replace generated enable/disable code with runtime info
Diffstat (limited to 'embassy-stm32/src/dac')
-rw-r--r--embassy-stm32/src/dac/mod.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/embassy-stm32/src/dac/mod.rs b/embassy-stm32/src/dac/mod.rs
index 8a748ad72..cdd8d1fd7 100644
--- a/embassy-stm32/src/dac/mod.rs
+++ b/embassy-stm32/src/dac/mod.rs
@@ -8,7 +8,7 @@ use embassy_hal_internal::{into_ref, PeripheralRef};
8use crate::dma::NoDma; 8use crate::dma::NoDma;
9#[cfg(any(dac_v3, dac_v4, dac_v5, dac_v6, dac_v7))] 9#[cfg(any(dac_v3, dac_v4, dac_v5, dac_v6, dac_v7))]
10use crate::pac::dac; 10use crate::pac::dac;
11use crate::rcc::RccPeripheral; 11use crate::rcc::{self, RccPeripheral};
12use crate::{peripherals, Peripheral}; 12use crate::{peripherals, Peripheral};
13 13
14mod tsel; 14mod tsel;
@@ -131,7 +131,7 @@ impl<'d, T: Instance, const N: u8, DMA> DacChannel<'d, T, N, DMA> {
131 ) -> Self { 131 ) -> Self {
132 into_ref!(dma, pin); 132 into_ref!(dma, pin);
133 pin.set_as_analog(); 133 pin.set_as_analog();
134 T::enable_and_reset(); 134 rcc::enable_and_reset::<T>();
135 let mut dac = Self { 135 let mut dac = Self {
136 phantom: PhantomData, 136 phantom: PhantomData,
137 dma, 137 dma,
@@ -157,7 +157,7 @@ impl<'d, T: Instance, const N: u8, DMA> DacChannel<'d, T, N, DMA> {
157 #[cfg(all(any(dac_v3, dac_v4, dac_v5, dac_v6, dac_v7), not(any(stm32h56x, stm32h57x))))] 157 #[cfg(all(any(dac_v3, dac_v4, dac_v5, dac_v6, dac_v7), not(any(stm32h56x, stm32h57x))))]
158 pub fn new_internal(_peri: impl Peripheral<P = T> + 'd, dma: impl Peripheral<P = DMA> + 'd) -> Self { 158 pub fn new_internal(_peri: impl Peripheral<P = T> + 'd, dma: impl Peripheral<P = DMA> + 'd) -> Self {
159 into_ref!(dma); 159 into_ref!(dma);
160 T::enable_and_reset(); 160 rcc::enable_and_reset::<T>();
161 let mut dac = Self { 161 let mut dac = Self {
162 phantom: PhantomData, 162 phantom: PhantomData,
163 dma, 163 dma,
@@ -356,7 +356,7 @@ impl_dma_methods!(2, DacDma2);
356 356
357impl<'d, T: Instance, const N: u8, DMA> Drop for DacChannel<'d, T, N, DMA> { 357impl<'d, T: Instance, const N: u8, DMA> Drop for DacChannel<'d, T, N, DMA> {
358 fn drop(&mut self) { 358 fn drop(&mut self) {
359 T::disable(); 359 rcc::disable::<T>();
360 } 360 }
361} 361}
362 362
@@ -400,8 +400,8 @@ impl<'d, T: Instance, DMACh1, DMACh2> Dac<'d, T, DMACh1, DMACh2> {
400 pin_ch2.set_as_analog(); 400 pin_ch2.set_as_analog();
401 401
402 // Enable twice to increment the DAC refcount for each channel. 402 // Enable twice to increment the DAC refcount for each channel.
403 T::enable_and_reset(); 403 rcc::enable_and_reset::<T>();
404 T::enable_and_reset(); 404 rcc::enable_and_reset::<T>();
405 405
406 let mut ch1 = DacCh1 { 406 let mut ch1 = DacCh1 {
407 phantom: PhantomData, 407 phantom: PhantomData,
@@ -444,8 +444,8 @@ impl<'d, T: Instance, DMACh1, DMACh2> Dac<'d, T, DMACh1, DMACh2> {
444 ) -> Self { 444 ) -> Self {
445 into_ref!(dma_ch1, dma_ch2); 445 into_ref!(dma_ch1, dma_ch2);
446 // Enable twice to increment the DAC refcount for each channel. 446 // Enable twice to increment the DAC refcount for each channel.
447 T::enable_and_reset(); 447 rcc::enable_and_reset::<T>();
448 T::enable_and_reset(); 448 rcc::enable_and_reset::<T>();
449 449
450 let mut ch1 = DacCh1 { 450 let mut ch1 = DacCh1 {
451 phantom: PhantomData, 451 phantom: PhantomData,