//使能按键和rtc唤醒 if(0/*gTask_Ctrl.Long_Key_Pwr_Off == 0*/) { // wake_event|=RB_SLP_RTC_WAKE; } else { PWR_PeriphWakeUpCfg( DISABLE, RB_SLP_RTC_WAKE, Edge_LongDelay ); } PWR_PeriphWakeUpCfg( DISABLE, RB_SLP_BAT_WAKE, Level_ShortDelay ); PWR_PeriphWakeUpCfg( ENABLE, RB_SLP_GPIO_WAKE, Level_LongDelay ); /*请io中断标记*/ R16_PA_INT_IF = 0XFFFF; R16_PB_INT_IF = 0XFFFF; /*清掉rtc中断标记*/ R8_RTC_FLAG_CTRL = ( RB_RTC_TMR_CLR | RB_RTC_TRIG_CLR ); SetSysClock( CLK_SOURCE_HSE_6_4MHz ); LowPower_Sleep( RB_PWR_RAM2K | RB_PWR_RAM16K | RB_PWR_EXTEND ); SetSysClock( CLK_SOURCE_PLL_60MHz );
进入休眠时候的代码如上,只开启按键唤醒,但是唤醒之后发现是RTC中断唤醒的,RTC是使用周期中断。可以肯定是RTC唤醒的,因为只要把RTC中断关闭,在没有按键之类的io中断,系统是不会从休眠中被唤醒。唤醒后打印出R8_SLP_WAKE_CTRL的值为0x10
热门产品 :
CH641: PD及无线充电专用MCU