mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-10-02 14:44:42 +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)
|
- 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)
|
- Remove `fn free(self)` in HMAC which goes against esp-hal API guidelines (#1972)
|
||||||
- PARL_IO use ReadBuffer and WriteBuffer for Async DMA (#1996)
|
- PARL_IO use ReadBuffer and WriteBuffer for Async DMA (#1996)
|
||||||
|
- `AnyPin`, `AnyInputOnyPin` and `DummyPin` are now accessible from `gpio` module (#1918)
|
||||||
|
|
||||||
### Fixed
|
### 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::*;
|
use super::*;
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
//! - [Input] pins can be used as digital inputs.
|
//! - [Input] pins can be used as digital inputs.
|
||||||
//! - [Output] and [OutputOpenDrain] pins can be used as digital outputs.
|
//! - [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.
|
//! - [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
|
//! - [AnyPin] and [AnyInputOnlyPin] are type-erased GPIO pins with support for
|
||||||
//! signals.
|
//! inverted signalling.
|
||||||
//! - It supports inverting the pin, so the peripheral signal can be
|
//! - [DummyPin] is a useful for cases where peripheral driver requires a pin,
|
||||||
//! inverted.
|
//! but real pin cannot be used.
|
||||||
//!
|
//!
|
||||||
//! ## Examples
|
//! ## Examples
|
||||||
//! ### Set up a GPIO as an Output
|
//! ### Set up a GPIO as an Output
|
||||||
@ -67,8 +67,11 @@ use crate::{
|
|||||||
#[cfg(touch)]
|
#[cfg(touch)]
|
||||||
pub(crate) use crate::{touch_common, touch_into};
|
pub(crate) use crate::{touch_common, touch_into};
|
||||||
|
|
||||||
pub mod any_pin;
|
mod any_pin;
|
||||||
pub mod dummy_pin;
|
mod dummy_pin;
|
||||||
|
|
||||||
|
pub use any_pin::{AnyInputOnlyPin, AnyPin};
|
||||||
|
pub use dummy_pin::DummyPin;
|
||||||
|
|
||||||
#[cfg(soc_etm)]
|
#[cfg(soc_etm)]
|
||||||
pub mod etm;
|
pub mod etm;
|
||||||
|
@ -90,7 +90,7 @@
|
|||||||
//! ```rust, no_run
|
//! ```rust, no_run
|
||||||
#![doc = crate::before_snippet!()]
|
#![doc = crate::before_snippet!()]
|
||||||
//! # use esp_hal::uart::{config::Config, Uart};
|
//! # 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 io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
//!
|
//!
|
||||||
//! let tx = AnyPin::new_inverted(io.pins.gpio1);
|
//! let tx = AnyPin::new_inverted(io.pins.gpio1);
|
||||||
@ -103,7 +103,7 @@
|
|||||||
//! ```rust, no_run
|
//! ```rust, no_run
|
||||||
#![doc = crate::before_snippet!()]
|
#![doc = crate::before_snippet!()]
|
||||||
//! # use esp_hal::uart::{config::Config, UartTx, UartRx};
|
//! # 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 io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
//!
|
//!
|
||||||
//! let tx = UartTx::new(peripherals.UART0, &clocks,
|
//! let tx = UartTx::new(peripherals.UART0, &clocks,
|
||||||
|
@ -22,7 +22,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::{any_pin::AnyPin, Io},
|
gpio::{AnyPin, Io},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{master::Spi, SpiMode},
|
spi::{master::Spi, SpiMode},
|
||||||
|
@ -16,7 +16,7 @@ use critical_section::Mutex;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
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,
|
macros::handler,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
|
@ -9,7 +9,7 @@ use esp_hal::{
|
|||||||
clock::{ClockControl, Clocks},
|
clock::{ClockControl, Clocks},
|
||||||
dma::{Dma, DmaDescriptor, DmaPriority},
|
dma::{Dma, DmaDescriptor, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::dummy_pin::DummyPin,
|
gpio::DummyPin,
|
||||||
lcd_cam::{
|
lcd_cam::{
|
||||||
lcd::{
|
lcd::{
|
||||||
i8080,
|
i8080,
|
||||||
|
@ -10,7 +10,7 @@ use esp_hal::{
|
|||||||
clock::{ClockControl, Clocks},
|
clock::{ClockControl, Clocks},
|
||||||
dma::{Dma, DmaDescriptor, DmaPriority},
|
dma::{Dma, DmaDescriptor, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::dummy_pin::DummyPin,
|
gpio::DummyPin,
|
||||||
lcd_cam::{
|
lcd_cam::{
|
||||||
lcd::{
|
lcd::{
|
||||||
i8080,
|
i8080,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user