diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-08-17 22:25:58 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-08-17 22:25:58 +0200 |
| commit | 2e85eaf7d5f4dcf6d84f426542b8ec87aa51c429 (patch) | |
| tree | 1d22c32eae26435677df89083d71f50fc298a09f /examples/stm32h7/src/bin/low_level_timer_api.rs | |
| parent | fc6e1e06b305d302d1b7ad17e8ef3a9be986c358 (diff) | |
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.
Diffstat (limited to 'examples/stm32h7/src/bin/low_level_timer_api.rs')
| -rw-r--r-- | examples/stm32h7/src/bin/low_level_timer_api.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/examples/stm32h7/src/bin/low_level_timer_api.rs b/examples/stm32h7/src/bin/low_level_timer_api.rs index e759c47a8..59648d4b4 100644 --- a/examples/stm32h7/src/bin/low_level_timer_api.rs +++ b/examples/stm32h7/src/bin/low_level_timer_api.rs | |||
| @@ -12,7 +12,8 @@ use embassy_stm32::time::{khz, mhz, Hertz}; | |||
| 12 | use embassy_stm32::{into_ref, Config, Peripheral, PeripheralRef}; | 12 | use embassy_stm32::{into_ref, Config, Peripheral, PeripheralRef}; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
| 15 | pub fn config() -> Config { | 15 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner) { | ||
| 16 | let mut config = Config::default(); | 17 | let mut config = Config::default(); |
| 17 | config.rcc.sys_ck = Some(mhz(400)); | 18 | config.rcc.sys_ck = Some(mhz(400)); |
| 18 | config.rcc.hclk = Some(mhz(400)); | 19 | config.rcc.hclk = Some(mhz(400)); |
| @@ -21,12 +22,8 @@ pub fn config() -> Config { | |||
| 21 | config.rcc.pclk2 = Some(mhz(100)); | 22 | config.rcc.pclk2 = Some(mhz(100)); |
| 22 | config.rcc.pclk3 = Some(mhz(100)); | 23 | config.rcc.pclk3 = Some(mhz(100)); |
| 23 | config.rcc.pclk4 = Some(mhz(100)); | 24 | config.rcc.pclk4 = Some(mhz(100)); |
| 24 | config | 25 | let p = embassy_stm32::init(config); |
| 25 | } | ||
| 26 | 26 | ||
| 27 | #[embassy_executor::main] | ||
| 28 | async fn main(_spawner: Spawner) { | ||
| 29 | let p = embassy_stm32::init(config()); | ||
| 30 | info!("Hello World!"); | 27 | info!("Hello World!"); |
| 31 | 28 | ||
| 32 | let mut pwm = SimplePwm32::new(p.TIM5, p.PA0, p.PA1, p.PA2, p.PA3, khz(10)); | 29 | let mut pwm = SimplePwm32::new(p.TIM5, p.PA0, p.PA1, p.PA2, p.PA3, khz(10)); |
