Remove HAL initialization from #[embassy::main] macro.

This commit is contained in:
Dario Nieuwenhuis
2022-08-17 18:49:55 +02:00
parent d881f3ad91
commit fc6e1e06b3
182 changed files with 454 additions and 423 deletions

View File

@ -6,11 +6,11 @@ use defmt::*;
use embassy_executor::executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::Peripherals;
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
async fn main(_spawner: Spawner, p: Peripherals) {
async fn main(_spawner: Spawner) {
let p = embassy_stm32::init(Default::default());
info!("Hello World!");
let mut led = Output::new(p.PB14, Level::High, Speed::Low);

View File

@ -11,7 +11,7 @@ use embassy_stm32::rcc::{
APBPrescaler, ClockSrc, HSEConfig, HSESrc, PLL48Div, PLLConfig, PLLMainDiv, PLLMul, PLLPreDiv, PLLSrc,
};
use embassy_stm32::time::Hertz;
use embassy_stm32::{Config, Peripherals};
use embassy_stm32::Config;
use {defmt_rtt as _, panic_probe as _};
// Example config for maximum performance on a NUCLEO-F207ZG board
@ -43,8 +43,9 @@ fn config() -> Config {
config
}
#[embassy_executor::main(config = "config()")]
async fn main(_spawner: Spawner, _p: Peripherals) {
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let _p = embassy_stm32::init(config());
loop {
Timer::after(Duration::from_millis(1000)).await;
info!("1s elapsed");