×
单片机 > 单片机程序设计 > 详情

STM32 低功耗 stop模式

发布时间:2020-12-29 发布时间:
|

关键代码:


1.


    RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);  

    PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);  


2.


/**

  * @brief  Configures system clock after wake-up from STOP: enable HSE, PLL

  *         and select PLL as system clock source.

  * @param  None

  * @retval None

  */

static void SYSCLKConfig_STOP(void)

{  

  /* After wake-up from STOP reconfigure the system clock */

  /* Enable HSE */

  RCC_HSEConfig(RCC_HSE_ON);

  

  /* Wait till HSE is ready */

  while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET)

  {}

  

  /* Enable PLL */

  RCC_PLLCmd(ENABLE);

  

  /* Wait till PLL is ready */

  while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)

  {}

  

  /* Select PLL as system clock source */

  RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

  

  /* Wait till PLL is used as system clock source */

  while (RCC_GetSYSCLKSource() != 0x08)

  {}

}




『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多