mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-28 04:40:52 +00:00
gpio: Make AnyPin, AnyInputOnlyPin, DummyPin available from gpio module (#1918)
Making these available straight from `gpio` aligns it with other Embassy implementations (mainly nrf and stm32). Signed-off-by: Priit Laes <plaes@plaes.org>
This commit is contained in:
parent
e1697310f6
commit
a41bc4cb3d
@ -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
|
||||
|
||||
|
@ -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)]
|
||||
|
@ -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
|
||||
@ -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;
|
||||
|
@ -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);
|
||||
@ -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,
|
||||
|
@ -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},
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user