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/camera.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/camera.rs')
| -rw-r--r-- | examples/stm32h7/src/bin/camera.rs | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/examples/stm32h7/src/bin/camera.rs b/examples/stm32h7/src/bin/camera.rs index 8e93a54c8..a281e75c9 100644 --- a/examples/stm32h7/src/bin/camera.rs +++ b/examples/stm32h7/src/bin/camera.rs | |||
| @@ -10,10 +10,16 @@ use embassy_stm32::i2c::I2c; | |||
| 10 | use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; | 10 | use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; |
| 11 | use embassy_stm32::time::{khz, mhz}; | 11 | use embassy_stm32::time::{khz, mhz}; |
| 12 | use embassy_stm32::{interrupt, Config}; | 12 | use embassy_stm32::{interrupt, Config}; |
| 13 | use ov7725::*; | ||
| 13 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 15 | ||
| 15 | #[allow(unused)] | 16 | const WIDTH: usize = 100; |
| 16 | pub fn config() -> Config { | 17 | const HEIGHT: usize = 100; |
| 18 | |||
| 19 | static mut FRAME: [u32; WIDTH * HEIGHT / 2] = [0u32; WIDTH * HEIGHT / 2]; | ||
| 20 | |||
| 21 | #[embassy_executor::main] | ||
| 22 | async fn main(_spawner: Spawner) { | ||
| 17 | let mut config = Config::default(); | 23 | let mut config = Config::default(); |
| 18 | config.rcc.sys_ck = Some(mhz(400)); | 24 | config.rcc.sys_ck = Some(mhz(400)); |
| 19 | config.rcc.hclk = Some(mhz(400)); | 25 | config.rcc.hclk = Some(mhz(400)); |
| @@ -22,19 +28,8 @@ pub fn config() -> Config { | |||
| 22 | config.rcc.pclk2 = Some(mhz(100)); | 28 | config.rcc.pclk2 = Some(mhz(100)); |
| 23 | config.rcc.pclk3 = Some(mhz(100)); | 29 | config.rcc.pclk3 = Some(mhz(100)); |
| 24 | config.rcc.pclk4 = Some(mhz(100)); | 30 | config.rcc.pclk4 = Some(mhz(100)); |
| 25 | config | 31 | let p = embassy_stm32::init(config); |
| 26 | } | ||
| 27 | 32 | ||
| 28 | use ov7725::*; | ||
| 29 | |||
| 30 | const WIDTH: usize = 100; | ||
| 31 | const HEIGHT: usize = 100; | ||
| 32 | |||
| 33 | static mut FRAME: [u32; WIDTH * HEIGHT / 2] = [0u32; WIDTH * HEIGHT / 2]; | ||
| 34 | |||
| 35 | #[embassy_executor::main] | ||
| 36 | async fn main(_spawner: Spawner) { | ||
| 37 | let p = embassy_stm32::init(config()); | ||
| 38 | defmt::info!("Hello World!"); | 33 | defmt::info!("Hello World!"); |
| 39 | let mco = Mco::new(p.MCO1, p.PA8, Mco1Source::Hsi, McoClock::Divided(3)); | 34 | let mco = Mco::new(p.MCO1, p.PA8, Mco1Source::Hsi, McoClock::Divided(3)); |
| 40 | 35 | ||
