| | |
| | | #include "RTC.h" |
| | | |
| | | |
| | | void RTC_SET_ALARM(u32 sec) |
| | | { |
| | | //DEBUG_COM_STREAM("-??-",NULL); |
| | | RTC_SetAlarm(RTC_GetCounter()+sec); |
| | | //DEBUG_COM_STREAM("-??1-",NULL); |
| | | RTC_WaitForLastTask(); |
| | | //DEBUG_COM_STREAM("-??2-",NULL); |
| | | RTC_ITConfig(RTC_FLAG_ALR,ENABLE); |
| | | //DEBUG_COM_STREAM("-??-",NULL); |
| | | RTC_SetAlarm(RTC_GetCounter()+sec); |
| | | //DEBUG_COM_STREAM("-??1-",NULL); |
| | | RTC_WaitForLastTask(); |
| | | //DEBUG_COM_STREAM("-??2-",NULL); |
| | | RTC_ITConfig(RTC_FLAG_ALR,ENABLE); |
| | | } |
| | | |
| | | void RTC_Configuration(void) |
| | | { |
| | | EXTI_InitTypeDef EXTI_InitStructure; |
| | | |
| | | /* Enable PWR and BKP clocks */ |
| | | RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE); |
| | | |
| | |
| | | /* Wait until last write operation on RTC registers has finished */ |
| | | RTC_WaitForLastTask(); |
| | | RTC_SET_ALARM(1); |
| | | } |
| | | |
| | | //RTC澶栭儴涓柇浣胯兘 |
| | | EXTI_InitStructure.EXTI_Line = EXTI_Line17; |
| | | EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; |
| | | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; |
| | | EXTI_InitStructure.EXTI_LineCmd = ENABLE; |
| | | EXTI_Init(&EXTI_InitStructure); |
| | | |
| | | } |
| | | |