aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l0/src/bin/button.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-01-14 22:02:00 +0100
committerDario Nieuwenhuis <[email protected]>2022-01-19 17:59:55 +0100
commit58fc64722c65bbdc209ae0fd1700f03702bbcd08 (patch)
tree77f9412b47259cd4cf4170b0a257b371398d4f2c /examples/stm32l0/src/bin/button.rs
parent52e156b429417bde59d0ea67d11256866f1dcec9 (diff)
stm32/gpio: expose all functionality as inherent methods.
Diffstat (limited to 'examples/stm32l0/src/bin/button.rs')
-rw-r--r--examples/stm32l0/src/bin/button.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/stm32l0/src/bin/button.rs b/examples/stm32l0/src/bin/button.rs
index c29155302..046c43caf 100644
--- a/examples/stm32l0/src/bin/button.rs
+++ b/examples/stm32l0/src/bin/button.rs
@@ -7,7 +7,6 @@ mod example_common;
7use embassy::executor::Spawner; 7use embassy::executor::Spawner;
8use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; 8use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
9use embassy_stm32::Peripherals; 9use embassy_stm32::Peripherals;
10use embedded_hal::digital::v2::{InputPin, OutputPin};
11use example_common::*; 10use example_common::*;
12 11
13#[embassy::main] 12#[embassy::main]
@@ -19,14 +18,14 @@ async fn main(_spawner: Spawner, p: Peripherals) {
19 let mut led2 = Output::new(p.PB5, Level::High, Speed::Low); 18 let mut led2 = Output::new(p.PB5, Level::High, Speed::Low);
20 19
21 loop { 20 loop {
22 if unwrap!(button.is_high()) { 21 if button.is_high() {
23 info!("high"); 22 info!("high");
24 unwrap!(led1.set_high()); 23 led1.set_high();
25 unwrap!(led2.set_low()); 24 led2.set_low();
26 } else { 25 } else {
27 info!("low"); 26 info!("low");
28 unwrap!(led1.set_low()); 27 led1.set_low();
29 unwrap!(led2.set_high()); 28 led2.set_high();
30 } 29 }
31 } 30 }
32} 31}