diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-03-21 21:01:06 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-03-29 00:58:57 +0200 |
| commit | 95218bf8d4a49121e94d6290b8cdb4129a9ea0b8 (patch) | |
| tree | 5161b6066801ba142b7885ef9f7b9a2ddd15d61c | |
| parent | c0876187dd16d4a391a9b11a4eb5f91689c7d6ff (diff) | |
Rename GpioteInput -> PortInput
| -rw-r--r-- | embassy-nrf-examples/src/bin/gpiote_port.rs | 12 | ||||
| -rw-r--r-- | 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 273cd124d..b0e59ccce 100644 --- a/embassy-nrf-examples/src/bin/gpiote_port.rs +++ b/embassy-nrf-examples/src/bin/gpiote_port.rs | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | mod example_common; | 8 | mod example_common; |
| 9 | use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; | 9 | use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; |
| 10 | use example_common::*; | 10 | use example_common::*; |
| 11 | use gpiote::GpioteInput; | 11 | use gpiote::PortInput; |
| 12 | 12 | ||
| 13 | use core::pin::Pin; | 13 | use core::pin::Pin; |
| 14 | use cortex_m_rt::entry; | 14 | use cortex_m_rt::entry; |
| @@ -21,7 +21,7 @@ use embassy::util::Forever; | |||
| 21 | use embassy_nrf::gpiote; | 21 | use embassy_nrf::gpiote; |
| 22 | use embassy_nrf::interrupt; | 22 | use embassy_nrf::interrupt; |
| 23 | 23 | ||
| 24 | async fn button(n: usize, mut pin: GpioteInput<AnyPin>) { | 24 | async fn button(n: usize, mut pin: PortInput<AnyPin>) { |
| 25 | loop { | 25 | loop { |
| 26 | Pin::new(&mut pin).wait_for_low().await; | 26 | Pin::new(&mut pin).wait_for_low().await; |
| 27 | info!("Button {:?} pressed!", n); | 27 | info!("Button {:?} pressed!", n); |
| @@ -38,19 +38,19 @@ async fn run() { | |||
| 38 | 38 | ||
| 39 | let button1 = button( | 39 | let button1 = button( |
| 40 | 1, | 40 | 1, |
| 41 | GpioteInput::new(g, Input::new(p.p0_11.degrade(), Pull::Up)), | 41 | PortInput::new(g, Input::new(p.p0_11.degrade(), Pull::Up)), |
| 42 | ); | 42 | ); |
| 43 | let button2 = button( | 43 | let button2 = button( |
| 44 | 2, | 44 | 2, |
| 45 | GpioteInput::new(g, Input::new(p.p0_12.degrade(), Pull::Up)), | 45 | PortInput::new(g, Input::new(p.p0_12.degrade(), Pull::Up)), |
| 46 | ); | 46 | ); |
| 47 | let button3 = button( | 47 | let button3 = button( |
| 48 | 3, | 48 | 3, |
| 49 | GpioteInput::new(g, Input::new(p.p0_24.degrade(), Pull::Up)), | 49 | PortInput::new(g, Input::new(p.p0_24.degrade(), Pull::Up)), |
| 50 | ); | 50 | ); |
| 51 | let button4 = button( | 51 | let button4 = button( |
| 52 | 4, | 52 | 4, |
| 53 | GpioteInput::new(g, Input::new(p.p0_25.degrade(), Pull::Up)), | 53 | PortInput::new(g, Input::new(p.p0_25.degrade(), Pull::Up)), |
| 54 | ); | 54 | ); |
| 55 | futures::join!(button1, button2, button3, button4); | 55 | futures::join!(button1, button2, button3, button4); |
| 56 | } | 56 | } |
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index 2b603c4c1..dc96a7eba 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs | |||
| @@ -338,18 +338,18 @@ impl<C: ChannelID, T> OutputChannel<C, T> { | |||
| 338 | */ | 338 | */ |
| 339 | 339 | ||
| 340 | /// GPIO input driver with support | 340 | /// GPIO input driver with support |
| 341 | pub struct GpioteInput<T: GpioPin> { | 341 | pub struct PortInput<T: GpioPin> { |
| 342 | pin: Input<T>, | 342 | pin: Input<T>, |
| 343 | } | 343 | } |
| 344 | impl<T: GpioPin> Unpin for GpioteInput<T> {} | 344 | impl<T: GpioPin> Unpin for PortInput<T> {} |
| 345 | 345 | ||
| 346 | impl<T: GpioPin> GpioteInput<T> { | 346 | impl<T: GpioPin> PortInput<T> { |
| 347 | pub fn new(_init: Initialized, pin: Input<T>) -> Self { | 347 | pub fn new(_init: Initialized, pin: Input<T>) -> Self { |
| 348 | Self { pin } | 348 | Self { pin } |
| 349 | } | 349 | } |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | impl<T: GpioPin> InputPin for GpioteInput<T> { | 352 | impl<T: GpioPin> InputPin for PortInput<T> { |
| 353 | type Error = Infallible; | 353 | type Error = Infallible; |
| 354 | 354 | ||
| 355 | fn is_high(&self) -> Result<bool, Self::Error> { | 355 | fn is_high(&self) -> Result<bool, Self::Error> { |
| @@ -361,7 +361,7 @@ impl<T: GpioPin> InputPin for GpioteInput<T> { | |||
| 361 | } | 361 | } |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | impl<T: GpioPin> WaitForHigh for GpioteInput<T> { | 364 | impl<T: GpioPin> WaitForHigh for PortInput<T> { |
| 365 | type Future<'a> = PortInputFuture<'a>; | 365 | type Future<'a> = PortInputFuture<'a>; |
| 366 | 366 | ||
| 367 | fn wait_for_high<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { | 367 | fn wait_for_high<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { |
| @@ -374,7 +374,7 @@ impl<T: GpioPin> WaitForHigh for GpioteInput<T> { | |||
| 374 | } | 374 | } |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | impl<T: GpioPin> WaitForLow for GpioteInput<T> { | 377 | impl<T: GpioPin> WaitForLow for PortInput<T> { |
| 378 | type Future<'a> = PortInputFuture<'a>; | 378 | type Future<'a> = PortInputFuture<'a>; |
| 379 | 379 | ||
| 380 | fn wait_for_low<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { | 380 | fn wait_for_low<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> { |
