代码:
- /**
- * [url=home.php?mod=space&uid=247401]@brief[/url] This function configures the system to enter Sleep mode for
- * current consumption measurement purpose.
- * Sleep Mode
- * ==========
- * - System Running at PLL
- * - Flash 5 wait state
- * - Instruction and Data caches ON
- * - Prefetch ON
- * - Code running from Internal FLASH
- * - All peripherals disabled.
- * - Wakeup using EXTI Line (USER Button)
- * @param None
- * @retval None
- */
- void SleepMode_Measure(void)
- {
- //挂起(暂停)系统时钟中断
- HAL_SuspendTick();
-
- /* 进入睡眠模式, 任意中断唤醒 */
- HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
-
- /* 恢复系统时钟中断 */
- HAL_ResumeTick();
-
- /* Add a delay of 200ms after exit from Sleep mode */
- HAL_Delay(200);
- }
|