aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32wba/src/bin/button_exti.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-09-16 02:06:22 +0000
committerGitHub <[email protected]>2023-09-16 02:06:22 +0000
commit80d7193b5b7442fb7a9cee00a5a51300778acdcd (patch)
tree6eaa13745fc8df757e07c9c4e749aa7343a7f206 /examples/stm32wba/src/bin/button_exti.rs
parentf27620cc0b7a50c0ba5e93c96a6a88be252af286 (diff)
parent8315cf064eab133006e1397819b50f072fec6398 (diff)
Merge pull request #1911 from embassy-rs/stm32wba
stm32: add stm32wba support.
Diffstat (limited to 'examples/stm32wba/src/bin/button_exti.rs')
-rw-r--r--examples/stm32wba/src/bin/button_exti.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/stm32wba/src/bin/button_exti.rs b/examples/stm32wba/src/bin/button_exti.rs
new file mode 100644
index 000000000..ef32d4c4a
--- /dev/null
+++ b/examples/stm32wba/src/bin/button_exti.rs
@@ -0,0 +1,27 @@
1#![no_std]
2#![no_main]
3#![feature(type_alias_impl_trait)]
4
5use defmt::*;
6use embassy_executor::Spawner;
7use embassy_stm32::exti::ExtiInput;
8use embassy_stm32::gpio::{Input, Pull};
9use {defmt_rtt as _, panic_probe as _};
10
11#[embassy_executor::main]
12async fn main(_spawner: Spawner) {
13 let p = embassy_stm32::init(Default::default());
14 info!("Hello World!");
15
16 let button = Input::new(p.PC13, Pull::Up);
17 let mut button = ExtiInput::new(button, p.EXTI13);
18
19 info!("Press the USER button...");
20
21 loop {
22 button.wait_for_falling_edge().await;
23 info!("Pressed!");
24 button.wait_for_rising_edge().await;
25 info!("Released!");
26 }
27}