aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f3/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stm32f3/src')
-rw-r--r--examples/stm32f3/src/bin/blinky.rs5
-rw-r--r--examples/stm32f3/src/bin/button.rs11
2 files changed, 7 insertions, 9 deletions
diff --git a/examples/stm32f3/src/bin/blinky.rs b/examples/stm32f3/src/bin/blinky.rs
index 321643557..e8b8dc23f 100644
--- a/examples/stm32f3/src/bin/blinky.rs
+++ b/examples/stm32f3/src/bin/blinky.rs
@@ -9,7 +9,6 @@ use embassy::executor::Spawner;
9use embassy::time::{Duration, Timer}; 9use embassy::time::{Duration, Timer};
10use embassy_stm32::gpio::{Level, Output, Speed}; 10use embassy_stm32::gpio::{Level, Output, Speed};
11use embassy_stm32::Peripherals; 11use embassy_stm32::Peripherals;
12use embedded_hal::digital::v2::OutputPin;
13use example_common::*; 12use example_common::*;
14 13
15#[embassy::main] 14#[embassy::main]
@@ -20,11 +19,11 @@ async fn main(_spawner: Spawner, p: Peripherals) {
20 19
21 loop { 20 loop {
22 info!("high"); 21 info!("high");
23 unwrap!(led.set_high()); 22 led.set_high();
24 Timer::after(Duration::from_millis(1000)).await; 23 Timer::after(Duration::from_millis(1000)).await;
25 24
26 info!("low"); 25 info!("low");
27 unwrap!(led.set_low()); 26 led.set_low();
28 Timer::after(Duration::from_millis(1000)).await; 27 Timer::after(Duration::from_millis(1000)).await;
29 } 28 }
30} 29}
diff --git a/examples/stm32f3/src/bin/button.rs b/examples/stm32f3/src/bin/button.rs
index c5fab138b..131d4af42 100644
--- a/examples/stm32f3/src/bin/button.rs
+++ b/examples/stm32f3/src/bin/button.rs
@@ -6,7 +6,6 @@
6mod example_common; 6mod example_common;
7use cortex_m_rt::entry; 7use cortex_m_rt::entry;
8use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; 8use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
9use embedded_hal::digital::v2::{InputPin, OutputPin};
10use example_common::*; 9use example_common::*;
11 10
12#[entry] 11#[entry]
@@ -20,14 +19,14 @@ fn main() -> ! {
20 let mut led2 = Output::new(p.PE15, Level::High, Speed::Low); 19 let mut led2 = Output::new(p.PE15, Level::High, Speed::Low);
21 20
22 loop { 21 loop {
23 if unwrap!(button.is_high()) { 22 if button.is_high() {
24 info!("high"); 23 info!("high");
25 unwrap!(led1.set_high()); 24 led1.set_high();
26 unwrap!(led2.set_low()); 25 led2.set_low();
27 } else { 26 } else {
28 info!("low"); 27 info!("low");
29 unwrap!(led1.set_low()); 28 led1.set_low();
30 unwrap!(led2.set_high()); 29 led2.set_high();
31 } 30 }
32 } 31 }
33} 32}