aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l4/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-08-17 22:25:58 +0200
committerDario Nieuwenhuis <[email protected]>2022-08-17 22:25:58 +0200
commit2e85eaf7d5f4dcf6d84f426542b8ec87aa51c429 (patch)
tree1d22c32eae26435677df89083d71f50fc298a09f /examples/stm32l4/src
parentfc6e1e06b305d302d1b7ad17e8ef3a9be986c358 (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/stm32l4/src')
-rw-r--r--examples/stm32l4/src/bin/rng.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/examples/stm32l4/src/bin/rng.rs b/examples/stm32l4/src/bin/rng.rs
index d0e1306a3..c90515626 100644
--- a/examples/stm32l4/src/bin/rng.rs
+++ b/examples/stm32l4/src/bin/rng.rs
@@ -9,7 +9,8 @@ use embassy_stm32::rng::Rng;
9use embassy_stm32::Config; 9use embassy_stm32::Config;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12fn config() -> Config { 12#[embassy_executor::main]
13async fn main(_spawner: Spawner) {
13 let mut config = Config::default(); 14 let mut config = Config::default();
14 // 72Mhz clock (16 / 1 * 18 / 4) 15 // 72Mhz clock (16 / 1 * 18 / 4)
15 config.rcc.mux = ClockSrc::PLL( 16 config.rcc.mux = ClockSrc::PLL(
@@ -19,12 +20,8 @@ fn config() -> Config {
19 PLLMul::Mul18, 20 PLLMul::Mul18,
20 Some(PLLClkDiv::Div6), // 48Mhz (16 / 1 * 18 / 6) 21 Some(PLLClkDiv::Div6), // 48Mhz (16 / 1 * 18 / 6)
21 ); 22 );
22 config 23 let p = embassy_stm32::init(config);
23}
24 24
25#[embassy_executor::main]
26async fn main(_spawner: Spawner) {
27 let p = embassy_stm32::init(config());
28 info!("Hello World!"); 25 info!("Hello World!");
29 26
30 let mut rng = Rng::new(p.RNG); 27 let mut rng = Rng::new(p.RNG);