aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f3/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-01-19 20:47:07 +0000
committerGitHub <[email protected]>2022-01-19 20:47:07 +0000
commit6b0cb0609b4bfa3e464e4603ce373a9de9886103 (patch)
tree70a6590ad9da8c625eb69c21faddb5721bfbcea4 /examples/stm32f3/src
parent071b034a5dbece727b28aee6362e36d66bcb763b (diff)
parent889d757ab8bcfc10caf0a7d75ffb7733a7e71ed1 (diff)
Merge #581
581: stm32: expose all functionality as inherent methods. r=Dirbaio a=Dirbaio This is the previous step to implementing both the embedded-hal 0.2 and embedded-hal 1.0 + embedded-hal-async traits. The equivalent in nrf was done in #552 - Removes need for `unwrap` in gpio. - Removes need for `use embedded_hal::whatever` in all cases. Co-authored-by: Dario Nieuwenhuis <[email protected]>
Diffstat (limited to 'examples/stm32f3/src')
-rw-r--r--examples/stm32f3/src/bin/blinky.rs5
-rw-r--r--examples/stm32f3/src/bin/button.rs11
-rw-r--r--examples/stm32f3/src/bin/button_exti.rs1
-rw-r--r--examples/stm32f3/src/bin/usart_dma.rs1
4 files changed, 7 insertions, 11 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}
diff --git a/examples/stm32f3/src/bin/button_exti.rs b/examples/stm32f3/src/bin/button_exti.rs
index d45e4365b..b11f38ea5 100644
--- a/examples/stm32f3/src/bin/button_exti.rs
+++ b/examples/stm32f3/src/bin/button_exti.rs
@@ -8,7 +8,6 @@ use embassy::executor::Spawner;
8use embassy_stm32::exti::ExtiInput; 8use embassy_stm32::exti::ExtiInput;
9use embassy_stm32::gpio::{Input, Pull}; 9use embassy_stm32::gpio::{Input, Pull};
10use embassy_stm32::Peripherals; 10use embassy_stm32::Peripherals;
11use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge};
12use example_common::*; 11use example_common::*;
13 12
14#[embassy::main] 13#[embassy::main]
diff --git a/examples/stm32f3/src/bin/usart_dma.rs b/examples/stm32f3/src/bin/usart_dma.rs
index 99530b5c0..0e67bb1f1 100644
--- a/examples/stm32f3/src/bin/usart_dma.rs
+++ b/examples/stm32f3/src/bin/usart_dma.rs
@@ -9,7 +9,6 @@ use embassy::executor::Spawner;
9use embassy_stm32::dma::NoDma; 9use embassy_stm32::dma::NoDma;
10use embassy_stm32::usart::{Config, Uart}; 10use embassy_stm32::usart::{Config, Uart};
11use embassy_stm32::Peripherals; 11use embassy_stm32::Peripherals;
12use embassy_traits::uart::Write as _;
13use example_common::*; 12use example_common::*;
14use heapless::String; 13use heapless::String;
15 14