From 2e85eaf7d5f4dcf6d84f426542b8ec87aa51c429 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 17 Aug 2022 22:25:58 +0200 Subject: examples Remove the `fn config()` idiom. It was only useful for doing #[embassy_executor::main(config = "config()")]`. Now that it's gone, it makes more sense to build the config in main directly. --- examples/stm32f2/src/bin/pll.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'examples/stm32f2/src') 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; use embassy_stm32::Config; use {defmt_rtt as _, panic_probe as _}; -// Example config for maximum performance on a NUCLEO-F207ZG board -fn config() -> Config { +#[embassy_executor::main] +async fn main(_spawner: Spawner) { + // Example config for maximum performance on a NUCLEO-F207ZG board + let mut config = Config::default(); // By default, HSE on the board comes from a 8 MHz clock signal (not a crystal) config.rcc.hse = Some(HSEConfig { @@ -40,12 +42,9 @@ fn config() -> Config { config.rcc.apb1_pre = APBPrescaler::Div4; // 120 MHz / 2 = 60 MHz APB2 frequency config.rcc.apb2_pre = APBPrescaler::Div2; - config -} -#[embassy_executor::main] -async fn main(_spawner: Spawner) { - let _p = embassy_stm32::init(config()); + let _p = embassy_stm32::init(config); + loop { Timer::after(Duration::from_millis(1000)).await; info!("1s elapsed"); -- cgit