__INTERRUPT __HIGH_CODE void RTC_IRQHandler(void) { RTC_TRIGFunCfg(32768*10); RTC_ClearITFlag(RTC_TRIG_EVENT); } void HAL_TimeInit(void) { uint16_t status = 0; #if(CLK_OSC32K) sys_safe_access_enable(); R8_CK32K_CONFIG &= ~(RB_CLK_OSC32K_XT | RB_CLK_XT32K_PON); sys_safe_access_enable(); R8_CK32K_CONFIG |= RB_CLK_INT32K_PON; sys_safe_access_disable(); Lib_Calibration_LSI(); #else sys_safe_access_enable(); R8_CK32K_CONFIG |= RB_CLK_OSC32K_XT | RB_CLK_INT32K_PON | RB_CLK_XT32K_PON; sys_safe_access_disable(); #endif status = R8_RESET_STATUS; if(((status & 0x07) == 0x01 )|| ((status & 0x07) == 0x03 )) RTC_InitTime(2020, 1, 1, 0, 0, 0); TMOS_TimerInit(0); } 按键函数 { KeyCfg.KEY_Event = KEY_Event_SingleClick;// 响应单击 RTC_TRIGFunCfg(32768*10); PFIC_EnableIRQ(RTC_IRQn); PWR_PeriphWakeUpCfg( ENABLE, RB_SLP_RTC_WAKE, Long_Delay ); GPIOA_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU); GPIOB_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU); LowPower_Shutdown(0); }
GPIO可以唤醒,可RTC唤不醒,但是用实例的RTC可以,不清楚哪里出了问题
热门产品 :
CH182: 以太网PHY收发器芯片