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 int32_t i32RegInt,i32RegFra ;
65 i32RegFra = (((i32FrequencyX100%100)) * 60) / 100;
68 if ( (i32RegInt < 0) | (i32RegInt > 15) )
75 if(i32TimeoutCnt-- <= 0)
79 RTC->FCR = (uint32_t)((i32RegInt<<8) | i32RegFra);
109 volatile int32_t i32delay=1000;
117 while(
RTC->INIR != 0x1) {
118 if(i32TimeoutCnt-- <= 0)
134 if(i32TimeoutCnt-- <= 0)
137 RTC->TSSR &= ~RTC_TSSR_24H_12H_Msk;
150 if(i32TimeoutCnt-- <= 0)
161 u32Reg |= ((sPt->
u32Month / 10) << 12);
162 u32Reg |= ((sPt->
u32Month % 10) << 8);
163 u32Reg |= ((sPt->
u32Day / 10) << 4);
164 u32Reg |= (sPt->
u32Day % 10);
169 if(i32TimeoutCnt-- <= 0)
173 RTC->CLR = (uint32_t)g_u32Reg;
178 u32Reg = ((sPt->
u32Hour / 10) << 20);
179 u32Reg |= ((sPt->
u32Hour % 10) << 16);
188 if(i32TimeoutCnt-- <= 0)
192 RTC->TLR = (uint32_t)g_u32Reg;
240 u32Tmp = (g_u32hiYear * 10);
241 u32Tmp += g_u32loYear;
244 u32Tmp = (g_u32hiMonth * 10);
245 sPt->
u32Month = u32Tmp + g_u32loMonth;
247 u32Tmp = (g_u32hiDay * 10);
248 sPt->
u32Day = u32Tmp + g_u32loDay;
252 u32Tmp = (g_u32hiHour * 10);
253 u32Tmp+= g_u32loHour;
266 u32Tmp = (g_u32hiMin * 10);
270 u32Tmp = (g_u32hiSec * 10);
277 u32Tmp = (g_u32hiHour * 10);
278 u32Tmp += g_u32loHour;
281 u32Tmp = (g_u32hiMin * 10);
282 u32Tmp += g_u32loMin;
285 u32Tmp = (g_u32hiSec * 10);
286 u32Tmp += g_u32loSec;
322 if(i32TimeoutCnt-- <= 0)
335 if(i32TimeoutCnt-- <= 0)
346 u32Tmp = (g_u32hiYear * 10);
347 u32Tmp += g_u32loYear;
350 u32Tmp = (g_u32hiMonth * 10);
351 sPt->
u32Month = u32Tmp + g_u32loMonth;
353 u32Tmp = (g_u32hiDay * 10);
354 sPt->
u32Day = u32Tmp + g_u32loDay;
358 u32Tmp = (g_u32hiHour * 10);
359 u32Tmp += g_u32loHour;
372 u32Tmp = (g_u32hiMin * 10);
373 u32Tmp += g_u32loMin;
376 u32Tmp = (g_u32hiSec * 10);
377 u32Tmp += g_u32loSec;
383 u32Tmp = (g_u32hiHour * 10);
384 u32Tmp += g_u32loHour;
387 u32Tmp = (g_u32hiMin * 10);
391 u32Tmp = (g_u32hiSec * 10);
392 u32Tmp += g_u32loSec;
429 if(i32TimeoutCnt-- <= 0)
435 RTC->TSSR &= ~RTC_TSSR_24H_12H_Msk;
452 u32Reg |= ((sPt->
u32Month / 10) << 12);
453 u32Reg |= ((sPt->
u32Month % 10) << 8);
454 u32Reg |= ((sPt->
u32Day / 10) << 4);
455 u32Reg |= (sPt->
u32Day % 10);
460 if(i32TimeoutCnt-- <= 0)
464 RTC->CLR = (uint32_t)g_u32Reg;
466 u32Reg = ((sPt->
u32Hour / 10) << 20);
467 u32Reg |= ((sPt->
u32Hour % 10) << 16);
476 if(i32TimeoutCnt-- <= 0)
480 RTC->TLR = (uint32_t)g_u32Reg;
511 if(i32TimeoutCnt-- <= 0)
517 RTC->TSSR &= ~RTC_TSSR_24H_12H_Msk;
535 u32Reg |= ((sPt->
u32Month / 10) << 12);
536 u32Reg |= ((sPt->
u32Month % 10) << 8);
537 u32Reg |= ((sPt->
u32Day / 10) << 4);
538 u32Reg |= (sPt->
u32Day % 10);
543 if(i32TimeoutCnt-- <= 0)
547 RTC->CAR = (uint32_t)g_u32Reg;
549 u32Reg = ((sPt->
u32Hour / 10) << 20);
550 u32Reg |= ((sPt->
u32Hour % 10) << 16);
559 if(i32TimeoutCnt-- <= 0)
563 RTC->TAR = (uint32_t)g_u32Reg;
581void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
583 __IO uint32_t u32Reg;
589 if(i32TimeoutCnt-- <= 0)
597 u32Reg |= ((u32Month / 10) << 12);
598 u32Reg |= ((u32Month % 10) << 8);
599 u32Reg |= ((u32Day / 10) << 4);
600 u32Reg |= (u32Day % 10);
605 if(i32TimeoutCnt-- <= 0)
609 RTC->CLR = (uint32_t)g_u32Reg;
625void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
627 __IO uint32_t u32Reg;
632 if(i32TimeoutCnt-- <= 0)
638 RTC->TSSR &= ~RTC_TSSR_24H_12H_Msk;
648 u32Reg = ((u32Hour / 10) << 20);
649 u32Reg |= ((u32Hour % 10) << 16);
650 u32Reg |= ((u32Minute / 10) << 12);
651 u32Reg |= ((u32Minute % 10) << 8);
652 u32Reg |= ((u32Second / 10) << 4);
653 u32Reg |= (u32Second % 10);
659 if(i32TimeoutCnt-- <= 0)
663 RTC->TLR = (uint32_t)g_u32Reg;
679 __IO uint32_t u32Reg;
685 if(i32TimeoutCnt-- <= 0)
691 u32Reg |= ((u32Month / 10) << 12);
692 u32Reg |= ((u32Month % 10) << 8);
693 u32Reg |= ((u32Day / 10) << 4);
694 u32Reg |= (u32Day % 10);
700 if(i32TimeoutCnt-- <= 0)
704 RTC->CAR = (uint32_t)g_u32Reg;
720void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
722 __IO uint32_t u32Reg;
728 if(i32TimeoutCnt-- <= 0)
734 RTC->TSSR &= ~RTC_TSSR_24H_12H_Msk;
744 u32Reg = ((u32Hour / 10) << 20);
745 u32Reg |= ((u32Hour % 10) << 16);
746 u32Reg |= ((u32Minute / 10) << 12);
747 u32Reg |= ((u32Minute % 10) << 8);
748 u32Reg |= ((u32Second / 10) << 4);
749 u32Reg |= (u32Second % 10);
756 if(i32TimeoutCnt-- <= 0)
760 RTC->TAR = (uint32_t)g_u32Reg;
780 if(i32TimeoutCnt-- <= 0)
788 RTC->SPRCTL &= ~RTC_SPRCTL_SNOOPEDGE_Msk;
791 if(i32TimeoutCnt-- <= 0)
798 if(i32TimeoutCnt-- <= 0)
818 if(i32TimeoutCnt-- <= 0)
822 RTC->SPRCTL &= ~RTC_SPRCTL_SNOOPEN_Msk;
864 if(i32TimeoutCnt-- <= 0)
868 RTC->TTR =
RTC->TTR & ~RTC_TTR_TTR_Msk | u32TickSelection;
889 if(i32TimeoutCnt-- <= 0)
893 RTC->RIER |= u32IntFlagMask;
914 if(i32TimeoutCnt-- <= 0)
920 RTC->RIER &= ~RTC_RIER_TIER_Msk;
926 RTC->RIER &= ~RTC_RIER_AIER_Msk;
932 RTC->RIER &= ~RTC_RIER_SNOOPIER_Msk;
945 CLK->APBCLK &= ~CLK_APBCLK_RTC_EN_Msk;
Nano100 series peripheral access layer header file. This file contains all the peripheral register's ...
#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_SPRCTL_SPRRDY_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.
#define RTC_FCR_REFERENCE
void RTC_EnableInt(uint32_t u32IntFlagMask)
The function is used to enable specified interrupt.
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 write initial key to let RTC start count and set current time.
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 enable tamper detection function and set tamper control register,...
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_32KCalibration(int32_t i32FrequencyX100)
Set Frequency Compensation Data.
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.