diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-06-25 06:20:45 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-06-25 06:24:14 +0200 |
| commit | c7c897bb72bd88eb404871c641de69a542d2b56d (patch) | |
| tree | 8266f132c70104b0717f9dc07801a85e8a9c38da /examples | |
| parent | a35c8561c7dfafeabe10877a94f8519174dfe4c7 (diff) | |
rp/gpio: add infallible inherent methods
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/rp/src/bin/blinky.rs | 5 | ||||
| -rw-r--r-- | examples/rp/src/bin/button.rs | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/examples/rp/src/bin/blinky.rs b/examples/rp/src/bin/blinky.rs index e42999912..a162ed2f7 100644 --- a/examples/rp/src/bin/blinky.rs +++ b/examples/rp/src/bin/blinky.rs | |||
| @@ -12,7 +12,6 @@ mod example_common; | |||
| 12 | use defmt::*; | 12 | use defmt::*; |
| 13 | use embassy::executor::Spawner; | 13 | use embassy::executor::Spawner; |
| 14 | use embassy_rp::{gpio, Peripherals}; | 14 | use embassy_rp::{gpio, Peripherals}; |
| 15 | use embedded_hal::digital::v2::OutputPin; | ||
| 16 | use gpio::{Level, Output}; | 15 | use gpio::{Level, Output}; |
| 17 | 16 | ||
| 18 | #[embassy::main] | 17 | #[embassy::main] |
| @@ -21,11 +20,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 21 | 20 | ||
| 22 | loop { | 21 | loop { |
| 23 | info!("led on!"); | 22 | info!("led on!"); |
| 24 | led.set_high().unwrap(); | 23 | led.set_high(); |
| 25 | cortex_m::asm::delay(1_000_000); | 24 | cortex_m::asm::delay(1_000_000); |
| 26 | 25 | ||
| 27 | info!("led off!"); | 26 | info!("led off!"); |
| 28 | led.set_low().unwrap(); | 27 | led.set_low(); |
| 29 | cortex_m::asm::delay(1_000_000); | 28 | cortex_m::asm::delay(1_000_000); |
| 30 | } | 29 | } |
| 31 | } | 30 | } |
diff --git a/examples/rp/src/bin/button.rs b/examples/rp/src/bin/button.rs index c4d942ff5..12bc0e0d9 100644 --- a/examples/rp/src/bin/button.rs +++ b/examples/rp/src/bin/button.rs | |||
| @@ -20,10 +20,10 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 20 | let mut led = Output::new(p.PIN_25, Level::Low); | 20 | let mut led = Output::new(p.PIN_25, Level::Low); |
| 21 | 21 | ||
| 22 | loop { | 22 | loop { |
| 23 | if button.is_high().unwrap() { | 23 | if button.is_high() { |
| 24 | led.set_high().unwrap(); | 24 | led.set_high(); |
| 25 | } else { | 25 | } else { |
| 26 | led.set_low().unwrap(); | 26 | led.set_low(); |
| 27 | } | 27 | } |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
