diff options
Diffstat (limited to 'embassy-stm32/src/rcc/mod.rs')
| -rw-r--r-- | embassy-stm32/src/rcc/mod.rs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs index 2a9a1595a..d25c922d8 100644 --- a/embassy-stm32/src/rcc/mod.rs +++ b/embassy-stm32/src/rcc/mod.rs | |||
| @@ -312,6 +312,15 @@ impl RccInfo { | |||
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | #[allow(dead_code)] | 314 | #[allow(dead_code)] |
| 315 | fn increment_minimum_stop_refcount_with_cs(&self, _cs: CriticalSection) { | ||
| 316 | #[cfg(all(stm32wlex, feature = "low-power"))] | ||
| 317 | match self.stop_mode { | ||
| 318 | StopMode::Stop1 | StopMode::Stop2 => increment_stop_refcount(_cs, StopMode::Stop2), | ||
| 319 | _ => {} | ||
| 320 | } | ||
| 321 | } | ||
| 322 | |||
| 323 | #[allow(dead_code)] | ||
| 315 | pub(crate) fn increment_stop_refcount(&self) { | 324 | pub(crate) fn increment_stop_refcount(&self) { |
| 316 | #[cfg(feature = "low-power")] | 325 | #[cfg(feature = "low-power")] |
| 317 | critical_section::with(|cs| self.increment_stop_refcount_with_cs(cs)) | 326 | critical_section::with(|cs| self.increment_stop_refcount_with_cs(cs)) |
| @@ -324,6 +333,15 @@ impl RccInfo { | |||
| 324 | } | 333 | } |
| 325 | 334 | ||
| 326 | #[allow(dead_code)] | 335 | #[allow(dead_code)] |
| 336 | fn decrement_minimum_stop_refcount_with_cs(&self, _cs: CriticalSection) { | ||
| 337 | #[cfg(all(stm32wlex, feature = "low-power"))] | ||
| 338 | match self.stop_mode { | ||
| 339 | StopMode::Stop1 | StopMode::Stop2 => decrement_stop_refcount(_cs, StopMode::Stop2), | ||
| 340 | _ => {} | ||
| 341 | } | ||
| 342 | } | ||
| 343 | |||
| 344 | #[allow(dead_code)] | ||
| 327 | pub(crate) fn decrement_stop_refcount(&self) { | 345 | pub(crate) fn decrement_stop_refcount(&self) { |
| 328 | #[cfg(feature = "low-power")] | 346 | #[cfg(feature = "low-power")] |
| 329 | critical_section::with(|cs| self.decrement_stop_refcount_with_cs(cs)) | 347 | critical_section::with(|cs| self.decrement_stop_refcount_with_cs(cs)) |
| @@ -339,7 +357,10 @@ impl RccInfo { | |||
| 339 | 357 | ||
| 340 | #[allow(dead_code)] | 358 | #[allow(dead_code)] |
| 341 | pub(crate) fn enable_and_reset_without_stop(&self) { | 359 | pub(crate) fn enable_and_reset_without_stop(&self) { |
| 342 | critical_section::with(|cs| self.enable_and_reset_with_cs(cs)) | 360 | critical_section::with(|cs| { |
| 361 | self.enable_and_reset_with_cs(cs); | ||
| 362 | self.increment_minimum_stop_refcount_with_cs(cs); | ||
| 363 | }) | ||
| 343 | } | 364 | } |
| 344 | 365 | ||
| 345 | // TODO: should this be `unsafe`? | 366 | // TODO: should this be `unsafe`? |
| @@ -353,7 +374,10 @@ impl RccInfo { | |||
| 353 | // TODO: should this be `unsafe`? | 374 | // TODO: should this be `unsafe`? |
| 354 | #[allow(dead_code)] | 375 | #[allow(dead_code)] |
| 355 | pub(crate) fn disable_without_stop(&self) { | 376 | pub(crate) fn disable_without_stop(&self) { |
| 356 | critical_section::with(|cs| self.disable_with_cs(cs)) | 377 | critical_section::with(|cs| { |
| 378 | self.disable_with_cs(cs); | ||
| 379 | self.decrement_minimum_stop_refcount_with_cs(cs); | ||
| 380 | }) | ||
| 357 | } | 381 | } |
| 358 | 382 | ||
| 359 | #[allow(dead_code)] | 383 | #[allow(dead_code)] |
