Camel case structs (#1473)
* Remove uneeded usb generics * Ensure all structs are consistently CamelCased * changelog
This commit is contained in:
parent
f5dfca7f27
commit
56a7553b2d
@ -11,7 +11,7 @@
|
|||||||
//! ## Example
|
//! ## Example
|
||||||
//!
|
//!
|
||||||
//! ```rust,ignore
|
//! ```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 = Rmt::new(peripherals.RMT, 80.MHz(), &clocks).unwrap();
|
||||||
//!
|
//!
|
||||||
//! let rmt_buffer = smartLedBuffer!(1);
|
//! let rmt_buffer = smartLedBuffer!(1);
|
||||||
|
|||||||
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Created virtual peripherals for CPU control and radio clocks, rather than splitting them from `SYSTEM` (#1428)
|
- 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
|
### Removed
|
||||||
|
|
||||||
|
|||||||
@ -192,13 +192,13 @@ impl RegisterAccess for ADC2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Analog-to-Digital Converter peripheral driver.
|
/// Analog-to-Digital Converter peripheral driver.
|
||||||
pub struct ADC<'d, ADC> {
|
pub struct Adc<'d, ADC> {
|
||||||
_adc: PeripheralRef<'d, ADC>,
|
_adc: PeripheralRef<'d, ADC>,
|
||||||
attenuations: [Option<Attenuation>; NUM_ATTENS],
|
attenuations: [Option<Attenuation>; NUM_ATTENS],
|
||||||
active_channel: Option<u8>,
|
active_channel: Option<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, ADCI> ADC<'d, ADCI>
|
impl<'d, ADCI> Adc<'d, ADCI>
|
||||||
where
|
where
|
||||||
ADCI: RegisterAccess,
|
ADCI: RegisterAccess,
|
||||||
{
|
{
|
||||||
@ -270,7 +270,7 @@ where
|
|||||||
.sar_read_ctrl2()
|
.sar_read_ctrl2()
|
||||||
.modify(|_, w| w.sar2_data_inv().set_bit());
|
.modify(|_, w| w.sar2_data_inv().set_bit());
|
||||||
|
|
||||||
ADC {
|
Adc {
|
||||||
_adc: adc_instance.into_ref(),
|
_adc: adc_instance.into_ref(),
|
||||||
attenuations: config.attenuations,
|
attenuations: config.attenuations,
|
||||||
active_channel: None,
|
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() {
|
pub fn enable_hall_sensor() {
|
||||||
// Connect hall sensor
|
// Connect hall sensor
|
||||||
unsafe { &*RTC_IO::ptr() }
|
unsafe { &*RTC_IO::ptr() }
|
||||||
@ -341,7 +341,7 @@ impl<'d, ADC1> ADC<'d, ADC1> {
|
|||||||
|
|
||||||
#[cfg(feature = "embedded-hal-02")]
|
#[cfg(feature = "embedded-hal-02")]
|
||||||
impl<'d, ADCI, PIN> embedded_hal_02::adc::OneShot<ADCI, u16, super::AdcPin<PIN, ADCI>>
|
impl<'d, ADCI, PIN> embedded_hal_02::adc::OneShot<ADCI, u16, super::AdcPin<PIN, ADCI>>
|
||||||
for ADC<'d, ADCI>
|
for Adc<'d, ADCI>
|
||||||
where
|
where
|
||||||
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + super::AdcChannel,
|
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + super::AdcChannel,
|
||||||
ADCI: RegisterAccess,
|
ADCI: RegisterAccess,
|
||||||
|
|||||||
@ -397,13 +397,13 @@ impl super::CalibrationAccess for crate::peripherals::ADC2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Analog-to-Digital Converter peripheral driver.
|
/// Analog-to-Digital Converter peripheral driver.
|
||||||
pub struct ADC<'d, ADCI> {
|
pub struct Adc<'d, ADCI> {
|
||||||
_adc: PeripheralRef<'d, ADCI>,
|
_adc: PeripheralRef<'d, ADCI>,
|
||||||
attenuations: [Option<Attenuation>; NUM_ATTENS],
|
attenuations: [Option<Attenuation>; NUM_ATTENS],
|
||||||
active_channel: Option<u8>,
|
active_channel: Option<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, ADCI> ADC<'d, ADCI>
|
impl<'d, ADCI> Adc<'d, ADCI>
|
||||||
where
|
where
|
||||||
ADCI: RegisterAccess + 'd,
|
ADCI: RegisterAccess + 'd,
|
||||||
{
|
{
|
||||||
@ -426,7 +426,7 @@ where
|
|||||||
.bits(0b11)
|
.bits(0b11)
|
||||||
});
|
});
|
||||||
|
|
||||||
ADC {
|
Adc {
|
||||||
_adc: adc_instance.into_ref(),
|
_adc: adc_instance.into_ref(),
|
||||||
attenuations: config.attenuations,
|
attenuations: config.attenuations,
|
||||||
active_channel: None,
|
active_channel: None,
|
||||||
@ -540,7 +540,7 @@ impl super::AdcCalEfuse for crate::peripherals::ADC2 {
|
|||||||
|
|
||||||
#[cfg(feature = "embedded-hal-02")]
|
#[cfg(feature = "embedded-hal-02")]
|
||||||
impl<'d, ADCI, PIN, CS> embedded_hal_02::adc::OneShot<ADCI, u16, super::AdcPin<PIN, ADCI, CS>>
|
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
|
where
|
||||||
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + super::AdcChannel,
|
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + super::AdcChannel,
|
||||||
ADCI: RegisterAccess,
|
ADCI: RegisterAccess,
|
||||||
|
|||||||
@ -401,13 +401,13 @@ impl super::CalibrationAccess for crate::peripherals::ADC2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Analog-to-Digital Converter peripheral driver.
|
/// Analog-to-Digital Converter peripheral driver.
|
||||||
pub struct ADC<'d, ADC> {
|
pub struct Adc<'d, ADC> {
|
||||||
_adc: PeripheralRef<'d, ADC>,
|
_adc: PeripheralRef<'d, ADC>,
|
||||||
active_channel: Option<u8>,
|
active_channel: Option<u8>,
|
||||||
last_init_code: u16,
|
last_init_code: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, ADCI> ADC<'d, ADCI>
|
impl<'d, ADCI> Adc<'d, ADCI>
|
||||||
where
|
where
|
||||||
ADCI: RegisterAccess,
|
ADCI: RegisterAccess,
|
||||||
{
|
{
|
||||||
@ -481,7 +481,7 @@ where
|
|||||||
.sar_amp_ctrl2()
|
.sar_amp_ctrl2()
|
||||||
.modify(|_, w| unsafe { w.sar_amp_wait3().bits(1) });
|
.modify(|_, w| unsafe { w.sar_amp_wait3().bits(1) });
|
||||||
|
|
||||||
ADC {
|
Adc {
|
||||||
_adc: adc_instance.into_ref(),
|
_adc: adc_instance.into_ref(),
|
||||||
active_channel: None,
|
active_channel: None,
|
||||||
last_init_code: 0,
|
last_init_code: 0,
|
||||||
@ -605,7 +605,7 @@ impl super::AdcCalEfuse for crate::peripherals::ADC2 {
|
|||||||
|
|
||||||
#[cfg(feature = "embedded-hal-02")]
|
#[cfg(feature = "embedded-hal-02")]
|
||||||
impl<'d, ADCI, PIN, CS> embedded_hal_02::adc::OneShot<ADCI, u16, AdcPin<PIN, ADCI, CS>>
|
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
|
where
|
||||||
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + AdcChannel,
|
PIN: embedded_hal_02::adc::Channel<ADCI, ID = u8> + AdcChannel,
|
||||||
ADCI: RegisterAccess,
|
ADCI: RegisterAccess,
|
||||||
|
|||||||
@ -12,12 +12,12 @@
|
|||||||
//! ## Example
|
//! ## Example
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```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 gpio25 = io.pins.gpio25.into_analog();
|
||||||
//! let gpio26 = io.pins.gpio26.into_analog();
|
//! let gpio26 = io.pins.gpio26.into_analog();
|
||||||
//!
|
//!
|
||||||
//! let mut dac1 = DAC1::new(peripherals.DAC1, gpio25);
|
//! let mut dac1 = Dac1::new(peripherals.DAC1, gpio25);
|
||||||
//! let mut dac2 = DAC2::new(peripherals.DAC2, gpio26);
|
//! let mut dac2 = Dac2::new(peripherals.DAC2, gpio26);
|
||||||
//!
|
//!
|
||||||
//! let mut delay = Delay::new(&clocks);
|
//! let mut delay = Delay::new(&clocks);
|
||||||
//!
|
//!
|
||||||
@ -53,11 +53,11 @@ cfg_if::cfg_if! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Digital-to-Analog Converter (DAC) Channel 1
|
/// Digital-to-Analog Converter (DAC) Channel 1
|
||||||
pub struct DAC1<'d> {
|
pub struct Dac1<'d> {
|
||||||
_inner: PeripheralRef<'d, peripherals::DAC1>,
|
_inner: PeripheralRef<'d, peripherals::DAC1>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d> DAC1<'d> {
|
impl<'d> Dac1<'d> {
|
||||||
/// Constructs a new DAC instance.
|
/// Constructs a new DAC instance.
|
||||||
pub fn new(dac: impl Peripheral<P = peripherals::DAC1> + 'd, _pin: Dac1Gpio) -> Self {
|
pub fn new(dac: impl Peripheral<P = peripherals::DAC1> + 'd, _pin: Dac1Gpio) -> Self {
|
||||||
crate::into_ref!(dac);
|
crate::into_ref!(dac);
|
||||||
@ -90,11 +90,11 @@ impl<'d> DAC1<'d> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Digital-to-Analog Converter (DAC) Channel 2
|
/// Digital-to-Analog Converter (DAC) Channel 2
|
||||||
pub struct DAC2<'d> {
|
pub struct Dac2<'d> {
|
||||||
_inner: PeripheralRef<'d, peripherals::DAC2>,
|
_inner: PeripheralRef<'d, peripherals::DAC2>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d> DAC2<'d> {
|
impl<'d> Dac2<'d> {
|
||||||
/// Constructs a new DAC instance.
|
/// Constructs a new DAC instance.
|
||||||
pub fn new(dac: impl Peripheral<P = peripherals::DAC2> + 'd, _pin: Dac2Gpio) -> Self {
|
pub fn new(dac: impl Peripheral<P = peripherals::DAC2> + 'd, _pin: Dac2Gpio) -> Self {
|
||||||
crate::into_ref!(dac);
|
crate::into_ref!(dac);
|
||||||
|
|||||||
@ -41,7 +41,7 @@
|
|||||||
//! #[cfg(feature = "embassy-time-timg0")]
|
//! #[cfg(feature = "embassy-time-timg0")]
|
||||||
//! embassy::init(&clocks, timer_group0.timer0);
|
//! 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
|
//! // GPIO 9 as input
|
||||||
//! let input = io.pins.gpio9.into_pull_down_input();
|
//! let input = io.pins.gpio9.into_pull_down_input();
|
||||||
//!
|
//!
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Example
|
//! ## Example
|
||||||
//! ```no_run
|
//! ```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 mut led = io.pins.gpio1.into_push_pull_output();
|
||||||
//! let button = io.pins.gpio9.into_pull_down_input();
|
//! let button = io.pins.gpio9.into_pull_down_input();
|
||||||
//!
|
//!
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
//!
|
//!
|
||||||
//! # Example
|
//! # Example
|
||||||
//! ```no_run
|
//! ```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
|
//! // configure GPIO 1 as LP output pin
|
||||||
//! let lp_pin = io.pins.gpio1.into_low_power().into_push_pull_output();
|
//! 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) {
|
unsafe fn apply_wakeup(&mut self, wakeup: bool, level: u8) {
|
||||||
let lp_io = &*$crate::peripherals::LP_IO::ptr();
|
let lp_io = &*$crate::peripherals::LP_IO::ptr();
|
||||||
lp_io.[< pin $gpionum >]().modify(|_, w| {
|
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) {
|
fn rtcio_pullup(&mut self, enable: bool) {
|
||||||
let lp_io = unsafe { &*$crate::peripherals::LP_IO::ptr() };
|
let lp_io = unsafe { &*$crate::peripherals::LP_IO::ptr() };
|
||||||
lp_io.[< gpio $gpionum >]().modify(|_, w| w.fun_wpu().bit(enable));
|
lp_io.[< gpio $gpionum >]().modify(|_, w| w.fun_wpu().bit(enable));
|
||||||
|
|||||||
@ -12,11 +12,11 @@
|
|||||||
//! interface for GPIO pins.
|
//! interface for GPIO pins.
|
||||||
//!
|
//!
|
||||||
//! To get access to the pins, you first need to convert them into a HAL
|
//! 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
|
//! ## Example
|
||||||
//! ```no_run
|
//! ```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();
|
//! let mut led = io.pins.gpio5.into_push_pull_output();
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
@ -100,7 +100,7 @@ impl InputMode for Unknown {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// RTC input pin mode
|
/// RTC input pin mode
|
||||||
pub struct RTCInput<MODE> {
|
pub struct RtcInput<MODE> {
|
||||||
_mode: PhantomData<MODE>,
|
_mode: PhantomData<MODE>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ impl OutputMode for Unknown {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// RTC output pin mode
|
/// RTC output pin mode
|
||||||
pub struct RTCOutput<MODE> {
|
pub struct RtcOutput<MODE> {
|
||||||
_mode: PhantomData<MODE>,
|
_mode: PhantomData<MODE>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,20 +155,6 @@ pub struct PushPull;
|
|||||||
/// Analog mode
|
/// Analog mode
|
||||||
pub struct Analog;
|
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)
|
/// Drive strength (values are approximates)
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub enum DriveStrength {
|
pub enum DriveStrength {
|
||||||
@ -199,7 +185,7 @@ pub enum RtcFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Trait implemented by RTC pins
|
/// Trait implemented by RTC pins
|
||||||
pub trait RTCPin: Pin {
|
pub trait RtcPin: Pin {
|
||||||
/// RTC number of the pin
|
/// RTC number of the pin
|
||||||
#[cfg(xtensa)]
|
#[cfg(xtensa)]
|
||||||
fn rtc_number(&self) -> u8;
|
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
|
/// Trait implemented by RTC pins which supporting internal pull-up / pull-down
|
||||||
/// resistors.
|
/// resistors.
|
||||||
pub trait RTCPinWithResistors: RTCPin {
|
pub trait RtcPinWithResistors: RtcPin {
|
||||||
/// Enable/disable the internal pull-up resistor
|
/// Enable/disable the internal pull-up resistor
|
||||||
fn rtcio_pullup(&mut self, enable: bool);
|
fn rtcio_pullup(&mut self, enable: bool);
|
||||||
/// Enable/disable the internal pull-down resistor
|
/// Enable/disable the internal pull-down resistor
|
||||||
@ -229,15 +215,15 @@ pub trait RTCPinWithResistors: RTCPin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Marker for RTC pins which support input mode
|
/// Marker for RTC pins which support input mode
|
||||||
pub trait RTCInputPin: RTCPin {}
|
pub trait RtcInputPin: RtcPin {}
|
||||||
/// Marker for RTC pins which support output mode
|
/// Marker for RTC pins which support output mode
|
||||||
pub trait RTCOutputPin: RTCPin {}
|
pub trait RtcOutputPin: RtcPin {}
|
||||||
|
|
||||||
/// Marker for pins which support analog mode
|
/// Marker for pins which support analog mode
|
||||||
pub trait AnalogPin {}
|
pub trait AnalogPin {}
|
||||||
|
|
||||||
/// Common trait implemented by pins
|
/// Common trait implemented by pins
|
||||||
pub trait Pin {
|
pub trait Pin: crate::private::Sealed {
|
||||||
/// GPIO number
|
/// GPIO number
|
||||||
fn number(&self) -> u8;
|
fn number(&self) -> u8;
|
||||||
|
|
||||||
@ -304,7 +290,7 @@ pub trait InputPin: Pin {
|
|||||||
|
|
||||||
/// Remove a connected `signal` from this input 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
|
/// pin with the given [input `signal`](`InputSignal`). Any other
|
||||||
/// connected signals remain intact.
|
/// connected signals remain intact.
|
||||||
fn disconnect_input_from_peripheral(&mut self, signal: InputSignal) -> &mut Self;
|
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`).
|
/// 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
|
/// pin with a previously connected [signal](`InputSignal`). Any other
|
||||||
/// outputs connected to the signal remain intact.
|
/// outputs connected to the signal remain intact.
|
||||||
fn disconnect_peripheral_from_output(&mut self) -> &mut Self;
|
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>
|
impl<MODE, const GPIONUM: u8> GpioPin<MODE, GPIONUM>
|
||||||
where
|
where
|
||||||
Self: GpioProperties,
|
Self: GpioProperties,
|
||||||
@ -1246,18 +1208,6 @@ where
|
|||||||
self.init_output(GPIO_FUNCTION, true);
|
self.init_output(GPIO_FUNCTION, true);
|
||||||
GpioPin { _mode: PhantomData }
|
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>
|
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
|
/// General Purpose Input/Output driver
|
||||||
pub struct IO {
|
pub struct Io {
|
||||||
_io_mux: IO_MUX,
|
_io_mux: IO_MUX,
|
||||||
/// The pins available on this chip
|
/// The pins available on this chip
|
||||||
pub pins: Pins,
|
pub pins: Pins,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IO {
|
impl Io {
|
||||||
/// Initialize the I/O driver.
|
/// Initialize the I/O driver.
|
||||||
pub fn new(gpio: GPIO, io_mux: IO_MUX) -> Self {
|
pub fn new(gpio: GPIO, io_mux: IO_MUX) -> Self {
|
||||||
Self::new_with_priority(gpio, io_mux, crate::interrupt::Priority::min())
|
Self::new_with_priority(gpio, io_mux, crate::interrupt::Priority::min())
|
||||||
@ -1903,7 +1853,7 @@ impl IO {
|
|||||||
|
|
||||||
let pins = gpio.split();
|
let pins = gpio.split();
|
||||||
|
|
||||||
IO {
|
Io {
|
||||||
_io_mux: io_mux,
|
_io_mux: io_mux,
|
||||||
pins,
|
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)?
|
$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 {
|
fn rtc_number(&self) -> u8 {
|
||||||
$rtc_pin
|
$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) {
|
fn rtcio_pullup(&mut self, enable: bool) {
|
||||||
let rtcio = unsafe { &*$crate::peripherals::RTC_IO::PTR };
|
let rtcio = unsafe { &*$crate::peripherals::RTC_IO::PTR };
|
||||||
@ -2175,7 +2125,7 @@ macro_rules! rtc_pins {
|
|||||||
paste::paste!{
|
paste::paste!{
|
||||||
impl<MODE> $crate::gpio::rtc_io::IntoLowPowerPin<$pin_num> for GpioPin<MODE, $pin_num> {
|
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> {
|
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);
|
self.rtc_set_config(false, true, $crate::gpio::RtcFunction::Rtc);
|
||||||
|
|
||||||
@ -2204,7 +2154,7 @@ macro_rules! rtc_pins {
|
|||||||
(
|
(
|
||||||
$pin_num:expr
|
$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) {
|
unsafe fn apply_wakeup(&mut self, wakeup: bool, level: u8) {
|
||||||
let rtc_cntl = unsafe { &*$crate::peripherals::RTC_CNTL::ptr() };
|
let rtc_cntl = unsafe { &*$crate::peripherals::RTC_CNTL::ptr() };
|
||||||
paste::paste! {
|
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) {
|
fn rtcio_pullup(&mut self, enable: bool) {
|
||||||
let io_mux = unsafe { &*$crate::peripherals::IO_MUX::ptr() };
|
let io_mux = unsafe { &*$crate::peripherals::IO_MUX::ptr() };
|
||||||
io_mux.gpio($pin_num).modify(|_, w| w.fun_wpu().bit(enable));
|
io_mux.gpio($pin_num).modify(|_, w| w.fun_wpu().bit(enable));
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
//!
|
//!
|
||||||
//! # Example
|
//! # Example
|
||||||
//! ```no_run
|
//! ```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
|
//! // configure GPIO 1 as ULP output pin
|
||||||
//! let lp_pin = io.pins.gpio1.into_low_power().into_push_pull_output();
|
//! let lp_pin = io.pins.gpio1.into_low_power().into_push_pull_output();
|
||||||
//! ```
|
//! ```
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
//! 10% duty using the ABPClock
|
//! 10% duty using the ABPClock
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```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);
|
//! ledc.set_global_slow_clock(LSGlobalClkSource::APBClk);
|
||||||
//!
|
//!
|
||||||
//! let mut lstimer0 = ledc.get_timer::<LowSpeed>(timer::Number::Timer0);
|
//! let mut lstimer0 = ledc.get_timer::<LowSpeed>(timer::Number::Timer0);
|
||||||
@ -37,7 +37,7 @@
|
|||||||
//! 10% duty using the ABPClock
|
//! 10% duty using the ABPClock
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```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);
|
//! let mut hstimer0 = ledc.get_timer::<HighSpeed>(timer::Number::Timer0);
|
||||||
//! hstimer0
|
//! hstimer0
|
||||||
@ -82,7 +82,7 @@ pub enum LSGlobalClkSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// LEDC (LED PWM Controller)
|
/// LEDC (LED PWM Controller)
|
||||||
pub struct LEDC<'d> {
|
pub struct Ledc<'d> {
|
||||||
_instance: PeripheralRef<'d, crate::peripherals::LEDC>,
|
_instance: PeripheralRef<'d, crate::peripherals::LEDC>,
|
||||||
ledc: &'d crate::peripherals::ledc::RegisterBlock,
|
ledc: &'d crate::peripherals::ledc::RegisterBlock,
|
||||||
clock_control_config: &'d Clocks<'d>,
|
clock_control_config: &'d Clocks<'d>,
|
||||||
@ -108,7 +108,7 @@ impl Speed for LowSpeed {
|
|||||||
const IS_HS: bool = false;
|
const IS_HS: bool = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d> LEDC<'d> {
|
impl<'d> Ledc<'d> {
|
||||||
/// Return a new LEDC
|
/// Return a new LEDC
|
||||||
pub fn new(
|
pub fn new(
|
||||||
_instance: impl Peripheral<P = crate::peripherals::LEDC> + 'd,
|
_instance: impl Peripheral<P = crate::peripherals::LEDC> + 'd,
|
||||||
@ -118,7 +118,7 @@ impl<'d> LEDC<'d> {
|
|||||||
PeripheralClockControl::enable(PeripheralEnable::Ledc);
|
PeripheralClockControl::enable(PeripheralEnable::Ledc);
|
||||||
|
|
||||||
let ledc = unsafe { &*crate::peripherals::LEDC::ptr() };
|
let ledc = unsafe { &*crate::peripherals::LEDC::ptr() };
|
||||||
LEDC {
|
Ledc {
|
||||||
_instance,
|
_instance,
|
||||||
ledc,
|
ledc,
|
||||||
clock_control_config,
|
clock_control_config,
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
//!
|
//!
|
||||||
//! // initialize peripheral
|
//! // initialize peripheral
|
||||||
//! let clock_cfg = PeripheralClockConfig::with_frequency(&clocks, 40.MHz()).unwrap();
|
//! 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
|
//! // connect operator0 to timer0
|
||||||
//! mcpwm.operator0.set_timer(&mcpwm.timer0);
|
//! mcpwm.operator0.set_timer(&mcpwm.timer0);
|
||||||
@ -81,7 +81,7 @@ type RegisterBlock = crate::peripherals::mcpwm0::RegisterBlock;
|
|||||||
|
|
||||||
/// The MCPWM peripheral
|
/// The MCPWM peripheral
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct MCPWM<'d, PWM> {
|
pub struct McPwm<'d, PWM> {
|
||||||
_inner: PeripheralRef<'d, PWM>,
|
_inner: PeripheralRef<'d, PWM>,
|
||||||
/// Timer0
|
/// Timer0
|
||||||
pub timer0: Timer<0, PWM>,
|
pub timer0: Timer<0, PWM>,
|
||||||
@ -97,7 +97,7 @@ pub struct MCPWM<'d, PWM> {
|
|||||||
pub operator2: Operator<2, 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)`
|
/// `pwm_clk = clocks.crypto_pwm_clock / (prescaler + 1)`
|
||||||
// clocks.crypto_pwm_clock normally is 160 MHz
|
// clocks.crypto_pwm_clock normally is 160 MHz
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
|||||||
@ -37,55 +37,36 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub trait UsbDp {}
|
pub trait UsbDp: crate::private::Sealed {}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub trait UsbDm {}
|
pub trait UsbDm: crate::private::Sealed {}
|
||||||
|
|
||||||
pub struct USB<'d, P, M>
|
pub struct Usb<'d> {
|
||||||
where
|
|
||||||
P: UsbDp + Send + Sync,
|
|
||||||
M: UsbDm + Send + Sync,
|
|
||||||
{
|
|
||||||
_usb0: PeripheralRef<'d, peripherals::USB0>,
|
_usb0: PeripheralRef<'d, peripherals::USB0>,
|
||||||
_usb_dp: PeripheralRef<'d, P>,
|
|
||||||
_usb_dm: PeripheralRef<'d, M>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, P, M> USB<'d, P, M>
|
impl<'d> Usb<'d> {
|
||||||
where
|
pub fn new<P, M>(
|
||||||
P: UsbDp + Send + Sync,
|
|
||||||
M: UsbDm + Send + Sync,
|
|
||||||
{
|
|
||||||
pub fn new(
|
|
||||||
usb0: impl Peripheral<P = peripherals::USB0> + 'd,
|
usb0: impl Peripheral<P = peripherals::USB0> + 'd,
|
||||||
usb_dp: impl Peripheral<P = P> + 'd,
|
_usb_dp: impl Peripheral<P = P> + 'd,
|
||||||
usb_dm: impl Peripheral<P = M> + 'd,
|
_usb_dm: impl Peripheral<P = M> + 'd,
|
||||||
) -> Self {
|
) -> Self
|
||||||
crate::into_ref!(usb_dp, usb_dm);
|
where
|
||||||
|
P: UsbDp + Send + Sync,
|
||||||
|
M: UsbDm + Send + Sync,
|
||||||
|
{
|
||||||
PeripheralClockControl::enable(PeripheralEnable::Usb);
|
PeripheralClockControl::enable(PeripheralEnable::Usb);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
_usb0: usb0.into_ref(),
|
_usb0: usb0.into_ref(),
|
||||||
_usb_dp: usb_dp,
|
|
||||||
_usb_dm: usb_dm,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<'d, P, M> Sync for USB<'d, P, M>
|
unsafe impl<'d> Sync for Usb<'d> {}
|
||||||
where
|
|
||||||
P: UsbDp + Send + Sync,
|
|
||||||
M: UsbDm + Send + Sync,
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl<'d, P, M> UsbPeripheral for USB<'d, P, M>
|
unsafe impl<'d> UsbPeripheral for Usb<'d> {
|
||||||
where
|
|
||||||
P: UsbDp + Send + Sync,
|
|
||||||
M: UsbDm + Send + Sync,
|
|
||||||
{
|
|
||||||
const REGISTERS: *const () = peripherals::USB0::ptr() as *const ();
|
const REGISTERS: *const () = peripherals::USB0::ptr() as *const ();
|
||||||
|
|
||||||
const HIGH_SPEED: bool = false;
|
const HIGH_SPEED: bool = false;
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
//!
|
//!
|
||||||
//! // setup a pulse couter
|
//! // setup a pulse couter
|
||||||
//! println!("setup pulse counter unit 0");
|
//! 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);
|
//! let mut u0 = pcnt.get_unit(unit_number);
|
||||||
//! u0.configure(unit::Config {
|
//! u0.configure(unit::Config {
|
||||||
//! low_limit: -100,
|
//! low_limit: -100,
|
||||||
@ -46,7 +46,7 @@
|
|||||||
//!
|
//!
|
||||||
//! println!("setup channel 0");
|
//! println!("setup channel 0");
|
||||||
//! let mut ch0 = u0.get_channel(channel::Number::Channel0);
|
//! 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_a = io.pins.gpio5.into_pull_up_input();
|
||||||
//! let mut pin_b = io.pins.gpio6.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 channel;
|
||||||
pub mod unit;
|
pub mod unit;
|
||||||
|
|
||||||
pub struct PCNT<'d> {
|
pub struct Pcnt<'d> {
|
||||||
_instance: PeripheralRef<'d, peripherals::PCNT>,
|
_instance: PeripheralRef<'d, peripherals::PCNT>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d> PCNT<'d> {
|
impl<'d> Pcnt<'d> {
|
||||||
/// Return a new PCNT
|
/// Return a new PCNT
|
||||||
pub fn new(
|
pub fn new(
|
||||||
_instance: impl Peripheral<P = peripherals::PCNT> + 'd,
|
_instance: impl Peripheral<P = peripherals::PCNT> + 'd,
|
||||||
@ -162,7 +162,7 @@ impl<'d> PCNT<'d> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PCNT { _instance }
|
Pcnt { _instance }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a unit
|
/// Return a unit
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
//! let mut rtc = Rtc::new(peripherals.LPWR, None);
|
//! let mut rtc = Rtc::new(peripherals.LPWR, None);
|
||||||
//! ```
|
//! ```
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use core::{
|
use core::{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use super::{Ext0WakeupSource, Ext1WakeupSource, TimerWakeupSource, WakeSource, WakeTriggers};
|
use super::{Ext0WakeupSource, Ext1WakeupSource, TimerWakeupSource, WakeSource, WakeTriggers};
|
||||||
use crate::{
|
use crate::{
|
||||||
gpio::{RTCPin, RtcFunction},
|
gpio::{RtcFunction, RtcPin},
|
||||||
rtc_cntl::{sleep::WakeupLevel, Clock, Rtc, RtcClock},
|
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) {
|
fn apply(&self, _rtc: &Rtc, triggers: &mut WakeTriggers, sleep_config: &mut RtcSleepConfig) {
|
||||||
// don't power down RTC peripherals
|
// don't power down RTC peripherals
|
||||||
sleep_config.set_rtc_peri_pd_en(false);
|
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) {
|
fn drop(&mut self) {
|
||||||
// should we have saved the pin configuration first?
|
// 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
|
// set pin back to IO_MUX (input_enable and func have no effect when pin is sent
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use super::{TimerWakeupSource, WakeSource, WakeTriggers, WakeupLevel};
|
use super::{TimerWakeupSource, WakeSource, WakeTriggers, WakeupLevel};
|
||||||
use crate::{
|
use crate::{
|
||||||
gpio::{RTCPinWithResistors, RtcFunction},
|
gpio::{RtcFunction, RtcPinWithResistors},
|
||||||
regi2c_write_mask,
|
regi2c_write_mask,
|
||||||
rtc_cntl::{sleep::RtcioWakeupSource, Clock, Rtc, RtcClock},
|
rtc_cntl::{sleep::RtcioWakeupSource, Clock, Rtc, RtcClock},
|
||||||
};
|
};
|
||||||
@ -116,7 +116,7 @@ impl WakeSource for TimerWakeupSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> RtcioWakeupSource<'a, 'b> {
|
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
|
// The pullup/pulldown part is like in gpio_deep_sleep_wakeup_prepare
|
||||||
let level = match level {
|
let level = match level {
|
||||||
WakeupLevel::High => {
|
WakeupLevel::High => {
|
||||||
|
|||||||
@ -61,9 +61,9 @@ impl Ext1WakeupSource<'_, '_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn wake_io_reset(gpio: &mut Pins) {
|
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 {
|
if wakeup_pins & (1 << pin.number()) != 0 {
|
||||||
pin.rtcio_pad_hold(false);
|
pin.rtcio_pad_hold(false);
|
||||||
pin.rtc_set_config(false, false, RtcFunction::Rtc);
|
pin.rtc_set_config(false, false, RtcFunction::Rtc);
|
||||||
|
|||||||
@ -7,7 +7,7 @@ use super::{
|
|||||||
WakeupLevel,
|
WakeupLevel,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
gpio::{RTCPin, RtcFunction},
|
gpio::{RtcFunction, RtcPin},
|
||||||
regi2c_write_mask,
|
regi2c_write_mask,
|
||||||
rtc_cntl::{sleep::RtcioWakeupSource, Clock, Rtc, RtcClock},
|
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) {
|
fn apply(&self, _rtc: &Rtc, triggers: &mut WakeTriggers, sleep_config: &mut RtcSleepConfig) {
|
||||||
// don't power down RTC peripherals
|
// don't power down RTC peripherals
|
||||||
sleep_config.set_rtc_peri_pd_en(false);
|
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) {
|
fn drop(&mut self) {
|
||||||
// should we have saved the pin configuration first?
|
// 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
|
// 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> {
|
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 };
|
let rtcio = unsafe { &*crate::peripherals::RTC_IO::PTR };
|
||||||
|
|
||||||
pin.rtc_set_config(true, true, RtcFunction::Rtc);
|
pin.rtc_set_config(true, true, RtcFunction::Rtc);
|
||||||
|
|||||||
@ -25,9 +25,9 @@ use core::cell::RefCell;
|
|||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
|
|
||||||
#[cfg(any(esp32, esp32s3))]
|
#[cfg(any(esp32, esp32s3))]
|
||||||
use crate::gpio::RTCPin as RtcIoWakeupPinType;
|
use crate::gpio::RtcPin as RtcIoWakeupPinType;
|
||||||
#[cfg(any(esp32c3, esp32c6))]
|
#[cfg(any(esp32c3, esp32c6))]
|
||||||
use crate::gpio::RTCPinWithResistors as RtcIoWakeupPinType;
|
use crate::gpio::RtcPinWithResistors as RtcIoWakeupPinType;
|
||||||
use crate::rtc_cntl::Rtc;
|
use crate::rtc_cntl::Rtc;
|
||||||
|
|
||||||
#[cfg_attr(esp32, path = "esp32.rs")]
|
#[cfg_attr(esp32, path = "esp32.rs")]
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Example
|
//! ## Example
|
||||||
//! ```rust
|
//! ```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 sclk = io.pins.gpio12;
|
||||||
//! let miso = io.pins.gpio11;
|
//! let miso = io.pins.gpio11;
|
||||||
//! let mosi = io.pins.gpio13;
|
//! let mosi = io.pins.gpio13;
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
//! ## Example
|
//! ## Example
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```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 sclk = io.pins.gpio12;
|
||||||
//! let miso = io.pins.gpio11;
|
//! let miso = io.pins.gpio11;
|
||||||
//! let mosi = io.pins.gpio13;
|
//! let mosi = io.pins.gpio13;
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
//! specified.
|
//! specified.
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```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(
|
//! let pins = TxRxPins::new_tx_rx(
|
||||||
//! io.pins.gpio1.into_push_pull_output(),
|
//! io.pins.gpio1.into_push_pull_output(),
|
||||||
//! io.pins.gpio2.into_floating_input(),
|
//! io.pins.gpio2.into_floating_input(),
|
||||||
|
|||||||
@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
analog::adc::{AdcConfig, Attenuation, ADC},
|
analog::adc::{Adc, AdcConfig, Attenuation},
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::{Peripherals, ADC1},
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
@ -26,7 +26,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "esp32")] {
|
if #[cfg(feature = "esp32")] {
|
||||||
let analog_pin = io.pins.gpio32.into_analog();
|
let analog_pin = io.pins.gpio32.into_analog();
|
||||||
@ -40,7 +40,7 @@ fn main() -> ! {
|
|||||||
// Create ADC instances
|
// Create ADC instances
|
||||||
let mut adc1_config = AdcConfig::new();
|
let mut adc1_config = AdcConfig::new();
|
||||||
let mut adc1_pin = adc1_config.enable_pin(analog_pin, Attenuation::Attenuation11dB);
|
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);
|
let delay = Delay::new(&clocks);
|
||||||
|
|
||||||
|
|||||||
@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
analog::adc::{AdcConfig, Attenuation, ADC},
|
analog::adc::{Adc, AdcConfig, Attenuation},
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::{Peripherals, ADC1},
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
@ -24,7 +24,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "esp32s3")] {
|
if #[cfg(feature = "esp32s3")] {
|
||||||
let analog_pin = io.pins.gpio3.into_analog();
|
let analog_pin = io.pins.gpio3.into_analog();
|
||||||
@ -46,7 +46,7 @@ fn main() -> ! {
|
|||||||
let mut adc1_config = AdcConfig::new();
|
let mut adc1_config = AdcConfig::new();
|
||||||
let mut adc1_pin =
|
let mut adc1_pin =
|
||||||
adc1_config.enable_pin_with_cal::<_, AdcCal>(analog_pin, Attenuation::Attenuation11dB);
|
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);
|
let delay = Delay::new(&clocks);
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
uart::{config::Config, TxRxPins, Uart},
|
uart::{config::Config, TxRxPins, Uart},
|
||||||
@ -30,7 +30,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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(
|
let pins = TxRxPins::new_tx_rx(
|
||||||
io.pins.gpio4.into_push_pull_output(),
|
io.pins.gpio4.into_push_pull_output(),
|
||||||
io.pins.gpio5.into_floating_input(),
|
io.pins.gpio5.into_floating_input(),
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use esp_backtrace as _;
|
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]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
@ -17,7 +17,7 @@ fn main() -> ! {
|
|||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
||||||
|
|
||||||
// Set GPIO0 as an output, and set its state high initially.
|
// 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();
|
let mut led = io.pins.gpio8.into_push_pull_output();
|
||||||
|
|
||||||
led.set_high();
|
led.set_high();
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::{AnyPin, Input, Output, PullDown, PushPull, IO},
|
gpio::{AnyPin, Input, Io, Output, PullDown, PushPull},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
@ -25,7 +25,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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:
|
// Set LED GPIOs as an output:
|
||||||
let led1 = io.pins.gpio8.into_push_pull_output();
|
let led1 = io.pins.gpio8.into_push_pull_output();
|
||||||
|
|||||||
@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
analog::dac::{DAC1, DAC2},
|
analog::dac::{Dac1, Dac2},
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
@ -27,7 +27,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "esp32")] {
|
if #[cfg(feature = "esp32")] {
|
||||||
@ -40,8 +40,8 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create DAC instances
|
// Create DAC instances
|
||||||
let mut dac1 = DAC1::new(peripherals.DAC1, dac1_pin);
|
let mut dac1 = Dac1::new(peripherals.DAC1, dac1_pin);
|
||||||
let mut dac2 = DAC2::new(peripherals.DAC2, dac2_pin);
|
let mut dac2 = Dac2::new(peripherals.DAC2, dac2_pin);
|
||||||
|
|
||||||
let delay = Delay::new(&clocks);
|
let delay = Delay::new(&clocks);
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use core::{cell::RefCell, ptr::addr_of_mut};
|
use core::cell::RefCell;
|
||||||
|
|
||||||
use critical_section::Mutex;
|
use critical_section::Mutex;
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
@ -31,6 +31,8 @@ fn main() -> ! {
|
|||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(not(feature = "esp32s3"))] {
|
if #[cfg(not(feature = "esp32s3"))] {
|
||||||
|
use core::ptr::addr_of_mut;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// top of stack
|
// top of stack
|
||||||
static mut _stack_start: u32;
|
static mut _stack_start: u32;
|
||||||
|
|||||||
@ -23,7 +23,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
embassy::{self},
|
embassy::{self},
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
i2c::I2C,
|
i2c::I2C,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -40,7 +40,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
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(
|
let i2c0 = I2C::new_async(
|
||||||
peripherals.I2C0,
|
peripherals.I2C0,
|
||||||
|
|||||||
@ -25,7 +25,7 @@ use esp_hal::{
|
|||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
embassy,
|
embassy,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
i2s::{asynch::*, DataFormat, I2s, Standard},
|
i2s::{asynch::*, DataFormat, I2s, Standard},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -43,7 +43,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
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);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
#[cfg(any(feature = "esp32", feature = "esp32s2"))]
|
#[cfg(any(feature = "esp32", feature = "esp32s2"))]
|
||||||
|
|||||||
@ -40,7 +40,7 @@ use esp_hal::{
|
|||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
embassy::{self},
|
embassy::{self},
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
i2s::{asynch::*, DataFormat, I2s, Standard},
|
i2s::{asynch::*, DataFormat, I2s, Standard},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -66,7 +66,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
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);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
#[cfg(any(feature = "esp32", feature = "esp32s2"))]
|
#[cfg(any(feature = "esp32", feature = "esp32s2"))]
|
||||||
|
|||||||
@ -21,7 +21,7 @@ use esp_hal::{
|
|||||||
cpu_control::{CpuControl, Stack},
|
cpu_control::{CpuControl, Stack},
|
||||||
embassy::{self, executor::Executor},
|
embassy::{self, executor::Executor},
|
||||||
get_core,
|
get_core,
|
||||||
gpio::{GpioPin, Output, PushPull, IO},
|
gpio::{GpioPin, Io, Output, PushPull},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
timer::TimerGroup,
|
timer::TimerGroup,
|
||||||
@ -56,7 +56,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
embassy::init(&clocks, timg0);
|
||||||
|
|||||||
@ -20,7 +20,7 @@ use esp_hal::{
|
|||||||
cpu_control::{CpuControl, Stack},
|
cpu_control::{CpuControl, Stack},
|
||||||
embassy::{self, executor::InterruptExecutor},
|
embassy::{self, executor::InterruptExecutor},
|
||||||
get_core,
|
get_core,
|
||||||
gpio::{GpioPin, Output, PushPull, IO},
|
gpio::{GpioPin, Io, Output, PushPull},
|
||||||
interrupt::Priority,
|
interrupt::Priority,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -75,7 +75,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
embassy::init(&clocks, timg0);
|
||||||
|
|||||||
@ -18,7 +18,7 @@ use esp_hal::{
|
|||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
embassy,
|
embassy,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
parl_io::{BitPackOrder, NoClkPin, ParlIoRxOnly, RxFourBits},
|
parl_io::{BitPackOrder, NoClkPin, ParlIoRxOnly, RxFourBits},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -36,7 +36,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
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);
|
let (_, mut tx_descriptors, rx_buffer, mut rx_descriptors) = dma_buffers!(0, 32000);
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ use esp_hal::{
|
|||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
embassy,
|
embassy,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
parl_io::{
|
parl_io::{
|
||||||
BitPackOrder,
|
BitPackOrder,
|
||||||
ClkOutPin,
|
ClkOutPin,
|
||||||
@ -47,7 +47,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
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);
|
let (tx_buffer, mut tx_descriptors, _, mut rx_descriptors) = dma_buffers!(32000, 0);
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
embassy::{self},
|
embassy::{self},
|
||||||
gpio::{Gpio5, Output, PushPull, IO},
|
gpio::{Gpio5, Io, Output, PushPull},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rmt::{asynch::RxChannelAsync, PulseCode, Rmt, RxChannelConfig, RxChannelCreatorAsync},
|
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);
|
let timer_group0 = esp_hal::timer::TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timer_group0);
|
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! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "esp32h2")] {
|
if #[cfg(feature = "esp32h2")] {
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
embassy,
|
embassy,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rmt::{asynch::TxChannelAsync, PulseCode, Rmt, TxChannelConfig, TxChannelCreatorAsync},
|
rmt::{asynch::TxChannelAsync, PulseCode, Rmt, TxChannelConfig, TxChannelCreatorAsync},
|
||||||
@ -33,7 +33,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
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! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "esp32h2")] {
|
if #[cfg(feature = "esp32h2")] {
|
||||||
|
|||||||
@ -29,7 +29,7 @@ use esp_hal::{
|
|||||||
dma::*,
|
dma::*,
|
||||||
dma_descriptors,
|
dma_descriptors,
|
||||||
embassy::{self},
|
embassy::{self},
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{
|
||||||
@ -49,7 +49,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
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 sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio4;
|
||||||
|
|||||||
@ -24,7 +24,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
embassy::{self},
|
embassy::{self},
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
interrupt,
|
interrupt,
|
||||||
peripherals::{self, Peripherals, TWAI0},
|
peripherals::{self, Peripherals, TWAI0},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -89,7 +89,7 @@ async fn main(spawner: Spawner) {
|
|||||||
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
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.
|
// Set the tx pin as open drain. Skip this if using transceivers.
|
||||||
let can_tx_pin = io.pins.gpio0.into_open_drain_output();
|
let can_tx_pin = io.pins.gpio0.into_open_drain_output();
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
embassy::{self},
|
embassy::{self},
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
timer::TimerGroup,
|
timer::TimerGroup,
|
||||||
@ -31,7 +31,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timg0);
|
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"))]
|
#[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))]
|
||||||
let mut input = io.pins.gpio0.into_pull_down_input();
|
let mut input = io.pins.gpio0.into_pull_down_input();
|
||||||
#[cfg(not(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3")))]
|
#[cfg(not(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3")))]
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
etm::Etm,
|
etm::Etm,
|
||||||
gpio::{etm::GpioEtmChannels, IO},
|
gpio::{etm::GpioEtmChannels, Io},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
systimer::{etm::SysTimerEtmEvent, SystemTimer},
|
systimer::{etm::SysTimerEtmEvent, SystemTimer},
|
||||||
@ -23,7 +23,7 @@ fn main() -> ! {
|
|||||||
let mut alarm0 = syst.alarm0.into_periodic();
|
let mut alarm0 = syst.alarm0.into_periodic();
|
||||||
alarm0.set_period(1u32.secs());
|
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();
|
let mut led = io.pins.gpio1.into_push_pull_output();
|
||||||
|
|
||||||
// setup ETM
|
// setup ETM
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
etm::Etm,
|
etm::Etm,
|
||||||
gpio::{etm::GpioEtmChannels, IO},
|
gpio::{etm::GpioEtmChannels, Io},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
@ -17,7 +17,7 @@ use esp_hal::{
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let peripherals = Peripherals::take();
|
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 mut led = io.pins.gpio1.into_push_pull_output();
|
||||||
let button = io.pins.gpio9.into_pull_down_input();
|
let button = io.pins.gpio9.into_pull_down_input();
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::{self, Event, Input, PullDown, IO},
|
gpio::{self, Event, Input, Io, PullDown},
|
||||||
macros::ram,
|
macros::ram,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -35,7 +35,7 @@ fn main() -> ! {
|
|||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
||||||
|
|
||||||
// Set GPIO2 as an output, and set its state high initially.
|
// 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);
|
io.set_interrupt_handler(handler);
|
||||||
let mut led = io.pins.gpio2.into_push_pull_output();
|
let mut led = io.pins.gpio2.into_push_pull_output();
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rmt::Rmt,
|
rmt::Rmt,
|
||||||
@ -36,7 +36,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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
|
// Each devkit uses a unique GPIO for the RGB LED, so in order to support
|
||||||
// all chips we must unfortunately use `#[cfg]`s:
|
// all chips we must unfortunately use `#[cfg]`s:
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use esp_backtrace as _;
|
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;
|
use esp_println::println;
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
@ -21,7 +21,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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
|
// Create a new peripheral object with the described wiring and standard
|
||||||
// I2C clock speed:
|
// I2C clock speed:
|
||||||
|
|||||||
@ -26,7 +26,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
i2c::I2C,
|
i2c::I2C,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -40,7 +40,7 @@ fn main() -> ! {
|
|||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
||||||
|
|
||||||
let delay = Delay::new(&clocks);
|
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
|
// Create a new peripheral object with the described wiring
|
||||||
// and standard I2C clock speed
|
// and standard I2C clock speed
|
||||||
|
|||||||
@ -21,7 +21,7 @@ use esp_hal::{
|
|||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
i2s::{DataFormat, I2s, I2sReadDma, Standard},
|
i2s::{DataFormat, I2s, I2sReadDma, Standard},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -34,7 +34,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
#[cfg(any(feature = "esp32", feature = "esp32s2"))]
|
#[cfg(any(feature = "esp32", feature = "esp32s2"))]
|
||||||
|
|||||||
@ -36,7 +36,7 @@ use esp_hal::{
|
|||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
i2s::{DataFormat, I2s, I2sWriteDma, Standard},
|
i2s::{DataFormat, I2s, I2sWriteDma, Standard},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -56,7 +56,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
#[cfg(any(feature = "esp32", feature = "esp32s2"))]
|
#[cfg(any(feature = "esp32", feature = "esp32s2"))]
|
||||||
|
|||||||
@ -28,7 +28,7 @@ use esp_hal::{
|
|||||||
delay::Delay,
|
delay::Delay,
|
||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
lcd_cam::{
|
lcd_cam::{
|
||||||
lcd::i8080::{Config, TxEightBits, I8080},
|
lcd::i8080::{Config, TxEightBits, I8080},
|
||||||
LcdCam,
|
LcdCam,
|
||||||
@ -44,7 +44,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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_backlight = io.pins.gpio45;
|
||||||
let lcd_reset = io.pins.gpio4;
|
let lcd_reset = io.pins.gpio4;
|
||||||
|
|||||||
@ -11,13 +11,13 @@
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
ledc::{
|
ledc::{
|
||||||
channel::{self, ChannelIFace},
|
channel::{self, ChannelIFace},
|
||||||
timer::{self, TimerIFace},
|
timer::{self, TimerIFace},
|
||||||
LSGlobalClkSource,
|
LSGlobalClkSource,
|
||||||
|
Ledc,
|
||||||
LowSpeed,
|
LowSpeed,
|
||||||
LEDC,
|
|
||||||
},
|
},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -29,10 +29,10 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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 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);
|
ledc.set_global_slow_clock(LSGlobalClkSource::APBClk);
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
gpio::{lp_io::IntoLowPowerPin, IO},
|
gpio::{lp_io::IntoLowPowerPin, Io},
|
||||||
lp_core::{LpCore, LpCoreWakeupSource},
|
lp_core::{LpCore, LpCoreWakeupSource},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -24,7 +24,7 @@ fn main() -> ! {
|
|||||||
let peripherals = Peripherals::take();
|
let peripherals = Peripherals::take();
|
||||||
|
|
||||||
// configure GPIO 1 as LP output pin
|
// 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 lp_pin = io.pins.gpio1.into_low_power().into_push_pull_output();
|
||||||
|
|
||||||
let mut lp_core = LpCore::new(peripherals.LP_CORE);
|
let mut lp_core = LpCore::new(peripherals.LP_CORE);
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
gpio::{lp_io::IntoLowPowerPin, IO},
|
gpio::{lp_io::IntoLowPowerPin, Io},
|
||||||
i2c::lp_i2c::LpI2c,
|
i2c::lp_i2c::LpI2c,
|
||||||
lp_core::{LpCore, LpCoreWakeupSource},
|
lp_core::{LpCore, LpCoreWakeupSource},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
@ -24,7 +24,7 @@ use esp_println::println;
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let peripherals = Peripherals::take();
|
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_sda = io.pins.gpio6.into_low_power().into_open_drain_output();
|
||||||
let lp_scl = io.pins.gpio7.into_low_power().into_open_drain_output();
|
let lp_scl = io.pins.gpio7.into_low_power().into_open_drain_output();
|
||||||
|
|||||||
@ -13,16 +13,11 @@
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
gpio::{lp_io::IntoLowPowerPin, IO},
|
gpio::{lp_io::IntoLowPowerPin, Io},
|
||||||
lp_core::{LpCore, LpCoreWakeupSource},
|
lp_core::{LpCore, LpCoreWakeupSource},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
uart::{
|
uart::{config::Config, lp_uart::LpUart, TxRxPins, Uart},
|
||||||
config::{Config, DataBits, Parity, StopBits},
|
|
||||||
lp_uart::LpUart,
|
|
||||||
TxRxPins,
|
|
||||||
Uart,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
|
||||||
@ -32,7 +27,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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:
|
// Set up (HP) UART1:
|
||||||
|
|
||||||
|
|||||||
@ -11,8 +11,8 @@
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
mcpwm::{operator::PwmPinConfig, timer::PwmWorkingMode, PeripheralClockConfig, MCPWM},
|
mcpwm::{operator::PwmPinConfig, timer::PwmWorkingMode, McPwm, PeripheralClockConfig},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
@ -23,7 +23,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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;
|
let pin = io.pins.gpio0;
|
||||||
|
|
||||||
// initialize peripheral
|
// initialize peripheral
|
||||||
@ -32,7 +32,7 @@ fn main() -> ! {
|
|||||||
#[cfg(not(feature = "esp32h2"))]
|
#[cfg(not(feature = "esp32h2"))]
|
||||||
let clock_cfg = PeripheralClockConfig::with_frequency(&clocks, 32.MHz()).unwrap();
|
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
|
// connect operator0 to timer0
|
||||||
mcpwm.operator0.set_timer(&mcpwm.timer0);
|
mcpwm.operator0.set_timer(&mcpwm.timer0);
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use esp_hal::{
|
|||||||
delay::Delay,
|
delay::Delay,
|
||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
parl_io::{BitPackOrder, NoClkPin, ParlIoRxOnly, RxFourBits},
|
parl_io::{BitPackOrder, NoClkPin, ParlIoRxOnly, RxFourBits},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -27,7 +27,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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);
|
let (_, mut tx_descriptors, rx_buffer, mut rx_descriptors) = dma_buffers!(0, 32000);
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ use esp_hal::{
|
|||||||
delay::Delay,
|
delay::Delay,
|
||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
parl_io::{
|
parl_io::{
|
||||||
BitPackOrder,
|
BitPackOrder,
|
||||||
ClkOutPin,
|
ClkOutPin,
|
||||||
@ -38,7 +38,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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);
|
let (tx_buffer, mut tx_descriptors, _, mut rx_descriptors) = dma_buffers!(32000, 0);
|
||||||
|
|
||||||
|
|||||||
@ -16,9 +16,9 @@ use core::{cell::RefCell, cmp::min, sync::atomic::Ordering};
|
|||||||
use critical_section::Mutex;
|
use critical_section::Mutex;
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
interrupt::Priority,
|
interrupt::Priority,
|
||||||
pcnt::{channel, channel::PcntSource, unit, PCNT},
|
pcnt::{channel, channel::PcntSource, unit, Pcnt},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
@ -32,11 +32,11 @@ static VALUE: AtomicI32 = AtomicI32::new(0);
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let peripherals = Peripherals::take();
|
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:
|
// Set up a pulse counter:
|
||||||
println!("setup pulse counter unit 0");
|
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);
|
let mut u0 = pcnt.get_unit(unit::Number::Unit1);
|
||||||
u0.configure(unit::Config {
|
u0.configure(unit::Config {
|
||||||
low_limit: -100,
|
low_limit: -100,
|
||||||
|
|||||||
@ -33,7 +33,7 @@ use esp_hal::{
|
|||||||
delay::Delay,
|
delay::Delay,
|
||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{
|
||||||
@ -50,7 +50,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "esp32")] {
|
if #[cfg(feature = "esp32")] {
|
||||||
let sclk = io.pins.gpio0;
|
let sclk = io.pins.gpio0;
|
||||||
|
|||||||
@ -10,7 +10,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rmt::{PulseCode, Rmt, RxChannel, RxChannelConfig, RxChannelCreator},
|
rmt::{PulseCode, Rmt, RxChannel, RxChannelConfig, RxChannelCreator},
|
||||||
@ -25,7 +25,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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();
|
let mut out = io.pins.gpio5.into_push_pull_output();
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rmt::{PulseCode, Rmt, TxChannel, TxChannelConfig, TxChannelCreator},
|
rmt::{PulseCode, Rmt, TxChannel, TxChannelConfig, TxChannelCreator},
|
||||||
@ -23,7 +23,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "esp32h2")] {
|
if #[cfg(feature = "esp32h2")] {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use esp_hal::{
|
|||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
entry,
|
entry,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rtc_cntl::{
|
rtc_cntl::{
|
||||||
@ -34,7 +34,7 @@ fn main() -> ! {
|
|||||||
|
|
||||||
let mut rtc = Rtc::new(peripherals.LPWR, None);
|
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;
|
let mut ext0_pin = io.pins.gpio4;
|
||||||
|
|
||||||
println!("up and runnning!");
|
println!("up and runnning!");
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use esp_hal::{
|
|||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
entry,
|
entry,
|
||||||
gpio::{RTCPin, IO},
|
gpio::{Io, RtcPin},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rtc_cntl::{
|
rtc_cntl::{
|
||||||
@ -34,7 +34,7 @@ fn main() -> ! {
|
|||||||
|
|
||||||
let mut rtc = Rtc::new(peripherals.LPWR, None);
|
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_0 = io.pins.gpio4;
|
||||||
let mut pin_2 = io.pins.gpio2;
|
let mut pin_2 = io.pins.gpio2;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ fn main() -> ! {
|
|||||||
let mut delay = Delay::new(&clocks);
|
let mut delay = Delay::new(&clocks);
|
||||||
|
|
||||||
let timer = TimerWakeupSource::new(Duration::from_secs(30));
|
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);
|
let ext1 = Ext1WakeupSource::new(&mut wakeup_pins, WakeupLevel::High);
|
||||||
println!("sleeping!");
|
println!("sleeping!");
|
||||||
delay.delay_millis(100);
|
delay.delay_millis(100);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use esp_hal::{
|
|||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
entry,
|
entry,
|
||||||
gpio::{RTCPinWithResistors, IO},
|
gpio::{Io, RtcPinWithResistors},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rtc_cntl::{
|
rtc_cntl::{
|
||||||
@ -34,7 +34,7 @@ fn main() -> ! {
|
|||||||
|
|
||||||
let mut rtc = Rtc::new(peripherals.LPWR, None);
|
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 pin2 = io.pins.gpio2;
|
||||||
let mut pin3 = io.pins.gpio3;
|
let mut pin3 = io.pins.gpio3;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ fn main() -> ! {
|
|||||||
let mut delay = Delay::new(&clocks);
|
let mut delay = Delay::new(&clocks);
|
||||||
let timer = TimerWakeupSource::new(Duration::from_secs(10));
|
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 pin2, WakeupLevel::Low),
|
||||||
(&mut pin3, WakeupLevel::High),
|
(&mut pin3, WakeupLevel::High),
|
||||||
];
|
];
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use esp_hal::{
|
|||||||
delay::Delay,
|
delay::Delay,
|
||||||
entry,
|
entry,
|
||||||
gpio,
|
gpio,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rtc_cntl::{
|
rtc_cntl::{
|
||||||
@ -34,7 +34,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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);
|
let mut rtc = Rtc::new(peripherals.LPWR, None);
|
||||||
|
|
||||||
println!("up and runnning!");
|
println!("up and runnning!");
|
||||||
@ -47,13 +47,13 @@ fn main() -> ! {
|
|||||||
let timer = TimerWakeupSource::new(Duration::from_secs(10));
|
let timer = TimerWakeupSource::new(Duration::from_secs(10));
|
||||||
|
|
||||||
#[cfg(feature = "esp32c3")]
|
#[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.gpio2, WakeupLevel::Low),
|
||||||
(&mut io.pins.gpio3, WakeupLevel::High),
|
(&mut io.pins.gpio3, WakeupLevel::High),
|
||||||
];
|
];
|
||||||
|
|
||||||
#[cfg(feature = "esp32s3")]
|
#[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)];
|
&mut [(&mut io.pins.gpio18, WakeupLevel::Low)];
|
||||||
|
|
||||||
let rtcio = RtcioWakeupSource::new(wakeup_pins);
|
let rtcio = RtcioWakeupSource::new(wakeup_pins);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::{self, IO},
|
gpio::{self, Io},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{master::Spi, SpiMode},
|
spi::{master::Spi, SpiMode},
|
||||||
@ -50,7 +50,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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 sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio4;
|
||||||
|
|||||||
@ -24,7 +24,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{master::Spi, SpiMode},
|
spi::{master::Spi, SpiMode},
|
||||||
@ -37,7 +37,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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 sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio4;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{
|
||||||
@ -48,7 +48,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "esp32")] {
|
if #[cfg(feature = "esp32")] {
|
||||||
let sclk = io.pins.gpio0;
|
let sclk = io.pins.gpio0;
|
||||||
|
|||||||
@ -22,7 +22,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{master::Spi, SpiMode},
|
spi::{master::Spi, SpiMode},
|
||||||
@ -35,7 +35,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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 sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio4;
|
||||||
|
|||||||
@ -24,7 +24,7 @@ use esp_hal::{
|
|||||||
delay::Delay,
|
delay::Delay,
|
||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{
|
||||||
@ -40,7 +40,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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 sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio4;
|
||||||
|
|||||||
@ -34,7 +34,7 @@ use esp_hal::{
|
|||||||
delay::Delay,
|
delay::Delay,
|
||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{
|
||||||
@ -50,7 +50,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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 slave_sclk = io.pins.gpio0;
|
||||||
let mut master_sclk = io.pins.gpio4.into_push_pull_output();
|
let mut master_sclk = io.pins.gpio4.into_push_pull_output();
|
||||||
let slave_miso = io.pins.gpio1;
|
let slave_miso = io.pins.gpio1;
|
||||||
|
|||||||
@ -21,7 +21,7 @@ const IS_FIRST_SENDER: bool = true;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
twai::{self, filter::SingleStandardFilter, EspTwaiFrame, StandardId},
|
twai::{self, filter::SingleStandardFilter, EspTwaiFrame, StandardId},
|
||||||
@ -35,7 +35,7 @@ fn main() -> ! {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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.
|
// Set the tx pin as open drain. Skip this if using transceivers.
|
||||||
let can_tx_pin = io.pins.gpio0.into_open_drain_output();
|
let can_tx_pin = io.pins.gpio0.into_open_drain_output();
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
gpio::{rtc_io::*, IO},
|
gpio::{rtc_io::*, Io},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
ulp_core,
|
ulp_core,
|
||||||
@ -21,7 +21,7 @@ use esp_println::{print, println};
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let peripherals = Peripherals::take();
|
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 pin = io.pins.gpio1.into_low_power().into_push_pull_output();
|
||||||
|
|
||||||
let mut ulp_core = ulp_core::UlpCore::new(peripherals.ULP_RISCV_CORE);
|
let mut ulp_core = ulp_core::UlpCore::new(peripherals.ULP_RISCV_CORE);
|
||||||
|
|||||||
@ -11,8 +11,8 @@ use core::ptr::addr_of_mut;
|
|||||||
|
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
otg_fs::{UsbBus, USB},
|
otg_fs::{Usb, UsbBus},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
@ -25,9 +25,9 @@ static mut EP_MEMORY: [u32; 1024] = [0; 1024];
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let peripherals = Peripherals::take();
|
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 usb_bus = UsbBus::new(usb, unsafe { &mut *addr_of_mut!(EP_MEMORY) });
|
||||||
|
|
||||||
let mut serial = SerialPort::new(&usb_bus);
|
let mut serial = SerialPort::new(&usb_bus);
|
||||||
|
|||||||
@ -16,7 +16,7 @@ use esp_hal::{
|
|||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
embassy,
|
embassy,
|
||||||
gpio::{GpioPin, Input, Output, OutputPin, PullDown, PushPull, Unknown, IO},
|
gpio::{GpioPin, Input, Io, Output, OutputPin, PullDown, PushPull, Unknown},
|
||||||
macros::handler,
|
macros::handler,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
system::SystemExt,
|
system::SystemExt,
|
||||||
@ -39,7 +39,7 @@ impl Context {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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);
|
io.set_interrupt_handler(interrupt_handler);
|
||||||
|
|
||||||
let delay = Delay::new(&clocks);
|
let delay = Delay::new(&clocks);
|
||||||
|
|||||||
@ -16,7 +16,7 @@ use embedded_hal::spi::SpiBus;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{master::Spi, FullDuplexMode, SpiMode},
|
spi::{master::Spi, FullDuplexMode, SpiMode},
|
||||||
@ -32,7 +32,7 @@ impl Context {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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 sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio4;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ use esp_hal::{
|
|||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
dma::{Dma, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
dma_buffers,
|
dma_buffers,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{
|
||||||
@ -44,7 +44,7 @@ mod tests {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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 sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio4;
|
||||||
@ -87,7 +87,7 @@ mod tests {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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 sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio4;
|
||||||
@ -131,7 +131,7 @@ mod tests {
|
|||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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 sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio4;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use embedded_hal_02::serial::{Read, Write};
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::{Peripherals, UART0},
|
peripherals::{Peripherals, UART0},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
uart::{config::Config, TxRxPins, Uart},
|
uart::{config::Config, TxRxPins, Uart},
|
||||||
@ -31,7 +31,7 @@ impl Context {
|
|||||||
let peripherals = Peripherals::take();
|
let peripherals = Peripherals::take();
|
||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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(
|
let pins = TxRxPins::new_tx_rx(
|
||||||
io.pins.gpio2.into_push_pull_output(),
|
io.pins.gpio2.into_push_pull_output(),
|
||||||
io.pins.gpio4.into_floating_input(),
|
io.pins.gpio4.into_floating_input(),
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use defmt_rtt as _;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
gpio::IO,
|
gpio::Io,
|
||||||
peripherals::{Peripherals, UART0},
|
peripherals::{Peripherals, UART0},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
uart::{config::Config, TxRxPins, Uart, UartRx, UartTx},
|
uart::{config::Config, TxRxPins, Uart, UartRx, UartTx},
|
||||||
@ -30,7 +30,7 @@ impl Context {
|
|||||||
let peripherals = Peripherals::take();
|
let peripherals = Peripherals::take();
|
||||||
let system = peripherals.SYSTEM.split();
|
let system = peripherals.SYSTEM.split();
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
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(
|
let pins = TxRxPins::new_tx_rx(
|
||||||
io.pins.gpio2.into_push_pull_output(),
|
io.pins.gpio2.into_push_pull_output(),
|
||||||
io.pins.gpio4.into_floating_input(),
|
io.pins.gpio4.into_floating_input(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user