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/spi.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/spi.rs')
| -rw-r--r-- | examples/stm32h7/src/bin/spi.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/examples/stm32h7/src/bin/spi.rs b/examples/stm32h7/src/bin/spi.rs index dc8cb7f47..8f6f14850 100644 --- a/examples/stm32h7/src/bin/spi.rs +++ b/examples/stm32h7/src/bin/spi.rs | |||
| @@ -16,14 +16,6 @@ use embassy_util::Forever; | |||
| 16 | use heapless::String; | 16 | use heapless::String; |
| 17 | use {defmt_rtt as _, panic_probe as _}; | 17 | use {defmt_rtt as _, panic_probe as _}; |
| 18 | 18 | ||
| 19 | pub fn config() -> Config { | ||
| 20 | let mut config = Config::default(); | ||
| 21 | config.rcc.sys_ck = Some(mhz(400)); | ||
| 22 | config.rcc.hclk = Some(mhz(200)); | ||
| 23 | config.rcc.pll1.q_ck = Some(mhz(100)); | ||
| 24 | config | ||
| 25 | } | ||
| 26 | |||
| 27 | #[embassy_executor::task] | 19 | #[embassy_executor::task] |
| 28 | async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) { | 20 | async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) { |
| 29 | for n in 0u32.. { | 21 | for n in 0u32.. { |
| @@ -45,7 +37,11 @@ static EXECUTOR: Forever<Executor> = Forever::new(); | |||
| 45 | fn main() -> ! { | 37 | fn main() -> ! { |
| 46 | info!("Hello World!"); | 38 | info!("Hello World!"); |
| 47 | 39 | ||
| 48 | let p = embassy_stm32::init(config()); | 40 | let mut config = Config::default(); |
| 41 | config.rcc.sys_ck = Some(mhz(400)); | ||
| 42 | config.rcc.hclk = Some(mhz(200)); | ||
| 43 | config.rcc.pll1.q_ck = Some(mhz(100)); | ||
| 44 | let p = embassy_stm32::init(config); | ||
| 49 | 45 | ||
| 50 | let spi = spi::Spi::new( | 46 | let spi = spi::Spi::new( |
| 51 | p.SPI3, | 47 | p.SPI3, |
