diff options
| author | Gerzain Mata <[email protected]> | 2025-07-27 17:05:43 -0700 |
|---|---|---|
| committer | Gerzain Mata <[email protected]> | 2025-07-27 17:08:29 -0700 |
| commit | 9a1f1cc02c7eb83c3b30de2706cd33eab95a221e (patch) | |
| tree | d50c96281af80dc9aa4960594c08003c9664dbc8 /examples/stm32wba6/src/bin/button_exti.rs | |
| parent | 81bef219e315aca005e50143757c681d5bc122ee (diff) | |
Separated USB_OTG_HS to STM32WBA6
Diffstat (limited to 'examples/stm32wba6/src/bin/button_exti.rs')
| -rw-r--r-- | examples/stm32wba6/src/bin/button_exti.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/stm32wba6/src/bin/button_exti.rs b/examples/stm32wba6/src/bin/button_exti.rs new file mode 100644 index 000000000..34a08bbc6 --- /dev/null +++ b/examples/stm32wba6/src/bin/button_exti.rs | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::*; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_stm32::exti::ExtiInput; | ||
| 7 | use embassy_stm32::gpio::Pull; | ||
| 8 | use {defmt_rtt as _, panic_probe as _}; | ||
| 9 | |||
| 10 | #[embassy_executor::main] | ||
| 11 | async fn main(_spawner: Spawner) { | ||
| 12 | let p = embassy_stm32::init(Default::default()); | ||
| 13 | info!("Hello World!"); | ||
| 14 | |||
| 15 | let mut button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Up); | ||
| 16 | |||
| 17 | info!("Press the USER button..."); | ||
| 18 | |||
| 19 | loop { | ||
| 20 | button.wait_for_falling_edge().await; | ||
| 21 | info!("Pressed!"); | ||
| 22 | button.wait_for_rising_edge().await; | ||
| 23 | info!("Released!"); | ||
| 24 | } | ||
| 25 | } | ||
