diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-02-24 05:57:17 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-02-24 06:28:29 +0100 |
| commit | e8ca5f9b04c30aa63fa68ae051070f506c5c964e (patch) | |
| tree | 54ebe3ab46d0b81bb30a7a2912f8b96fd4a03af6 | |
| parent | cb8a7d00d5e896129587f371f0f1e77580ce5e34 (diff) | |
stm32/rcc: fix build on l0 chips without CRS
| -rw-r--r-- | embassy-stm32/src/rcc/l0.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/embassy-stm32/src/rcc/l0.rs b/embassy-stm32/src/rcc/l0.rs index e482dcc21..692791174 100644 --- a/embassy-stm32/src/rcc/l0.rs +++ b/embassy-stm32/src/rcc/l0.rs | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | use crate::pac::rcc::vals::{Hpre, Msirange, Plldiv, Pllmul, Pllsrc, Ppre, Sw}; | 1 | use crate::pac::rcc::vals::{Hpre, Msirange, Plldiv, Pllmul, Pllsrc, Ppre, Sw}; |
| 2 | use crate::pac::{CRS, RCC, SYSCFG}; | 2 | use crate::pac::RCC; |
| 3 | #[cfg(crs)] | ||
| 4 | use crate::pac::{CRS, SYSCFG}; | ||
| 3 | use crate::rcc::{set_freqs, Clocks}; | 5 | use crate::rcc::{set_freqs, Clocks}; |
| 4 | use crate::time::Hertz; | 6 | use crate::time::Hertz; |
| 5 | use crate::time::U32Ext; | 7 | use crate::time::U32Ext; |
| @@ -180,6 +182,7 @@ pub struct Config { | |||
| 180 | pub ahb_pre: AHBPrescaler, | 182 | pub ahb_pre: AHBPrescaler, |
| 181 | pub apb1_pre: APBPrescaler, | 183 | pub apb1_pre: APBPrescaler, |
| 182 | pub apb2_pre: APBPrescaler, | 184 | pub apb2_pre: APBPrescaler, |
| 185 | #[cfg(crs)] | ||
| 183 | pub enable_hsi48: bool, | 186 | pub enable_hsi48: bool, |
| 184 | } | 187 | } |
| 185 | 188 | ||
| @@ -191,6 +194,7 @@ impl Default for Config { | |||
| 191 | ahb_pre: AHBPrescaler::NotDivided, | 194 | ahb_pre: AHBPrescaler::NotDivided, |
| 192 | apb1_pre: APBPrescaler::NotDivided, | 195 | apb1_pre: APBPrescaler::NotDivided, |
| 193 | apb2_pre: APBPrescaler::NotDivided, | 196 | apb2_pre: APBPrescaler::NotDivided, |
| 197 | #[cfg(crs)] | ||
| 194 | enable_hsi48: false, | 198 | enable_hsi48: false, |
| 195 | } | 199 | } |
| 196 | } | 200 | } |
| @@ -312,6 +316,7 @@ pub(crate) unsafe fn init(config: Config) { | |||
| 312 | } | 316 | } |
| 313 | }; | 317 | }; |
| 314 | 318 | ||
| 319 | #[cfg(crs)] | ||
| 315 | if config.enable_hsi48 { | 320 | if config.enable_hsi48 { |
| 316 | // Reset SYSCFG peripheral | 321 | // Reset SYSCFG peripheral |
| 317 | RCC.apb2rstr().modify(|w| w.set_syscfgrst(true)); | 322 | RCC.apb2rstr().modify(|w| w.set_syscfgrst(true)); |
