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);
104 volatile int32_t i32delay=1000;
112 while(
RTC->INIR != 0x1);
145 u32Reg |= ((sPt->
u32Month / 10) << 12);
146 u32Reg |= ((sPt->
u32Month % 10) << 8);
147 u32Reg |= ((sPt->
u32Day / 10) << 4);
148 u32Reg |= (sPt->
u32Day % 10);
154 RTC->CLR = (uint32_t)g_u32Reg;
159 u32Reg = ((sPt->
u32Hour / 10) << 20);
160 u32Reg |= ((sPt->
u32Hour % 10) << 16);
170 RTC->TLR = (uint32_t)g_u32Reg;
218 u32Tmp = (g_u32hiYear * 10);
219 u32Tmp += g_u32loYear;
222 u32Tmp = (g_u32hiMonth * 10);
223 sPt->
u32Month = u32Tmp + g_u32loMonth;
225 u32Tmp = (g_u32hiDay * 10);
226 sPt->
u32Day = u32Tmp + g_u32loDay;
230 u32Tmp = (g_u32hiHour * 10);
231 u32Tmp+= g_u32loHour;
244 u32Tmp = (g_u32hiMin * 10);
248 u32Tmp = (g_u32hiSec * 10);
255 u32Tmp = (g_u32hiHour * 10);
256 u32Tmp += g_u32loHour;
259 u32Tmp = (g_u32hiMin * 10);
260 u32Tmp += g_u32loMin;
263 u32Tmp = (g_u32hiSec * 10);
264 u32Tmp += g_u32loSec;
317 u32Tmp = (g_u32hiYear * 10);
318 u32Tmp += g_u32loYear;
321 u32Tmp = (g_u32hiMonth * 10);
322 sPt->
u32Month = u32Tmp + g_u32loMonth;
324 u32Tmp = (g_u32hiDay * 10);
325 sPt->
u32Day = u32Tmp + g_u32loDay;
329 u32Tmp = (g_u32hiHour * 10);
330 u32Tmp += g_u32loHour;
343 u32Tmp = (g_u32hiMin * 10);
344 u32Tmp += g_u32loMin;
347 u32Tmp = (g_u32hiSec * 10);
348 u32Tmp += g_u32loSec;
354 u32Tmp = (g_u32hiHour * 10);
355 u32Tmp += g_u32loHour;
358 u32Tmp = (g_u32hiMin * 10);
362 u32Tmp = (g_u32hiSec * 10);
363 u32Tmp += g_u32loSec;
419 u32Reg |= ((sPt->
u32Month / 10) << 12);
420 u32Reg |= ((sPt->
u32Month % 10) << 8);
421 u32Reg |= ((sPt->
u32Day / 10) << 4);
422 u32Reg |= (sPt->
u32Day % 10);
428 RTC->CLR = (uint32_t)g_u32Reg;
430 u32Reg = ((sPt->
u32Hour / 10) << 20);
431 u32Reg |= ((sPt->
u32Hour % 10) << 16);
441 RTC->TLR = (uint32_t)g_u32Reg;
492 u32Reg |= ((sPt->
u32Month / 10) << 12);
493 u32Reg |= ((sPt->
u32Month % 10) << 8);
494 u32Reg |= ((sPt->
u32Day / 10) << 4);
495 u32Reg |= (sPt->
u32Day % 10);
501 RTC->CAR = (uint32_t)g_u32Reg;
503 u32Reg = ((sPt->
u32Hour / 10) << 20);
504 u32Reg |= ((sPt->
u32Hour % 10) << 16);
514 RTC->TAR = (uint32_t)g_u32Reg;
532 void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
534 __IO uint32_t u32Reg;
543 u32Reg |= ((u32Month / 10) << 12);
544 u32Reg |= ((u32Month % 10) << 8);
545 u32Reg |= ((u32Day / 10) << 4);
546 u32Reg |= (u32Day % 10);
552 RTC->CLR = (uint32_t)g_u32Reg;
568 void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
570 __IO uint32_t u32Reg;
587 u32Reg = ((u32Hour / 10) << 20);
588 u32Reg |= ((u32Hour % 10) << 16);
589 u32Reg |= ((u32Minute / 10) << 12);
590 u32Reg |= ((u32Minute % 10) << 8);
591 u32Reg |= ((u32Second / 10) << 4);
592 u32Reg |= (u32Second % 10);
599 RTC->TLR = (uint32_t)g_u32Reg;
615 __IO uint32_t u32Reg;
622 u32Reg |= ((u32Month / 10) << 12);
623 u32Reg |= ((u32Month % 10) << 8);
624 u32Reg |= ((u32Day / 10) << 4);
625 u32Reg |= (u32Day % 10);
631 RTC->CAR = (uint32_t)g_u32Reg;
647 void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
649 __IO uint32_t u32Reg;
666 u32Reg = ((u32Hour / 10) << 20);
667 u32Reg |= ((u32Hour % 10) << 16);
668 u32Reg |= ((u32Minute / 10) << 12);
669 u32Reg |= ((u32Minute % 10) << 8);
670 u32Reg |= ((u32Second / 10) << 4);
671 u32Reg |= (u32Second % 10);
678 RTC->TAR = (uint32_t)g_u32Reg;
781 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 enable tamper detection function and set tamper control register,...
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 write initial key to let RTC start count and set current time.
#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