aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/ucpd.rs
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/ucpd.rs
parent01c1cb2764300625f80b24e70052f250de27d814 (diff)
stm32/rcc: replace generated enable/disable code with runtime info
Diffstat (limited to 'embassy-stm32/src/ucpd.rs')
-rw-r--r--embassy-stm32/src/ucpd.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/embassy-stm32/src/ucpd.rs b/embassy-stm32/src/ucpd.rs
index d6d0682b9..89e2f5d49 100644
--- a/embassy-stm32/src/ucpd.rs
+++ b/embassy-stm32/src/ucpd.rs
@@ -28,7 +28,7 @@ use crate::interrupt;
28use crate::interrupt::typelevel::Interrupt; 28use crate::interrupt::typelevel::Interrupt;
29use crate::pac::ucpd::vals::{Anamode, Ccenable, PscUsbpdclk, Txmode}; 29use crate::pac::ucpd::vals::{Anamode, Ccenable, PscUsbpdclk, Txmode};
30pub use crate::pac::ucpd::vals::{Phyccsel as CcSel, TypecVstateCc as CcVState}; 30pub use crate::pac::ucpd::vals::{Phyccsel as CcSel, TypecVstateCc as CcVState};
31use crate::rcc::RccPeripheral; 31use crate::rcc::{self, RccPeripheral};
32 32
33pub(crate) fn init( 33pub(crate) fn init(
34 _cs: critical_section::CriticalSection, 34 _cs: critical_section::CriticalSection,
@@ -103,7 +103,7 @@ impl<'d, T: Instance> Ucpd<'d, T> {
103 cc1.set_as_analog(); 103 cc1.set_as_analog();
104 cc2.set_as_analog(); 104 cc2.set_as_analog();
105 105
106 T::enable_and_reset(); 106 rcc::enable_and_reset::<T>();
107 T::Interrupt::unpend(); 107 T::Interrupt::unpend();
108 unsafe { T::Interrupt::enable() }; 108 unsafe { T::Interrupt::enable() };
109 109
@@ -212,7 +212,7 @@ impl<'d, T: Instance> Drop for CcPhy<'d, T> {
212 drop_not_ready.store(true, Ordering::Relaxed); 212 drop_not_ready.store(true, Ordering::Relaxed);
213 } else { 213 } else {
214 r.cfgr1().write(|w| w.set_ucpden(false)); 214 r.cfgr1().write(|w| w.set_ucpden(false));
215 T::disable(); 215 rcc::disable::<T>();
216 T::Interrupt::disable(); 216 T::Interrupt::disable();
217 } 217 }
218 } 218 }
@@ -325,7 +325,7 @@ impl<'d, T: Instance> Drop for PdPhy<'d, T> {
325 drop_not_ready.store(true, Ordering::Relaxed); 325 drop_not_ready.store(true, Ordering::Relaxed);
326 } else { 326 } else {
327 T::REGS.cfgr1().write(|w| w.set_ucpden(false)); 327 T::REGS.cfgr1().write(|w| w.set_ucpden(false));
328 T::disable(); 328 rcc::disable::<T>();
329 T::Interrupt::disable(); 329 T::Interrupt::disable();
330 } 330 }
331 } 331 }