From 95218bf8d4a49121e94d6290b8cdb4129a9ea0b8 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sun, 21 Mar 2021 21:01:06 +0100 Subject: [PATCH] Rename GpioteInput -> PortInput --- embassy-nrf-examples/src/bin/gpiote_port.rs | 12 ++++++------ embassy-nrf/src/gpiote.rs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/embassy-nrf-examples/src/bin/gpiote_port.rs b/embassy-nrf-examples/src/bin/gpiote_port.rs index 273cd124..b0e59ccc 100644 --- a/embassy-nrf-examples/src/bin/gpiote_port.rs +++ b/embassy-nrf-examples/src/bin/gpiote_port.rs @@ -8,7 +8,7 @@ mod example_common; use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; use example_common::*; -use gpiote::GpioteInput; +use gpiote::PortInput; use core::pin::Pin; use cortex_m_rt::entry; @@ -21,7 +21,7 @@ use embassy::util::Forever; use embassy_nrf::gpiote; use embassy_nrf::interrupt; -async fn button(n: usize, mut pin: GpioteInput) { +async fn button(n: usize, mut pin: PortInput) { loop { Pin::new(&mut pin).wait_for_low().await; info!("Button {:?} pressed!", n); @@ -38,19 +38,19 @@ async fn run() { let button1 = button( 1, - GpioteInput::new(g, Input::new(p.p0_11.degrade(), Pull::Up)), + PortInput::new(g, Input::new(p.p0_11.degrade(), Pull::Up)), ); let button2 = button( 2, - GpioteInput::new(g, Input::new(p.p0_12.degrade(), Pull::Up)), + PortInput::new(g, Input::new(p.p0_12.degrade(), Pull::Up)), ); let button3 = button( 3, - GpioteInput::new(g, Input::new(p.p0_24.degrade(), Pull::Up)), + PortInput::new(g, Input::new(p.p0_24.degrade(), Pull::Up)), ); let button4 = button( 4, - GpioteInput::new(g, Input::new(p.p0_25.degrade(), Pull::Up)), + PortInput::new(g, Input::new(p.p0_25.degrade(), Pull::Up)), ); futures::join!(button1, button2, button3, button4); } diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index 2b603c4c..dc96a7eb 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs @@ -338,18 +338,18 @@ impl OutputChannel { */ /// GPIO input driver with support -pub struct GpioteInput { +pub struct PortInput { pin: Input, } -impl Unpin for GpioteInput {} +impl Unpin for PortInput {} -impl GpioteInput { +impl PortInput { pub fn new(_init: Initialized, pin: Input) -> Self { Self { pin } } } -impl InputPin for GpioteInput { +impl InputPin for PortInput { type Error = Infallible; fn is_high(&self) -> Result { @@ -361,7 +361,7 @@ impl InputPin for GpioteInput { } } -impl WaitForHigh for GpioteInput { +impl WaitForHigh for PortInput { type Future<'a> = PortInputFuture<'a>; fn wait_for_high<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { @@ -374,7 +374,7 @@ impl WaitForHigh for GpioteInput { } } -impl WaitForLow for GpioteInput { +impl WaitForLow for PortInput { type Future<'a> = PortInputFuture<'a>; fn wait_for_low<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> {