1use defmt::info;
11use embassy_stm32::exti::ExtiInput;
12use embassy_time::Timer;
13
14pub const BOUNCE_DELAY: u64 = 50;
16
17#[embassy_executor::task]
18pub async fn btn1_task(mut btn1: ExtiInput<'static>) {
19 let mut i = 0;
20 loop {
21 btn1.wait_for_falling_edge().await;
22 info!("Btn 1 Pressed!");
23 Timer::after_millis(BOUNCE_DELAY).await;
24
25 i += 1;
26 btn1.wait_for_high().await;
27 Timer::after_millis(BOUNCE_DELAY).await;
28 info!("Btn 1 Released {} times!", i);
29 }
30}
31
32#[embassy_executor::task]
33pub async fn btn2_task(mut btn2: ExtiInput<'static>) {
34 let mut i = 0;
35 loop {
36 btn2.wait_for_falling_edge().await;
37 info!("Btn 2 Pressed!");
38 Timer::after_millis(BOUNCE_DELAY).await;
39
40 i += 1;
41 btn2.wait_for_high().await;
42 Timer::after_millis(BOUNCE_DELAY).await;
43 info!("Btn 2 Released {} times!", i);
44 }
45}