From d12a3dbac5840d4520d14e2f71aaab60e9d970d2 Mon Sep 17 00:00:00 2001 From: Jesse Braham Date: Thu, 31 Aug 2023 07:17:12 -0700 Subject: [PATCH] Update all examples to remove unnecessary disabling of watchdogs (#768) * Update `esp32-hal` examples * Update `esp32c2-hal` examples * Update `esp32c3-hal` examples * Update `esp32c6-hal` examples * Update `esp32h2-hal` examples * Update `esp32s2-hal` examples * Update `esp32s3-hal` examples * Fix the `ram.rs` examples --- esp32-hal/examples/adc.rs | 16 +------- esp32-hal/examples/advanced_serial.rs | 14 ------- esp32-hal/examples/aes.rs | 23 +---------- esp32-hal/examples/blinky.rs | 24 +----------- esp32-hal/examples/blinky_erased_pins.rs | 16 +------- esp32-hal/examples/clock_monitor.rs | 4 -- esp32-hal/examples/crc.rs | 7 ---- esp32-hal/examples/dac.rs | 25 +----------- esp32-hal/examples/embassy_hello_world.rs | 16 -------- esp32-hal/examples/embassy_i2c.rs | 8 ---- esp32-hal/examples/embassy_multicore.rs | 18 +-------- .../examples/embassy_multicore_interrupt.rs | 18 +-------- esp32-hal/examples/embassy_multiprio.rs | 18 +-------- esp32-hal/examples/embassy_serial.rs | 16 -------- esp32-hal/examples/embassy_spi.rs | 22 ----------- esp32-hal/examples/embassy_wait.rs | 16 -------- esp32-hal/examples/gpio_interrupt.rs | 17 +------- esp32-hal/examples/hello_rgb.rs | 22 +---------- esp32-hal/examples/hello_world.rs | 7 ---- .../examples/i2c_bmp180_calibration_data.rs | 22 +---------- esp32-hal/examples/i2c_display.rs | 7 ---- esp32-hal/examples/i2s_read.rs | 14 ------- esp32-hal/examples/i2s_sound.rs | 14 ------- esp32-hal/examples/ledc.rs | 14 ------- esp32-hal/examples/mcpwm.rs | 14 ------- esp32-hal/examples/multicore.rs | 10 ----- esp32-hal/examples/pcnt_encoder.rs | 15 +------ esp32-hal/examples/psram.rs | 12 ------ esp32-hal/examples/qspi_flash.rs | 22 ----------- esp32-hal/examples/ram.rs | 10 ++--- esp32-hal/examples/read_efuse.rs | 25 ++---------- esp32-hal/examples/rmt_rx.rs | 10 ----- esp32-hal/examples/rmt_tx.rs | 10 ----- esp32-hal/examples/rng.rs | 25 ++---------- esp32-hal/examples/rsa.rs | 23 +---------- esp32-hal/examples/rtc_time.rs | 23 ++--------- esp32-hal/examples/serial_interrupts.rs | 17 -------- esp32-hal/examples/sha.rs | 16 +------- esp32-hal/examples/sleep_timer.rs | 20 +--------- esp32-hal/examples/sleep_timer_ext0.rs | 20 +--------- esp32-hal/examples/sleep_timer_ext1.rs | 20 +--------- esp32-hal/examples/software_interrupts.rs | 16 +------- esp32-hal/examples/spi_eh1_device_loopback.rs | 15 ------- esp32-hal/examples/spi_eh1_loopback.rs | 15 ------- .../spi_halfduplex_read_manufacturer_id.rs | 22 ----------- esp32-hal/examples/spi_loopback.rs | 15 ------- esp32-hal/examples/spi_loopback_dma.rs | 15 ------- esp32-hal/examples/timer_interrupt.rs | 12 +----- esp32c2-hal/examples/adc.rs | 16 -------- esp32c2-hal/examples/adc_cal.rs | 16 -------- esp32c2-hal/examples/advanced_serial.rs | 8 ---- esp32c2-hal/examples/blinky.rs | 26 +------------ esp32c2-hal/examples/blinky_erased_pins.rs | 18 +-------- esp32c2-hal/examples/clock_monitor.rs | 5 --- esp32c2-hal/examples/crc.rs | 15 ++----- esp32c2-hal/examples/debug_assist.rs | 17 +------- esp32c2-hal/examples/direct-vectoring.rs | 15 ------- esp32c2-hal/examples/embassy_hello_world.rs | 32 +++++---------- esp32c2-hal/examples/embassy_i2c.rs | 25 +++++------- esp32c2-hal/examples/embassy_serial.rs | 27 +++++-------- esp32c2-hal/examples/embassy_spi.rs | 25 +++++------- esp32c2-hal/examples/embassy_wait.rs | 24 +++++------- esp32c2-hal/examples/gpio_interrupt.rs | 18 +-------- esp32c2-hal/examples/hello_world.rs | 14 ++----- .../examples/i2c_bmp180_calibration_data.rs | 23 +---------- esp32c2-hal/examples/i2c_display.rs | 8 ---- esp32c2-hal/examples/interrupt_preemption.rs | 13 ------- esp32c2-hal/examples/ledc.rs | 19 +-------- esp32c2-hal/examples/qspi_flash.rs | 16 -------- esp32c2-hal/examples/read_efuse.rs | 26 ++----------- esp32c2-hal/examples/rng.rs | 26 ++----------- esp32c2-hal/examples/rtc_time.rs | 26 ++----------- esp32c2-hal/examples/serial_interrupts.rs | 8 ---- esp32c2-hal/examples/sha.rs | 19 +-------- esp32c2-hal/examples/software_interrupts.rs | 17 +------- .../examples/spi_eh1_device_loopback.rs | 16 -------- esp32c2-hal/examples/spi_eh1_loopback.rs | 16 -------- .../spi_halfduplex_read_manufacturer_id.rs | 16 -------- esp32c2-hal/examples/spi_loopback.rs | 16 -------- esp32c2-hal/examples/spi_loopback_dma.rs | 16 -------- esp32c2-hal/examples/systimer.rs | 17 +------- esp32c2-hal/examples/timer_interrupt.rs | 9 ----- esp32c3-hal/examples/adc.rs | 23 ----------- esp32c3-hal/examples/adc_cal.rs | 23 ----------- esp32c3-hal/examples/advanced_serial.rs | 15 ------- esp32c3-hal/examples/aes.rs | 24 +----------- esp32c3-hal/examples/blinky.rs | 33 +--------------- esp32c3-hal/examples/blinky_erased_pins.rs | 25 +----------- esp32c3-hal/examples/clock_monitor.rs | 5 --- esp32c3-hal/examples/crc.rs | 16 -------- esp32c3-hal/examples/debug_assist.rs | 24 +----------- esp32c3-hal/examples/direct-vectoring.rs | 23 ----------- esp32c3-hal/examples/embassy_hello_world.rs | 39 +++++-------------- esp32c3-hal/examples/embassy_i2c.rs | 32 +++++---------- esp32c3-hal/examples/embassy_serial.rs | 32 +++++---------- esp32c3-hal/examples/embassy_spi.rs | 32 +++++---------- esp32c3-hal/examples/embassy_wait.rs | 32 +++++---------- esp32c3-hal/examples/gpio_interrupt.rs | 25 +----------- esp32c3-hal/examples/hello_rgb.rs | 23 +---------- esp32c3-hal/examples/hello_world.rs | 15 ------- esp32c3-hal/examples/hmac.rs | 24 +----------- .../examples/i2c_bmp180_calibration_data.rs | 30 +------------- esp32c3-hal/examples/i2c_display.rs | 15 ------- esp32c3-hal/examples/i2s_read.rs | 22 ----------- esp32c3-hal/examples/i2s_sound.rs | 22 ----------- esp32c3-hal/examples/interrupt_preemption.rs | 21 ---------- esp32c3-hal/examples/ledc.rs | 22 ----------- esp32c3-hal/examples/qspi_flash.rs | 23 ----------- esp32c3-hal/examples/ram.rs | 10 ++--- esp32c3-hal/examples/read_efuse.rs | 33 ++-------------- esp32c3-hal/examples/rmt_rx.rs | 15 ------- esp32c3-hal/examples/rmt_tx.rs | 15 ------- esp32c3-hal/examples/rng.rs | 33 ++-------------- esp32c3-hal/examples/rsa.rs | 24 +----------- esp32c3-hal/examples/rtc_time.rs | 33 ++-------------- esp32c3-hal/examples/serial_interrupts.rs | 15 ------- esp32c3-hal/examples/sha.rs | 19 +-------- esp32c3-hal/examples/software_interrupts.rs | 25 +----------- .../examples/spi_eh1_device_loopback.rs | 23 ----------- esp32c3-hal/examples/spi_eh1_loopback.rs | 23 ----------- .../spi_halfduplex_read_manufacturer_id.rs | 23 ----------- esp32c3-hal/examples/spi_loopback.rs | 23 ----------- esp32c3-hal/examples/spi_loopback_dma.rs | 23 ----------- esp32c3-hal/examples/systimer.rs | 17 +------- esp32c3-hal/examples/timer_interrupt.rs | 11 ------ esp32c3-hal/examples/twai.rs | 30 +------------- esp32c3-hal/examples/usb_serial_jtag.rs | 15 ------- esp32c6-hal/examples/adc.rs | 23 ----------- esp32c6-hal/examples/adc_cal.rs | 23 ----------- esp32c6-hal/examples/advanced_serial.rs | 16 -------- esp32c6-hal/examples/aes.rs | 27 +------------ esp32c6-hal/examples/blinky.rs | 33 +--------------- esp32c6-hal/examples/blinky_erased_pins.rs | 25 +----------- esp32c6-hal/examples/crc.rs | 17 +------- esp32c6-hal/examples/debug_assist.rs | 24 +----------- esp32c6-hal/examples/direct-vectoring.rs | 23 ----------- esp32c6-hal/examples/embassy_hello_world.rs | 38 +++++------------- esp32c6-hal/examples/embassy_i2c.rs | 31 ++++----------- esp32c6-hal/examples/embassy_serial.rs | 31 ++++----------- esp32c6-hal/examples/embassy_spi.rs | 33 ++++------------ esp32c6-hal/examples/embassy_wait.rs | 31 ++++----------- esp32c6-hal/examples/gpio_interrupt.rs | 26 +------------ esp32c6-hal/examples/hello_rgb.rs | 31 +-------------- esp32c6-hal/examples/hello_world.rs | 17 +------- esp32c6-hal/examples/hmac.rs | 24 +----------- .../examples/i2c_bmp180_calibration_data.rs | 30 +------------- esp32c6-hal/examples/i2c_display.rs | 15 ------- esp32c6-hal/examples/i2s_read.rs | 24 ------------ esp32c6-hal/examples/i2s_sound.rs | 22 ----------- esp32c6-hal/examples/interrupt_preemption.rs | 23 ----------- esp32c6-hal/examples/ledc.rs | 24 ------------ esp32c6-hal/examples/lp_core_basic.rs | 26 +------------ esp32c6-hal/examples/mcpwm.rs | 24 ------------ esp32c6-hal/examples/parl_io_tx.rs | 22 ----------- esp32c6-hal/examples/pcnt_encoder.rs | 26 +------------ esp32c6-hal/examples/qspi_flash.rs | 23 ----------- esp32c6-hal/examples/ram.rs | 19 +++------ esp32c6-hal/examples/read_efuse.rs | 33 ++-------------- esp32c6-hal/examples/rmt_rx.rs | 15 ------- esp32c6-hal/examples/rmt_tx.rs | 15 ------- esp32c6-hal/examples/rng.rs | 33 ++-------------- esp32c6-hal/examples/rsa.rs | 25 +----------- esp32c6-hal/examples/rtc_time.rs | 33 ++-------------- esp32c6-hal/examples/serial_interrupts.rs | 17 +------- esp32c6-hal/examples/sha.rs | 18 +-------- esp32c6-hal/examples/software_interrupts.rs | 25 +----------- .../examples/spi_eh1_device_loopback.rs | 24 ------------ esp32c6-hal/examples/spi_eh1_loopback.rs | 24 ------------ .../spi_halfduplex_read_manufacturer_id.rs | 23 ----------- esp32c6-hal/examples/spi_loopback.rs | 24 ------------ esp32c6-hal/examples/spi_loopback_dma.rs | 24 ------------ esp32c6-hal/examples/systimer.rs | 26 +------------ esp32c6-hal/examples/timer_interrupt.rs | 13 +------ esp32c6-hal/examples/usb_serial_jtag.rs | 15 ------- esp32h2-hal/examples/adc.rs | 23 ----------- esp32h2-hal/examples/advanced_serial.rs | 16 -------- esp32h2-hal/examples/aes.rs | 27 +------------ esp32h2-hal/examples/blinky.rs | 33 +--------------- esp32h2-hal/examples/blinky_erased_pins.rs | 25 +----------- esp32h2-hal/examples/crc.rs | 20 +--------- esp32h2-hal/examples/debug_assist.rs | 24 +----------- esp32h2-hal/examples/direct-vectoring.rs | 23 ----------- esp32h2-hal/examples/embassy_hello_world.rs | 38 +++++------------- esp32h2-hal/examples/embassy_i2c.rs | 31 ++++----------- esp32h2-hal/examples/embassy_serial.rs | 31 ++++----------- esp32h2-hal/examples/embassy_spi.rs | 33 ++++------------ esp32h2-hal/examples/embassy_wait.rs | 31 ++++----------- esp32h2-hal/examples/gpio_interrupt.rs | 26 +------------ esp32h2-hal/examples/hello_rgb.rs | 31 +-------------- esp32h2-hal/examples/hello_world.rs | 20 +--------- esp32h2-hal/examples/hmac.rs | 26 +------------ .../examples/i2c_bmp180_calibration_data.rs | 30 +------------- esp32h2-hal/examples/i2c_display.rs | 15 ------- esp32h2-hal/examples/i2s_read.rs | 24 ------------ esp32h2-hal/examples/i2s_sound.rs | 22 ----------- esp32h2-hal/examples/interrupt_preemption.rs | 23 ----------- esp32h2-hal/examples/ledc.rs | 24 ------------ esp32h2-hal/examples/mcpwm.rs | 24 ------------ esp32h2-hal/examples/parl_io_tx.rs | 22 ----------- esp32h2-hal/examples/pcnt_encoder.rs | 26 +------------ esp32h2-hal/examples/qspi_flash.rs | 23 ----------- esp32h2-hal/examples/ram.rs | 19 +++------ esp32h2-hal/examples/read_efuse.rs | 33 ++-------------- esp32h2-hal/examples/rmt_rx.rs | 15 ------- esp32h2-hal/examples/rmt_tx.rs | 15 ------- esp32h2-hal/examples/rng.rs | 33 ++-------------- esp32h2-hal/examples/rsa.rs | 25 +----------- esp32h2-hal/examples/rtc_time.rs | 33 ++-------------- esp32h2-hal/examples/serial_interrupts.rs | 17 +------- esp32h2-hal/examples/sha.rs | 18 +-------- esp32h2-hal/examples/software_interrupts.rs | 26 +------------ .../examples/spi_eh1_device_loopback.rs | 24 ------------ esp32h2-hal/examples/spi_eh1_loopback.rs | 24 ------------ .../spi_halfduplex_read_manufacturer_id.rs | 23 ----------- esp32h2-hal/examples/spi_loopback.rs | 24 ------------ esp32h2-hal/examples/spi_loopback_dma.rs | 24 ------------ esp32h2-hal/examples/systimer.rs | 26 +------------ esp32h2-hal/examples/timer_interrupt.rs | 13 +------ esp32h2-hal/examples/usb_serial_jtag.rs | 15 ------- esp32s2-hal/examples/adc.rs | 17 +------- esp32s2-hal/examples/advanced_serial.rs | 14 ------- esp32s2-hal/examples/aes.rs | 23 +---------- esp32s2-hal/examples/blinky.rs | 24 +----------- esp32s2-hal/examples/blinky_erased_pins.rs | 16 +------- esp32s2-hal/examples/clock_monitor.rs | 4 -- esp32s2-hal/examples/crc.rs | 8 +--- esp32s2-hal/examples/dac.rs | 16 +------- esp32s2-hal/examples/embassy_hello_world.rs | 30 ++++---------- esp32s2-hal/examples/embassy_i2c.rs | 23 ++++------- esp32s2-hal/examples/embassy_multiprio.rs | 28 ++++--------- esp32s2-hal/examples/embassy_serial.rs | 30 ++++---------- esp32s2-hal/examples/embassy_spi.rs | 36 ++++------------- esp32s2-hal/examples/embassy_wait.rs | 30 ++++---------- esp32s2-hal/examples/gpio_interrupt.rs | 17 +------- esp32s2-hal/examples/hello_rgb.rs | 22 +---------- esp32s2-hal/examples/hello_world.rs | 8 +--- esp32s2-hal/examples/hmac.rs | 17 +------- .../examples/i2c_bmp180_calibration_data.rs | 22 +---------- esp32s2-hal/examples/i2c_display.rs | 7 ---- esp32s2-hal/examples/i2s_read.rs | 14 ------- esp32s2-hal/examples/i2s_sound.rs | 14 ------- esp32s2-hal/examples/ledc.rs | 14 ------- esp32s2-hal/examples/pcnt_encoder.rs | 15 +------ esp32s2-hal/examples/psram.rs | 21 +--------- esp32s2-hal/examples/qspi_flash.rs | 22 ----------- esp32s2-hal/examples/ram.rs | 10 ++--- esp32s2-hal/examples/read_efuse.rs | 24 ++---------- esp32s2-hal/examples/rmt_rx.rs | 10 ----- esp32s2-hal/examples/rmt_tx.rs | 10 ----- esp32s2-hal/examples/rng.rs | 25 ++---------- esp32s2-hal/examples/rsa.rs | 22 +---------- esp32s2-hal/examples/rtc_time.rs | 24 ++---------- esp32s2-hal/examples/serial_interrupts.rs | 16 -------- esp32s2-hal/examples/sha.rs | 16 +------- esp32s2-hal/examples/software_interrupts.rs | 16 +------- .../examples/spi_eh1_device_loopback.rs | 15 ------- esp32s2-hal/examples/spi_eh1_loopback.rs | 15 ------- .../spi_halfduplex_read_manufacturer_id.rs | 22 ----------- esp32s2-hal/examples/spi_loopback.rs | 15 ------- esp32s2-hal/examples/spi_loopback_dma.rs | 15 ------- esp32s2-hal/examples/systimer.rs | 16 +------- esp32s2-hal/examples/timer_interrupt.rs | 11 +----- esp32s2-hal/examples/ulp_riscv_core_basic.rs | 24 ++---------- esp32s2-hal/examples/usb_serial.rs | 16 +------- esp32s3-hal/examples/adc.rs | 16 +------- esp32s3-hal/examples/adc_cal.rs | 16 +------- esp32s3-hal/examples/advanced_serial.rs | 14 ------- esp32s3-hal/examples/aes.rs | 23 +---------- esp32s3-hal/examples/blinky.rs | 24 +----------- esp32s3-hal/examples/blinky_erased_pins.rs | 16 +------- esp32s3-hal/examples/clock_monitor.rs | 4 -- esp32s3-hal/examples/crc.rs | 8 +--- esp32s3-hal/examples/debug_assist.rs | 16 +------- esp32s3-hal/examples/embassy_hello_world.rs | 31 ++++----------- esp32s3-hal/examples/embassy_i2c.rs | 23 ++++------- esp32s3-hal/examples/embassy_multicore.rs | 28 ++++--------- .../examples/embassy_multicore_interrupt.rs | 28 ++++--------- esp32s3-hal/examples/embassy_multiprio.rs | 28 ++++--------- esp32s3-hal/examples/embassy_serial.rs | 31 ++++----------- esp32s3-hal/examples/embassy_spi.rs | 31 ++++----------- esp32s3-hal/examples/embassy_wait.rs | 31 ++++----------- esp32s3-hal/examples/gpio_interrupt.rs | 17 +------- esp32s3-hal/examples/hello_rgb.rs | 22 +---------- esp32s3-hal/examples/hello_world.rs | 8 +--- esp32s3-hal/examples/hmac.rs | 17 +------- .../examples/i2c_bmp180_calibration_data.rs | 22 +---------- esp32s3-hal/examples/i2c_display.rs | 7 ---- esp32s3-hal/examples/i2s_read.rs | 22 ----------- esp32s3-hal/examples/i2s_sound.rs | 22 ----------- esp32s3-hal/examples/ledc.rs | 14 ------- esp32s3-hal/examples/mcpwm.rs | 14 ------- esp32s3-hal/examples/multicore.rs | 10 ----- esp32s3-hal/examples/octal_psram.rs | 12 ------ esp32s3-hal/examples/pcnt_encoder.rs | 15 +------ esp32s3-hal/examples/psram.rs | 13 ------- esp32s3-hal/examples/qspi_flash.rs | 23 ----------- esp32s3-hal/examples/ram.rs | 10 ++--- esp32s3-hal/examples/read_efuse.rs | 24 ++---------- esp32s3-hal/examples/rmt_rx.rs | 10 ----- esp32s3-hal/examples/rmt_tx.rs | 18 +-------- esp32s3-hal/examples/rng.rs | 25 ++---------- esp32s3-hal/examples/rsa.rs | 22 +---------- esp32s3-hal/examples/rtc_time.rs | 24 ++---------- esp32s3-hal/examples/serial_interrupts.rs | 17 -------- esp32s3-hal/examples/sha.rs | 16 +------- esp32s3-hal/examples/sleep_timer.rs | 20 +--------- esp32s3-hal/examples/sleep_timer_ext0.rs | 20 +--------- esp32s3-hal/examples/sleep_timer_ext1.rs | 20 +--------- esp32s3-hal/examples/sleep_timer_rtcio.rs | 20 +--------- esp32s3-hal/examples/software_interrupts.rs | 16 +------- .../examples/spi_eh1_device_loopback.rs | 15 ------- esp32s3-hal/examples/spi_eh1_loopback.rs | 15 ------- .../spi_halfduplex_read_manufacturer_id.rs | 23 ----------- esp32s3-hal/examples/spi_loopback.rs | 15 ------- esp32s3-hal/examples/spi_loopback_dma.rs | 23 ----------- esp32s3-hal/examples/systimer.rs | 16 +------- esp32s3-hal/examples/timer_interrupt.rs | 11 ------ esp32s3-hal/examples/twai.rs | 22 +---------- esp32s3-hal/examples/ulp_riscv_core_basic.rs | 24 ++---------- esp32s3-hal/examples/usb_serial.rs | 16 +------- esp32s3-hal/examples/usb_serial_jtag.rs | 7 ---- 321 files changed, 531 insertions(+), 5992 deletions(-) diff --git a/esp32-hal/examples/adc.rs b/esp32-hal/examples/adc.rs index 78154a327..1a973997e 100644 --- a/esp32-hal/examples/adc.rs +++ b/esp32-hal/examples/adc.rs @@ -11,9 +11,7 @@ use esp32_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -21,21 +19,9 @@ 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create ADC instances diff --git a/esp32-hal/examples/advanced_serial.rs b/esp32-hal/examples/advanced_serial.rs index 1f070ed14..b2e5d2efa 100644 --- a/esp32-hal/examples/advanced_serial.rs +++ b/esp32-hal/examples/advanced_serial.rs @@ -15,13 +15,11 @@ use esp32_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, uart::{ config::{Config, DataBits, Parity, StopBits}, TxRxPins, }, Delay, - Rtc, Uart, }; use esp_backtrace as _; @@ -34,18 +32,6 @@ 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let config = Config { baudrate: 115200, data_bits: DataBits::DataBits8, diff --git a/esp32-hal/examples/aes.rs b/esp32-hal/examples/aes.rs index 7e7b82cf2..1cba19285 100644 --- a/esp32-hal/examples/aes.rs +++ b/esp32-hal/examples/aes.rs @@ -11,9 +11,7 @@ use esp32_hal::{ clock::ClockControl, peripherals::Peripherals, prelude::*, - timer::TimerGroup, xtensa_lx, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -22,26 +20,7 @@ use esp_println::println; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.DPORT.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the RTC and TIMG watchdog timers - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); diff --git a/esp32-hal/examples/blinky.rs b/esp32-hal/examples/blinky.rs index ead1014a8..3220189dc 100644 --- a/esp32-hal/examples/blinky.rs +++ b/esp32-hal/examples/blinky.rs @@ -6,35 +6,15 @@ #![no_std] #![no_main] -use esp32_hal::{ - clock::ClockControl, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*, Delay}; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - // Set GPIO2 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio2.into_push_pull_output(); diff --git a/esp32-hal/examples/blinky_erased_pins.rs b/esp32-hal/examples/blinky_erased_pins.rs index 788b74a48..04bae5f6e 100644 --- a/esp32-hal/examples/blinky_erased_pins.rs +++ b/esp32-hal/examples/blinky_erased_pins.rs @@ -10,30 +10,16 @@ use esp32_hal::{ gpio::{AnyPin, Input, Output, PullDown, PushPull, IO}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - // Set LED GPIOs as an output. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led1 = io.pins.gpio25.into_push_pull_output(); diff --git a/esp32-hal/examples/clock_monitor.rs b/esp32-hal/examples/clock_monitor.rs index 280d35c34..82bfc018e 100644 --- a/esp32-hal/examples/clock_monitor.rs +++ b/esp32-hal/examples/clock_monitor.rs @@ -26,10 +26,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - rtc.rwdt.disable(); - rtc.rwdt.start(2000u64.millis()); rtc.rwdt.listen(); diff --git a/esp32-hal/examples/crc.rs b/esp32-hal/examples/crc.rs index cd3df9188..3cb91db28 100644 --- a/esp32-hal/examples/crc.rs +++ b/esp32-hal/examples/crc.rs @@ -11,7 +11,6 @@ use esp32_hal::{ prelude::*, rom::{crc, md5}, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -29,13 +28,7 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); timer0.start(1u64.secs()); diff --git a/esp32-hal/examples/dac.rs b/esp32-hal/examples/dac.rs index 67beaced4..c2f2716ea 100644 --- a/esp32-hal/examples/dac.rs +++ b/esp32-hal/examples/dac.rs @@ -5,36 +5,15 @@ #![no_std] #![no_main] -use esp32_hal::{ - clock::ClockControl, - dac, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32_hal::{clock::ClockControl, dac, gpio::IO, peripherals::Peripherals, prelude::*, Delay}; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let pin25 = io.pins.gpio25.into_analog(); let pin26 = io.pins.gpio26.into_analog(); diff --git a/esp32-hal/examples/embassy_hello_world.rs b/esp32-hal/examples/embassy_hello_world.rs index f21b85f56..eead4980c 100644 --- a/esp32-hal/examples/embassy_hello_world.rs +++ b/esp32-hal/examples/embassy_hello_world.rs @@ -14,7 +14,6 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use static_cell::make_static; @@ -42,26 +41,11 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - - #[cfg(feature = "embassy-time-timg0")] 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 a9877efe3..d64ef98bc 100644 --- a/esp32-hal/examples/embassy_i2c.rs +++ b/esp32-hal/examples/embassy_i2c.rs @@ -23,7 +23,6 @@ use esp32_hal::{ peripherals::{Interrupt, Peripherals, I2C0}, prelude::*, timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -54,13 +53,6 @@ fn main() -> ! { &clocks, &mut system.peripheral_clock_control, ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timers - wdt.disable(); - rtc.rwdt.disable(); - embassy::init(&clocks, timer_group0.timer0); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32-hal/examples/embassy_multicore.rs b/esp32-hal/examples/embassy_multicore.rs index 9854dbddd..628e0a901 100644 --- a/esp32-hal/examples/embassy_multicore.rs +++ b/esp32-hal/examples/embassy_multicore.rs @@ -16,7 +16,6 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_hal_common::get_core; @@ -69,29 +68,16 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( + let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); - let mut timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable watchdog timers - rtc.rwdt.disable(); - timer_group0.wdt.disable(); - timer_group1.wdt.disable(); + embassy::init(&clocks, timer_group0.timer0); // Set GPIO2 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); - let mut cpu_control = CpuControl::new(system.cpu_control); let led_ctrl_signal = &*make_static!(Signal::new()); diff --git a/esp32-hal/examples/embassy_multicore_interrupt.rs b/esp32-hal/examples/embassy_multicore_interrupt.rs index e6ebfec02..a3d412e80 100644 --- a/esp32-hal/examples/embassy_multicore_interrupt.rs +++ b/esp32-hal/examples/embassy_multicore_interrupt.rs @@ -20,7 +20,6 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_hal_common::get_core; @@ -86,29 +85,16 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( + let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); - let mut timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable watchdog timers - rtc.rwdt.disable(); - timer_group0.wdt.disable(); - timer_group1.wdt.disable(); + embassy::init(&clocks, timer_group0.timer0); // Set GPIO2 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); - let mut cpu_control = CpuControl::new(system.cpu_control); let led_ctrl_signal = &*make_static!(Signal::new()); diff --git a/esp32-hal/examples/embassy_multiprio.rs b/esp32-hal/examples/embassy_multiprio.rs index 4439289a3..56457ba0d 100644 --- a/esp32-hal/examples/embassy_multiprio.rs +++ b/esp32-hal/examples/embassy_multiprio.rs @@ -19,7 +19,6 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_hal_common::get_core; @@ -86,29 +85,16 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( + let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); - let mut timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable watchdog timers - rtc.rwdt.disable(); - timer_group0.wdt.disable(); - timer_group1.wdt.disable(); + embassy::init(&clocks, timer_group0.timer0); // Set GPIO2 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); - let led = make_static!(io.pins.gpio0.into_push_pull_output()); let spawner = INT_EXECUTOR_0.start(Priority::Priority2); diff --git a/esp32-hal/examples/embassy_serial.rs b/esp32-hal/examples/embassy_serial.rs index 6cb6e74ef..b37698a10 100644 --- a/esp32-hal/examples/embassy_serial.rs +++ b/esp32-hal/examples/embassy_serial.rs @@ -17,7 +17,6 @@ use esp32_hal::{ peripherals::{Interrupt, Peripherals, UART0}, prelude::*, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -107,26 +106,11 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - - #[cfg(feature = "embassy-time-timg0")] embassy::init(&clocks, timer_group0.timer0); let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); diff --git a/esp32-hal/examples/embassy_spi.rs b/esp32-hal/examples/embassy_spi.rs index b1c965a79..e53d4092e 100644 --- a/esp32-hal/examples/embassy_spi.rs +++ b/esp32-hal/examples/embassy_spi.rs @@ -28,7 +28,6 @@ use esp32_hal::{ prelude::*, spi::{dma::SpiDma, FullDuplexMode, Spi, SpiMode}, timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -57,32 +56,11 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - - #[cfg(feature = "embassy-time-systick")] - embassy::init( - &clocks, - esp32_hal::systimer::SystemTimer::new(peripherals.SYSTIMER), - ); - - #[cfg(feature = "embassy-time-timg0")] embassy::init(&clocks, timer_group0.timer0); esp32_hal::interrupt::enable( diff --git a/esp32-hal/examples/embassy_wait.rs b/esp32-hal/examples/embassy_wait.rs index e10aedaea..4c161cb60 100644 --- a/esp32-hal/examples/embassy_wait.rs +++ b/esp32-hal/examples/embassy_wait.rs @@ -15,7 +15,6 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -38,26 +37,11 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - - #[cfg(feature = "embassy-time-timg0")] embassy::init(&clocks, timer_group0.timer0); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32-hal/examples/gpio_interrupt.rs b/esp32-hal/examples/gpio_interrupt.rs index 9866a2ebb..82e400c28 100644 --- a/esp32-hal/examples/gpio_interrupt.rs +++ b/esp32-hal/examples/gpio_interrupt.rs @@ -16,10 +16,8 @@ use esp32_hal::{ macros::ram, peripherals::{self, Peripherals}, prelude::*, - timer::TimerGroup, xtensa_lx, Delay, - Rtc, }; use esp_backtrace as _; @@ -28,22 +26,9 @@ static BUTTON: Mutex>>>> = Mutex::new(RefCe #[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 mut wdt = timer_group0.wdt; - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - // Set GPIO15 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio15.into_push_pull_output(); diff --git a/esp32-hal/examples/hello_rgb.rs b/esp32-hal/examples/hello_rgb.rs index 974f77b13..370393cd8 100644 --- a/esp32-hal/examples/hello_rgb.rs +++ b/esp32-hal/examples/hello_rgb.rs @@ -13,16 +13,7 @@ #![no_std] #![no_main] -use esp32_hal::{ - clock::ClockControl, - peripherals, - prelude::*, - rmt::Rmt, - timer::TimerGroup, - Delay, - Rtc, - IO, -}; +use esp32_hal::{clock::ClockControl, peripherals, prelude::*, rmt::Rmt, Delay, IO}; use esp_backtrace as _; use esp_hal_smartled::{smartLedAdapter, SmartLedsAdapter}; use smart_leds::{ @@ -38,17 +29,6 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - timer_group0.wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally diff --git a/esp32-hal/examples/hello_world.rs b/esp32-hal/examples/hello_world.rs index d33dd14f9..58bab1c16 100644 --- a/esp32-hal/examples/hello_world.rs +++ b/esp32-hal/examples/hello_world.rs @@ -11,7 +11,6 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -29,13 +28,7 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); 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 f1ddb3a45..304b0b52a 100644 --- a/esp32-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32-hal/examples/i2c_bmp180_calibration_data.rs @@ -9,15 +9,7 @@ #![no_std] #![no_main] -use esp32_hal::{ - clock::ClockControl, - gpio::IO, - i2c::I2C, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32_hal::{clock::ClockControl, gpio::IO, i2c::I2C, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; @@ -27,18 +19,6 @@ 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create a new peripheral object with the described wiring diff --git a/esp32-hal/examples/i2c_display.rs b/esp32-hal/examples/i2c_display.rs index 57d4523c6..35a45cf39 100644 --- a/esp32-hal/examples/i2c_display.rs +++ b/esp32-hal/examples/i2c_display.rs @@ -26,7 +26,6 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use nb::block; @@ -44,12 +43,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32-hal/examples/i2s_read.rs b/esp32-hal/examples/i2s_read.rs index 99e66d0b6..6c492b0e5 100644 --- a/esp32-hal/examples/i2s_read.rs +++ b/esp32-hal/examples/i2s_read.rs @@ -20,8 +20,6 @@ use esp32_hal::{ pdma::Dma, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -33,18 +31,6 @@ 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); diff --git a/esp32-hal/examples/i2s_sound.rs b/esp32-hal/examples/i2s_sound.rs index 96043932e..587e9997f 100644 --- a/esp32-hal/examples/i2s_sound.rs +++ b/esp32-hal/examples/i2s_sound.rs @@ -36,8 +36,6 @@ use esp32_hal::{ pdma::Dma, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -56,18 +54,6 @@ 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); diff --git a/esp32-hal/examples/ledc.rs b/esp32-hal/examples/ledc.rs index acf899bef..855b968dc 100644 --- a/esp32-hal/examples/ledc.rs +++ b/esp32-hal/examples/ledc.rs @@ -17,8 +17,6 @@ use esp32_hal::{ }, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -28,18 +26,6 @@ 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); diff --git a/esp32-hal/examples/mcpwm.rs b/esp32-hal/examples/mcpwm.rs index b3d134152..29ed611b2 100644 --- a/esp32-hal/examples/mcpwm.rs +++ b/esp32-hal/examples/mcpwm.rs @@ -12,8 +12,6 @@ use esp32_hal::{ mcpwm::{operator::PwmPinConfig, timer::PwmWorkingMode, PeripheralClockConfig, MCPWM}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -23,18 +21,6 @@ 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let pin = io.pins.gpio4; diff --git a/esp32-hal/examples/multicore.rs b/esp32-hal/examples/multicore.rs index 2f66f39e8..7ea460632 100644 --- a/esp32-hal/examples/multicore.rs +++ b/esp32-hal/examples/multicore.rs @@ -14,7 +14,6 @@ use esp32_hal::{ peripherals::{Peripherals, TIMG1}, prelude::*, timer::{Timer, Timer0, TimerGroup}, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -34,7 +33,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; let timer_group1 = TimerGroup::new( peripherals.TIMG1, @@ -42,14 +40,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer1 = timer_group1.timer0; - let mut wdt1 = timer_group1.wdt; - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt0.disable(); - wdt1.disable(); - rtc.rwdt.disable(); timer0.start(1u64.secs()); timer1.start(500u64.millis()); diff --git a/esp32-hal/examples/pcnt_encoder.rs b/esp32-hal/examples/pcnt_encoder.rs index c26cb8401..fc771b3dc 100644 --- a/esp32-hal/examples/pcnt_encoder.rs +++ b/esp32-hal/examples/pcnt_encoder.rs @@ -23,8 +23,6 @@ use esp_hal::{ pcnt::{channel, channel::PcntSource, unit, PCNT}, peripherals::{self, Peripherals}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_println::println; @@ -36,21 +34,10 @@ static VALUE: AtomicI32 = AtomicI32::new(0); fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.DPORT.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let unit_number = unit::Number::Unit1; // setup a pulse couter diff --git a/esp32-hal/examples/psram.rs b/esp32-hal/examples/psram.rs index 73bc1eea4..22faceca2 100644 --- a/esp32-hal/examples/psram.rs +++ b/esp32-hal/examples/psram.rs @@ -41,18 +41,6 @@ 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - println!("Going to access PSRAM"); let mut large_vec: alloc::vec::Vec = alloc::vec::Vec::with_capacity(500 * 1024 / 4); diff --git a/esp32-hal/examples/qspi_flash.rs b/esp32-hal/examples/qspi_flash.rs index c1327115c..e71918e3b 100644 --- a/esp32-hal/examples/qspi_flash.rs +++ b/esp32-hal/examples/qspi_flash.rs @@ -25,9 +25,7 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,26 +36,6 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32, this includes - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio19; let miso = io.pins.gpio18; diff --git a/esp32-hal/examples/ram.rs b/esp32-hal/examples/ram.rs index 9f0fcd73c..c54efdb46 100644 --- a/esp32-hal/examples/ram.rs +++ b/esp32-hal/examples/ram.rs @@ -14,6 +14,7 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, + Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -40,12 +41,11 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - // Disable MWDT flash boot protection - wdt.disable(); - // The RWDT flash boot protection remains enabled and it being triggered is part - // of the example + // The RWDT flash boot protection must be enabled, as it is triggered as part of + // the example. + let mut rtc = Rtc::new(peripherals.RTC_CNTL); + rtc.rwdt.enable(); timer0.start(1u64.secs()); diff --git a/esp32-hal/examples/read_efuse.rs b/esp32-hal/examples/read_efuse.rs index d221f986e..63b96c0b5 100644 --- a/esp32-hal/examples/read_efuse.rs +++ b/esp32-hal/examples/read_efuse.rs @@ -4,34 +4,15 @@ #![no_std] #![no_main] -use esp32_hal::{ - clock::ClockControl, - efuse::Efuse, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32_hal::{clock::ClockControl, efuse::Efuse, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let system = peripherals.DPORT.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); println!("MAC address {:02x?}", Efuse::get_mac_address()); println!("Core Count {}", Efuse::get_core_count()); diff --git a/esp32-hal/examples/rmt_rx.rs b/esp32-hal/examples/rmt_rx.rs index fcafce22c..ddc0275b2 100644 --- a/esp32-hal/examples/rmt_rx.rs +++ b/esp32-hal/examples/rmt_rx.rs @@ -10,10 +10,8 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, RxChannel, RxChannelConfig, RxChannelCreator}, - timer::TimerGroup, Delay, Rmt, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -25,14 +23,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut clock_control = system.peripheral_clock_control; - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut out = io.pins.gpio15.into_push_pull_output(); diff --git a/esp32-hal/examples/rmt_tx.rs b/esp32-hal/examples/rmt_tx.rs index 54a0b0f16..688a473a5 100644 --- a/esp32-hal/examples/rmt_tx.rs +++ b/esp32-hal/examples/rmt_tx.rs @@ -10,10 +10,8 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, TxChannel, TxChannelConfig, TxChannelCreator}, - timer::TimerGroup, Delay, Rmt, - Rtc, }; use esp_backtrace as _; @@ -24,14 +22,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut clock_control = system.peripheral_clock_control; - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let rmt = Rmt::new(peripherals.RMT, 80u32.MHz(), &mut clock_control, &clocks).unwrap(); diff --git a/esp32-hal/examples/rng.rs b/esp32-hal/examples/rng.rs index c4c7fa064..34244b764 100644 --- a/esp32-hal/examples/rng.rs +++ b/esp32-hal/examples/rng.rs @@ -3,34 +3,15 @@ #![no_std] #![no_main] -use esp32_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rng, - Rtc, -}; +use esp32_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Rng}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection: - wdt.disable(); - rtc.rwdt.disable(); + let system = peripherals.DPORT.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Instantiate the Random Number Generator peripheral: let mut rng = Rng::new(peripherals.RNG); diff --git a/esp32-hal/examples/rsa.rs b/esp32-hal/examples/rsa.rs index 59ca27e30..2d75a6862 100644 --- a/esp32-hal/examples/rsa.rs +++ b/esp32-hal/examples/rsa.rs @@ -22,9 +22,7 @@ use esp32_hal::{ RsaModularMultiplication, RsaMultiplication, }, - timer::TimerGroup, xtensa_lx, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -59,26 +57,7 @@ const fn compute_mprime(modulus: &U512) -> u32 { fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.DPORT.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the RTC and TIMG watchdog timers - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let rsa = peripherals.RSA; let mut rsa = Rsa::new(rsa, &mut system.peripheral_clock_control); diff --git a/esp32-hal/examples/rtc_time.rs b/esp32-hal/examples/rtc_time.rs index 471bda7db..234415a17 100644 --- a/esp32-hal/examples/rtc_time.rs +++ b/esp32-hal/examples/rtc_time.rs @@ -3,33 +3,16 @@ #![no_std] #![no_main] -use esp32_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay, Rtc}; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let rtc = Rtc::new(peripherals.RTC_CNTL); let mut delay = Delay::new(&clocks); diff --git a/esp32-hal/examples/serial_interrupts.rs b/esp32-hal/examples/serial_interrupts.rs index 926143937..2a5222165 100644 --- a/esp32-hal/examples/serial_interrupts.rs +++ b/esp32-hal/examples/serial_interrupts.rs @@ -15,7 +15,6 @@ use esp32_hal::{ prelude::*, timer::TimerGroup, uart::config::AtCmdConfig, - Rtc, Uart, }; use esp_backtrace as _; @@ -29,30 +28,14 @@ fn main() -> ! { let mut system = peripherals.DPORT.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 mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt0.disable(); - wdt1.disable(); - rtc.rwdt.disable(); - serial0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); serial0.set_rx_fifo_full_threshold(30).unwrap(); serial0.listen_at_cmd(); diff --git a/esp32-hal/examples/sha.rs b/esp32-hal/examples/sha.rs index df40c4c4b..c689ddcbb 100644 --- a/esp32-hal/examples/sha.rs +++ b/esp32-hal/examples/sha.rs @@ -9,9 +9,7 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, sha::{Sha, ShaMode}, - timer::TimerGroup, xtensa_lx, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -22,19 +20,7 @@ use sha2::{Digest, Sha512}; fn main() -> ! { let peripherals = Peripherals::take(); 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); let mut remaining = source_data.clone(); diff --git a/esp32-hal/examples/sleep_timer.rs b/esp32-hal/examples/sleep_timer.rs index 44a5be340..dae4b46f4 100644 --- a/esp32-hal/examples/sleep_timer.rs +++ b/esp32-hal/examples/sleep_timer.rs @@ -14,7 +14,6 @@ use hal::{ peripherals::Peripherals, prelude::*, rtc_cntl::{get_reset_reason, get_wakeup_cause, sleep::TimerWakeupSource, SocResetReason}, - timer::TimerGroup, Delay, Rtc, }; @@ -22,27 +21,10 @@ use hal::{ #[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(); - // Disable the RTC and TIMG watchdog timers let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); println!("up and runnning!"); let reason = get_reset_reason(hal::Cpu::ProCpu).unwrap_or(SocResetReason::ChipPowerOn); diff --git a/esp32-hal/examples/sleep_timer_ext0.rs b/esp32-hal/examples/sleep_timer_ext0.rs index 0260de33c..f400bd5c5 100644 --- a/esp32-hal/examples/sleep_timer_ext0.rs +++ b/esp32-hal/examples/sleep_timer_ext0.rs @@ -19,7 +19,6 @@ use hal::{ sleep::{Ext0WakeupSource, TimerWakeupSource, WakeupLevel}, SocResetReason, }, - timer::TimerGroup, Delay, Rtc, IO, @@ -28,27 +27,10 @@ use hal::{ #[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(); - // Disable the RTC and TIMG watchdog timers let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut ext0_pin = io.pins.gpio27; diff --git a/esp32-hal/examples/sleep_timer_ext1.rs b/esp32-hal/examples/sleep_timer_ext1.rs index 5716d9a55..fb18cff30 100644 --- a/esp32-hal/examples/sleep_timer_ext1.rs +++ b/esp32-hal/examples/sleep_timer_ext1.rs @@ -19,7 +19,6 @@ use hal::{ sleep::{Ext1WakeupSource, TimerWakeupSource, WakeupLevel}, SocResetReason, }, - timer::TimerGroup, Delay, Rtc, IO, @@ -28,27 +27,10 @@ use hal::{ #[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(); - // Disable the RTC and TIMG watchdog timers let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut pin27 = io.pins.gpio27; diff --git a/esp32-hal/examples/software_interrupts.rs b/esp32-hal/examples/software_interrupts.rs index 0d208e5e6..006486365 100644 --- a/esp32-hal/examples/software_interrupts.rs +++ b/esp32-hal/examples/software_interrupts.rs @@ -16,9 +16,7 @@ use esp32_hal::{ peripherals::{self, Peripherals}, prelude::*, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -27,22 +25,10 @@ static SWINT: Mutex>> = Mutex::new(RefC #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.DPORT.split(); + let system = peripherals.DPORT.split(); let sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32-hal/examples/spi_eh1_device_loopback.rs b/esp32-hal/examples/spi_eh1_device_loopback.rs index a420e7107..ecc014287 100644 --- a/esp32-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32-hal/examples/spi_eh1_device_loopback.rs @@ -25,9 +25,7 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiBusController, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,19 +36,6 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32 this includes the RTC WDT and the - // TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio19; let miso = io.pins.gpio25; diff --git a/esp32-hal/examples/spi_eh1_loopback.rs b/esp32-hal/examples/spi_eh1_loopback.rs index efdb5c5d1..a735473e2 100644 --- a/esp32-hal/examples/spi_eh1_loopback.rs +++ b/esp32-hal/examples/spi_eh1_loopback.rs @@ -23,9 +23,7 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -36,19 +34,6 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32 this includes the RTC WDT and the - // TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio19; let miso = io.pins.gpio25; diff --git a/esp32-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32-hal/examples/spi_halfduplex_read_manufacturer_id.rs index 318a25fe8..f1e381009 100644 --- a/esp32-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -23,9 +23,7 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, HalfDuplexReadWrite, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -36,26 +34,6 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32, this includes - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio19; let miso = io.pins.gpio18; diff --git a/esp32-hal/examples/spi_loopback.rs b/esp32-hal/examples/spi_loopback.rs index c374e9fdf..754bef6a5 100644 --- a/esp32-hal/examples/spi_loopback.rs +++ b/esp32-hal/examples/spi_loopback.rs @@ -22,9 +22,7 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -35,19 +33,6 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32 this includes the RTC WDT and the - // TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio19; let miso = io.pins.gpio25; diff --git a/esp32-hal/examples/spi_loopback_dma.rs b/esp32-hal/examples/spi_loopback_dma.rs index 8f0a4549f..09c7f97e6 100644 --- a/esp32-hal/examples/spi_loopback_dma.rs +++ b/esp32-hal/examples/spi_loopback_dma.rs @@ -24,9 +24,7 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -37,19 +35,6 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32 this includes - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio19; let miso = io.pins.gpio25; diff --git a/esp32-hal/examples/timer_interrupt.rs b/esp32-hal/examples/timer_interrupt.rs index b63c96ba5..9f56e4508 100644 --- a/esp32-hal/examples/timer_interrupt.rs +++ b/esp32-hal/examples/timer_interrupt.rs @@ -15,7 +15,6 @@ use esp32_hal::{ peripherals::{self, Peripherals, TIMG0, TIMG1}, prelude::*, timer::{Timer, Timer0, Timer1, TimerGroup}, - Rtc, }; use esp_backtrace as _; @@ -30,7 +29,6 @@ fn main() -> ! { let mut system = peripherals.DPORT.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the TIMG watchdog timer. let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, @@ -38,7 +36,6 @@ fn main() -> ! { ); let mut timer00 = timer_group0.timer0; let mut timer01 = timer_group0.timer1; - let mut wdt0 = timer_group0.wdt; let timer_group1 = TimerGroup::new( peripherals.TIMG1, @@ -47,19 +44,12 @@ fn main() -> ! { ); let mut timer10 = timer_group1.timer0; let mut timer11 = timer_group1.timer1; - let mut wdt1 = timer_group1.wdt; - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt0.disable(); - wdt1.disable(); - rtc.rwdt.disable(); interrupt::enable(peripherals::Interrupt::TG0_T0_LEVEL, Priority::Priority2).unwrap(); interrupt::enable(peripherals::Interrupt::TG0_T1_LEVEL, Priority::Priority2).unwrap(); interrupt::enable(peripherals::Interrupt::TG1_T0_LEVEL, Priority::Priority3).unwrap(); interrupt::enable(peripherals::Interrupt::TG1_T1_LEVEL, Priority::Priority3).unwrap(); + timer00.start(500u64.millis()); timer00.listen(); timer01.start(2500u64.millis()); diff --git a/esp32c2-hal/examples/adc.rs b/esp32c2-hal/examples/adc.rs index 6a07f74bb..083ae86fc 100644 --- a/esp32c2-hal/examples/adc.rs +++ b/esp32c2-hal/examples/adc.rs @@ -11,9 +11,7 @@ use esp32c2_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -24,20 +22,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create ADC instances diff --git a/esp32c2-hal/examples/adc_cal.rs b/esp32c2-hal/examples/adc_cal.rs index dce2d67b8..8a0a17ed9 100644 --- a/esp32c2-hal/examples/adc_cal.rs +++ b/esp32c2-hal/examples/adc_cal.rs @@ -12,9 +12,7 @@ use esp32c2_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -25,20 +23,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create ADC instances diff --git a/esp32c2-hal/examples/advanced_serial.rs b/esp32c2-hal/examples/advanced_serial.rs index 2e07d072e..ac99c23f9 100644 --- a/esp32c2-hal/examples/advanced_serial.rs +++ b/esp32c2-hal/examples/advanced_serial.rs @@ -19,7 +19,6 @@ use esp32c2_hal::{ config::{Config, DataBits, Parity, StopBits}, TxRxPins, }, - Rtc, Uart, IO, }; @@ -33,19 +32,12 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); let config = Config { baudrate: 115200, diff --git a/esp32c2-hal/examples/blinky.rs b/esp32c2-hal/examples/blinky.rs index 784d903d2..c3ba7e715 100644 --- a/esp32c2-hal/examples/blinky.rs +++ b/esp32c2-hal/examples/blinky.rs @@ -5,37 +5,15 @@ #![no_std] #![no_main] -use esp32c2_hal::{ - clock::ClockControl, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32c2_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*, Delay}; 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(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - // Set GPIO5 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio5.into_push_pull_output(); diff --git a/esp32c2-hal/examples/blinky_erased_pins.rs b/esp32c2-hal/examples/blinky_erased_pins.rs index 85ad9f82b..27bde11d5 100644 --- a/esp32c2-hal/examples/blinky_erased_pins.rs +++ b/esp32c2-hal/examples/blinky_erased_pins.rs @@ -10,32 +10,16 @@ use esp32c2_hal::{ gpio::{AnyPin, Input, Output, PullDown, PushPull, IO}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; 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(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDT. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - // Set LED GPIOs as an output. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led1 = io.pins.gpio3.into_push_pull_output(); diff --git a/esp32c2-hal/examples/clock_monitor.rs b/esp32c2-hal/examples/clock_monitor.rs index 80b01a18e..87b7706db 100644 --- a/esp32c2-hal/examples/clock_monitor.rs +++ b/esp32c2-hal/examples/clock_monitor.rs @@ -27,11 +27,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - rtc.rwdt.start(2000u64.millis()); rtc.rwdt.listen(); diff --git a/esp32c2-hal/examples/crc.rs b/esp32c2-hal/examples/crc.rs index 0521d487f..1a50ea96c 100644 --- a/esp32c2-hal/examples/crc.rs +++ b/esp32c2-hal/examples/crc.rs @@ -11,7 +11,6 @@ use esp32c2_hal::{ prelude::*, rom::{crc, md5}, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -23,28 +22,20 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); + let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - timer0.start(1u64.secs()); let data = "123456789"; let sentence = "The quick brown fox jumps over a lazy dog"; writeln!( - serial0, + uart0, "Performing CRC calculations on test string \"{data}\"" ) .unwrap(); @@ -89,7 +80,7 @@ fn main() -> ! { ); writeln!( - serial0, + uart0, "{:08x} {:08x} {:08x} {:08x} {:04x} {:04x} {:02x} {:02x} {}", crc_hdlc, crc_bzip2, diff --git a/esp32c2-hal/examples/debug_assist.rs b/esp32c2-hal/examples/debug_assist.rs index 0f55f9185..b38637f2e 100644 --- a/esp32c2-hal/examples/debug_assist.rs +++ b/esp32c2-hal/examples/debug_assist.rs @@ -13,8 +13,6 @@ use esp32c2_hal::{ peripherals::{self, Peripherals}, prelude::*, riscv, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -25,20 +23,7 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut da = DebugAssist::new( peripherals.ASSIST_DEBUG, diff --git a/esp32c2-hal/examples/direct-vectoring.rs b/esp32c2-hal/examples/direct-vectoring.rs index d3bb36bcb..b5aacf6f5 100644 --- a/esp32c2-hal/examples/direct-vectoring.rs +++ b/esp32c2-hal/examples/direct-vectoring.rs @@ -9,8 +9,6 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -23,19 +21,6 @@ unsafe fn main() -> ! { let sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(clockctrl).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); unsafe { asm!( diff --git a/esp32c2-hal/examples/embassy_hello_world.rs b/esp32c2-hal/examples/embassy_hello_world.rs index 33c279088..d8c196df2 100644 --- a/esp32c2-hal/examples/embassy_hello_world.rs +++ b/esp32c2-hal/examples/embassy_hello_world.rs @@ -9,14 +9,7 @@ use embassy_executor::Executor; use embassy_time::{Duration, Timer}; -use esp32c2_hal::{ - clock::ClockControl, - embassy, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32c2_hal::{clock::ClockControl, embassy, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use static_cell::make_static; @@ -43,19 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -63,7 +43,15 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + embassy::init( + &clocks, + esp32c2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ) + .timer0, + ); let executor = make_static!(Executor::new()); executor.run(|spawner| { diff --git a/esp32c2-hal/examples/embassy_i2c.rs b/esp32c2-hal/examples/embassy_i2c.rs index ee1c21804..ae4b62408 100644 --- a/esp32c2-hal/examples/embassy_i2c.rs +++ b/esp32c2-hal/examples/embassy_i2c.rs @@ -23,8 +23,6 @@ use esp32c2_hal::{ interrupt, peripherals::{Interrupt, Peripherals, I2C0}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -50,19 +48,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -70,7 +55,15 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + embassy::init( + &clocks, + esp32c2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ) + .timer0, + ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32c2-hal/examples/embassy_serial.rs b/esp32c2-hal/examples/embassy_serial.rs index c3c444ce6..bfba40c30 100644 --- a/esp32c2-hal/examples/embassy_serial.rs +++ b/esp32c2-hal/examples/embassy_serial.rs @@ -17,8 +17,6 @@ use esp32c2_hal::{ interrupt, peripherals::{Interrupt, Peripherals, UART0}, prelude::*, - timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -28,7 +26,7 @@ use static_cell::make_static; // rx_fifo_full_threshold const READ_BUF_SIZE: usize = 64; -/// EOT; CTRL-D +// EOT (CTRL-D) const AT_CMD: u8 = 0x04; #[embassy_executor::task] @@ -108,19 +106,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -128,7 +113,15 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + embassy::init( + &clocks, + esp32c2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ) + .timer0, + ); let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); diff --git a/esp32c2-hal/examples/embassy_spi.rs b/esp32c2-hal/examples/embassy_spi.rs index 5adf63ae5..f557030a0 100644 --- a/esp32c2-hal/examples/embassy_spi.rs +++ b/esp32c2-hal/examples/embassy_spi.rs @@ -28,8 +28,6 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, spi::{dma::SpiDma, FullDuplexMode, Spi, SpiMode}, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -59,19 +57,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -79,7 +64,15 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + embassy::init( + &clocks, + esp32c2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ) + .timer0, + ); esp32c2_hal::interrupt::enable( esp32c2_hal::peripherals::Interrupt::DMA_CH0, diff --git a/esp32c2-hal/examples/embassy_wait.rs b/esp32c2-hal/examples/embassy_wait.rs index c1f096a0a..59c5baf6f 100644 --- a/esp32c2-hal/examples/embassy_wait.rs +++ b/esp32c2-hal/examples/embassy_wait.rs @@ -15,8 +15,6 @@ use esp32c2_hal::{ gpio::{Gpio9, Input, PullDown}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -39,18 +37,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -58,7 +44,15 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + embassy::init( + &clocks, + esp32c2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ) + .timer0, + ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // GPIO 9 as input diff --git a/esp32c2-hal/examples/gpio_interrupt.rs b/esp32c2-hal/examples/gpio_interrupt.rs index 1b72d9547..fea04ac8f 100644 --- a/esp32c2-hal/examples/gpio_interrupt.rs +++ b/esp32c2-hal/examples/gpio_interrupt.rs @@ -16,9 +16,7 @@ use esp32c2_hal::{ peripherals::{self, Peripherals}, prelude::*, riscv, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -27,23 +25,9 @@ static BUTTON: Mutex>>>> = Mutex::new(RefCe #[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 watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - // Set GPIO5 as an output let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio5.into_push_pull_output(); diff --git a/esp32c2-hal/examples/hello_world.rs b/esp32c2-hal/examples/hello_world.rs index 7ae9d0cce..3b86fcec6 100644 --- a/esp32c2-hal/examples/hello_world.rs +++ b/esp32c2-hal/examples/hello_world.rs @@ -1,4 +1,4 @@ -//! This shows how to write text to serial0. +//! This shows how to write text to uart0. //! You can see the output with `espflash` if you provide the `--monitor` option #![no_std] @@ -11,7 +11,6 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -23,25 +22,18 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); + let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); timer0.start(1u64.secs()); loop { - writeln!(serial0, "Hello world!").unwrap(); + writeln!(uart0, "Hello world!").unwrap(); block!(timer0.wait()).unwrap(); } } diff --git a/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs b/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs index 493ae8b5f..5d3a3c064 100644 --- a/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs @@ -9,15 +9,7 @@ #![no_std] #![no_main] -use esp32c2_hal::{ - clock::ClockControl, - gpio::IO, - i2c::I2C, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32c2_hal::{clock::ClockControl, gpio::IO, i2c::I2C, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; @@ -27,19 +19,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create a new peripheral object with the described wiring diff --git a/esp32c2-hal/examples/i2c_display.rs b/esp32c2-hal/examples/i2c_display.rs index 34bcede0f..477245a29 100644 --- a/esp32c2-hal/examples/i2c_display.rs +++ b/esp32c2-hal/examples/i2c_display.rs @@ -26,7 +26,6 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use nb::block; @@ -38,19 +37,12 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32c2-hal/examples/interrupt_preemption.rs b/esp32c2-hal/examples/interrupt_preemption.rs index 81c558192..69377b30f 100644 --- a/esp32c2-hal/examples/interrupt_preemption.rs +++ b/esp32c2-hal/examples/interrupt_preemption.rs @@ -32,19 +32,6 @@ fn main() -> ! { let sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(clockctrl).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32c2-hal/examples/ledc.rs b/esp32c2-hal/examples/ledc.rs index 2f41d995e..1e34a7f16 100644 --- a/esp32c2-hal/examples/ledc.rs +++ b/esp32c2-hal/examples/ledc.rs @@ -1,5 +1,5 @@ //! Turns on LED with the option to change LED intensity depending on `duty` -//! value. Possible values (`u32`) are in range 0..100. +//! value, then fades it. Possible starting values (`u32`) are in range 0..100. //! //! This assumes that a LED is connected to the pin assigned to `led`. (GPIO4) @@ -18,8 +18,6 @@ use esp32c2_hal::{ }, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -29,19 +27,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); @@ -65,7 +50,7 @@ fn main() -> ! { channel0 .configure(channel::config::Config { timer: &lstimer0, - duty_pct: 90, + duty_pct: 10, pin_config: channel::config::PinConfig::PushPull, }) .unwrap(); diff --git a/esp32c2-hal/examples/qspi_flash.rs b/esp32c2-hal/examples/qspi_flash.rs index 3140a0fba..70005fe53 100644 --- a/esp32c2-hal/examples/qspi_flash.rs +++ b/esp32c2-hal/examples/qspi_flash.rs @@ -25,9 +25,7 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,20 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio4; let miso = io.pins.gpio5; diff --git a/esp32c2-hal/examples/read_efuse.rs b/esp32c2-hal/examples/read_efuse.rs index 0ff8ac95a..22d26ac4b 100644 --- a/esp32c2-hal/examples/read_efuse.rs +++ b/esp32c2-hal/examples/read_efuse.rs @@ -4,35 +4,15 @@ #![no_std] #![no_main] -use esp32c2_hal::{ - clock::ClockControl, - efuse::Efuse, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32c2_hal::{clock::ClockControl, efuse::Efuse, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); + let system = peripherals.SYSTEM.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); println!("MAC address {:02x?}", Efuse::get_mac_address()); println!("Flash Encryption {:?}", Efuse::get_flash_encryption()); diff --git a/esp32c2-hal/examples/rng.rs b/esp32c2-hal/examples/rng.rs index 88c51f4e9..ef9d6faa7 100644 --- a/esp32c2-hal/examples/rng.rs +++ b/esp32c2-hal/examples/rng.rs @@ -3,35 +3,15 @@ #![no_std] #![no_main] -use esp32c2_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rng, - Rtc, -}; +use esp32c2_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Rng}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers: - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); + let system = peripherals.SYSTEM.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Instantiate the Random Number Generator peripheral: let mut rng = Rng::new(peripherals.RNG); diff --git a/esp32c2-hal/examples/rtc_time.rs b/esp32c2-hal/examples/rtc_time.rs index 38f4f4a3c..f45eb287c 100644 --- a/esp32c2-hal/examples/rtc_time.rs +++ b/esp32c2-hal/examples/rtc_time.rs @@ -3,36 +3,16 @@ #![no_std] #![no_main] -use esp32c2_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32c2_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay, Rtc}; 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(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - + let rtc = Rtc::new(peripherals.RTC_CNTL); let mut delay = Delay::new(&clocks); loop { diff --git a/esp32c2-hal/examples/serial_interrupts.rs b/esp32c2-hal/examples/serial_interrupts.rs index 9f691e890..c38092551 100644 --- a/esp32c2-hal/examples/serial_interrupts.rs +++ b/esp32c2-hal/examples/serial_interrupts.rs @@ -17,7 +17,6 @@ use esp32c2_hal::{ timer::TimerGroup, uart::config::AtCmdConfig, Cpu, - Rtc, Uart, }; use esp_backtrace as _; @@ -31,7 +30,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); let timer_group0 = TimerGroup::new( peripherals.TIMG0, @@ -39,12 +37,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); serial0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); serial0.set_rx_fifo_full_threshold(30).unwrap(); diff --git a/esp32c2-hal/examples/sha.rs b/esp32c2-hal/examples/sha.rs index 0dcbdf2f1..27b0fc88b 100644 --- a/esp32c2-hal/examples/sha.rs +++ b/esp32c2-hal/examples/sha.rs @@ -9,8 +9,6 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, sha::{Sha, ShaMode}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -21,23 +19,10 @@ use sha2::{Digest, Sha256}; fn main() -> ! { let peripherals = Peripherals::take(); let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.swd.disable(); - rtc.rwdt.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); - let mut remaining = source_data.clone(); + let mut remaining = source_data; let mut hasher = Sha::new( peripherals.SHA, ShaMode::SHA256, diff --git a/esp32c2-hal/examples/software_interrupts.rs b/esp32c2-hal/examples/software_interrupts.rs index 3b026c845..10ed27cc7 100644 --- a/esp32c2-hal/examples/software_interrupts.rs +++ b/esp32c2-hal/examples/software_interrupts.rs @@ -17,9 +17,7 @@ use esp32c2_hal::{ prelude::*, riscv, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -28,24 +26,11 @@ 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 mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32c2-hal/examples/spi_eh1_device_loopback.rs b/esp32c2-hal/examples/spi_eh1_device_loopback.rs index 84b0283d9..1c0dc2e65 100644 --- a/esp32c2-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32c2-hal/examples/spi_eh1_device_loopback.rs @@ -25,9 +25,7 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiBusController, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,20 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c2-hal/examples/spi_eh1_loopback.rs b/esp32c2-hal/examples/spi_eh1_loopback.rs index b3c419fd8..9dd96774d 100644 --- a/esp32c2-hal/examples/spi_eh1_loopback.rs +++ b/esp32c2-hal/examples/spi_eh1_loopback.rs @@ -23,9 +23,7 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -36,20 +34,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c2-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32c2-hal/examples/spi_halfduplex_read_manufacturer_id.rs index 97a2a8ffd..66cb2292e 100644 --- a/esp32c2-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32c2-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -23,9 +23,7 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, HalfDuplexReadWrite, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -36,20 +34,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio4; let miso = io.pins.gpio5; diff --git a/esp32c2-hal/examples/spi_loopback.rs b/esp32c2-hal/examples/spi_loopback.rs index 5f67a123d..989b52a2e 100644 --- a/esp32c2-hal/examples/spi_loopback.rs +++ b/esp32c2-hal/examples/spi_loopback.rs @@ -22,9 +22,7 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -35,20 +33,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c2-hal/examples/spi_loopback_dma.rs b/esp32c2-hal/examples/spi_loopback_dma.rs index 06bcff6e0..e16cb12ae 100644 --- a/esp32c2-hal/examples/spi_loopback_dma.rs +++ b/esp32c2-hal/examples/spi_loopback_dma.rs @@ -24,9 +24,7 @@ use esp32c2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -37,20 +35,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDT. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c2-hal/examples/systimer.rs b/esp32c2-hal/examples/systimer.rs index 4e9fef36b..2117dfc18 100644 --- a/esp32c2-hal/examples/systimer.rs +++ b/esp32c2-hal/examples/systimer.rs @@ -14,9 +14,7 @@ use esp32c2_hal::{ peripherals::{self, Peripherals}, prelude::*, systimer::{Alarm, Periodic, SystemTimer, Target}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -28,22 +26,9 @@ static ALARM2: Mutex>>> = Mutex::new(RefCell::ne #[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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.swd.disable(); - rtc.rwdt.disable(); - let syst = SystemTimer::new(peripherals.SYSTIMER); println!("SYSTIMER Current value = {}", SystemTimer::now()); diff --git a/esp32c2-hal/examples/timer_interrupt.rs b/esp32c2-hal/examples/timer_interrupt.rs index ba72e6671..97361dfd6 100644 --- a/esp32c2-hal/examples/timer_interrupt.rs +++ b/esp32c2-hal/examples/timer_interrupt.rs @@ -14,7 +14,6 @@ use esp32c2_hal::{ prelude::*, riscv, timer::{Timer, Timer0, TimerGroup}, - Rtc, }; use esp_backtrace as _; @@ -26,20 +25,12 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDT. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); interrupt::enable( peripherals::Interrupt::TG0_T0_LEVEL, diff --git a/esp32c3-hal/examples/adc.rs b/esp32c3-hal/examples/adc.rs index d836d8d59..b49616c82 100644 --- a/esp32c3-hal/examples/adc.rs +++ b/esp32c3-hal/examples/adc.rs @@ -11,9 +11,7 @@ use esp32c3_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -24,27 +22,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create ADC instances diff --git a/esp32c3-hal/examples/adc_cal.rs b/esp32c3-hal/examples/adc_cal.rs index 223f241de..7b4337f5b 100644 --- a/esp32c3-hal/examples/adc_cal.rs +++ b/esp32c3-hal/examples/adc_cal.rs @@ -12,9 +12,7 @@ use esp32c3_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -25,27 +23,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create ADC instances diff --git a/esp32c3-hal/examples/advanced_serial.rs b/esp32c3-hal/examples/advanced_serial.rs index 6a76025ab..ab0f392b1 100644 --- a/esp32c3-hal/examples/advanced_serial.rs +++ b/esp32c3-hal/examples/advanced_serial.rs @@ -19,7 +19,6 @@ use esp32c3_hal::{ config::{Config, DataBits, Parity, StopBits}, TxRxPins, }, - Rtc, Uart, IO, }; @@ -33,26 +32,12 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let config = Config { baudrate: 115200, diff --git a/esp32c3-hal/examples/aes.rs b/esp32c3-hal/examples/aes.rs index 4387cfd08..2f10481b2 100644 --- a/esp32c3-hal/examples/aes.rs +++ b/esp32c3-hal/examples/aes.rs @@ -12,8 +12,6 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, systimer::SystemTimer, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -22,27 +20,7 @@ use esp_println::println; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the RTC and TIMG watchdog timers - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); diff --git a/esp32c3-hal/examples/blinky.rs b/esp32c3-hal/examples/blinky.rs index 04241fb71..79d7d48bb 100644 --- a/esp32c3-hal/examples/blinky.rs +++ b/esp32c3-hal/examples/blinky.rs @@ -5,44 +5,15 @@ #![no_std] #![no_main] -use esp32c3_hal::{ - clock::ClockControl, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32c3_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*, Delay}; 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(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - // Set GPIO5 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio5.into_push_pull_output(); diff --git a/esp32c3-hal/examples/blinky_erased_pins.rs b/esp32c3-hal/examples/blinky_erased_pins.rs index d796528c9..2c926800d 100644 --- a/esp32c3-hal/examples/blinky_erased_pins.rs +++ b/esp32c3-hal/examples/blinky_erased_pins.rs @@ -10,39 +10,16 @@ use esp32c3_hal::{ gpio::{AnyPin, Input, Output, PullDown, PushPull, IO}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; 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(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - // Set LED GPIOs as an output. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led1 = io.pins.gpio3.into_push_pull_output(); diff --git a/esp32c3-hal/examples/clock_monitor.rs b/esp32c3-hal/examples/clock_monitor.rs index 2293e4861..c5a0c081e 100644 --- a/esp32c3-hal/examples/clock_monitor.rs +++ b/esp32c3-hal/examples/clock_monitor.rs @@ -27,11 +27,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - rtc.rwdt.start(2000u64.millis()); rtc.rwdt.listen(); diff --git a/esp32c3-hal/examples/crc.rs b/esp32c3-hal/examples/crc.rs index 5d92adc7d..a41715469 100644 --- a/esp32c3-hal/examples/crc.rs +++ b/esp32c3-hal/examples/crc.rs @@ -11,7 +11,6 @@ use esp32c3_hal::{ prelude::*, rom::{crc, md5}, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -23,7 +22,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); let timer_group0 = TimerGroup::new( peripherals.TIMG0, @@ -31,20 +29,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - timer0.start(1u64.secs()); let data = "123456789"; diff --git a/esp32c3-hal/examples/debug_assist.rs b/esp32c3-hal/examples/debug_assist.rs index f7f8afece..fa4da84e1 100644 --- a/esp32c3-hal/examples/debug_assist.rs +++ b/esp32c3-hal/examples/debug_assist.rs @@ -15,8 +15,6 @@ use esp32c3_hal::{ peripherals::{self, Peripherals}, prelude::*, riscv, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -27,27 +25,7 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _ = ClockControl::boot_defaults(system.clock_control).freeze(); let mut da = DebugAssist::new( peripherals.ASSIST_DEBUG, diff --git a/esp32c3-hal/examples/direct-vectoring.rs b/esp32c3-hal/examples/direct-vectoring.rs index 05d6c6806..0170b9c69 100644 --- a/esp32c3-hal/examples/direct-vectoring.rs +++ b/esp32c3-hal/examples/direct-vectoring.rs @@ -13,8 +13,6 @@ use esp32c3_hal::{ peripherals::{self, Peripherals}, prelude::*, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -27,27 +25,6 @@ unsafe fn main() -> ! { let sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(clockctrl).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( peripherals::Interrupt::FROM_CPU_INTR0, diff --git a/esp32c3-hal/examples/embassy_hello_world.rs b/esp32c3-hal/examples/embassy_hello_world.rs index 79b1b69f8..1cdf38fb3 100644 --- a/esp32c3-hal/examples/embassy_hello_world.rs +++ b/esp32c3-hal/examples/embassy_hello_world.rs @@ -9,14 +9,7 @@ use embassy_executor::Executor; use embassy_time::{Duration, Timer}; -use esp32c3_hal::{ - clock::ClockControl, - embassy, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32c3_hal::{clock::ClockControl, embassy, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use static_cell::make_static; @@ -43,26 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -70,7 +43,15 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + embassy::init( + &clocks, + esp32c3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ) + .timer0, + ); let executor = make_static!(Executor::new()); executor.run(|spawner| { diff --git a/esp32c3-hal/examples/embassy_i2c.rs b/esp32c3-hal/examples/embassy_i2c.rs index 61d5aa3f2..4304cae4f 100644 --- a/esp32c3-hal/examples/embassy_i2c.rs +++ b/esp32c3-hal/examples/embassy_i2c.rs @@ -23,8 +23,6 @@ use esp32c3_hal::{ interrupt, peripherals::{Interrupt, Peripherals, I2C0}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -50,26 +48,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -77,7 +55,15 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + embassy::init( + &clocks, + esp32c3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ) + .timer0, + ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32c3-hal/examples/embassy_serial.rs b/esp32c3-hal/examples/embassy_serial.rs index 94c828d86..6fbc92b7e 100644 --- a/esp32c3-hal/examples/embassy_serial.rs +++ b/esp32c3-hal/examples/embassy_serial.rs @@ -17,8 +17,6 @@ use esp32c3_hal::{ interrupt, peripherals::{Interrupt, Peripherals, UART0}, prelude::*, - timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -108,26 +106,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -135,7 +113,15 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + embassy::init( + &clocks, + esp32c3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ) + .timer0, + ); let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); diff --git a/esp32c3-hal/examples/embassy_spi.rs b/esp32c3-hal/examples/embassy_spi.rs index 97df210a7..c48d93db2 100644 --- a/esp32c3-hal/examples/embassy_spi.rs +++ b/esp32c3-hal/examples/embassy_spi.rs @@ -28,8 +28,6 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, spi::{dma::SpiDma, FullDuplexMode, Spi, SpiMode}, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -59,26 +57,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -86,7 +64,15 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + embassy::init( + &clocks, + esp32c3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ) + .timer0, + ); esp32c3_hal::interrupt::enable( esp32c3_hal::peripherals::Interrupt::DMA_CH0, diff --git a/esp32c3-hal/examples/embassy_wait.rs b/esp32c3-hal/examples/embassy_wait.rs index 6bd76052c..b556f46e4 100644 --- a/esp32c3-hal/examples/embassy_wait.rs +++ b/esp32c3-hal/examples/embassy_wait.rs @@ -15,8 +15,6 @@ use esp32c3_hal::{ gpio::{Gpio9, Input, PullDown}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -39,26 +37,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -66,7 +44,15 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + embassy::init( + &clocks, + esp32c3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ) + .timer0, + ); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // GPIO 9 as input diff --git a/esp32c3-hal/examples/gpio_interrupt.rs b/esp32c3-hal/examples/gpio_interrupt.rs index 880af1388..56052003c 100644 --- a/esp32c3-hal/examples/gpio_interrupt.rs +++ b/esp32c3-hal/examples/gpio_interrupt.rs @@ -16,9 +16,7 @@ use esp32c3_hal::{ peripherals::{self, Peripherals}, prelude::*, riscv, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -27,30 +25,9 @@ static BUTTON: Mutex>>>> = Mutex::new(RefCe #[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 watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - // Set GPIO5 as an output let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio5.into_push_pull_output(); diff --git a/esp32c3-hal/examples/hello_rgb.rs b/esp32c3-hal/examples/hello_rgb.rs index 4e2b121e2..38c1bdc19 100644 --- a/esp32c3-hal/examples/hello_rgb.rs +++ b/esp32c3-hal/examples/hello_rgb.rs @@ -11,16 +11,7 @@ #![no_std] #![no_main] -use esp32c3_hal::{ - clock::ClockControl, - peripherals, - prelude::*, - rmt::Rmt, - timer::TimerGroup, - Delay, - Rtc, - IO, -}; +use esp32c3_hal::{clock::ClockControl, peripherals, prelude::*, rmt::Rmt, Delay, IO}; use esp_backtrace as _; use esp_hal_smartled::{smartLedAdapter, SmartLedsAdapter}; use smart_leds::{ @@ -36,18 +27,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable watchdogs - rtc.swd.disable(); - rtc.rwdt.disable(); - timer_group0.wdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally diff --git a/esp32c3-hal/examples/hello_world.rs b/esp32c3-hal/examples/hello_world.rs index b5dd83f63..7db4c15ab 100644 --- a/esp32c3-hal/examples/hello_world.rs +++ b/esp32c3-hal/examples/hello_world.rs @@ -11,7 +11,6 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -23,7 +22,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); let timer_group0 = TimerGroup::new( peripherals.TIMG0, @@ -31,19 +29,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); timer0.start(1u64.secs()); diff --git a/esp32c3-hal/examples/hmac.rs b/esp32c3-hal/examples/hmac.rs index 985d5e81f..7f1628721 100644 --- a/esp32c3-hal/examples/hmac.rs +++ b/esp32c3-hal/examples/hmac.rs @@ -61,9 +61,7 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, systimer::SystemTimer, - timer::TimerGroup, Rng, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -77,27 +75,7 @@ type HmacSha256 = HmacSw; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); diff --git a/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs b/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs index 9c2651fa8..15edb4a80 100644 --- a/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs @@ -9,15 +9,7 @@ #![no_std] #![no_main] -use esp32c3_hal::{ - clock::ClockControl, - gpio::IO, - i2c::I2C, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32c3_hal::{clock::ClockControl, gpio::IO, i2c::I2C, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; @@ -27,26 +19,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create a new peripheral object with the described wiring diff --git a/esp32c3-hal/examples/i2c_display.rs b/esp32c3-hal/examples/i2c_display.rs index 06d72e9e8..ec6237aa1 100644 --- a/esp32c3-hal/examples/i2c_display.rs +++ b/esp32c3-hal/examples/i2c_display.rs @@ -26,7 +26,6 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use nb::block; @@ -38,26 +37,12 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32c3-hal/examples/i2s_read.rs b/esp32c3-hal/examples/i2s_read.rs index ade7b7a59..cf0a2055d 100644 --- a/esp32c3-hal/examples/i2s_read.rs +++ b/esp32c3-hal/examples/i2s_read.rs @@ -21,8 +21,6 @@ use esp32c3_hal::{ i2s::{DataFormat, I2s, I2s0New, I2sReadDma, MclkPin, PinsBclkWsDin, Standard}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -34,26 +32,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); diff --git a/esp32c3-hal/examples/i2s_sound.rs b/esp32c3-hal/examples/i2s_sound.rs index 145aa1489..6636645ad 100644 --- a/esp32c3-hal/examples/i2s_sound.rs +++ b/esp32c3-hal/examples/i2s_sound.rs @@ -37,8 +37,6 @@ use esp32c3_hal::{ i2s::{DataFormat, I2s, I2s0New, I2sWriteDma, MclkPin, PinsBclkWsDout, Standard}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -57,26 +55,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); diff --git a/esp32c3-hal/examples/interrupt_preemption.rs b/esp32c3-hal/examples/interrupt_preemption.rs index 981101c7d..f75e026ae 100644 --- a/esp32c3-hal/examples/interrupt_preemption.rs +++ b/esp32c3-hal/examples/interrupt_preemption.rs @@ -32,27 +32,6 @@ fn main() -> ! { let sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(clockctrl).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32c3-hal/examples/ledc.rs b/esp32c3-hal/examples/ledc.rs index 9fb7ac228..4033bf7d9 100644 --- a/esp32c3-hal/examples/ledc.rs +++ b/esp32c3-hal/examples/ledc.rs @@ -18,8 +18,6 @@ use esp32c3_hal::{ }, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -29,26 +27,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); diff --git a/esp32c3-hal/examples/qspi_flash.rs b/esp32c3-hal/examples/qspi_flash.rs index cf8318388..cf8f8c9d8 100644 --- a/esp32c3-hal/examples/qspi_flash.rs +++ b/esp32c3-hal/examples/qspi_flash.rs @@ -25,9 +25,7 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,27 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c3-hal/examples/ram.rs b/esp32c3-hal/examples/ram.rs index 40f645505..1147ff0df 100644 --- a/esp32c3-hal/examples/ram.rs +++ b/esp32c3-hal/examples/ram.rs @@ -14,6 +14,7 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, + Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -40,12 +41,11 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - // Disable MWDT flash boot protection - wdt0.disable(); - // The RWDT flash boot protection remains enabled and it being triggered is part - // of the example + // The RWDT flash boot protection must be enabled, as it is triggered as part of + // the example. + let mut rtc = Rtc::new(peripherals.RTC_CNTL); + rtc.rwdt.enable(); timer0.start(1u64.secs()); diff --git a/esp32c3-hal/examples/read_efuse.rs b/esp32c3-hal/examples/read_efuse.rs index e1b329a11..c96427c1d 100644 --- a/esp32c3-hal/examples/read_efuse.rs +++ b/esp32c3-hal/examples/read_efuse.rs @@ -4,42 +4,15 @@ #![no_std] #![no_main] -use esp32c3_hal::{ - clock::ClockControl, - efuse::Efuse, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32c3_hal::{clock::ClockControl, efuse::Efuse, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let system = peripherals.SYSTEM.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); println!("MAC address {:02x?}", Efuse::get_mac_address()); println!("Flash Encryption {:?}", Efuse::get_flash_encryption()); diff --git a/esp32c3-hal/examples/rmt_rx.rs b/esp32c3-hal/examples/rmt_rx.rs index 7c33336c3..ad1410e8e 100644 --- a/esp32c3-hal/examples/rmt_rx.rs +++ b/esp32c3-hal/examples/rmt_rx.rs @@ -12,10 +12,8 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, RxChannel, RxChannelConfig, RxChannelCreator}, - timer::TimerGroup, Delay, Rmt, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -29,19 +27,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut clock_control = system.peripheral_clock_control; - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks, &mut clock_control); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &mut clock_control, &clocks).unwrap(); diff --git a/esp32c3-hal/examples/rmt_tx.rs b/esp32c3-hal/examples/rmt_tx.rs index 51c0ca6a0..41c1ff1cb 100644 --- a/esp32c3-hal/examples/rmt_tx.rs +++ b/esp32c3-hal/examples/rmt_tx.rs @@ -10,9 +10,7 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, TxChannel, TxChannelConfig, TxChannelCreator}, - timer::TimerGroup, Rmt, - Rtc, }; use esp_backtrace as _; use esp_hal_common::Delay; @@ -24,19 +22,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut clock_control = system.peripheral_clock_control; - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks, &mut clock_control); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &mut clock_control, &clocks).unwrap(); diff --git a/esp32c3-hal/examples/rng.rs b/esp32c3-hal/examples/rng.rs index b52d3f93e..05685e70c 100644 --- a/esp32c3-hal/examples/rng.rs +++ b/esp32c3-hal/examples/rng.rs @@ -3,42 +3,15 @@ #![no_std] #![no_main] -use esp32c3_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rng, - Rtc, -}; +use esp32c3_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Rng}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers: - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let system = peripherals.SYSTEM.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Instantiate the Random Number Generator peripheral: let mut rng = Rng::new(peripherals.RNG); diff --git a/esp32c3-hal/examples/rsa.rs b/esp32c3-hal/examples/rsa.rs index fb88a6a81..f6ffbf57e 100644 --- a/esp32c3-hal/examples/rsa.rs +++ b/esp32c3-hal/examples/rsa.rs @@ -23,8 +23,6 @@ use esp32c3_hal::{ RsaMultiplication, }, systimer::SystemTimer, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -59,27 +57,7 @@ const fn compute_mprime(modulus: &U512) -> u32 { fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the RTC and TIMG watchdog timers - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); diff --git a/esp32c3-hal/examples/rtc_time.rs b/esp32c3-hal/examples/rtc_time.rs index 7737d6d0e..1bf8195c8 100644 --- a/esp32c3-hal/examples/rtc_time.rs +++ b/esp32c3-hal/examples/rtc_time.rs @@ -3,43 +3,16 @@ #![no_std] #![no_main] -use esp32c3_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32c3_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay, Rtc}; 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(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - + let rtc = Rtc::new(peripherals.RTC_CNTL); let mut delay = Delay::new(&clocks); loop { diff --git a/esp32c3-hal/examples/serial_interrupts.rs b/esp32c3-hal/examples/serial_interrupts.rs index 168c99519..b3beb841e 100644 --- a/esp32c3-hal/examples/serial_interrupts.rs +++ b/esp32c3-hal/examples/serial_interrupts.rs @@ -17,7 +17,6 @@ use esp32c3_hal::{ timer::TimerGroup, uart::config::AtCmdConfig, Cpu, - Rtc, Uart, }; use esp_backtrace as _; @@ -31,7 +30,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); let timer_group0 = TimerGroup::new( peripherals.TIMG0, @@ -39,19 +37,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); serial0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); serial0.set_rx_fifo_full_threshold(30).unwrap(); diff --git a/esp32c3-hal/examples/sha.rs b/esp32c3-hal/examples/sha.rs index 17da1512a..6929fa155 100644 --- a/esp32c3-hal/examples/sha.rs +++ b/esp32c3-hal/examples/sha.rs @@ -9,8 +9,6 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, sha::{Sha, ShaMode}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -21,23 +19,10 @@ use sha2::{Digest, Sha256}; fn main() -> ! { let peripherals = Peripherals::take(); let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.swd.disable(); - rtc.rwdt.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); - let mut remaining = source_data.clone(); + let mut remaining = source_data; let mut hasher = Sha::new( peripherals.SHA, ShaMode::SHA256, diff --git a/esp32c3-hal/examples/software_interrupts.rs b/esp32c3-hal/examples/software_interrupts.rs index 8add65b0e..3dc1fed8d 100644 --- a/esp32c3-hal/examples/software_interrupts.rs +++ b/esp32c3-hal/examples/software_interrupts.rs @@ -17,9 +17,7 @@ use esp32c3_hal::{ prelude::*, riscv, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -28,32 +26,11 @@ 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(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32c3-hal/examples/spi_eh1_device_loopback.rs b/esp32c3-hal/examples/spi_eh1_device_loopback.rs index cf02dd41b..61c2c1268 100644 --- a/esp32c3-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32c3-hal/examples/spi_eh1_device_loopback.rs @@ -25,9 +25,7 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiBusController, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,27 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c3-hal/examples/spi_eh1_loopback.rs b/esp32c3-hal/examples/spi_eh1_loopback.rs index 424adcf03..ddecfc63d 100644 --- a/esp32c3-hal/examples/spi_eh1_loopback.rs +++ b/esp32c3-hal/examples/spi_eh1_loopback.rs @@ -23,9 +23,7 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -36,27 +34,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c3-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32c3-hal/examples/spi_halfduplex_read_manufacturer_id.rs index 20cb53e51..f83e51912 100644 --- a/esp32c3-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32c3-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -23,9 +23,7 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, HalfDuplexReadWrite, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -36,27 +34,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c3-hal/examples/spi_loopback.rs b/esp32c3-hal/examples/spi_loopback.rs index 83a2ff1e2..19bdb595e 100644 --- a/esp32c3-hal/examples/spi_loopback.rs +++ b/esp32c3-hal/examples/spi_loopback.rs @@ -22,9 +22,7 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -35,27 +33,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c3-hal/examples/spi_loopback_dma.rs b/esp32c3-hal/examples/spi_loopback_dma.rs index 3203a8d71..c91b4210f 100644 --- a/esp32c3-hal/examples/spi_loopback_dma.rs +++ b/esp32c3-hal/examples/spi_loopback_dma.rs @@ -24,9 +24,7 @@ use esp32c3_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -37,27 +35,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c3-hal/examples/systimer.rs b/esp32c3-hal/examples/systimer.rs index e7195f2d9..7b6328f3d 100644 --- a/esp32c3-hal/examples/systimer.rs +++ b/esp32c3-hal/examples/systimer.rs @@ -14,9 +14,7 @@ use esp32c3_hal::{ peripherals::{self, Peripherals}, prelude::*, systimer::{Alarm, Periodic, SystemTimer, Target}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -28,22 +26,9 @@ static ALARM2: Mutex>>> = Mutex::new(RefCell::ne #[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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.swd.disable(); - rtc.rwdt.disable(); - let syst = SystemTimer::new(peripherals.SYSTIMER); println!("SYSTIMER Current value = {}", SystemTimer::now()); diff --git a/esp32c3-hal/examples/timer_interrupt.rs b/esp32c3-hal/examples/timer_interrupt.rs index f1d4d63a5..410d8603d 100644 --- a/esp32c3-hal/examples/timer_interrupt.rs +++ b/esp32c3-hal/examples/timer_interrupt.rs @@ -15,7 +15,6 @@ use esp32c3_hal::{ prelude::*, riscv, timer::{Timer, Timer0, TimerGroup}, - Rtc, }; use esp_backtrace as _; @@ -28,28 +27,18 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; let timer_group1 = TimerGroup::new( peripherals.TIMG1, &clocks, &mut system.peripheral_clock_control, ); let mut timer1 = timer_group1.timer0; - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); interrupt::enable( peripherals::Interrupt::TG0_T0_LEVEL, diff --git a/esp32c3-hal/examples/twai.rs b/esp32c3-hal/examples/twai.rs index 35e6ca704..2e9be018a 100644 --- a/esp32c3-hal/examples/twai.rs +++ b/esp32c3-hal/examples/twai.rs @@ -10,15 +10,7 @@ use embedded_can::{nb::Can, Frame, Id}; // cargo run --example twai --release #[cfg(not(feature = "eh1"))] use embedded_hal::can::{Can, Frame, Id}; -use esp32c3_hal::{ - clock::ClockControl, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - twai, - Rtc, -}; +use esp32c3_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*, twai}; use esp_backtrace as _; use esp_println::println; use nb::block; @@ -29,26 +21,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Use GPIO pins 2 and 3 to connect to the respective pins on the CAN diff --git a/esp32c3-hal/examples/usb_serial_jtag.rs b/esp32c3-hal/examples/usb_serial_jtag.rs index 3d6480cda..0752917c3 100644 --- a/esp32c3-hal/examples/usb_serial_jtag.rs +++ b/esp32c3-hal/examples/usb_serial_jtag.rs @@ -17,7 +17,6 @@ use esp32c3_hal::{ riscv, timer::TimerGroup, Cpu, - Rtc, UsbSerialJtag, }; use esp_backtrace as _; @@ -31,26 +30,12 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE, &mut system.peripheral_clock_control); diff --git a/esp32c6-hal/examples/adc.rs b/esp32c6-hal/examples/adc.rs index bb003ac64..a41555397 100644 --- a/esp32c6-hal/examples/adc.rs +++ b/esp32c6-hal/examples/adc.rs @@ -11,9 +11,7 @@ use esp32c6_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -24,27 +22,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create ADC instances diff --git a/esp32c6-hal/examples/adc_cal.rs b/esp32c6-hal/examples/adc_cal.rs index f789f1f59..b89e18b4f 100644 --- a/esp32c6-hal/examples/adc_cal.rs +++ b/esp32c6-hal/examples/adc_cal.rs @@ -12,9 +12,7 @@ use esp32c6_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -25,27 +23,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create ADC instances diff --git a/esp32c6-hal/examples/advanced_serial.rs b/esp32c6-hal/examples/advanced_serial.rs index a11be9ca6..696ffc9ab 100644 --- a/esp32c6-hal/examples/advanced_serial.rs +++ b/esp32c6-hal/examples/advanced_serial.rs @@ -19,7 +19,6 @@ use esp32c6_hal::{ config::{Config, DataBits, Parity, StopBits}, TxRxPins, }, - Rtc, Uart, IO, }; @@ -33,27 +32,12 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let config = Config { baudrate: 115200, diff --git a/esp32c6-hal/examples/aes.rs b/esp32c6-hal/examples/aes.rs index bb6052673..6a849dad8 100644 --- a/esp32c6-hal/examples/aes.rs +++ b/esp32c6-hal/examples/aes.rs @@ -12,8 +12,6 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, systimer::SystemTimer, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -22,30 +20,7 @@ use esp_println::println; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); diff --git a/esp32c6-hal/examples/blinky.rs b/esp32c6-hal/examples/blinky.rs index 324ac9f19..a5baec919 100644 --- a/esp32c6-hal/examples/blinky.rs +++ b/esp32c6-hal/examples/blinky.rs @@ -5,44 +5,15 @@ #![no_std] #![no_main] -use esp32c6_hal::{ - clock::ClockControl, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32c6_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*, Delay}; 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(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - // Set GPIO5 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio5.into_push_pull_output(); diff --git a/esp32c6-hal/examples/blinky_erased_pins.rs b/esp32c6-hal/examples/blinky_erased_pins.rs index 7d3597aff..e175fb6d6 100644 --- a/esp32c6-hal/examples/blinky_erased_pins.rs +++ b/esp32c6-hal/examples/blinky_erased_pins.rs @@ -10,39 +10,16 @@ use esp32c6_hal::{ gpio::{AnyPin, Input, Output, PullDown, PushPull, IO}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; 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(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - // Set LED GPIOs as an output. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led1 = io.pins.gpio3.into_push_pull_output(); diff --git a/esp32c6-hal/examples/crc.rs b/esp32c6-hal/examples/crc.rs index 854e6eb20..90cbad381 100644 --- a/esp32c6-hal/examples/crc.rs +++ b/esp32c6-hal/examples/crc.rs @@ -11,7 +11,6 @@ use esp32c6_hal::{ prelude::*, rom::{crc, md5}, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -24,27 +23,13 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); + let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - timer0.start(1u64.secs()); let data = "123456789"; diff --git a/esp32c6-hal/examples/debug_assist.rs b/esp32c6-hal/examples/debug_assist.rs index daf4b21a1..38f4b8230 100644 --- a/esp32c6-hal/examples/debug_assist.rs +++ b/esp32c6-hal/examples/debug_assist.rs @@ -15,8 +15,6 @@ use esp32c6_hal::{ peripherals::{self, Peripherals}, prelude::*, riscv, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -27,27 +25,7 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut da = DebugAssist::new( peripherals.ASSIST_DEBUG, diff --git a/esp32c6-hal/examples/direct-vectoring.rs b/esp32c6-hal/examples/direct-vectoring.rs index ceb5cb9b6..39cf771fb 100644 --- a/esp32c6-hal/examples/direct-vectoring.rs +++ b/esp32c6-hal/examples/direct-vectoring.rs @@ -13,8 +13,6 @@ use esp32c6_hal::{ peripherals::{self, Peripherals}, prelude::*, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -28,27 +26,6 @@ fn main() -> ! { let sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(clockctrl).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); unsafe { interrupt::enable( diff --git a/esp32c6-hal/examples/embassy_hello_world.rs b/esp32c6-hal/examples/embassy_hello_world.rs index 45019a599..03447b393 100644 --- a/esp32c6-hal/examples/embassy_hello_world.rs +++ b/esp32c6-hal/examples/embassy_hello_world.rs @@ -9,14 +9,7 @@ use embassy_executor::Executor; use embassy_time::{Duration, Timer}; -use esp32c6_hal::{ - clock::ClockControl, - embassy, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32c6_hal::{clock::ClockControl, embassy, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use static_cell::make_static; @@ -43,26 +36,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -70,7 +43,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32c6_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let executor = make_static!(Executor::new()); executor.run(|spawner| { diff --git a/esp32c6-hal/examples/embassy_i2c.rs b/esp32c6-hal/examples/embassy_i2c.rs index 6a335c966..b2f0bbc03 100644 --- a/esp32c6-hal/examples/embassy_i2c.rs +++ b/esp32c6-hal/examples/embassy_i2c.rs @@ -23,8 +23,6 @@ use esp32c6_hal::{ interrupt, peripherals::{Interrupt, Peripherals, I2C0}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -50,26 +48,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -77,7 +55,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32c6_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32c6-hal/examples/embassy_serial.rs b/esp32c6-hal/examples/embassy_serial.rs index 95f8896d4..2953ff3bd 100644 --- a/esp32c6-hal/examples/embassy_serial.rs +++ b/esp32c6-hal/examples/embassy_serial.rs @@ -17,8 +17,6 @@ use esp32c6_hal::{ interrupt, peripherals::{Interrupt, Peripherals, UART0}, prelude::*, - timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -108,26 +106,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -135,7 +113,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32c6_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); diff --git a/esp32c6-hal/examples/embassy_spi.rs b/esp32c6-hal/examples/embassy_spi.rs index e5a602a3a..6df29052d 100644 --- a/esp32c6-hal/examples/embassy_spi.rs +++ b/esp32c6-hal/examples/embassy_spi.rs @@ -28,8 +28,6 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, spi::{dma::SpiDma, FullDuplexMode, Spi, SpiMode}, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -59,28 +57,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -88,7 +64,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32c6_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } esp32c6_hal::interrupt::enable( esp32c6_hal::peripherals::Interrupt::DMA_IN_CH0, diff --git a/esp32c6-hal/examples/embassy_wait.rs b/esp32c6-hal/examples/embassy_wait.rs index 7f947e0cc..5a3ebf19e 100644 --- a/esp32c6-hal/examples/embassy_wait.rs +++ b/esp32c6-hal/examples/embassy_wait.rs @@ -15,8 +15,6 @@ use esp32c6_hal::{ gpio::{Gpio9, Input, PullDown}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -39,26 +37,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -66,7 +44,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32c6_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // GPIO 9 as input diff --git a/esp32c6-hal/examples/gpio_interrupt.rs b/esp32c6-hal/examples/gpio_interrupt.rs index f960a04c4..d2b4aeef5 100644 --- a/esp32c6-hal/examples/gpio_interrupt.rs +++ b/esp32c6-hal/examples/gpio_interrupt.rs @@ -16,9 +16,7 @@ use esp32c6_hal::{ peripherals::{self, Peripherals}, prelude::*, riscv, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -27,31 +25,9 @@ static BUTTON: Mutex>>>> = Mutex::new(RefCe #[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. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - // Set GPIO5 as an output let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio5.into_push_pull_output(); diff --git a/esp32c6-hal/examples/hello_rgb.rs b/esp32c6-hal/examples/hello_rgb.rs index 4bbba339d..29c317e42 100644 --- a/esp32c6-hal/examples/hello_rgb.rs +++ b/esp32c6-hal/examples/hello_rgb.rs @@ -10,16 +10,7 @@ #![no_std] #![no_main] -use esp32c6_hal::{ - clock::ClockControl, - peripherals, - prelude::*, - rmt::Rmt, - timer::TimerGroup, - Delay, - Rtc, - IO, -}; +use esp32c6_hal::{clock::ClockControl, peripherals, prelude::*, rmt::Rmt, Delay, IO}; use esp_backtrace as _; use esp_hal_smartled::{smartLedAdapter, SmartLedsAdapter}; use smart_leds::{ @@ -35,26 +26,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let mut timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - timer_group0.wdt.disable(); - timer_group1.wdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally diff --git a/esp32c6-hal/examples/hello_world.rs b/esp32c6-hal/examples/hello_world.rs index e68bca371..32d402e5d 100644 --- a/esp32c6-hal/examples/hello_world.rs +++ b/esp32c6-hal/examples/hello_world.rs @@ -11,7 +11,6 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -24,27 +23,13 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); + let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - timer0.start(1u64.secs()); loop { diff --git a/esp32c6-hal/examples/hmac.rs b/esp32c6-hal/examples/hmac.rs index d0fb636f3..3b5ae8583 100644 --- a/esp32c6-hal/examples/hmac.rs +++ b/esp32c6-hal/examples/hmac.rs @@ -61,9 +61,7 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, systimer::SystemTimer, - timer::TimerGroup, Rng, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -77,27 +75,7 @@ type HmacSha256 = HmacSw; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); diff --git a/esp32c6-hal/examples/i2c_bmp180_calibration_data.rs b/esp32c6-hal/examples/i2c_bmp180_calibration_data.rs index c8f457ac0..23bdbe7de 100644 --- a/esp32c6-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32c6-hal/examples/i2c_bmp180_calibration_data.rs @@ -9,15 +9,7 @@ #![no_std] #![no_main] -use esp32c6_hal::{ - clock::ClockControl, - gpio::IO, - i2c::I2C, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32c6_hal::{clock::ClockControl, gpio::IO, i2c::I2C, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; @@ -27,26 +19,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create a new peripheral object with the described wiring diff --git a/esp32c6-hal/examples/i2c_display.rs b/esp32c6-hal/examples/i2c_display.rs index a581bfc15..2c039cb13 100644 --- a/esp32c6-hal/examples/i2c_display.rs +++ b/esp32c6-hal/examples/i2c_display.rs @@ -26,7 +26,6 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use nb::block; @@ -38,26 +37,12 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32c6-hal/examples/i2s_read.rs b/esp32c6-hal/examples/i2s_read.rs index 63192948d..8fdd78a91 100644 --- a/esp32c6-hal/examples/i2s_read.rs +++ b/esp32c6-hal/examples/i2s_read.rs @@ -21,8 +21,6 @@ use esp32c6_hal::{ i2s::{DataFormat, I2s, I2s0New, I2sReadDma, MclkPin, PinsBclkWsDin, Standard}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -34,28 +32,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); diff --git a/esp32c6-hal/examples/i2s_sound.rs b/esp32c6-hal/examples/i2s_sound.rs index 9f57452af..ad928174b 100644 --- a/esp32c6-hal/examples/i2s_sound.rs +++ b/esp32c6-hal/examples/i2s_sound.rs @@ -37,8 +37,6 @@ use esp32c6_hal::{ i2s::{DataFormat, I2s, I2s0New, I2sWriteDma, MclkPin, PinsBclkWsDout, Standard}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -57,26 +55,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); diff --git a/esp32c6-hal/examples/interrupt_preemption.rs b/esp32c6-hal/examples/interrupt_preemption.rs index eea092285..7f2febeed 100644 --- a/esp32c6-hal/examples/interrupt_preemption.rs +++ b/esp32c6-hal/examples/interrupt_preemption.rs @@ -17,8 +17,6 @@ use esp32c6_hal::{ prelude::*, riscv, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -32,27 +30,6 @@ fn main() -> ! { let sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(clockctrl).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32c6-hal/examples/ledc.rs b/esp32c6-hal/examples/ledc.rs index fef771d6b..fef78eb13 100644 --- a/esp32c6-hal/examples/ledc.rs +++ b/esp32c6-hal/examples/ledc.rs @@ -18,8 +18,6 @@ use esp32c6_hal::{ }, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -29,28 +27,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); diff --git a/esp32c6-hal/examples/lp_core_basic.rs b/esp32c6-hal/examples/lp_core_basic.rs index 40788a031..7f63249a7 100644 --- a/esp32c6-hal/examples/lp_core_basic.rs +++ b/esp32c6-hal/examples/lp_core_basic.rs @@ -12,8 +12,6 @@ use esp32c6_hal::{ lp_core, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -108,28 +106,8 @@ const CODE: &[u8] = &[ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let system = peripherals.PCR.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32c6-hal/examples/mcpwm.rs b/esp32c6-hal/examples/mcpwm.rs index ac18d300b..66266a26f 100644 --- a/esp32c6-hal/examples/mcpwm.rs +++ b/esp32c6-hal/examples/mcpwm.rs @@ -12,8 +12,6 @@ use esp32c6_hal::{ mcpwm::{operator::PwmPinConfig, timer::PwmWorkingMode, PeripheralClockConfig, MCPWM}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -23,28 +21,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let pin = io.pins.gpio4; diff --git a/esp32c6-hal/examples/parl_io_tx.rs b/esp32c6-hal/examples/parl_io_tx.rs index a5ac9c9c8..341ddfa3a 100644 --- a/esp32c6-hal/examples/parl_io_tx.rs +++ b/esp32c6-hal/examples/parl_io_tx.rs @@ -25,9 +25,7 @@ use esp32c6_hal::{ }, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -38,26 +36,6 @@ fn main() -> ! { let mut 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 mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut tx_descriptors = [0u32; 8 * 3]; diff --git a/esp32c6-hal/examples/pcnt_encoder.rs b/esp32c6-hal/examples/pcnt_encoder.rs index a5c02415e..2580ebef5 100644 --- a/esp32c6-hal/examples/pcnt_encoder.rs +++ b/esp32c6-hal/examples/pcnt_encoder.rs @@ -23,8 +23,6 @@ use esp_hal::{ pcnt::{channel, channel::PcntSource, unit, PCNT}, peripherals::{self, Peripherals}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_println::println; @@ -36,29 +34,7 @@ static VALUE: AtomicI32 = AtomicI32::new(0); fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let unit_number = unit::Number::Unit1; diff --git a/esp32c6-hal/examples/qspi_flash.rs b/esp32c6-hal/examples/qspi_flash.rs index 886ded195..02210dd7c 100644 --- a/esp32c6-hal/examples/qspi_flash.rs +++ b/esp32c6-hal/examples/qspi_flash.rs @@ -25,9 +25,7 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,27 +36,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio4; let miso = io.pins.gpio5; diff --git a/esp32c6-hal/examples/ram.rs b/esp32c6-hal/examples/ram.rs index 7120fd844..25fba144b 100644 --- a/esp32c6-hal/examples/ram.rs +++ b/esp32c6-hal/examples/ram.rs @@ -14,6 +14,7 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, + Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -34,27 +35,17 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - // Disable MWDT flash boot protection - wdt0.disable(); - wdt1.disable(); - // The RWDT flash boot protection remains enabled and it being triggered is part - // of the example + // The RWDT flash boot protection must be enabled, as it is triggered as part of + // the example. + let mut rtc = Rtc::new(peripherals.LP_CLKRST); + rtc.rwdt.enable(); timer0.start(1u64.secs()); diff --git a/esp32c6-hal/examples/read_efuse.rs b/esp32c6-hal/examples/read_efuse.rs index 02af03076..60c65897c 100644 --- a/esp32c6-hal/examples/read_efuse.rs +++ b/esp32c6-hal/examples/read_efuse.rs @@ -4,42 +4,15 @@ #![no_std] #![no_main] -use esp32c6_hal::{ - clock::ClockControl, - efuse::Efuse, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32c6_hal::{clock::ClockControl, efuse::Efuse, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let system = peripherals.PCR.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); println!("MAC address {:02x?}", Efuse::get_mac_address()); println!("Flash Encryption {:?}", Efuse::get_flash_encryption()); diff --git a/esp32c6-hal/examples/rmt_rx.rs b/esp32c6-hal/examples/rmt_rx.rs index febfbaa6e..edc5d86e9 100644 --- a/esp32c6-hal/examples/rmt_rx.rs +++ b/esp32c6-hal/examples/rmt_rx.rs @@ -12,10 +12,8 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, RxChannel, RxChannelConfig, RxChannelCreator}, - timer::TimerGroup, Delay, Rmt, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -29,19 +27,6 @@ fn main() -> ! { let mut clock_control = system.peripheral_clock_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks, &mut clock_control); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &mut clock_control, &clocks).unwrap(); diff --git a/esp32c6-hal/examples/rmt_tx.rs b/esp32c6-hal/examples/rmt_tx.rs index b59e6745b..20d95cdbf 100644 --- a/esp32c6-hal/examples/rmt_tx.rs +++ b/esp32c6-hal/examples/rmt_tx.rs @@ -10,10 +10,8 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, TxChannel, TxChannelConfig, TxChannelCreator}, - timer::TimerGroup, Delay, Rmt, - Rtc, }; use esp_backtrace as _; @@ -24,19 +22,6 @@ fn main() -> ! { let mut clock_control = system.peripheral_clock_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks, &mut clock_control); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &mut clock_control, &clocks).unwrap(); diff --git a/esp32c6-hal/examples/rng.rs b/esp32c6-hal/examples/rng.rs index 53e352b8f..8c19061a8 100644 --- a/esp32c6-hal/examples/rng.rs +++ b/esp32c6-hal/examples/rng.rs @@ -3,42 +3,15 @@ #![no_std] #![no_main] -use esp32c6_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rng, - Rtc, -}; +use esp32c6_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Rng}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers: - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let system = peripherals.PCR.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Instantiate the Random Number Generator peripheral: let mut rng = Rng::new(peripherals.RNG); diff --git a/esp32c6-hal/examples/rsa.rs b/esp32c6-hal/examples/rsa.rs index a519f70fc..c3fd855e8 100644 --- a/esp32c6-hal/examples/rsa.rs +++ b/esp32c6-hal/examples/rsa.rs @@ -23,8 +23,6 @@ use esp32c6_hal::{ RsaMultiplication, }, systimer::SystemTimer, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -59,28 +57,7 @@ const fn compute_mprime(modulus: &U512) -> u32 { fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); diff --git a/esp32c6-hal/examples/rtc_time.rs b/esp32c6-hal/examples/rtc_time.rs index 499d227ce..db7aa0149 100644 --- a/esp32c6-hal/examples/rtc_time.rs +++ b/esp32c6-hal/examples/rtc_time.rs @@ -3,43 +3,16 @@ #![no_std] #![no_main] -use esp32c6_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32c6_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay, Rtc}; 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(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - + let rtc = Rtc::new(peripherals.LP_CLKRST); let mut delay = Delay::new(&clocks); loop { diff --git a/esp32c6-hal/examples/serial_interrupts.rs b/esp32c6-hal/examples/serial_interrupts.rs index 40b9f40f0..aa4a1c31c 100644 --- a/esp32c6-hal/examples/serial_interrupts.rs +++ b/esp32c6-hal/examples/serial_interrupts.rs @@ -17,7 +17,6 @@ use esp32c6_hal::{ timer::TimerGroup, uart::config::AtCmdConfig, Cpu, - Rtc, Uart, }; use esp_backtrace as _; @@ -31,28 +30,14 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); serial0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); serial0.set_rx_fifo_full_threshold(30).unwrap(); serial0.listen_at_cmd(); diff --git a/esp32c6-hal/examples/sha.rs b/esp32c6-hal/examples/sha.rs index 8fb4fc420..3ab6097ee 100644 --- a/esp32c6-hal/examples/sha.rs +++ b/esp32c6-hal/examples/sha.rs @@ -9,8 +9,6 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, sha::{Sha, ShaMode}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -21,22 +19,10 @@ use sha2::{Digest, Sha256}; fn main() -> ! { let peripherals = Peripherals::take(); let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.swd.disable(); - rtc.rwdt.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); - let mut remaining = source_data.clone(); + let mut remaining = source_data; let mut hasher = Sha::new( peripherals.SHA, ShaMode::SHA256, diff --git a/esp32c6-hal/examples/software_interrupts.rs b/esp32c6-hal/examples/software_interrupts.rs index 60c57fac3..914bd3300 100644 --- a/esp32c6-hal/examples/software_interrupts.rs +++ b/esp32c6-hal/examples/software_interrupts.rs @@ -16,9 +16,7 @@ use esp32c6_hal::{ prelude::*, riscv, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -27,32 +25,11 @@ 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(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32c6-hal/examples/spi_eh1_device_loopback.rs b/esp32c6-hal/examples/spi_eh1_device_loopback.rs index 249204c29..e573e69da 100644 --- a/esp32c6-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32c6-hal/examples/spi_eh1_device_loopback.rs @@ -25,9 +25,7 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiBusController, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,28 +36,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c6-hal/examples/spi_eh1_loopback.rs b/esp32c6-hal/examples/spi_eh1_loopback.rs index da47f6d90..9619f8b61 100644 --- a/esp32c6-hal/examples/spi_eh1_loopback.rs +++ b/esp32c6-hal/examples/spi_eh1_loopback.rs @@ -23,9 +23,7 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -36,28 +34,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c6-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32c6-hal/examples/spi_halfduplex_read_manufacturer_id.rs index 4480c3c85..d45c06d2d 100644 --- a/esp32c6-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32c6-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -23,9 +23,7 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, HalfDuplexReadWrite, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -36,27 +34,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio4; let miso = io.pins.gpio5; diff --git a/esp32c6-hal/examples/spi_loopback.rs b/esp32c6-hal/examples/spi_loopback.rs index 4d56e73fd..2d7a401f2 100644 --- a/esp32c6-hal/examples/spi_loopback.rs +++ b/esp32c6-hal/examples/spi_loopback.rs @@ -22,9 +22,7 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -35,28 +33,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c6-hal/examples/spi_loopback_dma.rs b/esp32c6-hal/examples/spi_loopback_dma.rs index bcc1ee575..7fc37bab5 100644 --- a/esp32c6-hal/examples/spi_loopback_dma.rs +++ b/esp32c6-hal/examples/spi_loopback_dma.rs @@ -24,9 +24,7 @@ use esp32c6_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -37,28 +35,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32c6-hal/examples/systimer.rs b/esp32c6-hal/examples/systimer.rs index 7152d1657..639fb3877 100644 --- a/esp32c6-hal/examples/systimer.rs +++ b/esp32c6-hal/examples/systimer.rs @@ -14,9 +14,7 @@ use esp32c6_hal::{ peripherals::{self, Peripherals}, prelude::*, systimer::{Alarm, Periodic, SystemTimer, Target}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -28,31 +26,9 @@ static ALARM2: Mutex>>> = Mutex::new(RefCell::ne #[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. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let syst = SystemTimer::new(peripherals.SYSTIMER); println!("SYSTIMER Current value = {}", SystemTimer::now()); diff --git a/esp32c6-hal/examples/timer_interrupt.rs b/esp32c6-hal/examples/timer_interrupt.rs index 8dd425c68..bcea5d3b7 100644 --- a/esp32c6-hal/examples/timer_interrupt.rs +++ b/esp32c6-hal/examples/timer_interrupt.rs @@ -15,7 +15,6 @@ use esp32c6_hal::{ prelude::*, riscv, timer::{Timer, Timer0, TimerGroup}, - Rtc, }; use esp_backtrace as _; @@ -28,29 +27,19 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; + let timer_group1 = TimerGroup::new( peripherals.TIMG1, &clocks, &mut system.peripheral_clock_control, ); let mut timer1 = timer_group1.timer0; - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); interrupt::enable( peripherals::Interrupt::TG0_T0_LEVEL, diff --git a/esp32c6-hal/examples/usb_serial_jtag.rs b/esp32c6-hal/examples/usb_serial_jtag.rs index 04ea4cc55..a5da0e909 100644 --- a/esp32c6-hal/examples/usb_serial_jtag.rs +++ b/esp32c6-hal/examples/usb_serial_jtag.rs @@ -16,7 +16,6 @@ use esp32c6_hal::{ riscv, timer::TimerGroup, Cpu, - Rtc, UsbSerialJtag, }; use esp_backtrace as _; @@ -30,26 +29,12 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE, &mut system.peripheral_clock_control); diff --git a/esp32h2-hal/examples/adc.rs b/esp32h2-hal/examples/adc.rs index be524ce99..38448a83b 100644 --- a/esp32h2-hal/examples/adc.rs +++ b/esp32h2-hal/examples/adc.rs @@ -11,9 +11,7 @@ use esp32h2_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -24,27 +22,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create ADC instances diff --git a/esp32h2-hal/examples/advanced_serial.rs b/esp32h2-hal/examples/advanced_serial.rs index 86eeb9974..6595e0fa7 100644 --- a/esp32h2-hal/examples/advanced_serial.rs +++ b/esp32h2-hal/examples/advanced_serial.rs @@ -19,7 +19,6 @@ use esp32h2_hal::{ config::{Config, DataBits, Parity, StopBits}, TxRxPins, }, - Rtc, Uart, IO, }; @@ -33,27 +32,12 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let config = Config { baudrate: 115200, diff --git a/esp32h2-hal/examples/aes.rs b/esp32h2-hal/examples/aes.rs index 858bb47e8..c3d8905ae 100644 --- a/esp32h2-hal/examples/aes.rs +++ b/esp32h2-hal/examples/aes.rs @@ -1,4 +1,4 @@ -//! Encrypt/Decrypt a message using AES +//! Encrypt/Decrypt a message using AES. #![no_std] #![no_main] @@ -12,8 +12,6 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, systimer::SystemTimer, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -22,28 +20,7 @@ use esp_println::println; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); diff --git a/esp32h2-hal/examples/blinky.rs b/esp32h2-hal/examples/blinky.rs index d9e498557..ac08fef1e 100644 --- a/esp32h2-hal/examples/blinky.rs +++ b/esp32h2-hal/examples/blinky.rs @@ -5,44 +5,15 @@ #![no_std] #![no_main] -use esp32h2_hal::{ - clock::ClockControl, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32h2_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*, Delay}; 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(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - // Set GPIO5 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio5.into_push_pull_output(); diff --git a/esp32h2-hal/examples/blinky_erased_pins.rs b/esp32h2-hal/examples/blinky_erased_pins.rs index 4d01564db..27dc9a581 100644 --- a/esp32h2-hal/examples/blinky_erased_pins.rs +++ b/esp32h2-hal/examples/blinky_erased_pins.rs @@ -10,39 +10,16 @@ use esp32h2_hal::{ gpio::{AnyPin, Input, Output, PullDown, PushPull, IO}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; 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(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - // Set LED GPIOs as an output. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led1 = io.pins.gpio3.into_push_pull_output(); diff --git a/esp32h2-hal/examples/crc.rs b/esp32h2-hal/examples/crc.rs index 423530bba..137253cb8 100644 --- a/esp32h2-hal/examples/crc.rs +++ b/esp32h2-hal/examples/crc.rs @@ -11,7 +11,6 @@ use esp32h2_hal::{ prelude::*, rom::{crc, md5}, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -23,29 +22,14 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); + let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); + let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - - let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); timer0.start(1u64.secs()); let data = "123456789"; diff --git a/esp32h2-hal/examples/debug_assist.rs b/esp32h2-hal/examples/debug_assist.rs index 0c92e460c..79a8eede4 100644 --- a/esp32h2-hal/examples/debug_assist.rs +++ b/esp32h2-hal/examples/debug_assist.rs @@ -15,8 +15,6 @@ use esp32h2_hal::{ peripherals::{self, Peripherals}, prelude::*, riscv, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -27,27 +25,7 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut da = DebugAssist::new( peripherals.ASSIST_DEBUG, diff --git a/esp32h2-hal/examples/direct-vectoring.rs b/esp32h2-hal/examples/direct-vectoring.rs index bb615d890..8bc9be9de 100644 --- a/esp32h2-hal/examples/direct-vectoring.rs +++ b/esp32h2-hal/examples/direct-vectoring.rs @@ -13,8 +13,6 @@ use esp32h2_hal::{ peripherals::{self, Peripherals}, prelude::*, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -28,27 +26,6 @@ fn main() -> ! { let sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(clockctrl).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); unsafe { interrupt::enable( diff --git a/esp32h2-hal/examples/embassy_hello_world.rs b/esp32h2-hal/examples/embassy_hello_world.rs index 6d58d053b..964ab9165 100644 --- a/esp32h2-hal/examples/embassy_hello_world.rs +++ b/esp32h2-hal/examples/embassy_hello_world.rs @@ -9,14 +9,7 @@ use embassy_executor::Executor; use embassy_time::{Duration, Timer}; -use esp32h2_hal::{ - clock::ClockControl, - embassy, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32h2_hal::{clock::ClockControl, embassy, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use static_cell::make_static; @@ -43,26 +36,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -70,7 +43,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32h2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let executor = make_static!(Executor::new()); executor.run(|spawner| { diff --git a/esp32h2-hal/examples/embassy_i2c.rs b/esp32h2-hal/examples/embassy_i2c.rs index 92913975e..14361d31a 100644 --- a/esp32h2-hal/examples/embassy_i2c.rs +++ b/esp32h2-hal/examples/embassy_i2c.rs @@ -23,8 +23,6 @@ use esp32h2_hal::{ interrupt, peripherals::{Interrupt, Peripherals, I2C0}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -50,26 +48,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -77,7 +55,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32h2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32h2-hal/examples/embassy_serial.rs b/esp32h2-hal/examples/embassy_serial.rs index 0e2343ded..e714aeac8 100644 --- a/esp32h2-hal/examples/embassy_serial.rs +++ b/esp32h2-hal/examples/embassy_serial.rs @@ -17,8 +17,6 @@ use esp32h2_hal::{ interrupt, peripherals::{Interrupt, Peripherals, UART0}, prelude::*, - timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -108,26 +106,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -135,7 +113,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32h2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); diff --git a/esp32h2-hal/examples/embassy_spi.rs b/esp32h2-hal/examples/embassy_spi.rs index 24df40bfd..e58afa23e 100644 --- a/esp32h2-hal/examples/embassy_spi.rs +++ b/esp32h2-hal/examples/embassy_spi.rs @@ -28,8 +28,6 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, spi::{dma::SpiDma, FullDuplexMode, Spi, SpiMode}, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -59,28 +57,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -88,7 +64,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32h2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } esp32h2_hal::interrupt::enable( esp32h2_hal::peripherals::Interrupt::DMA_IN_CH0, diff --git a/esp32h2-hal/examples/embassy_wait.rs b/esp32h2-hal/examples/embassy_wait.rs index 1dd03f50e..2cff6ca7a 100644 --- a/esp32h2-hal/examples/embassy_wait.rs +++ b/esp32h2-hal/examples/embassy_wait.rs @@ -15,8 +15,6 @@ use esp32h2_hal::{ gpio::{Gpio9, Input, PullDown}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -39,26 +37,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -66,7 +44,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32h2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // GPIO 9 as input diff --git a/esp32h2-hal/examples/gpio_interrupt.rs b/esp32h2-hal/examples/gpio_interrupt.rs index 10471136e..30de4af78 100644 --- a/esp32h2-hal/examples/gpio_interrupt.rs +++ b/esp32h2-hal/examples/gpio_interrupt.rs @@ -16,9 +16,7 @@ use esp32h2_hal::{ peripherals::{self, Peripherals}, prelude::*, riscv, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -27,31 +25,9 @@ static BUTTON: Mutex>>>> = Mutex::new(RefCe #[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. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - // Set GPIO5 as an output let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio5.into_push_pull_output(); diff --git a/esp32h2-hal/examples/hello_rgb.rs b/esp32h2-hal/examples/hello_rgb.rs index 42ae167d9..f350223da 100644 --- a/esp32h2-hal/examples/hello_rgb.rs +++ b/esp32h2-hal/examples/hello_rgb.rs @@ -10,16 +10,7 @@ #![no_std] #![no_main] -use esp32h2_hal::{ - clock::ClockControl, - peripherals, - prelude::*, - rmt::Rmt, - timer::TimerGroup, - Delay, - Rtc, - IO, -}; +use esp32h2_hal::{clock::ClockControl, peripherals, prelude::*, rmt::Rmt, Delay, IO}; use esp_backtrace as _; use esp_hal_smartled::{smartLedAdapter, SmartLedsAdapter}; use smart_leds::{ @@ -35,26 +26,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let mut timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - timer_group0.wdt.disable(); - timer_group1.wdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally diff --git a/esp32h2-hal/examples/hello_world.rs b/esp32h2-hal/examples/hello_world.rs index 25a336f15..7d5da9c2d 100644 --- a/esp32h2-hal/examples/hello_world.rs +++ b/esp32h2-hal/examples/hello_world.rs @@ -11,7 +11,6 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -23,29 +22,14 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); + let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); + let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - - let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); timer0.start(1u64.secs()); loop { diff --git a/esp32h2-hal/examples/hmac.rs b/esp32h2-hal/examples/hmac.rs index 7531fb514..226f21b02 100644 --- a/esp32h2-hal/examples/hmac.rs +++ b/esp32h2-hal/examples/hmac.rs @@ -61,9 +61,7 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, systimer::SystemTimer, - timer::TimerGroup, Rng, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -77,29 +75,7 @@ type HmacSha256 = HmacSw; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable MWDT and RWDT (Watchdog) flash boot protection - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); diff --git a/esp32h2-hal/examples/i2c_bmp180_calibration_data.rs b/esp32h2-hal/examples/i2c_bmp180_calibration_data.rs index b5f44d817..9a18dd8fc 100644 --- a/esp32h2-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32h2-hal/examples/i2c_bmp180_calibration_data.rs @@ -9,15 +9,7 @@ #![no_std] #![no_main] -use esp32h2_hal::{ - clock::ClockControl, - gpio::IO, - i2c::I2C, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32h2_hal::{clock::ClockControl, gpio::IO, i2c::I2C, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; @@ -27,26 +19,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create a new peripheral object with the described wiring diff --git a/esp32h2-hal/examples/i2c_display.rs b/esp32h2-hal/examples/i2c_display.rs index c2a001adb..e65495ed6 100644 --- a/esp32h2-hal/examples/i2c_display.rs +++ b/esp32h2-hal/examples/i2c_display.rs @@ -26,7 +26,6 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use nb::block; @@ -38,26 +37,12 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32h2-hal/examples/i2s_read.rs b/esp32h2-hal/examples/i2s_read.rs index caff418e4..ea1c84f15 100644 --- a/esp32h2-hal/examples/i2s_read.rs +++ b/esp32h2-hal/examples/i2s_read.rs @@ -21,8 +21,6 @@ use esp32h2_hal::{ i2s::{DataFormat, I2s, I2s0New, I2sReadDma, MclkPin, PinsBclkWsDin, Standard}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -34,28 +32,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); diff --git a/esp32h2-hal/examples/i2s_sound.rs b/esp32h2-hal/examples/i2s_sound.rs index 9c90509ee..ca67d8461 100644 --- a/esp32h2-hal/examples/i2s_sound.rs +++ b/esp32h2-hal/examples/i2s_sound.rs @@ -37,8 +37,6 @@ use esp32h2_hal::{ i2s::{DataFormat, I2s, I2s0New, I2sWriteDma, MclkPin, PinsBclkWsDout, Standard}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -57,26 +55,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); diff --git a/esp32h2-hal/examples/interrupt_preemption.rs b/esp32h2-hal/examples/interrupt_preemption.rs index fee32d9b5..202ef653f 100644 --- a/esp32h2-hal/examples/interrupt_preemption.rs +++ b/esp32h2-hal/examples/interrupt_preemption.rs @@ -17,8 +17,6 @@ use esp32h2_hal::{ prelude::*, riscv, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -32,27 +30,6 @@ fn main() -> ! { let sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(clockctrl).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32h2-hal/examples/ledc.rs b/esp32h2-hal/examples/ledc.rs index 13c82292f..8c8efc29a 100644 --- a/esp32h2-hal/examples/ledc.rs +++ b/esp32h2-hal/examples/ledc.rs @@ -18,8 +18,6 @@ use esp32h2_hal::{ }, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -29,28 +27,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); diff --git a/esp32h2-hal/examples/mcpwm.rs b/esp32h2-hal/examples/mcpwm.rs index 7eedb2bec..8d335d86a 100644 --- a/esp32h2-hal/examples/mcpwm.rs +++ b/esp32h2-hal/examples/mcpwm.rs @@ -12,8 +12,6 @@ use esp32h2_hal::{ mcpwm::{operator::PwmPinConfig, timer::PwmWorkingMode, PeripheralClockConfig, MCPWM}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -23,28 +21,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let pin = io.pins.gpio4; diff --git a/esp32h2-hal/examples/parl_io_tx.rs b/esp32h2-hal/examples/parl_io_tx.rs index 800fe88f0..16667bf40 100644 --- a/esp32h2-hal/examples/parl_io_tx.rs +++ b/esp32h2-hal/examples/parl_io_tx.rs @@ -25,9 +25,7 @@ use esp32h2_hal::{ }, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -38,26 +36,6 @@ fn main() -> ! { let mut 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 mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut tx_descriptors = [0u32; 8 * 3]; diff --git a/esp32h2-hal/examples/pcnt_encoder.rs b/esp32h2-hal/examples/pcnt_encoder.rs index 946c8bf31..4f560d12f 100644 --- a/esp32h2-hal/examples/pcnt_encoder.rs +++ b/esp32h2-hal/examples/pcnt_encoder.rs @@ -23,8 +23,6 @@ use esp_hal::{ pcnt::{channel, channel::PcntSource, unit, PCNT}, peripherals::{self, Peripherals}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_println::println; @@ -36,29 +34,7 @@ static VALUE: AtomicI32 = AtomicI32::new(0); fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let unit_number = unit::Number::Unit1; diff --git a/esp32h2-hal/examples/qspi_flash.rs b/esp32h2-hal/examples/qspi_flash.rs index 4278c76ce..64d2aef24 100644 --- a/esp32h2-hal/examples/qspi_flash.rs +++ b/esp32h2-hal/examples/qspi_flash.rs @@ -25,9 +25,7 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,27 +36,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio1; let miso = io.pins.gpio2; diff --git a/esp32h2-hal/examples/ram.rs b/esp32h2-hal/examples/ram.rs index 6a0104752..0da401fad 100644 --- a/esp32h2-hal/examples/ram.rs +++ b/esp32h2-hal/examples/ram.rs @@ -14,6 +14,7 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, + Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -34,27 +35,17 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - // Disable MWDT flash boot protection - wdt0.disable(); - wdt1.disable(); - // The RWDT flash boot protection remains enabled and it being triggered is part - // of the example + // The RWDT flash boot protection must be enabled, as it is triggered as part of + // the example. + let mut rtc = Rtc::new(peripherals.LP_CLKRST); + rtc.rwdt.enable(); timer0.start(1u64.secs()); diff --git a/esp32h2-hal/examples/read_efuse.rs b/esp32h2-hal/examples/read_efuse.rs index e8f6e0ea3..b83982d34 100644 --- a/esp32h2-hal/examples/read_efuse.rs +++ b/esp32h2-hal/examples/read_efuse.rs @@ -4,42 +4,15 @@ #![no_std] #![no_main] -use esp32h2_hal::{ - clock::ClockControl, - efuse::Efuse, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32h2_hal::{clock::ClockControl, efuse::Efuse, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let system = peripherals.PCR.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); println!("MAC address {:02x?}", Efuse::get_mac_address()); println!("Flash Encryption {:?}", Efuse::get_flash_encryption()); diff --git a/esp32h2-hal/examples/rmt_rx.rs b/esp32h2-hal/examples/rmt_rx.rs index 842fb3b6d..9263d661a 100644 --- a/esp32h2-hal/examples/rmt_rx.rs +++ b/esp32h2-hal/examples/rmt_rx.rs @@ -12,10 +12,8 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, RxChannel, RxChannelConfig, RxChannelCreator}, - timer::TimerGroup, Delay, Rmt, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -29,19 +27,6 @@ fn main() -> ! { let mut clock_control = system.peripheral_clock_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks, &mut clock_control); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &mut clock_control, &clocks).unwrap(); diff --git a/esp32h2-hal/examples/rmt_tx.rs b/esp32h2-hal/examples/rmt_tx.rs index aeda3b555..e0276c56f 100644 --- a/esp32h2-hal/examples/rmt_tx.rs +++ b/esp32h2-hal/examples/rmt_tx.rs @@ -10,10 +10,8 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, TxChannel, TxChannelConfig, TxChannelCreator}, - timer::TimerGroup, Delay, Rmt, - Rtc, }; use esp_backtrace as _; @@ -24,19 +22,6 @@ fn main() -> ! { let mut clock_control = system.peripheral_clock_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-C6, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks, &mut clock_control); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &mut clock_control, &clocks).unwrap(); diff --git a/esp32h2-hal/examples/rng.rs b/esp32h2-hal/examples/rng.rs index a09253950..2333f7472 100644 --- a/esp32h2-hal/examples/rng.rs +++ b/esp32h2-hal/examples/rng.rs @@ -3,42 +3,15 @@ #![no_std] #![no_main] -use esp32h2_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rng, - Rtc, -}; +use esp32h2_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Rng}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers: - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let system = peripherals.PCR.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Instantiate the Random Number Generator peripheral: let mut rng = Rng::new(peripherals.RNG); diff --git a/esp32h2-hal/examples/rsa.rs b/esp32h2-hal/examples/rsa.rs index 234059bb0..7373befa7 100644 --- a/esp32h2-hal/examples/rsa.rs +++ b/esp32h2-hal/examples/rsa.rs @@ -23,8 +23,6 @@ use esp32h2_hal::{ RsaMultiplication, }, systimer::SystemTimer, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -59,28 +57,7 @@ const fn compute_mprime(modulus: &U512) -> u32 { fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.PCR.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); diff --git a/esp32h2-hal/examples/rtc_time.rs b/esp32h2-hal/examples/rtc_time.rs index 074a9f98b..d49f37888 100644 --- a/esp32h2-hal/examples/rtc_time.rs +++ b/esp32h2-hal/examples/rtc_time.rs @@ -3,43 +3,16 @@ #![no_std] #![no_main] -use esp32h2_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32h2_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay, Rtc}; 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(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - + let rtc = Rtc::new(peripherals.LP_CLKRST); let mut delay = Delay::new(&clocks); loop { diff --git a/esp32h2-hal/examples/serial_interrupts.rs b/esp32h2-hal/examples/serial_interrupts.rs index c793dfa2a..841000b37 100644 --- a/esp32h2-hal/examples/serial_interrupts.rs +++ b/esp32h2-hal/examples/serial_interrupts.rs @@ -17,7 +17,6 @@ use esp32h2_hal::{ timer::TimerGroup, uart::config::AtCmdConfig, Cpu, - Rtc, Uart, }; use esp_backtrace as _; @@ -31,28 +30,14 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); serial0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); serial0.set_rx_fifo_full_threshold(30).unwrap(); serial0.listen_at_cmd(); diff --git a/esp32h2-hal/examples/sha.rs b/esp32h2-hal/examples/sha.rs index eabe010c4..b97213ea8 100644 --- a/esp32h2-hal/examples/sha.rs +++ b/esp32h2-hal/examples/sha.rs @@ -9,8 +9,6 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, sha::{Sha, ShaMode}, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -21,22 +19,10 @@ use sha2::{Digest, Sha256}; fn main() -> ! { let peripherals = Peripherals::take(); let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.swd.disable(); - rtc.rwdt.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); - let mut remaining = source_data.clone(); + let mut remaining = source_data; let mut hasher = Sha::new( peripherals.SHA, ShaMode::SHA256, diff --git a/esp32h2-hal/examples/software_interrupts.rs b/esp32h2-hal/examples/software_interrupts.rs index e21853182..ff3329ad7 100644 --- a/esp32h2-hal/examples/software_interrupts.rs +++ b/esp32h2-hal/examples/software_interrupts.rs @@ -3,7 +3,6 @@ //! An example of how software interrupts can be raised and reset //! Should rotate through all of the available interrupts printing their number //! when raised. - #![no_std] #![no_main] @@ -17,9 +16,7 @@ use esp32h2_hal::{ prelude::*, riscv, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -28,32 +25,11 @@ 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(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32h2-hal/examples/spi_eh1_device_loopback.rs b/esp32h2-hal/examples/spi_eh1_device_loopback.rs index d67027640..e3dbcc5f0 100644 --- a/esp32h2-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32h2-hal/examples/spi_eh1_device_loopback.rs @@ -25,9 +25,7 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiBusController, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,28 +36,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio1; let miso = io.pins.gpio2; diff --git a/esp32h2-hal/examples/spi_eh1_loopback.rs b/esp32h2-hal/examples/spi_eh1_loopback.rs index 6c572d85d..4bb0814a2 100644 --- a/esp32h2-hal/examples/spi_eh1_loopback.rs +++ b/esp32h2-hal/examples/spi_eh1_loopback.rs @@ -23,9 +23,7 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -36,28 +34,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio1; let miso = io.pins.gpio2; diff --git a/esp32h2-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32h2-hal/examples/spi_halfduplex_read_manufacturer_id.rs index 8264ada4f..e42555a8b 100644 --- a/esp32h2-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32h2-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -23,9 +23,7 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, HalfDuplexReadWrite, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -36,27 +34,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio1; let miso = io.pins.gpio2; diff --git a/esp32h2-hal/examples/spi_loopback.rs b/esp32h2-hal/examples/spi_loopback.rs index 29cc6ccc3..bae26f2ae 100644 --- a/esp32h2-hal/examples/spi_loopback.rs +++ b/esp32h2-hal/examples/spi_loopback.rs @@ -22,9 +22,7 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -35,28 +33,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio1; let miso = io.pins.gpio2; diff --git a/esp32h2-hal/examples/spi_loopback_dma.rs b/esp32h2-hal/examples/spi_loopback_dma.rs index 6ec13e644..c1246585d 100644 --- a/esp32h2-hal/examples/spi_loopback_dma.rs +++ b/esp32h2-hal/examples/spi_loopback_dma.rs @@ -24,9 +24,7 @@ use esp32h2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -37,28 +35,6 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio1; let miso = io.pins.gpio2; diff --git a/esp32h2-hal/examples/systimer.rs b/esp32h2-hal/examples/systimer.rs index f7f2de8ea..bbbb8f88e 100644 --- a/esp32h2-hal/examples/systimer.rs +++ b/esp32h2-hal/examples/systimer.rs @@ -14,9 +14,7 @@ use esp32h2_hal::{ peripherals::{self, Peripherals}, prelude::*, systimer::{Alarm, Periodic, SystemTimer, Target}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -28,31 +26,9 @@ static ALARM2: Mutex>>> = Mutex::new(RefCell::ne #[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. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let syst = SystemTimer::new(peripherals.SYSTIMER); println!("SYSTIMER Current value = {}", SystemTimer::now()); diff --git a/esp32h2-hal/examples/timer_interrupt.rs b/esp32h2-hal/examples/timer_interrupt.rs index 0a2d4da7a..2f3f94d55 100644 --- a/esp32h2-hal/examples/timer_interrupt.rs +++ b/esp32h2-hal/examples/timer_interrupt.rs @@ -15,7 +15,6 @@ use esp32h2_hal::{ prelude::*, riscv, timer::{Timer, Timer0, TimerGroup}, - Rtc, }; use esp_backtrace as _; @@ -28,29 +27,19 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-H2, this includes the Super WDT, - // and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.LP_CLKRST); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; + let timer_group1 = TimerGroup::new( peripherals.TIMG1, &clocks, &mut system.peripheral_clock_control, ); let mut timer1 = timer_group1.timer0; - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); interrupt::enable( peripherals::Interrupt::TG0_T0_LEVEL, diff --git a/esp32h2-hal/examples/usb_serial_jtag.rs b/esp32h2-hal/examples/usb_serial_jtag.rs index 0aeede1d7..cbc3c5bea 100644 --- a/esp32h2-hal/examples/usb_serial_jtag.rs +++ b/esp32h2-hal/examples/usb_serial_jtag.rs @@ -16,7 +16,6 @@ use esp32h2_hal::{ riscv, timer::TimerGroup, Cpu, - Rtc, UsbSerialJtag, }; use esp_backtrace as _; @@ -30,26 +29,12 @@ fn main() -> ! { let mut system = peripherals.PCR.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.LP_CLKRST); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE, &mut system.peripheral_clock_control); diff --git a/esp32s2-hal/examples/adc.rs b/esp32s2-hal/examples/adc.rs index 4c6dfd12d..eb5d1ac2f 100644 --- a/esp32s2-hal/examples/adc.rs +++ b/esp32s2-hal/examples/adc.rs @@ -11,9 +11,7 @@ use esp32s2_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -21,23 +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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - // let pin3 = io.pins.gpio3.into_analog(); // Create ADC instances let analog = peripherals.SENS.split(); diff --git a/esp32s2-hal/examples/advanced_serial.rs b/esp32s2-hal/examples/advanced_serial.rs index 6197099a9..2d060ff3c 100644 --- a/esp32s2-hal/examples/advanced_serial.rs +++ b/esp32s2-hal/examples/advanced_serial.rs @@ -15,13 +15,11 @@ use esp32s2_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, uart::{ config::{Config, DataBits, Parity, StopBits}, TxRxPins, }, Delay, - Rtc, Uart, }; use esp_backtrace as _; @@ -34,18 +32,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let config = Config { baudrate: 115200, data_bits: DataBits::DataBits8, diff --git a/esp32s2-hal/examples/aes.rs b/esp32s2-hal/examples/aes.rs index b781cdbf1..37b301cfc 100644 --- a/esp32s2-hal/examples/aes.rs +++ b/esp32s2-hal/examples/aes.rs @@ -11,9 +11,7 @@ use esp32s2_hal::{ clock::ClockControl, peripherals::Peripherals, prelude::*, - timer::TimerGroup, xtensa_lx, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -22,26 +20,7 @@ use esp_println::println; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the RTC and TIMG watchdog timers - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); diff --git a/esp32s2-hal/examples/blinky.rs b/esp32s2-hal/examples/blinky.rs index 2d96ea167..922c6489b 100644 --- a/esp32s2-hal/examples/blinky.rs +++ b/esp32s2-hal/examples/blinky.rs @@ -5,35 +5,15 @@ #![no_std] #![no_main] -use esp32s2_hal::{ - clock::ClockControl, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32s2_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*, Delay}; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - // Set GPIO4 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio4.into_push_pull_output(); diff --git a/esp32s2-hal/examples/blinky_erased_pins.rs b/esp32s2-hal/examples/blinky_erased_pins.rs index 0c31c4a91..2ee4ba9a8 100644 --- a/esp32s2-hal/examples/blinky_erased_pins.rs +++ b/esp32s2-hal/examples/blinky_erased_pins.rs @@ -10,30 +10,16 @@ use esp32s2_hal::{ gpio::{AnyPin, Input, Output, PullDown, PushPull, IO}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - // Set LED GPIOs as an output. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led1 = io.pins.gpio3.into_push_pull_output(); diff --git a/esp32s2-hal/examples/clock_monitor.rs b/esp32s2-hal/examples/clock_monitor.rs index 8f0569529..aff43e7c4 100644 --- a/esp32s2-hal/examples/clock_monitor.rs +++ b/esp32s2-hal/examples/clock_monitor.rs @@ -28,10 +28,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - rtc.rwdt.disable(); - rtc.rwdt.start(2000u64.millis()); rtc.rwdt.listen(); diff --git a/esp32s2-hal/examples/crc.rs b/esp32s2-hal/examples/crc.rs index 1c2b944a9..3801f4290 100644 --- a/esp32s2-hal/examples/crc.rs +++ b/esp32s2-hal/examples/crc.rs @@ -11,7 +11,6 @@ use esp32s2_hal::{ prelude::*, rom::{crc, md5}, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -29,13 +28,8 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); timer0.start(1u64.secs()); diff --git a/esp32s2-hal/examples/dac.rs b/esp32s2-hal/examples/dac.rs index 1e1b26efb..1f1874987 100644 --- a/esp32s2-hal/examples/dac.rs +++ b/esp32s2-hal/examples/dac.rs @@ -11,30 +11,16 @@ use esp32s2_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let pin17 = io.pins.gpio17.into_analog(); let pin18 = io.pins.gpio18.into_analog(); diff --git a/esp32s2-hal/examples/embassy_hello_world.rs b/esp32s2-hal/examples/embassy_hello_world.rs index ab567c3cc..0683602ed 100644 --- a/esp32s2-hal/examples/embassy_hello_world.rs +++ b/esp32s2-hal/examples/embassy_hello_world.rs @@ -13,8 +13,6 @@ use esp32s2_hal::{ embassy::{self, executor::Executor}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use static_cell::make_static; @@ -43,27 +41,15 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let executor = make_static!(Executor::new()); executor.run(|spawner| { diff --git a/esp32s2-hal/examples/embassy_i2c.rs b/esp32s2-hal/examples/embassy_i2c.rs index af2b26bc4..f3da61566 100644 --- a/esp32s2-hal/examples/embassy_i2c.rs +++ b/esp32s2-hal/examples/embassy_i2c.rs @@ -22,8 +22,6 @@ use esp32s2_hal::{ interrupt, peripherals::{Interrupt, Peripherals, I2C0}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -49,20 +47,15 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32s2-hal/examples/embassy_multiprio.rs b/esp32s2-hal/examples/embassy_multiprio.rs index ee78d6add..ec48b3ca6 100644 --- a/esp32s2-hal/examples/embassy_multiprio.rs +++ b/esp32s2-hal/examples/embassy_multiprio.rs @@ -18,8 +18,6 @@ use esp32s2_hal::{ interrupt::Priority, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_hal_common::get_core; @@ -86,28 +84,18 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable watchdog timers - rtc.rwdt.disable(); - timer_group0.wdt.disable(); - timer_group1.wdt.disable(); - // Set GPIO2 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let led = make_static!(io.pins.gpio0.into_push_pull_output()); diff --git a/esp32s2-hal/examples/embassy_serial.rs b/esp32s2-hal/examples/embassy_serial.rs index f02d9f954..d7812a6d4 100644 --- a/esp32s2-hal/examples/embassy_serial.rs +++ b/esp32s2-hal/examples/embassy_serial.rs @@ -16,8 +16,6 @@ use esp32s2_hal::{ interrupt, peripherals::{Interrupt, Peripherals, UART0}, prelude::*, - timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -107,27 +105,15 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); diff --git a/esp32s2-hal/examples/embassy_spi.rs b/esp32s2-hal/examples/embassy_spi.rs index 89669d901..3019ca021 100644 --- a/esp32s2-hal/examples/embassy_spi.rs +++ b/esp32s2-hal/examples/embassy_spi.rs @@ -27,8 +27,6 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, spi::{dma::SpiDma, FullDuplexMode, Spi, SpiMode}, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -57,33 +55,15 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - - #[cfg(feature = "embassy-time-systick")] - embassy::init( - &clocks, - esp32s2_hal::systimer::SystemTimer::new(peripherals.SYSTIMER), - ); - #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } esp32s2_hal::interrupt::enable( esp32s2_hal::peripherals::Interrupt::SPI2_DMA, diff --git a/esp32s2-hal/examples/embassy_wait.rs b/esp32s2-hal/examples/embassy_wait.rs index 5a68e1ae0..2f3cf0de6 100644 --- a/esp32s2-hal/examples/embassy_wait.rs +++ b/esp32s2-hal/examples/embassy_wait.rs @@ -14,8 +14,6 @@ use esp32s2_hal::{ gpio::{Gpio0, Input, PullDown}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -38,27 +36,15 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s2_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // GPIO 0 as input diff --git a/esp32s2-hal/examples/gpio_interrupt.rs b/esp32s2-hal/examples/gpio_interrupt.rs index 37cfa7647..d40012a2e 100644 --- a/esp32s2-hal/examples/gpio_interrupt.rs +++ b/esp32s2-hal/examples/gpio_interrupt.rs @@ -17,10 +17,8 @@ use esp32s2_hal::{ macros::ram, peripherals::{self, Peripherals}, prelude::*, - timer::TimerGroup, xtensa_lx, Delay, - Rtc, }; use esp_backtrace as _; @@ -29,22 +27,9 @@ static BUTTON: Mutex>>>> = Mutex::new(RefCe #[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 mut wdt = timer_group0.wdt; - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - // Set GPIO15 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio15.into_push_pull_output(); diff --git a/esp32s2-hal/examples/hello_rgb.rs b/esp32s2-hal/examples/hello_rgb.rs index eaedb785b..26f987e8d 100644 --- a/esp32s2-hal/examples/hello_rgb.rs +++ b/esp32s2-hal/examples/hello_rgb.rs @@ -11,16 +11,7 @@ #![no_std] #![no_main] -use esp32s2_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - rmt::Rmt, - timer::TimerGroup, - Delay, - Rtc, - IO, -}; +use esp32s2_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, rmt::Rmt, Delay, IO}; use esp_backtrace as _; use esp_hal_smartled::{smartLedAdapter, SmartLedsAdapter}; use smart_leds::{ @@ -36,17 +27,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - timer_group0.wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally diff --git a/esp32s2-hal/examples/hello_world.rs b/esp32s2-hal/examples/hello_world.rs index 171ee27ad..9a7977770 100644 --- a/esp32s2-hal/examples/hello_world.rs +++ b/esp32s2-hal/examples/hello_world.rs @@ -11,7 +11,6 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -29,13 +28,8 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); timer0.start(1u64.secs()); diff --git a/esp32s2-hal/examples/hmac.rs b/esp32s2-hal/examples/hmac.rs index 29411b128..c99ebb20f 100644 --- a/esp32s2-hal/examples/hmac.rs +++ b/esp32s2-hal/examples/hmac.rs @@ -61,9 +61,7 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, systimer::SystemTimer, - timer::TimerGroup, Rng, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -77,23 +75,10 @@ type HmacSha256 = HmacSw; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the RTC and TIMG watchdog timers - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); - // Disable MWDT and RWDT (Watchdog) flash boot protection - rtc.rwdt.disable(); - wdt.disable(); - // Set sw key let key = [0_u8; 32].as_ref(); diff --git a/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs b/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs index b3a9348e7..ab3d7b0a3 100644 --- a/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs @@ -9,15 +9,7 @@ #![no_std] #![no_main] -use esp32s2_hal::{ - clock::ClockControl, - gpio::IO, - i2c::I2C, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32s2_hal::{clock::ClockControl, gpio::IO, i2c::I2C, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; @@ -27,18 +19,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create a new peripheral object with the described wiring diff --git a/esp32s2-hal/examples/i2c_display.rs b/esp32s2-hal/examples/i2c_display.rs index d97463582..6ea7edacd 100644 --- a/esp32s2-hal/examples/i2c_display.rs +++ b/esp32s2-hal/examples/i2c_display.rs @@ -26,7 +26,6 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use nb::block; @@ -45,12 +44,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32s2-hal/examples/i2s_read.rs b/esp32s2-hal/examples/i2s_read.rs index b860ab7a8..8d2dad5af 100644 --- a/esp32s2-hal/examples/i2s_read.rs +++ b/esp32s2-hal/examples/i2s_read.rs @@ -20,8 +20,6 @@ use esp32s2_hal::{ pdma::Dma, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -33,18 +31,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); diff --git a/esp32s2-hal/examples/i2s_sound.rs b/esp32s2-hal/examples/i2s_sound.rs index 48dbbe603..2964cd4c8 100644 --- a/esp32s2-hal/examples/i2s_sound.rs +++ b/esp32s2-hal/examples/i2s_sound.rs @@ -37,8 +37,6 @@ use esp32s2_hal::{ pdma::Dma, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -57,18 +55,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Dma::new(system.dma, &mut system.peripheral_clock_control); diff --git a/esp32s2-hal/examples/ledc.rs b/esp32s2-hal/examples/ledc.rs index 7c8318f98..57cce859f 100644 --- a/esp32s2-hal/examples/ledc.rs +++ b/esp32s2-hal/examples/ledc.rs @@ -18,8 +18,6 @@ use esp32s2_hal::{ }, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use xtensa_atomic_emulation_trap as _; @@ -30,18 +28,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); diff --git a/esp32s2-hal/examples/pcnt_encoder.rs b/esp32s2-hal/examples/pcnt_encoder.rs index 4400a4895..0cff5c1c4 100644 --- a/esp32s2-hal/examples/pcnt_encoder.rs +++ b/esp32s2-hal/examples/pcnt_encoder.rs @@ -23,8 +23,6 @@ use esp_hal::{ pcnt::{channel, channel::PcntSource, unit, PCNT}, peripherals::{self, Peripherals}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_println::println; @@ -36,21 +34,10 @@ static VALUE: AtomicI32 = AtomicI32::new(0); fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let unit_number = unit::Number::Unit1; // setup a pulse couter diff --git a/esp32s2-hal/examples/psram.rs b/esp32s2-hal/examples/psram.rs index 6896e67f6..a8ae0b140 100644 --- a/esp32s2-hal/examples/psram.rs +++ b/esp32s2-hal/examples/psram.rs @@ -5,14 +5,7 @@ #![no_std] #![no_main] -use esp32s2_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - psram, - timer::TimerGroup, - Rtc, -}; +use esp32s2_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, psram}; use esp_backtrace as _; use esp_println::println; @@ -36,18 +29,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - println!("Going to access PSRAM"); let mut large_vec: alloc::vec::Vec = alloc::vec::Vec::with_capacity(500 * 1024 / 4); diff --git a/esp32s2-hal/examples/qspi_flash.rs b/esp32s2-hal/examples/qspi_flash.rs index 6e9cacf64..10f0d8b1d 100644 --- a/esp32s2-hal/examples/qspi_flash.rs +++ b/esp32s2-hal/examples/qspi_flash.rs @@ -25,9 +25,7 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,26 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S2, this includes - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio4; let miso = io.pins.gpio5; diff --git a/esp32s2-hal/examples/ram.rs b/esp32s2-hal/examples/ram.rs index 00d152c69..bc3fa0092 100644 --- a/esp32s2-hal/examples/ram.rs +++ b/esp32s2-hal/examples/ram.rs @@ -14,6 +14,7 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, + Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -40,12 +41,11 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - // Disable MWDT flash boot protection - wdt.disable(); - // The RWDT flash boot protection remains enabled and it being triggered is part - // of the example + // The RWDT flash boot protection must be enabled, as it is triggered as part of + // the example. + let mut rtc = Rtc::new(peripherals.RTC_CNTL); + rtc.rwdt.enable(); timer0.start(1u64.secs()); diff --git a/esp32s2-hal/examples/read_efuse.rs b/esp32s2-hal/examples/read_efuse.rs index 64392aa82..fb9f28b04 100644 --- a/esp32s2-hal/examples/read_efuse.rs +++ b/esp32s2-hal/examples/read_efuse.rs @@ -4,34 +4,16 @@ #![no_std] #![no_main] -use esp32s2_hal::{ - clock::ClockControl, - efuse::Efuse, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32s2_hal::{clock::ClockControl, efuse::Efuse, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); + 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); println!("MAC address {:02x?}", Efuse::get_mac_address()); println!("Flash Encryption {:?}", Efuse::get_flash_encryption()); diff --git a/esp32s2-hal/examples/rmt_rx.rs b/esp32s2-hal/examples/rmt_rx.rs index abf2c5e65..0e8d19629 100644 --- a/esp32s2-hal/examples/rmt_rx.rs +++ b/esp32s2-hal/examples/rmt_rx.rs @@ -10,10 +10,8 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, RxChannel, RxChannelConfig, RxChannelCreator}, - timer::TimerGroup, Delay, Rmt, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -25,14 +23,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut clock_control = system.peripheral_clock_control; - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut out = io.pins.gpio15.into_push_pull_output(); diff --git a/esp32s2-hal/examples/rmt_tx.rs b/esp32s2-hal/examples/rmt_tx.rs index 519bca85f..9b8de158e 100644 --- a/esp32s2-hal/examples/rmt_tx.rs +++ b/esp32s2-hal/examples/rmt_tx.rs @@ -10,10 +10,8 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, TxChannel, TxChannelConfig, TxChannelCreator}, - timer::TimerGroup, Delay, Rmt, - Rtc, }; use esp_backtrace as _; @@ -24,14 +22,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut clock_control = system.peripheral_clock_control; - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut delay = Delay::new(&clocks); diff --git a/esp32s2-hal/examples/rng.rs b/esp32s2-hal/examples/rng.rs index 98b4919ee..0b49de22c 100644 --- a/esp32s2-hal/examples/rng.rs +++ b/esp32s2-hal/examples/rng.rs @@ -3,34 +3,15 @@ #![no_std] #![no_main] -use esp32s2_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rng, - Rtc, -}; +use esp32s2_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Rng}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection: - wdt.disable(); - rtc.rwdt.disable(); + let system = peripherals.SYSTEM.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Instantiate the Random Number Generator peripheral: let mut rng = Rng::new(peripherals.RNG); diff --git a/esp32s2-hal/examples/rsa.rs b/esp32s2-hal/examples/rsa.rs index 33504c473..132dba20d 100644 --- a/esp32s2-hal/examples/rsa.rs +++ b/esp32s2-hal/examples/rsa.rs @@ -22,9 +22,7 @@ use esp32s2_hal::{ RsaModularMultiplication, RsaMultiplication, }, - timer::TimerGroup, xtensa_lx, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -59,26 +57,8 @@ const fn compute_mprime(modulus: &U512) -> u32 { fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the RTC and TIMG watchdog timers - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); block!(rsa.ready()).unwrap(); diff --git a/esp32s2-hal/examples/rtc_time.rs b/esp32s2-hal/examples/rtc_time.rs index 8f55da63f..6f1635839 100644 --- a/esp32s2-hal/examples/rtc_time.rs +++ b/esp32s2-hal/examples/rtc_time.rs @@ -3,34 +3,16 @@ #![no_std] #![no_main] -use esp32s2_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32s2_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay, Rtc}; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - + let rtc = Rtc::new(peripherals.RTC_CNTL); let mut delay = Delay::new(&clocks); loop { diff --git a/esp32s2-hal/examples/serial_interrupts.rs b/esp32s2-hal/examples/serial_interrupts.rs index 4d2ce4e16..4287467d0 100644 --- a/esp32s2-hal/examples/serial_interrupts.rs +++ b/esp32s2-hal/examples/serial_interrupts.rs @@ -15,7 +15,6 @@ use esp32s2_hal::{ prelude::*, timer::TimerGroup, uart::config::AtCmdConfig, - Rtc, Uart, }; use esp_backtrace as _; @@ -36,23 +35,8 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt0.disable(); - wdt1.disable(); - rtc.rwdt.disable(); - serial0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); serial0.set_rx_fifo_full_threshold(30).unwrap(); serial0.listen_at_cmd(); diff --git a/esp32s2-hal/examples/sha.rs b/esp32s2-hal/examples/sha.rs index ca228bb36..e6185c324 100644 --- a/esp32s2-hal/examples/sha.rs +++ b/esp32s2-hal/examples/sha.rs @@ -9,9 +9,7 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, sha::{Sha, ShaMode}, - timer::TimerGroup, xtensa_lx, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -22,19 +20,7 @@ use sha2::{Digest, Sha512}; fn main() -> ! { let peripherals = Peripherals::take(); let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); let mut remaining = source_data.clone(); diff --git a/esp32s2-hal/examples/software_interrupts.rs b/esp32s2-hal/examples/software_interrupts.rs index 71b889a95..bc13b6d05 100644 --- a/esp32s2-hal/examples/software_interrupts.rs +++ b/esp32s2-hal/examples/software_interrupts.rs @@ -16,9 +16,7 @@ use esp32s2_hal::{ peripherals::{self, Peripherals}, prelude::*, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -27,22 +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 sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32s2-hal/examples/spi_eh1_device_loopback.rs b/esp32s2-hal/examples/spi_eh1_device_loopback.rs index ee96d6672..f949b4ebb 100644 --- a/esp32s2-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32s2-hal/examples/spi_eh1_device_loopback.rs @@ -25,9 +25,7 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiBusController, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,19 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S2, this includes the RTC WDT, and - // the TIMG WDT. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio36; let miso = io.pins.gpio37; diff --git a/esp32s2-hal/examples/spi_eh1_loopback.rs b/esp32s2-hal/examples/spi_eh1_loopback.rs index bc1bb5362..e84fc399f 100644 --- a/esp32s2-hal/examples/spi_eh1_loopback.rs +++ b/esp32s2-hal/examples/spi_eh1_loopback.rs @@ -23,9 +23,7 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -36,19 +34,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S2, this includes the RTC WDT, and - // the TIMG WDT. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio36; let miso = io.pins.gpio37; diff --git a/esp32s2-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32s2-hal/examples/spi_halfduplex_read_manufacturer_id.rs index bc3a562e3..6f36ff26b 100644 --- a/esp32s2-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32s2-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -23,9 +23,7 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, HalfDuplexReadWrite, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -36,26 +34,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S2, this includes - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio4; let miso = io.pins.gpio5; diff --git a/esp32s2-hal/examples/spi_loopback.rs b/esp32s2-hal/examples/spi_loopback.rs index 5a2b4dcae..8e090d524 100644 --- a/esp32s2-hal/examples/spi_loopback.rs +++ b/esp32s2-hal/examples/spi_loopback.rs @@ -22,9 +22,7 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -35,19 +33,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S2, this includes the RTC WDT, and - // the TIMG WDT. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio36; let miso = io.pins.gpio37; diff --git a/esp32s2-hal/examples/spi_loopback_dma.rs b/esp32s2-hal/examples/spi_loopback_dma.rs index c688432f4..234728346 100644 --- a/esp32s2-hal/examples/spi_loopback_dma.rs +++ b/esp32s2-hal/examples/spi_loopback_dma.rs @@ -24,9 +24,7 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -37,19 +35,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S2, this includes the RTC WDT, and - // the TIMG WDT. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio36; let miso = io.pins.gpio37; diff --git a/esp32s2-hal/examples/systimer.rs b/esp32s2-hal/examples/systimer.rs index 940765233..4c21c2ad5 100644 --- a/esp32s2-hal/examples/systimer.rs +++ b/esp32s2-hal/examples/systimer.rs @@ -14,9 +14,7 @@ use esp32s2_hal::{ peripherals::{self, Peripherals}, prelude::*, systimer::{Alarm, Periodic, SystemTimer, Target}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -28,21 +26,9 @@ static ALARM2: Mutex>>> = Mutex::new(RefCell::ne #[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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let syst = SystemTimer::new(peripherals.SYSTIMER); println!("SYSTIMER Current value = {}", SystemTimer::now()); diff --git a/esp32s2-hal/examples/timer_interrupt.rs b/esp32s2-hal/examples/timer_interrupt.rs index 51e18827c..b8041b102 100644 --- a/esp32s2-hal/examples/timer_interrupt.rs +++ b/esp32s2-hal/examples/timer_interrupt.rs @@ -15,7 +15,6 @@ use esp32s2_hal::{ peripherals::{self, Peripherals, TIMG0, TIMG1}, prelude::*, timer::{Timer, Timer0, Timer1, TimerGroup}, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -39,7 +38,6 @@ fn main() -> ! { ); let mut timer00 = timer_group0.timer0; let mut timer01 = timer_group0.timer1; - let mut wdt0 = timer_group0.wdt; let timer_group1 = TimerGroup::new( peripherals.TIMG1, @@ -48,19 +46,12 @@ fn main() -> ! { ); let mut timer10 = timer_group1.timer0; let mut timer11 = timer_group1.timer1; - let mut wdt1 = timer_group1.wdt; - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt0.disable(); - wdt1.disable(); - rtc.rwdt.disable(); interrupt::enable(peripherals::Interrupt::TG0_T0_LEVEL, Priority::Priority2).unwrap(); interrupt::enable(peripherals::Interrupt::TG0_T1_LEVEL, Priority::Priority2).unwrap(); interrupt::enable(peripherals::Interrupt::TG1_T0_LEVEL, Priority::Priority3).unwrap(); interrupt::enable(peripherals::Interrupt::TG1_T1_LEVEL, Priority::Priority3).unwrap(); + timer00.start(500u64.millis()); timer00.listen(); timer01.start(2500u64.millis()); diff --git a/esp32s2-hal/examples/ulp_riscv_core_basic.rs b/esp32s2-hal/examples/ulp_riscv_core_basic.rs index 02cd16098..8e97dce25 100644 --- a/esp32s2-hal/examples/ulp_riscv_core_basic.rs +++ b/esp32s2-hal/examples/ulp_riscv_core_basic.rs @@ -6,13 +6,7 @@ #![no_std] #![no_main] -use esp32s2_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32s2_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; @@ -37,20 +31,8 @@ const CODE: &[u8] = &[ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let system = peripherals.SYSTEM.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut ulp_core = esp32s2_hal::ulp_core::UlpCore::new(peripherals.ULP_RISCV_CORE); diff --git a/esp32s2-hal/examples/usb_serial.rs b/esp32s2-hal/examples/usb_serial.rs index 58bafa9b1..5fabe4f02 100644 --- a/esp32s2-hal/examples/usb_serial.rs +++ b/esp32s2-hal/examples/usb_serial.rs @@ -10,8 +10,6 @@ use esp32s2_hal::{ otg_fs::{UsbBus, USB}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -23,19 +21,7 @@ static mut EP_MEMORY: [u32; 1024] = [0; 1024]; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::configure(system.clock_control, CpuClock::Clock240MHz).freeze(); - - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let _clocks = ClockControl::configure(system.clock_control, CpuClock::Clock240MHz).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32s3-hal/examples/adc.rs b/esp32s3-hal/examples/adc.rs index d5a046e11..8b6a19ec5 100644 --- a/esp32s3-hal/examples/adc.rs +++ b/esp32s3-hal/examples/adc.rs @@ -11,9 +11,7 @@ use esp32s3_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -21,21 +19,9 @@ 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create ADC instances diff --git a/esp32s3-hal/examples/adc_cal.rs b/esp32s3-hal/examples/adc_cal.rs index 6df866081..e128b67fd 100644 --- a/esp32s3-hal/examples/adc_cal.rs +++ b/esp32s3-hal/examples/adc_cal.rs @@ -11,9 +11,7 @@ use esp32s3_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -21,21 +19,9 @@ 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create ADC instances diff --git a/esp32s3-hal/examples/advanced_serial.rs b/esp32s3-hal/examples/advanced_serial.rs index 00bad4e14..2c7d16aad 100644 --- a/esp32s3-hal/examples/advanced_serial.rs +++ b/esp32s3-hal/examples/advanced_serial.rs @@ -15,13 +15,11 @@ use esp32s3_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, - timer::TimerGroup, uart::{ config::{Config, DataBits, Parity, StopBits}, TxRxPins, }, Delay, - Rtc, Uart, }; use esp_backtrace as _; @@ -34,18 +32,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let config = Config { baudrate: 115200, data_bits: DataBits::DataBits8, diff --git a/esp32s3-hal/examples/aes.rs b/esp32s3-hal/examples/aes.rs index 0702d21bd..73ecda731 100644 --- a/esp32s3-hal/examples/aes.rs +++ b/esp32s3-hal/examples/aes.rs @@ -11,9 +11,7 @@ use esp32s3_hal::{ clock::ClockControl, peripherals::Peripherals, prelude::*, - timer::TimerGroup, xtensa_lx, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -22,26 +20,7 @@ use esp_println::println; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the RTC and TIMG watchdog timers - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut aes = Aes::new(peripherals.AES, &mut system.peripheral_clock_control); diff --git a/esp32s3-hal/examples/blinky.rs b/esp32s3-hal/examples/blinky.rs index c459d797b..9502bb199 100644 --- a/esp32s3-hal/examples/blinky.rs +++ b/esp32s3-hal/examples/blinky.rs @@ -5,35 +5,15 @@ #![no_std] #![no_main] -use esp32s3_hal::{ - clock::ClockControl, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32s3_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*, Delay}; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - // Set GPIO4 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio4.into_push_pull_output(); diff --git a/esp32s3-hal/examples/blinky_erased_pins.rs b/esp32s3-hal/examples/blinky_erased_pins.rs index 5108df3e5..d7b6256a3 100644 --- a/esp32s3-hal/examples/blinky_erased_pins.rs +++ b/esp32s3-hal/examples/blinky_erased_pins.rs @@ -10,30 +10,16 @@ use esp32s3_hal::{ gpio::{AnyPin, Input, Output, PullDown, PushPull, IO}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, Delay, - Rtc, }; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - // Set LED GPIOs as an output. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led1 = io.pins.gpio3.into_push_pull_output(); diff --git a/esp32s3-hal/examples/clock_monitor.rs b/esp32s3-hal/examples/clock_monitor.rs index 6f14b4ddf..b8838b51e 100644 --- a/esp32s3-hal/examples/clock_monitor.rs +++ b/esp32s3-hal/examples/clock_monitor.rs @@ -27,10 +27,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - rtc.rwdt.disable(); - rtc.rwdt.start(2000u64.millis()); rtc.rwdt.listen(); diff --git a/esp32s3-hal/examples/crc.rs b/esp32s3-hal/examples/crc.rs index 71d6b4f78..7808617a6 100644 --- a/esp32s3-hal/examples/crc.rs +++ b/esp32s3-hal/examples/crc.rs @@ -11,7 +11,6 @@ use esp32s3_hal::{ prelude::*, rom::{crc, md5}, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -29,13 +28,8 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); timer0.start(1u64.secs()); diff --git a/esp32s3-hal/examples/debug_assist.rs b/esp32s3-hal/examples/debug_assist.rs index c3c9a768a..fd72beb1d 100644 --- a/esp32s3-hal/examples/debug_assist.rs +++ b/esp32s3-hal/examples/debug_assist.rs @@ -14,8 +14,6 @@ use esp32s3_hal::{ interrupt, peripherals::{self, Peripherals}, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -26,19 +24,7 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); fn main() -> ! { let peripherals = Peripherals::take(); let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut da = DebugAssist::new( peripherals.ASSIST_DEBUG, diff --git a/esp32s3-hal/examples/embassy_hello_world.rs b/esp32s3-hal/examples/embassy_hello_world.rs index 0312bf36b..e006e122e 100644 --- a/esp32s3-hal/examples/embassy_hello_world.rs +++ b/esp32s3-hal/examples/embassy_hello_world.rs @@ -13,8 +13,6 @@ use esp32s3_hal::{ embassy::{self, executor::Executor}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use static_cell::make_static; @@ -42,26 +40,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -69,7 +47,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let executor = make_static!(Executor::new()); executor.run(|spawner| { diff --git a/esp32s3-hal/examples/embassy_i2c.rs b/esp32s3-hal/examples/embassy_i2c.rs index cfe75b87c..69ab93b6c 100644 --- a/esp32s3-hal/examples/embassy_i2c.rs +++ b/esp32s3-hal/examples/embassy_i2c.rs @@ -22,8 +22,6 @@ use esp32s3_hal::{ interrupt, peripherals::{Interrupt, Peripherals, I2C0}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -49,18 +47,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -68,7 +54,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32s3-hal/examples/embassy_multicore.rs b/esp32s3-hal/examples/embassy_multicore.rs index b34cd005e..c1f84ffab 100644 --- a/esp32s3-hal/examples/embassy_multicore.rs +++ b/esp32s3-hal/examples/embassy_multicore.rs @@ -15,8 +15,6 @@ use esp32s3_hal::{ gpio::{GpioPin, Output, PushPull, IO}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_hal_common::get_core; @@ -69,23 +67,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable watchdog timers - rtc.rwdt.disable(); - timer_group0.wdt.disable(); - timer_group1.wdt.disable(); - // Set GPIO2 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -96,7 +77,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let mut cpu_control = CpuControl::new(system.cpu_control); diff --git a/esp32s3-hal/examples/embassy_multicore_interrupt.rs b/esp32s3-hal/examples/embassy_multicore_interrupt.rs index 4c00f80f7..e74daa7e5 100644 --- a/esp32s3-hal/examples/embassy_multicore_interrupt.rs +++ b/esp32s3-hal/examples/embassy_multicore_interrupt.rs @@ -19,8 +19,6 @@ use esp32s3_hal::{ interrupt::Priority, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_hal_common::get_core; @@ -86,23 +84,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable watchdog timers - rtc.rwdt.disable(); - timer_group0.wdt.disable(); - timer_group1.wdt.disable(); - // Set GPIO2 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -113,7 +94,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let mut cpu_control = CpuControl::new(system.cpu_control); diff --git a/esp32s3-hal/examples/embassy_multiprio.rs b/esp32s3-hal/examples/embassy_multiprio.rs index df0bc4050..a14893694 100644 --- a/esp32s3-hal/examples/embassy_multiprio.rs +++ b/esp32s3-hal/examples/embassy_multiprio.rs @@ -18,8 +18,6 @@ use esp32s3_hal::{ interrupt::Priority, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_hal_common::get_core; @@ -86,23 +84,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable watchdog timers - rtc.rwdt.disable(); - timer_group0.wdt.disable(); - timer_group1.wdt.disable(); - // Set GPIO2 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); @@ -113,7 +94,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let led = make_static!(io.pins.gpio0.into_push_pull_output()); diff --git a/esp32s3-hal/examples/embassy_serial.rs b/esp32s3-hal/examples/embassy_serial.rs index a02db744d..128e58f94 100644 --- a/esp32s3-hal/examples/embassy_serial.rs +++ b/esp32s3-hal/examples/embassy_serial.rs @@ -16,8 +16,6 @@ use esp32s3_hal::{ interrupt, peripherals::{Interrupt, Peripherals, UART0}, prelude::*, - timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -107,26 +105,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -134,7 +112,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let mut uart0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); uart0.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); diff --git a/esp32s3-hal/examples/embassy_spi.rs b/esp32s3-hal/examples/embassy_spi.rs index 159836862..5ab99ed67 100644 --- a/esp32s3-hal/examples/embassy_spi.rs +++ b/esp32s3-hal/examples/embassy_spi.rs @@ -27,8 +27,6 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, spi::{dma::SpiDma, FullDuplexMode, Spi, SpiMode}, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -59,26 +57,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -86,7 +64,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } esp32s3_hal::interrupt::enable( esp32s3_hal::peripherals::Interrupt::DMA_IN_CH0, diff --git a/esp32s3-hal/examples/embassy_wait.rs b/esp32s3-hal/examples/embassy_wait.rs index e8389cc17..868f91f54 100644 --- a/esp32s3-hal/examples/embassy_wait.rs +++ b/esp32s3-hal/examples/embassy_wait.rs @@ -14,8 +14,6 @@ use esp32s3_hal::{ gpio::{Gpio0, Input, PullDown}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -38,26 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - #[cfg(feature = "embassy-time-systick")] embassy::init( &clocks, @@ -65,7 +43,14 @@ fn main() -> ! { ); #[cfg(feature = "embassy-time-timg0")] - embassy::init(&clocks, timer_group0.timer0); + { + let timer_group0 = esp32s3_hal::timer::TimerGroup::new( + peripherals.TIMG0, + &clocks, + &mut system.peripheral_clock_control, + ); + embassy::init(&clocks, timer_group0.timer0); + } let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // GPIO 0 as input diff --git a/esp32s3-hal/examples/gpio_interrupt.rs b/esp32s3-hal/examples/gpio_interrupt.rs index 1c6496f93..fd40f43cd 100644 --- a/esp32s3-hal/examples/gpio_interrupt.rs +++ b/esp32s3-hal/examples/gpio_interrupt.rs @@ -16,10 +16,8 @@ use esp32s3_hal::{ macros::ram, peripherals::{self, Peripherals}, prelude::*, - timer::TimerGroup, xtensa_lx, Delay, - Rtc, }; use esp_backtrace as _; @@ -28,22 +26,9 @@ static BUTTON: Mutex>>>> = Mutex::new(RefCe #[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 mut wdt = timer_group0.wdt; - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - // Set GPIO15 as an output, and set its state high initially. let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut led = io.pins.gpio15.into_push_pull_output(); diff --git a/esp32s3-hal/examples/hello_rgb.rs b/esp32s3-hal/examples/hello_rgb.rs index c2089bef0..3b77ad5a9 100644 --- a/esp32s3-hal/examples/hello_rgb.rs +++ b/esp32s3-hal/examples/hello_rgb.rs @@ -11,16 +11,7 @@ #![no_std] #![no_main] -use esp32s3_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - rmt::Rmt, - timer::TimerGroup, - Delay, - Rtc, - IO, -}; +use esp32s3_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, rmt::Rmt, Delay, IO}; use esp_backtrace as _; use esp_hal_smartled::{smartLedAdapter, SmartLedsAdapter}; use smart_leds::{ @@ -36,17 +27,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - timer_group0.wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Configure RMT peripheral globally diff --git a/esp32s3-hal/examples/hello_world.rs b/esp32s3-hal/examples/hello_world.rs index a0271fbec..6be78abc5 100644 --- a/esp32s3-hal/examples/hello_world.rs +++ b/esp32s3-hal/examples/hello_world.rs @@ -11,7 +11,6 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, Uart, }; use esp_backtrace as _; @@ -29,13 +28,8 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); timer0.start(1u64.secs()); diff --git a/esp32s3-hal/examples/hmac.rs b/esp32s3-hal/examples/hmac.rs index d45c2b648..21a548492 100644 --- a/esp32s3-hal/examples/hmac.rs +++ b/esp32s3-hal/examples/hmac.rs @@ -61,9 +61,7 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, systimer::SystemTimer, - timer::TimerGroup, Rng, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -77,23 +75,10 @@ type HmacSha256 = HmacSw; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - - // Disable the RTC and TIMG watchdog timers - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); - // Disable MWDT and RWDT (Watchdog) flash boot protection - rtc.rwdt.disable(); - wdt.disable(); - // Set sw key let key = [0_u8; 32].as_ref(); diff --git a/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs b/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs index cf34694ea..980c6ebbb 100644 --- a/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs @@ -9,15 +9,7 @@ #![no_std] #![no_main] -use esp32s3_hal::{ - clock::ClockControl, - gpio::IO, - i2c::I2C, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32s3_hal::{clock::ClockControl, gpio::IO, i2c::I2C, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; @@ -27,18 +19,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Create a new peripheral object with the described wiring diff --git a/esp32s3-hal/examples/i2c_display.rs b/esp32s3-hal/examples/i2c_display.rs index 116e428b9..be9e8e074 100644 --- a/esp32s3-hal/examples/i2c_display.rs +++ b/esp32s3-hal/examples/i2c_display.rs @@ -26,7 +26,6 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use nb::block; @@ -44,12 +43,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32s3-hal/examples/i2s_read.rs b/esp32s3-hal/examples/i2s_read.rs index 8af3935b5..f63fc6d65 100644 --- a/esp32s3-hal/examples/i2s_read.rs +++ b/esp32s3-hal/examples/i2s_read.rs @@ -22,8 +22,6 @@ use esp32s3_hal::{ i2s::{DataFormat, I2s, I2s0New, I2sReadDma, MclkPin, PinsBclkWsDin, Standard}, peripherals::{Peripherals, I2S0}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -36,26 +34,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); diff --git a/esp32s3-hal/examples/i2s_sound.rs b/esp32s3-hal/examples/i2s_sound.rs index 412a129dd..b1cc83dbb 100644 --- a/esp32s3-hal/examples/i2s_sound.rs +++ b/esp32s3-hal/examples/i2s_sound.rs @@ -37,8 +37,6 @@ use esp32s3_hal::{ i2s::{DataFormat, I2s, I2s0New, I2sWriteDma, MclkPin, PinsBclkWsDout, Standard}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -57,26 +55,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - // Disable watchdog timers - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let dma = Gdma::new(peripherals.DMA, &mut system.peripheral_clock_control); diff --git a/esp32s3-hal/examples/ledc.rs b/esp32s3-hal/examples/ledc.rs index 203153ae9..988b2fdd3 100644 --- a/esp32s3-hal/examples/ledc.rs +++ b/esp32s3-hal/examples/ledc.rs @@ -18,8 +18,6 @@ use esp32s3_hal::{ }, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -29,18 +27,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let led = io.pins.gpio4.into_push_pull_output(); diff --git a/esp32s3-hal/examples/mcpwm.rs b/esp32s3-hal/examples/mcpwm.rs index 8796253d7..211202a9d 100644 --- a/esp32s3-hal/examples/mcpwm.rs +++ b/esp32s3-hal/examples/mcpwm.rs @@ -12,8 +12,6 @@ use esp32s3_hal::{ mcpwm::{operator::PwmPinConfig, timer::PwmWorkingMode, PeripheralClockConfig, MCPWM}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, }; use esp_backtrace as _; @@ -23,18 +21,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let pin = io.pins.gpio4; diff --git a/esp32s3-hal/examples/multicore.rs b/esp32s3-hal/examples/multicore.rs index df532bc10..d9ee52376 100644 --- a/esp32s3-hal/examples/multicore.rs +++ b/esp32s3-hal/examples/multicore.rs @@ -14,7 +14,6 @@ use esp32s3_hal::{ peripherals::{Peripherals, TIMG1}, prelude::*, timer::{Timer, Timer0, TimerGroup}, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -34,7 +33,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; let timer_group1 = TimerGroup::new( peripherals.TIMG1, @@ -42,14 +40,6 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer1 = timer_group1.timer0; - let mut wdt1 = timer_group1.wdt; - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt0.disable(); - wdt1.disable(); - rtc.rwdt.disable(); timer0.start(1u64.secs()); timer1.start(500u64.millis()); diff --git a/esp32s3-hal/examples/octal_psram.rs b/esp32s3-hal/examples/octal_psram.rs index afec9f1fb..f8746ae2f 100644 --- a/esp32s3-hal/examples/octal_psram.rs +++ b/esp32s3-hal/examples/octal_psram.rs @@ -45,18 +45,6 @@ fn main() -> ! { ) .freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - println!("Going to access PSRAM"); let mut large_vec: alloc::vec::Vec = alloc::vec::Vec::with_capacity(500 * 1024 / 4); diff --git a/esp32s3-hal/examples/pcnt_encoder.rs b/esp32s3-hal/examples/pcnt_encoder.rs index e91d948a5..061f3f926 100644 --- a/esp32s3-hal/examples/pcnt_encoder.rs +++ b/esp32s3-hal/examples/pcnt_encoder.rs @@ -23,8 +23,6 @@ use esp_hal::{ pcnt::{channel, channel::PcntSource, unit, PCNT}, peripherals::{self, Peripherals}, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_println::println; @@ -36,21 +34,10 @@ static VALUE: AtomicI32 = AtomicI32::new(0); fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let unit_number = unit::Number::Unit1; // setup a pulse couter diff --git a/esp32s3-hal/examples/psram.rs b/esp32s3-hal/examples/psram.rs index afec9f1fb..5b71d8756 100644 --- a/esp32s3-hal/examples/psram.rs +++ b/esp32s3-hal/examples/psram.rs @@ -11,7 +11,6 @@ use esp32s3_hal::{ prelude::*, psram, timer::TimerGroup, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -45,18 +44,6 @@ fn main() -> ! { ) .freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - println!("Going to access PSRAM"); let mut large_vec: alloc::vec::Vec = alloc::vec::Vec::with_capacity(500 * 1024 / 4); diff --git a/esp32s3-hal/examples/qspi_flash.rs b/esp32s3-hal/examples/qspi_flash.rs index 17c3057d0..4ee2346c5 100644 --- a/esp32s3-hal/examples/qspi_flash.rs +++ b/esp32s3-hal/examples/qspi_flash.rs @@ -25,9 +25,7 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,27 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S3, this includes the RTC WDT, and - // the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio4; let miso = io.pins.gpio5; diff --git a/esp32s3-hal/examples/ram.rs b/esp32s3-hal/examples/ram.rs index bdc256360..896f0d76d 100644 --- a/esp32s3-hal/examples/ram.rs +++ b/esp32s3-hal/examples/ram.rs @@ -14,6 +14,7 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, + Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -40,12 +41,11 @@ fn main() -> ! { &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - // Disable MWDT flash boot protection - wdt.disable(); - // The RWDT flash boot protection remains enabled and it being triggered is part - // of the example + // The RWDT flash boot protection must be enabled, as it is triggered as part of + // the example. + let mut rtc = Rtc::new(peripherals.RTC_CNTL); + rtc.rwdt.enable(); timer0.start(1u64.secs()); diff --git a/esp32s3-hal/examples/read_efuse.rs b/esp32s3-hal/examples/read_efuse.rs index 1fb10e66d..1329cd71a 100644 --- a/esp32s3-hal/examples/read_efuse.rs +++ b/esp32s3-hal/examples/read_efuse.rs @@ -4,34 +4,16 @@ #![no_std] #![no_main] -use esp32s3_hal::{ - clock::ClockControl, - efuse::Efuse, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32s3_hal::{clock::ClockControl, efuse::Efuse, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); + 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); println!("MAC address {:02x?}", Efuse::get_mac_address()); println!("Flash Encryption {:?}", Efuse::get_flash_encryption()); diff --git a/esp32s3-hal/examples/rmt_rx.rs b/esp32s3-hal/examples/rmt_rx.rs index 0bbaee17f..e4cd1f493 100644 --- a/esp32s3-hal/examples/rmt_rx.rs +++ b/esp32s3-hal/examples/rmt_rx.rs @@ -12,10 +12,8 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, RxChannel, RxChannelConfig, RxChannelCreator}, - timer::TimerGroup, Delay, Rmt, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -29,14 +27,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut clock_control = system.peripheral_clock_control; - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let rmt = Rmt::new(peripherals.RMT, 1u32.MHz(), &mut clock_control, &clocks).unwrap(); diff --git a/esp32s3-hal/examples/rmt_tx.rs b/esp32s3-hal/examples/rmt_tx.rs index 5bb1b7335..1b1ba0d28 100644 --- a/esp32s3-hal/examples/rmt_tx.rs +++ b/esp32s3-hal/examples/rmt_tx.rs @@ -4,15 +4,7 @@ #![no_std] #![no_main] -use esp32s3_hal::{ - clock::ClockControl, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32s3_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*, Delay}; use esp_backtrace as _; use esp_hal_common::{ rmt::{PulseCode, TxChannel, TxChannelConfig, TxChannelCreator}, @@ -26,14 +18,6 @@ fn main() -> ! { let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut clock_control = system.peripheral_clock_control; - let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks, &mut clock_control); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let rmt = Rmt::new(peripherals.RMT, 8u32.MHz(), &mut clock_control, &clocks).unwrap(); diff --git a/esp32s3-hal/examples/rng.rs b/esp32s3-hal/examples/rng.rs index be586863c..280d4c52c 100644 --- a/esp32s3-hal/examples/rng.rs +++ b/esp32s3-hal/examples/rng.rs @@ -3,34 +3,15 @@ #![no_std] #![no_main] -use esp32s3_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rng, - Rtc, -}; +use esp32s3_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Rng}; use esp_backtrace as _; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection: - wdt.disable(); - rtc.rwdt.disable(); + let system = peripherals.SYSTEM.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Instantiate the Random Number Generator peripheral: let mut rng = Rng::new(peripherals.RNG); diff --git a/esp32s3-hal/examples/rsa.rs b/esp32s3-hal/examples/rsa.rs index 6ae7cd821..2240913c4 100644 --- a/esp32s3-hal/examples/rsa.rs +++ b/esp32s3-hal/examples/rsa.rs @@ -22,9 +22,7 @@ use esp32s3_hal::{ RsaModularMultiplication, RsaMultiplication, }, - timer::TimerGroup, xtensa_lx, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -59,26 +57,8 @@ const fn compute_mprime(modulus: &U512) -> u32 { fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the RTC and TIMG watchdog timers - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let mut rsa = Rsa::new(peripherals.RSA, &mut system.peripheral_clock_control); block!(rsa.ready()).unwrap(); diff --git a/esp32s3-hal/examples/rtc_time.rs b/esp32s3-hal/examples/rtc_time.rs index 32149d5a9..b698b7d03 100644 --- a/esp32s3-hal/examples/rtc_time.rs +++ b/esp32s3-hal/examples/rtc_time.rs @@ -3,34 +3,16 @@ #![no_std] #![no_main] -use esp32s3_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Delay, - Rtc, -}; +use esp32s3_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay, Rtc}; 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 timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - + let rtc = Rtc::new(peripherals.RTC_CNTL); let mut delay = Delay::new(&clocks); loop { diff --git a/esp32s3-hal/examples/serial_interrupts.rs b/esp32s3-hal/examples/serial_interrupts.rs index 5a7217d99..f3fb9a68c 100644 --- a/esp32s3-hal/examples/serial_interrupts.rs +++ b/esp32s3-hal/examples/serial_interrupts.rs @@ -15,7 +15,6 @@ use esp32s3_hal::{ prelude::*, timer::TimerGroup, uart::config::AtCmdConfig, - Rtc, Uart, }; use esp_backtrace as _; @@ -29,30 +28,14 @@ fn main() -> ! { let mut 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 mut timer0 = timer_group0.timer0; - let mut wdt0 = timer_group0.wdt; - - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; let mut serial0 = Uart::new(peripherals.UART0, &mut system.peripheral_clock_control); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt0.disable(); - wdt1.disable(); - rtc.rwdt.disable(); - serial0.set_at_cmd(AtCmdConfig::new(None, None, None, b'#', None)); serial0.set_rx_fifo_full_threshold(30).unwrap(); serial0.listen_at_cmd(); diff --git a/esp32s3-hal/examples/sha.rs b/esp32s3-hal/examples/sha.rs index b472d2d7b..4801cc305 100644 --- a/esp32s3-hal/examples/sha.rs +++ b/esp32s3-hal/examples/sha.rs @@ -9,9 +9,7 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, sha::{Sha, ShaMode}, - timer::TimerGroup, xtensa_lx, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -22,19 +20,7 @@ use sha2::{Digest, Sha512}; fn main() -> ! { let peripherals = Peripherals::take(); let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes(); let mut remaining = source_data.clone(); diff --git a/esp32s3-hal/examples/sleep_timer.rs b/esp32s3-hal/examples/sleep_timer.rs index 8a29857d6..3074b34fa 100644 --- a/esp32s3-hal/examples/sleep_timer.rs +++ b/esp32s3-hal/examples/sleep_timer.rs @@ -14,7 +14,6 @@ use hal::{ peripherals::Peripherals, prelude::*, rtc_cntl::{get_reset_reason, get_wakeup_cause, sleep::TimerWakeupSource, SocResetReason}, - timer::TimerGroup, Delay, Rtc, }; @@ -22,27 +21,10 @@ use hal::{ #[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 RTC and TIMG watchdog timers let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); println!("up and runnning!"); let reason = get_reset_reason(hal::Cpu::ProCpu).unwrap_or(SocResetReason::ChipPowerOn); diff --git a/esp32s3-hal/examples/sleep_timer_ext0.rs b/esp32s3-hal/examples/sleep_timer_ext0.rs index 8ad865ded..f5248cb35 100644 --- a/esp32s3-hal/examples/sleep_timer_ext0.rs +++ b/esp32s3-hal/examples/sleep_timer_ext0.rs @@ -19,7 +19,6 @@ use hal::{ sleep::{Ext0WakeupSource, TimerWakeupSource, WakeupLevel}, SocResetReason, }, - timer::TimerGroup, Delay, Rtc, IO, @@ -28,27 +27,10 @@ use hal::{ #[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 RTC and TIMG watchdog timers let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut ext0_pin = io.pins.gpio18; diff --git a/esp32s3-hal/examples/sleep_timer_ext1.rs b/esp32s3-hal/examples/sleep_timer_ext1.rs index 8dd4dcb77..14649d2ce 100644 --- a/esp32s3-hal/examples/sleep_timer_ext1.rs +++ b/esp32s3-hal/examples/sleep_timer_ext1.rs @@ -19,7 +19,6 @@ use hal::{ sleep::{Ext1WakeupSource, TimerWakeupSource, WakeupLevel}, SocResetReason, }, - timer::TimerGroup, Delay, Rtc, IO, @@ -28,27 +27,10 @@ use hal::{ #[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 RTC and TIMG watchdog timers let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut pin18 = io.pins.gpio18; diff --git a/esp32s3-hal/examples/sleep_timer_rtcio.rs b/esp32s3-hal/examples/sleep_timer_rtcio.rs index e197cbf87..b2a69f97b 100644 --- a/esp32s3-hal/examples/sleep_timer_rtcio.rs +++ b/esp32s3-hal/examples/sleep_timer_rtcio.rs @@ -23,7 +23,6 @@ use hal::{ sleep::{TimerWakeupSource, WakeupLevel}, SocResetReason, }, - timer::TimerGroup, Delay, Rtc, IO, @@ -32,27 +31,10 @@ use hal::{ #[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 RTC and TIMG watchdog timers let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let mut rtcio_pin18 = io.pins.gpio18; diff --git a/esp32s3-hal/examples/software_interrupts.rs b/esp32s3-hal/examples/software_interrupts.rs index 9b34f7163..88d6bc1b5 100644 --- a/esp32s3-hal/examples/software_interrupts.rs +++ b/esp32s3-hal/examples/software_interrupts.rs @@ -16,9 +16,7 @@ use esp32s3_hal::{ peripherals::{self, Peripherals}, prelude::*, system::{SoftwareInterrupt, SoftwareInterruptControl}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; @@ -27,22 +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 sw_int = system.software_interrupt_control; let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - critical_section::with(|cs| SWINT.borrow_ref_mut(cs).replace(sw_int)); interrupt::enable( diff --git a/esp32s3-hal/examples/spi_eh1_device_loopback.rs b/esp32s3-hal/examples/spi_eh1_device_loopback.rs index 944cef2b6..2b95b8208 100644 --- a/esp32s3-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32s3-hal/examples/spi_eh1_device_loopback.rs @@ -25,9 +25,7 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiBusController, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -38,19 +36,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S3, this includes the RTC WDT, and - // the TIMG WDT. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio12; let miso = io.pins.gpio11; diff --git a/esp32s3-hal/examples/spi_eh1_loopback.rs b/esp32s3-hal/examples/spi_eh1_loopback.rs index d53c366fb..53abe0059 100644 --- a/esp32s3-hal/examples/spi_eh1_loopback.rs +++ b/esp32s3-hal/examples/spi_eh1_loopback.rs @@ -23,9 +23,7 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; @@ -36,19 +34,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S3, this includes the RTC WDT, and - // the TIMG WDT. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio12; let miso = io.pins.gpio11; diff --git a/esp32s3-hal/examples/spi_halfduplex_read_manufacturer_id.rs b/esp32s3-hal/examples/spi_halfduplex_read_manufacturer_id.rs index 0adf7695f..3131d5739 100644 --- a/esp32s3-hal/examples/spi_halfduplex_read_manufacturer_id.rs +++ b/esp32s3-hal/examples/spi_halfduplex_read_manufacturer_id.rs @@ -23,9 +23,7 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, spi::{Address, Command, HalfDuplexReadWrite, Spi, SpiDataMode, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -36,27 +34,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio4; let miso = io.pins.gpio5; diff --git a/esp32s3-hal/examples/spi_loopback.rs b/esp32s3-hal/examples/spi_loopback.rs index 3b2122b49..ed9a271a2 100644 --- a/esp32s3-hal/examples/spi_loopback.rs +++ b/esp32s3-hal/examples/spi_loopback.rs @@ -22,9 +22,7 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -35,19 +33,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S3, this includes the RTC WDT, and - // the TIMG WDT. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio12; let miso = io.pins.gpio11; diff --git a/esp32s3-hal/examples/spi_loopback_dma.rs b/esp32s3-hal/examples/spi_loopback_dma.rs index 3e9804c68..be49cf976 100644 --- a/esp32s3-hal/examples/spi_loopback_dma.rs +++ b/esp32s3-hal/examples/spi_loopback_dma.rs @@ -24,9 +24,7 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, spi::{Spi, SpiMode}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -37,27 +35,6 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - // Disable the watchdog timers. For the ESP32-S3, this includes the Super WDT, - // the RTC WDT, and the TIMG WDTs. - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt0 = timer_group0.wdt; - let timer_group1 = TimerGroup::new( - peripherals.TIMG1, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt1 = timer_group1.wdt; - - rtc.swd.disable(); - rtc.rwdt.disable(); - wdt0.disable(); - wdt1.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); let sclk = io.pins.gpio6; let miso = io.pins.gpio2; diff --git a/esp32s3-hal/examples/systimer.rs b/esp32s3-hal/examples/systimer.rs index e1d08141c..de2db01a6 100644 --- a/esp32s3-hal/examples/systimer.rs +++ b/esp32s3-hal/examples/systimer.rs @@ -14,9 +14,7 @@ use esp32s3_hal::{ peripherals::{self, Peripherals}, prelude::*, systimer::{Alarm, Periodic, SystemTimer, Target}, - timer::TimerGroup, Delay, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -28,21 +26,9 @@ static ALARM2: Mutex>>> = Mutex::new(RefCell::ne #[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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); - let syst = SystemTimer::new(peripherals.SYSTIMER); println!("SYSTIMER Current value = {}", SystemTimer::now()); diff --git a/esp32s3-hal/examples/timer_interrupt.rs b/esp32s3-hal/examples/timer_interrupt.rs index 89b34f1a3..8c66a3909 100644 --- a/esp32s3-hal/examples/timer_interrupt.rs +++ b/esp32s3-hal/examples/timer_interrupt.rs @@ -15,7 +15,6 @@ use esp32s3_hal::{ peripherals::{self, Peripherals, TIMG0, TIMG1}, prelude::*, timer::{Timer, Timer0, Timer1, TimerGroup}, - Rtc, }; use esp_backtrace as _; use esp_println::println; @@ -31,7 +30,6 @@ fn main() -> ! { let mut 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, @@ -39,7 +37,6 @@ fn main() -> ! { ); let mut timer00 = timer_group0.timer0; let mut timer01 = timer_group0.timer1; - let mut wdt0 = timer_group0.wdt; let timer_group1 = TimerGroup::new( peripherals.TIMG1, @@ -48,14 +45,6 @@ fn main() -> ! { ); let mut timer10 = timer_group1.timer0; let mut timer11 = timer_group1.timer1; - let mut wdt1 = timer_group1.wdt; - - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt0.disable(); - wdt1.disable(); - rtc.rwdt.disable(); interrupt::enable(peripherals::Interrupt::TG0_T0_LEVEL, Priority::Priority2).unwrap(); interrupt::enable(peripherals::Interrupt::TG0_T1_LEVEL, Priority::Priority2).unwrap(); diff --git a/esp32s3-hal/examples/twai.rs b/esp32s3-hal/examples/twai.rs index 9d2531c59..a5ec68fed 100644 --- a/esp32s3-hal/examples/twai.rs +++ b/esp32s3-hal/examples/twai.rs @@ -25,15 +25,7 @@ use embedded_can::{nb::Can, Frame, StandardId}; // cargo run --example twai --release #[cfg(not(feature = "eh1"))] use embedded_hal::can::{Can, Frame, StandardId}; -use esp32s3_hal::{ - clock::ClockControl, - gpio::IO, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - twai, - Rtc, -}; +use esp32s3_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*, twai}; use esp_backtrace as _; use esp_println::println; use nb::block; @@ -44,18 +36,6 @@ fn main() -> ! { let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable watchdog timer - wdt.disable(); - rtc.rwdt.disable(); - let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); // Set the tx pin as open drain. Skip this if using transceivers. diff --git a/esp32s3-hal/examples/ulp_riscv_core_basic.rs b/esp32s3-hal/examples/ulp_riscv_core_basic.rs index 90acbc726..b0f8b9666 100644 --- a/esp32s3-hal/examples/ulp_riscv_core_basic.rs +++ b/esp32s3-hal/examples/ulp_riscv_core_basic.rs @@ -6,13 +6,7 @@ #![no_std] #![no_main] -use esp32s3_hal::{ - clock::ClockControl, - peripherals::Peripherals, - prelude::*, - timer::TimerGroup, - Rtc, -}; +use esp32s3_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*}; use esp_backtrace as _; use esp_println::println; @@ -37,20 +31,8 @@ const CODE: &[u8] = &[ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let mut 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 mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let system = peripherals.SYSTEM.split(); + let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut ulp_core = esp32s3_hal::ulp_core::UlpCore::new(peripherals.ULP_RISCV_CORE); ulp_core.stop(); diff --git a/esp32s3-hal/examples/usb_serial.rs b/esp32s3-hal/examples/usb_serial.rs index 3b0b1f9d2..14ecc6bf2 100644 --- a/esp32s3-hal/examples/usb_serial.rs +++ b/esp32s3-hal/examples/usb_serial.rs @@ -10,8 +10,6 @@ use esp32s3_hal::{ otg_fs::{UsbBus, USB}, peripherals::Peripherals, prelude::*, - timer::TimerGroup, - Rtc, IO, }; use esp_backtrace as _; @@ -23,19 +21,7 @@ static mut EP_MEMORY: [u32; 1024] = [0; 1024]; fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); - let clocks = ClockControl::configure(system.clock_control, CpuClock::Clock240MHz).freeze(); - - let timer_group0 = TimerGroup::new( - peripherals.TIMG0, - &clocks, - &mut system.peripheral_clock_control, - ); - let mut wdt = timer_group0.wdt; - let mut rtc = Rtc::new(peripherals.RTC_CNTL); - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); + let _clocks = ClockControl::configure(system.clock_control, CpuClock::Clock240MHz).freeze(); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32s3-hal/examples/usb_serial_jtag.rs b/esp32s3-hal/examples/usb_serial_jtag.rs index b35279032..7eeeb08aa 100644 --- a/esp32s3-hal/examples/usb_serial_jtag.rs +++ b/esp32s3-hal/examples/usb_serial_jtag.rs @@ -16,7 +16,6 @@ use esp32s3_hal::{ peripherals::{self, Peripherals}, prelude::*, timer::TimerGroup, - Rtc, UsbSerialJtag, }; use esp_backtrace as _; @@ -30,18 +29,12 @@ fn main() -> ! { let mut system = peripherals.SYSTEM.split(); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); - let mut rtc = Rtc::new(peripherals.RTC_CNTL); let timer_group0 = TimerGroup::new( peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control, ); let mut timer0 = timer_group0.timer0; - let mut wdt = timer_group0.wdt; - - // Disable MWDT and RWDT (Watchdog) flash boot protection - wdt.disable(); - rtc.rwdt.disable(); let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE, &mut system.peripheral_clock_control);