aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob McWhirter <[email protected]>2021-08-16 15:03:29 -0400
committerBob McWhirter <[email protected]>2021-08-16 15:15:07 -0400
commita93ed2bed6311450b2a8f17a07346eff3c9b6667 (patch)
treeabfbb7c5d952d128277a2b3b3f9d0d381312862e
parentcbff0398bb8d59f881e6649e2b3776d9e00af671 (diff)
Add H7 exti button example using correct EXTI reg block offsets.
-rw-r--r--embassy-stm32/src/exti/mod.rs1
-rw-r--r--examples/stm32h7/src/bin/button_exti.rs36
m---------stm32-data0
3 files changed, 37 insertions, 0 deletions
diff --git a/embassy-stm32/src/exti/mod.rs b/embassy-stm32/src/exti/mod.rs
index bb9082f2e..164cdba33 100644
--- a/embassy-stm32/src/exti/mod.rs
+++ b/embassy-stm32/src/exti/mod.rs
@@ -35,6 +35,7 @@ macro_rules! foreach_exti_irq {
35} 35}
36 36
37#[cfg_attr(exti_v1, path = "v1.rs")] 37#[cfg_attr(exti_v1, path = "v1.rs")]
38#[cfg_attr(exti_h7, path = "v1.rs")]
38#[cfg_attr(exti_wb55, path = "v2.rs")] 39#[cfg_attr(exti_wb55, path = "v2.rs")]
39mod _version; 40mod _version;
40 41
diff --git a/examples/stm32h7/src/bin/button_exti.rs b/examples/stm32h7/src/bin/button_exti.rs
new file mode 100644
index 000000000..ee43fa7d9
--- /dev/null
+++ b/examples/stm32h7/src/bin/button_exti.rs
@@ -0,0 +1,36 @@
1#![no_std]
2#![no_main]
3#![feature(trait_alias)]
4#![feature(type_alias_impl_trait)]
5#![allow(incomplete_features)]
6
7#[path = "../example_common.rs"]
8mod example_common;
9use embassy::executor::Spawner;
10use embassy_stm32::dbgmcu::Dbgmcu;
11use embassy_stm32::exti::ExtiInput;
12use embassy_stm32::gpio::{Input, Pull};
13use embassy_stm32::Peripherals;
14use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge};
15use example_common::*;
16
17#[embassy::main]
18async fn main(_spawner: Spawner, p: Peripherals) {
19 info!("Hello World!");
20
21 unsafe {
22 Dbgmcu::enable_all();
23 }
24
25 let button = Input::new(p.PC13, Pull::Down);
26 let mut button = ExtiInput::new(button, p.EXTI13);
27
28 info!("Press the USER button...");
29
30 loop {
31 button.wait_for_rising_edge().await;
32 info!("Pressed!");
33 button.wait_for_falling_edge().await;
34 info!("Released!");
35 }
36}
diff --git a/stm32-data b/stm32-data
Subproject 79ab92a38d1cbb47dda2f6f8556fe1abc9a14f3 Subproject 75a76596c37f07cbbdaa3a689c1776297063b65