diff --git a/esp-hal-smartled/src/lib.rs b/esp-hal-smartled/src/lib.rs index d36573f7f16..3ae9dae25eb 100644 --- a/esp-hal-smartled/src/lib.rs +++ b/esp-hal-smartled/src/lib.rs @@ -11,7 +11,7 @@ //! ## Example //! //! ```rust,ignore -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! let rmt = Rmt::new(peripherals.RMT, 80.MHz(), &clocks).unwrap(); //! //! let rmt_buffer = smartLedBuffer!(1); diff --git a/esp-hal/src/analog/adc/esp32.rs b/esp-hal/src/analog/adc/esp32.rs index d9200235f44..fb80b2836c9 100644 --- a/esp-hal/src/analog/adc/esp32.rs +++ b/esp-hal/src/analog/adc/esp32.rs @@ -192,13 +192,13 @@ impl RegisterAccess for ADC2 { } /// Analog-to-Digital Converter peripheral driver. -pub struct ADC<'d, ADC> { +pub struct Adc<'d, ADC> { _adc: PeripheralRef<'d, ADC>, attenuations: [Option; NUM_ATTENS], active_channel: Option, } -impl<'d, ADCI> ADC<'d, ADCI> +impl<'d, ADCI> Adc<'d, ADCI> where ADCI: RegisterAccess, { @@ -270,7 +270,7 @@ where .sar_read_ctrl2() .modify(|_, w| w.sar2_data_inv().set_bit()); - ADC { + Adc { _adc: adc_instance.into_ref(), attenuations: config.attenuations, active_channel: None, @@ -323,7 +323,7 @@ where } } -impl<'d, ADC1> ADC<'d, ADC1> { +impl<'d, ADC1> Adc<'d, ADC1> { pub fn enable_hall_sensor() { // Connect hall sensor unsafe { &*RTC_IO::ptr() } @@ -341,7 +341,7 @@ impl<'d, ADC1> ADC<'d, ADC1> { #[cfg(feature = "embedded-hal-02")] impl<'d, ADCI, PIN> embedded_hal_02::adc::OneShot> - for ADC<'d, ADCI> + for Adc<'d, ADCI> where PIN: embedded_hal_02::adc::Channel + super::AdcChannel, ADCI: RegisterAccess, diff --git a/esp-hal/src/analog/adc/riscv.rs b/esp-hal/src/analog/adc/riscv.rs index 672da8ae358..f057cc4a25c 100644 --- a/esp-hal/src/analog/adc/riscv.rs +++ b/esp-hal/src/analog/adc/riscv.rs @@ -397,13 +397,13 @@ impl super::CalibrationAccess for crate::peripherals::ADC2 { } /// Analog-to-Digital Converter peripheral driver. -pub struct ADC<'d, ADCI> { +pub struct Adc<'d, ADCI> { _adc: PeripheralRef<'d, ADCI>, attenuations: [Option; NUM_ATTENS], active_channel: Option, } -impl<'d, ADCI> ADC<'d, ADCI> +impl<'d, ADCI> Adc<'d, ADCI> where ADCI: RegisterAccess + 'd, { @@ -426,7 +426,7 @@ where .bits(0b11) }); - ADC { + Adc { _adc: adc_instance.into_ref(), attenuations: config.attenuations, active_channel: None, @@ -540,7 +540,7 @@ impl super::AdcCalEfuse for crate::peripherals::ADC2 { #[cfg(feature = "embedded-hal-02")] impl<'d, ADCI, PIN, CS> embedded_hal_02::adc::OneShot> - for ADC<'d, ADCI> + for Adc<'d, ADCI> where PIN: embedded_hal_02::adc::Channel + super::AdcChannel, ADCI: RegisterAccess, diff --git a/esp-hal/src/analog/adc/xtensa.rs b/esp-hal/src/analog/adc/xtensa.rs index 9d9fada97c3..020dd4912f1 100644 --- a/esp-hal/src/analog/adc/xtensa.rs +++ b/esp-hal/src/analog/adc/xtensa.rs @@ -401,13 +401,13 @@ impl super::CalibrationAccess for crate::peripherals::ADC2 { } /// Analog-to-Digital Converter peripheral driver. -pub struct ADC<'d, ADC> { +pub struct Adc<'d, ADC> { _adc: PeripheralRef<'d, ADC>, active_channel: Option, last_init_code: u16, } -impl<'d, ADCI> ADC<'d, ADCI> +impl<'d, ADCI> Adc<'d, ADCI> where ADCI: RegisterAccess, { @@ -481,7 +481,7 @@ where .sar_amp_ctrl2() .modify(|_, w| unsafe { w.sar_amp_wait3().bits(1) }); - ADC { + Adc { _adc: adc_instance.into_ref(), active_channel: None, last_init_code: 0, @@ -605,7 +605,7 @@ impl super::AdcCalEfuse for crate::peripherals::ADC2 { #[cfg(feature = "embedded-hal-02")] impl<'d, ADCI, PIN, CS> embedded_hal_02::adc::OneShot> - for ADC<'d, ADCI> + for Adc<'d, ADCI> where PIN: embedded_hal_02::adc::Channel + AdcChannel, ADCI: RegisterAccess, diff --git a/esp-hal/src/analog/dac.rs b/esp-hal/src/analog/dac.rs index e7ff5492f61..b2b3e71e826 100644 --- a/esp-hal/src/analog/dac.rs +++ b/esp-hal/src/analog/dac.rs @@ -12,12 +12,12 @@ //! ## Example //! //! ```no_run -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! let gpio25 = io.pins.gpio25.into_analog(); //! let gpio26 = io.pins.gpio26.into_analog(); //! -//! let mut dac1 = DAC1::new(peripherals.DAC1, gpio25); -//! let mut dac2 = DAC2::new(peripherals.DAC2, gpio26); +//! let mut dac1 = Dac1::new(peripherals.DAC1, gpio25); +//! let mut dac2 = Dac2::new(peripherals.DAC2, gpio26); //! //! let mut delay = Delay::new(&clocks); //! @@ -53,11 +53,11 @@ cfg_if::cfg_if! { } /// Digital-to-Analog Converter (DAC) Channel 1 -pub struct DAC1<'d> { +pub struct Dac1<'d> { _inner: PeripheralRef<'d, peripherals::DAC1>, } -impl<'d> DAC1<'d> { +impl<'d> Dac1<'d> { /// Constructs a new DAC instance. pub fn new(dac: impl Peripheral

+ 'd, _pin: Dac1Gpio) -> Self { crate::into_ref!(dac); @@ -90,11 +90,11 @@ impl<'d> DAC1<'d> { } /// Digital-to-Analog Converter (DAC) Channel 2 -pub struct DAC2<'d> { +pub struct Dac2<'d> { _inner: PeripheralRef<'d, peripherals::DAC2>, } -impl<'d> DAC2<'d> { +impl<'d> Dac2<'d> { /// Constructs a new DAC instance. pub fn new(dac: impl Peripheral

+ 'd, _pin: Dac2Gpio) -> Self { crate::into_ref!(dac); diff --git a/esp-hal/src/embassy/mod.rs b/esp-hal/src/embassy/mod.rs index 223e2f2cc89..188c861fb98 100644 --- a/esp-hal/src/embassy/mod.rs +++ b/esp-hal/src/embassy/mod.rs @@ -41,7 +41,7 @@ //! #[cfg(feature = "embassy-time-timg0")] //! embassy::init(&clocks, timer_group0.timer0); //! -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! // GPIO 9 as input //! let input = io.pins.gpio9.into_pull_down_input(); //! diff --git a/esp-hal/src/etm.rs b/esp-hal/src/etm.rs index 8748c8b29da..5b7370ce7ca 100644 --- a/esp-hal/src/etm.rs +++ b/esp-hal/src/etm.rs @@ -22,7 +22,7 @@ //! //! ## Example //! ```no_run -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! let mut led = io.pins.gpio1.into_push_pull_output(); //! let button = io.pins.gpio9.into_pull_down_input(); //! diff --git a/esp-hal/src/gpio/lp_io.rs b/esp-hal/src/gpio/lp_io.rs index fff66ecdac7..56463d0be6d 100644 --- a/esp-hal/src/gpio/lp_io.rs +++ b/esp-hal/src/gpio/lp_io.rs @@ -15,7 +15,7 @@ //! //! # Example //! ```no_run -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! // configure GPIO 1 as LP output pin //! let lp_pin = io.pins.gpio1.into_low_power().into_push_pull_output(); //! ``` @@ -180,7 +180,7 @@ macro_rules! lp_gpio { } } - impl $crate::gpio::RTCPin for GpioPin { + impl $crate::gpio::RtcPin for GpioPin { unsafe fn apply_wakeup(&mut self, wakeup: bool, level: u8) { let lp_io = &*$crate::peripherals::LP_IO::ptr(); lp_io.[< pin $gpionum >]().modify(|_, w| { @@ -232,7 +232,7 @@ macro_rules! lp_gpio { } } - impl $crate::gpio::RTCPinWithResistors for GpioPin { + impl $crate::gpio::RtcPinWithResistors for GpioPin { fn rtcio_pullup(&mut self, enable: bool) { let lp_io = unsafe { &*$crate::peripherals::LP_IO::ptr() }; lp_io.[< gpio $gpionum >]().modify(|_, w| w.fun_wpu().bit(enable)); diff --git a/esp-hal/src/gpio/mod.rs b/esp-hal/src/gpio/mod.rs index 885188684ec..4b4afadb328 100644 --- a/esp-hal/src/gpio/mod.rs +++ b/esp-hal/src/gpio/mod.rs @@ -12,11 +12,11 @@ //! interface for GPIO pins. //! //! To get access to the pins, you first need to convert them into a HAL -//! designed struct from the pac struct `GPIO` and `IO_MUX` using `IO::new`. +//! designed struct from the pac struct `GPIO` and `IO_MUX` using `Io::new`. //! //! ## Example //! ```no_run -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! let mut led = io.pins.gpio5.into_push_pull_output(); //! ``` //! @@ -100,7 +100,7 @@ impl InputMode for Unknown { } /// RTC input pin mode -pub struct RTCInput { +pub struct RtcInput { _mode: PhantomData, } @@ -142,7 +142,7 @@ impl OutputMode for Unknown { } /// RTC output pin mode -pub struct RTCOutput { +pub struct RtcOutput { _mode: PhantomData, } @@ -155,20 +155,6 @@ pub struct PushPull; /// Analog mode pub struct Analog; -/// Alternate mode -pub struct Alternate { - _mode: PhantomData, -} - -#[doc(hidden)] -pub struct AF0; - -#[doc(hidden)] -pub struct AF1; - -#[doc(hidden)] -pub struct AF2; - /// Drive strength (values are approximates) #[allow(missing_docs)] pub enum DriveStrength { @@ -199,7 +185,7 @@ pub enum RtcFunction { } /// Trait implemented by RTC pins -pub trait RTCPin: Pin { +pub trait RtcPin: Pin { /// RTC number of the pin #[cfg(xtensa)] fn rtc_number(&self) -> u8; @@ -221,7 +207,7 @@ pub trait RTCPin: Pin { /// Trait implemented by RTC pins which supporting internal pull-up / pull-down /// resistors. -pub trait RTCPinWithResistors: RTCPin { +pub trait RtcPinWithResistors: RtcPin { /// Enable/disable the internal pull-up resistor fn rtcio_pullup(&mut self, enable: bool); /// Enable/disable the internal pull-down resistor @@ -229,15 +215,15 @@ pub trait RTCPinWithResistors: RTCPin { } /// Marker for RTC pins which support input mode -pub trait RTCInputPin: RTCPin {} +pub trait RtcInputPin: RtcPin {} /// Marker for RTC pins which support output mode -pub trait RTCOutputPin: RTCPin {} +pub trait RtcOutputPin: RtcPin {} /// Marker for pins which support analog mode pub trait AnalogPin {} /// Common trait implemented by pins -pub trait Pin { +pub trait Pin: crate::private::Sealed { /// GPIO number fn number(&self) -> u8; @@ -304,7 +290,7 @@ pub trait InputPin: Pin { /// Remove a connected `signal` from this input pin. /// - /// Clears the entry in the GPIO matrix / IO mux that associates this input + /// Clears the entry in the GPIO matrix / Io mux that associates this input /// pin with the given [input `signal`](`InputSignal`). Any other /// connected signals remain intact. fn disconnect_input_from_peripheral(&mut self, signal: InputSignal) -> &mut Self; @@ -374,7 +360,7 @@ pub trait OutputPin: Pin { /// Remove this output pin from a connected [signal](`InputSignal`). /// - /// Clears the entry in the GPIO matrix / IO mux that associates this output + /// Clears the entry in the GPIO matrix / Io mux that associates this output /// pin with a previously connected [signal](`InputSignal`). Any other /// outputs connected to the signal remain intact. fn disconnect_peripheral_from_output(&mut self) -> &mut Self; @@ -1146,30 +1132,6 @@ where } } -impl From> for GpioPin, GPIONUM> -where - Self: GpioProperties, - ::PinType: IsOutputPin, - GpioPin: GpioProperties, - as GpioProperties>::PinType: IsOutputPin, -{ - fn from(pin: GpioPin) -> Self { - pin.into_alternate_1() - } -} - -impl From> for GpioPin, GPIONUM> -where - Self: GpioProperties, - ::PinType: IsOutputPin, - GpioPin: GpioProperties, - as GpioProperties>::PinType: IsOutputPin, -{ - fn from(pin: GpioPin) -> Self { - pin.into_alternate_2() - } -} - impl GpioPin where Self: GpioProperties, @@ -1246,18 +1208,6 @@ where self.init_output(GPIO_FUNCTION, true); GpioPin { _mode: PhantomData } } - - /// Configures the pin into alternate mode one. - pub fn into_alternate_1(self) -> GpioPin, GPIONUM> { - self.init_output(AlternateFunction::Function1, false); - GpioPin { _mode: PhantomData } - } - - /// Configures the pin into alternate mode two. - pub fn into_alternate_2(self) -> GpioPin, GPIONUM> { - self.init_output(AlternateFunction::Function2, false); - GpioPin { _mode: PhantomData } - } } impl OutputPin for GpioPin @@ -1878,13 +1828,13 @@ impl AnyPin, TYPE> { } /// General Purpose Input/Output driver -pub struct IO { +pub struct Io { _io_mux: IO_MUX, /// The pins available on this chip pub pins: Pins, } -impl IO { +impl Io { /// Initialize the I/O driver. pub fn new(gpio: GPIO, io_mux: IO_MUX) -> Self { Self::new_with_priority(gpio, io_mux, crate::interrupt::Priority::min()) @@ -1903,7 +1853,7 @@ impl IO { let pins = gpio.split(); - IO { + Io { _io_mux: io_mux, pins, } @@ -2112,7 +2062,7 @@ macro_rules! rtc_pins { ( $pin_num:expr, $rtc_pin:expr, $pin_reg:expr, $prefix:pat, $hold:ident $(, $rue:ident, $rde:ident)? ) => { - impl $crate::gpio::RTCPin for GpioPin + impl $crate::gpio::RtcPin for GpioPin { fn rtc_number(&self) -> u8 { $rtc_pin @@ -2152,7 +2102,7 @@ macro_rules! rtc_pins { } $( - impl $crate::gpio::RTCPinWithResistors for GpioPin + impl $crate::gpio::RtcPinWithResistors for GpioPin { fn rtcio_pullup(&mut self, enable: bool) { let rtcio = unsafe { &*$crate::peripherals::RTC_IO::PTR }; @@ -2175,7 +2125,7 @@ macro_rules! rtc_pins { paste::paste!{ impl $crate::gpio::rtc_io::IntoLowPowerPin<$pin_num> for GpioPin { fn into_low_power(mut self) -> $crate::gpio::rtc_io::LowPowerPin { - use $crate::gpio::RTCPin; + use $crate::gpio::RtcPin; self.rtc_set_config(false, true, $crate::gpio::RtcFunction::Rtc); @@ -2204,7 +2154,7 @@ macro_rules! rtc_pins { ( $pin_num:expr ) => { - impl $crate::gpio::RTCPin for GpioPin { + impl $crate::gpio::RtcPin for GpioPin { unsafe fn apply_wakeup(&mut self, wakeup: bool, level: u8) { let rtc_cntl = unsafe { &*$crate::peripherals::RTC_CNTL::ptr() }; paste::paste! { @@ -2221,7 +2171,7 @@ macro_rules! rtc_pins { } } - impl $crate::gpio::RTCPinWithResistors for GpioPin { + impl $crate::gpio::RtcPinWithResistors for GpioPin { fn rtcio_pullup(&mut self, enable: bool) { let io_mux = unsafe { &*$crate::peripherals::IO_MUX::ptr() }; io_mux.gpio($pin_num).modify(|_, w| w.fun_wpu().bit(enable)); diff --git a/esp-hal/src/gpio/rtc_io.rs b/esp-hal/src/gpio/rtc_io.rs index c77f449cda9..8559bd4f3aa 100644 --- a/esp-hal/src/gpio/rtc_io.rs +++ b/esp-hal/src/gpio/rtc_io.rs @@ -15,7 +15,7 @@ //! //! # Example //! ```no_run -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! // configure GPIO 1 as ULP output pin //! let lp_pin = io.pins.gpio1.into_low_power().into_push_pull_output(); //! ``` diff --git a/esp-hal/src/ledc/mod.rs b/esp-hal/src/ledc/mod.rs index b6d17439f61..d69deb66fca 100644 --- a/esp-hal/src/ledc/mod.rs +++ b/esp-hal/src/ledc/mod.rs @@ -10,7 +10,7 @@ //! 10% duty using the ABPClock //! //! ```no_run -//! let mut ledc = LEDC::new(peripherals.LEDC, &clock_control); +//! let mut ledc = Ledc::new(peripherals.LEDC, &clock_control); //! ledc.set_global_slow_clock(LSGlobalClkSource::APBClk); //! //! let mut lstimer0 = ledc.get_timer::(timer::Number::Timer0); @@ -37,7 +37,7 @@ //! 10% duty using the ABPClock //! //! ```no_run -//! let ledc = LEDC::new(peripherals.LEDC, &clock_control); +//! let ledc = Ledc::new(peripherals.LEDC, &clock_control); //! //! let mut hstimer0 = ledc.get_timer::(timer::Number::Timer0); //! hstimer0 @@ -82,7 +82,7 @@ pub enum LSGlobalClkSource { } /// LEDC (LED PWM Controller) -pub struct LEDC<'d> { +pub struct Ledc<'d> { _instance: PeripheralRef<'d, crate::peripherals::LEDC>, ledc: &'d crate::peripherals::ledc::RegisterBlock, clock_control_config: &'d Clocks<'d>, @@ -108,7 +108,7 @@ impl Speed for LowSpeed { const IS_HS: bool = false; } -impl<'d> LEDC<'d> { +impl<'d> Ledc<'d> { /// Return a new LEDC pub fn new( _instance: impl Peripheral

+ 'd, @@ -118,7 +118,7 @@ impl<'d> LEDC<'d> { PeripheralClockControl::enable(PeripheralEnable::Ledc); let ledc = unsafe { &*crate::peripherals::LEDC::ptr() }; - LEDC { + Ledc { _instance, ledc, clock_control_config, diff --git a/esp-hal/src/mcpwm/mod.rs b/esp-hal/src/mcpwm/mod.rs index 373318b99e7..0b024a716fe 100644 --- a/esp-hal/src/mcpwm/mod.rs +++ b/esp-hal/src/mcpwm/mod.rs @@ -38,7 +38,7 @@ //! //! // initialize peripheral //! let clock_cfg = PeripheralClockConfig::with_frequency(&clocks, 40.MHz()).unwrap(); -//! let mut mcpwm = MCPWM::new(peripherals.PWM0, clock_cfg); +//! let mut mcpwm = McPwm::new(peripherals.PWM0, clock_cfg); //! //! // connect operator0 to timer0 //! mcpwm.operator0.set_timer(&mcpwm.timer0); @@ -81,7 +81,7 @@ type RegisterBlock = crate::peripherals::mcpwm0::RegisterBlock; /// The MCPWM peripheral #[non_exhaustive] -pub struct MCPWM<'d, PWM> { +pub struct McPwm<'d, PWM> { _inner: PeripheralRef<'d, PWM>, /// Timer0 pub timer0: Timer<0, PWM>, @@ -97,7 +97,7 @@ pub struct MCPWM<'d, PWM> { pub operator2: Operator<2, PWM>, } -impl<'d, PWM: PwmPeripheral> MCPWM<'d, PWM> { +impl<'d, PWM: PwmPeripheral> McPwm<'d, PWM> { /// `pwm_clk = clocks.crypto_pwm_clock / (prescaler + 1)` // clocks.crypto_pwm_clock normally is 160 MHz pub fn new( diff --git a/esp-hal/src/otg_fs.rs b/esp-hal/src/otg_fs.rs index 69a96a91582..49883df17ad 100644 --- a/esp-hal/src/otg_fs.rs +++ b/esp-hal/src/otg_fs.rs @@ -42,11 +42,11 @@ pub trait UsbDp: crate::private::Sealed {} #[doc(hidden)] pub trait UsbDm: crate::private::Sealed {} -pub struct USB<'d> { +pub struct Usb<'d> { _usb0: PeripheralRef<'d, peripherals::USB0>, } -impl<'d> USB<'d> { +impl<'d> Usb<'d> { pub fn new( usb0: impl Peripheral

+ 'd, _usb_dp: impl Peripheral

+ 'd, @@ -64,9 +64,9 @@ impl<'d> USB<'d> { } } -unsafe impl<'d> Sync for USB<'d> {} +unsafe impl<'d> Sync for Usb<'d> {} -unsafe impl<'d> UsbPeripheral for USB<'d> { +unsafe impl<'d> UsbPeripheral for Usb<'d> { const REGISTERS: *const () = peripherals::USB0::ptr() as *const (); const HIGH_SPEED: bool = false; diff --git a/esp-hal/src/pcnt/mod.rs b/esp-hal/src/pcnt/mod.rs index 64fed30a1cf..844f7d7b162 100644 --- a/esp-hal/src/pcnt/mod.rs +++ b/esp-hal/src/pcnt/mod.rs @@ -34,7 +34,7 @@ //! //! // setup a pulse couter //! println!("setup pulse counter unit 0"); -//! let pcnt = PCNT::new(peripherals.PCNT, Some(interrupt_handler)); +//! let pcnt = Pcnt::new(peripherals.PCNT, Some(interrupt_handler)); //! let mut u0 = pcnt.get_unit(unit_number); //! u0.configure(unit::Config { //! low_limit: -100, @@ -46,7 +46,7 @@ //! //! println!("setup channel 0"); //! let mut ch0 = u0.get_channel(channel::Number::Channel0); -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! let mut pin_a = io.pins.gpio5.into_pull_up_input(); //! let mut pin_b = io.pins.gpio6.into_pull_up_input(); //! @@ -141,11 +141,11 @@ use crate::{ pub mod channel; pub mod unit; -pub struct PCNT<'d> { +pub struct Pcnt<'d> { _instance: PeripheralRef<'d, peripherals::PCNT>, } -impl<'d> PCNT<'d> { +impl<'d> Pcnt<'d> { /// Return a new PCNT pub fn new( _instance: impl Peripheral

+ 'd, @@ -162,7 +162,7 @@ impl<'d> PCNT<'d> { } } - PCNT { _instance } + Pcnt { _instance } } /// Return a unit diff --git a/esp-hal/src/peripheral.rs b/esp-hal/src/peripheral.rs index f5b207b0532..1bb7333a1b8 100644 --- a/esp-hal/src/peripheral.rs +++ b/esp-hal/src/peripheral.rs @@ -32,7 +32,7 @@ //! let mut rtc = Rtc::new(peripherals.LPWR, None); //! ``` //! ```no_run -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! ``` use core::{ diff --git a/esp-hal/src/rtc_cntl/sleep/esp32.rs b/esp-hal/src/rtc_cntl/sleep/esp32.rs index b95760348be..21723dab76f 100644 --- a/esp-hal/src/rtc_cntl/sleep/esp32.rs +++ b/esp-hal/src/rtc_cntl/sleep/esp32.rs @@ -1,6 +1,6 @@ use super::{Ext0WakeupSource, Ext1WakeupSource, TimerWakeupSource, WakeSource, WakeTriggers}; use crate::{ - gpio::{RTCPin, RtcFunction}, + gpio::{RtcFunction, RtcPin}, rtc_cntl::{sleep::WakeupLevel, Clock, Rtc, RtcClock}, }; @@ -66,7 +66,7 @@ impl WakeSource for TimerWakeupSource { } } -impl WakeSource for Ext0WakeupSource<'_, P> { +impl WakeSource for Ext0WakeupSource<'_, P> { fn apply(&self, _rtc: &Rtc, triggers: &mut WakeTriggers, sleep_config: &mut RtcSleepConfig) { // don't power down RTC peripherals sleep_config.set_rtc_peri_pd_en(false); @@ -92,7 +92,7 @@ impl WakeSource for Ext0WakeupSource<'_, P> { } } -impl Drop for Ext0WakeupSource<'_, P> { +impl Drop for Ext0WakeupSource<'_, P> { fn drop(&mut self) { // should we have saved the pin configuration first? // set pin back to IO_MUX (input_enable and func have no effect when pin is sent diff --git a/esp-hal/src/rtc_cntl/sleep/esp32c3.rs b/esp-hal/src/rtc_cntl/sleep/esp32c3.rs index 34ecb2c41bb..8a5594c47eb 100644 --- a/esp-hal/src/rtc_cntl/sleep/esp32c3.rs +++ b/esp-hal/src/rtc_cntl/sleep/esp32c3.rs @@ -1,6 +1,6 @@ use super::{TimerWakeupSource, WakeSource, WakeTriggers, WakeupLevel}; use crate::{ - gpio::{RTCPinWithResistors, RtcFunction}, + gpio::{RtcFunction, RtcPinWithResistors}, regi2c_write_mask, rtc_cntl::{sleep::RtcioWakeupSource, Clock, Rtc, RtcClock}, }; @@ -116,7 +116,7 @@ impl WakeSource for TimerWakeupSource { } impl<'a, 'b> RtcioWakeupSource<'a, 'b> { - fn apply_pin(&self, pin: &mut dyn RTCPinWithResistors, level: WakeupLevel) { + fn apply_pin(&self, pin: &mut dyn RtcPinWithResistors, level: WakeupLevel) { // The pullup/pulldown part is like in gpio_deep_sleep_wakeup_prepare let level = match level { WakeupLevel::High => { diff --git a/esp-hal/src/rtc_cntl/sleep/esp32c6.rs b/esp-hal/src/rtc_cntl/sleep/esp32c6.rs index 878dd378c02..b07eabeb83e 100644 --- a/esp-hal/src/rtc_cntl/sleep/esp32c6.rs +++ b/esp-hal/src/rtc_cntl/sleep/esp32c6.rs @@ -61,9 +61,9 @@ impl Ext1WakeupSource<'_, '_> { } fn wake_io_reset(gpio: &mut Pins) { - use crate::gpio::RTCPin; + use crate::gpio::RtcPin; - fn uninit_pin(pin: &mut impl RTCPin, wakeup_pins: u8) { + fn uninit_pin(pin: &mut impl RtcPin, wakeup_pins: u8) { if wakeup_pins & (1 << pin.number()) != 0 { pin.rtcio_pad_hold(false); pin.rtc_set_config(false, false, RtcFunction::Rtc); diff --git a/esp-hal/src/rtc_cntl/sleep/esp32s3.rs b/esp-hal/src/rtc_cntl/sleep/esp32s3.rs index beb4ecbda95..13760c0ba22 100644 --- a/esp-hal/src/rtc_cntl/sleep/esp32s3.rs +++ b/esp-hal/src/rtc_cntl/sleep/esp32s3.rs @@ -7,7 +7,7 @@ use super::{ WakeupLevel, }; use crate::{ - gpio::{RTCPin, RtcFunction}, + gpio::{RtcFunction, RtcPin}, regi2c_write_mask, rtc_cntl::{sleep::RtcioWakeupSource, Clock, Rtc, RtcClock}, }; @@ -110,7 +110,7 @@ impl WakeSource for TimerWakeupSource { } } -impl WakeSource for Ext0WakeupSource<'_, P> { +impl WakeSource for Ext0WakeupSource<'_, P> { fn apply(&self, _rtc: &Rtc, triggers: &mut WakeTriggers, sleep_config: &mut RtcSleepConfig) { // don't power down RTC peripherals sleep_config.set_rtc_peri_pd_en(false); @@ -136,7 +136,7 @@ impl WakeSource for Ext0WakeupSource<'_, P> { } } -impl Drop for Ext0WakeupSource<'_, P> { +impl Drop for Ext0WakeupSource<'_, P> { fn drop(&mut self) { // should we have saved the pin configuration first? // set pin back to IO_MUX (input_enable and func have no effect when pin is sent @@ -192,7 +192,7 @@ impl Drop for Ext1WakeupSource<'_, '_> { } impl<'a, 'b> RtcioWakeupSource<'a, 'b> { - fn apply_pin(&self, pin: &mut dyn RTCPin, level: WakeupLevel) { + fn apply_pin(&self, pin: &mut dyn RtcPin, level: WakeupLevel) { let rtcio = unsafe { &*crate::peripherals::RTC_IO::PTR }; pin.rtc_set_config(true, true, RtcFunction::Rtc); diff --git a/esp-hal/src/rtc_cntl/sleep/mod.rs b/esp-hal/src/rtc_cntl/sleep/mod.rs index e63fe94a75c..1df091fca36 100644 --- a/esp-hal/src/rtc_cntl/sleep/mod.rs +++ b/esp-hal/src/rtc_cntl/sleep/mod.rs @@ -25,9 +25,9 @@ use core::cell::RefCell; use core::time::Duration; #[cfg(any(esp32, esp32s3))] -use crate::gpio::RTCPin as RtcIoWakeupPinType; +use crate::gpio::RtcPin as RtcIoWakeupPinType; #[cfg(any(esp32c3, esp32c6))] -use crate::gpio::RTCPinWithResistors as RtcIoWakeupPinType; +use crate::gpio::RtcPinWithResistors as RtcIoWakeupPinType; use crate::rtc_cntl::Rtc; #[cfg_attr(esp32, path = "esp32.rs")] diff --git a/esp-hal/src/spi/master.rs b/esp-hal/src/spi/master.rs index 1ceb42bca50..a91e3633f7a 100644 --- a/esp-hal/src/spi/master.rs +++ b/esp-hal/src/spi/master.rs @@ -8,7 +8,7 @@ //! //! ## Example //! ```rust -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! let sclk = io.pins.gpio12; //! let miso = io.pins.gpio11; //! let mosi = io.pins.gpio13; diff --git a/esp-hal/src/spi/slave.rs b/esp-hal/src/spi/slave.rs index 257452a3daf..50ef90b917e 100644 --- a/esp-hal/src/spi/slave.rs +++ b/esp-hal/src/spi/slave.rs @@ -9,7 +9,7 @@ //! ## Example //! //! ```rust -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! let sclk = io.pins.gpio12; //! let miso = io.pins.gpio11; //! let mosi = io.pins.gpio13; diff --git a/esp-hal/src/uart.rs b/esp-hal/src/uart.rs index 7c24784c8a7..4f97b70431a 100644 --- a/esp-hal/src/uart.rs +++ b/esp-hal/src/uart.rs @@ -19,7 +19,7 @@ //! specified. //! //! ```no_run -//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); +//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); //! let pins = TxRxPins::new_tx_rx( //! io.pins.gpio1.into_push_pull_output(), //! io.pins.gpio2.into_floating_input(), diff --git a/examples/src/bin/adc.rs b/examples/src/bin/adc.rs index b89805daa00..a8b0722b4b5 100644 --- a/examples/src/bin/adc.rs +++ b/examples/src/bin/adc.rs @@ -11,11 +11,11 @@ use esp_backtrace as _; use esp_hal::{ - analog::adc::{AdcConfig, Attenuation, ADC}, + analog::adc::{Adc, AdcConfig, Attenuation}, clock::ClockControl, delay::Delay, - gpio::IO, - peripherals::{Peripherals, ADC1}, + gpio::Io, + peripherals::Peripherals, prelude::*, }; use esp_println::println; @@ -26,7 +26,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { let analog_pin = io.pins.gpio32.into_analog(); @@ -40,7 +40,7 @@ fn main() -> ! { // Create ADC instances 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 mut adc1 = Adc::new(peripherals.ADC1, adc1_config); let delay = Delay::new(&clocks); diff --git a/examples/src/bin/adc_cal.rs b/examples/src/bin/adc_cal.rs index 85075ae2280..c6951890363 100644 --- a/examples/src/bin/adc_cal.rs +++ b/examples/src/bin/adc_cal.rs @@ -9,11 +9,11 @@ use esp_backtrace as _; use esp_hal::{ - analog::adc::{AdcConfig, Attenuation, ADC}, + analog::adc::{Adc, AdcConfig, Attenuation}, clock::ClockControl, delay::Delay, - gpio::IO, - peripherals::{Peripherals, ADC1}, + gpio::Io, + peripherals::Peripherals, prelude::*, }; use esp_println::println; @@ -24,7 +24,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32s3")] { let analog_pin = io.pins.gpio3.into_analog(); @@ -46,7 +46,7 @@ fn main() -> ! { let mut adc1_config = AdcConfig::new(); let mut adc1_pin = adc1_config.enable_pin_with_cal::<_, AdcCal>(analog_pin, Attenuation::Attenuation11dB); - let mut adc1 = ADC::::new(peripherals.ADC1, adc1_config); + let mut adc1 = Adc::new(peripherals.ADC1, adc1_config); let delay = Delay::new(&clocks); diff --git a/examples/src/bin/advanced_serial.rs b/examples/src/bin/advanced_serial.rs index 564086458fb..2236ba7a0cf 100644 --- a/examples/src/bin/advanced_serial.rs +++ b/examples/src/bin/advanced_serial.rs @@ -16,7 +16,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, uart::{config::Config, TxRxPins, Uart}, @@ -30,7 +30,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let pins = TxRxPins::new_tx_rx( io.pins.gpio4.into_push_pull_output(), io.pins.gpio5.into_floating_input(), diff --git a/examples/src/bin/blinky.rs b/examples/src/bin/blinky.rs index f4d212fe3b2..4704ee3c767 100644 --- a/examples/src/bin/blinky.rs +++ b/examples/src/bin/blinky.rs @@ -8,7 +8,7 @@ #![no_main] use esp_backtrace as _; -use esp_hal::{clock::ClockControl, delay::Delay, gpio::IO, peripherals::Peripherals, prelude::*}; +use esp_hal::{clock::ClockControl, delay::Delay, gpio::Io, peripherals::Peripherals, prelude::*}; #[entry] fn main() -> ! { @@ -17,7 +17,7 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Set GPIO0 as an output, and set its state high initially. - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio8.into_push_pull_output(); led.set_high(); diff --git a/examples/src/bin/blinky_erased_pins.rs b/examples/src/bin/blinky_erased_pins.rs index d4a9560ae7f..984f14030cd 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::{ clock::ClockControl, delay::Delay, - gpio::{AnyPin, Input, Output, PullDown, PushPull, IO}, + gpio::{AnyPin, Input, Io, Output, PullDown, PushPull}, peripherals::Peripherals, prelude::*, }; @@ -25,7 +25,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); // Set LED GPIOs as an output: let led1 = io.pins.gpio8.into_push_pull_output(); diff --git a/examples/src/bin/dac.rs b/examples/src/bin/dac.rs index 0cb715a0112..ede3d334e0c 100644 --- a/examples/src/bin/dac.rs +++ b/examples/src/bin/dac.rs @@ -13,10 +13,10 @@ use esp_backtrace as _; use esp_hal::{ - analog::dac::{DAC1, DAC2}, + analog::dac::{Dac1, Dac2}, clock::ClockControl, delay::Delay, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, }; @@ -27,7 +27,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { @@ -40,8 +40,8 @@ fn main() -> ! { } // Create DAC instances - let mut dac1 = DAC1::new(peripherals.DAC1, dac1_pin); - let mut dac2 = DAC2::new(peripherals.DAC2, dac2_pin); + let mut dac1 = Dac1::new(peripherals.DAC1, dac1_pin); + let mut dac2 = Dac2::new(peripherals.DAC2, dac2_pin); let delay = Delay::new(&clocks); diff --git a/examples/src/bin/debug_assist.rs b/examples/src/bin/debug_assist.rs index a94baa5c482..a648f24f0c6 100644 --- a/examples/src/bin/debug_assist.rs +++ b/examples/src/bin/debug_assist.rs @@ -7,7 +7,7 @@ #![no_std] #![no_main] -use core::{cell::RefCell, ptr::addr_of_mut}; +use core::cell::RefCell; use critical_section::Mutex; use esp_backtrace as _; @@ -31,6 +31,8 @@ fn main() -> ! { cfg_if::cfg_if! { if #[cfg(not(feature = "esp32s3"))] { + use core::ptr::addr_of_mut; + extern "C" { // top of stack static mut _stack_start: u32; diff --git a/examples/src/bin/embassy_i2c.rs b/examples/src/bin/embassy_i2c.rs index e83f398d038..51669bbc206 100644 --- a/examples/src/bin/embassy_i2c.rs +++ b/examples/src/bin/embassy_i2c.rs @@ -23,7 +23,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, embassy::{self}, - gpio::IO, + gpio::Io, i2c::I2C, peripherals::Peripherals, prelude::*, @@ -40,7 +40,7 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let i2c0 = I2C::new_async( peripherals.I2C0, diff --git a/examples/src/bin/embassy_i2s_read.rs b/examples/src/bin/embassy_i2s_read.rs index e5687d5d0a7..34ad8e5e53e 100644 --- a/examples/src/bin/embassy_i2s_read.rs +++ b/examples/src/bin/embassy_i2s_read.rs @@ -25,7 +25,7 @@ use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, embassy, - gpio::IO, + gpio::Io, i2s::{asynch::*, DataFormat, I2s, Standard}, peripherals::Peripherals, prelude::*, @@ -43,7 +43,7 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Dma::new(peripherals.DMA); #[cfg(any(feature = "esp32", feature = "esp32s2"))] diff --git a/examples/src/bin/embassy_i2s_sound.rs b/examples/src/bin/embassy_i2s_sound.rs index 24a78282267..644e1666415 100644 --- a/examples/src/bin/embassy_i2s_sound.rs +++ b/examples/src/bin/embassy_i2s_sound.rs @@ -40,7 +40,7 @@ use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, embassy::{self}, - gpio::IO, + gpio::Io, i2s::{asynch::*, DataFormat, I2s, Standard}, peripherals::Peripherals, prelude::*, @@ -66,7 +66,7 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Dma::new(peripherals.DMA); #[cfg(any(feature = "esp32", feature = "esp32s2"))] diff --git a/examples/src/bin/embassy_multicore.rs b/examples/src/bin/embassy_multicore.rs index 758e3e11436..da931ef3811 100644 --- a/examples/src/bin/embassy_multicore.rs +++ b/examples/src/bin/embassy_multicore.rs @@ -21,7 +21,7 @@ use esp_hal::{ cpu_control::{CpuControl, Stack}, embassy::{self, executor::Executor}, get_core, - gpio::{GpioPin, Output, PushPull, IO}, + gpio::{GpioPin, Io, Output, PushPull}, peripherals::Peripherals, prelude::*, timer::TimerGroup, @@ -56,7 +56,7 @@ async fn main(_spawner: Spawner) { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); diff --git a/examples/src/bin/embassy_multicore_interrupt.rs b/examples/src/bin/embassy_multicore_interrupt.rs index be438bb57c1..33ed22e1309 100644 --- a/examples/src/bin/embassy_multicore_interrupt.rs +++ b/examples/src/bin/embassy_multicore_interrupt.rs @@ -20,7 +20,7 @@ use esp_hal::{ cpu_control::{CpuControl, Stack}, embassy::{self, executor::InterruptExecutor}, get_core, - gpio::{GpioPin, Output, PushPull, IO}, + gpio::{GpioPin, Io, Output, PushPull}, interrupt::Priority, peripherals::Peripherals, prelude::*, @@ -75,7 +75,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); diff --git a/examples/src/bin/embassy_parl_io_rx.rs b/examples/src/bin/embassy_parl_io_rx.rs index c700821b730..3cfd3873294 100644 --- a/examples/src/bin/embassy_parl_io_rx.rs +++ b/examples/src/bin/embassy_parl_io_rx.rs @@ -18,7 +18,7 @@ use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, embassy, - gpio::IO, + gpio::Io, parl_io::{BitPackOrder, NoClkPin, ParlIoRxOnly, RxFourBits}, peripherals::Peripherals, prelude::*, @@ -36,7 +36,7 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let (_, mut tx_descriptors, rx_buffer, mut rx_descriptors) = dma_buffers!(0, 32000); diff --git a/examples/src/bin/embassy_parl_io_tx.rs b/examples/src/bin/embassy_parl_io_tx.rs index aa6e4c9db7e..1698d65e0cb 100644 --- a/examples/src/bin/embassy_parl_io_tx.rs +++ b/examples/src/bin/embassy_parl_io_tx.rs @@ -22,7 +22,7 @@ use esp_hal::{ dma::{Dma, DmaPriority}, dma_buffers, embassy, - gpio::IO, + gpio::Io, parl_io::{ BitPackOrder, ClkOutPin, @@ -47,7 +47,7 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let (tx_buffer, mut tx_descriptors, _, mut rx_descriptors) = dma_buffers!(32000, 0); diff --git a/examples/src/bin/embassy_rmt_rx.rs b/examples/src/bin/embassy_rmt_rx.rs index d05917cdf09..8eb40c8feec 100644 --- a/examples/src/bin/embassy_rmt_rx.rs +++ b/examples/src/bin/embassy_rmt_rx.rs @@ -14,7 +14,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, embassy::{self}, - gpio::{Gpio5, Output, PushPull, IO}, + gpio::{Gpio5, Io, Output, PushPull}, peripherals::Peripherals, prelude::*, rmt::{asynch::RxChannelAsync, PulseCode, Rmt, RxChannelConfig, RxChannelCreatorAsync}, @@ -47,7 +47,7 @@ async fn main(spawner: Spawner) { let timer_group0 = esp_hal::timer::TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32h2")] { diff --git a/examples/src/bin/embassy_rmt_tx.rs b/examples/src/bin/embassy_rmt_tx.rs index f7a8ec6f0c1..b5699f68c42 100644 --- a/examples/src/bin/embassy_rmt_tx.rs +++ b/examples/src/bin/embassy_rmt_tx.rs @@ -15,7 +15,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, embassy, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, rmt::{asynch::TxChannelAsync, PulseCode, Rmt, TxChannelConfig, TxChannelCreatorAsync}, @@ -33,7 +33,7 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32h2")] { diff --git a/examples/src/bin/embassy_spi.rs b/examples/src/bin/embassy_spi.rs index 744534c5d0d..4a1ecf374ac 100644 --- a/examples/src/bin/embassy_spi.rs +++ b/examples/src/bin/embassy_spi.rs @@ -29,7 +29,7 @@ use esp_hal::{ dma::*, dma_descriptors, embassy::{self}, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, spi::{ @@ -49,7 +49,7 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio0; let miso = io.pins.gpio2; let mosi = io.pins.gpio4; diff --git a/examples/src/bin/embassy_twai.rs b/examples/src/bin/embassy_twai.rs index b06a4f1bdf6..7f025472493 100644 --- a/examples/src/bin/embassy_twai.rs +++ b/examples/src/bin/embassy_twai.rs @@ -24,7 +24,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, embassy::{self}, - gpio::IO, + gpio::Io, interrupt, peripherals::{self, Peripherals, TWAI0}, prelude::*, @@ -89,7 +89,7 @@ async fn main(spawner: Spawner) { let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); // Set the tx pin as open drain. Skip this if using transceivers. let can_tx_pin = io.pins.gpio0.into_open_drain_output(); diff --git a/examples/src/bin/embassy_wait.rs b/examples/src/bin/embassy_wait.rs index 246bb50ad9f..76b9e356221 100644 --- a/examples/src/bin/embassy_wait.rs +++ b/examples/src/bin/embassy_wait.rs @@ -15,7 +15,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, embassy::{self}, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, timer::TimerGroup, @@ -31,7 +31,7 @@ async fn main(_spawner: Spawner) { let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); embassy::init(&clocks, timg0); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] let mut input = io.pins.gpio0.into_pull_down_input(); #[cfg(not(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3")))] diff --git a/examples/src/bin/etm_blinky_systimer.rs b/examples/src/bin/etm_blinky_systimer.rs index f0c01a45961..623d7c0c4cf 100644 --- a/examples/src/bin/etm_blinky_systimer.rs +++ b/examples/src/bin/etm_blinky_systimer.rs @@ -8,7 +8,7 @@ use esp_backtrace as _; use esp_hal::{ etm::Etm, - gpio::{etm::GpioEtmChannels, IO}, + gpio::{etm::GpioEtmChannels, Io}, peripherals::Peripherals, prelude::*, systimer::{etm::SysTimerEtmEvent, SystemTimer}, @@ -23,7 +23,7 @@ fn main() -> ! { let mut alarm0 = syst.alarm0.into_periodic(); alarm0.set_period(1u32.secs()); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio1.into_push_pull_output(); // setup ETM diff --git a/examples/src/bin/etm_gpio.rs b/examples/src/bin/etm_gpio.rs index 8cc0caa1697..f0e2e78b48e 100644 --- a/examples/src/bin/etm_gpio.rs +++ b/examples/src/bin/etm_gpio.rs @@ -8,7 +8,7 @@ use esp_backtrace as _; use esp_hal::{ etm::Etm, - gpio::{etm::GpioEtmChannels, IO}, + gpio::{etm::GpioEtmChannels, Io}, peripherals::Peripherals, prelude::*, }; @@ -17,7 +17,7 @@ use esp_hal::{ fn main() -> ! { let peripherals = Peripherals::take(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio1.into_push_pull_output(); let button = io.pins.gpio9.into_pull_down_input(); diff --git a/examples/src/bin/gpio_interrupt.rs b/examples/src/bin/gpio_interrupt.rs index 1990a3f27ac..efcae4257b3 100644 --- a/examples/src/bin/gpio_interrupt.rs +++ b/examples/src/bin/gpio_interrupt.rs @@ -15,7 +15,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, - gpio::{self, Event, Input, PullDown, IO}, + gpio::{self, Event, Input, Io, PullDown}, macros::ram, peripherals::Peripherals, prelude::*, @@ -35,7 +35,7 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Set GPIO2 as an output, and set its state high initially. - let mut io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX); io.set_interrupt_handler(handler); let mut led = io.pins.gpio2.into_push_pull_output(); diff --git a/examples/src/bin/hello_rgb.rs b/examples/src/bin/hello_rgb.rs index 20ba84e88d6..a7cbdeaf9dc 100644 --- a/examples/src/bin/hello_rgb.rs +++ b/examples/src/bin/hello_rgb.rs @@ -17,7 +17,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, rmt::Rmt, @@ -36,7 +36,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); // Each devkit uses a unique GPIO for the RGB LED, so in order to support // all chips we must unfortunately use `#[cfg]`s: diff --git a/examples/src/bin/i2c_bmp180_calibration_data.rs b/examples/src/bin/i2c_bmp180_calibration_data.rs index aa217b08eac..955bab4212e 100644 --- a/examples/src/bin/i2c_bmp180_calibration_data.rs +++ b/examples/src/bin/i2c_bmp180_calibration_data.rs @@ -12,7 +12,7 @@ #![no_main] use esp_backtrace as _; -use esp_hal::{clock::ClockControl, gpio::IO, i2c::I2C, peripherals::Peripherals, prelude::*}; +use esp_hal::{clock::ClockControl, gpio::Io, i2c::I2C, peripherals::Peripherals, prelude::*}; use esp_println::println; #[entry] @@ -21,7 +21,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); // Create a new peripheral object with the described wiring and standard // I2C clock speed: diff --git a/examples/src/bin/i2c_display.rs b/examples/src/bin/i2c_display.rs index 22761568a92..d00880c2165 100644 --- a/examples/src/bin/i2c_display.rs +++ b/examples/src/bin/i2c_display.rs @@ -26,7 +26,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, - gpio::IO, + gpio::Io, i2c::I2C, peripherals::Peripherals, prelude::*, @@ -40,7 +40,7 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let delay = Delay::new(&clocks); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); // Create a new peripheral object with the described wiring // and standard I2C clock speed diff --git a/examples/src/bin/i2s_read.rs b/examples/src/bin/i2s_read.rs index f45c59121c8..5e28866a6ce 100644 --- a/examples/src/bin/i2s_read.rs +++ b/examples/src/bin/i2s_read.rs @@ -21,7 +21,7 @@ use esp_hal::{ clock::ClockControl, dma::{Dma, DmaPriority}, dma_buffers, - gpio::IO, + gpio::Io, i2s::{DataFormat, I2s, I2sReadDma, Standard}, peripherals::Peripherals, prelude::*, @@ -34,7 +34,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Dma::new(peripherals.DMA); #[cfg(any(feature = "esp32", feature = "esp32s2"))] diff --git a/examples/src/bin/i2s_sound.rs b/examples/src/bin/i2s_sound.rs index abbf943f610..d7f61970540 100644 --- a/examples/src/bin/i2s_sound.rs +++ b/examples/src/bin/i2s_sound.rs @@ -36,7 +36,7 @@ use esp_hal::{ clock::ClockControl, dma::{Dma, DmaPriority}, dma_buffers, - gpio::IO, + gpio::Io, i2s::{DataFormat, I2s, I2sWriteDma, Standard}, peripherals::Peripherals, prelude::*, @@ -56,7 +56,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Dma::new(peripherals.DMA); #[cfg(any(feature = "esp32", feature = "esp32s2"))] diff --git a/examples/src/bin/lcd_i8080.rs b/examples/src/bin/lcd_i8080.rs index 53afa2e6718..530da4eb71f 100644 --- a/examples/src/bin/lcd_i8080.rs +++ b/examples/src/bin/lcd_i8080.rs @@ -28,7 +28,7 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority}, dma_buffers, - gpio::IO, + gpio::Io, lcd_cam::{ lcd::i8080::{Config, TxEightBits, I8080}, LcdCam, @@ -44,7 +44,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let lcd_backlight = io.pins.gpio45; let lcd_reset = io.pins.gpio4; diff --git a/examples/src/bin/ledc.rs b/examples/src/bin/ledc.rs index 39f7a7dc165..9994527fddf 100644 --- a/examples/src/bin/ledc.rs +++ b/examples/src/bin/ledc.rs @@ -11,13 +11,13 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, - gpio::IO, + gpio::Io, ledc::{ channel::{self, ChannelIFace}, timer::{self, TimerIFace}, LSGlobalClkSource, + Ledc, LowSpeed, - LEDC, }, peripherals::Peripherals, prelude::*, @@ -29,10 +29,10 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio0.into_push_pull_output(); - let mut ledc = LEDC::new(peripherals.LEDC, &clocks); + let mut ledc = Ledc::new(peripherals.LEDC, &clocks); ledc.set_global_slow_clock(LSGlobalClkSource::APBClk); diff --git a/examples/src/bin/lp_core_basic.rs b/examples/src/bin/lp_core_basic.rs index 53cd5bb9756..4d5758a2095 100644 --- a/examples/src/bin/lp_core_basic.rs +++ b/examples/src/bin/lp_core_basic.rs @@ -12,7 +12,7 @@ use esp_backtrace as _; use esp_hal::{ - gpio::{lp_io::IntoLowPowerPin, IO}, + gpio::{lp_io::IntoLowPowerPin, Io}, lp_core::{LpCore, LpCoreWakeupSource}, peripherals::Peripherals, prelude::*, @@ -24,7 +24,7 @@ fn main() -> ! { let peripherals = Peripherals::take(); // configure GPIO 1 as LP output pin - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let lp_pin = io.pins.gpio1.into_low_power().into_push_pull_output(); 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 bcfa647eaaf..4f813cf9b5c 100644 --- a/examples/src/bin/lp_core_i2c.rs +++ b/examples/src/bin/lp_core_i2c.rs @@ -12,7 +12,7 @@ use esp_backtrace as _; use esp_hal::{ - gpio::{lp_io::IntoLowPowerPin, IO}, + gpio::{lp_io::IntoLowPowerPin, Io}, i2c::lp_i2c::LpI2c, lp_core::{LpCore, LpCoreWakeupSource}, peripherals::Peripherals, @@ -24,7 +24,7 @@ use esp_println::println; fn main() -> ! { let peripherals = Peripherals::take(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let lp_sda = io.pins.gpio6.into_low_power().into_open_drain_output(); let lp_scl = io.pins.gpio7.into_low_power().into_open_drain_output(); diff --git a/examples/src/bin/lp_core_uart.rs b/examples/src/bin/lp_core_uart.rs index aaa51cdc34b..060cdfccc2f 100644 --- a/examples/src/bin/lp_core_uart.rs +++ b/examples/src/bin/lp_core_uart.rs @@ -13,16 +13,11 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, - gpio::{lp_io::IntoLowPowerPin, IO}, + gpio::{lp_io::IntoLowPowerPin, Io}, lp_core::{LpCore, LpCoreWakeupSource}, peripherals::Peripherals, prelude::*, - uart::{ - config::{Config, DataBits, Parity, StopBits}, - lp_uart::LpUart, - TxRxPins, - Uart, - }, + uart::{config::Config, lp_uart::LpUart, TxRxPins, Uart}, }; use esp_println::println; @@ -32,7 +27,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); // Set up (HP) UART1: diff --git a/examples/src/bin/mcpwm.rs b/examples/src/bin/mcpwm.rs index b06b973fb24..a2c24cccb75 100644 --- a/examples/src/bin/mcpwm.rs +++ b/examples/src/bin/mcpwm.rs @@ -11,8 +11,8 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, - gpio::IO, - mcpwm::{operator::PwmPinConfig, timer::PwmWorkingMode, PeripheralClockConfig, MCPWM}, + gpio::Io, + mcpwm::{operator::PwmPinConfig, timer::PwmWorkingMode, McPwm, PeripheralClockConfig}, peripherals::Peripherals, prelude::*, }; @@ -23,7 +23,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let pin = io.pins.gpio0; // initialize peripheral @@ -32,7 +32,7 @@ fn main() -> ! { #[cfg(not(feature = "esp32h2"))] let clock_cfg = PeripheralClockConfig::with_frequency(&clocks, 32.MHz()).unwrap(); - let mut mcpwm = MCPWM::new(peripherals.MCPWM0, clock_cfg); + let mut mcpwm = McPwm::new(peripherals.MCPWM0, clock_cfg); // connect operator0 to timer0 mcpwm.operator0.set_timer(&mcpwm.timer0); diff --git a/examples/src/bin/parl_io_rx.rs b/examples/src/bin/parl_io_rx.rs index eb4711656c0..b396e94e12b 100644 --- a/examples/src/bin/parl_io_rx.rs +++ b/examples/src/bin/parl_io_rx.rs @@ -14,7 +14,7 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority}, dma_buffers, - gpio::IO, + gpio::Io, parl_io::{BitPackOrder, NoClkPin, ParlIoRxOnly, RxFourBits}, peripherals::Peripherals, prelude::*, @@ -27,7 +27,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let (_, mut tx_descriptors, rx_buffer, mut rx_descriptors) = dma_buffers!(0, 32000); diff --git a/examples/src/bin/parl_io_tx.rs b/examples/src/bin/parl_io_tx.rs index 2060ca0f7cb..3f5ad34bdf8 100644 --- a/examples/src/bin/parl_io_tx.rs +++ b/examples/src/bin/parl_io_tx.rs @@ -18,7 +18,7 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority}, dma_buffers, - gpio::IO, + gpio::Io, parl_io::{ BitPackOrder, ClkOutPin, @@ -38,7 +38,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let (tx_buffer, mut tx_descriptors, _, mut rx_descriptors) = dma_buffers!(32000, 0); diff --git a/examples/src/bin/pcnt_encoder.rs b/examples/src/bin/pcnt_encoder.rs index bd5d3910949..0f081ee76ad 100644 --- a/examples/src/bin/pcnt_encoder.rs +++ b/examples/src/bin/pcnt_encoder.rs @@ -16,9 +16,9 @@ use core::{cell::RefCell, cmp::min, sync::atomic::Ordering}; use critical_section::Mutex; use esp_backtrace as _; use esp_hal::{ - gpio::IO, + gpio::Io, interrupt::Priority, - pcnt::{channel, channel::PcntSource, unit, PCNT}, + pcnt::{channel, channel::PcntSource, unit, Pcnt}, peripherals::Peripherals, prelude::*, }; @@ -32,11 +32,11 @@ static VALUE: AtomicI32 = AtomicI32::new(0); fn main() -> ! { let peripherals = Peripherals::take(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); // Set up a pulse counter: println!("setup pulse counter unit 0"); - let pcnt = PCNT::new(peripherals.PCNT, Some(interrupt_handler)); + let pcnt = Pcnt::new(peripherals.PCNT, Some(interrupt_handler)); let mut u0 = pcnt.get_unit(unit::Number::Unit1); u0.configure(unit::Config { low_limit: -100, diff --git a/examples/src/bin/qspi_flash.rs b/examples/src/bin/qspi_flash.rs index ad300e22bd6..3050b3e09b1 100644 --- a/examples/src/bin/qspi_flash.rs +++ b/examples/src/bin/qspi_flash.rs @@ -33,7 +33,7 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority}, dma_buffers, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, spi::{ @@ -50,7 +50,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { let sclk = io.pins.gpio0; diff --git a/examples/src/bin/rmt_rx.rs b/examples/src/bin/rmt_rx.rs index 2fe2911da1b..8a66863c449 100644 --- a/examples/src/bin/rmt_rx.rs +++ b/examples/src/bin/rmt_rx.rs @@ -10,7 +10,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, rmt::{PulseCode, Rmt, RxChannel, RxChannelConfig, RxChannelCreator}, @@ -25,7 +25,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let mut out = io.pins.gpio5.into_push_pull_output(); cfg_if::cfg_if! { diff --git a/examples/src/bin/rmt_tx.rs b/examples/src/bin/rmt_tx.rs index 8b267ac3fa3..3f61a578fab 100644 --- a/examples/src/bin/rmt_tx.rs +++ b/examples/src/bin/rmt_tx.rs @@ -11,7 +11,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, rmt::{PulseCode, Rmt, TxChannel, TxChannelConfig, TxChannelCreator}, @@ -23,7 +23,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32h2")] { diff --git a/examples/src/bin/sleep_timer_ext0.rs b/examples/src/bin/sleep_timer_ext0.rs index 11dc54a2681..936d0b49c5d 100644 --- a/examples/src/bin/sleep_timer_ext0.rs +++ b/examples/src/bin/sleep_timer_ext0.rs @@ -12,7 +12,7 @@ use esp_hal::{ clock::ClockControl, delay::Delay, entry, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, rtc_cntl::{ @@ -34,7 +34,7 @@ fn main() -> ! { let mut rtc = Rtc::new(peripherals.LPWR, None); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let mut ext0_pin = io.pins.gpio4; println!("up and runnning!"); diff --git a/examples/src/bin/sleep_timer_ext1.rs b/examples/src/bin/sleep_timer_ext1.rs index f8e2087df4b..e0f10710e38 100644 --- a/examples/src/bin/sleep_timer_ext1.rs +++ b/examples/src/bin/sleep_timer_ext1.rs @@ -12,7 +12,7 @@ use esp_hal::{ clock::ClockControl, delay::Delay, entry, - gpio::{RTCPin, IO}, + gpio::{Io, RtcPin}, peripherals::Peripherals, prelude::*, rtc_cntl::{ @@ -34,7 +34,7 @@ fn main() -> ! { let mut rtc = Rtc::new(peripherals.LPWR, None); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let mut pin_0 = io.pins.gpio4; let mut pin_2 = io.pins.gpio2; @@ -47,7 +47,7 @@ fn main() -> ! { let mut delay = Delay::new(&clocks); let timer = TimerWakeupSource::new(Duration::from_secs(30)); - let mut wakeup_pins: [&mut dyn RTCPin; 2] = [&mut pin_0, &mut pin_2]; + let mut wakeup_pins: [&mut dyn RtcPin; 2] = [&mut pin_0, &mut pin_2]; let ext1 = Ext1WakeupSource::new(&mut wakeup_pins, WakeupLevel::High); println!("sleeping!"); delay.delay_millis(100); diff --git a/examples/src/bin/sleep_timer_lpio.rs b/examples/src/bin/sleep_timer_lpio.rs index 5deb512396c..0d679498df5 100644 --- a/examples/src/bin/sleep_timer_lpio.rs +++ b/examples/src/bin/sleep_timer_lpio.rs @@ -12,7 +12,7 @@ use esp_hal::{ clock::ClockControl, delay::Delay, entry, - gpio::{RTCPinWithResistors, IO}, + gpio::{Io, RtcPinWithResistors}, peripherals::Peripherals, prelude::*, rtc_cntl::{ @@ -34,7 +34,7 @@ fn main() -> ! { let mut rtc = Rtc::new(peripherals.LPWR, None); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let mut pin2 = io.pins.gpio2; let mut pin3 = io.pins.gpio3; @@ -47,7 +47,7 @@ fn main() -> ! { let mut delay = Delay::new(&clocks); let timer = TimerWakeupSource::new(Duration::from_secs(10)); - let wakeup_pins: &mut [(&mut dyn RTCPinWithResistors, WakeupLevel)] = &mut [ + let wakeup_pins: &mut [(&mut dyn RtcPinWithResistors, WakeupLevel)] = &mut [ (&mut pin2, WakeupLevel::Low), (&mut pin3, WakeupLevel::High), ]; diff --git a/examples/src/bin/sleep_timer_rtcio.rs b/examples/src/bin/sleep_timer_rtcio.rs index 2ca1e39bf3d..1456914b893 100644 --- a/examples/src/bin/sleep_timer_rtcio.rs +++ b/examples/src/bin/sleep_timer_rtcio.rs @@ -14,7 +14,7 @@ use esp_hal::{ delay::Delay, entry, gpio, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, rtc_cntl::{ @@ -34,7 +34,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let mut rtc = Rtc::new(peripherals.LPWR, None); println!("up and runnning!"); @@ -47,13 +47,13 @@ fn main() -> ! { let timer = TimerWakeupSource::new(Duration::from_secs(10)); #[cfg(feature = "esp32c3")] - let wakeup_pins: &mut [(&mut dyn gpio::RTCPinWithResistors, WakeupLevel)] = &mut [ + let wakeup_pins: &mut [(&mut dyn gpio::RtcPinWithResistors, WakeupLevel)] = &mut [ (&mut io.pins.gpio2, WakeupLevel::Low), (&mut io.pins.gpio3, WakeupLevel::High), ]; #[cfg(feature = "esp32s3")] - let mut wakeup_pins: &mut [(&mut dyn gpio::RTCPin, WakeupLevel)] = + let wakeup_pins: &mut [(&mut dyn gpio::RtcPin, WakeupLevel)] = &mut [(&mut io.pins.gpio18, WakeupLevel::Low)]; let rtcio = RtcioWakeupSource::new(wakeup_pins); diff --git a/examples/src/bin/spi_eh1_device_loopback.rs b/examples/src/bin/spi_eh1_device_loopback.rs index 05c387252d8..a82a115cb1a 100644 --- a/examples/src/bin/spi_eh1_device_loopback.rs +++ b/examples/src/bin/spi_eh1_device_loopback.rs @@ -37,7 +37,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, - gpio::{self, IO}, + gpio::{self, Io}, peripherals::Peripherals, prelude::*, spi::{master::Spi, SpiMode}, @@ -50,7 +50,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio0; let miso = io.pins.gpio2; let mosi = io.pins.gpio4; diff --git a/examples/src/bin/spi_eh1_loopback.rs b/examples/src/bin/spi_eh1_loopback.rs index ced93e2f324..a41ea7be937 100644 --- a/examples/src/bin/spi_eh1_loopback.rs +++ b/examples/src/bin/spi_eh1_loopback.rs @@ -24,7 +24,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, spi::{master::Spi, SpiMode}, @@ -37,7 +37,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio0; let miso = io.pins.gpio2; let mosi = io.pins.gpio4; diff --git a/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs b/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs index b801b441b85..4f61c23a395 100644 --- a/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs +++ b/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs @@ -31,7 +31,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, spi::{ @@ -48,7 +48,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); cfg_if::cfg_if! { if #[cfg(feature = "esp32")] { let sclk = io.pins.gpio0; diff --git a/examples/src/bin/spi_loopback.rs b/examples/src/bin/spi_loopback.rs index 796b2da9541..07a02d23208 100644 --- a/examples/src/bin/spi_loopback.rs +++ b/examples/src/bin/spi_loopback.rs @@ -22,7 +22,7 @@ use esp_backtrace as _; use esp_hal::{ clock::ClockControl, delay::Delay, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, spi::{master::Spi, SpiMode}, @@ -35,7 +35,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio0; let miso = io.pins.gpio2; let mosi = io.pins.gpio4; diff --git a/examples/src/bin/spi_loopback_dma.rs b/examples/src/bin/spi_loopback_dma.rs index 9224df1c67a..56881291bff 100644 --- a/examples/src/bin/spi_loopback_dma.rs +++ b/examples/src/bin/spi_loopback_dma.rs @@ -24,7 +24,7 @@ use esp_hal::{ delay::Delay, dma::{Dma, DmaPriority}, dma_buffers, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, spi::{ @@ -40,7 +40,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio0; let miso = io.pins.gpio2; let mosi = io.pins.gpio4; diff --git a/examples/src/bin/spi_slave_dma.rs b/examples/src/bin/spi_slave_dma.rs index 2d52b88acdc..7a207fd00d2 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::IO, + gpio::Io, peripherals::Peripherals, prelude::*, spi::{ @@ -50,7 +50,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let slave_sclk = io.pins.gpio0; let mut master_sclk = io.pins.gpio4.into_push_pull_output(); let slave_miso = io.pins.gpio1; diff --git a/examples/src/bin/twai.rs b/examples/src/bin/twai.rs index 01814b2aeb0..9ca7a965969 100644 --- a/examples/src/bin/twai.rs +++ b/examples/src/bin/twai.rs @@ -21,7 +21,7 @@ const IS_FIRST_SENDER: bool = true; use esp_backtrace as _; use esp_hal::{ clock::ClockControl, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, twai::{self, filter::SingleStandardFilter, EspTwaiFrame, StandardId}, @@ -35,7 +35,7 @@ fn main() -> ! { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); // Set the tx pin as open drain. Skip this if using transceivers. let can_tx_pin = io.pins.gpio0.into_open_drain_output(); diff --git a/examples/src/bin/ulp_riscv_core_basic.rs b/examples/src/bin/ulp_riscv_core_basic.rs index 29f56ad5cc7..a63942d79e0 100644 --- a/examples/src/bin/ulp_riscv_core_basic.rs +++ b/examples/src/bin/ulp_riscv_core_basic.rs @@ -10,7 +10,7 @@ use esp_backtrace as _; use esp_hal::{ - gpio::{rtc_io::*, IO}, + gpio::{rtc_io::*, Io}, peripherals::Peripherals, prelude::*, ulp_core, @@ -21,7 +21,7 @@ use esp_println::{print, println}; fn main() -> ! { let peripherals = Peripherals::take(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let pin = io.pins.gpio1.into_low_power().into_push_pull_output(); 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 45a526f8fda..6ee4b894eff 100644 --- a/examples/src/bin/usb_serial.rs +++ b/examples/src/bin/usb_serial.rs @@ -11,8 +11,8 @@ use core::ptr::addr_of_mut; use esp_backtrace as _; use esp_hal::{ - gpio::IO, - otg_fs::{UsbBus, USB}, + gpio::Io, + otg_fs::{Usb, UsbBus}, peripherals::Peripherals, prelude::*, }; @@ -25,9 +25,9 @@ static mut EP_MEMORY: [u32; 1024] = [0; 1024]; fn main() -> ! { let peripherals = Peripherals::take(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); - let usb = USB::new(peripherals.USB0, io.pins.gpio19, io.pins.gpio20); + let usb = Usb::new(peripherals.USB0, io.pins.gpio19, io.pins.gpio20); let usb_bus = UsbBus::new(usb, unsafe { &mut *addr_of_mut!(EP_MEMORY) }); let mut serial = SerialPort::new(&usb_bus); diff --git a/hil-test/tests/gpio.rs b/hil-test/tests/gpio.rs index 80d1641befe..acec9947c53 100644 --- a/hil-test/tests/gpio.rs +++ b/hil-test/tests/gpio.rs @@ -16,7 +16,7 @@ use esp_hal::{ clock::ClockControl, delay::Delay, embassy, - gpio::{GpioPin, Input, Output, OutputPin, PullDown, PushPull, Unknown, IO}, + gpio::{GpioPin, Input, Io, Output, OutputPin, PullDown, PushPull, Unknown}, macros::handler, peripherals::Peripherals, system::SystemExt, @@ -39,7 +39,7 @@ impl Context { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX); io.set_interrupt_handler(interrupt_handler); let delay = Delay::new(&clocks); diff --git a/hil-test/tests/spi_full_duplex.rs b/hil-test/tests/spi_full_duplex.rs index c6d7e50ffd0..b5a1cc6a4a7 100644 --- a/hil-test/tests/spi_full_duplex.rs +++ b/hil-test/tests/spi_full_duplex.rs @@ -16,7 +16,7 @@ use embedded_hal::spi::SpiBus; use esp_backtrace as _; use esp_hal::{ clock::ClockControl, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, spi::{master::Spi, FullDuplexMode, SpiMode}, @@ -32,7 +32,7 @@ impl Context { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio0; let miso = io.pins.gpio2; let mosi = io.pins.gpio4; diff --git a/hil-test/tests/spi_full_duplex_dma.rs b/hil-test/tests/spi_full_duplex_dma.rs index 14078c3f3c3..82bf64ebba1 100644 --- a/hil-test/tests/spi_full_duplex_dma.rs +++ b/hil-test/tests/spi_full_duplex_dma.rs @@ -19,7 +19,7 @@ use esp_hal::{ clock::ClockControl, dma::{Dma, DmaPriority}, dma_buffers, - gpio::IO, + gpio::Io, peripherals::Peripherals, prelude::*, spi::{ @@ -44,7 +44,7 @@ mod tests { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio0; let miso = io.pins.gpio2; let mosi = io.pins.gpio4; @@ -87,7 +87,7 @@ mod tests { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio0; let miso = io.pins.gpio2; let mosi = io.pins.gpio4; @@ -131,7 +131,7 @@ mod tests { let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio0; let miso = io.pins.gpio2; let mosi = io.pins.gpio4; diff --git a/hil-test/tests/uart.rs b/hil-test/tests/uart.rs index c83d578922c..4ee7cd982cc 100644 --- a/hil-test/tests/uart.rs +++ b/hil-test/tests/uart.rs @@ -14,7 +14,7 @@ use embedded_hal_02::serial::{Read, Write}; use esp_backtrace as _; use esp_hal::{ clock::ClockControl, - gpio::IO, + gpio::Io, peripherals::{Peripherals, UART0}, prelude::*, uart::{config::Config, TxRxPins, Uart}, @@ -31,7 +31,7 @@ impl Context { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let pins = TxRxPins::new_tx_rx( io.pins.gpio2.into_push_pull_output(), io.pins.gpio4.into_floating_input(), diff --git a/hil-test/tests/uart_async.rs b/hil-test/tests/uart_async.rs index 028eae2b548..4c6bd306b74 100644 --- a/hil-test/tests/uart_async.rs +++ b/hil-test/tests/uart_async.rs @@ -13,7 +13,7 @@ use defmt_rtt as _; use esp_backtrace as _; use esp_hal::{ clock::ClockControl, - gpio::IO, + gpio::Io, peripherals::{Peripherals, UART0}, prelude::*, uart::{config::Config, TxRxPins, Uart, UartRx, UartTx}, @@ -30,7 +30,7 @@ impl Context { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let pins = TxRxPins::new_tx_rx( io.pins.gpio2.into_push_pull_output(), io.pins.gpio4.into_floating_input(),