嗨,您可以參考Datasheet有關Power的Register,各家族應該大同小異
然後您可以設定外部中斷或者RTC觸發喚醒,以下是用外部中斷方式(PA0),新版HAL庫
/* Check and handle if the system was resumed from Standby mode */
if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET) { /* Clear Standby flag */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
}
/*Disable all used wakeup sources: Pin1(PA.0)*/
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
/*Clear all related wakeup flags*/
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/*Re-enable all used wakeup sources: Pin1(PA.0)*/
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
/*Enter the Standby mode*/
HAL_PWR_EnterSTANDBYMode();
以上希望對您有用