diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-01-19 20:47:07 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-19 20:47:07 +0000 |
| commit | 6b0cb0609b4bfa3e464e4603ce373a9de9886103 (patch) | |
| tree | 70a6590ad9da8c625eb69c21faddb5721bfbcea4 /examples/stm32f3/src | |
| parent | 071b034a5dbece727b28aee6362e36d66bcb763b (diff) | |
| parent | 889d757ab8bcfc10caf0a7d75ffb7733a7e71ed1 (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.rs | 5 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/button.rs | 11 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/button_exti.rs | 1 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/usart_dma.rs | 1 |
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; | |||
| 9 | use embassy::time::{Duration, Timer}; | 9 | use embassy::time::{Duration, Timer}; |
| 10 | use embassy_stm32::gpio::{Level, Output, Speed}; | 10 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use embedded_hal::digital::v2::OutputPin; | ||
| 13 | use example_common::*; | 12 | use 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 @@ | |||
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use cortex_m_rt::entry; | 7 | use cortex_m_rt::entry; |
| 8 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 8 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 9 | use embedded_hal::digital::v2::{InputPin, OutputPin}; | ||
| 10 | use example_common::*; | 9 | use 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; | |||
| 8 | use embassy_stm32::exti::ExtiInput; | 8 | use embassy_stm32::exti::ExtiInput; |
| 9 | use embassy_stm32::gpio::{Input, Pull}; | 9 | use embassy_stm32::gpio::{Input, Pull}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; | ||
| 12 | use example_common::*; | 11 | use 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; | |||
| 9 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::usart::{Config, Uart}; | 10 | use embassy_stm32::usart::{Config, Uart}; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use embassy_traits::uart::Write as _; | ||
| 13 | use example_common::*; | 12 | use example_common::*; |
| 14 | use heapless::String; | 13 | use heapless::String; |
| 15 | 14 | ||
