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

@ -16,7 +16,6 @@ use embassy_executor::time::{with_timeout, Duration, Timer};
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{AnyPin, Input, Level, Output, Pin, Pull, Speed};
use embassy_stm32::peripherals::PA0;
use embassy_stm32::Peripherals;
use embassy_util::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_util::channel::mpmc::Channel;
use {defmt_rtt as _, panic_probe as _};
@ -100,7 +99,8 @@ enum ButtonEvent {
static CHANNEL: Channel<ThreadModeRawMutex, ButtonEvent, 4> = Channel::new();
#[embassy_executor::main]
async fn main(spawner: Spawner, p: Peripherals) {
async fn main(spawner: Spawner) {
let p = embassy_stm32::init(Default::default());
let button = Input::new(p.PA0, Pull::Down);
let button = ExtiInput::new(button, p.EXTI0);
info!("Press the USER button...");