wake up pin working for the wake up

This commit is contained in:
Priec
2025-12-14 14:33:01 +01:00
parent f4ca3071f0
commit 20dfdbc335
5 changed files with 21 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ use defmt::info;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::Pull;
use embassy_stm32::{peripherals, interrupt};
use embassy_time::{Duration, Timer};
use embassy_hal_internal::Peri;
/// GPIO pin as an EXTI wakeup source.
@@ -13,11 +14,12 @@ pub async fn gpio_wakeup(
ch: Peri<'static, peripherals::EXTI0>
) {
info!("Configuring EXTI wake input on PA0 (rising edge)");
let mut btn = ExtiInput::new(pin, ch, Pull::Down);
let mut btn = ExtiInput::new(pin, ch, Pull::Up);
loop {
info!("Waiting for rising edge on PA0");
btn.wait_for_rising_edge().await;
info!("Waiting for rising edge on PA0");
btn.wait_for_falling_edge().await;
info!("GPIO wakeup: event detected!");
Timer::after(Duration::from_millis(50)).await;
}
}