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;
68 uint64_t u64Compensate;
71 u64Compensate = (uint64_t)(0x2710000000000);
72 u64Compensate = (uint64_t)(u64Compensate / (uint64_t)i32FrequencyX10000);
74 if(u64Compensate >= 0x400000)
76 u64Compensate = 0x3FFFFF;
80 RTC->FREQADJ = (uint32_t)u64Compensate;
117 while(
RTC->INIT != 0x1);
148 u32Reg |= ((sPt->
u32Month / 10) << 12);
149 u32Reg |= ((sPt->
u32Month % 10) << 8);
150 u32Reg |= ((sPt->
u32Day / 10) << 4);
151 u32Reg |= (sPt->
u32Day % 10);
155 RTC->CAL = (uint32_t)g_u32Reg;
160 u32Reg = ((sPt->
u32Hour / 10) << 20);
161 u32Reg |= ((sPt->
u32Hour % 10) << 16);
169 RTC->TIME = (uint32_t)g_u32Reg;
215 u32Tmp = (g_u32hiYear * 10);
216 u32Tmp += g_u32loYear;
219 u32Tmp = (g_u32hiMonth * 10);
220 sPt->
u32Month = u32Tmp + g_u32loMonth;
222 u32Tmp = (g_u32hiDay * 10);
223 sPt->
u32Day = u32Tmp + g_u32loDay;
227 u32Tmp = (g_u32hiHour * 10);
228 u32Tmp+= g_u32loHour;
241 u32Tmp = (g_u32hiMin * 10);
245 u32Tmp = (g_u32hiSec * 10);
252 u32Tmp = (g_u32hiHour * 10);
253 u32Tmp += g_u32loHour;
256 u32Tmp = (g_u32hiMin * 10);
257 u32Tmp += g_u32loMin;
260 u32Tmp = (g_u32hiSec * 10);
261 u32Tmp += g_u32loSec;
308 u32Tmp = (g_u32hiYear * 10);
309 u32Tmp += g_u32loYear;
312 u32Tmp = (g_u32hiMonth * 10);
313 sPt->
u32Month = u32Tmp + g_u32loMonth;
315 u32Tmp = (g_u32hiDay * 10);
316 sPt->
u32Day = u32Tmp + g_u32loDay;
320 u32Tmp = (g_u32hiHour * 10);
321 u32Tmp += g_u32loHour;
334 u32Tmp = (g_u32hiMin * 10);
335 u32Tmp += g_u32loMin;
338 u32Tmp = (g_u32hiSec * 10);
339 u32Tmp += g_u32loSec;
345 u32Tmp = (g_u32hiHour * 10);
346 u32Tmp += g_u32loHour;
349 u32Tmp = (g_u32hiMin * 10);
353 u32Tmp = (g_u32hiSec * 10);
354 u32Tmp += g_u32loSec;
409 u32Reg |= ((sPt->
u32Month / 10) << 12);
410 u32Reg |= ((sPt->
u32Month % 10) << 8);
411 u32Reg |= ((sPt->
u32Day / 10) << 4);
412 u32Reg |= (sPt->
u32Day % 10);
416 RTC->CAL = (uint32_t)g_u32Reg;
418 u32Reg = ((sPt->
u32Hour / 10) << 20);
419 u32Reg |= ((sPt->
u32Hour % 10) << 16);
427 RTC->TIME = (uint32_t)g_u32Reg;
478 u32Reg |= ((sPt->
u32Month / 10) << 12);
479 u32Reg |= ((sPt->
u32Month % 10) << 8);
480 u32Reg |= ((sPt->
u32Day / 10) << 4);
481 u32Reg |= (sPt->
u32Day % 10);
485 RTC->CALM = (uint32_t)g_u32Reg;
487 u32Reg = ((sPt->
u32Hour / 10) << 20);
488 u32Reg |= ((sPt->
u32Hour % 10) << 16);
496 RTC->TALM = (uint32_t)g_u32Reg;
514 void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
516 __IO uint32_t u32Reg;
523 u32Reg |= ((u32Month / 10) << 12);
524 u32Reg |= ((u32Month % 10) << 8);
525 u32Reg |= ((u32Day / 10) << 4);
526 u32Reg |= (u32Day % 10);
530 RTC->CAL = (uint32_t)g_u32Reg;
546 void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
548 __IO uint32_t u32Reg;
564 u32Reg = ((u32Hour / 10) << 20);
565 u32Reg |= ((u32Hour % 10) << 16);
566 u32Reg |= ((u32Minute / 10) << 12);
567 u32Reg |= ((u32Minute % 10) << 8);
568 u32Reg |= ((u32Second / 10) << 4);
569 u32Reg |= (u32Second % 10);
574 RTC->TIME = (uint32_t)g_u32Reg;
590 __IO uint32_t u32Reg;
594 u32Reg |= ((u32Month / 10) << 12);
595 u32Reg |= ((u32Month % 10) << 8);
596 u32Reg |= ((u32Day / 10) << 4);
597 u32Reg |= (u32Day % 10);
601 RTC->CALM = (uint32_t)g_u32Reg;
617 void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
619 __IO uint32_t u32Reg;
635 u32Reg = ((u32Hour / 10) << 20);
636 u32Reg |= ((u32Hour % 10) << 16);
637 u32Reg |= ((u32Minute / 10) << 12);
638 u32Reg |= ((u32Minute % 10) << 8);
639 u32Reg |= ((u32Second / 10) << 4);
640 u32Reg |= (u32Second % 10);
645 RTC->TALM = (uint32_t)g_u32Reg;
744 RTC->INTEN |= u32IntFlagMask;
#define RTC_TALM_TENHR_Msk
#define RTC_CAL_TENYEAR_Msk
#define RTC_TIME_TENSEC_Pos
#define RTC_CALM_TENYEAR_Pos
#define RTC_TIME_TENSEC_Msk
void RTC_SetTickPeriod(uint32_t u32TickSelection)
The function is used to set time tick period for periodic time tick Interrupt.
void RTC_32KCalibration(int32_t i32FrequencyX100)
Set Frequency Compensation Data.
#define RTC_CALM_TENDAY_Pos
void RTC_DisableInt(uint32_t u32IntFlagMask)
The function is used to disable specified interrupt.
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 RTC_TIME_TENHR_Pos
void RTC_EnableTamperDetection(uint32_t u32PinCondition)
This function is used to: .
void RTC_GetDateAndTime(S_RTC_TIME_DATA_T *sPt)
Read current date/time from RTC setting.
#define RTC_INTSTS_TICKIF_Msk
void RTC_SetAlarmDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
This function is used to set alarm date to RTC.
#define RTC_CALM_TENMON_Pos
#define RTC_TALM_TENHR_Pos
#define RTC_SPRCTL_SNPTYPE0_Msk
#define RTC_TICK_TICK_Msk
#define RTC_CAL_TENMON_Msk
void RTC_GetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
Read alarm date/time from RTC setting.
#define RTC_INTEN_SNPDIEN_Msk
#define RTC_CALM_YEAR_Msk
#define RTC
Pointer to RTC register structure.
#define RTC_RWEN_RTCBUSY_Msk
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_TIME_TENHR_Msk
#define RTC_TALM_TENSEC_Pos
void RTC_EnableInt(uint32_t u32IntFlagMask)
The function is used to enable specified interrupt.
void RTC_SetDateAndTime(S_RTC_TIME_DATA_T *sPt)
This function is used to update date/time to RTC.
#define RTC_SPRCTL_SNPDEN_Msk
#define RTC_INTSTS_SNPDIF_Msk
#define RTC_CALM_TENMON_Msk
#define RTC_CALM_TENYEAR_Msk
#define RTC_CAL_TENDAY_Msk
#define RTC_RWEN_RWENF_Msk
uint32_t RTC_GetDayOfWeek(void)
This function is used to get day of week.
#define RTC_INTSTS_ALMIF_Msk
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.
#define RTC_TALM_TENMIN_Pos
#define RTC_WEEKDAY_WEEKDAY_Msk
#define NULL
NULL pointer.
#define RTC_TIME_TENMIN_Msk
#define RTC_TALM_TENMIN_Msk
#define RTC_CALM_TENDAY_Msk
#define RTC_CLKFMT_24HEN_Msk
NANO103 peripheral access layer header file. This file contains all the peripheral register's definit...
void RTC_Open(S_RTC_TIME_DATA_T *sPt)
This function is used to: .
#define RTC_CAL_TENMON_Pos
RTC define Time Data Struct.
#define RTC_INTEN_TICKIEN_Msk
void RTC_Close(void)
Disable RTC clock.
#define RTC_CAL_TENYEAR_Pos
void RTC_DisableTamperDetection(void)
This function is used to disable tamper detection function.
#define RTC_INTEN_ALMIEN_Msk
#define CLK
Pointer to CLK register structure.
#define RTC_CAL_TENDAY_Pos
void RTC_SetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
This function is used to set alarm date/time to RTC.
#define RTC_TALM_TENSEC_Msk
#define RTC_TIME_TENMIN_Pos
#define RTC_CALM_YEAR_Pos
#define CLK_APBCLK_RTCCKEN_Msk