40static volatile uint32_t g_u32Reg, g_u32Reg1,g_u32hiYear,g_u32loYear,g_u32hiMonth,g_u32loMonth,g_u32hiDay,g_u32loDay;
41static volatile uint32_t g_u32hiHour,g_u32loHour,g_u32hiMin,g_u32loMin,g_u32hiSec,g_u32loSec;
60 uint64_t u64Compensate;
64 u64Compensate = (uint64_t)(0x2710000000000);
65 u64Compensate = (uint64_t)(u64Compensate / (uint64_t)i32FrequencyX10000);
67 if(u64Compensate >= 0x400000)
69 u64Compensate = 0x3FFFFF;
75 if(i32TimeoutCnt-- <= 0)
79 RTC->FCR = (uint32_t)u64Compensate;
111 volatile int32_t i32delay=1000;
119 while(
RTC->INIR != 0x1) {
120 if(i32TimeoutCnt-- <= 0)
136 if(i32TimeoutCnt-- <= 0)
139 RTC->TSSR &= ~RTC_TSSR_24H_12H_Msk;
152 if(i32TimeoutCnt-- <= 0)
163 u32Reg |= ((sPt->
u32Month / 10) << 12);
164 u32Reg |= ((sPt->
u32Month % 10) << 8);
165 u32Reg |= ((sPt->
u32Day / 10) << 4);
166 u32Reg |= (sPt->
u32Day % 10);
172 if(i32TimeoutCnt-- <= 0)
176 RTC->CLR = (uint32_t)g_u32Reg;
181 u32Reg = ((sPt->
u32Hour / 10) << 20);
182 u32Reg |= ((sPt->
u32Hour % 10) << 16);
192 if(i32TimeoutCnt-- <= 0)
196 RTC->TLR = (uint32_t)g_u32Reg;
244 u32Tmp = (g_u32hiYear * 10);
245 u32Tmp += g_u32loYear;
248 u32Tmp = (g_u32hiMonth * 10);
249 sPt->
u32Month = u32Tmp + g_u32loMonth;
251 u32Tmp = (g_u32hiDay * 10);
252 sPt->
u32Day = u32Tmp + g_u32loDay;
256 u32Tmp = (g_u32hiHour * 10);
257 u32Tmp+= g_u32loHour;
270 u32Tmp = (g_u32hiMin * 10);
274 u32Tmp = (g_u32hiSec * 10);
281 u32Tmp = (g_u32hiHour * 10);
282 u32Tmp += g_u32loHour;
285 u32Tmp = (g_u32hiMin * 10);
286 u32Tmp += g_u32loMin;
289 u32Tmp = (g_u32hiSec * 10);
290 u32Tmp += g_u32loSec;
327 if(i32TimeoutCnt-- <= 0)
341 if(i32TimeoutCnt-- <= 0)
352 u32Tmp = (g_u32hiYear * 10);
353 u32Tmp += g_u32loYear;
356 u32Tmp = (g_u32hiMonth * 10);
357 sPt->
u32Month = u32Tmp + g_u32loMonth;
359 u32Tmp = (g_u32hiDay * 10);
360 sPt->
u32Day = u32Tmp + g_u32loDay;
364 u32Tmp = (g_u32hiHour * 10);
365 u32Tmp += g_u32loHour;
378 u32Tmp = (g_u32hiMin * 10);
379 u32Tmp += g_u32loMin;
382 u32Tmp = (g_u32hiSec * 10);
383 u32Tmp += g_u32loSec;
389 u32Tmp = (g_u32hiHour * 10);
390 u32Tmp += g_u32loHour;
393 u32Tmp = (g_u32hiMin * 10);
397 u32Tmp = (g_u32hiSec * 10);
398 u32Tmp += g_u32loSec;
436 if(i32TimeoutCnt-- <= 0)
442 RTC->TSSR &= ~RTC_TSSR_24H_12H_Msk;
459 u32Reg |= ((sPt->
u32Month / 10) << 12);
460 u32Reg |= ((sPt->
u32Month % 10) << 8);
461 u32Reg |= ((sPt->
u32Day / 10) << 4);
462 u32Reg |= (sPt->
u32Day % 10);
468 if(i32TimeoutCnt-- <= 0)
472 RTC->CLR = (uint32_t)g_u32Reg;
474 u32Reg = ((sPt->
u32Hour / 10) << 20);
475 u32Reg |= ((sPt->
u32Hour % 10) << 16);
485 if(i32TimeoutCnt-- <= 0)
489 RTC->TLR = (uint32_t)g_u32Reg;
521 if(i32TimeoutCnt-- <= 0)
527 RTC->TSSR &= ~RTC_TSSR_24H_12H_Msk;
545 u32Reg |= ((sPt->
u32Month / 10) << 12);
546 u32Reg |= ((sPt->
u32Month % 10) << 8);
547 u32Reg |= ((sPt->
u32Day / 10) << 4);
548 u32Reg |= (sPt->
u32Day % 10);
554 if(i32TimeoutCnt-- <= 0)
558 RTC->CAR = (uint32_t)g_u32Reg;
560 u32Reg = ((sPt->
u32Hour / 10) << 20);
561 u32Reg |= ((sPt->
u32Hour % 10) << 16);
571 if(i32TimeoutCnt-- <= 0)
575 RTC->TAR = (uint32_t)g_u32Reg;
593void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
595 __IO uint32_t u32Reg;
601 if(i32TimeoutCnt-- <= 0)
609 u32Reg |= ((u32Month / 10) << 12);
610 u32Reg |= ((u32Month % 10) << 8);
611 u32Reg |= ((u32Day / 10) << 4);
612 u32Reg |= (u32Day % 10);
618 if(i32TimeoutCnt-- <= 0)
622 RTC->CLR = (uint32_t)g_u32Reg;
638void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
640 __IO uint32_t u32Reg;
646 if(i32TimeoutCnt-- <= 0)
652 RTC->TSSR &= ~RTC_TSSR_24H_12H_Msk;
662 u32Reg = ((u32Hour / 10) << 20);
663 u32Reg |= ((u32Hour % 10) << 16);
664 u32Reg |= ((u32Minute / 10) << 12);
665 u32Reg |= ((u32Minute % 10) << 8);
666 u32Reg |= ((u32Second / 10) << 4);
667 u32Reg |= (u32Second % 10);
674 if(i32TimeoutCnt-- <= 0)
678 RTC->TLR = (uint32_t)g_u32Reg;
694 __IO uint32_t u32Reg;
700 if(i32TimeoutCnt-- <= 0)
706 u32Reg |= ((u32Month / 10) << 12);
707 u32Reg |= ((u32Month % 10) << 8);
708 u32Reg |= ((u32Day / 10) << 4);
709 u32Reg |= (u32Day % 10);
715 if(i32TimeoutCnt-- <= 0)
719 RTC->CAR = (uint32_t)g_u32Reg;
735void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
737 __IO uint32_t u32Reg;
743 if(i32TimeoutCnt-- <= 0)
749 RTC->TSSR &= ~RTC_TSSR_24H_12H_Msk;
759 u32Reg = ((u32Hour / 10) << 20);
760 u32Reg |= ((u32Hour % 10) << 16);
761 u32Reg |= ((u32Minute / 10) << 12);
762 u32Reg |= ((u32Minute % 10) << 8);
763 u32Reg |= ((u32Second / 10) << 4);
764 u32Reg |= (u32Second % 10);
771 if(i32TimeoutCnt-- <= 0)
775 RTC->TAR = (uint32_t)g_u32Reg;
797 if(i32TimeoutCnt-- <= 0)
805 RTC->SPRCTL &= ~RTC_SPRCTL_SNOOPEDGE_Msk;
826 if(i32TimeoutCnt-- <= 0)
830 RTC->SPRCTL &= ~RTC_SPRCTL_SNOOPEN_Msk;
872 if(i32TimeoutCnt-- <= 0)
876 RTC->TTR =
RTC->TTR & ~RTC_TTR_TTR_Msk | u32TickSelection;
897 if(i32TimeoutCnt-- <= 0)
901 RTC->RIER |= u32IntFlagMask;
922 if(i32TimeoutCnt-- <= 0)
928 RTC->RIER &= ~RTC_RIER_TIER_Msk;
934 RTC->RIER &= ~RTC_RIER_AIER_Msk;
940 RTC->RIER &= ~RTC_RIER_SNOOPIER_Msk;
954 CLK->APBCLK &= ~CLK_APBCLK_RTC_EN_Msk;
Nano102/112 peripheral access layer header file. This file contains all the peripheral register's def...
#define RTC_TAR_10SEC_Msk
#define RTC_TAR_10MIN_Pos
#define RTC_CAR_10YEAR_Pos
#define RTC_TLR_10MIN_Pos
#define RTC_CAR_10DAY_Msk
#define RTC_TLR_10SEC_Pos
#define RTC_CAR_10MON_Pos
#define RTC_SPRCTL_SNOOPEDGE_Msk
#define RTC_RIER_TIER_Msk
#define RTC_CLR_10YEAR_Pos
#define RTC_CAR_10DAY_Pos
#define RTC_CAR_10MON_Msk
#define RTC_CLR_10YEAR_Msk
#define RTC_CLR_10MON_Msk
#define RTC_CLR_1YEAR_Msk
#define RTC_CLR_10MON_Pos
#define RTC_RIER_AIER_Msk
#define RTC_CLR_1YEAR_Pos
#define RTC_CAR_1YEAR_Msk
#define RTC_CAR_10YEAR_Msk
#define RTC_TAR_10SEC_Pos
#define RTC_CAR_1YEAR_Pos
#define RTC_CLR_10DAY_Pos
#define RTC_CLR_10DAY_Msk
#define RTC_TLR_10MIN_Msk
#define RTC_SPRCTL_SNOOPEN_Msk
#define RTC_RIER_SNOOPIER_Msk
#define RTC_TSSR_24H_12H_Msk
#define RTC_TAR_10MIN_Msk
#define RTC_RIIR_SNOOPIF_Msk
#define RTC_TLR_10SEC_Msk
#define CLK
Pointer to CLK register structure.
#define RTC
Pointer to RTC register structure.
void RTC_EnableInt(uint32_t u32IntFlagMask)
The function is used to enable specified interrupt.
void RTC_32KCalibration(int32_t i32FrequencyX100)
Set Frequency Compensation Data.
uint32_t RTC_GetDayOfWeek(void)
This function is used to get day of week.
void RTC_SetDateAndTime(S_RTC_TIME_DATA_T *sPt)
This function is used to update date/time to RTC.
void RTC_GetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
Read alarm date/time from RTC setting.
void RTC_Open(S_RTC_TIME_DATA_T *sPt)
This function is used to: .
void RTC_SetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
This function is used to set alarm date/time to RTC.
void RTC_EnableTamperDetection(uint32_t u32PinCondition)
This function is used to: .
void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
This function is used to update date to RTC.
void RTC_Close(void)
Disable RTC clock.
void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
This function is used to update time to RTC.
void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
This function is used to set alarm date to RTC.
void RTC_DisableInt(uint32_t u32IntFlagMask)
The function is used to disable specified interrupt.
void RTC_DisableTamperDetection(void)
This function is used to disable tamper detection function.
void RTC_SetTickPeriod(uint32_t u32TickSelection)
The function is used to set time tick period for periodic time tick Interrupt.
void RTC_SetAlarmDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
This function is used to set alarm date to RTC.
void RTC_GetDateAndTime(S_RTC_TIME_DATA_T *sPt)
Read current date/time from RTC setting.
#define NULL
NULL pointer.
RTC define Time Data Struct.