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;
55 if(i > u32TimeOutCount)
break;
63 if(i > u32TimeOutCount)
break;
84 uint64_t u64Compensate;
87 u64Compensate = (uint64_t)(0x2710000000000);
88 u64Compensate = (uint64_t)(u64Compensate / (uint64_t)i32FrequencyX10000);
90 if(u64Compensate >= 0x400000)
92 u64Compensate = 0x3FFFFF;
96 RTC->FREQADJ = (uint32_t)u64Compensate;
132 while(
RTC->INIT != 0x1)
134 if(u32TimeOutCount == 0)
return -1;
148 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
167 u32Reg |= ((sPt->
u32Month / 10) << 12);
168 u32Reg |= ((sPt->
u32Month % 10) << 8);
169 u32Reg |= ((sPt->
u32Day / 10) << 4);
170 u32Reg |= (sPt->
u32Day % 10);
174 RTC->CAL = (uint32_t)g_u32Reg;
179 u32Reg = ((sPt->
u32Hour / 10) << 20);
180 u32Reg |= ((sPt->
u32Hour % 10) << 16);
188 RTC->TIME = (uint32_t)g_u32Reg;
235 u32Tmp = (g_u32hiYear * 10);
236 u32Tmp += g_u32loYear;
239 u32Tmp = (g_u32hiMonth * 10);
240 sPt->
u32Month = u32Tmp + g_u32loMonth;
242 u32Tmp = (g_u32hiDay * 10);
243 sPt->
u32Day = u32Tmp + g_u32loDay;
247 u32Tmp = (g_u32hiHour * 10);
248 u32Tmp+= g_u32loHour;
261 u32Tmp = (g_u32hiMin * 10);
265 u32Tmp = (g_u32hiSec * 10);
272 u32Tmp = (g_u32hiHour * 10);
273 u32Tmp += g_u32loHour;
276 u32Tmp = (g_u32hiMin * 10);
277 u32Tmp += g_u32loMin;
280 u32Tmp = (g_u32hiSec * 10);
281 u32Tmp += g_u32loSec;
328 u32Tmp = (g_u32hiYear * 10);
329 u32Tmp += g_u32loYear;
332 u32Tmp = (g_u32hiMonth * 10);
333 sPt->
u32Month = u32Tmp + g_u32loMonth;
335 u32Tmp = (g_u32hiDay * 10);
336 sPt->
u32Day = u32Tmp + g_u32loDay;
340 u32Tmp = (g_u32hiHour * 10);
341 u32Tmp += g_u32loHour;
354 u32Tmp = (g_u32hiMin * 10);
355 u32Tmp += g_u32loMin;
358 u32Tmp = (g_u32hiSec * 10);
359 u32Tmp += g_u32loSec;
365 u32Tmp = (g_u32hiHour * 10);
366 u32Tmp += g_u32loHour;
369 u32Tmp = (g_u32hiMin * 10);
373 u32Tmp = (g_u32hiSec * 10);
374 u32Tmp += g_u32loSec;
410 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
429 u32Reg |= ((sPt->
u32Month / 10) << 12);
430 u32Reg |= ((sPt->
u32Month % 10) << 8);
431 u32Reg |= ((sPt->
u32Day / 10) << 4);
432 u32Reg |= (sPt->
u32Day % 10);
436 RTC->CAL = (uint32_t)g_u32Reg;
438 u32Reg = ((sPt->
u32Hour / 10) << 20);
439 u32Reg |= ((sPt->
u32Hour % 10) << 16);
447 RTC->TIME = (uint32_t)g_u32Reg;
479 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
498 u32Reg |= ((sPt->
u32Month / 10) << 12);
499 u32Reg |= ((sPt->
u32Month % 10) << 8);
500 u32Reg |= ((sPt->
u32Day / 10) << 4);
501 u32Reg |= (sPt->
u32Day % 10);
505 RTC->CALM = (uint32_t)g_u32Reg;
507 u32Reg = ((sPt->
u32Hour / 10) << 20);
508 u32Reg |= ((sPt->
u32Hour % 10) << 16);
516 RTC->TALM = (uint32_t)g_u32Reg;
534void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
536 __IO uint32_t u32Reg;
543 u32Reg |= ((u32Month / 10) << 12);
544 u32Reg |= ((u32Month % 10) << 8);
545 u32Reg |= ((u32Day / 10) << 4);
546 u32Reg |= (u32Day % 10);
550 RTC->CAL = (uint32_t)g_u32Reg;
566void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
568 __IO uint32_t u32Reg;
574 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
584 u32Reg = ((u32Hour / 10) << 20);
585 u32Reg |= ((u32Hour % 10) << 16);
586 u32Reg |= ((u32Minute / 10) << 12);
587 u32Reg |= ((u32Minute % 10) << 8);
588 u32Reg |= ((u32Second / 10) << 4);
589 u32Reg |= (u32Second % 10);
594 RTC->TIME = (uint32_t)g_u32Reg;
610 __IO uint32_t u32Reg;
614 u32Reg |= ((u32Month / 10) << 12);
615 u32Reg |= ((u32Month % 10) << 8);
616 u32Reg |= ((u32Day / 10) << 4);
617 u32Reg |= (u32Day % 10);
621 RTC->CALM = (uint32_t)g_u32Reg;
637void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
639 __IO uint32_t u32Reg;
645 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
655 u32Reg = ((u32Hour / 10) << 20);
656 u32Reg |= ((u32Hour % 10) << 16);
657 u32Reg |= ((u32Minute / 10) << 12);
658 u32Reg |= ((u32Minute % 10) << 8);
659 u32Reg |= ((u32Second / 10) << 4);
660 u32Reg |= (u32Second % 10);
665 RTC->TALM = (uint32_t)g_u32Reg;
688 RTC->SPRCTL &= ~RTC_SPRCTL_SNPTYPE0_Msk;
707 RTC->SPRCTL &= ~RTC_SPRCTL_SNPDEN_Msk;
746 RTC->TICK =
RTC->TICK & ~RTC_TICK_TICK_Msk | u32TickSelection;
764 RTC->INTEN |= u32IntFlagMask;
783 RTC->INTEN &= ~RTC_INTEN_TICKIEN_Msk;
790 RTC->INTEN &= ~RTC_INTEN_ALMIEN_Msk;
797 RTC->INTEN &= ~RTC_INTEN_SNPDIEN_Msk;
811 CLK->APBCLK &= ~CLK_APBCLK_RTCCKEN_Msk;
NANO103 peripheral access layer header file. This file contains all the peripheral register's definit...
#define RTC_INTEN_TICKIEN_Msk
#define RTC_CAL_TENDAY_Msk
#define RTC_CAL_TENYEAR_Msk
#define RTC_SPRCTL_SNPDEN_Msk
#define RTC_INTSTS_SNPDIF_Msk
#define RTC_TIME_TENSEC_Msk
#define RTC_TALM_TENMIN_Pos
#define RTC_INTSTS_ALMIF_Msk
#define RTC_SPRCTL_SNPTYPE0_Msk
#define RTC_TIME_TENSEC_Pos
#define RTC_TALM_TENSEC_Pos
#define RTC_TALM_TENMIN_Msk
#define RTC_CALM_TENYEAR_Msk
#define RTC_TIME_TENHR_Pos
#define RTC_CALM_YEAR_Pos
#define RTC_RWEN_RTCBUSY_Msk
#define RTC_INTEN_ALMIEN_Msk
#define RTC_CAL_TENMON_Pos
#define RTC_CALM_TENDAY_Pos
#define RTC_CLKFMT_24HEN_Msk
#define RTC_CALM_TENMON_Pos
#define RTC_CAL_TENMON_Msk
#define RTC_INTSTS_TICKIF_Msk
#define RTC_CAL_TENYEAR_Pos
#define RTC_TIME_TENMIN_Msk
#define RTC_TALM_TENSEC_Msk
#define RTC_CAL_TENDAY_Pos
#define RTC_WEEKDAY_WEEKDAY_Msk
#define RTC_INTEN_SNPDIEN_Msk
#define RTC_CALM_TENMON_Msk
#define RTC_TIME_TENMIN_Pos
#define RTC_TALM_TENHR_Pos
#define RTC_CALM_TENDAY_Msk
#define RTC_CALM_YEAR_Msk
#define RTC_TIME_TENHR_Msk
#define RTC_TALM_TENHR_Msk
#define RTC_RWEN_RWENF_Msk
#define RTC_CALM_TENYEAR_Pos
#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_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: .
int32_t RTC_Open(S_RTC_TIME_DATA_T *sPt)
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.