Camel case structs (#1473)

* Remove uneeded usb generics

* Ensure all structs are consistently CamelCased

* changelog
This commit is contained in:
Scott Mabin 2024-04-22 18:27:53 +01:00 committed by GitHub
parent f5dfca7f27
commit 56a7553b2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
81 changed files with 230 additions and 301 deletions

View File

@ -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);

View File

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Created virtual peripherals for CPU control and radio clocks, rather than splitting them from `SYSTEM` (#1428)
- `IO`, `ADC`, `DAC`, `RTC*`, `LEDC`, `PWM` and `PCNT` drivers have been converted to camel case format (#1473)
### Removed

View File

@ -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<Attenuation>; NUM_ATTENS],
active_channel: Option<u8>,
}
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<ADCI, u16, super::AdcPin<PIN, ADCI>>
for ADC<'d, ADCI>
for Adc<'d, ADCI>
where
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + super::AdcChannel,
ADCI: RegisterAccess,

View File

@ -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<Attenuation>; NUM_ATTENS],
active_channel: Option<u8>,
}
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<ADCI, u16, super::AdcPin<PIN, ADCI, CS>>
for ADC<'d, ADCI>
for Adc<'d, ADCI>
where
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + super::AdcChannel,
ADCI: RegisterAccess,

View File

@ -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<u8>,
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<ADCI, u16, AdcPin<PIN, ADCI, CS>>
for ADC<'d, ADCI>
for Adc<'d, ADCI>
where
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + AdcChannel,
ADCI: RegisterAccess,

View File

@ -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<P = peripherals::DAC1> + '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<P = peripherals::DAC2> + 'd, _pin: Dac2Gpio) -> Self {
crate::into_ref!(dac);

View File

@ -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();
//!

View File

@ -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();
//!

View File

@ -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<MODE> $crate::gpio::RTCPin for GpioPin<MODE, $gpionum> {
impl<MODE> $crate::gpio::RtcPin for GpioPin<MODE, $gpionum> {
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<MODE> $crate::gpio::RTCPinWithResistors for GpioPin<MODE, $gpionum> {
impl<MODE> $crate::gpio::RtcPinWithResistors for GpioPin<MODE, $gpionum> {
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));

View File

@ -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<MODE> {
pub struct RtcInput<MODE> {
_mode: PhantomData<MODE>,
}
@ -142,7 +142,7 @@ impl OutputMode for Unknown {
}
/// RTC output pin mode
pub struct RTCOutput<MODE> {
pub struct RtcOutput<MODE> {
_mode: PhantomData<MODE>,
}
@ -155,20 +155,6 @@ pub struct PushPull;
/// Analog mode
pub struct Analog;
/// Alternate mode
pub struct Alternate<MODE> {
_mode: PhantomData<MODE>,
}
#[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<const GPIONUM: u8> From<GpioPin<Unknown, GPIONUM>> for GpioPin<Alternate<AF1>, GPIONUM>
where
Self: GpioProperties,
<Self as GpioProperties>::PinType: IsOutputPin,
GpioPin<Unknown, GPIONUM>: GpioProperties,
<GpioPin<Unknown, GPIONUM> as GpioProperties>::PinType: IsOutputPin,
{
fn from(pin: GpioPin<Unknown, GPIONUM>) -> Self {
pin.into_alternate_1()
}
}
impl<const GPIONUM: u8> From<GpioPin<Unknown, GPIONUM>> for GpioPin<Alternate<AF2>, GPIONUM>
where
Self: GpioProperties,
<Self as GpioProperties>::PinType: IsOutputPin,
GpioPin<Unknown, GPIONUM>: GpioProperties,
<GpioPin<Unknown, GPIONUM> as GpioProperties>::PinType: IsOutputPin,
{
fn from(pin: GpioPin<Unknown, GPIONUM>) -> Self {
pin.into_alternate_2()
}
}
impl<MODE, const GPIONUM: u8> GpioPin<MODE, GPIONUM>
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<Alternate<AF1>, GPIONUM> {
self.init_output(AlternateFunction::Function1, false);
GpioPin { _mode: PhantomData }
}
/// Configures the pin into alternate mode two.
pub fn into_alternate_2(self) -> GpioPin<Alternate<AF2>, GPIONUM> {
self.init_output(AlternateFunction::Function2, false);
GpioPin { _mode: PhantomData }
}
}
impl<MODE, const GPIONUM: u8> OutputPin for GpioPin<MODE, GPIONUM>
@ -1878,13 +1828,13 @@ impl<MODE, TYPE> AnyPin<Input<MODE>, 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<MODE> $crate::gpio::RTCPin for GpioPin<MODE, $pin_num>
impl<MODE> $crate::gpio::RtcPin for GpioPin<MODE, $pin_num>
{
fn rtc_number(&self) -> u8 {
$rtc_pin
@ -2152,7 +2102,7 @@ macro_rules! rtc_pins {
}
$(
impl<MODE> $crate::gpio::RTCPinWithResistors for GpioPin<MODE, $pin_num>
impl<MODE> $crate::gpio::RtcPinWithResistors for GpioPin<MODE, $pin_num>
{
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<MODE> $crate::gpio::rtc_io::IntoLowPowerPin<$pin_num> for GpioPin<MODE, $pin_num> {
fn into_low_power(mut self) -> $crate::gpio::rtc_io::LowPowerPin<Unknown, $pin_num> {
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<MODE> $crate::gpio::RTCPin for GpioPin<MODE, $pin_num> {
impl<MODE> $crate::gpio::RtcPin for GpioPin<MODE, $pin_num> {
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<MODE> $crate::gpio::RTCPinWithResistors for GpioPin<MODE, $pin_num> {
impl<MODE> $crate::gpio::RtcPinWithResistors for GpioPin<MODE, $pin_num> {
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));

View File

@ -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();
//! ```

View File

@ -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::<LowSpeed>(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::<HighSpeed>(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<P = crate::peripherals::LEDC> + '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,

View File

@ -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(

View File

@ -37,55 +37,36 @@ use crate::{
};
#[doc(hidden)]
pub trait UsbDp {}
pub trait UsbDp: crate::private::Sealed {}
#[doc(hidden)]
pub trait UsbDm {}
pub trait UsbDm: crate::private::Sealed {}
pub struct USB<'d, P, M>
where
P: UsbDp + Send + Sync,
M: UsbDm + Send + Sync,
{
pub struct Usb<'d> {
_usb0: PeripheralRef<'d, peripherals::USB0>,
_usb_dp: PeripheralRef<'d, P>,
_usb_dm: PeripheralRef<'d, M>,
}
impl<'d, P, M> USB<'d, P, M>
where
P: UsbDp + Send + Sync,
M: UsbDm + Send + Sync,
{
pub fn new(
impl<'d> Usb<'d> {
pub fn new<P, M>(
usb0: impl Peripheral<P = peripherals::USB0> + 'd,
usb_dp: impl Peripheral<P = P> + 'd,
usb_dm: impl Peripheral<P = M> + 'd,
) -> Self {
crate::into_ref!(usb_dp, usb_dm);
_usb_dp: impl Peripheral<P = P> + 'd,
_usb_dm: impl Peripheral<P = M> + 'd,
) -> Self
where
P: UsbDp + Send + Sync,
M: UsbDm + Send + Sync,
{
PeripheralClockControl::enable(PeripheralEnable::Usb);
Self {
_usb0: usb0.into_ref(),
_usb_dp: usb_dp,
_usb_dm: usb_dm,
}
}
}
unsafe impl<'d, P, M> Sync for USB<'d, P, M>
where
P: UsbDp + Send + Sync,
M: UsbDm + Send + Sync,
{
}
unsafe impl<'d> Sync for Usb<'d> {}
unsafe impl<'d, P, M> UsbPeripheral for USB<'d, P, M>
where
P: UsbDp + Send + Sync,
M: UsbDm + Send + Sync,
{
unsafe impl<'d> UsbPeripheral for Usb<'d> {
const REGISTERS: *const () = peripherals::USB0::ptr() as *const ();
const HIGH_SPEED: bool = false;

View File

@ -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<P = peripherals::PCNT> + 'd,
@ -162,7 +162,7 @@ impl<'d> PCNT<'d> {
}
}
PCNT { _instance }
Pcnt { _instance }
}
/// Return a unit

View File

@ -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::{

View File

@ -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<P: RTCPin> WakeSource for Ext0WakeupSource<'_, P> {
impl<P: RtcPin> 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<P: RTCPin> WakeSource for Ext0WakeupSource<'_, P> {
}
}
impl<P: RTCPin> Drop for Ext0WakeupSource<'_, P> {
impl<P: RtcPin> 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

View File

@ -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 => {

View File

@ -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);

View File

@ -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<P: RTCPin> WakeSource for Ext0WakeupSource<'_, P> {
impl<P: RtcPin> 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<P: RTCPin> WakeSource for Ext0WakeupSource<'_, P> {
}
}
impl<P: RTCPin> Drop for Ext0WakeupSource<'_, P> {
impl<P: RtcPin> 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);

View File

@ -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")]

View File

@ -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;

View File

@ -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;

View File

@ -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(),

View File

@ -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::<ADC1>::new(peripherals.ADC1, adc1_config);
let mut adc1 = Adc::new(peripherals.ADC1, adc1_config);
let delay = Delay::new(&clocks);

View File

@ -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::<ADC1>::new(peripherals.ADC1, adc1_config);
let mut adc1 = Adc::new(peripherals.ADC1, adc1_config);
let delay = Delay::new(&clocks);

View File

@ -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(),

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -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;

View File

@ -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,

View File

@ -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"))]

View File

@ -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"))]

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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")] {

View File

@ -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")] {

View File

@ -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;

View File

@ -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();

View File

@ -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")))]

View File

@ -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

View File

@ -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();

View File

@ -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();

View File

@ -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:

View File

@ -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:

View File

@ -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

View File

@ -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"))]

View File

@ -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"))]

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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:

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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,

View File

@ -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;

View File

@ -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! {

View File

@ -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")] {

View File

@ -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!");

View File

@ -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);

View File

@ -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),
];

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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(),

View File

@ -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(),