From 0064766ef2fd1ba6c51109cb75901e2122d5413a Mon Sep 17 00:00:00 2001 From: Jesse Braham Date: Tue, 26 Sep 2023 09:07:57 -0700 Subject: [PATCH] No longer publicly expose the `PeripheralClockControl` struct (#817) * No longer publicly expose the `PeripheralClockControl` struct * Update examples as needed to get things building again * Update CHANGELOG.md * Address review feedback, fix a warning * Use a critical section for all devices other than the ESP32-C6/H2, as they modify multiple registers * Rebase and update `etm` driver to fix build errors --- CHANGELOG.md | 1 + esp-hal-common/src/aes/esp32.rs | 4 +- esp-hal-common/src/aes/esp32cX.rs | 4 +- esp-hal-common/src/aes/esp32s2.rs | 4 +- esp-hal-common/src/aes/esp32s3.rs | 4 +- esp-hal-common/src/aes/mod.rs | 14 +++--- esp-hal-common/src/analog/adc/riscv.rs | 31 ++---------- esp-hal-common/src/analog/mod.rs | 7 +-- esp-hal-common/src/assist_debug.rs | 13 ++--- esp-hal-common/src/dma/gdma.rs | 5 +- esp-hal-common/src/dma/mod.rs | 5 +- esp-hal-common/src/dma/pdma.rs | 7 +-- esp-hal-common/src/ecc.rs | 7 +-- esp-hal-common/src/etm.rs | 10 ++-- esp-hal-common/src/hmac.rs | 9 ++-- esp-hal-common/src/i2c.rs | 25 +++------- esp-hal-common/src/i2s.rs | 10 +--- esp-hal-common/src/ledc/mod.rs | 15 ++---- esp-hal-common/src/mcpwm/mod.rs | 19 +++----- esp-hal-common/src/otg_fs.rs | 5 +- esp-hal-common/src/parl_io.rs | 14 ++---- esp-hal-common/src/pcnt/mod.rs | 10 ++-- esp-hal-common/src/rmt.rs | 3 +- esp-hal-common/src/rsa/mod.rs | 16 ++----- esp-hal-common/src/sha.rs | 15 ++---- esp-hal-common/src/spi.rs | 46 ++++++++---------- esp-hal-common/src/system.rs | 16 +++---- esp-hal-common/src/timer.rs | 47 ++++++------------- esp-hal-common/src/twai/mod.rs | 4 +- esp-hal-common/src/uart.rs | 31 +++--------- esp-hal-common/src/usb_serial_jtag.rs | 18 +++---- esp-hal-smartled/src/lib.rs | 8 +--- esp32-hal/examples/advanced_serial.rs | 10 +--- esp32-hal/examples/aes.rs | 4 +- esp32-hal/examples/crc.rs | 14 ++---- esp32-hal/examples/embassy_hello_world.rs | 8 +--- esp32-hal/examples/embassy_i2c.rs | 9 +--- esp32-hal/examples/embassy_i2s_read.rs | 11 ++--- esp32-hal/examples/embassy_i2s_sound.rs | 11 ++--- esp32-hal/examples/embassy_multicore.rs | 8 +--- .../examples/embassy_multicore_interrupt.rs | 8 +--- esp32-hal/examples/embassy_multiprio.rs | 8 +--- esp32-hal/examples/embassy_rmt_rx.rs | 6 +-- esp32-hal/examples/embassy_rmt_tx.rs | 6 +-- esp32-hal/examples/embassy_serial.rs | 12 +---- esp32-hal/examples/embassy_spi.rs | 11 ++--- esp32-hal/examples/embassy_wait.rs | 8 +--- esp32-hal/examples/hello_rgb.rs | 10 +--- esp32-hal/examples/hello_world.rs | 14 ++---- .../examples/i2c_bmp180_calibration_data.rs | 3 +- esp32-hal/examples/i2c_display.rs | 9 +--- esp32-hal/examples/i2s_read.rs | 5 +- esp32-hal/examples/i2s_sound.rs | 5 +- esp32-hal/examples/ledc.rs | 8 +--- esp32-hal/examples/mcpwm.rs | 8 +--- esp32-hal/examples/multicore.rs | 14 ++---- esp32-hal/examples/pcnt_encoder.rs | 4 +- esp32-hal/examples/qspi_flash.rs | 5 +- esp32-hal/examples/ram.rs | 8 +--- esp32-hal/examples/rmt_rx.rs | 3 +- esp32-hal/examples/rmt_tx.rs | 3 +- esp32-hal/examples/rsa.rs | 4 +- esp32-hal/examples/serial_interrupts.rs | 14 ++---- esp32-hal/examples/sha.rs | 8 +--- esp32-hal/examples/spi_eh1_device_loopback.rs | 3 +- esp32-hal/examples/spi_eh1_loopback.rs | 3 +- .../spi_halfduplex_read_manufacturer_id.rs | 3 +- esp32-hal/examples/spi_loopback.rs | 3 +- esp32-hal/examples/spi_loopback_dma.rs | 5 +- esp32-hal/examples/timer_interrupt.rs | 14 ++---- esp32-hal/examples/watchdog.rs | 8 +--- esp32c2-hal/examples/adc.rs | 9 +--- esp32c2-hal/examples/adc_cal.rs | 9 +--- esp32c2-hal/examples/advanced_serial.rs | 16 ++----- esp32c2-hal/examples/crc.rs | 14 ++---- esp32c2-hal/examples/debug_assist.rs | 7 +-- esp32c2-hal/examples/direct-vectoring.rs | 4 +- esp32c2-hal/examples/ecc.rs | 4 +- esp32c2-hal/examples/embassy_hello_world.rs | 9 +--- esp32c2-hal/examples/embassy_i2c.rs | 10 +--- esp32c2-hal/examples/embassy_serial.rs | 15 ++---- esp32c2-hal/examples/embassy_spi.rs | 12 ++--- esp32c2-hal/examples/embassy_wait.rs | 9 +--- esp32c2-hal/examples/hello_world.rs | 14 ++---- .../examples/i2c_bmp180_calibration_data.rs | 3 +- esp32c2-hal/examples/i2c_display.rs | 9 +--- esp32c2-hal/examples/interrupt_preemption.rs | 6 +-- esp32c2-hal/examples/ledc.rs | 8 +--- esp32c2-hal/examples/qspi_flash.rs | 5 +- esp32c2-hal/examples/serial_interrupts.rs | 14 ++---- esp32c2-hal/examples/sha.rs | 8 +--- .../examples/spi_eh1_device_loopback.rs | 3 +- esp32c2-hal/examples/spi_eh1_loopback.rs | 3 +- .../spi_halfduplex_read_manufacturer_id.rs | 3 +- esp32c2-hal/examples/spi_loopback.rs | 3 +- esp32c2-hal/examples/spi_loopback_dma.rs | 5 +- esp32c2-hal/examples/timer_interrupt.rs | 8 +--- esp32c2-hal/examples/watchdog.rs | 8 +--- esp32c3-hal/examples/adc.rs | 9 +--- esp32c3-hal/examples/adc_cal.rs | 9 +--- esp32c3-hal/examples/advanced_serial.rs | 16 ++----- esp32c3-hal/examples/aes.rs | 4 +- esp32c3-hal/examples/crc.rs | 14 ++---- esp32c3-hal/examples/debug_assist.rs | 7 +-- esp32c3-hal/examples/direct-vectoring.rs | 4 +- esp32c3-hal/examples/embassy_hello_world.rs | 9 +--- esp32c3-hal/examples/embassy_i2c.rs | 10 +--- esp32c3-hal/examples/embassy_i2s_read.rs | 10 +--- esp32c3-hal/examples/embassy_i2s_sound.rs | 10 +--- esp32c3-hal/examples/embassy_serial.rs | 15 ++---- esp32c3-hal/examples/embassy_spi.rs | 12 ++--- esp32c3-hal/examples/embassy_wait.rs | 9 +--- esp32c3-hal/examples/hello_rgb.rs | 10 +--- esp32c3-hal/examples/hello_world.rs | 14 ++---- esp32c3-hal/examples/hmac.rs | 4 +- .../examples/i2c_bmp180_calibration_data.rs | 3 +- esp32c3-hal/examples/i2c_display.rs | 9 +--- esp32c3-hal/examples/i2s_read.rs | 5 +- esp32c3-hal/examples/i2s_sound.rs | 5 +- esp32c3-hal/examples/interrupt_preemption.rs | 6 +-- esp32c3-hal/examples/ledc.rs | 8 +--- esp32c3-hal/examples/qspi_flash.rs | 5 +- esp32c3-hal/examples/ram.rs | 8 +--- esp32c3-hal/examples/rmt_rx.rs | 3 +- esp32c3-hal/examples/rmt_tx.rs | 3 +- esp32c3-hal/examples/rsa.rs | 4 +- esp32c3-hal/examples/serial_interrupts.rs | 14 ++---- esp32c3-hal/examples/sha.rs | 8 +--- .../examples/spi_eh1_device_loopback.rs | 3 +- esp32c3-hal/examples/spi_eh1_loopback.rs | 3 +- .../spi_halfduplex_read_manufacturer_id.rs | 3 +- esp32c3-hal/examples/spi_loopback.rs | 3 +- esp32c3-hal/examples/spi_loopback_dma.rs | 5 +- esp32c3-hal/examples/timer_interrupt.rs | 14 ++---- esp32c3-hal/examples/twai.rs | 3 +- esp32c3-hal/examples/usb_serial_jtag.rs | 11 ++--- esp32c3-hal/examples/watchdog.rs | 8 +--- esp32c6-hal/examples/adc.rs | 9 +--- esp32c6-hal/examples/adc_cal.rs | 9 +--- esp32c6-hal/examples/advanced_serial.rs | 16 ++----- esp32c6-hal/examples/aes.rs | 4 +- esp32c6-hal/examples/crc.rs | 14 ++---- esp32c6-hal/examples/debug_assist.rs | 7 +-- esp32c6-hal/examples/direct-vectoring.rs | 4 +- esp32c6-hal/examples/ecc.rs | 4 +- esp32c6-hal/examples/embassy_hello_world.rs | 8 +--- esp32c6-hal/examples/embassy_i2c.rs | 9 +--- esp32c6-hal/examples/embassy_i2s_read.rs | 10 +--- esp32c6-hal/examples/embassy_i2s_sound.rs | 10 +--- esp32c6-hal/examples/embassy_parl_io_rx.rs | 9 +--- esp32c6-hal/examples/embassy_parl_io_tx.rs | 9 +--- esp32c6-hal/examples/embassy_serial.rs | 14 ++---- esp32c6-hal/examples/embassy_spi.rs | 11 ++--- esp32c6-hal/examples/embassy_wait.rs | 8 +--- esp32c6-hal/examples/etm_gpio.rs | 4 +- esp32c6-hal/examples/hello_rgb.rs | 10 +--- esp32c6-hal/examples/hello_world.rs | 14 ++---- esp32c6-hal/examples/hmac.rs | 4 +- .../examples/i2c_bmp180_calibration_data.rs | 3 +- esp32c6-hal/examples/i2c_display.rs | 9 +--- esp32c6-hal/examples/i2s_read.rs | 5 +- esp32c6-hal/examples/i2s_sound.rs | 5 +- esp32c6-hal/examples/interrupt_preemption.rs | 4 +- esp32c6-hal/examples/ledc.rs | 8 +--- esp32c6-hal/examples/mcpwm.rs | 8 +--- esp32c6-hal/examples/parl_io_rx.rs | 17 ++----- esp32c6-hal/examples/parl_io_tx.rs | 5 +- esp32c6-hal/examples/pcnt_encoder.rs | 4 +- esp32c6-hal/examples/qspi_flash.rs | 5 +- esp32c6-hal/examples/ram.rs | 8 +--- esp32c6-hal/examples/rmt_rx.rs | 3 +- esp32c6-hal/examples/rmt_tx.rs | 3 +- esp32c6-hal/examples/rsa.rs | 4 +- esp32c6-hal/examples/serial_interrupts.rs | 14 ++---- esp32c6-hal/examples/sha.rs | 8 +--- .../examples/spi_eh1_device_loopback.rs | 3 +- esp32c6-hal/examples/spi_eh1_loopback.rs | 3 +- .../spi_halfduplex_read_manufacturer_id.rs | 3 +- esp32c6-hal/examples/spi_loopback.rs | 3 +- esp32c6-hal/examples/spi_loopback_dma.rs | 5 +- esp32c6-hal/examples/timer_interrupt.rs | 14 ++---- esp32c6-hal/examples/usb_serial_jtag.rs | 11 ++--- esp32c6-hal/examples/watchdog.rs | 8 +--- esp32h2-hal/examples/adc.rs | 9 +--- esp32h2-hal/examples/advanced_serial.rs | 16 ++----- esp32h2-hal/examples/aes.rs | 4 +- esp32h2-hal/examples/crc.rs | 14 ++---- esp32h2-hal/examples/debug_assist.rs | 7 +-- esp32h2-hal/examples/direct-vectoring.rs | 4 +- esp32h2-hal/examples/ecc.rs | 4 +- esp32h2-hal/examples/embassy_hello_world.rs | 8 +--- esp32h2-hal/examples/embassy_i2c.rs | 9 +--- esp32h2-hal/examples/embassy_i2s_read.rs | 10 +--- esp32h2-hal/examples/embassy_i2s_sound.rs | 10 +--- esp32h2-hal/examples/embassy_parl_io_rx.rs | 9 +--- esp32h2-hal/examples/embassy_parl_io_tx.rs | 9 +--- esp32h2-hal/examples/embassy_serial.rs | 14 ++---- esp32h2-hal/examples/embassy_spi.rs | 11 ++--- esp32h2-hal/examples/embassy_wait.rs | 8 +--- esp32h2-hal/examples/etm_gpio.rs | 4 +- esp32h2-hal/examples/hello_rgb.rs | 10 +--- esp32h2-hal/examples/hello_world.rs | 14 ++---- esp32h2-hal/examples/hmac.rs | 4 +- .../examples/i2c_bmp180_calibration_data.rs | 3 +- esp32h2-hal/examples/i2c_display.rs | 9 +--- esp32h2-hal/examples/i2s_read.rs | 5 +- esp32h2-hal/examples/i2s_sound.rs | 5 +- esp32h2-hal/examples/interrupt_preemption.rs | 4 +- esp32h2-hal/examples/ledc.rs | 8 +--- esp32h2-hal/examples/mcpwm.rs | 8 +--- esp32h2-hal/examples/parl_io_rx.rs | 17 ++----- esp32h2-hal/examples/parl_io_tx.rs | 5 +- esp32h2-hal/examples/pcnt_encoder.rs | 4 +- esp32h2-hal/examples/qspi_flash.rs | 5 +- esp32h2-hal/examples/ram.rs | 8 +--- esp32h2-hal/examples/rmt_rx.rs | 3 +- esp32h2-hal/examples/rmt_tx.rs | 3 +- esp32h2-hal/examples/rsa.rs | 4 +- esp32h2-hal/examples/serial_interrupts.rs | 14 ++---- esp32h2-hal/examples/sha.rs | 8 +--- .../examples/spi_eh1_device_loopback.rs | 3 +- esp32h2-hal/examples/spi_eh1_loopback.rs | 3 +- .../spi_halfduplex_read_manufacturer_id.rs | 3 +- esp32h2-hal/examples/spi_loopback.rs | 3 +- esp32h2-hal/examples/spi_loopback_dma.rs | 5 +- esp32h2-hal/examples/timer_interrupt.rs | 14 ++---- esp32h2-hal/examples/usb_serial_jtag.rs | 11 ++--- esp32h2-hal/examples/watchdog.rs | 8 +--- esp32s2-hal/examples/advanced_serial.rs | 10 +--- esp32s2-hal/examples/aes.rs | 4 +- esp32s2-hal/examples/crc.rs | 14 ++---- esp32s2-hal/examples/embassy_hello_world.rs | 8 +--- esp32s2-hal/examples/embassy_i2c.rs | 9 +--- esp32s2-hal/examples/embassy_i2s_read.rs | 11 ++--- esp32s2-hal/examples/embassy_i2s_sound.rs | 11 ++--- esp32s2-hal/examples/embassy_multiprio.rs | 8 +--- esp32s2-hal/examples/embassy_rmt_rx.rs | 6 +-- esp32s2-hal/examples/embassy_rmt_tx.rs | 6 +-- esp32s2-hal/examples/embassy_serial.rs | 14 ++---- esp32s2-hal/examples/embassy_spi.rs | 11 ++--- esp32s2-hal/examples/embassy_wait.rs | 8 +--- esp32s2-hal/examples/hello_rgb.rs | 10 +--- esp32s2-hal/examples/hello_world.rs | 14 ++---- esp32s2-hal/examples/hmac.rs | 4 +- .../examples/i2c_bmp180_calibration_data.rs | 3 +- esp32s2-hal/examples/i2c_display.rs | 9 +--- esp32s2-hal/examples/i2s_read.rs | 5 +- esp32s2-hal/examples/i2s_sound.rs | 5 +- esp32s2-hal/examples/ledc.rs | 8 +--- esp32s2-hal/examples/pcnt_encoder.rs | 4 +- esp32s2-hal/examples/qspi_flash.rs | 5 +- esp32s2-hal/examples/ram.rs | 8 +--- esp32s2-hal/examples/rmt_rx.rs | 3 +- esp32s2-hal/examples/rmt_tx.rs | 3 +- esp32s2-hal/examples/rsa.rs | 4 +- esp32s2-hal/examples/serial_interrupts.rs | 14 ++---- esp32s2-hal/examples/sha.rs | 8 +--- .../examples/spi_eh1_device_loopback.rs | 3 +- esp32s2-hal/examples/spi_eh1_loopback.rs | 3 +- .../spi_halfduplex_read_manufacturer_id.rs | 3 +- esp32s2-hal/examples/spi_loopback.rs | 3 +- esp32s2-hal/examples/spi_loopback_dma.rs | 5 +- esp32s2-hal/examples/timer_interrupt.rs | 14 ++---- esp32s2-hal/examples/usb_serial.rs | 3 +- esp32s2-hal/examples/watchdog.rs | 8 +--- esp32s3-hal/examples/advanced_serial.rs | 10 +--- esp32s3-hal/examples/aes.rs | 4 +- esp32s3-hal/examples/crc.rs | 14 ++---- esp32s3-hal/examples/debug_assist.rs | 7 +-- esp32s3-hal/examples/embassy_hello_world.rs | 6 +-- esp32s3-hal/examples/embassy_i2c.rs | 7 +-- esp32s3-hal/examples/embassy_i2s_read.rs | 10 +--- esp32s3-hal/examples/embassy_i2s_sound.rs | 10 +--- esp32s3-hal/examples/embassy_multicore.rs | 6 +-- .../examples/embassy_multicore_interrupt.rs | 6 +-- esp32s3-hal/examples/embassy_multiprio.rs | 6 +-- esp32s3-hal/examples/embassy_rmt_rx.rs | 6 +-- esp32s3-hal/examples/embassy_rmt_tx.rs | 5 +- esp32s3-hal/examples/embassy_serial.rs | 12 +---- esp32s3-hal/examples/embassy_spi.rs | 9 +--- esp32s3-hal/examples/embassy_wait.rs | 6 +-- esp32s3-hal/examples/hello_rgb.rs | 10 +--- esp32s3-hal/examples/hello_world.rs | 14 ++---- esp32s3-hal/examples/hmac.rs | 4 +- .../examples/i2c_bmp180_calibration_data.rs | 3 +- esp32s3-hal/examples/i2c_display.rs | 9 +--- esp32s3-hal/examples/i2s_read.rs | 5 +- esp32s3-hal/examples/i2s_sound.rs | 5 +- esp32s3-hal/examples/ledc.rs | 8 +--- esp32s3-hal/examples/mcpwm.rs | 8 +--- esp32s3-hal/examples/multicore.rs | 14 ++---- esp32s3-hal/examples/pcnt_encoder.rs | 4 +- esp32s3-hal/examples/qspi_flash.rs | 5 +- esp32s3-hal/examples/ram.rs | 8 +--- esp32s3-hal/examples/rmt_rx.rs | 3 +- esp32s3-hal/examples/rmt_tx.rs | 3 +- esp32s3-hal/examples/rsa.rs | 4 +- esp32s3-hal/examples/serial_interrupts.rs | 14 ++---- esp32s3-hal/examples/sha.rs | 8 +--- .../examples/spi_eh1_device_loopback.rs | 1 - esp32s3-hal/examples/spi_eh1_loopback.rs | 1 - .../spi_halfduplex_read_manufacturer_id.rs | 3 +- esp32s3-hal/examples/spi_loopback.rs | 3 +- esp32s3-hal/examples/spi_loopback_dma.rs | 5 +- esp32s3-hal/examples/timer_interrupt.rs | 14 ++---- esp32s3-hal/examples/twai.rs | 3 +- esp32s3-hal/examples/usb_serial.rs | 3 +- esp32s3-hal/examples/usb_serial_jtag.rs | 11 ++--- esp32s3-hal/examples/watchdog.rs | 8 +--- 309 files changed, 685 insertions(+), 1823 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae1eebc44cd..3e0c25312c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Uart::new_with_config` takes an `Config` instead of `Option`. (#808) - `Alarm::set_period` takes a period (duration) instead of a frequency (#812) - `Alarm::interrupt_clear` is now `Alarm::clear_interrupt` to be consistent (#812) +- The `PeripheralClockControl` struct is no longer public, drivers no longer take this as a parameter (#817) ## [0.12.0] diff --git a/esp-hal-common/src/aes/esp32.rs b/esp-hal-common/src/aes/esp32.rs index 201fb3f3c72..5f1c7319b47 100644 --- a/esp-hal-common/src/aes/esp32.rs +++ b/esp-hal-common/src/aes/esp32.rs @@ -4,8 +4,8 @@ use crate::{ }; impl<'d> Aes<'d> { - pub(super) fn init(&mut self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(PeripheralEnable::Aes); + pub(super) fn init(&mut self) { + PeripheralClockControl::enable(PeripheralEnable::Aes); self.write_endianness( Endianness::BigEndian, Endianness::BigEndian, diff --git a/esp-hal-common/src/aes/esp32cX.rs b/esp-hal-common/src/aes/esp32cX.rs index 732c7380fbc..e0fd99f27f3 100644 --- a/esp-hal-common/src/aes/esp32cX.rs +++ b/esp-hal-common/src/aes/esp32cX.rs @@ -4,8 +4,8 @@ use crate::{ }; impl<'d> Aes<'d> { - pub(super) fn init(&mut self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(PeripheralEnable::Aes); + pub(super) fn init(&mut self) { + PeripheralClockControl::enable(PeripheralEnable::Aes); self.write_dma(false); } diff --git a/esp-hal-common/src/aes/esp32s2.rs b/esp-hal-common/src/aes/esp32s2.rs index 78fa99e0cac..e3ff64074a6 100644 --- a/esp-hal-common/src/aes/esp32s2.rs +++ b/esp-hal-common/src/aes/esp32s2.rs @@ -4,8 +4,8 @@ use crate::{ }; impl<'d> Aes<'d> { - pub(super) fn init(&mut self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(PeripheralEnable::Aes); + pub(super) fn init(&mut self) { + PeripheralClockControl::enable(PeripheralEnable::Aes); self.write_dma(false); self.write_endianness( Endianness::BigEndian, diff --git a/esp-hal-common/src/aes/esp32s3.rs b/esp-hal-common/src/aes/esp32s3.rs index 4874eec52d7..cb00bf8be50 100644 --- a/esp-hal-common/src/aes/esp32s3.rs +++ b/esp-hal-common/src/aes/esp32s3.rs @@ -4,8 +4,8 @@ use crate::{ }; impl<'d> Aes<'d> { - pub(super) fn init(&mut self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(PeripheralEnable::Aes); + pub(super) fn init(&mut self) { + PeripheralClockControl::enable(PeripheralEnable::Aes); self.write_dma(false); } diff --git a/esp-hal-common/src/aes/mod.rs b/esp-hal-common/src/aes/mod.rs index adfd010a9fc..2f35fe64350 100644 --- a/esp-hal-common/src/aes/mod.rs +++ b/esp-hal-common/src/aes/mod.rs @@ -11,7 +11,7 @@ //! ## Example //! ### Initialization //! ```no_run -//! let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); +//! let mut aes = Aes::new(peripherals.AES); //! ``` //! ### Creating key and block Buffer //! ```no_run @@ -65,7 +65,6 @@ use crate::{ generic::{Readable, Reg, RegisterSpec, Resettable, Writable}, AES, }, - system::PeripheralClockControl, }; #[cfg_attr(esp32, path = "esp32.rs")] @@ -84,13 +83,12 @@ pub struct Aes<'d> { } impl<'d> Aes<'d> { - pub fn new( - aes: impl Peripheral

+ 'd, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(aes: impl Peripheral

+ 'd) -> Self { crate::into_ref!(aes); - let mut ret = Self { aes: aes }; - ret.init(peripheral_clock_control); + + let mut ret = Self { aes }; + ret.init(); + ret } diff --git a/esp-hal-common/src/analog/adc/riscv.rs b/esp-hal-common/src/analog/adc/riscv.rs index 16b227dd0d0..e58b04c7fd9 100644 --- a/esp-hal-common/src/analog/adc/riscv.rs +++ b/esp-hal-common/src/analog/adc/riscv.rs @@ -556,11 +556,10 @@ where ADCI: RegisterAccess + 'd, { pub fn adc( - peripheral_clock_controller: &mut PeripheralClockControl, adc_instance: impl crate::peripheral::Peripheral

+ 'd, config: AdcConfig, ) -> Result { - peripheral_clock_controller.enable(Peripheral::ApbSarAdc); + PeripheralClockControl::enable(Peripheral::ApbSarAdc); let sar_adc = unsafe { &*APB_SARADC::PTR }; sar_adc.ctrl.modify(|_, w| unsafe { @@ -718,12 +717,7 @@ mod implementation { //! //! let mut pin = adc1_config.enable_pin(io.pins.gpio2.into_analog(), Attenuation::Attenuation11dB); //! - //! let mut adc1 = ADC::::adc( - //! &mut system.peripheral_clock_control, - //! analog.adc1, - //! adc1_config, - //! ) - //! .unwrap(); + //! let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); //! //! let mut delay = Delay::new(&clocks); //! @@ -770,12 +764,7 @@ mod implementation { //! //! let mut pin = adc1_config.enable_pin(io.pins.gpio2.into_analog(), Attenuation::Attenuation11dB); //! - //! let mut adc1 = ADC::::adc( - //! &mut system.peripheral_clock_control, - //! analog.adc1, - //! adc1_config, - //! ) - //! .unwrap(); + //! let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); //! //! let mut delay = Delay::new(&clocks); //! @@ -827,12 +816,7 @@ mod implementation { //! //! let mut pin = adc1_config.enable_pin(io.pins.gpio2.into_analog(), Attenuation::Attenuation11dB); //! - //! let mut adc1 = ADC::::adc( - //! &mut system.peripheral_clock_control, - //! analog.adc1, - //! adc1_config, - //! ) - //! .unwrap(); + //! let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); //! //! let mut delay = Delay::new(&clocks); //! @@ -880,12 +864,7 @@ mod implementation { //! //! let mut pin = adc1_config.enable_pin(io.pins.gpio2.into_analog(), Attenuation::Attenuation11dB); //! - //! let mut adc1 = ADC::::adc( - //! &mut system.peripheral_clock_control, - //! analog.adc1, - //! adc1_config, - //! ) - //! .unwrap(); + //! let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); //! //! let mut delay = Delay::new(&clocks); //! diff --git a/esp-hal-common/src/analog/mod.rs b/esp-hal-common/src/analog/mod.rs index 9dd7bb72052..f650eeec385 100644 --- a/esp-hal-common/src/analog/mod.rs +++ b/esp-hal-common/src/analog/mod.rs @@ -46,12 +46,7 @@ //! //! let mut pin = adc1_config.enable_pin(io.pins.gpio2.into_analog(), Attenuation::Attenuation11dB); //! -//! let mut adc1 = ADC::::adc( -//! &mut system.peripheral_clock_control, -//! analog.adc1, -//! adc1_config, -//! ) -//! .unwrap(); +//! let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); //! //! let mut delay = Delay::new(&clocks); //! diff --git a/esp-hal-common/src/assist_debug.rs b/esp-hal-common/src/assist_debug.rs index 2a779a64e1d..14fab018329 100644 --- a/esp-hal-common/src/assist_debug.rs +++ b/esp-hal-common/src/assist_debug.rs @@ -18,22 +18,19 @@ use crate::{ peripheral::{Peripheral, PeripheralRef}, - system::PeripheralClockControl, + peripherals::ASSIST_DEBUG, }; pub struct DebugAssist<'d> { - debug_assist: PeripheralRef<'d, crate::peripherals::ASSIST_DEBUG>, + debug_assist: PeripheralRef<'d, ASSIST_DEBUG>, } impl<'d> DebugAssist<'d> { - pub fn new( - debug_assist: impl Peripheral

+ 'd, - _peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(debug_assist: impl Peripheral

+ 'd) -> Self { crate::into_ref!(debug_assist); - // we should use peripheral clock control to enable the debug assist however - // it's always enabled in ROM code already + // NOTE: We should enable the debug assist, however, it's always enabled in ROM + // code already. DebugAssist { debug_assist } } diff --git a/esp-hal-common/src/dma/gdma.rs b/esp-hal-common/src/dma/gdma.rs index 699fbcfd032..b04bf568474 100644 --- a/esp-hal-common/src/dma/gdma.rs +++ b/esp-hal-common/src/dma/gdma.rs @@ -16,7 +16,7 @@ //! //! GDMA peripheral can be initializes using the `new` function, which requires //! a DMA peripheral instance and a clock control reference. ```no_run -//! let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); +//! let dma = Gdma::new(peripherals.DMA); //! ``` //! //! PS: Note that the number of DMA channels is chip-specific. @@ -643,11 +643,10 @@ impl<'d> Gdma<'d> { /// Create a DMA instance. pub fn new( dma: impl crate::peripheral::Peripheral

+ 'd, - peripheral_clock_control: &mut PeripheralClockControl, ) -> Gdma<'d> { crate::into_ref!(dma); - peripheral_clock_control.enable(Peripheral::Gdma); + PeripheralClockControl::enable(Peripheral::Gdma); dma.misc_conf.modify(|_, w| w.ahbm_rst_inter().set_bit()); dma.misc_conf.modify(|_, w| w.ahbm_rst_inter().clear_bit()); dma.misc_conf.modify(|_, w| w.clk_en().set_bit()); diff --git a/esp-hal-common/src/dma/mod.rs b/esp-hal-common/src/dma/mod.rs index 6f32bee1cc7..fdc49c44699 100644 --- a/esp-hal-common/src/dma/mod.rs +++ b/esp-hal-common/src/dma/mod.rs @@ -36,11 +36,11 @@ //! ## Example //! #### Initialize and utilize DMA controller in `SPI` //! ```no_run -//! let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); +//! let dma = Gdma::new(peripherals.DMA); //! let dma_channel = dma.channel0; //! //! // For `ESP32` and `ESP32-S2` chips use `Pdma` controller instead: -//! // let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); +//! // let dma = Dma::new(system.dma); //! // let dma_channel = dma.spi2channel; //! //! let mut descriptors = [0u32; 8 * 3]; @@ -54,7 +54,6 @@ //! cs, //! 100u32.kHz(), //! SpiMode::Mode0, -//! &mut system.peripheral_clock_control, //! &clocks, //! ) //! .with_dma(dma_channel.configure( diff --git a/esp-hal-common/src/dma/pdma.rs b/esp-hal-common/src/dma/pdma.rs index 0f276f934d6..9586d5ca790 100644 --- a/esp-hal-common/src/dma/pdma.rs +++ b/esp-hal-common/src/dma/pdma.rs @@ -711,11 +711,8 @@ pub struct Dma<'d> { impl<'d> Dma<'d> { /// Create a DMA instance. - pub fn new( - dma: impl crate::peripheral::Peripheral

+ 'd, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Dma<'d> { - peripheral_clock_control.enable(Peripheral::Dma); + pub fn new(dma: impl crate::peripheral::Peripheral

+ 'd) -> Dma<'d> { + PeripheralClockControl::enable(Peripheral::Dma); Dma { _inner: dma.into_ref(), diff --git a/esp-hal-common/src/ecc.rs b/esp-hal-common/src/ecc.rs index bdf0f083ab2..5f693f68afd 100644 --- a/esp-hal-common/src/ecc.rs +++ b/esp-hal-common/src/ecc.rs @@ -77,13 +77,10 @@ pub enum WorkMode { } impl<'d> Ecc<'d> { - pub fn new( - ecc: impl Peripheral

+ 'd, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(ecc: impl Peripheral

+ 'd) -> Self { crate::into_ref!(ecc); - peripheral_clock_control.enable(PeripheralEnable::Ecc); + PeripheralClockControl::enable(PeripheralEnable::Ecc); Self { ecc, diff --git a/esp-hal-common/src/etm.rs b/esp-hal-common/src/etm.rs index b974a18a86a..e4fc1b61e89 100644 --- a/esp-hal-common/src/etm.rs +++ b/esp-hal-common/src/etm.rs @@ -31,7 +31,7 @@ //! let led_task = gpio_ext.channel0_task.toggle(&mut led); //! let button_event = gpio_ext.channel0_event.falling_edge(button); //! -//! let etm = Etm::new(peripherals.SOC_ETM, &mut system.peripheral_clock_control); +//! let etm = Etm::new(peripherals.SOC_ETM); //! let channel0 = etm.channel0; //! //! // make sure the configured channel doesn't get dropped - dropping it will @@ -241,12 +241,10 @@ macro_rules! create_etm_constructor { ($($num:literal),+) => { paste::paste! { impl<'d> Etm<'d> { - pub fn new( - peripheral: impl Peripheral

+ 'd, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(peripheral: impl Peripheral

+ 'd) -> Self { crate::into_ref!(peripheral); - peripheral_clock_control.enable(crate::system::Peripheral::Etm); + + PeripheralClockControl::enable(crate::system::Peripheral::Etm); Self { _peripheral: peripheral, diff --git a/esp-hal-common/src/hmac.rs b/esp-hal-common/src/hmac.rs index e29112f5363..ee6fe70dc87 100644 --- a/esp-hal-common/src/hmac.rs +++ b/esp-hal-common/src/hmac.rs @@ -93,14 +93,11 @@ enum NextCommand { } impl<'d> Hmac<'d> { - pub fn new( - hmac: impl Peripheral

+ 'd, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(hmac: impl Peripheral

+ 'd) -> Self { crate::into_ref!(hmac); - peripheral_clock_control.enable(PeripheralEnable::Sha); - peripheral_clock_control.enable(PeripheralEnable::Hmac); + PeripheralClockControl::enable(PeripheralEnable::Sha); + PeripheralClockControl::enable(PeripheralEnable::Hmac); Self { hmac, diff --git a/esp-hal-common/src/i2c.rs b/esp-hal-common/src/i2c.rs index 14d57a22217..2fd2475c8bf 100644 --- a/esp-hal-common/src/i2c.rs +++ b/esp-hal-common/src/i2c.rs @@ -22,7 +22,6 @@ //! io.pins.gpio1, //! io.pins.gpio2, //! 100u32.kHz(), -//! &mut system.peripheral_clock_control, //! &clocks, //! ); //! loop { @@ -274,11 +273,16 @@ where sda: impl Peripheral

+ 'd, scl: impl Peripheral

+ 'd, frequency: HertzU32, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Self { crate::into_ref!(i2c, sda, scl); - enable_peripheral(&i2c, peripheral_clock_control); + + PeripheralClockControl::enable(match i2c.i2c_number() { + 0 => crate::system::Peripheral::I2cExt0, + #[cfg(i2c1)] + 1 => crate::system::Peripheral::I2cExt1, + _ => unreachable!(), // will never happen + }); let mut i2c = I2C { peripheral: i2c }; @@ -623,21 +627,6 @@ mod asynch { } } -fn enable_peripheral<'d, T>( - i2c: &PeripheralRef<'d, T>, - peripheral_clock_control: &mut PeripheralClockControl, -) where - T: Instance, -{ - // enable peripheral - match i2c.i2c_number() { - 0 => peripheral_clock_control.enable(crate::system::Peripheral::I2cExt0), - #[cfg(i2c1)] - 1 => peripheral_clock_control.enable(crate::system::Peripheral::I2cExt1), - _ => unreachable!(), // will never happen - } -} - /// I2C Peripheral Instance pub trait Instance { fn scl_output_signal(&self) -> OutputSignal; diff --git a/esp-hal-common/src/i2s.rs b/esp-hal-common/src/i2s.rs index af3cc4899bb..31d5a11e035 100644 --- a/esp-hal-common/src/i2s.rs +++ b/esp-hal-common/src/i2s.rs @@ -35,7 +35,6 @@ //! &mut rx_descriptors, //! DmaPriority::Priority0, //! ), -//! &mut system.peripheral_clock_control, //! &clocks, //! ); //! ``` @@ -629,7 +628,6 @@ where data_format: DataFormat, sample_rate: impl Into, mut channel: Channel<'d, CH>, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Self { // on ESP32-C3 / ESP32-S3 and later RX and TX are independent and @@ -640,7 +638,7 @@ where let mut register_access = i2s.register_access(); channel.tx.init_channel(); - peripheral_clock_control.enable(register_access.get_peripheral()); + PeripheralClockControl::enable(register_access.get_peripheral()); pins.configure(&mut register_access); register_access.set_clock(calculate_clock( sample_rate, @@ -682,7 +680,6 @@ where data_format: DataFormat, sample_rate: impl Into, channel: Channel<'d, CH>, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Self; } @@ -701,7 +698,6 @@ where data_format: DataFormat, sample_rate: impl Into, channel: Channel<'d, CH>, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Self { Self::new_internal( @@ -711,7 +707,6 @@ where data_format, sample_rate, channel, - peripheral_clock_control, clocks, ) } @@ -733,7 +728,6 @@ where data_format: DataFormat, sample_rate: impl Into, channel: Channel<'d, CH>, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Self; } @@ -753,7 +747,6 @@ where data_format: DataFormat, sample_rate: impl Into, channel: Channel<'d, CH>, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Self { Self::new_internal( @@ -763,7 +756,6 @@ where data_format, sample_rate, channel, - peripheral_clock_control, clocks, ) } diff --git a/esp-hal-common/src/ledc/mod.rs b/esp-hal-common/src/ledc/mod.rs index 698c8813617..a988d58be5e 100644 --- a/esp-hal-common/src/ledc/mod.rs +++ b/esp-hal-common/src/ledc/mod.rs @@ -10,11 +10,7 @@ //! 10% duty using the ABPClock //! //! ```no_run -//! let mut ledc = LEDC::new( -//! peripherals.LEDC, -//! &clock_control, -//! &mut system.peripheral_clock_control, -//! ); +//! let mut ledc = LEDC::new(peripherals.LEDC, &clock_control); //! ledc.set_global_slow_clock(LSGlobalClkSource::APBClk); //! //! let mut lstimer0 = ledc.get_timer::(timer::Number::Timer0); @@ -41,11 +37,7 @@ //! 10% duty using the ABPClock //! //! ```no_run -//! let ledc = LEDC::new( -//! peripherals.LEDC, -//! &clock_control, -//! &mut system.peripheral_clock_control, -//! ); +//! let ledc = LEDC::new(peripherals.LEDC, &clock_control); //! //! let mut hstimer0 = ledc.get_timer::(timer::Number::Timer0); //! hstimer0 @@ -116,10 +108,9 @@ impl<'d> LEDC<'d> { pub fn new( _instance: impl Peripheral

+ 'd, clock_control_config: &'d Clocks, - system: &mut PeripheralClockControl, ) -> Self { crate::into_ref!(_instance); - system.enable(PeripheralEnable::Ledc); + PeripheralClockControl::enable(PeripheralEnable::Ledc); let ledc = unsafe { &*crate::peripherals::LEDC::ptr() }; LEDC { diff --git a/esp-hal-common/src/mcpwm/mod.rs b/esp-hal-common/src/mcpwm/mod.rs index 2f92fa57b84..38bb5f5b542 100644 --- a/esp-hal-common/src/mcpwm/mod.rs +++ b/esp-hal-common/src/mcpwm/mod.rs @@ -33,11 +33,7 @@ //! //! // initialize peripheral //! let clock_cfg = PeripheralClockConfig::with_frequency(&clocks, 40u32.MHz()).unwrap(); -//! let mut mcpwm = MCPWM::new( -//! peripherals.PWM0, -//! clock_cfg, -//! &mut system.peripheral_clock_control, -//! ); +//! let mut mcpwm = MCPWM::new(peripherals.PWM0, clock_cfg); //! //! // connect operator0 to timer0 //! mcpwm.operator0.set_timer(&mcpwm.timer0); @@ -102,11 +98,10 @@ impl<'d, PWM: PwmPeripheral> MCPWM<'d, PWM> { pub fn new( peripheral: impl Peripheral

+ 'd, peripheral_clock: PeripheralClockConfig, - system: &mut PeripheralClockControl, ) -> Self { crate::into_ref!(peripheral); - PWM::enable(system); + PWM::enable(); #[cfg(not(esp32c6))] { @@ -289,7 +284,7 @@ pub struct FrequencyError; /// A MCPWM peripheral pub unsafe trait PwmPeripheral: Deref { /// Enable peripheral - fn enable(system: &mut PeripheralClockControl); + fn enable(); /// Get a pointer to the peripheral RegisterBlock fn block() -> *const RegisterBlock; /// Get operator GPIO mux output signal @@ -298,8 +293,8 @@ pub unsafe trait PwmPeripheral: Deref { #[cfg(mcpwm0)] unsafe impl PwmPeripheral for crate::peripherals::MCPWM0 { - fn enable(system: &mut PeripheralClockControl) { - system.enable(PeripheralEnable::Mcpwm0) + fn enable() { + PeripheralClockControl::enable(PeripheralEnable::Mcpwm0) } fn block() -> *const RegisterBlock { @@ -321,8 +316,8 @@ unsafe impl PwmPeripheral for crate::peripherals::MCPWM0 { #[cfg(mcpwm1)] unsafe impl PwmPeripheral for crate::peripherals::MCPWM1 { - fn enable(system: &mut PeripheralClockControl) { - system.enable(PeripheralEnable::Mcpwm1) + fn enable() { + PeripheralClockControl::enable(PeripheralEnable::Mcpwm1) } fn block() -> *const RegisterBlock { diff --git a/esp-hal-common/src/otg_fs.rs b/esp-hal-common/src/otg_fs.rs index a6573f28423..5905f84308a 100644 --- a/esp-hal-common/src/otg_fs.rs +++ b/esp-hal-common/src/otg_fs.rs @@ -68,10 +68,11 @@ where usb_sel: impl Peripheral

+ 'd, usb_dp: impl Peripheral

+ 'd, usb_dm: impl Peripheral

+ 'd, - peripheral_clock_control: &mut PeripheralClockControl, ) -> Self { crate::into_ref!(usb_sel, usb_dp, usb_dm); - peripheral_clock_control.enable(PeripheralEnable::Usb); + + PeripheralClockControl::enable(PeripheralEnable::Usb); + Self { _usb0: usb0.into_ref(), _usb_sel: usb_sel, diff --git a/esp-hal-common/src/parl_io.rs b/esp-hal-common/src/parl_io.rs index 13a5d1bf187..731136e70d0 100644 --- a/esp-hal-common/src/parl_io.rs +++ b/esp-hal-common/src/parl_io.rs @@ -28,7 +28,6 @@ //! DmaPriority::Priority0, //! ), //! 1u32.MHz(), -//! &mut system.peripheral_clock_control, //! &clocks, //! ) //! .unwrap(); @@ -64,7 +63,6 @@ //! DmaPriority::Priority0, //! ), //! 1u32.MHz(), -//! &mut system.peripheral_clock_control, //! &clocks, //! ) //! .unwrap(); @@ -1034,11 +1032,10 @@ where parl_io: impl Peripheral

+ 'd, mut dma_channel: Channel<'d, CH>, frequency: HertzU32, - peripheral_clock_control: &mut PeripheralClockControl, _clocks: &Clocks, ) -> Result { crate::into_ref!(parl_io); - internal_init(&mut dma_channel, frequency, peripheral_clock_control)?; + internal_init(&mut dma_channel, frequency)?; Ok(Self { _parl_io: parl_io, @@ -1071,11 +1068,10 @@ where parl_io: impl Peripheral

+ 'd, mut dma_channel: Channel<'d, CH>, frequency: HertzU32, - peripheral_clock_control: &mut PeripheralClockControl, _clocks: &Clocks, ) -> Result { crate::into_ref!(parl_io); - internal_init(&mut dma_channel, frequency, peripheral_clock_control)?; + internal_init(&mut dma_channel, frequency)?; Ok(Self { _parl_io: parl_io, @@ -1105,11 +1101,10 @@ where parl_io: impl Peripheral

+ 'd, mut dma_channel: Channel<'d, CH>, frequency: HertzU32, - peripheral_clock_control: &mut PeripheralClockControl, _clocks: &Clocks, ) -> Result { crate::into_ref!(parl_io); - internal_init(&mut dma_channel, frequency, peripheral_clock_control)?; + internal_init(&mut dma_channel, frequency)?; Ok(Self { _parl_io: parl_io, @@ -1123,7 +1118,6 @@ where fn internal_init<'d, CH>( dma_channel: &mut Channel<'d, CH>, frequency: HertzU32, - peripheral_clock_control: &mut PeripheralClockControl, ) -> Result<(), Error> where CH: ChannelTypes, @@ -1133,7 +1127,7 @@ where return Err(Error::UnreachableClockRate); } - peripheral_clock_control.enable(crate::system::Peripheral::ParlIo); + PeripheralClockControl::enable(crate::system::Peripheral::ParlIo); let pcr = unsafe { &*crate::peripherals::PCR::PTR }; diff --git a/esp-hal-common/src/pcnt/mod.rs b/esp-hal-common/src/pcnt/mod.rs index 7dcca10177d..41784d9560b 100644 --- a/esp-hal-common/src/pcnt/mod.rs +++ b/esp-hal-common/src/pcnt/mod.rs @@ -34,7 +34,7 @@ //! //! // setup a pulse couter //! println!("setup pulse counter unit 0"); -//! let pcnt = PCNT::new(peripherals.PCNT, &mut system.peripheral_clock_control); +//! let pcnt = PCNT::new(peripherals.PCNT); //! let mut u0 = pcnt.get_unit(unit_number); //! u0.configure(unit::Config { //! low_limit: -100, @@ -147,13 +147,11 @@ pub struct PCNT<'d> { impl<'d> PCNT<'d> { /// Return a new PCNT - pub fn new( - _instance: impl Peripheral

+ 'd, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(_instance: impl Peripheral

+ 'd) -> Self { crate::into_ref!(_instance); // Enable the PCNT peripherals clock in the system peripheral - peripheral_clock_control.enable(crate::system::Peripheral::Pcnt); + PeripheralClockControl::enable(crate::system::Peripheral::Pcnt); + PCNT { _instance } } diff --git a/esp-hal-common/src/rmt.rs b/esp-hal-common/src/rmt.rs index 4932e560cac..8133e691a50 100644 --- a/esp-hal-common/src/rmt.rs +++ b/esp-hal-common/src/rmt.rs @@ -206,7 +206,6 @@ impl<'d> Rmt<'d> { pub fn new( peripheral: impl Peripheral

+ 'd, frequency: HertzU32, - peripheral_clock_control: &mut PeripheralClockControl, _clocks: &Clocks, ) -> Result { let me = Rmt::create(peripheral); @@ -216,7 +215,7 @@ impl<'d> Rmt<'d> { return Err(Error::UnreachableTargetFrequency); } - peripheral_clock_control.enable(crate::system::Peripheral::Rmt); + PeripheralClockControl::enable(crate::system::Peripheral::Rmt); #[cfg(not(any(esp32, esp32s2)))] me.configure_clock(frequency, _clocks)?; diff --git a/esp-hal-common/src/rsa/mod.rs b/esp-hal-common/src/rsa/mod.rs index 461fa7ba133..2365d6bd71b 100644 --- a/esp-hal-common/src/rsa/mod.rs +++ b/esp-hal-common/src/rsa/mod.rs @@ -25,7 +25,7 @@ //! let peripherals = Peripherals::take(); //! let mut system = peripherals.PCR.split(); //! -//! let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); +//! let mut rsa = Rsa::new(peripherals.RSA); //! ``` //! //! ⚠️: The examples for RSA peripheral are quite extensive, so for a more @@ -59,18 +59,12 @@ pub struct Rsa<'d> { } impl<'d> Rsa<'d> { - pub fn new( - rsa: impl Peripheral

+ 'd, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(rsa: impl Peripheral

+ 'd) -> Self { crate::into_ref!(rsa); - let mut ret = Self { rsa }; - ret.init(peripheral_clock_control); - ret - } - fn init(&mut self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(PeripheralEnable::Rsa); + PeripheralClockControl::enable(PeripheralEnable::Rsa); + + Self { rsa } } unsafe fn write_operand_b(&mut self, operand_b: &[u8; N]) { diff --git a/esp-hal-common/src/sha.rs b/esp-hal-common/src/sha.rs index 55a95b9cae5..edaf853f0f3 100644 --- a/esp-hal-common/src/sha.rs +++ b/esp-hal-common/src/sha.rs @@ -31,11 +31,7 @@ //! ```no_run //! let source_data = "HELLO, ESPRESSIF!".as_bytes(); //! let mut remaining = source_data.clone(); -//! let mut hasher = Sha::new( -//! peripherals.SHA, -//! ShaMode::SHA256, -//! &mut system.peripheral_clock_control, -//! ); +//! let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA256); //! //! // Short hashes can be created by decreasing the output buffer to the desired //! // length @@ -149,13 +145,10 @@ fn mode_as_bits(mode: ShaMode) -> u8 { // This implementation might fail after u32::MAX/8 bytes, to increase please see // ::finish() length/self.cursor usage impl<'d> Sha<'d> { - pub fn new( - sha: impl Peripheral

+ 'd, - mode: ShaMode, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(sha: impl Peripheral

+ 'd, mode: ShaMode) -> Self { crate::into_ref!(sha); - peripheral_clock_control.enable(crate::system::Peripheral::Sha); + + PeripheralClockControl::enable(crate::system::Peripheral::Sha); // Setup SHA Mode #[cfg(not(esp32))] diff --git a/esp-hal-common/src/spi.rs b/esp-hal-common/src/spi.rs index 48210b6777f..cca0eb0c5bd 100644 --- a/esp-hal-common/src/spi.rs +++ b/esp-hal-common/src/spi.rs @@ -434,7 +434,6 @@ where cs: impl Peripheral

+ 'd, frequency: HertzU32, mode: SpiMode, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Spi<'d, T, FullDuplexMode> { crate::into_ref!(spi, sck, mosi, miso, cs); @@ -450,7 +449,7 @@ where cs.set_to_push_pull_output() .connect_peripheral_to_output(spi.cs_signal()); - Self::new_internal(spi, frequency, mode, peripheral_clock_control, clocks) + Self::new_internal(spi, frequency, mode, clocks) } /// Constructs an SPI instance in 8bit dataframe mode without CS pin. @@ -461,7 +460,6 @@ where miso: impl Peripheral

+ 'd, frequency: HertzU32, mode: SpiMode, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Spi<'d, T, FullDuplexMode> { crate::into_ref!(spi, sck, mosi, miso); @@ -474,7 +472,7 @@ where miso.set_to_input() .connect_input_to_peripheral(spi.miso_signal()); - Self::new_internal(spi, frequency, mode, peripheral_clock_control, clocks) + Self::new_internal(spi, frequency, mode, clocks) } /// Constructs an SPI instance in 8bit dataframe mode without MISO pin. @@ -485,7 +483,6 @@ where cs: impl Peripheral

+ 'd, frequency: HertzU32, mode: SpiMode, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Spi<'d, T, FullDuplexMode> { crate::into_ref!(spi, sck, mosi, cs); @@ -498,7 +495,7 @@ where cs.set_to_push_pull_output() .connect_peripheral_to_output(spi.cs_signal()); - Self::new_internal(spi, frequency, mode, peripheral_clock_control, clocks) + Self::new_internal(spi, frequency, mode, clocks) } /// Constructs an SPI instance in 8bit dataframe mode without CS and MISO @@ -509,7 +506,6 @@ where mosi: impl Peripheral

+ 'd, frequency: HertzU32, mode: SpiMode, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Spi<'d, T, FullDuplexMode> { crate::into_ref!(spi, sck, mosi); @@ -519,7 +515,7 @@ where mosi.set_to_push_pull_output() .connect_peripheral_to_output(spi.mosi_signal()); - Self::new_internal(spi, frequency, mode, peripheral_clock_control, clocks) + Self::new_internal(spi, frequency, mode, clocks) } /// Constructs an SPI instance in 8bit dataframe mode with only MOSI @@ -531,24 +527,22 @@ where mosi: impl Peripheral

+ 'd, frequency: HertzU32, mode: SpiMode, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Spi<'d, T, FullDuplexMode> { crate::into_ref!(spi, mosi); mosi.set_to_push_pull_output() .connect_peripheral_to_output(spi.mosi_signal()); - Self::new_internal(spi, frequency, mode, peripheral_clock_control, clocks) + Self::new_internal(spi, frequency, mode, clocks) } pub(crate) fn new_internal( spi: PeripheralRef<'d, T>, frequency: HertzU32, mode: SpiMode, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Spi<'d, T, FullDuplexMode> { - spi.enable_peripheral(peripheral_clock_control); + spi.enable_peripheral(); let mut spi = Spi { spi, @@ -591,7 +585,6 @@ where cs: Option + 'd>, frequency: HertzU32, mode: SpiMode, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Spi<'d, T, HalfDuplexMode> { crate::into_ref!(spi); @@ -639,17 +632,16 @@ where .connect_peripheral_to_output(spi.cs_signal()); } - Self::new_internal(spi, frequency, mode, peripheral_clock_control, clocks) + Self::new_internal(spi, frequency, mode, clocks) } pub(crate) fn new_internal( spi: PeripheralRef<'d, T>, frequency: HertzU32, mode: SpiMode, - peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks, ) -> Spi<'d, T, HalfDuplexMode> { - spi.enable_peripheral(peripheral_clock_control); + spi.enable_peripheral(); let mut spi = Spi { spi, @@ -2138,7 +2130,7 @@ pub trait Instance { fn cs_signal(&self) -> OutputSignal; - fn enable_peripheral(&self, peripheral_clock_control: &mut PeripheralClockControl); + fn enable_peripheral(&self); fn spi_num(&self) -> u8; @@ -2996,8 +2988,8 @@ impl Instance for crate::peripherals::SPI2 { } #[inline(always)] - fn enable_peripheral(&self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(crate::system::Peripheral::Spi2); + fn enable_peripheral(&self) { + PeripheralClockControl::enable(crate::system::Peripheral::Spi2); } #[inline(always)] @@ -3067,8 +3059,8 @@ impl Instance for crate::peripherals::SPI2 { } #[inline(always)] - fn enable_peripheral(&self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(crate::system::Peripheral::Spi2); + fn enable_peripheral(&self) { + PeripheralClockControl::enable(crate::system::Peripheral::Spi2); } #[inline(always)] @@ -3132,8 +3124,8 @@ impl Instance for crate::peripherals::SPI3 { } #[inline(always)] - fn enable_peripheral(&self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(crate::system::Peripheral::Spi3) + fn enable_peripheral(&self) { + PeripheralClockControl::enable(crate::system::Peripheral::Spi3) } #[inline(always)] @@ -3170,8 +3162,8 @@ impl Instance for crate::peripherals::SPI2 { } #[inline(always)] - fn enable_peripheral(&self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(crate::system::Peripheral::Spi2) + fn enable_peripheral(&self) { + PeripheralClockControl::enable(crate::system::Peripheral::Spi2) } #[inline(always)] @@ -3241,8 +3233,8 @@ impl Instance for crate::peripherals::SPI3 { } #[inline(always)] - fn enable_peripheral(&self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(crate::system::Peripheral::Spi3) + fn enable_peripheral(&self) { + PeripheralClockControl::enable(crate::system::Peripheral::Spi3) } #[inline(always)] diff --git a/esp-hal-common/src/system.rs b/esp-hal-common/src/system.rs index c358ae101d0..77105f08656 100755 --- a/esp-hal-common/src/system.rs +++ b/esp-hal-common/src/system.rs @@ -46,7 +46,7 @@ pub enum SoftwareInterrupt { SoftwareInterrupt3, } -/// Peripherals which can be enabled via [PeripheralClockControl] +/// Peripherals which can be enabled via `PeripheralClockControl` pub enum Peripheral { #[cfg(spi2)] Spi2, @@ -179,14 +179,12 @@ impl SoftwareInterruptControl { } /// Controls the enablement of peripheral clocks. -pub struct PeripheralClockControl { - _private: (), -} +pub(crate) struct PeripheralClockControl; #[cfg(not(any(esp32c6, esp32h2)))] impl PeripheralClockControl { /// Enables and resets the given peripheral - pub fn enable(&mut self, peripheral: Peripheral) { + pub(crate) fn enable(peripheral: Peripheral) { let system = unsafe { &*SystemPeripheral::PTR }; #[cfg(not(esp32))] @@ -204,7 +202,7 @@ impl PeripheralClockControl { #[cfg(any(esp32c2, esp32c3, esp32s2, esp32s3))] let (perip_clk_en1, perip_rst_en1) = { (&system.perip_clk_en1, &system.perip_rst_en1) }; - match peripheral { + critical_section::with(|_cs| match peripheral { #[cfg(spi2)] Peripheral::Spi2 => { perip_clk_en0.modify(|_, w| w.spi2_clk_en().set_bit()); @@ -387,14 +385,14 @@ impl PeripheralClockControl { perip_clk_en1.modify(|_, w| w.crypto_ecc_clk_en().set_bit()); perip_rst_en1.modify(|_, w| w.crypto_ecc_rst().clear_bit()); } - } + }); } } #[cfg(any(esp32c6, esp32h2))] impl PeripheralClockControl { /// Enables and resets the given peripheral - pub fn enable(&mut self, peripheral: Peripheral) { + pub(crate) fn enable(peripheral: Peripheral) { let system = unsafe { &*SystemPeripheral::PTR }; match peripheral { @@ -618,7 +616,6 @@ pub trait RadioClockController { /// The SYSTEM/DPORT splitted into it's different logical parts. pub struct SystemParts<'d> { _private: PeripheralRef<'d, SystemPeripheral>, - pub peripheral_clock_control: PeripheralClockControl, pub clock_control: SystemClockControl, pub cpu_control: CpuControl, #[cfg(pdma)] @@ -642,7 +639,6 @@ impl<'d, T: crate::peripheral::Peripheral

+ 'd> SystemExt< fn split(self) -> Self::Parts { Self::Parts { _private: self.into_ref(), - peripheral_clock_control: PeripheralClockControl { _private: () }, clock_control: SystemClockControl { _private: () }, cpu_control: CpuControl { _private: () }, #[cfg(pdma)] diff --git a/esp-hal-common/src/timer.rs b/esp-hal-common/src/timer.rs index 3d81f924e08..7e29f32a7d2 100644 --- a/esp-hal-common/src/timer.rs +++ b/esp-hal-common/src/timer.rs @@ -21,18 +21,10 @@ //! let mut rtc = Rtc::new(peripherals.RTC_CNTL); //! //! // Create timer groups -//! let timer_group0 = TimerGroup::new( -//! peripherals.TIMG0, -//! &clocks, -//! &mut system.peripheral_clock_control, -//! ); +//! let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); //! // Get watchdog timers of timer groups //! let mut wdt0 = timer_group0.wdt; -//! let timer_group1 = TimerGroup::new( -//! peripherals.TIMG1, -//! &clocks, -//! &mut system.peripheral_clock_control, -//! ); +//! let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); //! let mut wdt1 = timer_group1.wdt; //! //! // Disable watchdog timers @@ -189,11 +181,7 @@ impl<'d, T> TimerGroup<'d, T> where T: TimerGroupInstance, { - pub fn new( - timer_group: impl Peripheral

+ 'd, - clocks: &Clocks, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(timer_group: impl Peripheral

+ 'd, clocks: &Clocks) -> Self { crate::into_ref!(timer_group); T::configure_src_clk(); @@ -207,7 +195,6 @@ where clocks.apb_clock, #[cfg(esp32h2)] clocks.pll_48m_clock, - peripheral_clock_control, ); #[cfg(not(any(esp32c2, esp32c3, esp32c6, esp32h2)))] @@ -216,17 +203,14 @@ where phantom: PhantomData::default(), }, clocks.apb_clock, - peripheral_clock_control, ); - let wdt = Wdt::new(peripheral_clock_control); - Self { _timer_group: timer_group, timer0, #[cfg(not(any(esp32c2, esp32c3, esp32c6, esp32h2)))] timer1, - wdt, + wdt: Wdt::new(), } } } @@ -242,15 +226,12 @@ where T: Instance, { /// Create a new timer instance - pub fn new( - timg: T, - apb_clk_freq: HertzU32, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(timg: T, apb_clk_freq: HertzU32) -> Self { // TODO: this currently assumes APB_CLK is being used, as we don't yet have a // way to select the XTAL_CLK. - timg.enable_peripheral(peripheral_clock_control); + timg.enable_peripheral(); + Self { timg, apb_clk_freq } } @@ -312,7 +293,7 @@ pub trait Instance { fn is_interrupt_set(&self) -> bool; - fn enable_peripheral(&self, peripheral_clock_control: &mut PeripheralClockControl); + fn enable_peripheral(&self); } pub struct Timer0 { @@ -469,8 +450,8 @@ where .modify(|_, w| unsafe { w.divider().bits(divider) }) } - fn enable_peripheral(&self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(crate::system::Peripheral::Timg0); + fn enable_peripheral(&self) { + PeripheralClockControl::enable(crate::system::Peripheral::Timg0); } } @@ -631,8 +612,8 @@ where .modify(|_, w| unsafe { w.divider().bits(divider) }) } - fn enable_peripheral(&self, peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(crate::system::Peripheral::Timg1); + fn enable_peripheral(&self) { + PeripheralClockControl::enable(crate::system::Peripheral::Timg1); } } @@ -726,9 +707,9 @@ where TG: TimerGroupInstance, { /// Create a new watchdog timer instance - pub fn new(_peripheral_clock_control: &mut PeripheralClockControl) -> Self { + pub fn new() -> Self { #[cfg(lp_wdt)] - _peripheral_clock_control.enable(crate::system::Peripheral::Wdt); + PeripheralClockControl::enable(crate::system::Peripheral::Wdt); TG::configure_wdt_src_clk(); diff --git a/esp-hal-common/src/twai/mod.rs b/esp-hal-common/src/twai/mod.rs index fdf7ae98c30..2dd6ea58145 100644 --- a/esp-hal-common/src/twai/mod.rs +++ b/esp-hal-common/src/twai/mod.rs @@ -32,7 +32,6 @@ //! peripherals.TWAI0, //! can_tx_pin, //! can_rx_pin, -//! &mut system.peripheral_clock_control, //! &clocks, //! CAN_BAUDRATE, //! ); @@ -274,12 +273,11 @@ where peripheral: impl Peripheral

+ 'd, tx_pin: impl Peripheral

+ 'd, rx_pin: impl Peripheral

+ 'd, - clock_control: &mut PeripheralClockControl, clocks: &Clocks, baud_rate: BaudRate, ) -> Self { // Enable the peripheral clock for the TWAI peripheral. - clock_control.enable(T::SYSTEM_PERIPHERAL); + PeripheralClockControl::enable(T::SYSTEM_PERIPHERAL); // Set up the GPIO pins. crate::into_ref!(tx_pin, rx_pin); diff --git a/esp-hal-common/src/uart.rs b/esp-hal-common/src/uart.rs index ba8f9ebeed1..57a5c54e522 100644 --- a/esp-hal-common/src/uart.rs +++ b/esp-hal-common/src/uart.rs @@ -24,13 +24,7 @@ //! io.pins.gpio2.into_floating_input(), //! ); //! -//! let mut serial1 = Uart::new_with_config( -//! peripherals.UART1, -//! config, -//! Some(pins), -//! &clocks, -//! &mut system.peripheral_clock_control, -//! ); +//! let mut serial1 = Uart::new_with_config(peripherals.UART1, config, Some(pins), &clocks); //! //! timer0.start(250u64.millis()); //! @@ -416,12 +410,11 @@ where config: Config, mut pins: Option

, clocks: &Clocks, - peripheral_clock_control: &mut PeripheralClockControl, ) -> Self where P: UartPins, { - T::enable_peripheral(peripheral_clock_control); + T::enable_peripheral(); T::disable_rx_interrupts(); T::disable_tx_interrupts(); @@ -448,21 +441,11 @@ where } /// Create a new UART instance with defaults - pub fn new( - uart: impl Peripheral

+ 'd, - clocks: &Clocks, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(uart: impl Peripheral

+ 'd, clocks: &Clocks) -> Self { use crate::gpio::*; // not real, just to satify the type type Pins<'a> = TxRxPins<'a, GpioPin, 2>, GpioPin, 0>>; - Self::new_with_config( - uart, - Default::default(), - None::>, - clocks, - peripheral_clock_control, - ) + Self::new_with_config(uart, Default::default(), None::>, clocks) } /// Split the Uart into a transmitter and receiver, which is @@ -957,7 +940,7 @@ pub trait Instance { fn rx_signal() -> InputSignal; fn cts_signal() -> InputSignal; fn rts_signal() -> OutputSignal; - fn enable_peripheral(peripheral_clock_control: &mut PeripheralClockControl); + fn enable_peripheral(); } macro_rules! impl_instance { @@ -989,8 +972,8 @@ macro_rules! impl_instance { OutputSignal::$rts } - fn enable_peripheral(peripheral_clock_control: &mut PeripheralClockControl) { - peripheral_clock_control.enable(crate::system::Peripheral::$peri); + fn enable_peripheral() { + PeripheralClockControl::enable(crate::system::Peripheral::$peri); } } }; diff --git a/esp-hal-common/src/usb_serial_jtag.rs b/esp-hal-common/src/usb_serial_jtag.rs index ff4cddf0c8d..eacbfb01e0c 100644 --- a/esp-hal-common/src/usb_serial_jtag.rs +++ b/esp-hal-common/src/usb_serial_jtag.rs @@ -11,12 +11,9 @@ //! ## Example //! ```no_run //! let peripherals = Peripherals::take(); -//! let mut system = peripherals.SYSTEM.split(); -//! let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); //! ... //! // Initialize USB Serial/JTAG peripheral -//! let mut usb_serial = -//! UsbSerialJtag::new(peripherals.USB_DEVICE, &mut system.peripheral_clock_control); +//! let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE); use core::convert::Infallible; @@ -26,23 +23,20 @@ use crate::{ system::PeripheralClockControl, }; +/// Custom USB serial error type +type Error = Infallible; + /// USB Serial JTAG driver pub struct UsbSerialJtag<'d> { usb_serial: PeripheralRef<'d, USB_DEVICE>, } -/// Custom USB serial error type -type Error = Infallible; - impl<'d> UsbSerialJtag<'d> { /// Create a new USB serial/JTAG instance with defaults - pub fn new( - usb_serial: impl Peripheral

+ 'd, - peripheral_clock_control: &mut PeripheralClockControl, - ) -> Self { + pub fn new(usb_serial: impl Peripheral

+ 'd) -> Self { crate::into_ref!(usb_serial); - peripheral_clock_control.enable(crate::system::Peripheral::Sha); + PeripheralClockControl::enable(crate::system::Peripheral::UsbDevice); let mut dev = Self { usb_serial }; dev.usb_serial.disable_rx_interrupts(); diff --git a/esp-hal-smartled/src/lib.rs b/esp-hal-smartled/src/lib.rs index d50bbdab5e1..86e5805803e 100644 --- a/esp-hal-smartled/src/lib.rs +++ b/esp-hal-smartled/src/lib.rs @@ -12,13 +12,7 @@ //! //! ```rust,ignore //! let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); -//! let rmt = Rmt::new( -//! peripherals.RMT, -//! 80u32.MHz(), -//! &mut system.peripheral_clock_control, -//! &clocks, -//! ) -//! .unwrap(); +//! let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); //! //! let led = ::new(rmt.channel0, io.pins.gpio0); //! ``` diff --git a/esp32-hal/examples/advanced_serial.rs b/esp32-hal/examples/advanced_serial.rs index 1cac415877c..1cbd546890b 100644 --- a/esp32-hal/examples/advanced_serial.rs +++ b/esp32-hal/examples/advanced_serial.rs @@ -29,7 +29,7 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let config = Config { @@ -45,13 +45,7 @@ fn main() -> ! { io.pins.gpio17.into_floating_input(), ); - let mut serial1 = Uart::new_with_config( - peripherals.UART1, - config, - Some(pins), - &clocks, - &mut system.peripheral_clock_control, - ); + let mut serial1 = Uart::new_with_config(peripherals.UART1, config, Some(pins), &clocks); let mut delay = Delay::new(&clocks); diff --git a/esp32-hal/examples/aes.rs b/esp32-hal/examples/aes.rs index 1cba192852a..f35172add3d 100644 --- a/esp32-hal/examples/aes.rs +++ b/esp32-hal/examples/aes.rs @@ -19,10 +19,10 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); + let mut aes = Aes::new(peripherals.AES); let keytext = "SUp4SeCp@sSw0rd".as_bytes(); let plaintext = "message".as_bytes(); diff --git a/esp32-hal/examples/crc.rs b/esp32-hal/examples/crc.rs index 517aefc92ac..f912c5da9b2 100644 --- a/esp32-hal/examples/crc.rs +++ b/esp32-hal/examples/crc.rs @@ -19,20 +19,12 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); timer0.start(1u64.secs()); diff --git a/esp32-hal/examples/embassy_hello_world.rs b/esp32-hal/examples/embassy_hello_world.rs index eead4980c19..cfb16bd7766 100644 --- a/esp32-hal/examples/embassy_hello_world.rs +++ b/esp32-hal/examples/embassy_hello_world.rs @@ -38,14 +38,10 @@ async fn run2() { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let executor = make_static!(Executor::new()); diff --git a/esp32-hal/examples/embassy_i2c.rs b/esp32-hal/examples/embassy_i2c.rs index d64ef98bce6..51f73a3247a 100644 --- a/esp32-hal/examples/embassy_i2c.rs +++ b/esp32-hal/examples/embassy_i2c.rs @@ -45,14 +45,10 @@ async fn run(i2c: I2C<'static, I2C0>) { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -62,7 +58,6 @@ fn main() -> ! { io.pins.gpio32, io.pins.gpio33, 400u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32-hal/examples/embassy_i2s_read.rs b/esp32-hal/examples/embassy_i2s_read.rs index 3f6fa1e452c..30966a97d68 100644 --- a/esp32-hal/examples/embassy_i2s_read.rs +++ b/esp32-hal/examples/embassy_i2s_read.rs @@ -68,19 +68,15 @@ fn main() -> ! { esp_println::logger::init_logger_from_env(); esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.i2s0channel; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -98,7 +94,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32-hal/examples/embassy_i2s_sound.rs b/esp32-hal/examples/embassy_i2s_sound.rs index 922ad62fe3a..8e84d2ac174 100644 --- a/esp32-hal/examples/embassy_i2s_sound.rs +++ b/esp32-hal/examples/embassy_i2s_sound.rs @@ -106,19 +106,15 @@ fn main() -> ! { esp_println::logger::init_logger_from_env(); esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.i2s0channel; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -136,7 +132,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32-hal/examples/embassy_multicore.rs b/esp32-hal/examples/embassy_multicore.rs index 628e0a90114..d45b14f805e 100644 --- a/esp32-hal/examples/embassy_multicore.rs +++ b/esp32-hal/examples/embassy_multicore.rs @@ -65,14 +65,10 @@ async fn enable_disable_led(control: &'static Signal ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); // Set GPIO2 as an output, and set its state high initially. diff --git a/esp32-hal/examples/embassy_multicore_interrupt.rs b/esp32-hal/examples/embassy_multicore_interrupt.rs index a3d412e80a3..378ea772a3f 100644 --- a/esp32-hal/examples/embassy_multicore_interrupt.rs +++ b/esp32-hal/examples/embassy_multicore_interrupt.rs @@ -82,14 +82,10 @@ async fn enable_disable_led(control: &'static Signal ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); // Set GPIO2 as an output, and set its state high initially. diff --git a/esp32-hal/examples/embassy_multiprio.rs b/esp32-hal/examples/embassy_multiprio.rs index 56457ba0daf..7311976d125 100644 --- a/esp32-hal/examples/embassy_multiprio.rs +++ b/esp32-hal/examples/embassy_multiprio.rs @@ -82,14 +82,10 @@ async fn low_prio_async() { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); // Set GPIO2 as an output, and set its state high initially. diff --git a/esp32-hal/examples/embassy_rmt_rx.rs b/esp32-hal/examples/embassy_rmt_rx.rs index fd45e44e043..01b407b3bd2 100644 --- a/esp32-hal/examples/embassy_rmt_rx.rs +++ b/esp32-hal/examples/embassy_rmt_rx.rs @@ -94,18 +94,16 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = - esp32_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); + let timer_group0 = esp32_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); let channel = rmt .channel2 diff --git a/esp32-hal/examples/embassy_rmt_tx.rs b/esp32-hal/examples/embassy_rmt_tx.rs index cbbca79ee59..243bb27cb2b 100644 --- a/esp32-hal/examples/embassy_rmt_tx.rs +++ b/esp32-hal/examples/embassy_rmt_tx.rs @@ -50,18 +50,16 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = - esp32_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); + let timer_group0 = esp32_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); let channel = rmt .channel0 diff --git a/esp32-hal/examples/embassy_serial.rs b/esp32-hal/examples/embassy_serial.rs index fe718322046..be943fe8e97 100644 --- a/esp32-hal/examples/embassy_serial.rs +++ b/esp32-hal/examples/embassy_serial.rs @@ -68,18 +68,10 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); uart0 .set_rx_fifo_full_threshold(READ_BUF_SIZE as u16) diff --git a/esp32-hal/examples/embassy_spi.rs b/esp32-hal/examples/embassy_spi.rs index e53d4092e23..0c0c711a05e 100644 --- a/esp32-hal/examples/embassy_spi.rs +++ b/esp32-hal/examples/embassy_spi.rs @@ -53,14 +53,10 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); esp32_hal::interrupt::enable( @@ -75,7 +71,7 @@ fn main() -> ! { let mosi = io.pins.gpio23; let cs = io.pins.gpio22; - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.spi2channel; let descriptors = make_static!([0u32; 8 * 3]); @@ -89,7 +85,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32-hal/examples/embassy_wait.rs b/esp32-hal/examples/embassy_wait.rs index 4c161cb60b1..13de0409733 100644 --- a/esp32-hal/examples/embassy_wait.rs +++ b/esp32-hal/examples/embassy_wait.rs @@ -34,14 +34,10 @@ async fn ping(mut pin: Gpio0>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32-hal/examples/hello_rgb.rs b/esp32-hal/examples/hello_rgb.rs index 370393cd8ed..be73aaf459c 100644 --- a/esp32-hal/examples/hello_rgb.rs +++ b/esp32-hal/examples/hello_rgb.rs @@ -26,19 +26,13 @@ use smart_leds::{ #[entry] fn main() -> ! { let peripherals = peripherals::Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally - let rmt = Rmt::new( - peripherals.RMT, - 80u32.MHz(), - &mut system.peripheral_clock_control, - &clocks, - ) - .unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); // We use one of the RMT channels to instantiate a `SmartLedsAdapter` which can // be used directly with all `smart_led` implementations diff --git a/esp32-hal/examples/hello_world.rs b/esp32-hal/examples/hello_world.rs index 22faad8f567..1e6f9f97b68 100644 --- a/esp32-hal/examples/hello_world.rs +++ b/esp32-hal/examples/hello_world.rs @@ -19,20 +19,12 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); timer0.start(1u64.secs()); diff --git a/esp32-hal/examples/i2c_bmp180_calibration_data.rs b/esp32-hal/examples/i2c_bmp180_calibration_data.rs index 304b0b52ab8..22f9501cebf 100644 --- a/esp32-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32-hal/examples/i2c_bmp180_calibration_data.rs @@ -16,7 +16,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -28,7 +28,6 @@ fn main() -> ! { io.pins.gpio32, io.pins.gpio33, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32-hal/examples/i2c_display.rs b/esp32-hal/examples/i2c_display.rs index 35a45cf394f..5b07dfc4652 100644 --- a/esp32-hal/examples/i2c_display.rs +++ b/esp32-hal/examples/i2c_display.rs @@ -34,14 +34,10 @@ use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -53,7 +49,6 @@ fn main() -> ! { io.pins.gpio32, io.pins.gpio33, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32-hal/examples/i2s_read.rs b/esp32-hal/examples/i2s_read.rs index 6c492b0e53a..6192cb29798 100644 --- a/esp32-hal/examples/i2s_read.rs +++ b/esp32-hal/examples/i2s_read.rs @@ -28,12 +28,12 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.i2s0channel; let mut tx_descriptors = [0u32; 8 * 3]; @@ -51,7 +51,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32-hal/examples/i2s_sound.rs b/esp32-hal/examples/i2s_sound.rs index 587e9997f67..288866cde9f 100644 --- a/esp32-hal/examples/i2s_sound.rs +++ b/esp32-hal/examples/i2s_sound.rs @@ -51,12 +51,12 @@ const SINE: [i16; 64] = [ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.i2s0channel; let mut tx_descriptors = [0u32; 20 * 3]; @@ -74,7 +74,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32-hal/examples/ledc.rs b/esp32-hal/examples/ledc.rs index 855b968dcda..1735bb4084e 100644 --- a/esp32-hal/examples/ledc.rs +++ b/esp32-hal/examples/ledc.rs @@ -23,17 +23,13 @@ use esp_backtrace as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); - let ledc = LEDC::new( - peripherals.LEDC, - &clocks, - &mut system.peripheral_clock_control, - ); + let ledc = LEDC::new(peripherals.LEDC, &clocks); let mut hstimer0 = ledc.get_timer::(timer::Number::Timer0); hstimer0 diff --git a/esp32-hal/examples/mcpwm.rs b/esp32-hal/examples/mcpwm.rs index 29ed611b292..c005293cc78 100644 --- a/esp32-hal/examples/mcpwm.rs +++ b/esp32-hal/examples/mcpwm.rs @@ -18,7 +18,7 @@ use esp_backtrace as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -26,11 +26,7 @@ fn main() -> ! { // initialize peripheral let clock_cfg = PeripheralClockConfig::with_frequency(&clocks, 40u32.MHz()).unwrap(); - let mut mcpwm = MCPWM::new( - peripherals.MCPWM0, - clock_cfg, - &mut system.peripheral_clock_control, - ); + let mut mcpwm = MCPWM::new(peripherals.MCPWM0, clock_cfg); // connect operator0 to timer0 mcpwm.operator0.set_timer(&mcpwm.timer0); diff --git a/esp32-hal/examples/multicore.rs b/esp32-hal/examples/multicore.rs index 7ea460632a9..da36f91c525 100644 --- a/esp32-hal/examples/multicore.rs +++ b/esp32-hal/examples/multicore.rs @@ -24,21 +24,13 @@ static mut APP_CORE_STACK: Stack<8192> = Stack::new(); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); let mut timer1 = timer_group1.timer0; timer0.start(1u64.secs()); diff --git a/esp32-hal/examples/pcnt_encoder.rs b/esp32-hal/examples/pcnt_encoder.rs index fc771b3dcba..b7a45631203 100644 --- a/esp32-hal/examples/pcnt_encoder.rs +++ b/esp32-hal/examples/pcnt_encoder.rs @@ -33,7 +33,7 @@ static VALUE: AtomicI32 = AtomicI32::new(0); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -42,7 +42,7 @@ fn main() -> ! { // setup a pulse couter println!("setup pulse counter unit 0"); - let pcnt = PCNT::new(peripherals.PCNT, &mut system.peripheral_clock_control); + let pcnt = PCNT::new(peripherals.PCNT); let mut u0 = pcnt.get_unit(unit_number); u0.configure(unit::Config { low_limit: -100, diff --git a/esp32-hal/examples/qspi_flash.rs b/esp32-hal/examples/qspi_flash.rs index e71918e3b56..b68e8a60e8c 100644 --- a/esp32-hal/examples/qspi_flash.rs +++ b/esp32-hal/examples/qspi_flash.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -44,7 +44,7 @@ fn main() -> ! { let sio3 = io.pins.gpio16; let cs = io.pins.gpio4; - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.spi2channel; let mut descriptors = [0u32; 8 * 3]; @@ -60,7 +60,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32-hal/examples/ram.rs b/esp32-hal/examples/ram.rs index c54efdb4625..5ea0704d61d 100644 --- a/esp32-hal/examples/ram.rs +++ b/esp32-hal/examples/ram.rs @@ -32,14 +32,10 @@ static mut SOME_ZEROED_DATA: [u8; 8] = [0; 8]; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; // The RWDT flash boot protection must be enabled, as it is triggered as part of diff --git a/esp32-hal/examples/rmt_rx.rs b/esp32-hal/examples/rmt_rx.rs index ddc0275b207..037b22e44c0 100644 --- a/esp32-hal/examples/rmt_rx.rs +++ b/esp32-hal/examples/rmt_rx.rs @@ -21,12 +21,11 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut out = io.pins.gpio15.into_push_pull_output(); - let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel0 diff --git a/esp32-hal/examples/rmt_tx.rs b/esp32-hal/examples/rmt_tx.rs index 688a473a5d1..7ef783b02cb 100644 --- a/esp32-hal/examples/rmt_tx.rs +++ b/esp32-hal/examples/rmt_tx.rs @@ -20,11 +20,10 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel0 diff --git a/esp32-hal/examples/rsa.rs b/esp32-hal/examples/rsa.rs index 2d75a6862bf..c86bf102640 100644 --- a/esp32-hal/examples/rsa.rs +++ b/esp32-hal/examples/rsa.rs @@ -56,11 +56,11 @@ const fn compute_mprime(modulus: &U512) -> u32 { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let rsa = peripherals.RSA; - let mut rsa = Rsa::new(rsa, &mut system.peripheral_clock_control); + let mut rsa = Rsa::new(rsa); block!(rsa.ready()).unwrap(); mod_exp_example(&mut rsa); mod_multi_example(&mut rsa); diff --git a/esp32-hal/examples/serial_interrupts.rs b/esp32-hal/examples/serial_interrupts.rs index c91c12e3b8a..04064bb735a 100644 --- a/esp32-hal/examples/serial_interrupts.rs +++ b/esp32-hal/examples/serial_interrupts.rs @@ -25,21 +25,13 @@ static SERIAL: Mutex>>> = Mutex::new(RefCell::new(Non #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); uart0.set_rx_fifo_full_threshold(30).unwrap(); uart0.listen_at_cmd(); diff --git a/esp32-hal/examples/sha.rs b/esp32-hal/examples/sha.rs index c689ddcbb5f..78b10545e0e 100644 --- a/esp32-hal/examples/sha.rs +++ b/esp32-hal/examples/sha.rs @@ -19,16 +19,12 @@ use sha2::{Digest, Sha512}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); let mut remaining = source_data.clone(); - let mut hasher = Sha::new( - peripherals.SHA, - ShaMode::SHA512, - &mut system.peripheral_clock_control, - ); + let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA512); // Short hashes can be created by decreasing the output buffer to the desired // length diff --git a/esp32-hal/examples/spi_eh1_device_loopback.rs b/esp32-hal/examples/spi_eh1_device_loopback.rs index ecc0142877d..6bbcd727512 100644 --- a/esp32-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32-hal/examples/spi_eh1_device_loopback.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { miso, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, )); let mut spi_device_1 = spi_controller.add_device(io.pins.gpio12); diff --git a/esp32-hal/examples/spi_eh1_loopback.rs b/esp32-hal/examples/spi_eh1_loopback.rs index a735473e2da..9fe1bdad498 100644 --- a/esp32-hal/examples/spi_eh1_loopback.rs +++ b/esp32-hal/examples/spi_eh1_loopback.rs @@ -31,7 +31,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { cs, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32-hal/examples/spi_halfduplex_read_manufacturer_id.rs index f1e3810095f..90753cce4be 100644 --- a/esp32-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -31,7 +31,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -52,7 +52,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32-hal/examples/spi_loopback.rs b/esp32-hal/examples/spi_loopback.rs index 754bef6a58d..46518efce56 100644 --- a/esp32-hal/examples/spi_loopback.rs +++ b/esp32-hal/examples/spi_loopback.rs @@ -30,7 +30,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -47,7 +47,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32-hal/examples/spi_loopback_dma.rs b/esp32-hal/examples/spi_loopback_dma.rs index 09c7f97e69e..95cfaddbbf9 100644 --- a/esp32-hal/examples/spi_loopback_dma.rs +++ b/esp32-hal/examples/spi_loopback_dma.rs @@ -32,7 +32,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -41,7 +41,7 @@ fn main() -> ! { let mosi = io.pins.gpio23; let cs = io.pins.gpio22; - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.spi2channel; let mut descriptors = [0u32; 8 * 3]; @@ -55,7 +55,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32-hal/examples/timer_interrupt.rs b/esp32-hal/examples/timer_interrupt.rs index 9f56e45088c..5825edfd784 100644 --- a/esp32-hal/examples/timer_interrupt.rs +++ b/esp32-hal/examples/timer_interrupt.rs @@ -26,22 +26,14 @@ static TIMER11: Mutex>>>> = Mutex::new(RefCel #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer00 = timer_group0.timer0; let mut timer01 = timer_group0.timer1; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); let mut timer10 = timer_group1.timer0; let mut timer11 = timer_group1.timer1; diff --git a/esp32-hal/examples/watchdog.rs b/esp32-hal/examples/watchdog.rs index 24620383b48..52b1f2c7d37 100644 --- a/esp32-hal/examples/watchdog.rs +++ b/esp32-hal/examples/watchdog.rs @@ -13,14 +13,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let mut wdt = timer_group0.wdt; diff --git a/esp32c2-hal/examples/adc.rs b/esp32c2-hal/examples/adc.rs index 083ae86fcf3..ad8e0406975 100644 --- a/esp32c2-hal/examples/adc.rs +++ b/esp32c2-hal/examples/adc.rs @@ -19,7 +19,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -31,12 +31,7 @@ fn main() -> ! { let mut pin = adc1_config.enable_pin(io.pins.gpio2.into_analog(), Attenuation::Attenuation11dB); - let mut adc1 = ADC::::adc( - &mut system.peripheral_clock_control, - analog.adc1, - adc1_config, - ) - .unwrap(); + let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); let mut delay = Delay::new(&clocks); diff --git a/esp32c2-hal/examples/adc_cal.rs b/esp32c2-hal/examples/adc_cal.rs index 8a0a17ed911..5a67f61aebc 100644 --- a/esp32c2-hal/examples/adc_cal.rs +++ b/esp32c2-hal/examples/adc_cal.rs @@ -20,7 +20,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -39,12 +39,7 @@ fn main() -> ! { let mut pin = adc1_config.enable_pin_with_cal::<_, AdcCal>(io.pins.gpio2.into_analog(), atten); - let mut adc1 = ADC::::adc( - &mut system.peripheral_clock_control, - analog.adc1, - adc1_config, - ) - .unwrap(); + let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); let mut delay = Delay::new(&clocks); diff --git a/esp32c2-hal/examples/advanced_serial.rs b/esp32c2-hal/examples/advanced_serial.rs index 7d0f6c00b41..2946bce18c0 100644 --- a/esp32c2-hal/examples/advanced_serial.rs +++ b/esp32c2-hal/examples/advanced_serial.rs @@ -29,14 +29,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let config = Config { @@ -52,13 +48,7 @@ fn main() -> ! { io.pins.gpio2.into_floating_input(), ); - let mut serial1 = Uart::new_with_config( - peripherals.UART1, - config, - Some(pins), - &clocks, - &mut system.peripheral_clock_control, - ); + let mut serial1 = Uart::new_with_config(peripherals.UART1, config, Some(pins), &clocks); timer0.start(250u64.millis()); diff --git a/esp32c2-hal/examples/crc.rs b/esp32c2-hal/examples/crc.rs index 6a6cbc47e7e..8223fc83c46 100644 --- a/esp32c2-hal/examples/crc.rs +++ b/esp32c2-hal/examples/crc.rs @@ -19,19 +19,11 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; timer0.start(1u64.secs()); diff --git a/esp32c2-hal/examples/debug_assist.rs b/esp32c2-hal/examples/debug_assist.rs index b38637f2e1f..6bd3e82a354 100644 --- a/esp32c2-hal/examples/debug_assist.rs +++ b/esp32c2-hal/examples/debug_assist.rs @@ -22,13 +22,10 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut da = DebugAssist::new( - peripherals.ASSIST_DEBUG, - &mut system.peripheral_clock_control, - ); + let mut da = DebugAssist::new(peripherals.ASSIST_DEBUG); da.enable_sp_monitor(0x3fccee00, 0x3fcd0000); diff --git a/esp32c2-hal/examples/direct-vectoring.rs b/esp32c2-hal/examples/direct-vectoring.rs index b5aacf6f51c..1153712505e 100644 --- a/esp32c2-hal/examples/direct-vectoring.rs +++ b/esp32c2-hal/examples/direct-vectoring.rs @@ -16,10 +16,10 @@ static SWINT: Mutex>> = Mutex::new(RefC #[entry] unsafe fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clockctrl = system.clock_control; let sw_int = system.software_interrupt_control; - let clocks = ClockControl::boot_defaults(clockctrl).freeze(); + let _clocks = ClockControl::boot_defaults(clockctrl).freeze(); critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); unsafe { diff --git a/esp32c2-hal/examples/ecc.rs b/esp32c2-hal/examples/ecc.rs index 2daa775f629..ec87daf49cf 100644 --- a/esp32c2-hal/examples/ecc.rs +++ b/esp32c2-hal/examples/ecc.rs @@ -42,13 +42,13 @@ const TEST_PARAMS_VECTOR: TestParams = TestParams { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let _system = peripherals.SYSTEM.split(); let mut rng = Rng::new(peripherals.RNG); println!("ECC example"); - let mut hw_ecc = Ecc::new(peripherals.ECC, &mut system.peripheral_clock_control); + let mut hw_ecc = Ecc::new(peripherals.ECC); println!("Beginning stress tests..."); test_affine_point_multiplication(&mut hw_ecc, &mut rng); diff --git a/esp32c2-hal/examples/embassy_hello_world.rs b/esp32c2-hal/examples/embassy_hello_world.rs index d8c196df200..53fbc487787 100644 --- a/esp32c2-hal/examples/embassy_hello_world.rs +++ b/esp32c2-hal/examples/embassy_hello_world.rs @@ -33,7 +33,7 @@ async fn run2() { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -45,12 +45,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let executor = make_static!(Executor::new()); diff --git a/esp32c2-hal/examples/embassy_i2c.rs b/esp32c2-hal/examples/embassy_i2c.rs index ae4b62408ab..74fa205a05c 100644 --- a/esp32c2-hal/examples/embassy_i2c.rs +++ b/esp32c2-hal/examples/embassy_i2c.rs @@ -45,7 +45,7 @@ async fn run(i2c: I2C<'static, I2C0>) { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -57,12 +57,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -72,7 +67,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 400u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c2-hal/examples/embassy_serial.rs b/esp32c2-hal/examples/embassy_serial.rs index 2c6c0f3afe6..a0754b75b4d 100644 --- a/esp32c2-hal/examples/embassy_serial.rs +++ b/esp32c2-hal/examples/embassy_serial.rs @@ -65,7 +65,7 @@ async fn reader(mut rx: UartRx<'static, UART0>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -77,19 +77,10 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); uart0 .set_rx_fifo_full_threshold(READ_BUF_SIZE as u16) diff --git a/esp32c2-hal/examples/embassy_spi.rs b/esp32c2-hal/examples/embassy_spi.rs index f557030a046..720b71ea1fe 100644 --- a/esp32c2-hal/examples/embassy_spi.rs +++ b/esp32c2-hal/examples/embassy_spi.rs @@ -54,7 +54,7 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -66,12 +66,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); esp32c2_hal::interrupt::enable( @@ -86,7 +81,7 @@ fn main() -> ! { let mosi = io.pins.gpio7; let cs = io.pins.gpio10; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let descriptors = make_static!([0u32; 8 * 3]); @@ -100,7 +95,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32c2-hal/examples/embassy_wait.rs b/esp32c2-hal/examples/embassy_wait.rs index 59c5baf6f3c..0ba712750e1 100644 --- a/esp32c2-hal/examples/embassy_wait.rs +++ b/esp32c2-hal/examples/embassy_wait.rs @@ -34,7 +34,7 @@ async fn ping(mut pin: Gpio9>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -46,12 +46,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32c2-hal/examples/hello_world.rs b/esp32c2-hal/examples/hello_world.rs index e0b414bf088..50ba6f7c378 100644 --- a/esp32c2-hal/examples/hello_world.rs +++ b/esp32c2-hal/examples/hello_world.rs @@ -19,19 +19,11 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; timer0.start(1u64.secs()); diff --git a/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs b/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs index 5d3a3c064c4..b076281978e 100644 --- a/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs @@ -16,7 +16,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -28,7 +28,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c2-hal/examples/i2c_display.rs b/esp32c2-hal/examples/i2c_display.rs index 477245a29ce..2e17fe08654 100644 --- a/esp32c2-hal/examples/i2c_display.rs +++ b/esp32c2-hal/examples/i2c_display.rs @@ -34,14 +34,10 @@ use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -53,7 +49,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c2-hal/examples/interrupt_preemption.rs b/esp32c2-hal/examples/interrupt_preemption.rs index 69377b30fed..2bb9c57817b 100644 --- a/esp32c2-hal/examples/interrupt_preemption.rs +++ b/esp32c2-hal/examples/interrupt_preemption.rs @@ -17,8 +17,6 @@ use esp32c2_hal::{ prelude::*, riscv, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -27,10 +25,10 @@ static SWINT: Mutex>> = Mutex::new(RefC #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clockctrl = system.clock_control; let sw_int = system.software_interrupt_control; - let clocks = ClockControl::boot_defaults(clockctrl).freeze(); + let _clocks = ClockControl::boot_defaults(clockctrl).freeze(); critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); diff --git a/esp32c2-hal/examples/ledc.rs b/esp32c2-hal/examples/ledc.rs index 1e34a7f1679..89ac68d9fd0 100644 --- a/esp32c2-hal/examples/ledc.rs +++ b/esp32c2-hal/examples/ledc.rs @@ -24,17 +24,13 @@ use esp_backtrace as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); - let mut ledc = LEDC::new( - peripherals.LEDC, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut ledc = LEDC::new(peripherals.LEDC, &clocks); ledc.set_global_slow_clock(LSGlobalClkSource::APBClk); let mut lstimer0 = ledc.get_timer::(timer::Number::Timer2); diff --git a/esp32c2-hal/examples/qspi_flash.rs b/esp32c2-hal/examples/qspi_flash.rs index 70005fe53a2..d59287db2ac 100644 --- a/esp32c2-hal/examples/qspi_flash.rs +++ b/esp32c2-hal/examples/qspi_flash.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -44,7 +44,7 @@ fn main() -> ! { let sio3 = io.pins.gpio8; let cs = io.pins.gpio9; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut descriptors = [0u32; 8 * 3]; @@ -60,7 +60,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32c2-hal/examples/serial_interrupts.rs b/esp32c2-hal/examples/serial_interrupts.rs index bc9de87c7e3..f7625463a06 100644 --- a/esp32c2-hal/examples/serial_interrupts.rs +++ b/esp32c2-hal/examples/serial_interrupts.rs @@ -27,19 +27,11 @@ static SERIAL: Mutex>>> = Mutex::new(RefCell::new(Non #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; uart0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); diff --git a/esp32c2-hal/examples/sha.rs b/esp32c2-hal/examples/sha.rs index 27b0fc88b50..ee66f288a34 100644 --- a/esp32c2-hal/examples/sha.rs +++ b/esp32c2-hal/examples/sha.rs @@ -18,16 +18,12 @@ use sha2::{Digest, Sha256}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); let mut remaining = source_data; - let mut hasher = Sha::new( - peripherals.SHA, - ShaMode::SHA256, - &mut system.peripheral_clock_control, - ); + let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA256); // Short hashes can be created by decreasing the output buffer to the desired // length diff --git a/esp32c2-hal/examples/spi_eh1_device_loopback.rs b/esp32c2-hal/examples/spi_eh1_device_loopback.rs index 1c0dc2e65f4..9b0f6491e4f 100644 --- a/esp32c2-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32c2-hal/examples/spi_eh1_device_loopback.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { miso, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, )); let mut spi_device_1 = spi_controller.add_device(io.pins.gpio3); diff --git a/esp32c2-hal/examples/spi_eh1_loopback.rs b/esp32c2-hal/examples/spi_eh1_loopback.rs index 9dd96774d9b..6ad68ead749 100644 --- a/esp32c2-hal/examples/spi_eh1_loopback.rs +++ b/esp32c2-hal/examples/spi_eh1_loopback.rs @@ -31,7 +31,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { cs, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c2-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32c2-hal/examples/spi_halfduplex_read_manufacturer_id.rs index 66cb2292ea6..4b40ceaf954 100644 --- a/esp32c2-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32c2-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -31,7 +31,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -52,7 +52,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c2-hal/examples/spi_loopback.rs b/esp32c2-hal/examples/spi_loopback.rs index 989b52a2e5f..f766f809d1e 100644 --- a/esp32c2-hal/examples/spi_loopback.rs +++ b/esp32c2-hal/examples/spi_loopback.rs @@ -30,7 +30,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -47,7 +47,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c2-hal/examples/spi_loopback_dma.rs b/esp32c2-hal/examples/spi_loopback_dma.rs index e16cb12ae84..be4adc83292 100644 --- a/esp32c2-hal/examples/spi_loopback_dma.rs +++ b/esp32c2-hal/examples/spi_loopback_dma.rs @@ -32,7 +32,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -41,7 +41,7 @@ fn main() -> ! { let mosi = io.pins.gpio7; let cs = io.pins.gpio10; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut descriptors = [0u32; 8 * 3]; @@ -55,7 +55,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32c2-hal/examples/timer_interrupt.rs b/esp32c2-hal/examples/timer_interrupt.rs index 97361dfd614..fdb2cd987ed 100644 --- a/esp32c2-hal/examples/timer_interrupt.rs +++ b/esp32c2-hal/examples/timer_interrupt.rs @@ -22,14 +22,10 @@ static TIMER0: Mutex>>>> = Mutex::new(RefCell #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; interrupt::enable( diff --git a/esp32c2-hal/examples/watchdog.rs b/esp32c2-hal/examples/watchdog.rs index 9d6d471db62..be8bca070a0 100644 --- a/esp32c2-hal/examples/watchdog.rs +++ b/esp32c2-hal/examples/watchdog.rs @@ -13,14 +13,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let mut wdt0 = timer_group0.wdt; diff --git a/esp32c3-hal/examples/adc.rs b/esp32c3-hal/examples/adc.rs index acdf5162160..5c42f58f589 100644 --- a/esp32c3-hal/examples/adc.rs +++ b/esp32c3-hal/examples/adc.rs @@ -19,7 +19,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -31,12 +31,7 @@ fn main() -> ! { let mut pin = adc1_config.enable_pin(io.pins.gpio2.into_analog(), Attenuation::Attenuation11dB); - let mut adc1 = ADC::::adc( - &mut system.peripheral_clock_control, - analog.adc1, - adc1_config, - ) - .unwrap(); + let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); let mut delay = Delay::new(&clocks); diff --git a/esp32c3-hal/examples/adc_cal.rs b/esp32c3-hal/examples/adc_cal.rs index 21c4658f448..069f6b6e0ab 100644 --- a/esp32c3-hal/examples/adc_cal.rs +++ b/esp32c3-hal/examples/adc_cal.rs @@ -20,7 +20,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -40,12 +40,7 @@ fn main() -> ! { let mut pin = adc1_config.enable_pin_with_cal::<_, AdcCal>(io.pins.gpio2.into_analog(), atten); - let mut adc1 = ADC::::adc( - &mut system.peripheral_clock_control, - analog.adc1, - adc1_config, - ) - .unwrap(); + let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); let mut delay = Delay::new(&clocks); diff --git a/esp32c3-hal/examples/advanced_serial.rs b/esp32c3-hal/examples/advanced_serial.rs index 59caad59915..5dad2133a7a 100644 --- a/esp32c3-hal/examples/advanced_serial.rs +++ b/esp32c3-hal/examples/advanced_serial.rs @@ -29,14 +29,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let config = Config { @@ -52,13 +48,7 @@ fn main() -> ! { io.pins.gpio2.into_floating_input(), ); - let mut serial1 = Uart::new_with_config( - peripherals.UART1, - config, - Some(pins), - &clocks, - &mut system.peripheral_clock_control, - ); + let mut serial1 = Uart::new_with_config(peripherals.UART1, config, Some(pins), &clocks); timer0.start(250u64.millis()); diff --git a/esp32c3-hal/examples/aes.rs b/esp32c3-hal/examples/aes.rs index 2f10481b2c6..70f44f59eb5 100644 --- a/esp32c3-hal/examples/aes.rs +++ b/esp32c3-hal/examples/aes.rs @@ -19,10 +19,10 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); + let mut aes = Aes::new(peripherals.AES); let keytext = "SUp4SeCp@sSw0rd".as_bytes(); let plaintext = "message".as_bytes(); diff --git a/esp32c3-hal/examples/crc.rs b/esp32c3-hal/examples/crc.rs index 22c3d3e3fec..482f5e77b3f 100644 --- a/esp32c3-hal/examples/crc.rs +++ b/esp32c3-hal/examples/crc.rs @@ -19,19 +19,11 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; timer0.start(1u64.secs()); diff --git a/esp32c3-hal/examples/debug_assist.rs b/esp32c3-hal/examples/debug_assist.rs index fa4da84e1c2..25000a42fd9 100644 --- a/esp32c3-hal/examples/debug_assist.rs +++ b/esp32c3-hal/examples/debug_assist.rs @@ -24,13 +24,10 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _ = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut da = DebugAssist::new( - peripherals.ASSIST_DEBUG, - &mut system.peripheral_clock_control, - ); + let mut da = DebugAssist::new(peripherals.ASSIST_DEBUG); // uncomment the functionality you want to test diff --git a/esp32c3-hal/examples/direct-vectoring.rs b/esp32c3-hal/examples/direct-vectoring.rs index 0170b9c6960..65ccfb9686c 100644 --- a/esp32c3-hal/examples/direct-vectoring.rs +++ b/esp32c3-hal/examples/direct-vectoring.rs @@ -20,10 +20,10 @@ static SWINT: Mutex>> = Mutex::new(RefC #[entry] unsafe fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clockctrl = system.clock_control; let sw_int = system.software_interrupt_control; - let clocks = ClockControl::boot_defaults(clockctrl).freeze(); + let _clocks = ClockControl::boot_defaults(clockctrl).freeze(); critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32c3-hal/examples/embassy_hello_world.rs b/esp32c3-hal/examples/embassy_hello_world.rs index 1cdf38fb300..d96aefe762b 100644 --- a/esp32c3-hal/examples/embassy_hello_world.rs +++ b/esp32c3-hal/examples/embassy_hello_world.rs @@ -33,7 +33,7 @@ async fn run2() { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -45,12 +45,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let executor = make_static!(Executor::new()); diff --git a/esp32c3-hal/examples/embassy_i2c.rs b/esp32c3-hal/examples/embassy_i2c.rs index 4304cae4fba..c496e85a2dd 100644 --- a/esp32c3-hal/examples/embassy_i2c.rs +++ b/esp32c3-hal/examples/embassy_i2c.rs @@ -45,7 +45,7 @@ async fn run(i2c: I2C<'static, I2C0>) { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -57,12 +57,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -72,7 +67,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 400u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c3-hal/examples/embassy_i2s_read.rs b/esp32c3-hal/examples/embassy_i2s_read.rs index 2c7ea3b4098..a9256b30c32 100644 --- a/esp32c3-hal/examples/embassy_i2s_read.rs +++ b/esp32c3-hal/examples/embassy_i2s_read.rs @@ -81,17 +81,12 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -109,7 +104,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c3-hal/examples/embassy_i2s_sound.rs b/esp32c3-hal/examples/embassy_i2s_sound.rs index 159b556a404..186a2d3d119 100644 --- a/esp32c3-hal/examples/embassy_i2s_sound.rs +++ b/esp32c3-hal/examples/embassy_i2s_sound.rs @@ -118,17 +118,12 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -146,7 +141,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c3-hal/examples/embassy_serial.rs b/esp32c3-hal/examples/embassy_serial.rs index c2b6853366c..429fe8fe20b 100644 --- a/esp32c3-hal/examples/embassy_serial.rs +++ b/esp32c3-hal/examples/embassy_serial.rs @@ -65,7 +65,7 @@ async fn reader(mut rx: UartRx<'static, UART0>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -77,19 +77,10 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); uart0 .set_rx_fifo_full_threshold(READ_BUF_SIZE as u16) diff --git a/esp32c3-hal/examples/embassy_spi.rs b/esp32c3-hal/examples/embassy_spi.rs index c48d93db2ac..61ad469a170 100644 --- a/esp32c3-hal/examples/embassy_spi.rs +++ b/esp32c3-hal/examples/embassy_spi.rs @@ -54,7 +54,7 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -66,12 +66,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); esp32c3_hal::interrupt::enable( @@ -86,7 +81,7 @@ fn main() -> ! { let mosi = io.pins.gpio7; let cs = io.pins.gpio10; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let descriptors = make_static!([0u32; 8 * 3]); @@ -100,7 +95,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32c3-hal/examples/embassy_wait.rs b/esp32c3-hal/examples/embassy_wait.rs index b556f46e40d..20114a1c858 100644 --- a/esp32c3-hal/examples/embassy_wait.rs +++ b/esp32c3-hal/examples/embassy_wait.rs @@ -34,7 +34,7 @@ async fn ping(mut pin: Gpio9>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -46,12 +46,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32c3-hal/examples/hello_rgb.rs b/esp32c3-hal/examples/hello_rgb.rs index 38c1bdc1961..bb98a60a364 100644 --- a/esp32c3-hal/examples/hello_rgb.rs +++ b/esp32c3-hal/examples/hello_rgb.rs @@ -24,19 +24,13 @@ use smart_leds::{ #[entry] fn main() -> ! { let peripherals = peripherals::Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally - let rmt = Rmt::new( - peripherals.RMT, - 80u32.MHz(), - &mut system.peripheral_clock_control, - &clocks, - ) - .unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); // We use one of the RMT channels to instantiate a `SmartLedsAdapter` which can // be used directly with all `smart_led` implementations diff --git a/esp32c3-hal/examples/hello_world.rs b/esp32c3-hal/examples/hello_world.rs index 39e7ac128e0..dbebbec28c0 100644 --- a/esp32c3-hal/examples/hello_world.rs +++ b/esp32c3-hal/examples/hello_world.rs @@ -19,19 +19,11 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; timer0.start(1u64.secs()); diff --git a/esp32c3-hal/examples/hmac.rs b/esp32c3-hal/examples/hmac.rs index 7f162872164..78f80ae7bc2 100644 --- a/esp32c3-hal/examples/hmac.rs +++ b/esp32c3-hal/examples/hmac.rs @@ -74,7 +74,7 @@ type HmacSha256 = HmacSw; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); @@ -82,7 +82,7 @@ fn main() -> ! { // Set sw key let key = [0_u8; 32].as_ref(); - let mut hw_hmac = Hmac::new(peripherals.HMAC, &mut system.peripheral_clock_control); + let mut hw_hmac = Hmac::new(peripherals.HMAC); let mut src = [0_u8; 1024]; rng.read(src.as_mut_slice()).unwrap(); diff --git a/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs b/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs index 15edb4a8001..b6e28895838 100644 --- a/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs @@ -16,7 +16,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -28,7 +28,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c3-hal/examples/i2c_display.rs b/esp32c3-hal/examples/i2c_display.rs index ec6237aa13a..bdc68022c69 100644 --- a/esp32c3-hal/examples/i2c_display.rs +++ b/esp32c3-hal/examples/i2c_display.rs @@ -34,14 +34,10 @@ use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -53,7 +49,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c3-hal/examples/i2s_read.rs b/esp32c3-hal/examples/i2s_read.rs index cf0a2055de6..6b0a408d20d 100644 --- a/esp32c3-hal/examples/i2s_read.rs +++ b/esp32c3-hal/examples/i2s_read.rs @@ -29,12 +29,12 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut tx_descriptors = [0u32; 8 * 3]; @@ -52,7 +52,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c3-hal/examples/i2s_sound.rs b/esp32c3-hal/examples/i2s_sound.rs index 6636645ad27..206ca600a17 100644 --- a/esp32c3-hal/examples/i2s_sound.rs +++ b/esp32c3-hal/examples/i2s_sound.rs @@ -52,12 +52,12 @@ const SINE: [i16; 64] = [ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut tx_descriptors = [0u32; 20 * 3]; @@ -75,7 +75,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c3-hal/examples/interrupt_preemption.rs b/esp32c3-hal/examples/interrupt_preemption.rs index f75e026aeb1..5581df8cec6 100644 --- a/esp32c3-hal/examples/interrupt_preemption.rs +++ b/esp32c3-hal/examples/interrupt_preemption.rs @@ -17,8 +17,6 @@ use esp32c3_hal::{ prelude::*, riscv, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -27,10 +25,10 @@ static SWINT: Mutex>> = Mutex::new(RefC #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clockctrl = system.clock_control; let sw_int = system.software_interrupt_control; - let clocks = ClockControl::boot_defaults(clockctrl).freeze(); + let _clocks = ClockControl::boot_defaults(clockctrl).freeze(); critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); diff --git a/esp32c3-hal/examples/ledc.rs b/esp32c3-hal/examples/ledc.rs index 4033bf7d997..d94186fa550 100644 --- a/esp32c3-hal/examples/ledc.rs +++ b/esp32c3-hal/examples/ledc.rs @@ -24,17 +24,13 @@ use esp_backtrace as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); - let mut ledc = LEDC::new( - peripherals.LEDC, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut ledc = LEDC::new(peripherals.LEDC, &clocks); ledc.set_global_slow_clock(LSGlobalClkSource::APBClk); let mut lstimer0 = ledc.get_timer::(timer::Number::Timer2); diff --git a/esp32c3-hal/examples/qspi_flash.rs b/esp32c3-hal/examples/qspi_flash.rs index cf8f8c9d8e5..9a95c12df61 100644 --- a/esp32c3-hal/examples/qspi_flash.rs +++ b/esp32c3-hal/examples/qspi_flash.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -44,7 +44,7 @@ fn main() -> ! { let sio3 = io.pins.gpio5; let cs = io.pins.gpio10; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut descriptors = [0u32; 8 * 3]; @@ -60,7 +60,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32c3-hal/examples/ram.rs b/esp32c3-hal/examples/ram.rs index 1147ff0df27..a0abf052984 100644 --- a/esp32c3-hal/examples/ram.rs +++ b/esp32c3-hal/examples/ram.rs @@ -32,14 +32,10 @@ static mut SOME_ZEROED_DATA: [u8; 8] = [0; 8]; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; // The RWDT flash boot protection must be enabled, as it is triggered as part of diff --git a/esp32c3-hal/examples/rmt_rx.rs b/esp32c3-hal/examples/rmt_rx.rs index ad1410e8e3e..a5c01d975c7 100644 --- a/esp32c3-hal/examples/rmt_rx.rs +++ b/esp32c3-hal/examples/rmt_rx.rs @@ -25,11 +25,10 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel2 diff --git a/esp32c3-hal/examples/rmt_tx.rs b/esp32c3-hal/examples/rmt_tx.rs index 41c1ff1cb98..d6f09f67b54 100644 --- a/esp32c3-hal/examples/rmt_tx.rs +++ b/esp32c3-hal/examples/rmt_tx.rs @@ -20,11 +20,10 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel0 diff --git a/esp32c3-hal/examples/rsa.rs b/esp32c3-hal/examples/rsa.rs index f6ffbf57e3c..08704fdce35 100644 --- a/esp32c3-hal/examples/rsa.rs +++ b/esp32c3-hal/examples/rsa.rs @@ -56,10 +56,10 @@ const fn compute_mprime(modulus: &U512) -> u32 { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); + let mut rsa = Rsa::new(peripherals.RSA); block!(rsa.ready()).unwrap(); mod_exp_example(&mut rsa); diff --git a/esp32c3-hal/examples/serial_interrupts.rs b/esp32c3-hal/examples/serial_interrupts.rs index 2ee76352add..4a8338382d0 100644 --- a/esp32c3-hal/examples/serial_interrupts.rs +++ b/esp32c3-hal/examples/serial_interrupts.rs @@ -27,19 +27,11 @@ static SERIAL: Mutex>>> = Mutex::new(RefCell::new(Non #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; uart0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); diff --git a/esp32c3-hal/examples/sha.rs b/esp32c3-hal/examples/sha.rs index 6929fa155a6..d5de9c29375 100644 --- a/esp32c3-hal/examples/sha.rs +++ b/esp32c3-hal/examples/sha.rs @@ -18,16 +18,12 @@ use sha2::{Digest, Sha256}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); let mut remaining = source_data; - let mut hasher = Sha::new( - peripherals.SHA, - ShaMode::SHA256, - &mut system.peripheral_clock_control, - ); + let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA256); // Short hashes can be created by decreasing the output buffer to the desired // length diff --git a/esp32c3-hal/examples/spi_eh1_device_loopback.rs b/esp32c3-hal/examples/spi_eh1_device_loopback.rs index 61c2c126869..5b13ac8f6c2 100644 --- a/esp32c3-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32c3-hal/examples/spi_eh1_device_loopback.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { miso, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, )); let mut spi_device_1 = spi_controller.add_device(io.pins.gpio3); diff --git a/esp32c3-hal/examples/spi_eh1_loopback.rs b/esp32c3-hal/examples/spi_eh1_loopback.rs index ddecfc63d4c..c2483ddd5d6 100644 --- a/esp32c3-hal/examples/spi_eh1_loopback.rs +++ b/esp32c3-hal/examples/spi_eh1_loopback.rs @@ -31,7 +31,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { cs, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c3-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32c3-hal/examples/spi_halfduplex_read_manufacturer_id.rs index f83e51912c0..002d6a567d3 100644 --- a/esp32c3-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32c3-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -31,7 +31,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -52,7 +52,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c3-hal/examples/spi_loopback.rs b/esp32c3-hal/examples/spi_loopback.rs index 19bdb595eef..757896db2b0 100644 --- a/esp32c3-hal/examples/spi_loopback.rs +++ b/esp32c3-hal/examples/spi_loopback.rs @@ -30,7 +30,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -47,7 +47,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c3-hal/examples/spi_loopback_dma.rs b/esp32c3-hal/examples/spi_loopback_dma.rs index c91b4210fb8..bf478929c56 100644 --- a/esp32c3-hal/examples/spi_loopback_dma.rs +++ b/esp32c3-hal/examples/spi_loopback_dma.rs @@ -32,7 +32,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -41,7 +41,7 @@ fn main() -> ! { let mosi = io.pins.gpio7; let cs = io.pins.gpio10; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut descriptors = [0u32; 8 * 3]; @@ -55,7 +55,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32c3-hal/examples/timer_interrupt.rs b/esp32c3-hal/examples/timer_interrupt.rs index 410d8603d0c..d721f6b96d2 100644 --- a/esp32c3-hal/examples/timer_interrupt.rs +++ b/esp32c3-hal/examples/timer_interrupt.rs @@ -24,20 +24,12 @@ static TIMER1: Mutex>>>> = Mutex::new(RefCell #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); let mut timer1 = timer_group1.timer0; interrupt::enable( diff --git a/esp32c3-hal/examples/twai.rs b/esp32c3-hal/examples/twai.rs index 2e9be018a69..6c15e5b464b 100644 --- a/esp32c3-hal/examples/twai.rs +++ b/esp32c3-hal/examples/twai.rs @@ -18,7 +18,7 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -37,7 +37,6 @@ fn main() -> ! { peripherals.TWAI0, can_tx_pin, can_rx_pin, - &mut system.peripheral_clock_control, &clocks, CAN_BAUDRATE, ); diff --git a/esp32c3-hal/examples/usb_serial_jtag.rs b/esp32c3-hal/examples/usb_serial_jtag.rs index 0752917c380..77cd670ed8a 100644 --- a/esp32c3-hal/examples/usb_serial_jtag.rs +++ b/esp32c3-hal/examples/usb_serial_jtag.rs @@ -27,18 +27,13 @@ static USB_SERIAL: Mutex>> = Mutex::new(RefCell::n #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut usb_serial = - UsbSerialJtag::new(peripherals.USB_DEVICE, &mut system.peripheral_clock_control); + let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE); usb_serial.listen_rx_packet_recv_interrupt(); diff --git a/esp32c3-hal/examples/watchdog.rs b/esp32c3-hal/examples/watchdog.rs index 28452d90aa2..67366a49076 100644 --- a/esp32c3-hal/examples/watchdog.rs +++ b/esp32c3-hal/examples/watchdog.rs @@ -13,14 +13,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let mut wdt0 = timer_group0.wdt; diff --git a/esp32c6-hal/examples/adc.rs b/esp32c6-hal/examples/adc.rs index a4155539759..d156ced4e6b 100644 --- a/esp32c6-hal/examples/adc.rs +++ b/esp32c6-hal/examples/adc.rs @@ -19,7 +19,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -31,12 +31,7 @@ fn main() -> ! { let mut pin = adc1_config.enable_pin(io.pins.gpio2.into_analog(), Attenuation::Attenuation11dB); - let mut adc1 = ADC::::adc( - &mut system.peripheral_clock_control, - analog.adc1, - adc1_config, - ) - .unwrap(); + let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); let mut delay = Delay::new(&clocks); diff --git a/esp32c6-hal/examples/adc_cal.rs b/esp32c6-hal/examples/adc_cal.rs index b89e18b4ffc..c92627cf615 100644 --- a/esp32c6-hal/examples/adc_cal.rs +++ b/esp32c6-hal/examples/adc_cal.rs @@ -20,7 +20,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -40,12 +40,7 @@ fn main() -> ! { let mut pin = adc1_config.enable_pin_with_cal::<_, AdcCal>(io.pins.gpio2.into_analog(), atten); - let mut adc1 = ADC::::adc( - &mut system.peripheral_clock_control, - analog.adc1, - adc1_config, - ) - .unwrap(); + let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); let mut delay = Delay::new(&clocks); diff --git a/esp32c6-hal/examples/advanced_serial.rs b/esp32c6-hal/examples/advanced_serial.rs index 532de3b3198..fb4157c35de 100644 --- a/esp32c6-hal/examples/advanced_serial.rs +++ b/esp32c6-hal/examples/advanced_serial.rs @@ -29,14 +29,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let config = Config { @@ -52,13 +48,7 @@ fn main() -> ! { io.pins.gpio2.into_floating_input(), ); - let mut serial1 = Uart::new_with_config( - peripherals.UART1, - config, - Some(pins), - &clocks, - &mut system.peripheral_clock_control, - ); + let mut serial1 = Uart::new_with_config(peripherals.UART1, config, Some(pins), &clocks); timer0.start(250u64.millis()); diff --git a/esp32c6-hal/examples/aes.rs b/esp32c6-hal/examples/aes.rs index 6a849dad81a..d1305fa48e6 100644 --- a/esp32c6-hal/examples/aes.rs +++ b/esp32c6-hal/examples/aes.rs @@ -19,10 +19,10 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); + let mut aes = Aes::new(peripherals.AES); let keytext = "SUp4SeCp@sSw0rd".as_bytes(); let plaintext = "message".as_bytes(); diff --git a/esp32c6-hal/examples/crc.rs b/esp32c6-hal/examples/crc.rs index b7f3581469c..de1d863b953 100644 --- a/esp32c6-hal/examples/crc.rs +++ b/esp32c6-hal/examples/crc.rs @@ -19,20 +19,12 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; timer0.start(1u64.secs()); diff --git a/esp32c6-hal/examples/debug_assist.rs b/esp32c6-hal/examples/debug_assist.rs index 38f4b82302c..f6fc3f87f58 100644 --- a/esp32c6-hal/examples/debug_assist.rs +++ b/esp32c6-hal/examples/debug_assist.rs @@ -24,13 +24,10 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut da = DebugAssist::new( - peripherals.ASSIST_DEBUG, - &mut system.peripheral_clock_control, - ); + let mut da = DebugAssist::new(peripherals.ASSIST_DEBUG); // uncomment the functionality you want to test diff --git a/esp32c6-hal/examples/direct-vectoring.rs b/esp32c6-hal/examples/direct-vectoring.rs index 39cf771fbe3..f51fd6398d3 100644 --- a/esp32c6-hal/examples/direct-vectoring.rs +++ b/esp32c6-hal/examples/direct-vectoring.rs @@ -21,10 +21,10 @@ static SWINT: Mutex>> = Mutex::new(RefC #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clockctrl = system.clock_control; let sw_int = system.software_interrupt_control; - let clocks = ClockControl::boot_defaults(clockctrl).freeze(); + let _clocks = ClockControl::boot_defaults(clockctrl).freeze(); critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); unsafe { diff --git a/esp32c6-hal/examples/ecc.rs b/esp32c6-hal/examples/ecc.rs index 0cb9b89787b..d9f1fe70596 100644 --- a/esp32c6-hal/examples/ecc.rs +++ b/esp32c6-hal/examples/ecc.rs @@ -40,13 +40,13 @@ const TEST_PARAMS_VECTOR: TestParams = TestParams { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let _system = peripherals.PCR.split(); let mut rng = Rng::new(peripherals.RNG); println!("ECC example"); - let mut hw_ecc = Ecc::new(peripherals.ECC, &mut system.peripheral_clock_control); + let mut hw_ecc = Ecc::new(peripherals.ECC); println!("Beginning stress tests..."); test_affine_point_multiplication(&mut hw_ecc, &mut rng); diff --git a/esp32c6-hal/examples/embassy_hello_world.rs b/esp32c6-hal/examples/embassy_hello_world.rs index 03447b3932a..d7929c67a5a 100644 --- a/esp32c6-hal/examples/embassy_hello_world.rs +++ b/esp32c6-hal/examples/embassy_hello_world.rs @@ -33,7 +33,7 @@ async fn run2() { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -44,11 +44,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32c6_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32c6-hal/examples/embassy_i2c.rs b/esp32c6-hal/examples/embassy_i2c.rs index b2f0bbc03c3..fdf5952875b 100644 --- a/esp32c6-hal/examples/embassy_i2c.rs +++ b/esp32c6-hal/examples/embassy_i2c.rs @@ -45,7 +45,7 @@ async fn run(i2c: I2C<'static, I2C0>) { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -56,11 +56,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32c6_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -71,7 +67,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 400u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c6-hal/examples/embassy_i2s_read.rs b/esp32c6-hal/examples/embassy_i2s_read.rs index b57f7d8f1e6..f04065bc815 100644 --- a/esp32c6-hal/examples/embassy_i2s_read.rs +++ b/esp32c6-hal/examples/embassy_i2s_read.rs @@ -81,17 +81,12 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c6_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -109,7 +104,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c6-hal/examples/embassy_i2s_sound.rs b/esp32c6-hal/examples/embassy_i2s_sound.rs index e10a1d072b0..728b7e3c3a5 100644 --- a/esp32c6-hal/examples/embassy_i2s_sound.rs +++ b/esp32c6-hal/examples/embassy_i2s_sound.rs @@ -118,17 +118,12 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32c6_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -146,7 +141,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c6-hal/examples/embassy_parl_io_rx.rs b/esp32c6-hal/examples/embassy_parl_io_rx.rs index 10e9ac05aad..12afa58a8b3 100644 --- a/esp32c6-hal/examples/embassy_parl_io_rx.rs +++ b/esp32c6-hal/examples/embassy_parl_io_rx.rs @@ -64,11 +64,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32c6_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -77,7 +73,7 @@ fn main() -> ! { let tx_descriptors = make_static!([0u32; 8 * 3]); let rx_descriptors = make_static!([0u32; 8 * 3]); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let rx_pins = RxFourBits::new(io.pins.gpio1, io.pins.gpio2, io.pins.gpio3, io.pins.gpio4); @@ -91,7 +87,6 @@ fn main() -> ! { DmaPriority::Priority0, ), 1u32.MHz(), - &mut system.peripheral_clock_control, &clocks, ) .unwrap(); diff --git a/esp32c6-hal/examples/embassy_parl_io_tx.rs b/esp32c6-hal/examples/embassy_parl_io_tx.rs index 9da0aaba32b..bb149db7939 100644 --- a/esp32c6-hal/examples/embassy_parl_io_tx.rs +++ b/esp32c6-hal/examples/embassy_parl_io_tx.rs @@ -84,11 +84,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32c6_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -97,7 +93,7 @@ fn main() -> ! { let tx_descriptors = make_static!([0u32; 8 * 3]); let rx_descriptors = make_static!([0u32; 8 * 3]); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_pins = TxFourBits::new(io.pins.gpio1, io.pins.gpio2, io.pins.gpio3, io.pins.gpio4); @@ -113,7 +109,6 @@ fn main() -> ! { DmaPriority::Priority0, ), 1u32.MHz(), - &mut system.peripheral_clock_control, &clocks, ) .unwrap(); diff --git a/esp32c6-hal/examples/embassy_serial.rs b/esp32c6-hal/examples/embassy_serial.rs index 6d8857f49ec..115ccd6a37c 100644 --- a/esp32c6-hal/examples/embassy_serial.rs +++ b/esp32c6-hal/examples/embassy_serial.rs @@ -65,7 +65,7 @@ async fn reader(mut rx: UartRx<'static, UART0>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -76,19 +76,11 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32c6_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); uart0 .set_rx_fifo_full_threshold(READ_BUF_SIZE as u16) diff --git a/esp32c6-hal/examples/embassy_spi.rs b/esp32c6-hal/examples/embassy_spi.rs index 6df29052d86..237feffe9b2 100644 --- a/esp32c6-hal/examples/embassy_spi.rs +++ b/esp32c6-hal/examples/embassy_spi.rs @@ -54,7 +54,7 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -65,11 +65,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32c6_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -90,7 +86,7 @@ fn main() -> ! { let mosi = io.pins.gpio7; let cs = io.pins.gpio10; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let descriptors = make_static!([0u32; 8 * 3]); @@ -104,7 +100,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32c6-hal/examples/embassy_wait.rs b/esp32c6-hal/examples/embassy_wait.rs index 5a3ebf19e64..68080beed8e 100644 --- a/esp32c6-hal/examples/embassy_wait.rs +++ b/esp32c6-hal/examples/embassy_wait.rs @@ -34,7 +34,7 @@ async fn ping(mut pin: Gpio9>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -45,11 +45,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32c6_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32c6-hal/examples/etm_gpio.rs b/esp32c6-hal/examples/etm_gpio.rs index a9625e03f20..4f6f95f848f 100644 --- a/esp32c6-hal/examples/etm_gpio.rs +++ b/esp32c6-hal/examples/etm_gpio.rs @@ -16,7 +16,7 @@ use esp_backtrace as _; fn main() -> ! { esp_println::logger::init_logger_from_env(); let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -30,7 +30,7 @@ fn main() -> ! { let led_task = gpio_ext.channel0_task.toggle(&mut led); let button_event = gpio_ext.channel0_event.falling_edge(button); - let etm = Etm::new(peripherals.SOC_ETM, &mut system.peripheral_clock_control); + let etm = Etm::new(peripherals.SOC_ETM); let channel0 = etm.channel0; // make sure the configured channel doesn't get dropped - dropping it will diff --git a/esp32c6-hal/examples/hello_rgb.rs b/esp32c6-hal/examples/hello_rgb.rs index 29c317e4234..f6cda59625b 100644 --- a/esp32c6-hal/examples/hello_rgb.rs +++ b/esp32c6-hal/examples/hello_rgb.rs @@ -23,19 +23,13 @@ use smart_leds::{ #[entry] fn main() -> ! { let peripherals = peripherals::Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally - let rmt = Rmt::new( - peripherals.RMT, - 80u32.MHz(), - &mut system.peripheral_clock_control, - &clocks, - ) - .unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); // We use one of the RMT channels to instantiate a `SmartLedsAdapter` which can // be used directly with all `smart_led` implementations diff --git a/esp32c6-hal/examples/hello_world.rs b/esp32c6-hal/examples/hello_world.rs index 8efc21fd437..3ef5d5b8515 100644 --- a/esp32c6-hal/examples/hello_world.rs +++ b/esp32c6-hal/examples/hello_world.rs @@ -19,20 +19,12 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; timer0.start(1u64.secs()); diff --git a/esp32c6-hal/examples/hmac.rs b/esp32c6-hal/examples/hmac.rs index 3b5ae8583cb..8419c0c8083 100644 --- a/esp32c6-hal/examples/hmac.rs +++ b/esp32c6-hal/examples/hmac.rs @@ -74,7 +74,7 @@ type HmacSha256 = HmacSw; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); @@ -82,7 +82,7 @@ fn main() -> ! { // Set sw key let key = [0_u8; 32].as_ref(); - let mut hw_hmac = Hmac::new(peripherals.HMAC, &mut system.peripheral_clock_control); + let mut hw_hmac = Hmac::new(peripherals.HMAC); let mut src = [0_u8; 1024]; rng.read(src.as_mut_slice()).unwrap(); diff --git a/esp32c6-hal/examples/i2c_bmp180_calibration_data.rs b/esp32c6-hal/examples/i2c_bmp180_calibration_data.rs index 23bdbe7de48..22ab072d9c1 100644 --- a/esp32c6-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32c6-hal/examples/i2c_bmp180_calibration_data.rs @@ -16,7 +16,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -28,7 +28,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c6-hal/examples/i2c_display.rs b/esp32c6-hal/examples/i2c_display.rs index 2c039cb13c2..f08c3a4286b 100644 --- a/esp32c6-hal/examples/i2c_display.rs +++ b/esp32c6-hal/examples/i2c_display.rs @@ -34,14 +34,10 @@ use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -53,7 +49,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c6-hal/examples/i2s_read.rs b/esp32c6-hal/examples/i2s_read.rs index daad8e1b5b8..8b460219f46 100644 --- a/esp32c6-hal/examples/i2s_read.rs +++ b/esp32c6-hal/examples/i2s_read.rs @@ -29,12 +29,12 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut tx_descriptors = [0u32; 8 * 3]; @@ -52,7 +52,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c6-hal/examples/i2s_sound.rs b/esp32c6-hal/examples/i2s_sound.rs index ad928174bc0..647581335d9 100644 --- a/esp32c6-hal/examples/i2s_sound.rs +++ b/esp32c6-hal/examples/i2s_sound.rs @@ -52,12 +52,12 @@ const SINE: [i16; 64] = [ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut tx_descriptors = [0u32; 20 * 3]; @@ -75,7 +75,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c6-hal/examples/interrupt_preemption.rs b/esp32c6-hal/examples/interrupt_preemption.rs index 7f2febeed62..0c5df387ad2 100644 --- a/esp32c6-hal/examples/interrupt_preemption.rs +++ b/esp32c6-hal/examples/interrupt_preemption.rs @@ -25,10 +25,10 @@ static SWINT: Mutex>> = Mutex::new(RefC #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clockctrl = system.clock_control; let sw_int = system.software_interrupt_control; - let clocks = ClockControl::boot_defaults(clockctrl).freeze(); + let _clocks = ClockControl::boot_defaults(clockctrl).freeze(); critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); diff --git a/esp32c6-hal/examples/ledc.rs b/esp32c6-hal/examples/ledc.rs index fef78eb131b..fc20456734e 100644 --- a/esp32c6-hal/examples/ledc.rs +++ b/esp32c6-hal/examples/ledc.rs @@ -24,17 +24,13 @@ use esp_backtrace as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); - let mut ledc = LEDC::new( - peripherals.LEDC, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut ledc = LEDC::new(peripherals.LEDC, &clocks); ledc.set_global_slow_clock(LSGlobalClkSource::APBClk); let mut lstimer0 = ledc.get_timer::(timer::Number::Timer2); diff --git a/esp32c6-hal/examples/mcpwm.rs b/esp32c6-hal/examples/mcpwm.rs index 66266a26f12..c49fdc60401 100644 --- a/esp32c6-hal/examples/mcpwm.rs +++ b/esp32c6-hal/examples/mcpwm.rs @@ -18,7 +18,7 @@ use esp_backtrace as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -26,11 +26,7 @@ fn main() -> ! { // initialize peripheral let clock_cfg = PeripheralClockConfig::with_frequency(&clocks, 40u32.MHz()).unwrap(); - let mut mcpwm = MCPWM::new( - peripherals.MCPWM0, - clock_cfg, - &mut system.peripheral_clock_control, - ); + let mut mcpwm = MCPWM::new(peripherals.MCPWM0, clock_cfg); // connect operator0 to timer0 mcpwm.operator0.set_timer(&mcpwm.timer0); diff --git a/esp32c6-hal/examples/parl_io_rx.rs b/esp32c6-hal/examples/parl_io_rx.rs index 632986c373f..d326901dd12 100644 --- a/esp32c6-hal/examples/parl_io_rx.rs +++ b/esp32c6-hal/examples/parl_io_rx.rs @@ -24,22 +24,14 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Disable the watchdog timers. let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); let mut wdt1 = timer_group1.wdt; rtc.swd.disable(); @@ -52,7 +44,7 @@ fn main() -> ! { let mut tx_descriptors = [0u32; 8 * 3]; let mut rx_descriptors = [0u32; 8 * 3]; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let rx_pins = RxFourBits::new(io.pins.gpio1, io.pins.gpio2, io.pins.gpio3, io.pins.gpio4); @@ -66,7 +58,6 @@ fn main() -> ! { DmaPriority::Priority0, ), 1u32.MHz(), - &mut system.peripheral_clock_control, &clocks, ) .unwrap(); diff --git a/esp32c6-hal/examples/parl_io_tx.rs b/esp32c6-hal/examples/parl_io_tx.rs index 341ddfa3a8a..b75c208b1cf 100644 --- a/esp32c6-hal/examples/parl_io_tx.rs +++ b/esp32c6-hal/examples/parl_io_tx.rs @@ -33,7 +33,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -41,7 +41,7 @@ fn main() -> ! { let mut tx_descriptors = [0u32; 8 * 3]; let mut rx_descriptors = [0u32; 8 * 3]; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_pins = TxFourBits::new(io.pins.gpio1, io.pins.gpio2, io.pins.gpio3, io.pins.gpio4); @@ -57,7 +57,6 @@ fn main() -> ! { DmaPriority::Priority0, ), 1u32.MHz(), - &mut system.peripheral_clock_control, &clocks, ) .unwrap(); diff --git a/esp32c6-hal/examples/pcnt_encoder.rs b/esp32c6-hal/examples/pcnt_encoder.rs index 2580ebef520..bc2ccf6383a 100644 --- a/esp32c6-hal/examples/pcnt_encoder.rs +++ b/esp32c6-hal/examples/pcnt_encoder.rs @@ -33,14 +33,14 @@ static VALUE: AtomicI32 = AtomicI32::new(0); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let unit_number = unit::Number::Unit1; // setup a pulse couter println!("setup pulse counter unit 0"); - let pcnt = PCNT::new(peripherals.PCNT, &mut system.peripheral_clock_control); + let pcnt = PCNT::new(peripherals.PCNT); let mut u0 = pcnt.get_unit(unit_number); u0.configure(unit::Config { low_limit: -100, diff --git a/esp32c6-hal/examples/qspi_flash.rs b/esp32c6-hal/examples/qspi_flash.rs index 02210dd7cd2..c8d18b78822 100644 --- a/esp32c6-hal/examples/qspi_flash.rs +++ b/esp32c6-hal/examples/qspi_flash.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -44,7 +44,7 @@ fn main() -> ! { let sio3 = io.pins.gpio0; let cs = io.pins.gpio1; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut descriptors = [0u32; 8 * 3]; @@ -60,7 +60,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32c6-hal/examples/ram.rs b/esp32c6-hal/examples/ram.rs index 25fba144b41..d74c64ae4b0 100644 --- a/esp32c6-hal/examples/ram.rs +++ b/esp32c6-hal/examples/ram.rs @@ -32,14 +32,10 @@ static mut SOME_ZEROED_DATA: [u8; 8] = [0; 8]; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; // The RWDT flash boot protection must be enabled, as it is triggered as part of diff --git a/esp32c6-hal/examples/rmt_rx.rs b/esp32c6-hal/examples/rmt_rx.rs index edc5d86e966..a2527a443d0 100644 --- a/esp32c6-hal/examples/rmt_rx.rs +++ b/esp32c6-hal/examples/rmt_rx.rs @@ -24,12 +24,11 @@ const WIDTH: usize = 80; fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.PCR.split(); - let mut clock_control = system.peripheral_clock_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel2 diff --git a/esp32c6-hal/examples/rmt_tx.rs b/esp32c6-hal/examples/rmt_tx.rs index 20d95cdbf4b..65b60f04091 100644 --- a/esp32c6-hal/examples/rmt_tx.rs +++ b/esp32c6-hal/examples/rmt_tx.rs @@ -19,12 +19,11 @@ use esp_backtrace as _; fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.PCR.split(); - let mut clock_control = system.peripheral_clock_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel0 diff --git a/esp32c6-hal/examples/rsa.rs b/esp32c6-hal/examples/rsa.rs index c3fd855e86d..961ba80dc2a 100644 --- a/esp32c6-hal/examples/rsa.rs +++ b/esp32c6-hal/examples/rsa.rs @@ -56,10 +56,10 @@ const fn compute_mprime(modulus: &U512) -> u32 { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); + let mut rsa = Rsa::new(peripherals.RSA); block!(rsa.ready()).unwrap(); mod_exp_example(&mut rsa); diff --git a/esp32c6-hal/examples/serial_interrupts.rs b/esp32c6-hal/examples/serial_interrupts.rs index abc25847368..5ddf0bf8ab1 100644 --- a/esp32c6-hal/examples/serial_interrupts.rs +++ b/esp32c6-hal/examples/serial_interrupts.rs @@ -27,21 +27,13 @@ static SERIAL: Mutex>>> = Mutex::new(RefCell::new(Non #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); uart0.set_rx_fifo_full_threshold(30).unwrap(); uart0.listen_at_cmd(); diff --git a/esp32c6-hal/examples/sha.rs b/esp32c6-hal/examples/sha.rs index 3ab6097ee1c..d630d21635d 100644 --- a/esp32c6-hal/examples/sha.rs +++ b/esp32c6-hal/examples/sha.rs @@ -18,16 +18,12 @@ use sha2::{Digest, Sha256}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); let mut remaining = source_data; - let mut hasher = Sha::new( - peripherals.SHA, - ShaMode::SHA256, - &mut system.peripheral_clock_control, - ); + let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA256); // Short hashes can be created by decreasing the output buffer to the desired // length diff --git a/esp32c6-hal/examples/spi_eh1_device_loopback.rs b/esp32c6-hal/examples/spi_eh1_device_loopback.rs index e573e69da55..a55c890ebcc 100644 --- a/esp32c6-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32c6-hal/examples/spi_eh1_device_loopback.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { miso, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, )); let mut spi_device_1 = spi_controller.add_device(io.pins.gpio3); diff --git a/esp32c6-hal/examples/spi_eh1_loopback.rs b/esp32c6-hal/examples/spi_eh1_loopback.rs index 9619f8b6126..65de7dcaa32 100644 --- a/esp32c6-hal/examples/spi_eh1_loopback.rs +++ b/esp32c6-hal/examples/spi_eh1_loopback.rs @@ -31,7 +31,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { cs, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c6-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32c6-hal/examples/spi_halfduplex_read_manufacturer_id.rs index d45c06d2d11..5589b763cfc 100644 --- a/esp32c6-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32c6-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -31,7 +31,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -52,7 +52,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c6-hal/examples/spi_loopback.rs b/esp32c6-hal/examples/spi_loopback.rs index 2d7a401f29d..53320c1f5ca 100644 --- a/esp32c6-hal/examples/spi_loopback.rs +++ b/esp32c6-hal/examples/spi_loopback.rs @@ -30,7 +30,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -47,7 +47,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32c6-hal/examples/spi_loopback_dma.rs b/esp32c6-hal/examples/spi_loopback_dma.rs index 7fc37bab5dc..f47faac4a6f 100644 --- a/esp32c6-hal/examples/spi_loopback_dma.rs +++ b/esp32c6-hal/examples/spi_loopback_dma.rs @@ -32,7 +32,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -41,7 +41,7 @@ fn main() -> ! { let mosi = io.pins.gpio7; let cs = io.pins.gpio10; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut descriptors = [0u32; 8 * 3]; @@ -55,7 +55,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32c6-hal/examples/timer_interrupt.rs b/esp32c6-hal/examples/timer_interrupt.rs index bcea5d3b771..3d263b5c4ab 100644 --- a/esp32c6-hal/examples/timer_interrupt.rs +++ b/esp32c6-hal/examples/timer_interrupt.rs @@ -24,21 +24,13 @@ static TIMER1: Mutex>>>> = Mutex::new(RefCell #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); let mut timer1 = timer_group1.timer0; interrupt::enable( diff --git a/esp32c6-hal/examples/usb_serial_jtag.rs b/esp32c6-hal/examples/usb_serial_jtag.rs index a5da0e909eb..6a3eba6a22d 100644 --- a/esp32c6-hal/examples/usb_serial_jtag.rs +++ b/esp32c6-hal/examples/usb_serial_jtag.rs @@ -26,18 +26,13 @@ static USB_SERIAL: Mutex>> = Mutex::new(RefCell::n #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut usb_serial = - UsbSerialJtag::new(peripherals.USB_DEVICE, &mut system.peripheral_clock_control); + let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE); usb_serial.listen_rx_packet_recv_interrupt(); diff --git a/esp32c6-hal/examples/watchdog.rs b/esp32c6-hal/examples/watchdog.rs index 4c61b216db3..dd0f54248f1 100644 --- a/esp32c6-hal/examples/watchdog.rs +++ b/esp32c6-hal/examples/watchdog.rs @@ -13,14 +13,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let mut wdt0 = timer_group0.wdt; diff --git a/esp32h2-hal/examples/adc.rs b/esp32h2-hal/examples/adc.rs index 38448a83baf..e04503746ba 100644 --- a/esp32h2-hal/examples/adc.rs +++ b/esp32h2-hal/examples/adc.rs @@ -19,7 +19,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -31,12 +31,7 @@ fn main() -> ! { let mut pin = adc1_config.enable_pin(io.pins.gpio2.into_analog(), Attenuation::Attenuation11dB); - let mut adc1 = ADC::::adc( - &mut system.peripheral_clock_control, - analog.adc1, - adc1_config, - ) - .unwrap(); + let mut adc1 = ADC::::adc(analog.adc1, adc1_config).unwrap(); let mut delay = Delay::new(&clocks); diff --git a/esp32h2-hal/examples/advanced_serial.rs b/esp32h2-hal/examples/advanced_serial.rs index a2af88d583c..aa0709f94e8 100644 --- a/esp32h2-hal/examples/advanced_serial.rs +++ b/esp32h2-hal/examples/advanced_serial.rs @@ -29,14 +29,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let config = Config { @@ -52,13 +48,7 @@ fn main() -> ! { io.pins.gpio2.into_floating_input(), ); - let mut serial1 = Uart::new_with_config( - peripherals.UART1, - config, - Some(pins), - &clocks, - &mut system.peripheral_clock_control, - ); + let mut serial1 = Uart::new_with_config(peripherals.UART1, config, Some(pins), &clocks); timer0.start(250u64.millis()); diff --git a/esp32h2-hal/examples/aes.rs b/esp32h2-hal/examples/aes.rs index c3d8905aea2..3871735f635 100644 --- a/esp32h2-hal/examples/aes.rs +++ b/esp32h2-hal/examples/aes.rs @@ -19,10 +19,10 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); + let mut aes = Aes::new(peripherals.AES); let keytext = "SUp4SeCp@sSw0rd".as_bytes(); let plaintext = "message".as_bytes(); diff --git a/esp32h2-hal/examples/crc.rs b/esp32h2-hal/examples/crc.rs index ff0cb94d89b..1f61ebc1fd7 100644 --- a/esp32h2-hal/examples/crc.rs +++ b/esp32h2-hal/examples/crc.rs @@ -19,20 +19,12 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; timer0.start(1u64.secs()); diff --git a/esp32h2-hal/examples/debug_assist.rs b/esp32h2-hal/examples/debug_assist.rs index 79a8eede465..bfea5fb7244 100644 --- a/esp32h2-hal/examples/debug_assist.rs +++ b/esp32h2-hal/examples/debug_assist.rs @@ -24,13 +24,10 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut da = DebugAssist::new( - peripherals.ASSIST_DEBUG, - &mut system.peripheral_clock_control, - ); + let mut da = DebugAssist::new(peripherals.ASSIST_DEBUG); // Uncomment the functionality you want to test // We use a 0x1200 wide SP and 0x100 regions, and RAM ends at 0x40850000 diff --git a/esp32h2-hal/examples/direct-vectoring.rs b/esp32h2-hal/examples/direct-vectoring.rs index 8bc9be9de98..c06e0d436cf 100644 --- a/esp32h2-hal/examples/direct-vectoring.rs +++ b/esp32h2-hal/examples/direct-vectoring.rs @@ -21,10 +21,10 @@ static SWINT: Mutex>> = Mutex::new(RefC #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clockctrl = system.clock_control; let sw_int = system.software_interrupt_control; - let clocks = ClockControl::boot_defaults(clockctrl).freeze(); + let _clocks = ClockControl::boot_defaults(clockctrl).freeze(); critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); unsafe { diff --git a/esp32h2-hal/examples/ecc.rs b/esp32h2-hal/examples/ecc.rs index d2c2c6edc4c..3a7ef6a2c89 100644 --- a/esp32h2-hal/examples/ecc.rs +++ b/esp32h2-hal/examples/ecc.rs @@ -41,13 +41,13 @@ const TEST_PARAMS_VECTOR: TestParams = TestParams { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let _system = peripherals.PCR.split(); let mut rng = Rng::new(peripherals.RNG); println!("ECC example"); - let mut hw_ecc = Ecc::new(peripherals.ECC, &mut system.peripheral_clock_control); + let mut hw_ecc = Ecc::new(peripherals.ECC); println!("Beginning stress tests..."); test_affine_point_multiplication(&mut hw_ecc, &mut rng); diff --git a/esp32h2-hal/examples/embassy_hello_world.rs b/esp32h2-hal/examples/embassy_hello_world.rs index 964ab91652d..1580cbf707e 100644 --- a/esp32h2-hal/examples/embassy_hello_world.rs +++ b/esp32h2-hal/examples/embassy_hello_world.rs @@ -33,7 +33,7 @@ async fn run2() { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -44,11 +44,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32h2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32h2-hal/examples/embassy_i2c.rs b/esp32h2-hal/examples/embassy_i2c.rs index 14361d31a8b..b37d9abb6a7 100644 --- a/esp32h2-hal/examples/embassy_i2c.rs +++ b/esp32h2-hal/examples/embassy_i2c.rs @@ -45,7 +45,7 @@ async fn run(i2c: I2C<'static, I2C0>) { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -56,11 +56,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32h2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -71,7 +67,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 400u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32h2-hal/examples/embassy_i2s_read.rs b/esp32h2-hal/examples/embassy_i2s_read.rs index 1cd8bdbe796..649a03f9417 100644 --- a/esp32h2-hal/examples/embassy_i2s_read.rs +++ b/esp32h2-hal/examples/embassy_i2s_read.rs @@ -81,17 +81,12 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32h2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -109,7 +104,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32h2-hal/examples/embassy_i2s_sound.rs b/esp32h2-hal/examples/embassy_i2s_sound.rs index 4ef6db807cf..1bac2ae040c 100644 --- a/esp32h2-hal/examples/embassy_i2s_sound.rs +++ b/esp32h2-hal/examples/embassy_i2s_sound.rs @@ -118,17 +118,12 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32h2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -146,7 +141,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32h2-hal/examples/embassy_parl_io_rx.rs b/esp32h2-hal/examples/embassy_parl_io_rx.rs index 00ba41fea1f..ed6c25f0ef4 100644 --- a/esp32h2-hal/examples/embassy_parl_io_rx.rs +++ b/esp32h2-hal/examples/embassy_parl_io_rx.rs @@ -64,11 +64,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32h2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -77,7 +73,7 @@ fn main() -> ! { let tx_descriptors = make_static!([0u32; 8 * 3]); let rx_descriptors = make_static!([0u32; 8 * 3]); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let rx_pins = RxFourBits::new(io.pins.gpio1, io.pins.gpio2, io.pins.gpio3, io.pins.gpio4); @@ -91,7 +87,6 @@ fn main() -> ! { DmaPriority::Priority0, ), 1u32.MHz(), - &mut system.peripheral_clock_control, &clocks, ) .unwrap(); diff --git a/esp32h2-hal/examples/embassy_parl_io_tx.rs b/esp32h2-hal/examples/embassy_parl_io_tx.rs index 9c03076dd74..d4277050174 100644 --- a/esp32h2-hal/examples/embassy_parl_io_tx.rs +++ b/esp32h2-hal/examples/embassy_parl_io_tx.rs @@ -84,11 +84,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32h2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -97,7 +93,7 @@ fn main() -> ! { let tx_descriptors = make_static!([0u32; 8 * 3]); let rx_descriptors = make_static!([0u32; 8 * 3]); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_pins = TxFourBits::new(io.pins.gpio1, io.pins.gpio2, io.pins.gpio3, io.pins.gpio4); @@ -113,7 +109,6 @@ fn main() -> ! { DmaPriority::Priority0, ), 1u32.MHz(), - &mut system.peripheral_clock_control, &clocks, ) .unwrap(); diff --git a/esp32h2-hal/examples/embassy_serial.rs b/esp32h2-hal/examples/embassy_serial.rs index 21c0c117577..5da4e6a90f4 100644 --- a/esp32h2-hal/examples/embassy_serial.rs +++ b/esp32h2-hal/examples/embassy_serial.rs @@ -65,7 +65,7 @@ async fn reader(mut rx: UartRx<'static, UART0>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -76,19 +76,11 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32h2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); uart0 .set_rx_fifo_full_threshold(READ_BUF_SIZE as u16) diff --git a/esp32h2-hal/examples/embassy_spi.rs b/esp32h2-hal/examples/embassy_spi.rs index e58afa23e57..0024f0db1a7 100644 --- a/esp32h2-hal/examples/embassy_spi.rs +++ b/esp32h2-hal/examples/embassy_spi.rs @@ -54,7 +54,7 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -65,11 +65,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32h2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -90,7 +86,7 @@ fn main() -> ! { let mosi = io.pins.gpio3; let cs = io.pins.gpio11; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let descriptors = make_static!([0u32; 8 * 3]); @@ -104,7 +100,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32h2-hal/examples/embassy_wait.rs b/esp32h2-hal/examples/embassy_wait.rs index 2cff6ca7a6b..fca08be7cbe 100644 --- a/esp32h2-hal/examples/embassy_wait.rs +++ b/esp32h2-hal/examples/embassy_wait.rs @@ -34,7 +34,7 @@ async fn ping(mut pin: Gpio9>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-systick")] @@ -45,11 +45,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32h2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32h2-hal/examples/etm_gpio.rs b/esp32h2-hal/examples/etm_gpio.rs index 166279d2919..64e64987124 100644 --- a/esp32h2-hal/examples/etm_gpio.rs +++ b/esp32h2-hal/examples/etm_gpio.rs @@ -16,7 +16,7 @@ use esp_backtrace as _; fn main() -> ! { esp_println::logger::init_logger_from_env(); let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -30,7 +30,7 @@ fn main() -> ! { let led_task = gpio_ext.channel0_task.toggle(&mut led); let button_event = gpio_ext.channel0_event.falling_edge(button); - let etm = Etm::new(peripherals.SOC_ETM, &mut system.peripheral_clock_control); + let etm = Etm::new(peripherals.SOC_ETM); let channel0 = etm.channel0; // make sure the configured channel doesn't get dropped - dropping it will diff --git a/esp32h2-hal/examples/hello_rgb.rs b/esp32h2-hal/examples/hello_rgb.rs index f350223da39..022abc36d95 100644 --- a/esp32h2-hal/examples/hello_rgb.rs +++ b/esp32h2-hal/examples/hello_rgb.rs @@ -23,19 +23,13 @@ use smart_leds::{ #[entry] fn main() -> ! { let peripherals = peripherals::Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally - let rmt = Rmt::new( - peripherals.RMT, - 80u32.MHz(), - &mut system.peripheral_clock_control, - &clocks, - ) - .unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); // We use one of the RMT channels to instantiate a `SmartLedsAdapter` which can // be used directly with all `smart_led` implementations diff --git a/esp32h2-hal/examples/hello_world.rs b/esp32h2-hal/examples/hello_world.rs index 4fc219c10ba..e71840bcf74 100644 --- a/esp32h2-hal/examples/hello_world.rs +++ b/esp32h2-hal/examples/hello_world.rs @@ -19,20 +19,12 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; timer0.start(1u64.secs()); diff --git a/esp32h2-hal/examples/hmac.rs b/esp32h2-hal/examples/hmac.rs index 226f21b0253..691265337d8 100644 --- a/esp32h2-hal/examples/hmac.rs +++ b/esp32h2-hal/examples/hmac.rs @@ -74,7 +74,7 @@ type HmacSha256 = HmacSw; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); @@ -82,7 +82,7 @@ fn main() -> ! { // Set sw key let key = [0_u8; 32].as_ref(); - let mut hw_hmac = Hmac::new(peripherals.HMAC, &mut system.peripheral_clock_control); + let mut hw_hmac = Hmac::new(peripherals.HMAC); let mut src = [0_u8; 1024]; rng.read(src.as_mut_slice()).unwrap(); diff --git a/esp32h2-hal/examples/i2c_bmp180_calibration_data.rs b/esp32h2-hal/examples/i2c_bmp180_calibration_data.rs index 9a18dd8fc5d..c62b3a40830 100644 --- a/esp32h2-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32h2-hal/examples/i2c_bmp180_calibration_data.rs @@ -16,7 +16,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -28,7 +28,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32h2-hal/examples/i2c_display.rs b/esp32h2-hal/examples/i2c_display.rs index e65495ed60e..2025722cc31 100644 --- a/esp32h2-hal/examples/i2c_display.rs +++ b/esp32h2-hal/examples/i2c_display.rs @@ -34,14 +34,10 @@ use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -53,7 +49,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32h2-hal/examples/i2s_read.rs b/esp32h2-hal/examples/i2s_read.rs index ea9550908f6..a5638aa4b51 100644 --- a/esp32h2-hal/examples/i2s_read.rs +++ b/esp32h2-hal/examples/i2s_read.rs @@ -29,12 +29,12 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut tx_descriptors = [0u32; 8 * 3]; @@ -52,7 +52,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32h2-hal/examples/i2s_sound.rs b/esp32h2-hal/examples/i2s_sound.rs index ca67d84617b..9e1343a4077 100644 --- a/esp32h2-hal/examples/i2s_sound.rs +++ b/esp32h2-hal/examples/i2s_sound.rs @@ -52,12 +52,12 @@ const SINE: [i16; 64] = [ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut tx_descriptors = [0u32; 20 * 3]; @@ -75,7 +75,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32h2-hal/examples/interrupt_preemption.rs b/esp32h2-hal/examples/interrupt_preemption.rs index 202ef653f41..0b7b57888c7 100644 --- a/esp32h2-hal/examples/interrupt_preemption.rs +++ b/esp32h2-hal/examples/interrupt_preemption.rs @@ -25,10 +25,10 @@ static SWINT: Mutex>> = Mutex::new(RefC #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clockctrl = system.clock_control; let sw_int = system.software_interrupt_control; - let clocks = ClockControl::boot_defaults(clockctrl).freeze(); + let _clocks = ClockControl::boot_defaults(clockctrl).freeze(); critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); diff --git a/esp32h2-hal/examples/ledc.rs b/esp32h2-hal/examples/ledc.rs index 8c8efc29aac..8bfb0df1258 100644 --- a/esp32h2-hal/examples/ledc.rs +++ b/esp32h2-hal/examples/ledc.rs @@ -24,17 +24,13 @@ use esp_backtrace as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); - let mut ledc = LEDC::new( - peripherals.LEDC, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut ledc = LEDC::new(peripherals.LEDC, &clocks); ledc.set_global_slow_clock(LSGlobalClkSource::APBClk); let mut lstimer0 = ledc.get_timer::(timer::Number::Timer2); diff --git a/esp32h2-hal/examples/mcpwm.rs b/esp32h2-hal/examples/mcpwm.rs index 8d335d86a9d..c98578e42c9 100644 --- a/esp32h2-hal/examples/mcpwm.rs +++ b/esp32h2-hal/examples/mcpwm.rs @@ -18,7 +18,7 @@ use esp_backtrace as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -26,11 +26,7 @@ fn main() -> ! { // initialize peripheral let clock_cfg = PeripheralClockConfig::with_frequency(&clocks, 32u32.MHz()).unwrap(); - let mut mcpwm = MCPWM::new( - peripherals.MCPWM0, - clock_cfg, - &mut system.peripheral_clock_control, - ); + let mut mcpwm = MCPWM::new(peripherals.MCPWM0, clock_cfg); // connect operator0 to timer0 mcpwm.operator0.set_timer(&mcpwm.timer0); diff --git a/esp32h2-hal/examples/parl_io_rx.rs b/esp32h2-hal/examples/parl_io_rx.rs index f2ec2f07d6b..fca2eb2ac1f 100644 --- a/esp32h2-hal/examples/parl_io_rx.rs +++ b/esp32h2-hal/examples/parl_io_rx.rs @@ -24,22 +24,14 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Disable the watchdog timers. let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); let mut wdt1 = timer_group1.wdt; rtc.swd.disable(); @@ -52,7 +44,7 @@ fn main() -> ! { let mut tx_descriptors = [0u32; 8 * 3]; let mut rx_descriptors = [0u32; 8 * 3]; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let rx_pins = RxFourBits::new(io.pins.gpio1, io.pins.gpio2, io.pins.gpio3, io.pins.gpio4); @@ -66,7 +58,6 @@ fn main() -> ! { DmaPriority::Priority0, ), 1u32.MHz(), - &mut system.peripheral_clock_control, &clocks, ) .unwrap(); diff --git a/esp32h2-hal/examples/parl_io_tx.rs b/esp32h2-hal/examples/parl_io_tx.rs index 16667bf4047..35646b02619 100644 --- a/esp32h2-hal/examples/parl_io_tx.rs +++ b/esp32h2-hal/examples/parl_io_tx.rs @@ -33,7 +33,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -41,7 +41,7 @@ fn main() -> ! { let mut tx_descriptors = [0u32; 8 * 3]; let mut rx_descriptors = [0u32; 8 * 3]; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_pins = TxFourBits::new(io.pins.gpio1, io.pins.gpio2, io.pins.gpio3, io.pins.gpio4); @@ -57,7 +57,6 @@ fn main() -> ! { DmaPriority::Priority0, ), 1u32.MHz(), - &mut system.peripheral_clock_control, &clocks, ) .unwrap(); diff --git a/esp32h2-hal/examples/pcnt_encoder.rs b/esp32h2-hal/examples/pcnt_encoder.rs index 4f560d12fd3..d816d9a0167 100644 --- a/esp32h2-hal/examples/pcnt_encoder.rs +++ b/esp32h2-hal/examples/pcnt_encoder.rs @@ -33,14 +33,14 @@ static VALUE: AtomicI32 = AtomicI32::new(0); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let unit_number = unit::Number::Unit1; // setup a pulse couter println!("setup pulse counter unit 0"); - let pcnt = PCNT::new(peripherals.PCNT, &mut system.peripheral_clock_control); + let pcnt = PCNT::new(peripherals.PCNT); let mut u0 = pcnt.get_unit(unit_number); u0.configure(unit::Config { low_limit: -100, diff --git a/esp32h2-hal/examples/qspi_flash.rs b/esp32h2-hal/examples/qspi_flash.rs index 64d2aef2411..dd10f4d05d9 100644 --- a/esp32h2-hal/examples/qspi_flash.rs +++ b/esp32h2-hal/examples/qspi_flash.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -44,7 +44,7 @@ fn main() -> ! { let sio3 = io.pins.gpio5; let cs = io.pins.gpio11; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut descriptors = [0u32; 8 * 3]; @@ -60,7 +60,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32h2-hal/examples/ram.rs b/esp32h2-hal/examples/ram.rs index 0da401fad3b..f1bac56ee60 100644 --- a/esp32h2-hal/examples/ram.rs +++ b/esp32h2-hal/examples/ram.rs @@ -32,14 +32,10 @@ static mut SOME_ZEROED_DATA: [u8; 8] = [0; 8]; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; // The RWDT flash boot protection must be enabled, as it is triggered as part of diff --git a/esp32h2-hal/examples/rmt_rx.rs b/esp32h2-hal/examples/rmt_rx.rs index 9263d661ad5..42f3ecda847 100644 --- a/esp32h2-hal/examples/rmt_rx.rs +++ b/esp32h2-hal/examples/rmt_rx.rs @@ -24,12 +24,11 @@ const WIDTH: usize = 80; fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.PCR.split(); - let mut clock_control = system.peripheral_clock_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel2 diff --git a/esp32h2-hal/examples/rmt_tx.rs b/esp32h2-hal/examples/rmt_tx.rs index e0276c56fca..3f0d6008b9e 100644 --- a/esp32h2-hal/examples/rmt_tx.rs +++ b/esp32h2-hal/examples/rmt_tx.rs @@ -19,12 +19,11 @@ use esp_backtrace as _; fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.PCR.split(); - let mut clock_control = system.peripheral_clock_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel0 diff --git a/esp32h2-hal/examples/rsa.rs b/esp32h2-hal/examples/rsa.rs index 7373befa7bc..3a19a40fc03 100644 --- a/esp32h2-hal/examples/rsa.rs +++ b/esp32h2-hal/examples/rsa.rs @@ -56,10 +56,10 @@ const fn compute_mprime(modulus: &U512) -> u32 { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); + let mut rsa = Rsa::new(peripherals.RSA); block!(rsa.ready()).unwrap(); mod_exp_example(&mut rsa); diff --git a/esp32h2-hal/examples/serial_interrupts.rs b/esp32h2-hal/examples/serial_interrupts.rs index b49cb66e6a5..a3c90e527fc 100644 --- a/esp32h2-hal/examples/serial_interrupts.rs +++ b/esp32h2-hal/examples/serial_interrupts.rs @@ -27,21 +27,13 @@ static SERIAL: Mutex>>> = Mutex::new(RefCell::new(Non #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); uart0.set_rx_fifo_full_threshold(30).unwrap(); uart0.listen_at_cmd(); diff --git a/esp32h2-hal/examples/sha.rs b/esp32h2-hal/examples/sha.rs index b97213ea832..2cc2ce7074d 100644 --- a/esp32h2-hal/examples/sha.rs +++ b/esp32h2-hal/examples/sha.rs @@ -18,16 +18,12 @@ use sha2::{Digest, Sha256}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); let mut remaining = source_data; - let mut hasher = Sha::new( - peripherals.SHA, - ShaMode::SHA256, - &mut system.peripheral_clock_control, - ); + let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA256); // Short hashes can be created by decreasing the output buffer to the desired // length diff --git a/esp32h2-hal/examples/spi_eh1_device_loopback.rs b/esp32h2-hal/examples/spi_eh1_device_loopback.rs index e3dbcc5f0e9..597793f9c9d 100644 --- a/esp32h2-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32h2-hal/examples/spi_eh1_device_loopback.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { miso, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, )); let mut spi_device_1 = spi_controller.add_device(io.pins.gpio11); diff --git a/esp32h2-hal/examples/spi_eh1_loopback.rs b/esp32h2-hal/examples/spi_eh1_loopback.rs index 4bb0814a210..dc84f3618ac 100644 --- a/esp32h2-hal/examples/spi_eh1_loopback.rs +++ b/esp32h2-hal/examples/spi_eh1_loopback.rs @@ -31,7 +31,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { cs, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32h2-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32h2-hal/examples/spi_halfduplex_read_manufacturer_id.rs index e42555a8b9c..bdd39bd30ba 100644 --- a/esp32h2-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32h2-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -31,7 +31,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -52,7 +52,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32h2-hal/examples/spi_loopback.rs b/esp32h2-hal/examples/spi_loopback.rs index bae26f2aef3..ad1bf4723d2 100644 --- a/esp32h2-hal/examples/spi_loopback.rs +++ b/esp32h2-hal/examples/spi_loopback.rs @@ -30,7 +30,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -47,7 +47,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32h2-hal/examples/spi_loopback_dma.rs b/esp32h2-hal/examples/spi_loopback_dma.rs index c1246585d02..ea329769dc5 100644 --- a/esp32h2-hal/examples/spi_loopback_dma.rs +++ b/esp32h2-hal/examples/spi_loopback_dma.rs @@ -32,7 +32,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -41,7 +41,7 @@ fn main() -> ! { let mosi = io.pins.gpio3; let cs = io.pins.gpio11; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut descriptors = [0u32; 8 * 3]; @@ -55,7 +55,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32h2-hal/examples/timer_interrupt.rs b/esp32h2-hal/examples/timer_interrupt.rs index 2f3f94d558e..5445d26aab2 100644 --- a/esp32h2-hal/examples/timer_interrupt.rs +++ b/esp32h2-hal/examples/timer_interrupt.rs @@ -24,21 +24,13 @@ static TIMER1: Mutex>>>> = Mutex::new(RefCell #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); let mut timer1 = timer_group1.timer0; interrupt::enable( diff --git a/esp32h2-hal/examples/usb_serial_jtag.rs b/esp32h2-hal/examples/usb_serial_jtag.rs index cbc3c5bea9d..6223269c9cd 100644 --- a/esp32h2-hal/examples/usb_serial_jtag.rs +++ b/esp32h2-hal/examples/usb_serial_jtag.rs @@ -26,18 +26,13 @@ static USB_SERIAL: Mutex>> = Mutex::new(RefCell::n #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut usb_serial = - UsbSerialJtag::new(peripherals.USB_DEVICE, &mut system.peripheral_clock_control); + let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE); usb_serial.listen_rx_packet_recv_interrupt(); diff --git a/esp32h2-hal/examples/watchdog.rs b/esp32h2-hal/examples/watchdog.rs index 310d2b15fc0..ea90af934b9 100644 --- a/esp32h2-hal/examples/watchdog.rs +++ b/esp32h2-hal/examples/watchdog.rs @@ -13,14 +13,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); + let system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let mut wdt0 = timer_group0.wdt; diff --git a/esp32s2-hal/examples/advanced_serial.rs b/esp32s2-hal/examples/advanced_serial.rs index 15b3b612642..8803ad99a04 100644 --- a/esp32s2-hal/examples/advanced_serial.rs +++ b/esp32s2-hal/examples/advanced_serial.rs @@ -29,7 +29,7 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let config = Config { @@ -45,13 +45,7 @@ fn main() -> ! { io.pins.gpio2.into_floating_input(), ); - let mut serial1 = Uart::new_with_config( - peripherals.UART1, - config, - Some(pins), - &clocks, - &mut system.peripheral_clock_control, - ); + let mut serial1 = Uart::new_with_config(peripherals.UART1, config, Some(pins), &clocks); let mut delay = Delay::new(&clocks); diff --git a/esp32s2-hal/examples/aes.rs b/esp32s2-hal/examples/aes.rs index 37b301cfc0b..2c9896be96f 100644 --- a/esp32s2-hal/examples/aes.rs +++ b/esp32s2-hal/examples/aes.rs @@ -19,10 +19,10 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); + let mut aes = Aes::new(peripherals.AES); let keytext = "SUp4SeCp@sSw0rd".as_bytes(); let plaintext = "message".as_bytes(); diff --git a/esp32s2-hal/examples/crc.rs b/esp32s2-hal/examples/crc.rs index 6f47e359371..205eebbc53d 100644 --- a/esp32s2-hal/examples/crc.rs +++ b/esp32s2-hal/examples/crc.rs @@ -19,21 +19,13 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); timer0.start(1u64.secs()); diff --git a/esp32s2-hal/examples/embassy_hello_world.rs b/esp32s2-hal/examples/embassy_hello_world.rs index 0683602edd8..d607e983932 100644 --- a/esp32s2-hal/examples/embassy_hello_world.rs +++ b/esp32s2-hal/examples/embassy_hello_world.rs @@ -38,16 +38,12 @@ async fn run2() { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32s2-hal/examples/embassy_i2c.rs b/esp32s2-hal/examples/embassy_i2c.rs index f3da6156641..50162ea2f23 100644 --- a/esp32s2-hal/examples/embassy_i2c.rs +++ b/esp32s2-hal/examples/embassy_i2c.rs @@ -44,16 +44,12 @@ async fn run(i2c: I2C<'static, I2C0>) { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -64,7 +60,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 400u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s2-hal/examples/embassy_i2s_read.rs b/esp32s2-hal/examples/embassy_i2s_read.rs index e3c9533c428..fdef6a66392 100644 --- a/esp32s2-hal/examples/embassy_i2s_read.rs +++ b/esp32s2-hal/examples/embassy_i2s_read.rs @@ -68,19 +68,15 @@ fn main() -> ! { esp_println::logger::init_logger_from_env(); esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.i2s0channel; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -98,7 +94,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s2-hal/examples/embassy_i2s_sound.rs b/esp32s2-hal/examples/embassy_i2s_sound.rs index aef7761d7a3..1e314ac17b0 100644 --- a/esp32s2-hal/examples/embassy_i2s_sound.rs +++ b/esp32s2-hal/examples/embassy_i2s_sound.rs @@ -107,19 +107,15 @@ fn main() -> ! { esp_println::logger::init_logger_from_env(); esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.i2s0channel; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -137,7 +133,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s2-hal/examples/embassy_multiprio.rs b/esp32s2-hal/examples/embassy_multiprio.rs index ec48b3ca6f8..0e0d6e3e7b3 100644 --- a/esp32s2-hal/examples/embassy_multiprio.rs +++ b/esp32s2-hal/examples/embassy_multiprio.rs @@ -81,7 +81,7 @@ async fn low_prio_async() { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Set GPIO2 as an output, and set its state high initially. @@ -89,11 +89,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32s2-hal/examples/embassy_rmt_rx.rs b/esp32s2-hal/examples/embassy_rmt_rx.rs index 5543513e226..beac84b19f9 100644 --- a/esp32s2-hal/examples/embassy_rmt_rx.rs +++ b/esp32s2-hal/examples/embassy_rmt_rx.rs @@ -95,18 +95,16 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = - esp32s2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); + let timer_group0 = esp32s2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); let channel = rmt .channel2 diff --git a/esp32s2-hal/examples/embassy_rmt_tx.rs b/esp32s2-hal/examples/embassy_rmt_tx.rs index 99d60aeeabf..c3016ecfcfa 100644 --- a/esp32s2-hal/examples/embassy_rmt_tx.rs +++ b/esp32s2-hal/examples/embassy_rmt_tx.rs @@ -51,18 +51,16 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = - esp32s2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); + let timer_group0 = esp32s2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); let channel = rmt .channel0 diff --git a/esp32s2-hal/examples/embassy_serial.rs b/esp32s2-hal/examples/embassy_serial.rs index fc1536b6f7a..253c2f7c882 100644 --- a/esp32s2-hal/examples/embassy_serial.rs +++ b/esp32s2-hal/examples/embassy_serial.rs @@ -64,24 +64,16 @@ async fn reader(mut rx: UartRx<'static, UART0>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); uart0 .set_rx_fifo_full_threshold(READ_BUF_SIZE as u16) diff --git a/esp32s2-hal/examples/embassy_spi.rs b/esp32s2-hal/examples/embassy_spi.rs index 3019ca0216d..f30835e4d50 100644 --- a/esp32s2-hal/examples/embassy_spi.rs +++ b/esp32s2-hal/examples/embassy_spi.rs @@ -52,16 +52,12 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -77,7 +73,7 @@ fn main() -> ! { let mosi = io.pins.gpio35; let cs = io.pins.gpio34; - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.spi2channel; let descriptors = make_static!([0u32; 8 * 3]); @@ -91,7 +87,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32s2-hal/examples/embassy_wait.rs b/esp32s2-hal/examples/embassy_wait.rs index 2f3cf0de62b..fee21c9d2f6 100644 --- a/esp32s2-hal/examples/embassy_wait.rs +++ b/esp32s2-hal/examples/embassy_wait.rs @@ -33,16 +33,12 @@ async fn ping(mut pin: Gpio0>) { fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s2_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32s2-hal/examples/hello_rgb.rs b/esp32s2-hal/examples/hello_rgb.rs index 26f987e8dc9..cd1f9fe8635 100644 --- a/esp32s2-hal/examples/hello_rgb.rs +++ b/esp32s2-hal/examples/hello_rgb.rs @@ -24,19 +24,13 @@ use smart_leds::{ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally - let rmt = Rmt::new( - peripherals.RMT, - 80u32.MHz(), - &mut system.peripheral_clock_control, - &clocks, - ) - .unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); // We use one of the RMT channels to instantiate a `SmartLedsAdapter` which can // be used directly with all `smart_led` implementations diff --git a/esp32s2-hal/examples/hello_world.rs b/esp32s2-hal/examples/hello_world.rs index 27549b1b4c5..ce29d0d0bcd 100644 --- a/esp32s2-hal/examples/hello_world.rs +++ b/esp32s2-hal/examples/hello_world.rs @@ -19,21 +19,13 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); timer0.start(1u64.secs()); diff --git a/esp32s2-hal/examples/hmac.rs b/esp32s2-hal/examples/hmac.rs index c99ebb20f89..1a4fcfed268 100644 --- a/esp32s2-hal/examples/hmac.rs +++ b/esp32s2-hal/examples/hmac.rs @@ -74,7 +74,7 @@ type HmacSha256 = HmacSw; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); @@ -82,7 +82,7 @@ fn main() -> ! { // Set sw key let key = [0_u8; 32].as_ref(); - let mut hw_hmac = Hmac::new(peripherals.HMAC, &mut system.peripheral_clock_control); + let mut hw_hmac = Hmac::new(peripherals.HMAC); let mut src = [0_u8; 1024]; rng.read(src.as_mut_slice()).unwrap(); diff --git a/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs b/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs index ab3d7b0a32c..7d73fd9a8cd 100644 --- a/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs @@ -16,7 +16,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -28,7 +28,6 @@ fn main() -> ! { io.pins.gpio35, io.pins.gpio36, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s2-hal/examples/i2c_display.rs b/esp32s2-hal/examples/i2c_display.rs index 6ea7edacd7a..44d51657c80 100644 --- a/esp32s2-hal/examples/i2c_display.rs +++ b/esp32s2-hal/examples/i2c_display.rs @@ -35,14 +35,10 @@ use xtensa_atomic_emulation_trap as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -54,7 +50,6 @@ fn main() -> ! { io.pins.gpio35, io.pins.gpio36, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s2-hal/examples/i2s_read.rs b/esp32s2-hal/examples/i2s_read.rs index 8d2dad5afa2..c27be6673b1 100644 --- a/esp32s2-hal/examples/i2s_read.rs +++ b/esp32s2-hal/examples/i2s_read.rs @@ -28,12 +28,12 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.i2s0channel; let mut tx_descriptors = [0u32; 8 * 3]; @@ -51,7 +51,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s2-hal/examples/i2s_sound.rs b/esp32s2-hal/examples/i2s_sound.rs index 2964cd4c8fc..b805447a49c 100644 --- a/esp32s2-hal/examples/i2s_sound.rs +++ b/esp32s2-hal/examples/i2s_sound.rs @@ -52,12 +52,12 @@ const SINE: [i16; 64] = [ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.i2s0channel; let mut tx_descriptors = [0u32; 20 * 3]; @@ -75,7 +75,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s2-hal/examples/ledc.rs b/esp32s2-hal/examples/ledc.rs index 57cce859fe6..0a269b18d3b 100644 --- a/esp32s2-hal/examples/ledc.rs +++ b/esp32s2-hal/examples/ledc.rs @@ -25,17 +25,13 @@ use xtensa_atomic_emulation_trap as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); - let mut ledc = LEDC::new( - peripherals.LEDC, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut ledc = LEDC::new(peripherals.LEDC, &clocks); ledc.set_global_slow_clock(LSGlobalClkSource::APBClk); diff --git a/esp32s2-hal/examples/pcnt_encoder.rs b/esp32s2-hal/examples/pcnt_encoder.rs index 0cff5c1c4c5..a6b30004e1f 100644 --- a/esp32s2-hal/examples/pcnt_encoder.rs +++ b/esp32s2-hal/examples/pcnt_encoder.rs @@ -33,7 +33,7 @@ static VALUE: AtomicI32 = AtomicI32::new(0); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -42,7 +42,7 @@ fn main() -> ! { // setup a pulse couter println!("setup pulse counter unit 0"); - let pcnt = PCNT::new(peripherals.PCNT, &mut system.peripheral_clock_control); + let pcnt = PCNT::new(peripherals.PCNT); let mut u0 = pcnt.get_unit(unit_number); u0.configure(unit::Config { low_limit: -100, diff --git a/esp32s2-hal/examples/qspi_flash.rs b/esp32s2-hal/examples/qspi_flash.rs index 10f0d8b1dde..5aef2a06823 100644 --- a/esp32s2-hal/examples/qspi_flash.rs +++ b/esp32s2-hal/examples/qspi_flash.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -44,7 +44,7 @@ fn main() -> ! { let sio3 = io.pins.gpio15; let cs = io.pins.gpio16; - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.spi2channel; let mut descriptors = [0u32; 8 * 3]; @@ -60,7 +60,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32s2-hal/examples/ram.rs b/esp32s2-hal/examples/ram.rs index bc3fa0092cd..e8c538e9839 100644 --- a/esp32s2-hal/examples/ram.rs +++ b/esp32s2-hal/examples/ram.rs @@ -32,14 +32,10 @@ static mut SOME_ZEROED_DATA: [u8; 8] = [0; 8]; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; // The RWDT flash boot protection must be enabled, as it is triggered as part of diff --git a/esp32s2-hal/examples/rmt_rx.rs b/esp32s2-hal/examples/rmt_rx.rs index 0e8d196292a..8c8cbb21b80 100644 --- a/esp32s2-hal/examples/rmt_rx.rs +++ b/esp32s2-hal/examples/rmt_rx.rs @@ -21,12 +21,11 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut out = io.pins.gpio15.into_push_pull_output(); - let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel0 diff --git a/esp32s2-hal/examples/rmt_tx.rs b/esp32s2-hal/examples/rmt_tx.rs index 9b8de158ea5..57a34a4260a 100644 --- a/esp32s2-hal/examples/rmt_tx.rs +++ b/esp32s2-hal/examples/rmt_tx.rs @@ -20,12 +20,11 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut delay = Delay::new(&clocks); - let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel2 diff --git a/esp32s2-hal/examples/rsa.rs b/esp32s2-hal/examples/rsa.rs index 132dba20da4..ba233658c45 100644 --- a/esp32s2-hal/examples/rsa.rs +++ b/esp32s2-hal/examples/rsa.rs @@ -56,10 +56,10 @@ const fn compute_mprime(modulus: &U512) -> u32 { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); + let mut rsa = Rsa::new(peripherals.RSA); block!(rsa.ready()).unwrap(); mod_exp_example(&mut rsa); diff --git a/esp32s2-hal/examples/serial_interrupts.rs b/esp32s2-hal/examples/serial_interrupts.rs index 6cd11924a64..715e47d3a72 100644 --- a/esp32s2-hal/examples/serial_interrupts.rs +++ b/esp32s2-hal/examples/serial_interrupts.rs @@ -25,22 +25,14 @@ static SERIAL: Mutex>>> = Mutex::new(RefCell::new(Non #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Disable the TIMG watchdog timer. - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); uart0.set_rx_fifo_full_threshold(30).unwrap(); uart0.listen_at_cmd(); diff --git a/esp32s2-hal/examples/sha.rs b/esp32s2-hal/examples/sha.rs index e6185c324a4..904eec60b6f 100644 --- a/esp32s2-hal/examples/sha.rs +++ b/esp32s2-hal/examples/sha.rs @@ -19,16 +19,12 @@ use sha2::{Digest, Sha512}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); let mut remaining = source_data.clone(); - let mut hasher = Sha::new( - peripherals.SHA, - ShaMode::SHA512, - &mut system.peripheral_clock_control, - ); + let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA512); // Short hashes can be created by decreasing the output buffer to the desired // length diff --git a/esp32s2-hal/examples/spi_eh1_device_loopback.rs b/esp32s2-hal/examples/spi_eh1_device_loopback.rs index f949b4ebbaf..77a61061e09 100644 --- a/esp32s2-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32s2-hal/examples/spi_eh1_device_loopback.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { miso, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, )); let mut spi_device_1 = spi_controller.add_device(io.pins.gpio1); diff --git a/esp32s2-hal/examples/spi_eh1_loopback.rs b/esp32s2-hal/examples/spi_eh1_loopback.rs index e84fc399f4e..d8e840e3de0 100644 --- a/esp32s2-hal/examples/spi_eh1_loopback.rs +++ b/esp32s2-hal/examples/spi_eh1_loopback.rs @@ -31,7 +31,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -48,7 +48,6 @@ fn main() -> ! { cs, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s2-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32s2-hal/examples/spi_halfduplex_read_manufacturer_id.rs index 6f36ff26b33..6f4e5ce12a0 100644 --- a/esp32s2-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32s2-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -31,7 +31,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -52,7 +52,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s2-hal/examples/spi_loopback.rs b/esp32s2-hal/examples/spi_loopback.rs index 8e090d52400..32ef69f0c8d 100644 --- a/esp32s2-hal/examples/spi_loopback.rs +++ b/esp32s2-hal/examples/spi_loopback.rs @@ -30,7 +30,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -47,7 +47,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s2-hal/examples/spi_loopback_dma.rs b/esp32s2-hal/examples/spi_loopback_dma.rs index 2347283465b..8e52f6c275a 100644 --- a/esp32s2-hal/examples/spi_loopback_dma.rs +++ b/esp32s2-hal/examples/spi_loopback_dma.rs @@ -32,7 +32,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -41,7 +41,7 @@ fn main() -> ! { let mosi = io.pins.gpio35; let cs = io.pins.gpio34; - let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); + let dma = Dma::new(system.dma); let dma_channel = dma.spi2channel; let mut descriptors = [0u32; 8 * 3]; @@ -55,7 +55,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32s2-hal/examples/timer_interrupt.rs b/esp32s2-hal/examples/timer_interrupt.rs index b8041b10231..dc6a99667b2 100644 --- a/esp32s2-hal/examples/timer_interrupt.rs +++ b/esp32s2-hal/examples/timer_interrupt.rs @@ -27,23 +27,15 @@ static TIMER11: Mutex>>>> = Mutex::new(RefCel #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Disable the TIMG watchdog timer. - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer00 = timer_group0.timer0; let mut timer01 = timer_group0.timer1; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); let mut timer10 = timer_group1.timer0; let mut timer11 = timer_group1.timer1; diff --git a/esp32s2-hal/examples/usb_serial.rs b/esp32s2-hal/examples/usb_serial.rs index 5fabe4f02ae..bd2fe449d72 100644 --- a/esp32s2-hal/examples/usb_serial.rs +++ b/esp32s2-hal/examples/usb_serial.rs @@ -20,7 +20,7 @@ static mut EP_MEMORY: [u32; 1024] = [0; 1024]; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::configure(system.clock_control, CpuClock::Clock240MHz).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -30,7 +30,6 @@ fn main() -> ! { io.pins.gpio18, io.pins.gpio19, io.pins.gpio20, - &mut system.peripheral_clock_control, ); let usb_bus = UsbBus::new(usb, unsafe { &mut EP_MEMORY }); diff --git a/esp32s2-hal/examples/watchdog.rs b/esp32s2-hal/examples/watchdog.rs index 4b706b9f5af..9d3a3603c02 100644 --- a/esp32s2-hal/examples/watchdog.rs +++ b/esp32s2-hal/examples/watchdog.rs @@ -13,14 +13,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let mut wdt = timer_group0.wdt; diff --git a/esp32s3-hal/examples/advanced_serial.rs b/esp32s3-hal/examples/advanced_serial.rs index 809332c021c..6dd575c7269 100644 --- a/esp32s3-hal/examples/advanced_serial.rs +++ b/esp32s3-hal/examples/advanced_serial.rs @@ -29,7 +29,7 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let config = Config { @@ -45,13 +45,7 @@ fn main() -> ! { io.pins.gpio2.into_floating_input(), ); - let mut serial1 = Uart::new_with_config( - peripherals.UART1, - config, - Some(pins), - &clocks, - &mut system.peripheral_clock_control, - ); + let mut serial1 = Uart::new_with_config(peripherals.UART1, config, Some(pins), &clocks); let mut delay = Delay::new(&clocks); diff --git a/esp32s3-hal/examples/aes.rs b/esp32s3-hal/examples/aes.rs index 73ecda731a6..d5c0c801869 100644 --- a/esp32s3-hal/examples/aes.rs +++ b/esp32s3-hal/examples/aes.rs @@ -19,10 +19,10 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); + let mut aes = Aes::new(peripherals.AES); let keytext = "SUp4SeCp@sSw0rd".as_bytes(); let plaintext = "message".as_bytes(); diff --git a/esp32s3-hal/examples/crc.rs b/esp32s3-hal/examples/crc.rs index e24d5399470..ac05da313fb 100644 --- a/esp32s3-hal/examples/crc.rs +++ b/esp32s3-hal/examples/crc.rs @@ -19,21 +19,13 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); timer0.start(1u64.secs()); diff --git a/esp32s3-hal/examples/debug_assist.rs b/esp32s3-hal/examples/debug_assist.rs index fd72beb1dc5..67f1599d01b 100644 --- a/esp32s3-hal/examples/debug_assist.rs +++ b/esp32s3-hal/examples/debug_assist.rs @@ -23,13 +23,10 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut da = DebugAssist::new( - peripherals.ASSIST_DEBUG, - &mut system.peripheral_clock_control, - ); + let mut da = DebugAssist::new(peripherals.ASSIST_DEBUG); // uncomment the functionality you want to test diff --git a/esp32s3-hal/examples/embassy_hello_world.rs b/esp32s3-hal/examples/embassy_hello_world.rs index e006e122e81..b6868526957 100644 --- a/esp32s3-hal/examples/embassy_hello_world.rs +++ b/esp32s3-hal/examples/embassy_hello_world.rs @@ -48,11 +48,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32s3-hal/examples/embassy_i2c.rs b/esp32s3-hal/examples/embassy_i2c.rs index 69ab93b6c7b..b61d1ca8423 100644 --- a/esp32s3-hal/examples/embassy_i2c.rs +++ b/esp32s3-hal/examples/embassy_i2c.rs @@ -55,11 +55,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -70,7 +66,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 400u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s3-hal/examples/embassy_i2s_read.rs b/esp32s3-hal/examples/embassy_i2s_read.rs index f9ef575bfc1..a8059638cdc 100644 --- a/esp32s3-hal/examples/embassy_i2s_read.rs +++ b/esp32s3-hal/examples/embassy_i2s_read.rs @@ -80,17 +80,12 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32s3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -108,7 +103,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s3-hal/examples/embassy_i2s_sound.rs b/esp32s3-hal/examples/embassy_i2s_sound.rs index 7d920acbca9..c79eda87fa5 100644 --- a/esp32s3-hal/examples/embassy_i2s_sound.rs +++ b/esp32s3-hal/examples/embassy_i2s_sound.rs @@ -117,17 +117,12 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32s3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ) - .timer0, + esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let tx_descriptors = make_static!([0u32; 20 * 3]); @@ -145,7 +140,6 @@ fn main() -> ! { rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s3-hal/examples/embassy_multicore.rs b/esp32s3-hal/examples/embassy_multicore.rs index c1f84ffabcf..0469eca6610 100644 --- a/esp32s3-hal/examples/embassy_multicore.rs +++ b/esp32s3-hal/examples/embassy_multicore.rs @@ -78,11 +78,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32s3-hal/examples/embassy_multicore_interrupt.rs b/esp32s3-hal/examples/embassy_multicore_interrupt.rs index e74daa7e596..69545537094 100644 --- a/esp32s3-hal/examples/embassy_multicore_interrupt.rs +++ b/esp32s3-hal/examples/embassy_multicore_interrupt.rs @@ -95,11 +95,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32s3-hal/examples/embassy_multiprio.rs b/esp32s3-hal/examples/embassy_multiprio.rs index a1489369437..53cc8bc5626 100644 --- a/esp32s3-hal/examples/embassy_multiprio.rs +++ b/esp32s3-hal/examples/embassy_multiprio.rs @@ -95,11 +95,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32s3-hal/examples/embassy_rmt_rx.rs b/esp32s3-hal/examples/embassy_rmt_rx.rs index 944442b2fe3..ccf030911eb 100644 --- a/esp32s3-hal/examples/embassy_rmt_rx.rs +++ b/esp32s3-hal/examples/embassy_rmt_rx.rs @@ -81,7 +81,6 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; #[cfg(feature = "embassy-time-systick")] embassy::init( @@ -91,14 +90,13 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = - esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); + let timer_group0 = esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &clocks).unwrap(); let channel = rmt .channel4 diff --git a/esp32s3-hal/examples/embassy_rmt_tx.rs b/esp32s3-hal/examples/embassy_rmt_tx.rs index 875f8493db1..8004289d9c2 100644 --- a/esp32s3-hal/examples/embassy_rmt_tx.rs +++ b/esp32s3-hal/examples/embassy_rmt_tx.rs @@ -50,7 +50,6 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; #[cfg(feature = "embassy-time-systick")] embassy::init( @@ -61,12 +60,12 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] embassy::init( &clocks, - esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control).timer0, + esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0, ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &clocks).unwrap(); let channel = rmt .channel0 diff --git a/esp32s3-hal/examples/embassy_serial.rs b/esp32s3-hal/examples/embassy_serial.rs index 38a08335425..99ad4871217 100644 --- a/esp32s3-hal/examples/embassy_serial.rs +++ b/esp32s3-hal/examples/embassy_serial.rs @@ -75,19 +75,11 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); uart0 .set_rx_fifo_full_threshold(READ_BUF_SIZE as u16) diff --git a/esp32s3-hal/examples/embassy_spi.rs b/esp32s3-hal/examples/embassy_spi.rs index 5ab99ed672b..8c3b62bb13c 100644 --- a/esp32s3-hal/examples/embassy_spi.rs +++ b/esp32s3-hal/examples/embassy_spi.rs @@ -65,11 +65,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } @@ -90,7 +86,7 @@ fn main() -> ! { let mosi = io.pins.gpio7; let cs = io.pins.gpio10; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let descriptors = make_static!([0u32; 8 * 3]); @@ -104,7 +100,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32s3-hal/examples/embassy_wait.rs b/esp32s3-hal/examples/embassy_wait.rs index 868f91f5475..cde7fe21384 100644 --- a/esp32s3-hal/examples/embassy_wait.rs +++ b/esp32s3-hal/examples/embassy_wait.rs @@ -44,11 +44,7 @@ fn main() -> ! { #[cfg(feature = "embassy-time-timg0")] { - let timer_group0 = esp32s3_hal::timer::TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); } diff --git a/esp32s3-hal/examples/hello_rgb.rs b/esp32s3-hal/examples/hello_rgb.rs index 3b77ad5a903..111da49aa2e 100644 --- a/esp32s3-hal/examples/hello_rgb.rs +++ b/esp32s3-hal/examples/hello_rgb.rs @@ -24,19 +24,13 @@ use smart_leds::{ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally - let rmt = Rmt::new( - peripherals.RMT, - 80u32.MHz(), - &mut system.peripheral_clock_control, - &clocks, - ) - .unwrap(); + let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &clocks).unwrap(); // We use one of the RMT channels to instantiate a `SmartLedsAdapter` which can // be used directly with all `smart_led` implementations diff --git a/esp32s3-hal/examples/hello_world.rs b/esp32s3-hal/examples/hello_world.rs index 975e4f62fde..47a8f8d0aa9 100644 --- a/esp32s3-hal/examples/hello_world.rs +++ b/esp32s3-hal/examples/hello_world.rs @@ -19,21 +19,13 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); timer0.start(1u64.secs()); diff --git a/esp32s3-hal/examples/hmac.rs b/esp32s3-hal/examples/hmac.rs index 21a54849204..37036aebd93 100644 --- a/esp32s3-hal/examples/hmac.rs +++ b/esp32s3-hal/examples/hmac.rs @@ -74,7 +74,7 @@ type HmacSha256 = HmacSw; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); @@ -82,7 +82,7 @@ fn main() -> ! { // Set sw key let key = [0_u8; 32].as_ref(); - let mut hw_hmac = Hmac::new(peripherals.HMAC, &mut system.peripheral_clock_control); + let mut hw_hmac = Hmac::new(peripherals.HMAC); let mut src = [0_u8; 1024]; rng.read(src.as_mut_slice()).unwrap(); diff --git a/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs b/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs index 980c6ebbbc7..9ce5f38f83f 100644 --- a/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs @@ -16,7 +16,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -28,7 +28,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s3-hal/examples/i2c_display.rs b/esp32s3-hal/examples/i2c_display.rs index be9e8e07437..fe1c3547993 100644 --- a/esp32s3-hal/examples/i2c_display.rs +++ b/esp32s3-hal/examples/i2c_display.rs @@ -34,14 +34,10 @@ use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -53,7 +49,6 @@ fn main() -> ! { io.pins.gpio1, io.pins.gpio2, 100u32.kHz(), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s3-hal/examples/i2s_read.rs b/esp32s3-hal/examples/i2s_read.rs index f63fc6d6591..e83ce6cb460 100644 --- a/esp32s3-hal/examples/i2s_read.rs +++ b/esp32s3-hal/examples/i2s_read.rs @@ -31,12 +31,12 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut tx_descriptors = [0u32; 8 * 3]; @@ -58,7 +58,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s3-hal/examples/i2s_sound.rs b/esp32s3-hal/examples/i2s_sound.rs index b1cc83dbb2e..da8dfb2a139 100644 --- a/esp32s3-hal/examples/i2s_sound.rs +++ b/esp32s3-hal/examples/i2s_sound.rs @@ -52,12 +52,12 @@ const SINE: [i16; 64] = [ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut tx_descriptors = [0u32; 20 * 3]; @@ -75,7 +75,6 @@ fn main() -> ! { &mut rx_descriptors, DmaPriority::Priority0, ), - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s3-hal/examples/ledc.rs b/esp32s3-hal/examples/ledc.rs index 988b2fdd340..1a85fe6cb9c 100644 --- a/esp32s3-hal/examples/ledc.rs +++ b/esp32s3-hal/examples/ledc.rs @@ -24,17 +24,13 @@ use esp_backtrace as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); - let mut ledc = LEDC::new( - peripherals.LEDC, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut ledc = LEDC::new(peripherals.LEDC, &clocks); ledc.set_global_slow_clock(LSGlobalClkSource::APBClk); diff --git a/esp32s3-hal/examples/mcpwm.rs b/esp32s3-hal/examples/mcpwm.rs index 211202a9d59..b3c9955454e 100644 --- a/esp32s3-hal/examples/mcpwm.rs +++ b/esp32s3-hal/examples/mcpwm.rs @@ -18,7 +18,7 @@ use esp_backtrace as _; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -26,11 +26,7 @@ fn main() -> ! { // initialize peripheral let clock_cfg = PeripheralClockConfig::with_frequency(&clocks, 40u32.MHz()).unwrap(); - let mut mcpwm = MCPWM::new( - peripherals.MCPWM0, - clock_cfg, - &mut system.peripheral_clock_control, - ); + let mut mcpwm = MCPWM::new(peripherals.MCPWM0, clock_cfg); // connect operator0 to timer0 mcpwm.operator0.set_timer(&mcpwm.timer0); diff --git a/esp32s3-hal/examples/multicore.rs b/esp32s3-hal/examples/multicore.rs index d9ee523762a..59d63a36244 100644 --- a/esp32s3-hal/examples/multicore.rs +++ b/esp32s3-hal/examples/multicore.rs @@ -24,21 +24,13 @@ static mut APP_CORE_STACK: Stack<8192> = Stack::new(); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); let mut timer1 = timer_group1.timer0; timer0.start(1u64.secs()); diff --git a/esp32s3-hal/examples/pcnt_encoder.rs b/esp32s3-hal/examples/pcnt_encoder.rs index 061f3f92601..17ef78b095c 100644 --- a/esp32s3-hal/examples/pcnt_encoder.rs +++ b/esp32s3-hal/examples/pcnt_encoder.rs @@ -33,7 +33,7 @@ static VALUE: AtomicI32 = AtomicI32::new(0); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -42,7 +42,7 @@ fn main() -> ! { // setup a pulse couter println!("setup pulse counter unit 0"); - let pcnt = PCNT::new(peripherals.PCNT, &mut system.peripheral_clock_control); + let pcnt = PCNT::new(peripherals.PCNT); let mut u0 = pcnt.get_unit(unit_number); u0.configure(unit::Config { low_limit: -100, diff --git a/esp32s3-hal/examples/qspi_flash.rs b/esp32s3-hal/examples/qspi_flash.rs index 4ee2346c58e..209539df6d1 100644 --- a/esp32s3-hal/examples/qspi_flash.rs +++ b/esp32s3-hal/examples/qspi_flash.rs @@ -33,7 +33,7 @@ use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -44,7 +44,7 @@ fn main() -> ! { let sio3 = io.pins.gpio15; let cs = io.pins.gpio16; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut descriptors = [0u32; 8 * 3]; @@ -60,7 +60,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32s3-hal/examples/ram.rs b/esp32s3-hal/examples/ram.rs index 896f0d76d22..7e021ec3178 100644 --- a/esp32s3-hal/examples/ram.rs +++ b/esp32s3-hal/examples/ram.rs @@ -32,14 +32,10 @@ static mut SOME_ZEROED_DATA: [u8; 8] = [0; 8]; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; // The RWDT flash boot protection must be enabled, as it is triggered as part of diff --git a/esp32s3-hal/examples/rmt_rx.rs b/esp32s3-hal/examples/rmt_rx.rs index e4cd1f493ca..2fb3fb9a620 100644 --- a/esp32s3-hal/examples/rmt_rx.rs +++ b/esp32s3-hal/examples/rmt_rx.rs @@ -25,11 +25,10 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel7 diff --git a/esp32s3-hal/examples/rmt_tx.rs b/esp32s3-hal/examples/rmt_tx.rs index 1b1ba0d28ef..7a3da6ce9cc 100644 --- a/esp32s3-hal/examples/rmt_tx.rs +++ b/esp32s3-hal/examples/rmt_tx.rs @@ -16,11 +16,10 @@ fn main() -> ! { let peripherals = Peripherals::take(); let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut clock_control = system.peripheral_clock_control; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &mut clock_control, &clocks).unwrap(); + let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &clocks).unwrap(); let mut channel = rmt .channel0 diff --git a/esp32s3-hal/examples/rsa.rs b/esp32s3-hal/examples/rsa.rs index 2240913c497..de7afe0c4cf 100644 --- a/esp32s3-hal/examples/rsa.rs +++ b/esp32s3-hal/examples/rsa.rs @@ -56,10 +56,10 @@ const fn compute_mprime(modulus: &U512) -> u32 { #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); + let mut rsa = Rsa::new(peripherals.RSA); block!(rsa.ready()).unwrap(); mod_exp_example(&mut rsa); diff --git a/esp32s3-hal/examples/serial_interrupts.rs b/esp32s3-hal/examples/serial_interrupts.rs index 70a663b7856..3e4fb25c9d1 100644 --- a/esp32s3-hal/examples/serial_interrupts.rs +++ b/esp32s3-hal/examples/serial_interrupts.rs @@ -25,21 +25,13 @@ static SERIAL: Mutex>>> = Mutex::new(RefCell::new(Non #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut uart0 = Uart::new( - peripherals.UART0, - &clocks, - &mut system.peripheral_clock_control, - ); + let mut uart0 = Uart::new(peripherals.UART0, &clocks); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); uart0.set_rx_fifo_full_threshold(30).unwrap(); uart0.listen_at_cmd(); diff --git a/esp32s3-hal/examples/sha.rs b/esp32s3-hal/examples/sha.rs index 4801cc3052b..8d24d474fd3 100644 --- a/esp32s3-hal/examples/sha.rs +++ b/esp32s3-hal/examples/sha.rs @@ -19,16 +19,12 @@ use sha2::{Digest, Sha512}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); let mut remaining = source_data.clone(); - let mut hasher = Sha::new( - peripherals.SHA, - ShaMode::SHA512, - &mut system.peripheral_clock_control, - ); + let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA512); // Short hashes can be created by decreasing the output buffer to the desired // length diff --git a/esp32s3-hal/examples/spi_eh1_device_loopback.rs b/esp32s3-hal/examples/spi_eh1_device_loopback.rs index 2b95b820852..80d5a2ff71e 100644 --- a/esp32s3-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32s3-hal/examples/spi_eh1_device_loopback.rs @@ -48,7 +48,6 @@ fn main() -> ! { miso, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, )); let mut spi_device_1 = spi_controller.add_device(io.pins.gpio4); diff --git a/esp32s3-hal/examples/spi_eh1_loopback.rs b/esp32s3-hal/examples/spi_eh1_loopback.rs index 53abe0059de..91992e58c6f 100644 --- a/esp32s3-hal/examples/spi_eh1_loopback.rs +++ b/esp32s3-hal/examples/spi_eh1_loopback.rs @@ -48,7 +48,6 @@ fn main() -> ! { cs, 1000u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s3-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32s3-hal/examples/spi_halfduplex_read_manufacturer_id.rs index 3131d5739ff..28c563c757d 100644 --- a/esp32s3-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32s3-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -31,7 +31,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -52,7 +52,6 @@ fn main() -> ! { Some(cs), 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s3-hal/examples/spi_loopback.rs b/esp32s3-hal/examples/spi_loopback.rs index ed9a271a27b..067e5e49449 100644 --- a/esp32s3-hal/examples/spi_loopback.rs +++ b/esp32s3-hal/examples/spi_loopback.rs @@ -30,7 +30,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -47,7 +47,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ); diff --git a/esp32s3-hal/examples/spi_loopback_dma.rs b/esp32s3-hal/examples/spi_loopback_dma.rs index be49cf976ba..95aee5d6a50 100644 --- a/esp32s3-hal/examples/spi_loopback_dma.rs +++ b/esp32s3-hal/examples/spi_loopback_dma.rs @@ -32,7 +32,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -41,7 +41,7 @@ fn main() -> ! { let mosi = io.pins.gpio7; let cs = io.pins.gpio10; - let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); + let dma = Gdma::new(peripherals.DMA); let dma_channel = dma.channel0; let mut descriptors = [0u32; 8 * 3]; @@ -55,7 +55,6 @@ fn main() -> ! { cs, 100u32.kHz(), SpiMode::Mode0, - &mut system.peripheral_clock_control, &clocks, ) .with_dma(dma_channel.configure( diff --git a/esp32s3-hal/examples/timer_interrupt.rs b/esp32s3-hal/examples/timer_interrupt.rs index 8c66a3909ff..08eb304dda4 100644 --- a/esp32s3-hal/examples/timer_interrupt.rs +++ b/esp32s3-hal/examples/timer_interrupt.rs @@ -27,22 +27,14 @@ static TIMER11: Mutex>>>> = Mutex::new(RefCel #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer00 = timer_group0.timer0; let mut timer01 = timer_group0.timer1; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); let mut timer10 = timer_group1.timer0; let mut timer11 = timer_group1.timer1; diff --git a/esp32s3-hal/examples/twai.rs b/esp32s3-hal/examples/twai.rs index a5ec68fed56..962f3c17678 100644 --- a/esp32s3-hal/examples/twai.rs +++ b/esp32s3-hal/examples/twai.rs @@ -33,7 +33,7 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -51,7 +51,6 @@ fn main() -> ! { peripherals.TWAI0, can_tx_pin, can_rx_pin, - &mut system.peripheral_clock_control, &clocks, CAN_BAUDRATE, ); diff --git a/esp32s3-hal/examples/usb_serial.rs b/esp32s3-hal/examples/usb_serial.rs index 14ecc6bf207..9e2dff5da67 100644 --- a/esp32s3-hal/examples/usb_serial.rs +++ b/esp32s3-hal/examples/usb_serial.rs @@ -20,7 +20,7 @@ static mut EP_MEMORY: [u32; 1024] = [0; 1024]; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let _clocks = ClockControl::configure(system.clock_control, CpuClock::Clock240MHz).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -30,7 +30,6 @@ fn main() -> ! { io.pins.gpio18, io.pins.gpio19, io.pins.gpio20, - &mut system.peripheral_clock_control, ); let usb_bus = UsbBus::new(usb, unsafe { &mut EP_MEMORY }); diff --git a/esp32s3-hal/examples/usb_serial_jtag.rs b/esp32s3-hal/examples/usb_serial_jtag.rs index 7eeeb08aa53..08cf119de24 100644 --- a/esp32s3-hal/examples/usb_serial_jtag.rs +++ b/esp32s3-hal/examples/usb_serial_jtag.rs @@ -26,18 +26,13 @@ static USB_SERIAL: Mutex>> = Mutex::new(RefCell::n #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; - let mut usb_serial = - UsbSerialJtag::new(peripherals.USB_DEVICE, &mut system.peripheral_clock_control); + let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE); usb_serial.listen_rx_packet_recv_interrupt(); diff --git a/esp32s3-hal/examples/watchdog.rs b/esp32s3-hal/examples/watchdog.rs index 1ec57348ef7..7412f5e5b32 100644 --- a/esp32s3-hal/examples/watchdog.rs +++ b/esp32s3-hal/examples/watchdog.rs @@ -13,14 +13,10 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); + let system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); + let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); let mut timer0 = timer_group0.timer0; let mut wdt = timer_group0.wdt;