kopia lustrzana https://github.com/micropython/micropython
stm32/powerctrl: Add hooks for a board to perform actions on sleep/wake.
rodzic
8cde5faedd
commit
ea033bf25a
|
@ -324,6 +324,10 @@ void powerctrl_enter_stop_mode(void) {
|
||||||
// executed until after the clocks are reconfigured
|
// executed until after the clocks are reconfigured
|
||||||
uint32_t irq_state = disable_irq();
|
uint32_t irq_state = disable_irq();
|
||||||
|
|
||||||
|
#if defined(MICROPY_BOARD_ENTER_STOP)
|
||||||
|
MICROPY_BOARD_ENTER_STOP
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(STM32L4)
|
#if defined(STM32L4)
|
||||||
// Configure the MSI as the clock source after waking up
|
// Configure the MSI as the clock source after waking up
|
||||||
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_MSI);
|
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_MSI);
|
||||||
|
@ -399,6 +403,10 @@ void powerctrl_enter_stop_mode(void) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MICROPY_BOARD_LEAVE_STOP)
|
||||||
|
MICROPY_BOARD_LEAVE_STOP
|
||||||
|
#endif
|
||||||
|
|
||||||
// Enable IRQs now that all clocks are reconfigured
|
// Enable IRQs now that all clocks are reconfigured
|
||||||
enable_irq(irq_state);
|
enable_irq(irq_state);
|
||||||
}
|
}
|
||||||
|
@ -406,6 +414,10 @@ void powerctrl_enter_stop_mode(void) {
|
||||||
void powerctrl_enter_standby_mode(void) {
|
void powerctrl_enter_standby_mode(void) {
|
||||||
rtc_init_finalise();
|
rtc_init_finalise();
|
||||||
|
|
||||||
|
#if defined(MICROPY_BOARD_ENTER_STANDBY)
|
||||||
|
MICROPY_BOARD_ENTER_STANDBY
|
||||||
|
#endif
|
||||||
|
|
||||||
// We need to clear the PWR wake-up-flag before entering standby, since
|
// We need to clear the PWR wake-up-flag before entering standby, since
|
||||||
// the flag may have been set by a previous wake-up event. Furthermore,
|
// the flag may have been set by a previous wake-up event. Furthermore,
|
||||||
// we need to disable the wake-up sources while clearing this flag, so
|
// we need to disable the wake-up sources while clearing this flag, so
|
||||||
|
|
Ładowanie…
Reference in New Issue