| 
 
| 原文:https://blog.csdn.net/wuhuijun165/article/details/62466739 
 #include "stm32l1xx.h"
 #include "system_stm32l1xx.h"
 #include "OLED.h"
 #include "delay.h"
 
 void RtcWakeUpConfig(void);
 u8 RtcInit(void);
 u8 RtcConfig(void);
 
 int main()
 {
 DelayInit();    //延时初始化
 RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //使能PWR时钟
 if(PWR_GetFlagStatus(PWR_FLAG_SB))  //从待机模式唤醒
 {
 PWR_ClearFlag(PWR_FLAG_SB);
 PWR_ClearFlag(PWR_FLAG_WU);
 }
 OLED_Init();
 RtcInit();
 
 while(1)
 {
 OLED_8x16StrP(0,0,"Runing...");         //液晶提示在运行中
 DelayS(2);                              //延时2秒
 RtcWakeUpConfig();                      //RTC wakeup 配置:间隔500ms自动唤醒
 //      PWR_WakeUpPinCmd(PWR_WakeUpPin_1,ENABLE);  //Periodic auto-wakeup不需要外部唤醒管脚,故不需要这句
 PWR_EnterSTANDBYMode();   //进入待机(STANDBY)模式
 }
 }
 
 
 
 | 
 |