aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32wl/src/bin/button_exti.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-04-08 03:32:29 +0200
committerGitHub <[email protected]>2022-04-08 03:32:29 +0200
commitb40c8342ecff2b7f5881cb1f54607d70b5331ae3 (patch)
tree68de96e3c66e3fd077aae60aa002f2b2941ee4af /examples/stm32wl/src/bin/button_exti.rs
parent05fecb3defaee1454757dc6f9d2ebed72df146a4 (diff)
parent0c07d0375406c6079e4b143cd7ac380d0a2bfd5f (diff)
Merge pull request #704 from embassy-rs/stm32wlwb-more
Add missing stm32wl/stm32wb chips except stm32wle
Diffstat (limited to 'examples/stm32wl/src/bin/button_exti.rs')
-rw-r--r--examples/stm32wl/src/bin/button_exti.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/stm32wl/src/bin/button_exti.rs b/examples/stm32wl/src/bin/button_exti.rs
new file mode 100644
index 000000000..9a427c2d3
--- /dev/null
+++ b/examples/stm32wl/src/bin/button_exti.rs
@@ -0,0 +1,28 @@
1#![no_std]
2#![no_main]
3#![feature(type_alias_impl_trait)]
4
5use defmt::*;
6use defmt_rtt as _; // global logger
7use embassy::executor::Spawner;
8use embassy_stm32::exti::ExtiInput;
9use embassy_stm32::gpio::{Input, Pull};
10use embassy_stm32::Peripherals;
11use panic_probe as _;
12
13#[embassy::main]
14async fn main(_spawner: Spawner, p: Peripherals) {
15 info!("Hello World!");
16
17 let button = Input::new(p.PA0, Pull::Up);
18 let mut button = ExtiInput::new(button, p.EXTI0);
19
20 info!("Press the USER button...");
21
22 loop {
23 button.wait_for_falling_edge().await;
24 info!("Pressed!");
25 button.wait_for_rising_edge().await;
26 info!("Released!");
27 }
28}