try standby mode

This commit is contained in:
Yunhorn 2024-04-03 19:07:30 +08:00
parent 25da5701d2
commit 0b430cba4e
1 changed files with 17 additions and 1 deletions

View File

@ -78,14 +78,30 @@ const struct UTIL_LPM_Driver_s UTIL_PowerDriver =
void PWR_EnterOffMode(void)
{
/* USER CODE BEGIN EnterOffMode_1 */
/* Enable Power Clock */
HAL_SuspendTick();
/* Disable all used wakeup sources: Pin1(PA.0) */
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1|PWR_WAKEUP_PIN2|PWR_WAKEUP_PIN3);
/* 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 Standby Mode ####################################################*/
/* Request to enter STANDBY mode */
HAL_PWR_EnterSTANDBYMode();
/* USER CODE END EnterOffMode_1 */
}
void PWR_ExitOffMode(void)
{
/* USER CODE BEGIN ExitOffMode_1 */
//HAL_ResumeTick();
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
/* USER CODE END ExitOffMode_1 */
}