diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-01-14 22:02:00 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-01-19 17:59:55 +0100 |
| commit | 58fc64722c65bbdc209ae0fd1700f03702bbcd08 (patch) | |
| tree | 77f9412b47259cd4cf4170b0a257b371398d4f2c /examples/stm32h7 | |
| parent | 52e156b429417bde59d0ea67d11256866f1dcec9 (diff) | |
stm32/gpio: expose all functionality as inherent methods.
Diffstat (limited to 'examples/stm32h7')
| -rw-r--r-- | examples/stm32h7/src/bin/blinky.rs | 5 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/camera.rs | 5 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/mco.rs | 5 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/rng.rs | 5 |
4 files changed, 8 insertions, 12 deletions
diff --git a/examples/stm32h7/src/bin/blinky.rs b/examples/stm32h7/src/bin/blinky.rs index 78edb5e27..7e5934239 100644 --- a/examples/stm32h7/src/bin/blinky.rs +++ b/examples/stm32h7/src/bin/blinky.rs | |||
| @@ -8,7 +8,6 @@ use embassy::executor::Spawner; | |||
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy::time::{Duration, Timer}; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use embedded_hal::digital::v2::OutputPin; | ||
| 12 | use example_common::*; | 11 | use example_common::*; |
| 13 | 12 | ||
| 14 | #[embassy::main] | 13 | #[embassy::main] |
| @@ -19,11 +18,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 19 | 18 | ||
| 20 | loop { | 19 | loop { |
| 21 | info!("high"); | 20 | info!("high"); |
| 22 | unwrap!(led.set_high()); | 21 | led.set_high(); |
| 23 | Timer::after(Duration::from_millis(500)).await; | 22 | Timer::after(Duration::from_millis(500)).await; |
| 24 | 23 | ||
| 25 | info!("low"); | 24 | info!("low"); |
| 26 | unwrap!(led.set_low()); | 25 | led.set_low(); |
| 27 | Timer::after(Duration::from_millis(500)).await; | 26 | Timer::after(Duration::from_millis(500)).await; |
| 28 | } | 27 | } |
| 29 | } | 28 | } |
diff --git a/examples/stm32h7/src/bin/camera.rs b/examples/stm32h7/src/bin/camera.rs index d94592071..9e8071bb3 100644 --- a/examples/stm32h7/src/bin/camera.rs +++ b/examples/stm32h7/src/bin/camera.rs | |||
| @@ -11,7 +11,6 @@ use embassy_stm32::interrupt; | |||
| 11 | use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; | 11 | use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; |
| 12 | use embassy_stm32::time::U32Ext; | 12 | use embassy_stm32::time::U32Ext; |
| 13 | use embassy_stm32::Peripherals; | 13 | use embassy_stm32::Peripherals; |
| 14 | use embedded_hal::digital::v2::OutputPin; | ||
| 15 | 14 | ||
| 16 | use defmt_rtt as _; // global logger | 15 | use defmt_rtt as _; // global logger |
| 17 | use panic_probe as _; | 16 | use panic_probe as _; |
| @@ -114,11 +113,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 114 | defmt::info!("main loop running"); | 113 | defmt::info!("main loop running"); |
| 115 | loop { | 114 | loop { |
| 116 | defmt::info!("high"); | 115 | defmt::info!("high"); |
| 117 | defmt::unwrap!(led.set_high()); | 116 | led.set_high(); |
| 118 | Timer::after(Duration::from_millis(500)).await; | 117 | Timer::after(Duration::from_millis(500)).await; |
| 119 | 118 | ||
| 120 | defmt::info!("low"); | 119 | defmt::info!("low"); |
| 121 | defmt::unwrap!(led.set_low()); | 120 | led.set_low(); |
| 122 | Timer::after(Duration::from_millis(500)).await; | 121 | Timer::after(Duration::from_millis(500)).await; |
| 123 | } | 122 | } |
| 124 | } | 123 | } |
diff --git a/examples/stm32h7/src/bin/mco.rs b/examples/stm32h7/src/bin/mco.rs index 4cecd9b04..f27bd8ef8 100644 --- a/examples/stm32h7/src/bin/mco.rs +++ b/examples/stm32h7/src/bin/mco.rs | |||
| @@ -9,7 +9,6 @@ use embassy::time::{Duration, Timer}; | |||
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; | 10 | use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; |
| 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] |
| @@ -22,11 +21,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 22 | 21 | ||
| 23 | loop { | 22 | loop { |
| 24 | info!("high"); | 23 | info!("high"); |
| 25 | unwrap!(led.set_high()); | 24 | led.set_high(); |
| 26 | Timer::after(Duration::from_millis(500)).await; | 25 | Timer::after(Duration::from_millis(500)).await; |
| 27 | 26 | ||
| 28 | info!("low"); | 27 | info!("low"); |
| 29 | unwrap!(led.set_low()); | 28 | led.set_low(); |
| 30 | Timer::after(Duration::from_millis(500)).await; | 29 | Timer::after(Duration::from_millis(500)).await; |
| 31 | } | 30 | } |
| 32 | } | 31 | } |
diff --git a/examples/stm32h7/src/bin/rng.rs b/examples/stm32h7/src/bin/rng.rs index d64ad9bcd..8e03861d5 100644 --- a/examples/stm32h7/src/bin/rng.rs +++ b/examples/stm32h7/src/bin/rng.rs | |||
| @@ -10,7 +10,6 @@ use embassy::traits::rng::Random; | |||
| 10 | use embassy_stm32::gpio::{Level, Output, Speed}; | 10 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 11 | use embassy_stm32::rng::Rng; | 11 | use embassy_stm32::rng::Rng; |
| 12 | use embassy_stm32::Peripherals; | 12 | use embassy_stm32::Peripherals; |
| 13 | use embedded_hal::digital::v2::OutputPin; | ||
| 14 | use example_common::*; | 13 | use example_common::*; |
| 15 | 14 | ||
| 16 | #[embassy::main] | 15 | #[embassy::main] |
| @@ -23,11 +22,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 23 | 22 | ||
| 24 | loop { | 23 | loop { |
| 25 | info!("high {}", unwrap!(rng.next_u8(16).await)); | 24 | info!("high {}", unwrap!(rng.next_u8(16).await)); |
| 26 | unwrap!(led.set_high()); | 25 | led.set_high(); |
| 27 | Timer::after(Duration::from_millis(500)).await; | 26 | Timer::after(Duration::from_millis(500)).await; |
| 28 | 27 | ||
| 29 | info!("low {}", unwrap!(rng.next_u8(16).await)); | 28 | info!("low {}", unwrap!(rng.next_u8(16).await)); |
| 30 | unwrap!(led.set_low()); | 29 | led.set_low(); |
| 31 | Timer::after(Duration::from_millis(500)).await; | 30 | Timer::after(Duration::from_millis(500)).await; |
| 32 | } | 31 | } |
| 33 | } | 32 | } |
