Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpio: Make AnyPin and AnyInputOnlyPin available from gpio module #1918

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- SHA driver now use specific structs for the hashing algorithm instead of a parameter. (#1908)
- Remove `fn free(self)` in HMAC which goes against esp-hal API guidelines (#1972)
- PARL_IO use ReadBuffer and WriteBuffer for Async DMA (#1996)
- `AnyPin`, `AnyInputOnyPin` and `DummyPin` are now accessible from `gpio` module (#1918)

### Fixed

Expand Down
6 changes: 0 additions & 6 deletions esp-hal/src/gpio/any_pin.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
//! Type-erased wrappers for GPIO pins.
//! These are useful to pass them into peripheral drivers.
//!
//! If you want a generic pin for GPIO input/output look into
//! [Output],[OutputOpenDrain], [Input] and [Flex].

use super::*;

#[derive(Clone, Copy)]
Expand Down
15 changes: 9 additions & 6 deletions esp-hal/src/gpio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
//! - [Input] pins can be used as digital inputs.
//! - [Output] and [OutputOpenDrain] pins can be used as digital outputs.
//! - [Flex] pin is a pin that can be used as an input and output pin.
//! - [any_pin::AnyPin] pin is type-erased that can be used for peripherals
//! signals.
//! - It supports inverting the pin, so the peripheral signal can be
//! inverted.
//! - [AnyPin] and [AnyInputOnlyPin] are type-erased GPIO pins with support for
//! inverted signalling.
//! - [DummyPin] is a useful for cases where peripheral driver requires a pin,
//! but real pin cannot be used.
//!
//! ## Examples
//! ### Set up a GPIO as an Output
Expand Down Expand Up @@ -67,8 +67,11 @@ use crate::{
#[cfg(touch)]
pub(crate) use crate::{touch_common, touch_into};

pub mod any_pin;
pub mod dummy_pin;
mod any_pin;
mod dummy_pin;

pub use any_pin::{AnyInputOnlyPin, AnyPin};
pub use dummy_pin::DummyPin;

#[cfg(soc_etm)]
pub mod etm;
Expand Down
4 changes: 2 additions & 2 deletions esp-hal/src/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
//! ```rust, no_run
#![doc = crate::before_snippet!()]
//! # use esp_hal::uart::{config::Config, Uart};
//! use esp_hal::gpio::{Io, any_pin::AnyPin};
//! use esp_hal::gpio::{AnyPin, Io};
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//!
//! let tx = AnyPin::new_inverted(io.pins.gpio1);
Expand All @@ -103,7 +103,7 @@
//! ```rust, no_run
#![doc = crate::before_snippet!()]
//! # use esp_hal::uart::{config::Config, UartTx, UartRx};
//! use esp_hal::gpio::{Io, any_pin::AnyPin};
//! use esp_hal::gpio::{AnyPin, Io};
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//!
//! let tx = UartTx::new(peripherals.UART0, &clocks,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/bin/spi_loopback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use esp_backtrace as _;
use esp_hal::{
clock::ClockControl,
delay::Delay,
gpio::{any_pin::AnyPin, Io},
gpio::{AnyPin, Io},
peripherals::Peripherals,
prelude::*,
spi::{master::Spi, SpiMode},
Expand Down
2 changes: 1 addition & 1 deletion hil-test/tests/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use critical_section::Mutex;
use esp_hal::{
clock::ClockControl,
delay::Delay,
gpio::{any_pin::AnyPin, Gpio2, Gpio3, GpioPin, Input, Io, Level, Output, Pull},
gpio::{AnyPin, Gpio2, Gpio3, GpioPin, Input, Io, Level, Output, Pull},
macros::handler,
peripherals::Peripherals,
system::SystemControl,
Expand Down
2 changes: 1 addition & 1 deletion hil-test/tests/lcd_cam_i8080.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use esp_hal::{
clock::{ClockControl, Clocks},
dma::{Dma, DmaDescriptor, DmaPriority},
dma_buffers,
gpio::dummy_pin::DummyPin,
gpio::DummyPin,
lcd_cam::{
lcd::{
i8080,
Expand Down
2 changes: 1 addition & 1 deletion hil-test/tests/lcd_cam_i8080_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use esp_hal::{
clock::{ClockControl, Clocks},
dma::{Dma, DmaDescriptor, DmaPriority},
dma_buffers,
gpio::dummy_pin::DummyPin,
gpio::DummyPin,
lcd_cam::{
lcd::{
i8080,
Expand Down