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.
This commit is contained in:
Dario Nieuwenhuis
2022-08-17 22:25:58 +02:00
parent fc6e1e06b3
commit 2e85eaf7d5
30 changed files with 121 additions and 229 deletions

View File

@@ -12,7 +12,8 @@ use embassy_stm32::time::{khz, mhz, Hertz};
use embassy_stm32::{into_ref, Config, Peripheral, PeripheralRef};
use {defmt_rtt as _, panic_probe as _};
pub fn config() -> Config {
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let mut config = Config::default();
config.rcc.sys_ck = Some(mhz(400));
config.rcc.hclk = Some(mhz(400));
@@ -21,12 +22,8 @@ pub fn config() -> Config {
config.rcc.pclk2 = Some(mhz(100));
config.rcc.pclk3 = Some(mhz(100));
config.rcc.pclk4 = Some(mhz(100));
config
}
let p = embassy_stm32::init(config);
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let p = embassy_stm32::init(config());
info!("Hello World!");
let mut pwm = SimplePwm32::new(p.TIM5, p.PA0, p.PA1, p.PA2, p.PA3, khz(10));