diff options
Diffstat (limited to 'examples/stm32f2/src')
| -rw-r--r-- | examples/stm32f2/src/bin/pll.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/examples/stm32f2/src/bin/pll.rs b/examples/stm32f2/src/bin/pll.rs index bc0c160ba..6fce7a716 100644 --- a/examples/stm32f2/src/bin/pll.rs +++ b/examples/stm32f2/src/bin/pll.rs | |||
| @@ -14,8 +14,10 @@ use embassy_stm32::time::Hertz; | |||
| 14 | use embassy_stm32::Config; | 14 | use embassy_stm32::Config; |
| 15 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 16 | 16 | ||
| 17 | // Example config for maximum performance on a NUCLEO-F207ZG board | 17 | #[embassy_executor::main] |
| 18 | fn config() -> Config { | 18 | async fn main(_spawner: Spawner) { |
| 19 | // Example config for maximum performance on a NUCLEO-F207ZG board | ||
| 20 | |||
| 19 | let mut config = Config::default(); | 21 | let mut config = Config::default(); |
| 20 | // By default, HSE on the board comes from a 8 MHz clock signal (not a crystal) | 22 | // By default, HSE on the board comes from a 8 MHz clock signal (not a crystal) |
| 21 | config.rcc.hse = Some(HSEConfig { | 23 | config.rcc.hse = Some(HSEConfig { |
| @@ -40,12 +42,9 @@ fn config() -> Config { | |||
| 40 | config.rcc.apb1_pre = APBPrescaler::Div4; | 42 | config.rcc.apb1_pre = APBPrescaler::Div4; |
| 41 | // 120 MHz / 2 = 60 MHz APB2 frequency | 43 | // 120 MHz / 2 = 60 MHz APB2 frequency |
| 42 | config.rcc.apb2_pre = APBPrescaler::Div2; | 44 | config.rcc.apb2_pre = APBPrescaler::Div2; |
| 43 | config | ||
| 44 | } | ||
| 45 | 45 | ||
| 46 | #[embassy_executor::main] | 46 | let _p = embassy_stm32::init(config); |
| 47 | async fn main(_spawner: Spawner) { | 47 | |
| 48 | let _p = embassy_stm32::init(config()); | ||
| 49 | loop { | 48 | loop { |
| 50 | Timer::after(Duration::from_millis(1000)).await; | 49 | Timer::after(Duration::from_millis(1000)).await; |
| 51 | info!("1s elapsed"); | 50 | info!("1s elapsed"); |
