From b3e8f930cf77daccad1f98612510f90b1b084c7f Mon Sep 17 00:00:00 2001 From: bjoernQ Date: Tue, 1 Mar 2022 14:37:04 +0100 Subject: [PATCH] Disable WDT in I2C examples --- esp32-hal/examples/i2c_display.rs | 4 +++- esp32c3-hal/examples/i2c_display.rs | 2 +- esp32s2-hal/examples/i2c_display.rs | 4 +++- esp32s3-hal/examples/i2c_display.rs | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/esp32-hal/examples/i2c_display.rs b/esp32-hal/examples/i2c_display.rs index ad3704008..a4bb5b464 100644 --- a/esp32-hal/examples/i2c_display.rs +++ b/esp32-hal/examples/i2c_display.rs @@ -22,7 +22,7 @@ use embedded_graphics::{ text::{Alignment, Text}, }; use esp_hal_common::i2c::{self, I2C}; -use esp32_hal::{gpio::IO, pac::Peripherals, prelude::*, Serial, Timer}; +use esp32_hal::{gpio::IO, pac::Peripherals, prelude::*, Serial, Timer, RtcCntl}; use nb::block; use panic_halt as _; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; @@ -34,9 +34,11 @@ fn main() -> ! { let mut timer0 = Timer::new(peripherals.TIMG0); let mut serial0 = Serial::new(peripherals.UART0).unwrap(); + let mut rtc_cntl = RtcCntl::new(peripherals.RTC_CNTL); // Disable watchdog timer timer0.disable(); + rtc_cntl.set_wdt_global_enable(false); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32c3-hal/examples/i2c_display.rs b/esp32c3-hal/examples/i2c_display.rs index efb39b9be..8dfa3acca 100644 --- a/esp32c3-hal/examples/i2c_display.rs +++ b/esp32c3-hal/examples/i2c_display.rs @@ -30,7 +30,7 @@ use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; fn main() -> ! { let mut peripherals = Peripherals::take().unwrap(); - let rtc_cntl = RtcCntl::new(peripherals.RTC_CNTL); + let mut rtc_cntl = RtcCntl::new(peripherals.RTC_CNTL); let mut timer0 = Timer::new(peripherals.TIMG0); let mut timer1 = Timer::new(peripherals.TIMG1); diff --git a/esp32s2-hal/examples/i2c_display.rs b/esp32s2-hal/examples/i2c_display.rs index 382307cca..0e0b1e324 100644 --- a/esp32s2-hal/examples/i2c_display.rs +++ b/esp32s2-hal/examples/i2c_display.rs @@ -22,7 +22,7 @@ use embedded_graphics::{ text::{Alignment, Text}, }; use esp_hal_common::i2c::{self, I2C}; -use esp32s2_hal::{gpio::IO, pac::Peripherals, prelude::*, Serial, Timer}; +use esp32s2_hal::{gpio::IO, pac::Peripherals, prelude::*, Serial, Timer, RtcCntl}; use nb::block; use panic_halt as _; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; @@ -34,9 +34,11 @@ fn main() -> ! { let mut timer0 = Timer::new(peripherals.TIMG0); let mut serial0 = Serial::new(peripherals.UART0).unwrap(); + let mut rtc_cntl = RtcCntl::new(peripherals.RTC_CNTL); // Disable watchdog timer timer0.disable(); + rtc_cntl.set_wdt_global_enable(false); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/esp32s3-hal/examples/i2c_display.rs b/esp32s3-hal/examples/i2c_display.rs index 783b00aef..ae8e6bfe7 100644 --- a/esp32s3-hal/examples/i2c_display.rs +++ b/esp32s3-hal/examples/i2c_display.rs @@ -22,7 +22,7 @@ use embedded_graphics::{ text::{Alignment, Text}, }; use esp_hal_common::i2c::{self, I2C}; -use esp32s3_hal::{gpio::IO, pac::Peripherals, prelude::*, Serial, Timer}; +use esp32s3_hal::{gpio::IO, pac::Peripherals, prelude::*, Serial, Timer, RtcCntl}; use nb::block; use panic_halt as _; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; @@ -34,9 +34,11 @@ fn main() -> ! { let mut timer0 = Timer::new(peripherals.TIMG0); let mut serial0 = Serial::new(peripherals.UART0).unwrap(); + let mut rtc_cntl = RtcCntl::new(peripherals.RTC_CNTL); // Disable watchdog timer timer0.disable(); + rtc_cntl.set_wdt_global_enable(false); let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);