#![no_std] #![no_main] use defmt::*; use embassy_executor::Spawner; use embassy_stm32::{peripherals, gpio::{Level, Output, Speed}}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; async fn task1(mut pin: peripherals::PB7) -> peripherals::PB7 { let mut led = Output::new(&mut pin, Level::High, Speed::Low); led.set_high(); Timer::after_millis(100).await; led.set_low(); Timer::after_millis(100).await; drop(led); pin } async fn task2(mut pin: peripherals::PB7) -> peripherals::PB7 { let mut led = Output::new(&mut pin, Level::High, Speed::Low); led.set_high(); Timer::after_millis(300).await; led.set_low(); Timer::after_millis(300).await; drop(led); pin } #[embassy_executor::main] async fn main(_spawner: Spawner) { let p = embassy_stm32::init(Default::default()); let mut pb7 = p.PB7; info!("Hello World!"); loop { if true { pb7 = task1(pb7).await; } else { pb7 = task2(pb7).await; } } }