diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-03-03 23:19:54 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-03-04 00:04:06 +0100 |
| commit | c8c4b0b701ecfbb146c6f651bebd43f053f55ac2 (patch) | |
| tree | f4af9be094f3a2b5d16af8097e589a53ed76c7be /examples | |
| parent | b4567bb8c56dced1c64177d727ebb32ee4680ea3 (diff) | |
stm32/rcc: port g0 to new api.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32g0/src/bin/hf_timer.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/stm32g0/src/bin/hf_timer.rs b/examples/stm32g0/src/bin/hf_timer.rs index 647ff0419..3ea06cdee 100644 --- a/examples/stm32g0/src/bin/hf_timer.rs +++ b/examples/stm32g0/src/bin/hf_timer.rs | |||
| @@ -16,15 +16,16 @@ async fn main(_spawner: Spawner) { | |||
| 16 | let mut config = PeripheralConfig::default(); | 16 | let mut config = PeripheralConfig::default(); |
| 17 | { | 17 | { |
| 18 | use embassy_stm32::rcc::*; | 18 | use embassy_stm32::rcc::*; |
| 19 | 19 | config.rcc.hsi = true; | |
| 20 | config.rcc.sys = Sysclk::PLL(PllConfig { | 20 | config.rcc.pll = Some(Pll { |
| 21 | source: PllSource::HSI, | 21 | source: PllSource::HSI, |
| 22 | m: Pllm::DIV1, | 22 | prediv: PllPreDiv::DIV1, |
| 23 | n: Plln::MUL16, | 23 | mul: PllMul::MUL16, |
| 24 | r: Pllr::DIV4, // CPU clock comes from PLLR (HSI (16MHz) / 1 * 16 / 4 = 64MHz) | 24 | divp: None, |
| 25 | q: Some(Pllq::DIV2), // TIM1 or TIM15 can be sourced from PLLQ (HSI (16MHz) / 1 * 16 / 2 = 128MHz) | 25 | divq: Some(PllQDiv::DIV2), // 16 / 1 * 16 / 2 = 128 Mhz |
| 26 | p: None, | 26 | divr: Some(PllRDiv::DIV4), // 16 / 1 * 16 / 4 = 64 Mhz |
| 27 | }); | 27 | }); |
| 28 | config.rcc.sys = Sysclk::PLL1_R; | ||
| 28 | 29 | ||
| 29 | // configure TIM1 mux to select PLLQ as clock source | 30 | // configure TIM1 mux to select PLLQ as clock source |
| 30 | // https://www.st.com/resource/en/reference_manual/rm0444-stm32g0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf | 31 | // https://www.st.com/resource/en/reference_manual/rm0444-stm32g0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf |
