diff --git a/esp-hal-common/src/rtc_cntl/mod.rs b/esp-hal-common/src/rtc_cntl/mod.rs
index cdf3acb52e6..d2411b01da6 100644
--- a/esp-hal-common/src/rtc_cntl/mod.rs
+++ b/esp-hal-common/src/rtc_cntl/mod.rs
@@ -83,7 +83,7 @@ use crate::efuse::Efuse;
use crate::peripherals::{LPWR, TIMG0};
#[cfg(any(esp32c6, esp32h2))]
use crate::peripherals::{LP_TIMER, LP_WDT};
-#[cfg(any(esp32, esp32s3, esp32c3))]
+#[cfg(any(esp32, esp32s3, esp32c3, esp32c6))]
use crate::rtc_cntl::sleep::{RtcSleepConfig, WakeSource, WakeTriggers};
use crate::{
clock::Clock,
@@ -95,11 +95,6 @@ use crate::{
#[cfg(any(esp32, esp32s3, esp32c3, esp32c6))]
pub mod sleep;
-#[cfg(any(esp32c6, esp32h2))]
-type LowPowerDomain = crate::peripherals::LPWR;
-#[cfg(not(any(esp32c6, esp32h2)))]
-type LowPowerDomain = crate::peripherals::LPWR;
-
#[cfg_attr(esp32, path = "rtc/esp32.rs")]
#[cfg_attr(esp32c2, path = "rtc/esp32c2.rs")]
#[cfg_attr(esp32c3, path = "rtc/esp32c3.rs")]
@@ -194,14 +189,14 @@ pub(crate) enum RtcCalSel {
/// Low-power Management
pub struct Rtc<'d> {
- _inner: PeripheralRef<'d, LowPowerDomain>,
+ _inner: PeripheralRef<'d, crate::peripherals::LPWR>,
pub rwdt: Rwdt,
#[cfg(any(esp32c2, esp32c3, esp32c6, esp32h2, esp32s3))]
pub swd: Swd,
}
impl<'d> Rtc<'d> {
- pub fn new(rtc_cntl: impl Peripheral
+ 'd) -> Self {
+ pub fn new(rtc_cntl: impl Peripheral
+ 'd) -> Self {
rtc::init();
rtc::configure_clock();
diff --git a/esp-hal-common/src/soc/esp32/mod.rs b/esp-hal-common/src/soc/esp32/mod.rs
index bb31a02bcb8..697a4bc5d37 100644
--- a/esp-hal-common/src/soc/esp32/mod.rs
+++ b/esp-hal-common/src/soc/esp32/mod.rs
@@ -5,7 +5,7 @@
//! The `SOC` module provides access, functions and structures that are useful
//! for interacting with various system-related peripherals on `ESP32` chip.
-use self::peripherals::{RTC_CNTL, TIMG0, TIMG1};
+use self::peripherals::{LPWR, TIMG0, TIMG1};
use crate::{timer::Wdt, Rtc};
pub mod cpu_control;
@@ -74,7 +74,7 @@ pub extern "Rust" fn __init_data() -> bool {
#[export_name = "__post_init"]
unsafe fn post_init() {
// RTC domain must be enabled before we try to disable
- let mut rtc = Rtc::new(RTC_CNTL::steal());
+ let mut rtc = Rtc::new(LPWR::steal());
rtc.rwdt.disable();
Wdt::::set_wdt_enabled(false);
diff --git a/esp-hal-common/src/soc/esp32c2/mod.rs b/esp-hal-common/src/soc/esp32c2/mod.rs
index 2cb4ea54dbf..da9c81e7491 100644
--- a/esp-hal-common/src/soc/esp32c2/mod.rs
+++ b/esp-hal-common/src/soc/esp32c2/mod.rs
@@ -5,7 +5,7 @@
//! The `SOC` module provides access, functions and structures that are useful
//! for interacting with various system-related peripherals on `ESP32-C2` chip.
-use self::peripherals::{RTC_CNTL, TIMG0};
+use self::peripherals::{LPWR, TIMG0};
use crate::{timer::Wdt, Rtc};
pub mod efuse;
@@ -25,7 +25,7 @@ pub(crate) mod constants {
#[export_name = "__post_init"]
unsafe fn post_init() {
// RTC domain must be enabled before we try to disable
- let mut rtc = Rtc::new(RTC_CNTL::steal());
+ let mut rtc = Rtc::new(LPWR::steal());
rtc.swd.disable();
rtc.rwdt.disable();
diff --git a/esp-hal-common/src/soc/esp32c3/mod.rs b/esp-hal-common/src/soc/esp32c3/mod.rs
index 3f0a89a79f1..a84c0c94ba6 100644
--- a/esp-hal-common/src/soc/esp32c3/mod.rs
+++ b/esp-hal-common/src/soc/esp32c3/mod.rs
@@ -9,7 +9,7 @@
//! * I2S_SCLK: 160_000_000 - I2S clock frequency
//! * I2S_DEFAULT_CLK_SRC: 2 - I2S clock source
-use self::peripherals::{RTC_CNTL, TIMG0, TIMG1};
+use self::peripherals::{LPWR, TIMG0, TIMG1};
use crate::{timer::Wdt, Rtc};
pub mod efuse;
@@ -37,7 +37,7 @@ pub(crate) mod constants {
#[export_name = "__post_init"]
unsafe fn post_init() {
// RTC domain must be enabled before we try to disable
- let mut rtc = Rtc::new(RTC_CNTL::steal());
+ let mut rtc = Rtc::new(LPWR::steal());
rtc.swd.disable();
rtc.rwdt.disable();
diff --git a/esp-hal-common/src/soc/esp32c6/mod.rs b/esp-hal-common/src/soc/esp32c6/mod.rs
index b0eb6b248f9..28a757cea61 100644
--- a/esp-hal-common/src/soc/esp32c6/mod.rs
+++ b/esp-hal-common/src/soc/esp32c6/mod.rs
@@ -10,7 +10,7 @@
//! * I2S_DEFAULT_CLK_SRC: 2 - I2S clock source
//! * I2S_SCLK: 160_000_000 - I2S clock frequency
-use self::peripherals::{LP_CLKRST, TIMG0, TIMG1};
+use self::peripherals::{LPWR, TIMG0, TIMG1};
use crate::{timer::Wdt, Rtc};
pub mod efuse;
@@ -43,7 +43,7 @@ pub(crate) mod constants {
#[export_name = "__post_init"]
unsafe fn post_init() {
// RTC domain must be enabled before we try to disable
- let mut rtc = Rtc::new(LP_CLKRST::steal());
+ let mut rtc = Rtc::new(LPWR::steal());
rtc.swd.disable();
rtc.rwdt.disable();
diff --git a/esp-hal-common/src/soc/esp32h2/mod.rs b/esp-hal-common/src/soc/esp32h2/mod.rs
index 04be9c9d79f..b367042d63d 100644
--- a/esp-hal-common/src/soc/esp32h2/mod.rs
+++ b/esp-hal-common/src/soc/esp32h2/mod.rs
@@ -10,7 +10,7 @@
//! * I2S_DEFAULT_CLK_SRC: 1 - I2S clock source
//! * I2S_SCLK: 96_000_000 - I2S clock frequency
-use self::peripherals::{LP_CLKRST, TIMG0, TIMG1};
+use self::peripherals::{LPWR, TIMG0, TIMG1};
use crate::{timer::Wdt, Rtc};
pub mod efuse;
@@ -42,7 +42,7 @@ pub(crate) mod constants {
#[export_name = "__post_init"]
unsafe fn post_init() {
// RTC domain must be enabled before we try to disable
- let mut rtc = Rtc::new(LP_CLKRST::steal());
+ let mut rtc = Rtc::new(LPWR::steal());
rtc.swd.disable();
rtc.rwdt.disable();
diff --git a/esp-hal-common/src/soc/esp32s2/mod.rs b/esp-hal-common/src/soc/esp32s2/mod.rs
index a1b35e99041..656ef673a1e 100644
--- a/esp-hal-common/src/soc/esp32s2/mod.rs
+++ b/esp-hal-common/src/soc/esp32s2/mod.rs
@@ -9,7 +9,7 @@
//! * I2S_SCLK: 160_000_000 - I2S clock frequency
//! * I2S_DEFAULT_CLK_SRC: 2 - I2S clock source
-use self::peripherals::{RTC_CNTL, TIMG0, TIMG1};
+use self::peripherals::{LPWR, TIMG0, TIMG1};
use crate::{timer::Wdt, Rtc};
pub mod efuse;
@@ -78,7 +78,7 @@ pub extern "Rust" fn __init_data() -> bool {
#[export_name = "__post_init"]
unsafe fn post_init() {
// RTC domain must be enabled before we try to disable
- let mut rtc = Rtc::new(RTC_CNTL::steal());
+ let mut rtc = Rtc::new(LPWR::steal());
rtc.rwdt.disable();
Wdt::::set_wdt_enabled(false);
diff --git a/esp-hal-common/src/soc/esp32s3/mod.rs b/esp-hal-common/src/soc/esp32s3/mod.rs
index 1ff65941861..9c3c52fe79a 100644
--- a/esp-hal-common/src/soc/esp32s3/mod.rs
+++ b/esp-hal-common/src/soc/esp32s3/mod.rs
@@ -9,7 +9,7 @@
//! * I2S_SCLK: 160_000_000 - I2S clock frequency
//! * I2S_DEFAULT_CLK_SRC: 2 - I2S clock source
-use self::peripherals::{RTC_CNTL, TIMG0, TIMG1};
+use self::peripherals::{LPWR, TIMG0, TIMG1};
use crate::{timer::Wdt, Rtc};
pub mod cpu_control;
@@ -113,7 +113,7 @@ pub extern "Rust" fn __init_data() -> bool {
#[export_name = "__post_init"]
unsafe fn post_init() {
// RTC domain must be enabled before we try to disable
- let mut rtc = Rtc::new(RTC_CNTL::steal());
+ let mut rtc = Rtc::new(LPWR::steal());
rtc.rwdt.disable();
Wdt::::set_wdt_enabled(false);
diff --git a/esp32c2-hal/examples/rtc_watchdog.rs b/esp32c2-hal/examples/rtc_watchdog.rs
index 6f09cca4bfe..aeb2df90317 100644
--- a/esp32c2-hal/examples/rtc_watchdog.rs
+++ b/esp32c2-hal/examples/rtc_watchdog.rs
@@ -14,7 +14,8 @@ use esp32c2_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
- Rtc, Rwdt,
+ Rtc,
+ Rwdt,
};
use esp_backtrace as _;
diff --git a/esp32c3-hal/examples/ram.rs b/esp32c3-hal/examples/ram.rs
index 64ff6e61f80..571f6efb45e 100644
--- a/esp32c3-hal/examples/ram.rs
+++ b/esp32c3-hal/examples/ram.rs
@@ -9,7 +9,12 @@
#![no_main]
use esp32c3_hal::{
- clock::ClockControl, macros::ram, peripherals::Peripherals, prelude::*, timer::TimerGroup, Rtc,
+ clock::ClockControl,
+ macros::ram,
+ peripherals::Peripherals,
+ prelude::*,
+ timer::TimerGroup,
+ Rtc,
};
use esp_backtrace as _;
use esp_println::println;
diff --git a/esp32c3-hal/examples/rtc_watchdog.rs b/esp32c3-hal/examples/rtc_watchdog.rs
index d990adabcb7..194f65f4f39 100644
--- a/esp32c3-hal/examples/rtc_watchdog.rs
+++ b/esp32c3-hal/examples/rtc_watchdog.rs
@@ -14,7 +14,8 @@ use esp32c3_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
- Rtc, Rwdt,
+ Rtc,
+ Rwdt,
};
use esp_backtrace as _;
diff --git a/esp32c3-hal/examples/sleep_timer.rs b/esp32c3-hal/examples/sleep_timer.rs
index 9f8c4091b25..760ddd8e429 100644
--- a/esp32c3-hal/examples/sleep_timer.rs
+++ b/esp32c3-hal/examples/sleep_timer.rs
@@ -11,7 +11,9 @@ use esp32c3_hal::{
peripherals::Peripherals,
prelude::*,
rtc_cntl::{get_reset_reason, get_wakeup_cause, sleep::TimerWakeupSource, SocResetReason},
- Cpu, Delay, Rtc,
+ Cpu,
+ Delay,
+ Rtc,
};
use esp_backtrace as _;
use esp_println::println;
diff --git a/esp32c3-hal/examples/sleep_timer_rtcio.rs b/esp32c3-hal/examples/sleep_timer_rtcio.rs
index e062fe962c2..b181936ba9f 100644
--- a/esp32c3-hal/examples/sleep_timer_rtcio.rs
+++ b/esp32c3-hal/examples/sleep_timer_rtcio.rs
@@ -13,11 +13,15 @@ use esp32c3_hal::{
peripherals::Peripherals,
prelude::*,
rtc_cntl::{
- get_reset_reason, get_wakeup_cause,
+ get_reset_reason,
+ get_wakeup_cause,
sleep::{RtcioWakeupSource, TimerWakeupSource, WakeupLevel},
SocResetReason,
},
- Cpu, Delay, Rtc, IO,
+ Cpu,
+ Delay,
+ Rtc,
+ IO,
};
use esp_backtrace as _;
use esp_println::println;
diff --git a/esp32c6-hal/examples/hello_world.rs b/esp32c6-hal/examples/hello_world.rs
index 374e83bf80c..33a095e85a1 100644
--- a/esp32c6-hal/examples/hello_world.rs
+++ b/esp32c6-hal/examples/hello_world.rs
@@ -7,7 +7,11 @@
use core::fmt::Write;
use esp32c6_hal::{
- clock::ClockControl, peripherals::Peripherals, prelude::*, timer::TimerGroup, Uart,
+ clock::ClockControl,
+ peripherals::Peripherals,
+ prelude::*,
+ timer::TimerGroup,
+ Uart,
};
use esp_backtrace as _;
use nb::block;
diff --git a/esp32c6-hal/examples/ram.rs b/esp32c6-hal/examples/ram.rs
index c776ec9b7c2..5f42c5bb611 100644
--- a/esp32c6-hal/examples/ram.rs
+++ b/esp32c6-hal/examples/ram.rs
@@ -9,7 +9,12 @@
#![no_main]
use esp32c6_hal::{
- clock::ClockControl, macros::ram, peripherals::Peripherals, prelude::*, timer::TimerGroup, Rtc,
+ clock::ClockControl,
+ macros::ram,
+ peripherals::Peripherals,
+ prelude::*,
+ timer::TimerGroup,
+ Rtc,
};
use esp_backtrace as _;
use esp_println::println;
diff --git a/esp32c6-hal/examples/rtc_watchdog.rs b/esp32c6-hal/examples/rtc_watchdog.rs
index d543c7d1911..96686482932 100644
--- a/esp32c6-hal/examples/rtc_watchdog.rs
+++ b/esp32c6-hal/examples/rtc_watchdog.rs
@@ -14,7 +14,8 @@ use esp32c6_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
- Rtc, Rwdt,
+ Rtc,
+ Rwdt,
};
use esp_backtrace as _;
diff --git a/esp32c6-hal/examples/sleep_lpio.rs b/esp32c6-hal/examples/sleep_lpio.rs
index e1fe4238757..164d460e440 100644
--- a/esp32c6-hal/examples/sleep_lpio.rs
+++ b/esp32c6-hal/examples/sleep_lpio.rs
@@ -29,7 +29,7 @@ fn main() -> ! {
let system = peripherals.SYSTEM.split();
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
- let mut rtc = Rtc::new(peripherals.LP_CLKRST);
+ let mut rtc = Rtc::new(peripherals.LPWR);
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
let mut pin2 = io.pins.gpio2;
diff --git a/esp32h2-hal/examples/ram.rs b/esp32h2-hal/examples/ram.rs
index f6bbaab9b29..97ad9f380d1 100644
--- a/esp32h2-hal/examples/ram.rs
+++ b/esp32h2-hal/examples/ram.rs
@@ -9,7 +9,12 @@
#![no_main]
use esp32h2_hal::{
- clock::ClockControl, macros::ram, peripherals::Peripherals, prelude::*, timer::TimerGroup, Rtc,
+ clock::ClockControl,
+ macros::ram,
+ peripherals::Peripherals,
+ prelude::*,
+ timer::TimerGroup,
+ Rtc,
};
use esp_backtrace as _;
use esp_println::println;
diff --git a/esp32h2-hal/examples/rtc_watchdog.rs b/esp32h2-hal/examples/rtc_watchdog.rs
index 6b267bfa1c2..ac737cf1dd6 100644
--- a/esp32h2-hal/examples/rtc_watchdog.rs
+++ b/esp32h2-hal/examples/rtc_watchdog.rs
@@ -14,7 +14,8 @@ use esp32h2_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
- Rtc, Rwdt,
+ Rtc,
+ Rwdt,
};
use esp_backtrace as _;