From 58fc64722c65bbdc209ae0fd1700f03702bbcd08 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Fri, 14 Jan 2022 22:02:00 +0100 Subject: stm32/gpio: expose all functionality as inherent methods. --- examples/stm32h7/src/bin/blinky.rs | 5 ++--- examples/stm32h7/src/bin/camera.rs | 5 ++--- examples/stm32h7/src/bin/mco.rs | 5 ++--- examples/stm32h7/src/bin/rng.rs | 5 ++--- 4 files changed, 8 insertions(+), 12 deletions(-) (limited to 'examples/stm32h7/src') 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; use embassy::time::{Duration, Timer}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::Peripherals; -use embedded_hal::digital::v2::OutputPin; use example_common::*; #[embassy::main] @@ -19,11 +18,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { loop { info!("high"); - unwrap!(led.set_high()); + led.set_high(); Timer::after(Duration::from_millis(500)).await; info!("low"); - unwrap!(led.set_low()); + led.set_low(); Timer::after(Duration::from_millis(500)).await; } } 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; use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; use embassy_stm32::time::U32Ext; use embassy_stm32::Peripherals; -use embedded_hal::digital::v2::OutputPin; use defmt_rtt as _; // global logger use panic_probe as _; @@ -114,11 +113,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { defmt::info!("main loop running"); loop { defmt::info!("high"); - defmt::unwrap!(led.set_high()); + led.set_high(); Timer::after(Duration::from_millis(500)).await; defmt::info!("low"); - defmt::unwrap!(led.set_low()); + led.set_low(); Timer::after(Duration::from_millis(500)).await; } } 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}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; use embassy_stm32::Peripherals; -use embedded_hal::digital::v2::OutputPin; use example_common::*; #[embassy::main] @@ -22,11 +21,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { loop { info!("high"); - unwrap!(led.set_high()); + led.set_high(); Timer::after(Duration::from_millis(500)).await; info!("low"); - unwrap!(led.set_low()); + led.set_low(); Timer::after(Duration::from_millis(500)).await; } } 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; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::rng::Rng; use embassy_stm32::Peripherals; -use embedded_hal::digital::v2::OutputPin; use example_common::*; #[embassy::main] @@ -23,11 +22,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { loop { info!("high {}", unwrap!(rng.next_u8(16).await)); - unwrap!(led.set_high()); + led.set_high(); Timer::after(Duration::from_millis(500)).await; info!("low {}", unwrap!(rng.next_u8(16).await)); - unwrap!(led.set_low()); + led.set_low(); Timer::after(Duration::from_millis(500)).await; } } -- cgit