detection of the stop0-2

This commit is contained in:
Priec
2025-12-14 12:01:19 +01:00
parent 49cc8dcc71
commit bbddc7cf9c

View File

@@ -4,7 +4,7 @@
use defmt::*; use defmt::*;
use embassy_stm32::pac; use embassy_stm32::pac;
use embassy_executor::Spawner; use embassy_executor::{Spawner, task};
use embassy_stm32::Config; use embassy_stm32::Config;
use embassy_stm32::gpio::{Output, Level, Speed}; use embassy_stm32::gpio::{Output, Level, Speed};
use embassy_time::{Duration, Timer}; use embassy_time::{Duration, Timer};
@@ -28,6 +28,9 @@ async fn main(spawner: Spawner) {
led.set_high(); led.set_high();
info!("LED ON (MCU awake)"); info!("LED ON (MCU awake)");
// LED BLINK
spawner.spawn(led_blink(led).unwrap());
// INIT HW UART // INIT HW UART
init_hw_uart_to_pc(p.USART1, p.PA10, p.PA9, &spawner); init_hw_uart_to_pc(p.USART1, p.PA10, p.PA9, &spawner);
@@ -67,3 +70,11 @@ async fn main(spawner: Spawner) {
execute_low_power(cmd, &mut iwdg).await; execute_low_power(cmd, &mut iwdg).await;
} }
} }
#[task]
async fn led_blink(mut led: Output<'static>) {
loop {
led.toggle();
Timer::after(Duration::from_millis(300)).await;
}
}