diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-12-14 13:23:40 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-12-14 13:23:40 +0100 |
| commit | 153b1bbdbfc38b7973b27c05589514bee993e690 (patch) | |
| tree | 4c289c0da1dede60214a85ce6b7262c06cfc75d9 /examples/nrf | |
| parent | ff82c76935d86b7444e6abc7296c4c3e09261484 (diff) | |
nrf/gpiote: remove PortInput, move impls to Input.
Diffstat (limited to 'examples/nrf')
| -rw-r--r-- | examples/nrf/src/bin/gpiote_port.rs | 11 | ||||
| -rw-r--r-- | examples/nrf/src/bin/wdt.rs | 3 |
2 files changed, 6 insertions, 8 deletions
diff --git a/examples/nrf/src/bin/gpiote_port.rs b/examples/nrf/src/bin/gpiote_port.rs index ba9436aca..76c861d95 100644 --- a/examples/nrf/src/bin/gpiote_port.rs +++ b/examples/nrf/src/bin/gpiote_port.rs | |||
| @@ -8,12 +8,11 @@ mod example_common; | |||
| 8 | use embassy::executor::Spawner; | 8 | use embassy::executor::Spawner; |
| 9 | use embassy::traits::gpio::{WaitForHigh, WaitForLow}; | 9 | use embassy::traits::gpio::{WaitForHigh, WaitForLow}; |
| 10 | use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; | 10 | use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; |
| 11 | use embassy_nrf::gpiote::PortInput; | ||
| 12 | use embassy_nrf::Peripherals; | 11 | use embassy_nrf::Peripherals; |
| 13 | use example_common::*; | 12 | use example_common::*; |
| 14 | 13 | ||
| 15 | #[embassy::task(pool_size = 4)] | 14 | #[embassy::task(pool_size = 4)] |
| 16 | async fn button_task(n: usize, mut pin: PortInput<'static, AnyPin>) { | 15 | async fn button_task(n: usize, mut pin: Input<'static, AnyPin>) { |
| 17 | loop { | 16 | loop { |
| 18 | pin.wait_for_low().await; | 17 | pin.wait_for_low().await; |
| 19 | info!("Button {:?} pressed!", n); | 18 | info!("Button {:?} pressed!", n); |
| @@ -26,10 +25,10 @@ async fn button_task(n: usize, mut pin: PortInput<'static, AnyPin>) { | |||
| 26 | async fn main(spawner: Spawner, p: Peripherals) { | 25 | async fn main(spawner: Spawner, p: Peripherals) { |
| 27 | info!("Starting!"); | 26 | info!("Starting!"); |
| 28 | 27 | ||
| 29 | let btn1 = PortInput::new(Input::new(p.P0_11.degrade(), Pull::Up)); | 28 | let btn1 = Input::new(p.P0_11.degrade(), Pull::Up); |
| 30 | let btn2 = PortInput::new(Input::new(p.P0_12.degrade(), Pull::Up)); | 29 | let btn2 = Input::new(p.P0_12.degrade(), Pull::Up); |
| 31 | let btn3 = PortInput::new(Input::new(p.P0_24.degrade(), Pull::Up)); | 30 | let btn3 = Input::new(p.P0_24.degrade(), Pull::Up); |
| 32 | let btn4 = PortInput::new(Input::new(p.P0_25.degrade(), Pull::Up)); | 31 | let btn4 = Input::new(p.P0_25.degrade(), Pull::Up); |
| 33 | 32 | ||
| 34 | unwrap!(spawner.spawn(button_task(1, btn1))); | 33 | unwrap!(spawner.spawn(button_task(1, btn1))); |
| 35 | unwrap!(spawner.spawn(button_task(2, btn2))); | 34 | unwrap!(spawner.spawn(button_task(2, btn2))); |
diff --git a/examples/nrf/src/bin/wdt.rs b/examples/nrf/src/bin/wdt.rs index 76f171cd3..78c2205d9 100644 --- a/examples/nrf/src/bin/wdt.rs +++ b/examples/nrf/src/bin/wdt.rs | |||
| @@ -8,7 +8,6 @@ mod example_common; | |||
| 8 | use defmt::*; | 8 | use defmt::*; |
| 9 | use embassy::executor::Spawner; | 9 | use embassy::executor::Spawner; |
| 10 | use embassy_nrf::gpio::{Input, Pull}; | 10 | use embassy_nrf::gpio::{Input, Pull}; |
| 11 | use embassy_nrf::gpiote::PortInput; | ||
| 12 | use embassy_nrf::wdt::{Config, Watchdog}; | 11 | use embassy_nrf::wdt::{Config, Watchdog}; |
| 13 | use embassy_nrf::Peripherals; | 12 | use embassy_nrf::Peripherals; |
| 14 | use embassy_traits::gpio::{WaitForHigh, WaitForLow}; | 13 | use embassy_traits::gpio::{WaitForHigh, WaitForLow}; |
| @@ -32,7 +31,7 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 32 | } | 31 | } |
| 33 | }; | 32 | }; |
| 34 | 33 | ||
| 35 | let mut button = PortInput::new(Input::new(p.P0_11, Pull::Up)); | 34 | let mut button = Input::new(p.P0_11, Pull::Up); |
| 36 | 35 | ||
| 37 | info!("Watchdog started, press button 1 to pet it or I'll reset in 3 seconds!"); | 36 | info!("Watchdog started, press button 1 to pet it or I'll reset in 3 seconds!"); |
| 38 | 37 | ||
