diff options
| author | xoviat <[email protected]> | 2025-11-05 07:13:15 -0600 |
|---|---|---|
| committer | xoviat <[email protected]> | 2025-11-05 07:13:15 -0600 |
| commit | 2f26c3c5f1380535c5fdd74cd39962338ed51204 (patch) | |
| tree | 8f5e137e832b00f4cca0e80634747ccd4121a7f5 /embassy-stm32/src/rtc | |
| parent | ff42c61dc6c0f870b4022aca52f3c45d992ae735 (diff) | |
tests: disable rtc for h563 on non-stop
Diffstat (limited to 'embassy-stm32/src/rtc')
| -rw-r--r-- | embassy-stm32/src/rtc/mod.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/embassy-stm32/src/rtc/mod.rs b/embassy-stm32/src/rtc/mod.rs index cbb904fd3..116b3c7ed 100644 --- a/embassy-stm32/src/rtc/mod.rs +++ b/embassy-stm32/src/rtc/mod.rs | |||
| @@ -175,13 +175,21 @@ pub struct RtcConfig { | |||
| 175 | /// | 175 | /// |
| 176 | /// A high counter frequency may impact stop power consumption | 176 | /// A high counter frequency may impact stop power consumption |
| 177 | pub frequency: Hertz, | 177 | pub frequency: Hertz, |
| 178 | |||
| 179 | #[cfg(feature = "_allow-disable-rtc")] | ||
| 180 | /// Allow disabling the rtc, even when stop is configured | ||
| 181 | pub _disable_rtc: bool, | ||
| 178 | } | 182 | } |
| 179 | 183 | ||
| 180 | impl Default for RtcConfig { | 184 | impl Default for RtcConfig { |
| 181 | /// LSI with prescalers assuming 32.768 kHz. | 185 | /// LSI with prescalers assuming 32.768 kHz. |
| 182 | /// Raw sub-seconds in 1/256. | 186 | /// Raw sub-seconds in 1/256. |
| 183 | fn default() -> Self { | 187 | fn default() -> Self { |
| 184 | RtcConfig { frequency: Hertz(256) } | 188 | RtcConfig { |
| 189 | frequency: Hertz(256), | ||
| 190 | #[cfg(feature = "_allow-disable-rtc")] | ||
| 191 | _disable_rtc: false, | ||
| 192 | } | ||
| 185 | } | 193 | } |
| 186 | } | 194 | } |
| 187 | 195 | ||
| @@ -372,6 +380,11 @@ trait SealedInstance { | |||
| 372 | 380 | ||
| 373 | #[cfg(feature = "low-power")] | 381 | #[cfg(feature = "low-power")] |
| 374 | pub(crate) fn init_rtc(cs: CriticalSection, config: RtcConfig) { | 382 | pub(crate) fn init_rtc(cs: CriticalSection, config: RtcConfig) { |
| 383 | #[cfg(feature = "_allow-disable-rtc")] | ||
| 384 | if config._disable_rtc { | ||
| 385 | return; | ||
| 386 | } | ||
| 387 | |||
| 375 | crate::time_driver::get_driver().set_rtc(cs, Rtc::new_inner(config)); | 388 | crate::time_driver::get_driver().set_rtc(cs, Rtc::new_inner(config)); |
| 376 | 389 | ||
| 377 | trace!("low power: stop with rtc configured"); | 390 | trace!("low power: stop with rtc configured"); |
