wake up pin working for the wake up
This commit is contained in:
@@ -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 wake‑up 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 wake‑up: event detected!");
|
||||
Timer::after(Duration::from_millis(50)).await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user