Rename GpioteInput -> PortInput
This commit is contained in:
parent
c0876187dd
commit
95218bf8d4
@ -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<AnyPin>) {
|
||||
async fn button(n: usize, mut pin: PortInput<AnyPin>) {
|
||||
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);
|
||||
}
|
||||
|
@ -338,18 +338,18 @@ impl<C: ChannelID, T> OutputChannel<C, T> {
|
||||
*/
|
||||
|
||||
/// GPIO input driver with support
|
||||
pub struct GpioteInput<T: GpioPin> {
|
||||
pub struct PortInput<T: GpioPin> {
|
||||
pin: Input<T>,
|
||||
}
|
||||
impl<T: GpioPin> Unpin for GpioteInput<T> {}
|
||||
impl<T: GpioPin> Unpin for PortInput<T> {}
|
||||
|
||||
impl<T: GpioPin> GpioteInput<T> {
|
||||
impl<T: GpioPin> PortInput<T> {
|
||||
pub fn new(_init: Initialized, pin: Input<T>) -> Self {
|
||||
Self { pin }
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: GpioPin> InputPin for GpioteInput<T> {
|
||||
impl<T: GpioPin> InputPin for PortInput<T> {
|
||||
type Error = Infallible;
|
||||
|
||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||
@ -361,7 +361,7 @@ impl<T: GpioPin> InputPin for GpioteInput<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: GpioPin> WaitForHigh for GpioteInput<T> {
|
||||
impl<T: GpioPin> WaitForHigh for PortInput<T> {
|
||||
type Future<'a> = PortInputFuture<'a>;
|
||||
|
||||
fn wait_for_high<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> {
|
||||
@ -374,7 +374,7 @@ impl<T: GpioPin> WaitForHigh for GpioteInput<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: GpioPin> WaitForLow for GpioteInput<T> {
|
||||
impl<T: GpioPin> WaitForLow for PortInput<T> {
|
||||
type Future<'a> = PortInputFuture<'a>;
|
||||
|
||||
fn wait_for_low<'a>(self: Pin<&'a mut Self>) -> Self::Future<'a> {
|
||||
|
Loading…
Reference in New Issue
Block a user