diff --git a/esp-hal/CHANGELOG.md b/esp-hal/CHANGELOG.md index 224d81239b0..e19c5d07ee7 100644 --- a/esp-hal/CHANGELOG.md +++ b/esp-hal/CHANGELOG.md @@ -171,6 +171,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SPI transactions are now cancelled if the transfer object (or async Future) is dropped. (#2216) - The DMA channel types have been removed from peripherals (#2261) - `I2C` driver renamed to `I2c` (#2320) +- The GPIO pins are now accessible via `Peripherals` and are no longer part of the `Io` struct (#2508) ### Fixed @@ -215,6 +216,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed `esp_hal::spi::slave::WithDmaSpiN` traits (#2260) - The `WithDmaAes` trait has been removed (#2261) - The `I2s::new_i2s1` constructor has been removed (#2261) +- `Peripherals.GPIO` has been removed (#2508) ## [0.20.1] - 2024-08-30 diff --git a/esp-hal/MIGRATING-0.21.md b/esp-hal/MIGRATING-0.21.md index 57460bd8037..0b74c31f1ea 100644 --- a/esp-hal/MIGRATING-0.21.md +++ b/esp-hal/MIGRATING-0.21.md @@ -1,5 +1,23 @@ # Migration Guide from 0.21.x to v0.22.x +## IO changes + +### GPIO pins are now accessible via `Peripherals` + +```diff + let peripherals = esp_hal::init(Default::default()); +-let io = Io::new(peripherals.GPIO, peripherals.IOMUX); +-let pin = io.pins.gpio5; ++let pin = peripherals.pins.gpio5; +``` + +### `Io` constructor changes + +- `new_with_priority` and `new_no_bind_interrupts` have been removed. + Use `set_priority` to configure the GPIO interrupt priority. + We no longer overwrite interrupt handlers set by user code during initialization. +- `new` no longer takes `peripherals.GPIO` + ## Removed `async`-specific constructors The following async-specific constuctors have been removed: diff --git a/esp-hal/src/analog/adc/mod.rs b/esp-hal/src/analog/adc/mod.rs index 159ab29cafb..053e0ae1f8d 100644 --- a/esp-hal/src/analog/adc/mod.rs +++ b/esp-hal/src/analog/adc/mod.rs @@ -31,10 +31,11 @@ //! # use esp_hal::analog::adc::Attenuation; //! # use esp_hal::analog::adc::Adc; //! # use esp_hal::delay::Delay; -//! # use esp_hal::gpio::Io; -//! # let io = Io::new(peripherals.IO_MUX); #![cfg_attr(esp32, doc = "let analog_pin = peripherals.pins.gpio32;")] -#![cfg_attr(any(esp32s2, esp32s3), doc = "let analog_pin = peripherals.pins.gpio3;")] +#![cfg_attr( + any(esp32s2, esp32s3), + doc = "let analog_pin = peripherals.pins.gpio3;" +)] #![cfg_attr( not(any(esp32, esp32s2, esp32s3)), doc = "let analog_pin = peripherals.pins.gpio2;" diff --git a/esp-hal/src/analog/dac.rs b/esp-hal/src/analog/dac.rs index 2b1c6a44c46..9956375d67c 100644 --- a/esp-hal/src/analog/dac.rs +++ b/esp-hal/src/analog/dac.rs @@ -17,12 +17,9 @@ //! ### Write a value to a DAC channel //! ```rust, no_run #![doc = crate::before_snippet!()] -//! # use esp_hal::gpio::Io; //! # use esp_hal::analog::dac::Dac; //! # use esp_hal::delay::Delay; //! # use embedded_hal::delay::DelayNs; -//! -//! let io = Io::new(peripherals.IO_MUX); #![cfg_attr(esp32, doc = "let dac1_pin = peripherals.pins.gpio25;")] #![cfg_attr(esp32s2, doc = "let dac1_pin = peripherals.pins.gpio17;")] //! let mut dac1 = Dac::new(peripherals.DAC1, dac1_pin); diff --git a/esp-hal/src/dma/mod.rs b/esp-hal/src/dma/mod.rs index 9710cdff97b..de519b3e3c1 100644 --- a/esp-hal/src/dma/mod.rs +++ b/esp-hal/src/dma/mod.rs @@ -18,13 +18,11 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::dma_buffers; -//! # use esp_hal::gpio::Io; //! # use esp_hal::spi::{master::{Config, Spi}, SpiMode}; //! # use esp_hal::dma::{Dma, DmaPriority}; //! let dma = Dma::new(peripherals.DMA); #![cfg_attr(any(esp32, esp32s2), doc = "let dma_channel = dma.spi2channel;")] #![cfg_attr(not(any(esp32, esp32s2)), doc = "let dma_channel = dma.channel0;")] -//! let io = Io::new(peripherals.IO_MUX); //! let sclk = peripherals.pins.gpio0; //! let miso = peripherals.pins.gpio2; //! let mosi = peripherals.pins.gpio4; diff --git a/esp-hal/src/etm.rs b/esp-hal/src/etm.rs index 95155a60fb1..c592978e73e 100644 --- a/esp-hal/src/etm.rs +++ b/esp-hal/src/etm.rs @@ -23,13 +23,11 @@ //! ## Examples //! ```rust, no_run #![doc = crate::before_snippet!()] -//! # use esp_hal::gpio::Io; //! # use esp_hal::gpio::etm::{Channels, InputConfig, OutputConfig}; //! # use esp_hal::etm::Etm; //! # use esp_hal::gpio::Pull; //! # use esp_hal::gpio::Level; //! -//! let io = Io::new(peripherals.IO_MUX); //! let mut led = peripherals.pins.gpio1; //! let button = peripherals.pins.gpio9; //! diff --git a/esp-hal/src/gpio/etm.rs b/esp-hal/src/gpio/etm.rs index 2ff09c0c90e..a3fe2d22448 100644 --- a/esp-hal/src/gpio/etm.rs +++ b/esp-hal/src/gpio/etm.rs @@ -25,7 +25,6 @@ //! ### Toggle an LED When a Button is Pressed //! ```rust, no_run #![doc = crate::before_snippet!()] -//! # use esp_hal::gpio::Io; //! # use esp_hal::gpio::etm::Channels; //! # use esp_hal::etm::Etm; //! # use esp_hal::gpio::etm::InputConfig; @@ -33,7 +32,6 @@ //! # use esp_hal::gpio::Pull; //! # use esp_hal::gpio::Level; //! # -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut led = peripherals.pins.gpio1; //! # let button = peripherals.pins.gpio9; //! diff --git a/esp-hal/src/gpio/lp_io.rs b/esp-hal/src/gpio/lp_io.rs index bee8f20fe01..f744f1916f2 100644 --- a/esp-hal/src/gpio/lp_io.rs +++ b/esp-hal/src/gpio/lp_io.rs @@ -15,15 +15,16 @@ //! chip from Deep-sleep. //! //! # Example +//! //! ## Configure a LP Pin as Output +//! //! ```rust, no_run #![doc = crate::before_snippet!()] -//! use esp_hal::gpio::Io; //! use esp_hal::gpio::lp_io::LowPowerOutput; -//! let io = Io::new(peripherals.IO_MUX); //! // configure GPIO 1 as LP output pin //! let lp_pin: LowPowerOutput<'_, 1> = -//! LowPowerOutput::new(peripherals.pins.gpio1); # } +//! LowPowerOutput::new(peripherals.pins.gpio1); +//! # } //! ``` use core::marker::PhantomData; diff --git a/esp-hal/src/gpio/mod.rs b/esp-hal/src/gpio/mod.rs index 521d2eb4f2b..d07c891d29d 100644 --- a/esp-hal/src/gpio/mod.rs +++ b/esp-hal/src/gpio/mod.rs @@ -18,9 +18,9 @@ //! GPIO interrupts. For more information, see the //! [`Io::set_interrupt_handler`]. //! -//! The pins are accessible via [`Io::pins`]. These pins can then be passed to -//! peripherals (such as SPI, UART, I2C, etc.), to pin drivers or can be -//! [`GpioPin::split`] into peripheral signals. +//! The pins are accessible via [`crate::Peripherals::pins`]. These pins can +//! then be passed to peripherals (such as SPI, UART, I2C, etc.), to pin drivers +//! or can be [`GpioPin::split`] into peripheral signals. //! //! Each pin is a different type initially. Internally, `esp-hal` will often //! erase their types automatically, but they can also be converted into @@ -52,7 +52,6 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::gpio::{Io, Level, Output}; -//! let io = Io::new(peripherals.IO_MUX); //! let mut led = Output::new(peripherals.pins.gpio5, Level::High); //! # } //! ``` diff --git a/esp-hal/src/gpio/rtc_io.rs b/esp-hal/src/gpio/rtc_io.rs index a265c2ecabb..be7aaf4f501 100644 --- a/esp-hal/src/gpio/rtc_io.rs +++ b/esp-hal/src/gpio/rtc_io.rs @@ -23,8 +23,6 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::gpio::rtc_io::LowPowerOutput; -//! # use esp_hal::gpio::Io; -//! let io = Io::new(peripherals.IO_MUX); //! // configure GPIO 1 as ULP output pin //! let lp_pin = LowPowerOutput::<'static, 1>::new(peripherals.pins.gpio1); //! # } diff --git a/esp-hal/src/i2c/master/mod.rs b/esp-hal/src/i2c/master/mod.rs index bd4a88b412f..f086982d53c 100644 --- a/esp-hal/src/i2c/master/mod.rs +++ b/esp-hal/src/i2c/master/mod.rs @@ -19,7 +19,6 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::i2c::master::{Config, I2c}; -//! # use esp_hal::gpio::Io; //! //! // Create a new peripheral object with the described wiring //! // and standard I2C clock speed. diff --git a/esp-hal/src/i2s/master.rs b/esp-hal/src/i2s/master.rs index 3499e5257e1..5da9e95ce26 100644 --- a/esp-hal/src/i2s/master.rs +++ b/esp-hal/src/i2s/master.rs @@ -30,10 +30,8 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::i2s::master::{I2s, Standard, DataFormat}; -//! # use esp_hal::gpio::Io; //! # use esp_hal::dma_buffers; //! # use esp_hal::dma::{Dma, DmaPriority}; -//! # let io = Io::new(peripherals.IO_MUX); //! let dma = Dma::new(peripherals.DMA); #![cfg_attr(any(esp32, esp32s2), doc = "let dma_channel = dma.i2s0channel;")] #![cfg_attr(not(any(esp32, esp32s2)), doc = "let dma_channel = dma.channel0;")] diff --git a/esp-hal/src/lcd_cam/cam.rs b/esp-hal/src/lcd_cam/cam.rs index be60e7ded67..905c8d47d0b 100644 --- a/esp-hal/src/lcd_cam/cam.rs +++ b/esp-hal/src/lcd_cam/cam.rs @@ -16,12 +16,10 @@ //! master mode. //! ```rust, no_run #![doc = crate::before_snippet!()] -//! # use esp_hal::gpio::Io; //! # use esp_hal::lcd_cam::{cam::{Camera, RxEightBits}, LcdCam}; //! # use fugit::RateExtU32; //! # use esp_hal::dma_rx_stream_buffer; //! # use esp_hal::dma::{Dma, DmaPriority}; -//! # let io = Io::new(peripherals.IO_MUX); //! //! # let dma = Dma::new(peripherals.DMA); //! # let channel = dma.channel0; diff --git a/esp-hal/src/lcd_cam/lcd/i8080.rs b/esp-hal/src/lcd_cam/lcd/i8080.rs index 3380a711759..ce4b9e2e6b4 100644 --- a/esp-hal/src/lcd_cam/lcd/i8080.rs +++ b/esp-hal/src/lcd_cam/lcd/i8080.rs @@ -15,11 +15,9 @@ //! //! ```rust, no_run #![doc = crate::before_snippet!()] -//! # use esp_hal::gpio::Io; //! # use esp_hal::lcd_cam::{LcdCam, lcd::i8080::{Config, I8080, TxEightBits}}; //! # use esp_hal::dma_tx_buffer; //! # use esp_hal::dma::{Dma, DmaPriority, DmaTxBuf}; -//! # let io = Io::new(peripherals.IO_MUX); //! //! # let dma = Dma::new(peripherals.DMA); //! # let channel = dma.channel0; diff --git a/esp-hal/src/ledc/mod.rs b/esp-hal/src/ledc/mod.rs index 316b66adc76..fe414ff5677 100644 --- a/esp-hal/src/ledc/mod.rs +++ b/esp-hal/src/ledc/mod.rs @@ -29,8 +29,6 @@ //! # use esp_hal::ledc::timer; //! # use esp_hal::ledc::LowSpeed; //! # use esp_hal::ledc::channel; -//! # use esp_hal::gpio::Io; -//! # let io = Io::new(peripherals.IO_MUX); //! # let led = peripherals.pins.gpio0; //! //! let mut ledc = Ledc::new(peripherals.LEDC); diff --git a/esp-hal/src/lib.rs b/esp-hal/src/lib.rs index a537f6a2982..ff938a3907a 100644 --- a/esp-hal/src/lib.rs +++ b/esp-hal/src/lib.rs @@ -81,7 +81,6 @@ //! }); //! //! // Set GPIO0 as an output, and set its state high initially. -//! let io = Io::new(peripherals.IO_MUX); //! let mut led = Output::new(peripherals.pins.gpio0, Level::High); //! //! let delay = Delay::new(); diff --git a/esp-hal/src/mcpwm/mod.rs b/esp-hal/src/mcpwm/mod.rs index e47bdd1ac6c..8f53ea33e66 100644 --- a/esp-hal/src/mcpwm/mod.rs +++ b/esp-hal/src/mcpwm/mod.rs @@ -52,9 +52,6 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::mcpwm::{operator::{DeadTimeCfg, PWMStream, PwmPinConfig}, timer::PwmWorkingMode, McPwm, PeripheralClockConfig}; -//! # use esp_hal::gpio::Io; -//! -//! # let io = Io::new(peripherals.IO_MUX); //! # let pin = peripherals.pins.gpio0; //! //! // initialize peripheral diff --git a/esp-hal/src/mcpwm/operator.rs b/esp-hal/src/mcpwm/operator.rs index b14d915f7f3..1b580b72d60 100644 --- a/esp-hal/src/mcpwm/operator.rs +++ b/esp-hal/src/mcpwm/operator.rs @@ -479,8 +479,6 @@ impl embedded_hal::pwm::SetD /// # use esp_hal::{mcpwm, prelude::*}; /// # use esp_hal::mcpwm::{McPwm, PeripheralClockConfig}; /// # use esp_hal::mcpwm::operator::{DeadTimeCfg, PwmPinConfig, PWMStream}; -/// # use esp_hal::gpio::Io; -/// # let io = Io::new(peripherals.IO_MUX); /// // active high complementary using PWMA input /// let bridge_active = DeadTimeCfg::new_ahc(); /// // use PWMB as input for both outputs diff --git a/esp-hal/src/rmt.rs b/esp-hal/src/rmt.rs index 17bf47089e2..67949ea1341 100644 --- a/esp-hal/src/rmt.rs +++ b/esp-hal/src/rmt.rs @@ -54,9 +54,7 @@ //! # use esp_hal::peripherals::Peripherals; //! # use esp_hal::rmt::TxChannelConfig; //! # use esp_hal::rmt::Rmt; -//! # use esp_hal::gpio::Io; //! # use crate::esp_hal::rmt::TxChannelCreator; -//! # let io = Io::new(peripherals.IO_MUX); #![cfg_attr(esp32h2, doc = "let freq = 32.MHz();")] #![cfg_attr(not(esp32h2), doc = "let freq = 80.MHz();")] //! let rmt = Rmt::new(peripherals.RMT, freq).unwrap(); diff --git a/esp-hal/src/rng.rs b/esp-hal/src/rng.rs index a25cd70d22e..d9666e300e3 100644 --- a/esp-hal/src/rng.rs +++ b/esp-hal/src/rng.rs @@ -138,9 +138,7 @@ impl rand_core::RngCore for Rng { /// # use esp_hal::peripherals::Peripherals; /// # use esp_hal::peripherals::ADC1; /// # use esp_hal::analog::adc::{AdcConfig, Attenuation, Adc}; -/// # use esp_hal::gpio::Io; /// -/// let io = Io::new(peripherals.IO_MUX); /// let mut buf = [0u8; 16]; /// /// // ADC is not available from now @@ -152,10 +150,12 @@ impl rand_core::RngCore for Rng { #[cfg_attr(esp32, doc = "let analog_pin = peripherals.pins.gpio32;")] #[cfg_attr(not(esp32), doc = "let analog_pin = peripherals.pins.gpio3;")] /// let mut adc1_config = AdcConfig::new(); -/// let mut adc1_pin = adc1_config.enable_pin(analog_pin, -/// Attenuation::Attenuation11dB); let mut adc1 = -/// Adc::::new(peripherals.ADC1, adc1_config); let pin_value: u16 = -/// nb::block!(adc1.read_oneshot(&mut adc1_pin)).unwrap(); +/// let mut adc1_pin = adc1_config.enable_pin( +/// analog_pin, +/// Attenuation::Attenuation11dB +/// ); +/// let mut adc1 = Adc::::new(peripherals.ADC1, adc1_config); +/// let pin_value: u16 = nb::block!(adc1.read_oneshot(&mut adc1_pin)).unwrap(); /// rng.read(&mut buf); /// true_rand = rng.random(); /// let pin_value: u16 = nb::block!(adc1.read_oneshot(&mut adc1_pin)).unwrap(); diff --git a/esp-hal/src/rom/md5.rs b/esp-hal/src/rom/md5.rs index fa00fb20658..2c249e226df 100644 --- a/esp-hal/src/rom/md5.rs +++ b/esp-hal/src/rom/md5.rs @@ -32,10 +32,8 @@ #![doc = crate::before_snippet!()] //! # use esp_hal::rom::md5; //! # use esp_hal::uart::Uart; -//! # use esp_hal::gpio::Io; //! # use core::writeln; //! # use core::fmt::Write; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut uart0 = Uart::new(peripherals.UART0, peripherals.pins.gpio1, peripherals.pins.gpio2).unwrap(); //! # let data = "Dummy"; //! let d: md5::Digest = md5::compute(&data); @@ -48,10 +46,8 @@ #![doc = crate::before_snippet!()] //! # use esp_hal::rom::md5; //! # use esp_hal::uart::Uart; -//! # use esp_hal::gpio::Io; //! # use core::writeln; //! # use core::fmt::Write; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut uart0 = Uart::new(peripherals.UART0, peripherals.pins.gpio1, peripherals.pins.gpio2).unwrap(); //! # let data0 = "Dummy"; //! # let data1 = "Dummy"; diff --git a/esp-hal/src/soc/esp32/efuse/mod.rs b/esp-hal/src/soc/esp32/efuse/mod.rs index 1ecd29cd15b..1ffb4263002 100644 --- a/esp-hal/src/soc/esp32/efuse/mod.rs +++ b/esp-hal/src/soc/esp32/efuse/mod.rs @@ -24,11 +24,9 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::efuse::Efuse; -//! # use esp_hal::gpio::Io; //! # use esp_hal::uart::Uart; //! # use core::writeln; //! # use core::fmt::Write; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut serial_tx = Uart::new(peripherals.UART0, peripherals.pins.gpio4, peripherals.pins.gpio5).unwrap(); //! let mac_address = Efuse::read_base_mac_address(); //! writeln!( diff --git a/esp-hal/src/soc/esp32/peripherals.rs b/esp-hal/src/soc/esp32/peripherals.rs index ab9b31ce6d1..172ff834cf9 100644 --- a/esp-hal/src/soc/esp32/peripherals.rs +++ b/esp-hal/src/soc/esp32/peripherals.rs @@ -33,7 +33,6 @@ crate::peripherals! { EFUSE <= EFUSE, FLASH_ENCRYPTION <= FLASH_ENCRYPTION, FRC_TIMER <= FRC_TIMER, - GPIO <= GPIO (GPIO,GPIO_NMI), GPIO_SD <= GPIO_SD, HINF <= HINF, I2C0 <= I2C0, diff --git a/esp-hal/src/soc/esp32c2/efuse/mod.rs b/esp-hal/src/soc/esp32c2/efuse/mod.rs index b330e4fcdd6..83c5f116763 100644 --- a/esp-hal/src/soc/esp32c2/efuse/mod.rs +++ b/esp-hal/src/soc/esp32c2/efuse/mod.rs @@ -21,11 +21,9 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::efuse::Efuse; -//! # use esp_hal::gpio::Io; //! # use esp_hal::uart::Uart; //! # use core::writeln; //! # use core::fmt::Write; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut serial_tx = Uart::new(peripherals.UART0, peripherals.pins.gpio4, peripherals.pins.gpio5).unwrap(); //! let mac_address = Efuse::read_base_mac_address(); //! writeln!( diff --git a/esp-hal/src/soc/esp32c2/peripherals.rs b/esp-hal/src/soc/esp32c2/peripherals.rs index 3cd86959d96..4685a536c21 100644 --- a/esp-hal/src/soc/esp32c2/peripherals.rs +++ b/esp-hal/src/soc/esp32c2/peripherals.rs @@ -28,7 +28,6 @@ crate::peripherals! { ECC <= ECC, EFUSE <= EFUSE, EXTMEM <= EXTMEM, - GPIO <= GPIO (GPIO,GPIO_NMI), I2C0 <= I2C0, INTERRUPT_CORE0 <= INTERRUPT_CORE0, IO_MUX <= IO_MUX, diff --git a/esp-hal/src/soc/esp32c3/efuse/mod.rs b/esp-hal/src/soc/esp32c3/efuse/mod.rs index 9f5d8eefdfe..5d4f4d7fc7c 100644 --- a/esp-hal/src/soc/esp32c3/efuse/mod.rs +++ b/esp-hal/src/soc/esp32c3/efuse/mod.rs @@ -22,11 +22,9 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::efuse::Efuse; -//! # use esp_hal::gpio::Io; //! # use esp_hal::uart::Uart; //! # use core::writeln; //! # use core::fmt::Write; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut serial_tx = Uart::new(peripherals.UART0, peripherals.pins.gpio4, peripherals.pins.gpio5).unwrap(); //! let mac_address = Efuse::read_base_mac_address(); //! writeln!( diff --git a/esp-hal/src/soc/esp32c3/peripherals.rs b/esp-hal/src/soc/esp32c3/peripherals.rs index dd5308df0c2..611a3f13f8a 100644 --- a/esp-hal/src/soc/esp32c3/peripherals.rs +++ b/esp-hal/src/soc/esp32c3/peripherals.rs @@ -30,7 +30,6 @@ crate::peripherals! { DS <= DS, EFUSE <= EFUSE, EXTMEM <= EXTMEM, - GPIO <= GPIO (GPIO,GPIO_NMI), GPIO_SD <= GPIO_SD, HMAC <= HMAC, I2C0 <= I2C0, diff --git a/esp-hal/src/soc/esp32c6/efuse/mod.rs b/esp-hal/src/soc/esp32c6/efuse/mod.rs index 4a9464317e6..f5cd1105126 100644 --- a/esp-hal/src/soc/esp32c6/efuse/mod.rs +++ b/esp-hal/src/soc/esp32c6/efuse/mod.rs @@ -22,11 +22,9 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::efuse::Efuse; -//! # use esp_hal::gpio::Io; //! # use esp_hal::uart::Uart; //! # use core::writeln; //! # use core::fmt::Write; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut serial_tx = Uart::new(peripherals.UART0, peripherals.pins.gpio4, peripherals.pins.gpio5).unwrap(); //! let mac_address = Efuse::read_base_mac_address(); //! writeln!( diff --git a/esp-hal/src/soc/esp32c6/peripherals.rs b/esp-hal/src/soc/esp32c6/peripherals.rs index ef74459ed22..c983c46b6fc 100644 --- a/esp-hal/src/soc/esp32c6/peripherals.rs +++ b/esp-hal/src/soc/esp32c6/peripherals.rs @@ -30,7 +30,6 @@ crate::peripherals! { ECC <= ECC, EFUSE <= EFUSE, EXTMEM <= EXTMEM, - GPIO <= GPIO (GPIO,GPIO_NMI), GPIO_SD <= GPIO_SD, HINF <= HINF, HMAC <= HMAC, diff --git a/esp-hal/src/soc/esp32h2/efuse/mod.rs b/esp-hal/src/soc/esp32h2/efuse/mod.rs index 858f4fb44c2..40ca4cee29d 100644 --- a/esp-hal/src/soc/esp32h2/efuse/mod.rs +++ b/esp-hal/src/soc/esp32h2/efuse/mod.rs @@ -22,11 +22,9 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::efuse::Efuse; -//! # use esp_hal::gpio::Io; //! # use esp_hal::uart::Uart; //! # use core::writeln; //! # use core::fmt::Write; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut serial_tx = Uart::new(peripherals.UART0, peripherals.pins.gpio4, peripherals.pins.gpio5).unwrap(); //! let mac_address = Efuse::read_base_mac_address(); //! writeln!( diff --git a/esp-hal/src/soc/esp32h2/peripherals.rs b/esp-hal/src/soc/esp32h2/peripherals.rs index 7fbda39c981..9a2606c9700 100644 --- a/esp-hal/src/soc/esp32h2/peripherals.rs +++ b/esp-hal/src/soc/esp32h2/peripherals.rs @@ -28,7 +28,6 @@ crate::peripherals! { DS <= DS, ECC <= ECC, EFUSE <= EFUSE, - GPIO <= GPIO (GPIO,GPIO_NMI), GPIO_SD <= GPIO_SD, HMAC <= HMAC, HP_APM <= HP_APM, diff --git a/esp-hal/src/soc/esp32s2/efuse/mod.rs b/esp-hal/src/soc/esp32s2/efuse/mod.rs index f8524ad682c..523e2d92151 100644 --- a/esp-hal/src/soc/esp32s2/efuse/mod.rs +++ b/esp-hal/src/soc/esp32s2/efuse/mod.rs @@ -24,11 +24,9 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::efuse::Efuse; -//! # use esp_hal::gpio::Io; //! # use esp_hal::uart::Uart; //! # use core::writeln; //! # use core::fmt::Write; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut serial_tx = Uart::new(peripherals.UART0, peripherals.pins.gpio4, peripherals.pins.gpio5).unwrap(); //! let mac_address = Efuse::read_base_mac_address(); //! writeln!( diff --git a/esp-hal/src/soc/esp32s2/peripherals.rs b/esp-hal/src/soc/esp32s2/peripherals.rs index c96d1c7b171..fc3634e17ee 100644 --- a/esp-hal/src/soc/esp32s2/peripherals.rs +++ b/esp-hal/src/soc/esp32s2/peripherals.rs @@ -30,7 +30,6 @@ crate::peripherals! { DS <= DS, EFUSE <= EFUSE, EXTMEM <= EXTMEM, - GPIO <= GPIO (GPIO,GPIO_NMI), GPIO_SD <= GPIO_SD, HMAC <= HMAC, I2C0 <= I2C0, diff --git a/esp-hal/src/soc/esp32s3/efuse/mod.rs b/esp-hal/src/soc/esp32s3/efuse/mod.rs index 85649fd74db..2c1ff3c9d3c 100644 --- a/esp-hal/src/soc/esp32s3/efuse/mod.rs +++ b/esp-hal/src/soc/esp32s3/efuse/mod.rs @@ -22,11 +22,9 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::efuse::Efuse; -//! # use esp_hal::gpio::Io; //! # use esp_hal::uart::Uart; //! # use core::writeln; //! # use core::fmt::Write; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut serial_tx = Uart::new(peripherals.UART0, peripherals.pins.gpio4, peripherals.pins.gpio5).unwrap(); //! let mac_address = Efuse::read_base_mac_address(); //! writeln!( diff --git a/esp-hal/src/soc/esp32s3/peripherals.rs b/esp-hal/src/soc/esp32s3/peripherals.rs index 9e0592abf52..ce061ae487e 100644 --- a/esp-hal/src/soc/esp32s3/peripherals.rs +++ b/esp-hal/src/soc/esp32s3/peripherals.rs @@ -31,7 +31,6 @@ crate::peripherals! { DS <= DS, EFUSE <= EFUSE, EXTMEM <= EXTMEM, - GPIO <= GPIO (GPIO,GPIO_NMI), GPIO_SD <= GPIO_SD, HMAC <= HMAC, I2C0 <= I2C0, diff --git a/esp-hal/src/spi/master.rs b/esp-hal/src/spi/master.rs index c26f5833190..3987bb3a749 100644 --- a/esp-hal/src/spi/master.rs +++ b/esp-hal/src/spi/master.rs @@ -40,8 +40,6 @@ #![doc = crate::before_snippet!()] //! # use esp_hal::spi::SpiMode; //! # use esp_hal::spi::master::{Config, Spi}; -//! # use esp_hal::gpio::Io; -//! # let io = Io::new(peripherals.IO_MUX); //! let sclk = peripherals.pins.gpio0; //! let miso = peripherals.pins.gpio2; //! let mosi = peripherals.pins.gpio1; diff --git a/esp-hal/src/spi/slave.rs b/esp-hal/src/spi/slave.rs index 86a80ffdca4..a443ebf911a 100644 --- a/esp-hal/src/spi/slave.rs +++ b/esp-hal/src/spi/slave.rs @@ -20,15 +20,13 @@ //! # use esp_hal::spi::SpiMode; //! # use esp_hal::spi::slave::Spi; //! # use esp_hal::dma::Dma; -//! # use esp_hal::gpio::Io; //! let dma = Dma::new(peripherals.DMA); #![cfg_attr(pdma, doc = "let dma_channel = dma.spi2channel;")] #![cfg_attr(gdma, doc = "let dma_channel = dma.channel0;")] -//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); -//! let sclk = io.pins.gpio0; -//! let miso = io.pins.gpio1; -//! let mosi = io.pins.gpio2; -//! let cs = io.pins.gpio3; +//! let sclk = peripherals.pins.gpio0; +//! let miso = peripherals.pins.gpio1; +//! let mosi = peripherals.pins.gpio2; +//! let cs = peripherals.pins.gpio3; //! //! let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = //! dma_buffers!(32000); diff --git a/esp-hal/src/touch.rs b/esp-hal/src/touch.rs index d1dee325822..d56e5d80825 100644 --- a/esp-hal/src/touch.rs +++ b/esp-hal/src/touch.rs @@ -10,8 +10,6 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::touch::{Touch, TouchPad}; -//! # use esp_hal::gpio::Io; -//! let io = Io::new(peripherals.IO_MUX); //! let touch_pin0 = peripherals.pins.gpio2; //! let touch = Touch::continuous_mode(peripherals.TOUCH, None); //! let mut touchpad = TouchPad::new(touch_pin0, &touch); diff --git a/esp-hal/src/twai/mod.rs b/esp-hal/src/twai/mod.rs index 4d07b8e0b4d..3686dceeaa8 100644 --- a/esp-hal/src/twai/mod.rs +++ b/esp-hal/src/twai/mod.rs @@ -32,10 +32,8 @@ //! # use esp_hal::twai::TwaiConfiguration; //! # use esp_hal::twai::BaudRate; //! # use esp_hal::twai::TwaiMode; -//! # use esp_hal::gpio::Io; //! # use embedded_can::Frame; //! # use nb::block; -//! # let io = Io::new(peripherals.IO_MUX); //! // Use GPIO pins 2 and 3 to connect to the respective pins on the TWAI //! // transceiver. //! let can_rx_pin = peripherals.pins.gpio3; @@ -86,10 +84,8 @@ //! # use esp_hal::twai::EspTwaiFrame; //! # use esp_hal::twai::StandardId; //! # use esp_hal::twai::TwaiMode; -//! # use esp_hal::gpio::Io; //! # use embedded_can::Frame; //! # use nb::block; -//! # let io = Io::new(peripherals.IO_MUX); //! // Use GPIO pins 2 and 3 to connect to the respective pins on the TWAI //! // transceiver. //! let can_rx_pin = peripherals.pins.gpio3; diff --git a/esp-hal/src/uart.rs b/esp-hal/src/uart.rs index 621f7cd1b66..7ab5783e5f9 100644 --- a/esp-hal/src/uart.rs +++ b/esp-hal/src/uart.rs @@ -23,9 +23,6 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::uart::Uart; -//! use esp_hal::gpio::Io; -//! -//! let io = Io::new(peripherals.IO_MUX); //! //! let mut uart1 = Uart::new( //! peripherals.UART1, @@ -56,8 +53,6 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::uart::{Config, Uart}; -//! # use esp_hal::gpio::Io; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut uart1 = Uart::new_with_config( //! # peripherals.UART1, //! # Config::default(), @@ -73,8 +68,6 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::uart::{Config, Uart}; -//! # use esp_hal::gpio::Io; -//! # let io = Io::new(peripherals.IO_MUX); //! # let mut uart1 = Uart::new_with_config( //! # peripherals.UART1, //! # Config::default(), @@ -94,9 +87,6 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::uart::Uart; -//! use esp_hal::gpio::Io; -//! -//! let io = Io::new(peripherals.IO_MUX); //! //! let (rx, _) = peripherals.pins.gpio2.split(); //! let (_, tx) = peripherals.pins.gpio1.split(); @@ -112,9 +102,6 @@ //! ```rust, no_run #![doc = crate::before_snippet!()] //! # use esp_hal::uart::{UartTx, UartRx}; -//! use esp_hal::gpio::Io; -//! -//! let io = Io::new(peripherals.IO_MUX); //! //! let tx = UartTx::new(peripherals.UART0, peripherals.pins.gpio1).unwrap(); //! let rx = UartRx::new(peripherals.UART1, peripherals.pins.gpio2).unwrap(); diff --git a/examples/src/bin/adc.rs b/examples/src/bin/adc.rs index 9ea7dd1d247..83e6a3e01cc 100644 --- a/examples/src/bin/adc.rs +++ b/examples/src/bin/adc.rs @@ -20,7 +20,6 @@ use esp_backtrace as _; use esp_hal::{ analog::adc::{Adc, AdcConfig, Attenuation}, delay::Delay, - gpio::Io, prelude::*, }; use esp_println::println; @@ -29,7 +28,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { let analog_pin = peripherals.pins.gpio32; diff --git a/examples/src/bin/adc_cal.rs b/examples/src/bin/adc_cal.rs index 1fc3e4e85c1..2a7a7662963 100644 --- a/examples/src/bin/adc_cal.rs +++ b/examples/src/bin/adc_cal.rs @@ -16,7 +16,6 @@ use esp_backtrace as _; use esp_hal::{ analog::adc::{Adc, AdcConfig, Attenuation}, delay::Delay, - gpio::Io, prelude::*, }; use esp_println::println; @@ -25,7 +24,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32s3")] { let analog_pin = peripherals.pins.gpio3; diff --git a/examples/src/bin/advanced_serial.rs b/examples/src/bin/advanced_serial.rs index 1e62e78798e..475cc2646c2 100644 --- a/examples/src/bin/advanced_serial.rs +++ b/examples/src/bin/advanced_serial.rs @@ -13,7 +13,7 @@ #![no_main] use esp_backtrace as _; -use esp_hal::{delay::Delay, gpio::Io, prelude::*, uart::Uart}; +use esp_hal::{delay::Delay, prelude::*, uart::Uart}; use esp_println::println; use nb::block; @@ -21,8 +21,6 @@ use nb::block; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let mut serial1 = Uart::new( peripherals.UART1, peripherals.pins.gpio4, diff --git a/examples/src/bin/blinky.rs b/examples/src/bin/blinky.rs index 8f5cb4b0a7e..0f48cb83954 100644 --- a/examples/src/bin/blinky.rs +++ b/examples/src/bin/blinky.rs @@ -11,7 +11,7 @@ use esp_backtrace as _; use esp_hal::{ delay::Delay, - gpio::{Io, Level, Output}, + gpio::{Level, Output}, prelude::*, }; @@ -20,7 +20,7 @@ fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); // Set GPIO0 as an output, and set its state high initially. - let io = Io::new(peripherals.IO_MUX); + let mut led = Output::new(peripherals.pins.gpio0, Level::High); let delay = Delay::new(); diff --git a/examples/src/bin/blinky_erased_pins.rs b/examples/src/bin/blinky_erased_pins.rs index 8fd590b5ee2..c3456bbbeb7 100644 --- a/examples/src/bin/blinky_erased_pins.rs +++ b/examples/src/bin/blinky_erased_pins.rs @@ -14,7 +14,7 @@ use esp_backtrace as _; use esp_hal::{ delay::Delay, - gpio::{Input, Io, Level, Output, Pin, Pull}, + gpio::{Input, Level, Output, Pin, Pull}, prelude::*, }; @@ -22,8 +22,6 @@ use esp_hal::{ fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - // Set LED GPIOs as an output: let led1 = Output::new(peripherals.pins.gpio2.degrade(), Level::Low); let led2 = Output::new(peripherals.pins.gpio4.degrade(), Level::Low); diff --git a/examples/src/bin/dac.rs b/examples/src/bin/dac.rs index 8d2c1528846..903e8f6f30e 100644 --- a/examples/src/bin/dac.rs +++ b/examples/src/bin/dac.rs @@ -19,14 +19,12 @@ #![no_main] use esp_backtrace as _; -use esp_hal::{analog::dac::Dac, delay::Delay, gpio::Io, prelude::*}; +use esp_hal::{analog::dac::Dac, delay::Delay, prelude::*}; #[entry] fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { let dac1_pin = peripherals.pins.gpio25; diff --git a/examples/src/bin/embassy_i2c.rs b/examples/src/bin/embassy_i2c.rs index 344d1502bc9..6e1397fc20b 100644 --- a/examples/src/bin/embassy_i2c.rs +++ b/examples/src/bin/embassy_i2c.rs @@ -20,7 +20,6 @@ use embassy_executor::Spawner; use embassy_time::{Duration, Timer}; use esp_backtrace as _; use esp_hal::{ - gpio::Io, i2c::master::{Config, I2c}, prelude::*, timer::timg::TimerGroup, diff --git a/examples/src/bin/embassy_i2c_bmp180_calibration_data.rs b/examples/src/bin/embassy_i2c_bmp180_calibration_data.rs index fa08cdfa78a..d3c9ddfc5ba 100644 --- a/examples/src/bin/embassy_i2c_bmp180_calibration_data.rs +++ b/examples/src/bin/embassy_i2c_bmp180_calibration_data.rs @@ -21,7 +21,6 @@ use embassy_executor::Spawner; use embassy_time::{Duration, Timer}; use esp_backtrace as _; use esp_hal::{ - gpio::Io, i2c::master::{Config, I2c}, prelude::*, timer::timg::TimerGroup, diff --git a/examples/src/bin/embassy_i2s_parallel.rs b/examples/src/bin/embassy_i2s_parallel.rs index fa76ac9f766..f88b69c1d8b 100644 --- a/examples/src/bin/embassy_i2s_parallel.rs +++ b/examples/src/bin/embassy_i2s_parallel.rs @@ -20,7 +20,6 @@ use esp_backtrace as _; use esp_hal::{ dma::{Dma, DmaPriority, DmaTxBuf}, dma_buffers, - gpio::Io, i2s::parallel::{I2sParallel, TxEightBits}, prelude::*, timer::timg::TimerGroup, @@ -35,7 +34,6 @@ async fn main(_spawner: Spawner) { info!("Starting!"); let peripherals = esp_hal::init(esp_hal::Config::default()); let dma = Dma::new(peripherals.DMA); - let io = Io::new(peripherals.IO_MUX); let timg0 = TimerGroup::new(peripherals.TIMG0); diff --git a/examples/src/bin/embassy_i2s_read.rs b/examples/src/bin/embassy_i2s_read.rs index ba881eb47ab..ae6a8e79233 100644 --- a/examples/src/bin/embassy_i2s_read.rs +++ b/examples/src/bin/embassy_i2s_read.rs @@ -22,7 +22,6 @@ use esp_backtrace as _; use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, - gpio::Io, i2s::master::{DataFormat, I2s, Standard}, prelude::*, timer::timg::TimerGroup, @@ -37,8 +36,6 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); - let io = Io::new(peripherals.IO_MUX); - let dma = Dma::new(peripherals.DMA); #[cfg(any(feature = "esp32", feature = "esp32s2"))] let dma_channel = dma.i2s0channel; diff --git a/examples/src/bin/embassy_i2s_sound.rs b/examples/src/bin/embassy_i2s_sound.rs index 613f5a57e27..4298c8b1ea9 100644 --- a/examples/src/bin/embassy_i2s_sound.rs +++ b/examples/src/bin/embassy_i2s_sound.rs @@ -36,7 +36,6 @@ use esp_backtrace as _; use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, - gpio::Io, i2s::master::{DataFormat, I2s, Standard}, prelude::*, timer::timg::TimerGroup, @@ -59,8 +58,6 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); - let io = Io::new(peripherals.IO_MUX); - let dma = Dma::new(peripherals.DMA); #[cfg(any(feature = "esp32", feature = "esp32s2"))] let dma_channel = dma.i2s0channel; diff --git a/examples/src/bin/embassy_multicore.rs b/examples/src/bin/embassy_multicore.rs index 96aad8a1cbc..0dddeed44ca 100644 --- a/examples/src/bin/embassy_multicore.rs +++ b/examples/src/bin/embassy_multicore.rs @@ -21,7 +21,7 @@ use esp_backtrace as _; use esp_hal::{ cpu_control::{CpuControl, Stack}, get_core, - gpio::{Io, Level, Output}, + gpio::{Level, Output}, timer::{timg::TimerGroup, AnyTimer}, }; use esp_hal_embassy::Executor; @@ -53,8 +53,6 @@ async fn control_led( async fn main(_spawner: Spawner) { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let timg0 = TimerGroup::new(peripherals.TIMG0); let timer0: AnyTimer = timg0.timer0.into(); let timer1: AnyTimer = timg0.timer1.into(); diff --git a/examples/src/bin/embassy_multicore_interrupt.rs b/examples/src/bin/embassy_multicore_interrupt.rs index f60056b9121..f87fb08fd7b 100644 --- a/examples/src/bin/embassy_multicore_interrupt.rs +++ b/examples/src/bin/embassy_multicore_interrupt.rs @@ -20,7 +20,7 @@ use esp_backtrace as _; use esp_hal::{ cpu_control::{CpuControl, Stack}, get_core, - gpio::{Io, Level, Output}, + gpio::{Level, Output}, interrupt::{software::SoftwareInterruptControl, Priority}, prelude::*, timer::{timg::TimerGroup, AnyTimer}, @@ -75,8 +75,6 @@ fn main() -> ! { let sw_ints = SoftwareInterruptControl::new(peripherals.SW_INTERRUPT); - let io = Io::new(peripherals.IO_MUX); - let timg0 = TimerGroup::new(peripherals.TIMG0); let timer0: AnyTimer = timg0.timer0.into(); let timer1: AnyTimer = timg0.timer1.into(); diff --git a/examples/src/bin/embassy_parl_io_rx.rs b/examples/src/bin/embassy_parl_io_rx.rs index 5fb4c89833e..aa896ad2d49 100644 --- a/examples/src/bin/embassy_parl_io_rx.rs +++ b/examples/src/bin/embassy_parl_io_rx.rs @@ -16,7 +16,6 @@ use esp_backtrace as _; use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, - gpio::Io, parl_io::{no_clk_pin, BitPackOrder, ParlIoRxOnly, RxFourBits}, prelude::*, timer::systimer::{SystemTimer, Target}, @@ -31,14 +30,17 @@ async fn main(_spawner: Spawner) { let systimer = SystemTimer::new(peripherals.SYSTIMER).split::(); esp_hal_embassy::init(systimer.alarm0); - let io = Io::new(peripherals.IO_MUX); - let (rx_buffer, rx_descriptors, _, _) = dma_buffers!(32000, 0); let dma = Dma::new(peripherals.DMA); let dma_channel = dma.channel0; - let mut rx_pins = RxFourBits::new(peripherals.pins.gpio1, peripherals.pins.gpio2, peripherals.pins.gpio3, peripherals.pins.gpio4); + let mut rx_pins = RxFourBits::new( + peripherals.pins.gpio1, + peripherals.pins.gpio2, + peripherals.pins.gpio3, + peripherals.pins.gpio4, + ); let parl_io = ParlIoRxOnly::new( peripherals.PARL_IO, diff --git a/examples/src/bin/embassy_parl_io_tx.rs b/examples/src/bin/embassy_parl_io_tx.rs index a4b0a884faf..d538af55ec0 100644 --- a/examples/src/bin/embassy_parl_io_tx.rs +++ b/examples/src/bin/embassy_parl_io_tx.rs @@ -20,7 +20,6 @@ use esp_backtrace as _; use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, - gpio::Io, parl_io::{ BitPackOrder, ClkOutPin, @@ -42,14 +41,17 @@ async fn main(_spawner: Spawner) { let systimer = SystemTimer::new(peripherals.SYSTIMER).split::(); esp_hal_embassy::init(systimer.alarm0); - let io = Io::new(peripherals.IO_MUX); - let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(0, 32000); let dma = Dma::new(peripherals.DMA); let dma_channel = dma.channel0; - let tx_pins = TxFourBits::new(peripherals.pins.gpio1, peripherals.pins.gpio2, peripherals.pins.gpio3, peripherals.pins.gpio4); + let tx_pins = TxFourBits::new( + peripherals.pins.gpio1, + peripherals.pins.gpio2, + peripherals.pins.gpio3, + peripherals.pins.gpio4, + ); let mut pin_conf = TxPinConfigWithValidPin::new(tx_pins, peripherals.pins.gpio5); diff --git a/examples/src/bin/embassy_rmt_rx.rs b/examples/src/bin/embassy_rmt_rx.rs index 75be15a7462..d42f73d047a 100644 --- a/examples/src/bin/embassy_rmt_rx.rs +++ b/examples/src/bin/embassy_rmt_rx.rs @@ -13,7 +13,7 @@ use embassy_executor::Spawner; use embassy_time::{Duration, Timer}; use esp_backtrace as _; use esp_hal::{ - gpio::{Io, Level, Output}, + gpio::{Level, Output}, prelude::*, rmt::{PulseCode, Rmt, RxChannelAsync, RxChannelConfig, RxChannelCreatorAsync}, timer::timg::TimerGroup, @@ -44,8 +44,6 @@ async fn main(spawner: Spawner) { let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); - let io = Io::new(peripherals.IO_MUX); - cfg_if::cfg_if! { if #[cfg(feature = "esp32h2")] { let freq = 32.MHz(); diff --git a/examples/src/bin/embassy_rmt_tx.rs b/examples/src/bin/embassy_rmt_tx.rs index 7a5406d6d3a..9d1000494ab 100644 --- a/examples/src/bin/embassy_rmt_tx.rs +++ b/examples/src/bin/embassy_rmt_tx.rs @@ -15,7 +15,6 @@ use embassy_executor::Spawner; use embassy_time::{Duration, Timer}; use esp_backtrace as _; use esp_hal::{ - gpio::Io, prelude::*, rmt::{PulseCode, Rmt, TxChannelAsync, TxChannelConfig, TxChannelCreatorAsync}, timer::timg::TimerGroup, @@ -30,8 +29,6 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); - let io = Io::new(peripherals.IO_MUX); - cfg_if::cfg_if! { if #[cfg(feature = "esp32h2")] { let freq = 32.MHz(); diff --git a/examples/src/bin/embassy_serial.rs b/examples/src/bin/embassy_serial.rs index 991b6b34a17..a89ddef1372 100644 --- a/examples/src/bin/embassy_serial.rs +++ b/examples/src/bin/embassy_serial.rs @@ -13,7 +13,6 @@ use embassy_executor::Spawner; use embassy_sync::{blocking_mutex::raw::NoopRawMutex, signal::Signal}; use esp_backtrace as _; use esp_hal::{ - gpio::Io, timer::timg::TimerGroup, uart::{AtCmdConfig, Config, Uart, UartRx, UartTx}, Async, @@ -71,8 +70,6 @@ async fn main(spawner: Spawner) { let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); - let io = Io::new(peripherals.IO_MUX); - // Default pins for Uart/Serial communication cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { diff --git a/examples/src/bin/embassy_spi.rs b/examples/src/bin/embassy_spi.rs index 1370a5de6d8..fd2a7e6de7e 100644 --- a/examples/src/bin/embassy_spi.rs +++ b/examples/src/bin/embassy_spi.rs @@ -24,7 +24,6 @@ use esp_backtrace as _; use esp_hal::{ dma::*, dma_buffers, - gpio::Io, prelude::*, spi::{ master::{Config, Spi}, @@ -41,7 +40,6 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); - let io = Io::new(peripherals.IO_MUX); let sclk = peripherals.pins.gpio0; let miso = peripherals.pins.gpio2; let mosi = peripherals.pins.gpio4; diff --git a/examples/src/bin/embassy_touch.rs b/examples/src/bin/embassy_touch.rs index 464683197c1..643f6684e00 100644 --- a/examples/src/bin/embassy_touch.rs +++ b/examples/src/bin/embassy_touch.rs @@ -17,7 +17,6 @@ use embassy_futures::select::{select, Either}; use embassy_time::{Duration, Timer}; use esp_backtrace as _; use esp_hal::{ - gpio::Io, rtc_cntl::Rtc, timer::timg::TimerGroup, touch::{Touch, TouchConfig, TouchPad}, @@ -32,7 +31,6 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); - let io = Io::new(peripherals.IO_MUX); let mut rtc = Rtc::new(peripherals.LPWR); let touch_pin0 = peripherals.pins.gpio2; diff --git a/examples/src/bin/embassy_twai.rs b/examples/src/bin/embassy_twai.rs index 8debbb58aa6..ad672cc2d48 100644 --- a/examples/src/bin/embassy_twai.rs +++ b/examples/src/bin/embassy_twai.rs @@ -35,7 +35,6 @@ use embassy_sync::{blocking_mutex::raw::NoopRawMutex, channel::Channel}; use embedded_can::{Frame, Id}; use esp_backtrace as _; use esp_hal::{ - gpio::Io, timer::timg::TimerGroup, twai::{self, EspTwaiFrame, StandardId, TwaiMode, TwaiRx, TwaiTx}, }; @@ -92,8 +91,6 @@ async fn main(spawner: Spawner) { let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); - let io = Io::new(peripherals.IO_MUX); - // Without an external transceiver, we only need a single line between the two MCUs. let (rx_pin, tx_pin) = peripherals.pins.gpio2.split(); // Use these if you want to use an external transceiver: diff --git a/examples/src/bin/embassy_usb_serial.rs b/examples/src/bin/embassy_usb_serial.rs index f021be5230e..65601da8b9c 100644 --- a/examples/src/bin/embassy_usb_serial.rs +++ b/examples/src/bin/embassy_usb_serial.rs @@ -21,7 +21,6 @@ use embassy_usb::{ }; use esp_backtrace as _; use esp_hal::{ - gpio::Io, otg_fs::{ asynch::{Config, Driver}, Usb, @@ -37,9 +36,11 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); - let io = Io::new(peripherals.IO_MUX); - - let usb = Usb::new(peripherals.USB0, peripherals.pins.gpio20, peripherals.pins.gpio19); + let usb = Usb::new( + peripherals.USB0, + peripherals.pins.gpio20, + peripherals.pins.gpio19, + ); // Create the driver, from the HAL. let mut ep_out_buffer = [0u8; 1024]; diff --git a/examples/src/bin/embassy_wait.rs b/examples/src/bin/embassy_wait.rs index ce236d9098e..fa9a67dccde 100644 --- a/examples/src/bin/embassy_wait.rs +++ b/examples/src/bin/embassy_wait.rs @@ -12,7 +12,7 @@ use embassy_executor::Spawner; use embassy_time::{Duration, Timer}; use esp_backtrace as _; use esp_hal::{ - gpio::{Input, Io, Pull}, + gpio::{Input, Pull}, timer::timg::TimerGroup, }; @@ -24,8 +24,6 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); - let io = Io::new(peripherals.IO_MUX); - cfg_if::cfg_if! { if #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] { let mut input = Input::new(peripherals.pins.gpio0, Pull::Down); diff --git a/examples/src/bin/etm_blinky_systimer.rs b/examples/src/bin/etm_blinky_systimer.rs index da8fb0785c0..35a30566522 100644 --- a/examples/src/bin/etm_blinky_systimer.rs +++ b/examples/src/bin/etm_blinky_systimer.rs @@ -13,7 +13,6 @@ use esp_hal::{ etm::Etm, gpio::{ etm::{Channels, OutputConfig}, - Io, Level, Pull, }, @@ -31,7 +30,6 @@ fn main() -> ! { let mut alarm0 = syst_alarms.alarm0; alarm0.set_period(1u32.secs()); - let io = Io::new(peripherals.IO_MUX); let mut led = peripherals.pins.gpio1; // setup ETM diff --git a/examples/src/bin/etm_gpio.rs b/examples/src/bin/etm_gpio.rs index 8ee061d0b6e..cf5d5a9d2e0 100644 --- a/examples/src/bin/etm_gpio.rs +++ b/examples/src/bin/etm_gpio.rs @@ -13,7 +13,6 @@ use esp_hal::{ etm::Etm, gpio::{ etm::{Channels, InputConfig, OutputConfig}, - Io, Level, Output, Pull, @@ -25,8 +24,6 @@ use esp_hal::{ fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let mut led = Output::new(peripherals.pins.gpio1, Level::Low); let button = peripherals.pins.gpio9; diff --git a/examples/src/bin/hello_world.rs b/examples/src/bin/hello_world.rs index 2ef151bae26..4e97c5d5353 100644 --- a/examples/src/bin/hello_world.rs +++ b/examples/src/bin/hello_world.rs @@ -15,7 +15,7 @@ use core::fmt::Write; use esp_backtrace as _; -use esp_hal::{delay::Delay, gpio::Io, prelude::*, uart::Uart}; +use esp_hal::{delay::Delay, prelude::*, uart::Uart}; #[entry] fn main() -> ! { @@ -23,8 +23,6 @@ fn main() -> ! { let delay = Delay::new(); - let io = Io::new(peripherals.IO_MUX); - // Default pins for Uart/Serial communication cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { diff --git a/examples/src/bin/i2s_parallel.rs b/examples/src/bin/i2s_parallel.rs index f059df6ceb1..fcfe88e9135 100644 --- a/examples/src/bin/i2s_parallel.rs +++ b/examples/src/bin/i2s_parallel.rs @@ -18,7 +18,6 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority, DmaTxBuf}, dma_buffers, - gpio::Io, i2s::parallel::{I2sParallel, TxEightBits}, prelude::*, }; @@ -32,7 +31,6 @@ fn main() -> ! { info!("Starting!"); let peripherals = esp_hal::init(esp_hal::Config::default()); let dma = Dma::new(peripherals.DMA); - let io = Io::new(peripherals.IO_MUX); let delay = Delay::new(); diff --git a/examples/src/bin/i2s_read.rs b/examples/src/bin/i2s_read.rs index e139dd5f691..e9f1e3c7bdb 100644 --- a/examples/src/bin/i2s_read.rs +++ b/examples/src/bin/i2s_read.rs @@ -20,7 +20,6 @@ use esp_backtrace as _; use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, - gpio::Io, i2s::master::{DataFormat, I2s, Standard}, prelude::*, }; @@ -30,8 +29,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let dma = Dma::new(peripherals.DMA); #[cfg(any(feature = "esp32", feature = "esp32s2"))] let dma_channel = dma.i2s0channel; diff --git a/examples/src/bin/i2s_sound.rs b/examples/src/bin/i2s_sound.rs index f38ebdd8dae..3d763490a04 100644 --- a/examples/src/bin/i2s_sound.rs +++ b/examples/src/bin/i2s_sound.rs @@ -34,7 +34,6 @@ use esp_backtrace as _; use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, - gpio::Io, i2s::master::{DataFormat, I2s, Standard}, prelude::*, }; @@ -51,8 +50,6 @@ const SINE: [i16; 64] = [ fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let dma = Dma::new(peripherals.DMA); #[cfg(any(feature = "esp32", feature = "esp32s2"))] let dma_channel = dma.i2s0channel; diff --git a/examples/src/bin/ieee802154_sniffer.rs b/examples/src/bin/ieee802154_sniffer.rs index b9deeb311fc..7e9663d2624 100644 --- a/examples/src/bin/ieee802154_sniffer.rs +++ b/examples/src/bin/ieee802154_sniffer.rs @@ -8,7 +8,7 @@ #![no_main] use esp_backtrace as _; -use esp_hal::{gpio::Io, prelude::*, reset::software_reset, uart::Uart}; +use esp_hal::{prelude::*, reset::software_reset, uart::Uart}; use esp_ieee802154::{Config, Ieee802154}; use esp_println::println; @@ -16,8 +16,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - // Default pins for Uart/Serial communication cfg_if::cfg_if! { if #[cfg(feature = "esp32c6")] { diff --git a/examples/src/bin/lcd_cam_ov2640.rs b/examples/src/bin/lcd_cam_ov2640.rs index 3a7f70486ad..705ae915184 100644 --- a/examples/src/bin/lcd_cam_ov2640.rs +++ b/examples/src/bin/lcd_cam_ov2640.rs @@ -28,7 +28,6 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority}, dma_rx_stream_buffer, - gpio::Io, i2c::{ self, master::{Config, I2c}, @@ -46,8 +45,6 @@ use esp_println::{print, println}; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let dma = Dma::new(peripherals.DMA); let channel = dma.channel0; diff --git a/examples/src/bin/lcd_i8080.rs b/examples/src/bin/lcd_i8080.rs index 17fb9603289..9c2c9c96921 100644 --- a/examples/src/bin/lcd_i8080.rs +++ b/examples/src/bin/lcd_i8080.rs @@ -27,7 +27,7 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority, DmaTxBuf}, dma_tx_buffer, - gpio::{Input, Io, Level, Output, Pull}, + gpio::{Input, Level, Output, Pull}, lcd_cam::{ lcd::i8080::{Config, TxEightBits, I8080}, LcdCam, @@ -41,8 +41,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let lcd_backlight = peripherals.pins.gpio45; let lcd_reset = peripherals.pins.gpio4; let lcd_rs = peripherals.pins.gpio0; // Command/Data selection diff --git a/examples/src/bin/ledc.rs b/examples/src/bin/ledc.rs index 0cdd354b936..396065fb5ac 100644 --- a/examples/src/bin/ledc.rs +++ b/examples/src/bin/ledc.rs @@ -11,7 +11,6 @@ use esp_backtrace as _; use esp_hal::{ - gpio::Io, ledc::{ channel::{self, ChannelIFace}, timer::{self, TimerIFace}, @@ -26,7 +25,6 @@ use esp_hal::{ fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let led = peripherals.pins.gpio0; let mut ledc = Ledc::new(peripherals.LEDC); diff --git a/examples/src/bin/lp_core_basic.rs b/examples/src/bin/lp_core_basic.rs index ae41125e62b..56925e18adf 100644 --- a/examples/src/bin/lp_core_basic.rs +++ b/examples/src/bin/lp_core_basic.rs @@ -15,7 +15,7 @@ use esp_backtrace as _; use esp_hal::{ - gpio::{lp_io::LowPowerOutput, Io}, + gpio::lp_io::LowPowerOutput, lp_core::{LpCore, LpCoreWakeupSource}, prelude::*, }; @@ -26,7 +26,7 @@ fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); // configure GPIO 1 as LP output pin - let io = Io::new(peripherals.IO_MUX); + let lp_pin = LowPowerOutput::new(peripherals.pins.gpio1); let mut lp_core = LpCore::new(peripherals.LP_CORE); diff --git a/examples/src/bin/lp_core_i2c.rs b/examples/src/bin/lp_core_i2c.rs index 1afb387774a..303b13a4499 100644 --- a/examples/src/bin/lp_core_i2c.rs +++ b/examples/src/bin/lp_core_i2c.rs @@ -16,7 +16,7 @@ use esp_backtrace as _; use esp_hal::{ - gpio::{lp_io::LowPowerOutputOpenDrain, Io}, + gpio::lp_io::LowPowerOutputOpenDrain, i2c::lp_i2c::LpI2c, lp_core::{LpCore, LpCoreWakeupSource}, prelude::*, @@ -27,8 +27,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let lp_sda = LowPowerOutputOpenDrain::new(peripherals.pins.gpio6); let lp_scl = LowPowerOutputOpenDrain::new(peripherals.pins.gpio7); diff --git a/examples/src/bin/lp_core_uart.rs b/examples/src/bin/lp_core_uart.rs index 1c0c616d038..b3cbc7df67c 100644 --- a/examples/src/bin/lp_core_uart.rs +++ b/examples/src/bin/lp_core_uart.rs @@ -16,10 +16,7 @@ use esp_backtrace as _; use esp_hal::{ - gpio::{ - lp_io::{LowPowerInput, LowPowerOutput}, - Io, - }, + gpio::lp_io::{LowPowerInput, LowPowerOutput}, lp_core::{LpCore, LpCoreWakeupSource}, prelude::*, uart::{lp_uart::LpUart, Config, Uart}, @@ -30,8 +27,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - // Set up (HP) UART1: let mut uart1 = Uart::new_with_config( diff --git a/examples/src/bin/mcpwm.rs b/examples/src/bin/mcpwm.rs index c28905ad172..98d42bdeb99 100644 --- a/examples/src/bin/mcpwm.rs +++ b/examples/src/bin/mcpwm.rs @@ -11,7 +11,6 @@ use esp_backtrace as _; use esp_hal::{ - gpio::Io, mcpwm::{operator::PwmPinConfig, timer::PwmWorkingMode, McPwm, PeripheralClockConfig}, prelude::*, }; @@ -20,7 +19,6 @@ use esp_hal::{ fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let pin = peripherals.pins.gpio0; // initialize peripheral diff --git a/examples/src/bin/parl_io_rx.rs b/examples/src/bin/parl_io_rx.rs index 2a97ecaf9c2..22937190c2c 100644 --- a/examples/src/bin/parl_io_rx.rs +++ b/examples/src/bin/parl_io_rx.rs @@ -14,7 +14,6 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority}, dma_buffers, - gpio::Io, parl_io::{no_clk_pin, BitPackOrder, ParlIoRxOnly, RxFourBits}, prelude::*, }; @@ -24,8 +23,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (rx_buffer, rx_descriptors, _, _) = dma_buffers!(32000, 0); let dma = Dma::new(peripherals.DMA); diff --git a/examples/src/bin/parl_io_tx.rs b/examples/src/bin/parl_io_tx.rs index 894c5146294..97184a339fd 100644 --- a/examples/src/bin/parl_io_tx.rs +++ b/examples/src/bin/parl_io_tx.rs @@ -18,7 +18,6 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority}, dma_buffers, - gpio::Io, parl_io::{ BitPackOrder, ClkOutPin, @@ -35,8 +34,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(0, 32000); let dma = Dma::new(peripherals.DMA); diff --git a/examples/src/bin/pcnt_encoder.rs b/examples/src/bin/pcnt_encoder.rs index 58733e5b93c..4c5ee1cf0ee 100644 --- a/examples/src/bin/pcnt_encoder.rs +++ b/examples/src/bin/pcnt_encoder.rs @@ -20,7 +20,7 @@ use core::{cell::RefCell, cmp::min, sync::atomic::Ordering}; use critical_section::Mutex; use esp_backtrace as _; use esp_hal::{ - gpio::{Input, Io, Pull}, + gpio::{Input, Pull}, interrupt::Priority, pcnt::{channel, unit, Pcnt}, prelude::*, @@ -35,8 +35,6 @@ static VALUE: AtomicI32 = AtomicI32::new(0); fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - // Set up a pulse counter: println!("setup pulse counter unit 0"); let mut pcnt = Pcnt::new(peripherals.PCNT); diff --git a/examples/src/bin/qspi_flash.rs b/examples/src/bin/qspi_flash.rs index 021642ad71f..e2bea23632c 100644 --- a/examples/src/bin/qspi_flash.rs +++ b/examples/src/bin/qspi_flash.rs @@ -32,7 +32,6 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority, DmaRxBuf, DmaTxBuf}, dma_buffers, - gpio::Io, prelude::*, spi::{ master::{Address, Command, Config, Spi}, @@ -46,7 +45,6 @@ use esp_println::{print, println}; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { let sclk = peripherals.pins.gpio0; diff --git a/examples/src/bin/rmt_rx.rs b/examples/src/bin/rmt_rx.rs index c3fa61ccb1a..1e35cea7ade 100644 --- a/examples/src/bin/rmt_rx.rs +++ b/examples/src/bin/rmt_rx.rs @@ -14,7 +14,7 @@ use esp_backtrace as _; use esp_hal::{ delay::Delay, - gpio::{Io, Level, Output}, + gpio::{Level, Output}, prelude::*, rmt::{PulseCode, Rmt, RxChannel, RxChannelConfig, RxChannelCreator}, }; @@ -26,7 +26,6 @@ const WIDTH: usize = 80; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let mut out = Output::new(peripherals.pins.gpio5, Level::Low); cfg_if::cfg_if! { diff --git a/examples/src/bin/rmt_tx.rs b/examples/src/bin/rmt_tx.rs index 58403846e69..c3ae58e996e 100644 --- a/examples/src/bin/rmt_tx.rs +++ b/examples/src/bin/rmt_tx.rs @@ -13,7 +13,6 @@ use esp_backtrace as _; use esp_hal::{ delay::Delay, - gpio::Io, prelude::*, rmt::{PulseCode, Rmt, TxChannel, TxChannelConfig, TxChannelCreator}, }; @@ -22,8 +21,6 @@ use esp_hal::{ fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - cfg_if::cfg_if! { if #[cfg(feature = "esp32h2")] { let freq = 32.MHz(); diff --git a/examples/src/bin/serial_interrupts.rs b/examples/src/bin/serial_interrupts.rs index 548fabe0bf5..a8dec11dcb7 100644 --- a/examples/src/bin/serial_interrupts.rs +++ b/examples/src/bin/serial_interrupts.rs @@ -13,7 +13,6 @@ use critical_section::Mutex; use esp_backtrace as _; use esp_hal::{ delay::Delay, - gpio::Io, prelude::*, uart::{AtCmdConfig, Config, Uart, UartInterrupt}, Blocking, @@ -27,8 +26,6 @@ fn main() -> ! { let delay = Delay::new(); - let io = Io::new(peripherals.IO_MUX); - // Default pins for Uart/Serial communication cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { diff --git a/examples/src/bin/sleep_timer_ext0.rs b/examples/src/bin/sleep_timer_ext0.rs index bf2ac3b0db3..77d0bfab3b2 100644 --- a/examples/src/bin/sleep_timer_ext0.rs +++ b/examples/src/bin/sleep_timer_ext0.rs @@ -14,7 +14,7 @@ use esp_backtrace as _; use esp_hal::{ delay::Delay, entry, - gpio::{Input, Io, Pull}, + gpio::{Input, Pull}, rtc_cntl::{ get_reset_reason, get_wakeup_cause, @@ -32,7 +32,6 @@ fn main() -> ! { let mut rtc = Rtc::new(peripherals.LPWR); - let io = Io::new(peripherals.IO_MUX); let ext0_pin = Input::new(peripherals.pins.gpio4, Pull::None); println!("up and runnning!"); diff --git a/examples/src/bin/sleep_timer_ext1.rs b/examples/src/bin/sleep_timer_ext1.rs index 1ae33fe6975..ba764fac968 100644 --- a/examples/src/bin/sleep_timer_ext1.rs +++ b/examples/src/bin/sleep_timer_ext1.rs @@ -14,7 +14,7 @@ use esp_backtrace as _; use esp_hal::{ delay::Delay, entry, - gpio::{Input, Io, Pull, RtcPin}, + gpio::{Input, Pull, RtcPin}, peripheral::Peripheral, rtc_cntl::{ get_reset_reason, @@ -33,7 +33,6 @@ fn main() -> ! { let mut rtc = Rtc::new(peripherals.LPWR); - let io = Io::new(peripherals.IO_MUX); let pin_0 = Input::new(peripherals.pins.gpio4, Pull::None); let mut pin_2 = peripherals.pins.gpio2; diff --git a/examples/src/bin/sleep_timer_lpio.rs b/examples/src/bin/sleep_timer_lpio.rs index 950ab8436fc..cc449228a35 100644 --- a/examples/src/bin/sleep_timer_lpio.rs +++ b/examples/src/bin/sleep_timer_lpio.rs @@ -15,7 +15,7 @@ use esp_backtrace as _; use esp_hal::{ delay::Delay, entry, - gpio::{Input, Io, Pull, RtcPinWithResistors}, + gpio::{Input, Pull, RtcPinWithResistors}, peripheral::Peripheral, rtc_cntl::{ get_reset_reason, @@ -34,7 +34,6 @@ fn main() -> ! { let mut rtc = Rtc::new(peripherals.LPWR); - let io = Io::new(peripherals.IO_MUX); let pin2 = Input::new(peripherals.pins.gpio2, Pull::None); let mut pin3 = peripherals.pins.gpio3; diff --git a/examples/src/bin/sleep_timer_rtcio.rs b/examples/src/bin/sleep_timer_rtcio.rs index e3c4a19b74b..c87f22eba86 100644 --- a/examples/src/bin/sleep_timer_rtcio.rs +++ b/examples/src/bin/sleep_timer_rtcio.rs @@ -19,7 +19,7 @@ use esp_hal::{ delay::Delay, entry, gpio, - gpio::{Input, Io, Pull}, + gpio::{Input, Pull}, peripheral::Peripheral, rtc_cntl::{ get_reset_reason, @@ -36,7 +36,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let mut rtc = Rtc::new(peripherals.LPWR); println!("up and runnning!"); diff --git a/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs b/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs index 4c446af19b4..5ee15877be3 100644 --- a/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs +++ b/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs @@ -30,7 +30,6 @@ use esp_backtrace as _; use esp_hal::{ delay::Delay, - gpio::Io, prelude::*, spi::{ master::{Address, Command, Config, Spi}, @@ -44,7 +43,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { let sclk = peripherals.pins.gpio0; diff --git a/examples/src/bin/spi_loopback.rs b/examples/src/bin/spi_loopback.rs index 8b0e48ecce9..577b1a821c0 100644 --- a/examples/src/bin/spi_loopback.rs +++ b/examples/src/bin/spi_loopback.rs @@ -18,7 +18,6 @@ use esp_backtrace as _; use esp_hal::{ delay::Delay, - gpio::Io, peripheral::Peripheral, prelude::*, spi::{ @@ -32,7 +31,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let sclk = peripherals.pins.gpio0; let miso_mosi = peripherals.pins.gpio2; let cs = peripherals.pins.gpio5; diff --git a/examples/src/bin/spi_loopback_dma.rs b/examples/src/bin/spi_loopback_dma.rs index 6ae4b8ecb35..8dcb339078a 100644 --- a/examples/src/bin/spi_loopback_dma.rs +++ b/examples/src/bin/spi_loopback_dma.rs @@ -23,7 +23,6 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority, DmaRxBuf, DmaTxBuf}, dma_buffers, - gpio::Io, prelude::*, spi::{ master::{Config, Spi}, @@ -36,7 +35,6 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let sclk = peripherals.pins.gpio0; let miso = peripherals.pins.gpio2; let mosi = peripherals.pins.gpio4; diff --git a/examples/src/bin/spi_loopback_dma_psram.rs b/examples/src/bin/spi_loopback_dma_psram.rs index dcdadca8ef1..10c077b9420 100644 --- a/examples/src/bin/spi_loopback_dma_psram.rs +++ b/examples/src/bin/spi_loopback_dma_psram.rs @@ -26,7 +26,6 @@ use esp_backtrace as _; use esp_hal::{ delay::Delay, dma::{Dma, DmaBufBlkSize, DmaPriority, DmaRxBuf, DmaTxBuf}, - gpio::Io, peripheral::Peripheral, prelude::*, spi::{ @@ -63,7 +62,6 @@ fn main() -> ! { esp_alloc::psram_allocator!(peripherals.PSRAM, esp_hal::psram); let delay = Delay::new(); - let io = Io::new(peripherals.IO_MUX); let sclk = peripherals.pins.gpio42; let mosi = peripherals.pins.gpio48; let miso = unsafe { mosi.clone_unchecked() }; diff --git a/examples/src/bin/spi_slave_dma.rs b/examples/src/bin/spi_slave_dma.rs index 44b2d4871fd..29c64356373 100644 --- a/examples/src/bin/spi_slave_dma.rs +++ b/examples/src/bin/spi_slave_dma.rs @@ -34,7 +34,7 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority}, dma_buffers, - gpio::{Input, Io, Level, Output, Pull}, + gpio::{Input, Level, Output, Pull}, prelude::*, spi::{slave::Spi, SpiMode}, }; @@ -44,17 +44,15 @@ use esp_println::println; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); + let mut master_sclk = Output::new(peripherals.pins.gpio4, Level::Low); + let master_miso = Input::new(peripherals.pins.gpio5, Pull::None); + let mut master_mosi = Output::new(peripherals.pins.gpio8, Level::Low); + let mut master_cs = Output::new(peripherals.pins.gpio9, Level::High); - let mut master_sclk = Output::new(io.pins.gpio4, Level::Low); - let master_miso = Input::new(io.pins.gpio5, Pull::None); - let mut master_mosi = Output::new(io.pins.gpio8, Level::Low); - let mut master_cs = Output::new(io.pins.gpio9, Level::High); - - let slave_sclk = io.pins.gpio0; - let slave_miso = io.pins.gpio1; - let slave_mosi = io.pins.gpio2; - let slave_cs = io.pins.gpio3; + let slave_sclk = peripherals.pins.gpio0; + let slave_miso = peripherals.pins.gpio1; + let slave_mosi = peripherals.pins.gpio2; + let slave_cs = peripherals.pins.gpio3; let dma = Dma::new(peripherals.DMA); cfg_if::cfg_if! { diff --git a/examples/src/bin/touch.rs b/examples/src/bin/touch.rs index 5a15fb83f4b..d82a794df70 100644 --- a/examples/src/bin/touch.rs +++ b/examples/src/bin/touch.rs @@ -17,7 +17,7 @@ use critical_section::Mutex; use esp_backtrace as _; use esp_hal::{ delay::Delay, - gpio::{GpioPin, Io}, + gpio::GpioPin, macros::ram, prelude::*, rtc_cntl::Rtc, @@ -49,8 +49,6 @@ fn main() -> ! { esp_println::logger::init_logger_from_env(); let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let mut rtc = Rtc::new(peripherals.LPWR); rtc.set_interrupt_handler(interrupt_handler); diff --git a/examples/src/bin/twai.rs b/examples/src/bin/twai.rs index 9327cb99625..063d6c1d7bb 100644 --- a/examples/src/bin/twai.rs +++ b/examples/src/bin/twai.rs @@ -29,7 +29,6 @@ const IS_FIRST_SENDER: bool = true; use esp_backtrace as _; use esp_hal::{ delay::Delay, - gpio::Io, prelude::*, twai::{self, filter::SingleStandardFilter, EspTwaiFrame, StandardId, TwaiMode}, }; @@ -40,8 +39,6 @@ use nb::block; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - // Without an external transceiver, we only need a single line between the two MCUs. let (rx_pin, tx_pin) = peripherals.pins.gpio2.split(); // Use these if you want to use an external transceiver: diff --git a/examples/src/bin/ulp_riscv_core_basic.rs b/examples/src/bin/ulp_riscv_core_basic.rs index 4a3da26e0fd..98087c84d54 100644 --- a/examples/src/bin/ulp_riscv_core_basic.rs +++ b/examples/src/bin/ulp_riscv_core_basic.rs @@ -12,18 +12,13 @@ #![no_main] use esp_backtrace as _; -use esp_hal::{ - gpio::{rtc_io::*, Io}, - prelude::*, - ulp_core, -}; +use esp_hal::{gpio::rtc_io::*, prelude::*, ulp_core}; use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let pin = LowPowerOutput::new(peripherals.pins.gpio1); let mut ulp_core = ulp_core::UlpCore::new(peripherals.ULP_RISCV_CORE); diff --git a/examples/src/bin/usb_serial.rs b/examples/src/bin/usb_serial.rs index 1ef65bcb7dc..8f29eaa71ca 100644 --- a/examples/src/bin/usb_serial.rs +++ b/examples/src/bin/usb_serial.rs @@ -15,7 +15,6 @@ use core::ptr::addr_of_mut; use esp_backtrace as _; use esp_hal::{ - gpio::Io, otg_fs::{Usb, UsbBus}, prelude::*, }; @@ -28,8 +27,6 @@ static mut EP_MEMORY: [u32; 1024] = [0; 1024]; fn main() -> ! { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let usb = Usb::new( peripherals.USB0, peripherals.pins.gpio20, diff --git a/examples/src/bin/wifi_ble.rs b/examples/src/bin/wifi_ble.rs index 8509113934b..4927f6d0fde 100644 --- a/examples/src/bin/wifi_ble.rs +++ b/examples/src/bin/wifi_ble.rs @@ -25,7 +25,7 @@ use bleps::{ use esp_alloc as _; use esp_backtrace as _; use esp_hal::{ - gpio::{Input, Io, Pull}, + gpio::{Input, Pull}, prelude::*, rng::Rng, time, @@ -54,8 +54,6 @@ fn main() -> ! { ) .unwrap(); - let io = Io::new(peripherals.IO_MUX); - cfg_if::cfg_if! { if #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] { let button = Input::new(peripherals.pins.gpio0, Pull::Down); diff --git a/examples/src/bin/wifi_embassy_ble.rs b/examples/src/bin/wifi_embassy_ble.rs index 823c63883d5..a303c2b7cc9 100644 --- a/examples/src/bin/wifi_embassy_ble.rs +++ b/examples/src/bin/wifi_embassy_ble.rs @@ -28,7 +28,7 @@ use embassy_executor::Spawner; use esp_alloc as _; use esp_backtrace as _; use esp_hal::{ - gpio::{Input, Io, Pull}, + gpio::{Input, Pull}, prelude::*, rng::Rng, time, @@ -70,7 +70,6 @@ async fn main(_spawner: Spawner) -> ! { .unwrap() ); - let io = Io::new(peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] { let button = Input::new(peripherals.pins.gpio0, Pull::Down); diff --git a/hil-test/tests/embassy_interrupt_spi_dma.rs b/hil-test/tests/embassy_interrupt_spi_dma.rs index d5394ff9ba5..46c91be1914 100644 --- a/hil-test/tests/embassy_interrupt_spi_dma.rs +++ b/hil-test/tests/embassy_interrupt_spi_dma.rs @@ -118,8 +118,7 @@ mod test { let dma_rx_buf = DmaRxBuf::new(rx_descriptors, rx_buffer).unwrap(); let dma_tx_buf = DmaTxBuf::new(tx_descriptors, tx_buffer).unwrap(); - let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); - let (_, mosi) = hil_test::common_test_pins!(io); + let (_, mosi) = hil_test::common_test_pins!(peripherals); let mut spi = Spi::new_with_config( peripherals.SPI2, diff --git a/hil-test/tests/gpio_custom_handler.rs b/hil-test/tests/gpio_custom_handler.rs index 334c9f53101..67f2d529870 100644 --- a/hil-test/tests/gpio_custom_handler.rs +++ b/hil-test/tests/gpio_custom_handler.rs @@ -66,9 +66,7 @@ mod tests { async fn default_handler_does_not_run_because_gpio_is_defined() { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); - - let (gpio1, gpio2) = hil_test::common_test_pins!(io); + let (gpio1, gpio2) = hil_test::common_test_pins!(peripherals); let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); @@ -83,10 +81,10 @@ mod tests { async fn default_handler_runs_because_handler_is_set() { let peripherals = esp_hal::init(esp_hal::Config::default()); - let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX); + let mut io = Io::new(peripherals.IO_MUX); io.set_interrupt_handler(interrupt_handler); - let (gpio1, gpio2) = hil_test::common_test_pins!(io); + let (gpio1, gpio2) = hil_test::common_test_pins!(peripherals); let timg0 = TimerGroup::new(peripherals.TIMG0); esp_hal_embassy::init(timg0.timer0); diff --git a/hil-test/tests/i2c.rs b/hil-test/tests/i2c.rs index 4281b70ff3f..9ea9f267c6b 100644 --- a/hil-test/tests/i2c.rs +++ b/hil-test/tests/i2c.rs @@ -6,7 +6,6 @@ #![no_main] use esp_hal::{ - gpio::Io, i2c::master::{Config, I2c, Operation}, Async, Blocking, @@ -33,7 +32,6 @@ mod tests { #[init] fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let (sda, scl) = hil_test::i2c_pins!(peripherals); diff --git a/hil-test/tests/i2s.rs b/hil-test/tests/i2s.rs index 54b0f91ef29..5fd85ca9e5f 100644 --- a/hil-test/tests/i2s.rs +++ b/hil-test/tests/i2s.rs @@ -14,7 +14,7 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority}, dma_buffers, - gpio::{Io, NoPin}, + gpio::{AnyPin, NoPin, Pin}, i2s::master::{DataFormat, I2s, I2sTx, Standard}, peripherals::I2S0, prelude::*, @@ -103,7 +103,7 @@ mod tests { use super::*; struct Context { - io: Io, + dout: AnyPin, dma_channel: DmaChannel0Creator, i2s: I2S0, } @@ -112,8 +112,6 @@ mod tests { fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let dma = Dma::new(peripherals.DMA); cfg_if::cfg_if! { @@ -124,8 +122,10 @@ mod tests { } } + let (_, dout) = hil_test::common_test_pins!(peripherals); + Context { - io, + dout: dout.degrade(), dma_channel, i2s: peripherals.I2S0, } @@ -149,9 +149,7 @@ mod tests { ) .into_async(); - let (_, dout) = hil_test::common_test_pins!(ctx.io); - - let (din, dout) = dout.split(); + let (din, dout) = ctx.dout.split(); let i2s_tx = i2s .i2s_tx @@ -203,9 +201,7 @@ mod tests { tx_descriptors, ); - let (_, dout) = hil_test::common_test_pins!(ctx.io); - - let (din, dout) = dout.split(); + let (din, dout) = ctx.dout.split(); let mut i2s_tx = i2s .i2s_tx @@ -314,13 +310,11 @@ mod tests { tx_descriptors, ); - let (_, dout) = hil_test::common_test_pins!(ctx.io); - let mut i2s_tx = i2s .i2s_tx .with_bclk(NoPin) .with_ws(NoPin) - .with_dout(dout) + .with_dout(ctx.dout) .build(); let mut tx_transfer = i2s_tx.write_dma_circular(tx_buffer).unwrap(); @@ -346,15 +340,11 @@ mod tests { tx_descriptors, ); - let (_, dout) = hil_test::common_test_pins!(ctx.io); - - let (din, dout) = dout.split(); - let mut i2s_rx = i2s .i2s_rx .with_bclk(NoPin) .with_ws(NoPin) - .with_din(din) + .with_din(ctx.dout) // not a typo .build(); let mut buffer = [0u8; 1024]; diff --git a/hil-test/tests/lcd_cam_i8080.rs b/hil-test/tests/lcd_cam_i8080.rs index 0f7b47f91bd..2c7d761ddbf 100644 --- a/hil-test/tests/lcd_cam_i8080.rs +++ b/hil-test/tests/lcd_cam_i8080.rs @@ -8,7 +8,7 @@ use esp_hal::{ dma::{Dma, DmaPriority, DmaTxBuf}, dma_buffers, - gpio::{Io, NoPin}, + gpio::{Io, NoPin, Pins}, lcd_cam::{ lcd::i8080::{Command, Config, TxEightBits, TxSixteenBits, I8080}, BitOrder, @@ -28,7 +28,7 @@ const DATA_SIZE: usize = 1024 * 10; struct Context<'d> { lcd_cam: LcdCam<'d, Blocking>, pcnt: Pcnt<'d>, - io: Io, + pins: Pins, dma: Dma<'d>, dma_buf: DmaTxBuf, } @@ -44,7 +44,7 @@ mod tests { let dma = Dma::new(peripherals.DMA); let lcd_cam = LcdCam::new(peripherals.LCD_CAM); let pcnt = Pcnt::new(peripherals.PCNT); - let io = Io::new(peripherals.IO_MUX); + let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(0, DATA_SIZE); let dma_buf = DmaTxBuf::new(tx_descriptors, tx_buffer).unwrap(); @@ -52,7 +52,7 @@ mod tests { lcd_cam, dma, pcnt, - io, + pins: peripherals.pins, dma_buf, } } @@ -102,11 +102,11 @@ mod tests { // issue with configuring pins as outputs after inputs have been sorted // out. See https://github.com/esp-rs/esp-hal/pull/2173#issue-2529323702 - let (unit_ctrl, cs_signal) = ctx.peripherals.pins.gpio8.split(); - let (unit0_input, unit0_signal) = ctx.peripherals.pins.gpio11.split(); - let (unit1_input, unit1_signal) = ctx.peripherals.pins.gpio12.split(); - let (unit2_input, unit2_signal) = ctx.peripherals.pins.gpio16.split(); - let (unit3_input, unit3_signal) = ctx.peripherals.pins.gpio17.split(); + let (unit_ctrl, cs_signal) = ctx.pins.gpio8.split(); + let (unit0_input, unit0_signal) = ctx.pins.gpio11.split(); + let (unit1_input, unit1_signal) = ctx.pins.gpio12.split(); + let (unit2_input, unit2_signal) = ctx.pins.gpio16.split(); + let (unit3_input, unit3_signal) = ctx.pins.gpio17.split(); let pcnt = ctx.pcnt; @@ -213,11 +213,11 @@ mod tests { // issue with configuring pins as outputs after inputs have been sorted // out. See https://github.com/esp-rs/esp-hal/pull/2173#issue-2529323702 - let (unit_ctrl, cs_signal) = ctx.peripherals.pins.gpio8.split(); - let (unit0_input, unit0_signal) = ctx.peripherals.pins.gpio11.split(); - let (unit1_input, unit1_signal) = ctx.peripherals.pins.gpio12.split(); - let (unit2_input, unit2_signal) = ctx.peripherals.pins.gpio16.split(); - let (unit3_input, unit3_signal) = ctx.peripherals.pins.gpio17.split(); + let (unit_ctrl, cs_signal) = ctx.pins.gpio8.split(); + let (unit0_input, unit0_signal) = ctx.pins.gpio11.split(); + let (unit1_input, unit1_signal) = ctx.pins.gpio12.split(); + let (unit2_input, unit2_signal) = ctx.pins.gpio16.split(); + let (unit3_input, unit3_signal) = ctx.pins.gpio17.split(); let pcnt = ctx.pcnt; diff --git a/hil-test/tests/parl_io_tx.rs b/hil-test/tests/parl_io_tx.rs index 2bbf0a4642d..8924c11ada8 100644 --- a/hil-test/tests/parl_io_tx.rs +++ b/hil-test/tests/parl_io_tx.rs @@ -10,7 +10,6 @@ use esp_hal::{ dma::{ChannelCreator, Dma, DmaPriority}, gpio::{ interconnect::{InputSignal, OutputSignal}, - Io, NoPin, }, parl_io::{ @@ -52,7 +51,6 @@ mod tests { fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let (clock, _) = hil_test::common_test_pins!(peripherals); let valid = hil_test::unconnected_pin!(peripherals); let (clock_loopback, clock) = clock.split(); diff --git a/hil-test/tests/parl_io_tx_async.rs b/hil-test/tests/parl_io_tx_async.rs index a345025be2a..a38719ec7e6 100644 --- a/hil-test/tests/parl_io_tx_async.rs +++ b/hil-test/tests/parl_io_tx_async.rs @@ -12,7 +12,6 @@ use esp_hal::{ dma::{ChannelCreator, Dma, DmaPriority}, gpio::{ interconnect::{InputSignal, OutputSignal}, - Io, NoPin, }, parl_io::{ @@ -54,7 +53,6 @@ mod tests { async fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let (clock, _) = hil_test::common_test_pins!(peripherals); let valid = hil_test::unconnected_pin!(peripherals); let (clock_loopback, clock) = clock.split(); diff --git a/hil-test/tests/pcnt.rs b/hil-test/tests/pcnt.rs index de93787a275..7c18e62b1b9 100644 --- a/hil-test/tests/pcnt.rs +++ b/hil-test/tests/pcnt.rs @@ -7,7 +7,7 @@ use esp_hal::{ delay::Delay, - gpio::{AnyPin, Input, Io, Level, Output, Pin, Pull}, + gpio::{AnyPin, Input, Level, Output, Pin, Pull}, pcnt::{channel::EdgeMode, Pcnt}, }; use hil_test as _; @@ -28,8 +28,6 @@ mod tests { fn init() -> Context<'static> { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (din, dout) = hil_test::common_test_pins!(peripherals); let din = din.degrade(); diff --git a/hil-test/tests/qspi.rs b/hil-test/tests/qspi.rs index 125b1a69f92..0123e32d01a 100644 --- a/hil-test/tests/qspi.rs +++ b/hil-test/tests/qspi.rs @@ -10,7 +10,7 @@ use esp_hal::pcnt::{channel::EdgeMode, unit::Unit, Pcnt}; use esp_hal::{ dma::{Channel, Dma, DmaPriority, DmaRxBuf, DmaTxBuf}, dma_buffers, - gpio::{AnyPin, Input, Io, Level, Output, Pull}, + gpio::{AnyPin, Input, Level, Output, Pull}, prelude::*, spi::{ master::{Address, Command, Config, Spi, SpiDma}, @@ -184,8 +184,6 @@ mod tests { fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (mut pin, mut pin_mirror) = hil_test::common_test_pins!(peripherals); let mut unconnected_pin = hil_test::unconnected_pin!(peripherals); diff --git a/hil-test/tests/rmt.rs b/hil-test/tests/rmt.rs index 4d2df21d1f4..c7c9db6d28e 100644 --- a/hil-test/tests/rmt.rs +++ b/hil-test/tests/rmt.rs @@ -6,7 +6,6 @@ #![no_main] use esp_hal::{ - gpio::Io, prelude::*, rmt::{PulseCode, Rmt, RxChannel, RxChannelConfig, TxChannel, TxChannelConfig}, }; @@ -25,8 +24,6 @@ mod tests { fn rmt_loopback() { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - cfg_if::cfg_if! { if #[cfg(feature = "esp32h2")] { let freq = 32.MHz(); diff --git a/hil-test/tests/spi_full_duplex.rs b/hil-test/tests/spi_full_duplex.rs index 18ba0f78b4f..7a0b0ea9570 100644 --- a/hil-test/tests/spi_full_duplex.rs +++ b/hil-test/tests/spi_full_duplex.rs @@ -14,7 +14,7 @@ use embedded_hal_async::spi::SpiBus as SpiBusAsync; use esp_hal::{ dma::{Dma, DmaDescriptor, DmaPriority, DmaRxBuf, DmaTxBuf}, dma_buffers, - gpio::{Io, Level, NoPin}, + gpio::{Level, NoPin}, peripheral::Peripheral, prelude::*, spi::master::{Config, Spi}, @@ -58,7 +58,6 @@ mod tests { fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let sclk = peripherals.pins.gpio0; let (_, mosi) = hil_test::common_test_pins!(peripherals); diff --git a/hil-test/tests/spi_half_duplex_read.rs b/hil-test/tests/spi_half_duplex_read.rs index 1630f5ef4e1..8192850293e 100644 --- a/hil-test/tests/spi_half_duplex_read.rs +++ b/hil-test/tests/spi_half_duplex_read.rs @@ -8,7 +8,7 @@ use esp_hal::{ dma::{Dma, DmaPriority, DmaRxBuf, DmaTxBuf}, dma_buffers, - gpio::{Io, Level, Output}, + gpio::{Level, Output}, prelude::*, spi::{ master::{Address, Command, Config, Spi, SpiDma}, @@ -33,7 +33,6 @@ mod tests { fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let sclk = peripherals.pins.gpio0; let (miso, miso_mirror) = hil_test::common_test_pins!(peripherals); diff --git a/hil-test/tests/spi_half_duplex_write.rs b/hil-test/tests/spi_half_duplex_write.rs index f4f9c7970c2..7ec44286c4b 100644 --- a/hil-test/tests/spi_half_duplex_write.rs +++ b/hil-test/tests/spi_half_duplex_write.rs @@ -8,7 +8,7 @@ use esp_hal::{ dma::{Dma, DmaPriority, DmaRxBuf, DmaTxBuf}, dma_buffers, - gpio::{interconnect::InputSignal, Io}, + gpio::interconnect::InputSignal, pcnt::{channel::EdgeMode, unit::Unit, Pcnt}, prelude::*, spi::{ @@ -35,7 +35,6 @@ mod tests { fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); let sclk = peripherals.pins.gpio0; let (mosi, _) = hil_test::common_test_pins!(peripherals); diff --git a/hil-test/tests/spi_half_duplex_write_psram.rs b/hil-test/tests/spi_half_duplex_write_psram.rs index 296466f277a..6968ecb32f5 100644 --- a/hil-test/tests/spi_half_duplex_write_psram.rs +++ b/hil-test/tests/spi_half_duplex_write_psram.rs @@ -53,7 +53,6 @@ mod tests { let peripherals = esp_hal::init(esp_hal::Config::default()); esp_alloc::psram_allocator!(peripherals.PSRAM, esp_hal::psram); - let io = Io::new(peripherals.IO_MUX); let sclk = peripherals.pins.gpio0; let (mosi, _) = hil_test::common_test_pins!(peripherals); diff --git a/hil-test/tests/spi_slave.rs b/hil-test/tests/spi_slave.rs index 6a0bbb877d0..6045f1d4d12 100644 --- a/hil-test/tests/spi_slave.rs +++ b/hil-test/tests/spi_slave.rs @@ -11,7 +11,7 @@ use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, - gpio::{Input, Io, Level, Output, Pull}, + gpio::{Input, Level, Output, Pull}, peripheral::Peripheral, spi::{slave::Spi, SpiMode}, Blocking, @@ -103,8 +103,6 @@ mod tests { fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (mosi_pin, miso_pin) = hil_test::i2c_pins!(peripherals); let (sclk_pin, _) = hil_test::common_test_pins!(peripherals); let cs_pin = hil_test::unconnected_pin!(peripherals); diff --git a/hil-test/tests/twai.rs b/hil-test/tests/twai.rs index a059ebc47da..14a871d7b36 100644 --- a/hil-test/tests/twai.rs +++ b/hil-test/tests/twai.rs @@ -7,7 +7,6 @@ use embedded_hal_02::can::Frame; use esp_hal::{ - gpio::Io, prelude::*, twai::{self, filter::SingleStandardFilter, EspTwaiFrame, StandardId, TwaiMode}, Blocking, @@ -28,8 +27,6 @@ mod tests { fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (loopback_pin, _) = hil_test::common_test_pins!(peripherals); let (rx, tx) = loopback_pin.split(); diff --git a/hil-test/tests/uart.rs b/hil-test/tests/uart.rs index b5ab16e4f72..d9cddaa4180 100644 --- a/hil-test/tests/uart.rs +++ b/hil-test/tests/uart.rs @@ -7,7 +7,6 @@ use embedded_hal_02::serial::{Read, Write}; use esp_hal::{ - gpio::Io, prelude::*, uart::{self, ClockSource, Uart}, Blocking, @@ -28,8 +27,6 @@ mod tests { fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (_, pin) = hil_test::common_test_pins!(peripherals); let (rx, tx) = pin.split(); diff --git a/hil-test/tests/uart_async.rs b/hil-test/tests/uart_async.rs index 9cf525c4911..7a36307c80d 100644 --- a/hil-test/tests/uart_async.rs +++ b/hil-test/tests/uart_async.rs @@ -6,7 +6,7 @@ #![no_std] #![no_main] -use esp_hal::{gpio::Io, uart::Uart, Async}; +use esp_hal::{uart::Uart, Async}; use hil_test as _; struct Context { @@ -22,8 +22,6 @@ mod tests { async fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (rx, tx) = hil_test::common_test_pins!(peripherals); let uart = Uart::new(peripherals.UART0, rx, tx).unwrap().into_async(); diff --git a/hil-test/tests/uart_regression.rs b/hil-test/tests/uart_regression.rs index 9a1fdb6f806..f2118afaa26 100644 --- a/hil-test/tests/uart_regression.rs +++ b/hil-test/tests/uart_regression.rs @@ -9,7 +9,6 @@ #[embedded_test::tests] mod tests { use esp_hal::{ - gpio::Io, prelude::*, uart::{UartRx, UartTx}, }; @@ -21,8 +20,6 @@ mod tests { fn test_that_creating_tx_does_not_cause_a_pulse() { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (rx, mut tx) = hil_test::common_test_pins!(peripherals); let mut rx = UartRx::new(peripherals.UART1, rx).unwrap(); diff --git a/hil-test/tests/uart_tx_rx.rs b/hil-test/tests/uart_tx_rx.rs index 9fb4db2f512..8274a9043db 100644 --- a/hil-test/tests/uart_tx_rx.rs +++ b/hil-test/tests/uart_tx_rx.rs @@ -6,7 +6,6 @@ #![no_main] use esp_hal::{ - gpio::Io, prelude::*, uart::{UartRx, UartTx}, Blocking, @@ -28,8 +27,6 @@ mod tests { fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (rx, tx) = hil_test::common_test_pins!(peripherals); let tx = UartTx::new(peripherals.UART0, tx).unwrap(); diff --git a/hil-test/tests/uart_tx_rx_async.rs b/hil-test/tests/uart_tx_rx_async.rs index 6bd4b4a6808..4f02cf63bda 100644 --- a/hil-test/tests/uart_tx_rx_async.rs +++ b/hil-test/tests/uart_tx_rx_async.rs @@ -7,7 +7,6 @@ #![no_main] use esp_hal::{ - gpio::Io, uart::{UartRx, UartTx}, Async, }; @@ -27,8 +26,6 @@ mod tests { async fn init() -> Context { let peripherals = esp_hal::init(esp_hal::Config::default()); - let io = Io::new(peripherals.IO_MUX); - let (rx, tx) = hil_test::common_test_pins!(peripherals); let tx = UartTx::new(peripherals.UART0, tx).unwrap().into_async();