stm32/powerctrl: Add hooks for a board to perform actions on sleep/wake.

pull/4892/head
Damien George 2019-07-03 01:04:25 +10:00
rodzic 8cde5faedd
commit ea033bf25a
1 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -324,6 +324,10 @@ void powerctrl_enter_stop_mode(void) {
// executed until after the clocks are reconfigured
uint32_t irq_state = disable_irq();
#if defined(MICROPY_BOARD_ENTER_STOP)
MICROPY_BOARD_ENTER_STOP
#endif
#if defined(STM32L4)
// Configure the MSI as the clock source after waking up
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_MSI);
@ -399,6 +403,10 @@ void powerctrl_enter_stop_mode(void) {
#endif
#if defined(MICROPY_BOARD_LEAVE_STOP)
MICROPY_BOARD_LEAVE_STOP
#endif
// Enable IRQs now that all clocks are reconfigured
enable_irq(irq_state);
}
@ -406,6 +414,10 @@ void powerctrl_enter_stop_mode(void) {
void powerctrl_enter_standby_mode(void) {
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
// 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