diff options
Diffstat (limited to 'embassy-stm32/src/rcc/hsi48.rs')
| -rw-r--r-- | embassy-stm32/src/rcc/hsi48.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/embassy-stm32/src/rcc/hsi48.rs b/embassy-stm32/src/rcc/hsi48.rs index 49be4af5e..50ac162a4 100644 --- a/embassy-stm32/src/rcc/hsi48.rs +++ b/embassy-stm32/src/rcc/hsi48.rs | |||
| @@ -66,3 +66,24 @@ pub(crate) fn init_hsi48(config: Hsi48Config) -> Hertz { | |||
| 66 | 66 | ||
| 67 | HSI48_FREQ | 67 | HSI48_FREQ |
| 68 | } | 68 | } |
| 69 | |||
| 70 | pub(crate) fn disable_hsi48() { | ||
| 71 | // disable CRS if it is enabled | ||
| 72 | rcc::disable::<crate::peripherals::CRS>(); | ||
| 73 | |||
| 74 | // Disable HSI48 | ||
| 75 | #[cfg(not(any(stm32u5, stm32g0, stm32h5, stm32h7, stm32h7rs, stm32u5, stm32wba, stm32f0, stm32c071)))] | ||
| 76 | let r = RCC.crrcr(); | ||
| 77 | #[cfg(any(stm32u5, stm32g0, stm32h5, stm32h7, stm32h7rs, stm32u5, stm32wba, stm32c071))] | ||
| 78 | let r = RCC.cr(); | ||
| 79 | #[cfg(any(stm32f0))] | ||
| 80 | let r = RCC.cr2(); | ||
| 81 | |||
| 82 | r.modify(|w| w.set_hsi48on(false)); | ||
| 83 | |||
| 84 | // Disable VREFINT reference for HSI48 oscillator | ||
| 85 | #[cfg(stm32l0)] | ||
| 86 | crate::pac::SYSCFG.cfgr3().modify(|w| { | ||
| 87 | w.set_enref_hsi48(false); | ||
| 88 | }); | ||
| 89 | } | ||
