?//使能按鍵和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?); ??/*請(qǐng)io中斷標(biāo)記*/ ??R16_PA_INT_IF?=?0XFFFF; ??R16_PB_INT_IF?=?0XFFFF; ??/*清掉rtc中斷標(biāo)記*/ ??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?);
進(jìn)入休眠時(shí)候的代碼如上,只開啟按鍵喚醒,但是喚醒之后發(fā)現(xiàn)是RTC中斷喚醒的,RTC是使用周期中斷??梢钥隙ㄊ荝TC喚醒的,因?yàn)橹灰裄TC中斷關(guān)閉,在沒有按鍵之類的io中斷,系統(tǒng)是不會(huì)從休眠中被喚醒。喚醒后打印出R8_SLP_WAKE_CTRL的值為0x10
熱門產(chǎn)品 :
CH32V317: 互聯(lián)型青稞RISC-V MCU