40 static volatile uint32_t g_u32Reg, g_u32Reg1,g_u32hiYear,g_u32loYear,g_u32hiMonth,g_u32loMonth,g_u32hiDay,g_u32loDay;
41 static volatile uint32_t g_u32hiHour,g_u32loHour,g_u32hiMin,g_u32loMin,g_u32hiSec,g_u32loSec;
60 int32_t i32RegInt,i32RegFra ;
64 i32RegFra = (((i32FrequencyX100%100)) * 60) / 100;
67 if ( (i32RegInt < 0) | (i32RegInt > 15) )
75 RTC->FCR = (uint32_t)((i32RegInt<<8) | i32RegFra);
106 volatile int32_t i32delay=1000;
114 while(
RTC->INIR != 0x1);
147 u32Reg |= ((sPt->
u32Month / 10) << 12);
148 u32Reg |= ((sPt->
u32Month % 10) << 8);
149 u32Reg |= ((sPt->
u32Day / 10) << 4);
150 u32Reg |= (sPt->
u32Day % 10);
156 RTC->CLR = (uint32_t)g_u32Reg;
161 u32Reg = ((sPt->
u32Hour / 10) << 20);
162 u32Reg |= ((sPt->
u32Hour % 10) << 16);
172 RTC->TLR = (uint32_t)g_u32Reg;
220 u32Tmp = (g_u32hiYear * 10);
221 u32Tmp += g_u32loYear;
224 u32Tmp = (g_u32hiMonth * 10);
225 sPt->
u32Month = u32Tmp + g_u32loMonth;
227 u32Tmp = (g_u32hiDay * 10);
228 sPt->
u32Day = u32Tmp + g_u32loDay;
232 u32Tmp = (g_u32hiHour * 10);
233 u32Tmp+= g_u32loHour;
246 u32Tmp = (g_u32hiMin * 10);
250 u32Tmp = (g_u32hiSec * 10);
257 u32Tmp = (g_u32hiHour * 10);
258 u32Tmp += g_u32loHour;
261 u32Tmp = (g_u32hiMin * 10);
262 u32Tmp += g_u32loMin;
265 u32Tmp = (g_u32hiSec * 10);
266 u32Tmp += g_u32loSec;
319 u32Tmp = (g_u32hiYear * 10);
320 u32Tmp += g_u32loYear;
323 u32Tmp = (g_u32hiMonth * 10);
324 sPt->
u32Month = u32Tmp + g_u32loMonth;
326 u32Tmp = (g_u32hiDay * 10);
327 sPt->
u32Day = u32Tmp + g_u32loDay;
331 u32Tmp = (g_u32hiHour * 10);
332 u32Tmp += g_u32loHour;
345 u32Tmp = (g_u32hiMin * 10);
346 u32Tmp += g_u32loMin;
349 u32Tmp = (g_u32hiSec * 10);
350 u32Tmp += g_u32loSec;
356 u32Tmp = (g_u32hiHour * 10);
357 u32Tmp += g_u32loHour;
360 u32Tmp = (g_u32hiMin * 10);
364 u32Tmp = (g_u32hiSec * 10);
365 u32Tmp += g_u32loSec;
421 u32Reg |= ((sPt->
u32Month / 10) << 12);
422 u32Reg |= ((sPt->
u32Month % 10) << 8);
423 u32Reg |= ((sPt->
u32Day / 10) << 4);
424 u32Reg |= (sPt->
u32Day % 10);
430 RTC->CLR = (uint32_t)g_u32Reg;
432 u32Reg = ((sPt->
u32Hour / 10) << 20);
433 u32Reg |= ((sPt->
u32Hour % 10) << 16);
443 RTC->TLR = (uint32_t)g_u32Reg;
494 u32Reg |= ((sPt->
u32Month / 10) << 12);
495 u32Reg |= ((sPt->
u32Month % 10) << 8);
496 u32Reg |= ((sPt->
u32Day / 10) << 4);
497 u32Reg |= (sPt->
u32Day % 10);
503 RTC->CAR = (uint32_t)g_u32Reg;
505 u32Reg = ((sPt->
u32Hour / 10) << 20);
506 u32Reg |= ((sPt->
u32Hour % 10) << 16);
516 RTC->TAR = (uint32_t)g_u32Reg;
534 void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
536 __IO uint32_t u32Reg;
545 u32Reg |= ((u32Month / 10) << 12);
546 u32Reg |= ((u32Month % 10) << 8);
547 u32Reg |= ((u32Day / 10) << 4);
548 u32Reg |= (u32Day % 10);
554 RTC->CLR = (uint32_t)g_u32Reg;
570 void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
572 __IO uint32_t u32Reg;
589 u32Reg = ((u32Hour / 10) << 20);
590 u32Reg |= ((u32Hour % 10) << 16);
591 u32Reg |= ((u32Minute / 10) << 12);
592 u32Reg |= ((u32Minute % 10) << 8);
593 u32Reg |= ((u32Second / 10) << 4);
594 u32Reg |= (u32Second % 10);
601 RTC->TLR = (uint32_t)g_u32Reg;
617 __IO uint32_t u32Reg;
624 u32Reg |= ((u32Month / 10) << 12);
625 u32Reg |= ((u32Month % 10) << 8);
626 u32Reg |= ((u32Day / 10) << 4);
627 u32Reg |= (u32Day % 10);
633 RTC->CAR = (uint32_t)g_u32Reg;
649 void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
651 __IO uint32_t u32Reg;
668 u32Reg = ((u32Hour / 10) << 20);
669 u32Reg |= ((u32Hour % 10) << 16);
670 u32Reg |= ((u32Minute / 10) << 12);
671 u32Reg |= ((u32Minute % 10) << 8);
672 u32Reg |= ((u32Second / 10) << 4);
673 u32Reg |= (u32Second % 10);
680 RTC->TAR = (uint32_t)g_u32Reg;
785 RTC->RIER |= u32IntFlagMask;
void RTC_DisableTamperDetection(void)
This function is used to disable tamper detection function.
#define RTC_RIIR_SNOOPIF_Msk
#define RTC_RIER_AIER_Msk
#define RTC_TAR_10MIN_Pos
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.
uint32_t RTC_GetDayOfWeek(void)
This function is used to get day of week.
#define RTC_RIER_SNOOPIER_Msk
#define RTC_TLR_10MIN_Pos
void RTC_GetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
Read alarm date/time from RTC setting.
#define CLK
Pointer to CLK register structure.
#define RTC_CLR_10DAY_Msk
#define RTC
Pointer to RTC register structure.
#define RTC_SPRCTL_SNOOPEN_Msk
#define RTC_CAR_10YEAR_Pos
#define RTC_CAR_10DAY_Msk
#define RTC_TSSR_24H_12H_Msk
#define RTC_TAR_10SEC_Msk
Nano100 series peripheral access layer header file. This file contains all the peripheral register's ...
void RTC_EnableTamperDetection(uint32_t u32PinCondition)
This function is used to: .
void RTC_SetDateAndTime(S_RTC_TIME_DATA_T *sPt)
This function is used to update date/time to RTC.
#define NULL
NULL pointer.
#define RTC_CLR_1YEAR_Msk
void RTC_GetDateAndTime(S_RTC_TIME_DATA_T *sPt)
Read current date/time from RTC setting.
#define RTC_CLR_10YEAR_Pos
void RTC_Close(void)
Disable RTC clock.
#define RTC_TAR_10SEC_Pos
void RTC_SetTickPeriod(uint32_t u32TickSelection)
The function is used to set time tick period for periodic time tick Interrupt.
#define RTC_CLR_10MON_Pos
#define RTC_CLR_10DAY_Pos
void RTC_32KCalibration(int32_t i32FrequencyX100)
Set Frequency Compensation Data.
#define RTC_TLR_10SEC_Pos
#define RTC_SPRCTL_SNOOPEDGE_Msk
void RTC_EnableInt(uint32_t u32IntFlagMask)
The function is used to enable specified interrupt.
#define RTC_CAR_1YEAR_Pos
#define RTC_CAR_10YEAR_Msk
#define RTC_CAR_10MON_Msk
void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
This function is used to update date to RTC.
#define CLK_APBCLK_RTC_EN_Msk
#define RTC_CLR_10YEAR_Msk
#define RTC_CAR_1YEAR_Msk
#define RTC_TLR_10SEC_Msk
#define RTC_CAR_10MON_Pos
void RTC_SetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
This function is used to set alarm date/time to RTC.
#define RTC_FCR_REFERENCE
RTC define Time Data Struct.
void RTC_SetAlarmDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
This function is used to set alarm date to RTC.
#define RTC_CAR_10DAY_Pos
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.
#define RTC_SPRCTL_SPRRDY_Msk
#define RTC_CLR_10MON_Msk
void RTC_Open(S_RTC_TIME_DATA_T *sPt)
This function is used to: .
#define RTC_TAR_10MIN_Msk
#define RTC_TLR_10MIN_Msk
void RTC_DisableInt(uint32_t u32IntFlagMask)
The function is used to disable specified interrupt.
#define RTC_RIER_TIER_Msk
#define RTC_CLR_1YEAR_Pos