aboutsummaryrefslogtreecommitdiffstats
path: root/cfg/chconf.h
diff options
context:
space:
mode:
Diffstat (limited to 'cfg/chconf.h')
-rw-r--r--cfg/chconf.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/cfg/chconf.h b/cfg/chconf.h
index 1ad623b..dc2ccc1 100644
--- a/cfg/chconf.h
+++ b/cfg/chconf.h
@@ -451,6 +451,10 @@
* @note This macro can be used to activate a power saving mode.
*/
#define CH_CFG_IDLE_ENTER_HOOK() { \
+ RCC->ICSCR = (RCC->ICSCR & ~RCC_ICSCR_MSIRANGE_Msk); \
+ while (!(RCC->CR & RCC_CR_MSIRDY)); \
+ PWR->CR &= ~PWR_CR_LPRUN; \
+ PWR->CR |= PWR_CR_LPRUN; \
}
/**
@@ -460,6 +464,9 @@
* @note This macro can be used to deactivate a power saving mode.
*/
#define CH_CFG_IDLE_LEAVE_HOOK() { \
+ RCC->ICSCR |= 6 << RCC_ICSCR_MSIRANGE_Pos; \
+ while (!(RCC->CR & RCC_CR_MSIRDY)); \
+ PWR->CR &= ~PWR_CR_LPRUN; \
}
/**