From d6ce00f6b68d3d1ecaf44c972909f311ac1d3bf8 Mon Sep 17 00:00:00 2001
From: jinlicong <493886250@qq.com>
Date: Thu, 09 May 2024 19:54:54 +0800
Subject: [PATCH] 增加电源管理部分功能
---
Function/EXTERN_RTC/extern_rtc.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/Function/EXTERN_RTC/extern_rtc.c b/Function/EXTERN_RTC/extern_rtc.c
index 75d5a80..263eb34 100644
--- a/Function/EXTERN_RTC/extern_rtc.c
+++ b/Function/EXTERN_RTC/extern_rtc.c
@@ -4,9 +4,8 @@
#include "gpio.h"
#include "system_general_para.h"
-//__IO CALENDAR_TIME_T calendar_g = {0};
+__IO sClockBCD sys_clockBCD_g = {24,1,1,0,0,0};
-//__IO CALENDAR_TIME_T calendar_test_g = {0};
void RTC_GPIO_Init(void)
{
@@ -31,10 +30,31 @@
if((yearDec>99)||(yearDec<20)||(monthDec>12)||(monthDec==0)||(dayDec>31)||(dayDec==0)||(hourDec>23)||(minDec>59)||(secDec>59))
{
- //����ʱ����Ч
+ //ʱ����Ч
return FAIL;
}else
{
+ switch(monthDec)
+ {
+ case 4:
+ case 6:
+ case 9:
+ case 11:
+ if(dayDec>30)
+ return FAIL;
+ case 2:
+ if(((yearDec&0x3) != 0) && (dayDec>28)){
+ return FAIL;
+ }
+ else if(((yearDec&0x3) == 0) && (dayDec > 29)){
+ return FAIL;
+ }
+ break;
+ default:
+ break;
+ }
+
+
return PASS;
}
}
@@ -157,7 +177,33 @@
return PASS;
}else
{
- return FAIL;
+ //�ٶ�һ��
+ R8025T_Read(0,rtc_time,7);
+ calendar_l.year = rtc_time[6];
+ calendar_l.month = rtc_time[5];
+ calendar_l.day = rtc_time[4];
+ calendar_l.hour = rtc_time[2];
+ calendar_l.min = rtc_time[1];
+ calendar_l.sec = rtc_time[0];
+
+ if(TimeEffectJudgm(calendar_l)==PASS) //��ȡ��ʱ����ȷ�Ų���ָ��
+ {
+ calendar_p->sec = rtc_time[0];
+ calendar_p->min = rtc_time[1];
+ calendar_p->hour = rtc_time[2];
+ calendar_p->day = rtc_time[4];
+ calendar_p->month = rtc_time[5];
+ calendar_p->year = rtc_time[6];
+ #ifdef RS232_PRINTF
+ printf("EX_RTC_TIME = %X-%02X-%02X-%02X-%02X-%02X \r\n",calendar_p->year,calendar_p->month,calendar_p->day,
+ calendar_p->hour,calendar_p->minute,calendar_p->second);
+ #endif
+
+ return PASS;
+ }else
+ {
+ return FAIL;
+ }
}
}
--
Gitblit v1.9.3