最近在使用STM32L151RC做低功耗方案,要使用到 LowPowerRunModeSram(),官方参考代码
STM32L1xx_StdPeriph_Lib_V1.3.1中 Examples PWR CurrentConsumption
- __ramfunc void LowPowerRunModeSRAM_Measure(void)
- {
- /* This function should be called when the program is running from internal SRAM. */
- FLASH_RUNPowerDownCmd(ENABLE);
- /* Wait Until Key button pressed */
- /// 原 while(((*(__IO uint32_t *)0x40020010) & 0x0001) == 0) 对应 PA.00
- /// 改 PC.13 接按键
- while(((*(__IO uint32_t *)0x40020810) & 0x2000) != 0)
- { }
- /* Wait Until Key button pressed */
- /// 原 while(((*(__IO uint32_t *)0x40020010) & 0x0001) != 0)
- /// 改 PC.13
- while(((*(__IO uint32_t *)0x40020810) & 0x2000) != 0)
- {}
- /* This function should be called when the program is running from internal SRAM. */
- FLASH_RUNPowerDownCmd(DISABLE);
- }
在执行这个函数前,是把所有GPIO时钟都关掉了的,有谁测试过这个真能唤醒退出么?
我把原代码中的PA.00唤醒,改成PC.13,发现如果把GPIOC的时钟关掉,是无法通过按键退出的。
GPIO时钟关掉后,GPIO->IDR 还能正常反应IO上的信号变化么?如果不能,参考代码为什么这么写?
|