diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-11-13 01:08:27 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-13 01:08:27 +0000 |
| commit | ac7134ed0d304282d2b10b1efff316426757fdab (patch) | |
| tree | 69cd68e35968cf0a5da5000308e338bdbad3724a /tests | |
| parent | f00e97a5f14b25d261eafba7cbc63b035c938996 (diff) | |
| parent | ace52210802a18a551f506bc3ad163703e3f9efa (diff) | |
Merge pull request #2178 from embassy-rs/rcc-no-spaghetti
stm32/rcc: unify f2 into f4/f7.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/stm32/src/common.rs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/stm32/src/common.rs b/tests/stm32/src/common.rs index e7367d5ed..a44e8230f 100644 --- a/tests/stm32/src/common.rs +++ b/tests/stm32/src/common.rs | |||
| @@ -236,24 +236,25 @@ pub fn config() -> Config { | |||
| 236 | { | 236 | { |
| 237 | use embassy_stm32::rcc::*; | 237 | use embassy_stm32::rcc::*; |
| 238 | // By default, HSE on the board comes from a 8 MHz clock signal (not a crystal) | 238 | // By default, HSE on the board comes from a 8 MHz clock signal (not a crystal) |
| 239 | config.rcc.hse = Some(HSEConfig { | 239 | config.rcc.hse = Some(Hse { |
| 240 | frequency: Hertz(8_000_000), | 240 | freq: Hertz(8_000_000), |
| 241 | source: HSESrc::Bypass, | 241 | mode: HseMode::Bypass, |
| 242 | }); | 242 | }); |
| 243 | // PLL uses HSE as the clock source | 243 | // PLL uses HSE as the clock source |
| 244 | config.rcc.pll_mux = PllSource::HSE; | 244 | config.rcc.pll_src = PllSource::HSE; |
| 245 | config.rcc.pll = Pll { | 245 | config.rcc.pll = Some(Pll { |
| 246 | // 8 MHz clock source / 8 = 1 MHz PLL input | 246 | // 8 MHz clock source / 8 = 1 MHz PLL input |
| 247 | pre_div: unwrap!(PllPreDiv::try_from(8)), | 247 | prediv: unwrap!(PllPreDiv::try_from(8)), |
| 248 | // 1 MHz PLL input * 240 = 240 MHz PLL VCO | 248 | // 1 MHz PLL input * 240 = 240 MHz PLL VCO |
| 249 | mul: unwrap!(PllMul::try_from(240)), | 249 | mul: unwrap!(PllMul::try_from(240)), |
| 250 | // 240 MHz PLL VCO / 2 = 120 MHz main PLL output | 250 | // 240 MHz PLL VCO / 2 = 120 MHz main PLL output |
| 251 | divp: PllPDiv::DIV2, | 251 | divp: Some(PllPDiv::DIV2), |
| 252 | // 240 MHz PLL VCO / 5 = 48 MHz PLL48 output | 252 | // 240 MHz PLL VCO / 5 = 48 MHz PLL48 output |
| 253 | divq: PllQDiv::DIV5, | 253 | divq: Some(PllQDiv::DIV5), |
| 254 | }; | 254 | divr: None, |
| 255 | }); | ||
| 255 | // System clock comes from PLL (= the 120 MHz main PLL output) | 256 | // System clock comes from PLL (= the 120 MHz main PLL output) |
| 256 | config.rcc.mux = ClockSrc::PLL; | 257 | config.rcc.sys = Sysclk::PLL1_P; |
| 257 | // 120 MHz / 4 = 30 MHz APB1 frequency | 258 | // 120 MHz / 4 = 30 MHz APB1 frequency |
| 258 | config.rcc.apb1_pre = APBPrescaler::DIV4; | 259 | config.rcc.apb1_pre = APBPrescaler::DIV4; |
| 259 | // 120 MHz / 2 = 60 MHz APB2 frequency | 260 | // 120 MHz / 2 = 60 MHz APB2 frequency |
| @@ -271,7 +272,7 @@ pub fn config() -> Config { | |||
| 271 | config.rcc.pll = Some(Pll { | 272 | config.rcc.pll = Some(Pll { |
| 272 | prediv: PllPreDiv::DIV4, | 273 | prediv: PllPreDiv::DIV4, |
| 273 | mul: PllMul::MUL180, | 274 | mul: PllMul::MUL180, |
| 274 | divp: Some(Pllp::DIV2), // 8mhz / 4 * 180 / 2 = 180Mhz. | 275 | divp: Some(PllPDiv::DIV2), // 8mhz / 4 * 180 / 2 = 180Mhz. |
| 275 | divq: None, | 276 | divq: None, |
| 276 | divr: None, | 277 | divr: None, |
| 277 | }); | 278 | }); |
| @@ -292,7 +293,7 @@ pub fn config() -> Config { | |||
| 292 | config.rcc.pll = Some(Pll { | 293 | config.rcc.pll = Some(Pll { |
| 293 | prediv: PllPreDiv::DIV4, | 294 | prediv: PllPreDiv::DIV4, |
| 294 | mul: PllMul::MUL216, | 295 | mul: PllMul::MUL216, |
| 295 | divp: Some(Pllp::DIV2), // 8mhz / 4 * 216 / 2 = 216Mhz. | 296 | divp: Some(PllPDiv::DIV2), // 8mhz / 4 * 216 / 2 = 216Mhz. |
| 296 | divq: None, | 297 | divq: None, |
| 297 | divr: None, | 298 | divr: None, |
| 298 | }); | 299 | }); |
