| | |
| | | #include "gpio.h" |
| | | #include "system_general_para.h" |
| | | |
| | | __IO sClockBCD sys_clockBCD_g = {24,1,1,0,0,0}; |
| | | __IO sClockBCD sys_clockBCD_g = {0x24,1,1,0,0,0}; |
| | | |
| | | |
| | | void RTC_GPIO_Init(void) |
| | | { |
| | | I2c_Scl_Gpio_Init(); |
| | | |
| | | InputtIO(EXT_RTC_INT_PORT,EXT_RTC_INT_PIN,IN_PULLUP); |
| | | InputtIO(EXT_RTC_INT_PORT,EXT_RTC_INT_PIN,IN_NORMAL); |
| | | } |
| | | |
| | | |
| | |
| | | minDec = BCD_2_DECIMAL(TimeBCD.min); |
| | | secDec = BCD_2_DECIMAL(TimeBCD.sec); |
| | | |
| | | if((yearDec>99)||(yearDec<20)||(monthDec>12)||(monthDec==0)||(dayDec>31)||(dayDec==0)||(hourDec>23)||(minDec>59)||(secDec>59)) |
| | | if((yearDec>YEAR_DEC_MAX)||(yearDec<20)||(monthDec>12)||(monthDec==0)||(dayDec>31)||(dayDec==0)||(hourDec>23)||(minDec>59)||(secDec>59)) |
| | | { |
| | | //ʱ¼äÎÞЧ |
| | | return FAIL; |
| | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | |
| | | return PASS; |
| | | } |
| | | } |
| | |
| | | |
| | | //ÉèÖÃÍⲿRTCʱ¼ä |
| | | //²ÎÊý£ºBCD¸ñʽ |
| | | void Set_Extern_Rtc_Time(uint16_t year,uint8_t month,uint8_t day,uint8_t week,uint8_t hour,uint8_t min,uint8_t sec) |
| | | ErrorStatus Set_Extern_Rtc_Time(uint16_t year,uint8_t month,uint8_t day,uint8_t week,uint8_t hour,uint8_t min,uint8_t sec) |
| | | { |
| | | uint8_t rtc_time[7] = {0,0,0,0,1,1,0x15}; |
| | | sClockBCD calendar_l; |
| | |
| | | rtc_time[5] = month; |
| | | rtc_time[6] = year; |
| | | R8025T_Write(0,rtc_time,7); |
| | | return PASS; |
| | | } |
| | | |
| | | return FAIL; |
| | | } |
| | | |
| | | //»ñÈ¡ÍⲿRTCʱ¼ä |