| M480 BSP V3.05.001 The Board Support Package for M480 Series

rtc.c
Go to the documentation of this file.
1 /**************************************************************************/
9 #include "NuMicro.h"
10
11
14 /*---------------------------------------------------------------------------------------------------------*/
15 /* Macro, type and constant definitions */
16 /*---------------------------------------------------------------------------------------------------------*/
17 #define RTC_GLOBALS
18
19 /*---------------------------------------------------------------------------------------------------------*/
20 /* Global file scope (static) variables */
21 /*---------------------------------------------------------------------------------------------------------*/
22 static volatile uint32_t g_u32hiYear, g_u32loYear, g_u32hiMonth, g_u32loMonth, g_u32hiDay, g_u32loDay;
23 static volatile uint32_t g_u32hiHour, g_u32loHour, g_u32hiMin, g_u32loMin, g_u32hiSec, g_u32loSec;
24
66 void RTC_Open(S_RTC_TIME_DATA_T *sPt)
67 {
68 RTC->INIT = RTC_INIT_KEY;
69
70 if(RTC->INIT != RTC_INIT_ACTIVE_Msk)
71 {
72 RTC->INIT = RTC_INIT_KEY;
73 while(RTC->INIT != RTC_INIT_ACTIVE_Msk)
74 {
75 }
76 }
77
78 if(sPt == 0)
79 {
80 }
81 else
82 {
83 /* Set RTC date and time */
84 RTC_SetDateAndTime(sPt);
85 }
86 }
87
97 void RTC_Close(void)
98 {
99 CLK->APBCLK0 &= ~CLK_APBCLK0_RTCCKEN_Msk;
100 }
101
110 void RTC_32KCalibration(int32_t i32FrequencyX10000)
111 {
112 uint64_t u64Compensate;
113 int32_t i32RegInt,i32RegFra ;
114
115 if(!(SYS->CSERVER & 0x1))
116 {
117 u64Compensate = (uint64_t)(0x2710000000000);
118 u64Compensate = (uint64_t)(u64Compensate / (uint64_t)i32FrequencyX10000);
119
120 if(u64Compensate >= (uint64_t)0x400000)
121 {
122 u64Compensate = (uint64_t)0x3FFFFF;
123 }
124
125 RTC_WaitAccessEnable();
126 RTC->FREQADJ = (uint32_t)u64Compensate;
127 }
128 else
129 {
130 /* Compute Integer and Fraction for RTC register*/
131 i32RegInt = (i32FrequencyX10000/10000) - 32752;
132 i32RegFra = ((((i32FrequencyX10000%10000)) * 64) + 5000) / 10000;
133
134 if(i32RegFra >= 0x40)
135 {
136 i32RegFra = 0x0;
137 i32RegInt++;
138 }
139
140 /* Judge Integer part is reasonable */
141 if ( (i32RegInt < 0) | (i32RegInt > 31) )
142 {
143 return;
144 }
145
146 RTC_WaitAccessEnable();
147 RTC->FREQADJ = (uint32_t)((i32RegInt<<8) | i32RegFra);
148 }
149
150 }
151
170 void RTC_GetDateAndTime(S_RTC_TIME_DATA_T *sPt)
171 {
172 uint32_t u32Tmp;
173
174 sPt->u32TimeScale = RTC->CLKFMT & RTC_CLKFMT_24HEN_Msk; /* 12/24-hour */
175 sPt->u32DayOfWeek = RTC->WEEKDAY & RTC_WEEKDAY_WEEKDAY_Msk; /* Day of the week */
176
177 /* Get [Date digit] data */
178 g_u32hiYear = (RTC->CAL & RTC_CAL_TENYEAR_Msk) >> RTC_CAL_TENYEAR_Pos;
179 g_u32loYear = (RTC->CAL & RTC_CAL_YEAR_Msk) >> RTC_CAL_YEAR_Pos;
180 g_u32hiMonth = (RTC->CAL & RTC_CAL_TENMON_Msk) >> RTC_CAL_TENMON_Pos;
181 g_u32loMonth = (RTC->CAL & RTC_CAL_MON_Msk) >> RTC_CAL_MON_Pos;
182 g_u32hiDay = (RTC->CAL & RTC_CAL_TENDAY_Msk) >> RTC_CAL_TENDAY_Pos;
183 g_u32loDay = (RTC->CAL & RTC_CAL_DAY_Msk) >> RTC_CAL_DAY_Pos;
184
185 /* Get [Time digit] data */
186 g_u32hiHour = (RTC->TIME & RTC_TIME_TENHR_Msk) >> RTC_TIME_TENHR_Pos;
187 g_u32loHour = (RTC->TIME & RTC_TIME_HR_Msk) >> RTC_TIME_HR_Pos;
188 g_u32hiMin = (RTC->TIME & RTC_TIME_TENMIN_Msk) >> RTC_TIME_TENMIN_Pos;
189 g_u32loMin = (RTC->TIME & RTC_TIME_MIN_Msk) >> RTC_TIME_MIN_Pos;
190 g_u32hiSec = (RTC->TIME & RTC_TIME_TENSEC_Msk) >> RTC_TIME_TENSEC_Pos;
191 g_u32loSec = (RTC->TIME & RTC_TIME_SEC_Msk) >> RTC_TIME_SEC_Pos;
192
193 /* Compute to 20XX year */
194 u32Tmp = (g_u32hiYear * 10ul);
195 u32Tmp += g_u32loYear;
196 sPt->u32Year = u32Tmp + RTC_YEAR2000;
197
198 /* Compute 0~12 month */
199 u32Tmp = (g_u32hiMonth * 10ul);
200 sPt->u32Month = u32Tmp + g_u32loMonth;
201
202 /* Compute 0~31 day */
203 u32Tmp = (g_u32hiDay * 10ul);
204 sPt->u32Day = u32Tmp + g_u32loDay;
205
206 /* Compute 12/24 hour */
207 if(sPt->u32TimeScale == RTC_CLOCK_12)
208 {
209 u32Tmp = (g_u32hiHour * 10ul);
210 u32Tmp += g_u32loHour;
211 sPt->u32Hour = u32Tmp; /* AM: 1~12. PM: 21~32. */
212
213 if(sPt->u32Hour >= 21ul)
214 {
215 sPt->u32AmPm = RTC_PM;
216 sPt->u32Hour -= 20ul;
217 }
218 else
219 {
220 sPt->u32AmPm = RTC_AM;
221 }
222
223 u32Tmp = (g_u32hiMin * 10ul);
224 u32Tmp += g_u32loMin;
225 sPt->u32Minute = u32Tmp;
226
227 u32Tmp = (g_u32hiSec * 10ul);
228 u32Tmp += g_u32loSec;
229 sPt->u32Second = u32Tmp;
230 }
231 else
232 {
233 u32Tmp = (g_u32hiHour * 10ul);
234 u32Tmp += g_u32loHour;
235 sPt->u32Hour = u32Tmp;
236
237 u32Tmp = (g_u32hiMin * 10ul);
238 u32Tmp += g_u32loMin;
239 sPt->u32Minute = u32Tmp;
240
241 u32Tmp = (g_u32hiSec * 10ul);
242 u32Tmp += g_u32loSec;
243 sPt->u32Second = u32Tmp;
244 }
245 }
246
265 void RTC_GetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
266 {
267 uint32_t u32Tmp;
268
269 sPt->u32TimeScale = RTC->CLKFMT & RTC_CLKFMT_24HEN_Msk; /* 12/24-hour */
270 sPt->u32DayOfWeek = RTC->WEEKDAY & RTC_WEEKDAY_WEEKDAY_Msk; /* Day of the week */
271
272 /* Get alarm [Date digit] data */
273 RTC_WaitAccessEnable();
274 g_u32hiYear = (RTC->CALM & RTC_CALM_TENYEAR_Msk) >> RTC_CALM_TENYEAR_Pos;
275 g_u32loYear = (RTC->CALM & RTC_CALM_YEAR_Msk) >> RTC_CALM_YEAR_Pos;
276 g_u32hiMonth = (RTC->CALM & RTC_CALM_TENMON_Msk) >> RTC_CALM_TENMON_Pos;
277 g_u32loMonth = (RTC->CALM & RTC_CALM_MON_Msk) >> RTC_CALM_MON_Pos;
278 g_u32hiDay = (RTC->CALM & RTC_CALM_TENDAY_Msk) >> RTC_CALM_TENDAY_Pos;
279 g_u32loDay = (RTC->CALM & RTC_CALM_DAY_Msk) >> RTC_CALM_DAY_Pos;
280
281 /* Get alarm [Time digit] data */
282 RTC_WaitAccessEnable();
283 g_u32hiHour = (RTC->TALM & RTC_TALM_TENHR_Msk) >> RTC_TALM_TENHR_Pos;
284 g_u32loHour = (RTC->TALM & RTC_TALM_HR_Msk) >> RTC_TALM_HR_Pos;
285 g_u32hiMin = (RTC->TALM & RTC_TALM_TENMIN_Msk) >> RTC_TALM_TENMIN_Pos;
286 g_u32loMin = (RTC->TALM & RTC_TALM_MIN_Msk) >> RTC_TALM_MIN_Pos;
287 g_u32hiSec = (RTC->TALM & RTC_TALM_TENSEC_Msk) >> RTC_TALM_TENSEC_Pos;
288 g_u32loSec = (RTC->TALM & RTC_TALM_SEC_Msk) >> RTC_TALM_SEC_Pos;
289
290 /* Compute to 20XX year */
291 u32Tmp = (g_u32hiYear * 10ul);
292 u32Tmp += g_u32loYear;
293 sPt->u32Year = u32Tmp + RTC_YEAR2000;
294
295 /* Compute 0~12 month */
296 u32Tmp = (g_u32hiMonth * 10ul);
297 sPt->u32Month = u32Tmp + g_u32loMonth;
298
299 /* Compute 0~31 day */
300 u32Tmp = (g_u32hiDay * 10ul);
301 sPt->u32Day = u32Tmp + g_u32loDay;
302
303 /* Compute 12/24 hour */
304 if(sPt->u32TimeScale == RTC_CLOCK_12)
305 {
306 u32Tmp = (g_u32hiHour * 10ul);
307 u32Tmp += g_u32loHour;
308 sPt->u32Hour = u32Tmp; /* AM: 1~12. PM: 21~32. */
309
310 if(sPt->u32Hour >= 21ul)
311 {
312 sPt->u32AmPm = RTC_PM;
313 sPt->u32Hour -= 20ul;
314 }
315 else
316 {
317 sPt->u32AmPm = RTC_AM;
318 }
319
320 u32Tmp = (g_u32hiMin * 10ul);
321 u32Tmp += g_u32loMin;
322 sPt->u32Minute = u32Tmp;
323
324 u32Tmp = (g_u32hiSec * 10ul);
325 u32Tmp += g_u32loSec;
326 sPt->u32Second = u32Tmp;
327
328 }
329 else
330 {
331 u32Tmp = (g_u32hiHour * 10ul);
332 u32Tmp += g_u32loHour;
333 sPt->u32Hour = u32Tmp;
334
335 u32Tmp = (g_u32hiMin * 10ul);
336 u32Tmp += g_u32loMin;
337 sPt->u32Minute = u32Tmp;
338
339 u32Tmp = (g_u32hiSec * 10ul);
340 u32Tmp += g_u32loSec;
341 sPt->u32Second = u32Tmp;
342 }
343 }
344
365 void RTC_SetDateAndTime(S_RTC_TIME_DATA_T *sPt)
366 {
367 uint32_t u32RegCAL, u32RegTIME;
368
369 if(sPt == 0ul)
370 {
371 }
372 else
373 {
374 /*-----------------------------------------------------------------------------------------------------*/
375 /* Set RTC 24/12 hour setting and Day of the Week */
376 /*-----------------------------------------------------------------------------------------------------*/
377 RTC_WaitAccessEnable();
378 if(sPt->u32TimeScale == RTC_CLOCK_12)
379 {
380 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
381
382 /*-------------------------------------------------------------------------------------------------*/
383 /* Important, range of 12-hour PM mode is 21 up to 32 */
384 /*-------------------------------------------------------------------------------------------------*/
385 if(sPt->u32AmPm == RTC_PM)
386 {
387 sPt->u32Hour += 20ul;
388 }
389 }
390 else
391 {
392 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
393 }
394
395 /* Set Day of the Week */
396 RTC_WaitAccessEnable();
397 RTC->WEEKDAY = sPt->u32DayOfWeek;
398
399 /*-----------------------------------------------------------------------------------------------------*/
400 /* Set RTC Current Date and Time */
401 /*-----------------------------------------------------------------------------------------------------*/
402 u32RegCAL = ((sPt->u32Year - RTC_YEAR2000) / 10ul) << 20;
403 u32RegCAL |= (((sPt->u32Year - RTC_YEAR2000) % 10ul) << 16);
404 u32RegCAL |= ((sPt->u32Month / 10ul) << 12);
405 u32RegCAL |= ((sPt->u32Month % 10ul) << 8);
406 u32RegCAL |= ((sPt->u32Day / 10ul) << 4);
407 u32RegCAL |= (sPt->u32Day % 10ul);
408
409 u32RegTIME = ((sPt->u32Hour / 10ul) << 20);
410 u32RegTIME |= ((sPt->u32Hour % 10ul) << 16);
411 u32RegTIME |= ((sPt->u32Minute / 10ul) << 12);
412 u32RegTIME |= ((sPt->u32Minute % 10ul) << 8);
413 u32RegTIME |= ((sPt->u32Second / 10ul) << 4);
414 u32RegTIME |= (sPt->u32Second % 10ul);
415
416 /*-----------------------------------------------------------------------------------------------------*/
417 /* Set RTC Calender and Time Loading */
418 /*-----------------------------------------------------------------------------------------------------*/
419 RTC_WaitAccessEnable();
420 RTC->CAL = (uint32_t)u32RegCAL;
421 RTC_WaitAccessEnable();
422 RTC->TIME = (uint32_t)u32RegTIME;
423 }
424 }
425
446 void RTC_SetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
447 {
448 uint32_t u32RegCALM, u32RegTALM;
449
450 if(sPt == 0)
451 {
452 }
453 else
454 {
455 /*-----------------------------------------------------------------------------------------------------*/
456 /* Set RTC 24/12 hour setting and Day of the Week */
457 /*-----------------------------------------------------------------------------------------------------*/
458 RTC_WaitAccessEnable();
459 if(sPt->u32TimeScale == RTC_CLOCK_12)
460 {
461 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
462
463 /*-------------------------------------------------------------------------------------------------*/
464 /* Important, range of 12-hour PM mode is 21 up to 32 */
465 /*-------------------------------------------------------------------------------------------------*/
466 if(sPt->u32AmPm == RTC_PM)
467 {
468 sPt->u32Hour += 20ul;
469 }
470 }
471 else
472 {
473 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
474 }
475
476 /*-----------------------------------------------------------------------------------------------------*/
477 /* Set RTC Alarm Date and Time */
478 /*-----------------------------------------------------------------------------------------------------*/
479 u32RegCALM = ((sPt->u32Year - RTC_YEAR2000) / 10ul) << 20;
480 u32RegCALM |= (((sPt->u32Year - RTC_YEAR2000) % 10ul) << 16);
481 u32RegCALM |= ((sPt->u32Month / 10ul) << 12);
482 u32RegCALM |= ((sPt->u32Month % 10ul) << 8);
483 u32RegCALM |= ((sPt->u32Day / 10ul) << 4);
484 u32RegCALM |= (sPt->u32Day % 10ul);
485
486 u32RegTALM = ((sPt->u32Hour / 10ul) << 20);
487 u32RegTALM |= ((sPt->u32Hour % 10ul) << 16);
488 u32RegTALM |= ((sPt->u32Minute / 10ul) << 12);
489 u32RegTALM |= ((sPt->u32Minute % 10ul) << 8);
490 u32RegTALM |= ((sPt->u32Second / 10ul) << 4);
491 u32RegTALM |= (sPt->u32Second % 10ul);
492
493 RTC_WaitAccessEnable();
494 RTC->CALM = (uint32_t)u32RegCALM;
495 RTC_WaitAccessEnable();
496 RTC->TALM = (uint32_t)u32RegTALM;
497 }
498 }
499
514 void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
515 {
516 uint32_t u32RegCAL;
517
518 u32RegCAL = ((u32Year - RTC_YEAR2000) / 10ul) << 20;
519 u32RegCAL |= (((u32Year - RTC_YEAR2000) % 10ul) << 16);
520 u32RegCAL |= ((u32Month / 10ul) << 12);
521 u32RegCAL |= ((u32Month % 10ul) << 8);
522 u32RegCAL |= ((u32Day / 10ul) << 4);
523 u32RegCAL |= (u32Day % 10ul);
524
525 /* Set Day of the Week */
526 RTC_WaitAccessEnable();
527 RTC->WEEKDAY = u32DayOfWeek & RTC_WEEKDAY_WEEKDAY_Msk;
528
529 /* Set RTC Calender Loading */
530 RTC_WaitAccessEnable();
531 RTC->CAL = (uint32_t)u32RegCAL;
532 }
533
547 void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
548 {
549 uint32_t u32RegTIME;
550
551 /* Important, range of 12-hour PM mode is 21 up to 32 */
552 if((u32TimeMode == RTC_CLOCK_12) && (u32AmPm == RTC_PM))
553 {
554 u32Hour += 20ul;
555 }
556
557 u32RegTIME = ((u32Hour / 10ul) << 20);
558 u32RegTIME |= ((u32Hour % 10ul) << 16);
559 u32RegTIME |= ((u32Minute / 10ul) << 12);
560 u32RegTIME |= ((u32Minute % 10ul) << 8);
561 u32RegTIME |= ((u32Second / 10ul) << 4);
562 u32RegTIME |= (u32Second % 10ul);
563
564 /*-----------------------------------------------------------------------------------------------------*/
565 /* Set RTC 24/12 hour setting and Day of the Week */
566 /*-----------------------------------------------------------------------------------------------------*/
567 RTC_WaitAccessEnable();
568 if(u32TimeMode == RTC_CLOCK_12)
569 {
570 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
571 }
572 else
573 {
574 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
575 }
576
577 RTC_WaitAccessEnable();
578 RTC->TIME = (uint32_t)u32RegTIME;
579 }
580
592 void RTC_SetAlarmDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
593 {
594 uint32_t u32RegCALM;
595
596 u32RegCALM = ((u32Year - RTC_YEAR2000) / 10ul) << 20;
597 u32RegCALM |= (((u32Year - RTC_YEAR2000) % 10ul) << 16);
598 u32RegCALM |= ((u32Month / 10ul) << 12);
599 u32RegCALM |= ((u32Month % 10ul) << 8);
600 u32RegCALM |= ((u32Day / 10ul) << 4);
601 u32RegCALM |= (u32Day % 10ul);
602
603 RTC_WaitAccessEnable();
604
605 /* Set RTC Alarm Date */
606 RTC->CALM = (uint32_t)u32RegCALM;
607 }
608
622 void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
623 {
624 uint32_t u32RegTALM;
625
626 /* Important, range of 12-hour PM mode is 21 up to 32 */
627 if((u32TimeMode == RTC_CLOCK_12) && (u32AmPm == RTC_PM))
628 {
629 u32Hour += 20ul;
630 }
631
632 u32RegTALM = ((u32Hour / 10ul) << 20);
633 u32RegTALM |= ((u32Hour % 10ul) << 16);
634 u32RegTALM |= ((u32Minute / 10ul) << 12);
635 u32RegTALM |= ((u32Minute % 10ul) << 8);
636 u32RegTALM |= ((u32Second / 10ul) << 4);
637 u32RegTALM |= (u32Second % 10ul);
638
639 /*-----------------------------------------------------------------------------------------------------*/
640 /* Set RTC 24/12 hour setting and Day of the Week */
641 /*-----------------------------------------------------------------------------------------------------*/
642 RTC_WaitAccessEnable();
643 if(u32TimeMode == RTC_CLOCK_12)
644 {
645 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
646 }
647 else
648 {
649 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
650 }
651
652 /* Set RTC Alarm Time */
653 RTC_WaitAccessEnable();
654 RTC->TALM = (uint32_t)u32RegTALM;
655 }
656
671 void RTC_SetAlarmDateMask(uint8_t u8IsTenYMsk, uint8_t u8IsYMsk, uint8_t u8IsTenMMsk, uint8_t u8IsMMsk, uint8_t u8IsTenDMsk, uint8_t u8IsDMsk)
672 {
673 RTC_WaitAccessEnable();
674 RTC->CAMSK = ((uint32_t)u8IsTenYMsk << RTC_CAMSK_MTENYEAR_Pos) |
675 ((uint32_t)u8IsYMsk << RTC_CAMSK_MYEAR_Pos) |
676 ((uint32_t)u8IsTenMMsk << RTC_CAMSK_MTENMON_Pos) |
677 ((uint32_t)u8IsMMsk << RTC_CAMSK_MMON_Pos) |
678 ((uint32_t)u8IsTenDMsk << RTC_CAMSK_MTENDAY_Pos) |
679 ((uint32_t)u8IsDMsk << RTC_CAMSK_MDAY_Pos);
680 }
681
696 void RTC_SetAlarmTimeMask(uint8_t u8IsTenHMsk, uint8_t u8IsHMsk, uint8_t u8IsTenMMsk, uint8_t u8IsMMsk, uint8_t u8IsTenSMsk, uint8_t u8IsSMsk)
697 {
698 RTC_WaitAccessEnable();
699 RTC->TAMSK = ((uint32_t)u8IsTenHMsk << RTC_TAMSK_MTENHR_Pos) |
700 ((uint32_t)u8IsHMsk << RTC_TAMSK_MHR_Pos) |
701 ((uint32_t)u8IsTenMMsk << RTC_TAMSK_MTENMIN_Pos) |
702 ((uint32_t)u8IsMMsk << RTC_TAMSK_MMIN_Pos) |
703 ((uint32_t)u8IsTenSMsk << RTC_TAMSK_MTENSEC_Pos) |
704 ((uint32_t)u8IsSMsk << RTC_TAMSK_MSEC_Pos);
705 }
706
722 uint32_t RTC_GetDayOfWeek(void)
723 {
724 return (RTC->WEEKDAY & RTC_WEEKDAY_WEEKDAY_Msk);
725 }
726
745 void RTC_SetTickPeriod(uint32_t u32TickSelection)
746 {
747 RTC_WaitAccessEnable();
748
749 RTC->TICK = (RTC->TICK & ~RTC_TICK_TICK_Msk) | u32TickSelection;
750 }
751
769 void RTC_EnableInt(uint32_t u32IntFlagMask)
770 {
771 RTC_WaitAccessEnable();
772 RTC->INTEN |= u32IntFlagMask;
773 }
774
792 void RTC_DisableInt(uint32_t u32IntFlagMask)
793 {
794 RTC_WaitAccessEnable();
795 RTC->INTEN &= ~u32IntFlagMask;
796 RTC_WaitAccessEnable();
797 RTC->INTSTS = u32IntFlagMask;
798 }
799
809 void RTC_EnableSpareAccess(void)
810 {
811 RTC_WaitAccessEnable();
812
813 RTC->SPRCTL |= RTC_SPRCTL_SPRRWEN_Msk;
814 }
815
825 void RTC_DisableSpareRegister(void)
826 {
827 RTC_WaitAccessEnable();
828
829 RTC->SPRCTL &= ~RTC_SPRCTL_SPRRWEN_Msk;
830 }
831
855 void RTC_StaticTamperEnable(uint32_t u32TamperSelect, uint32_t u32DetecLevel, uint32_t u32DebounceEn)
856 {
857 uint32_t i;
858 uint32_t u32Reg;
859 uint32_t u32TmpReg;
860
861 RTC_WaitAccessEnable();
862 u32Reg = RTC->TAMPCTL;
863
864 u32TmpReg = ( RTC_TAMPCTL_TAMP0EN_Msk | (u32DetecLevel << RTC_TAMPCTL_TAMP0LV_Pos) |
865 (u32DebounceEn << RTC_TAMPCTL_TAMP0DBEN_Pos) );
866
867 for(i = 0ul; i < MAX_TAMPER_PIN_NUM; i++)
868 {
869 if(u32TamperSelect & (0x1ul << i))
870 {
871 u32Reg &= ~((RTC_TAMPCTL_TAMP0EN_Msk|RTC_TAMPCTL_TAMP0LV_Msk|RTC_TAMPCTL_TAMP0DBEN_Msk) << (i*4ul));
872 u32Reg |= (u32TmpReg << (i*4ul));
873 }
874 }
875
876 RTC_WaitAccessEnable();
877 RTC->TAMPCTL = u32Reg;
878
879 }
880
896 void RTC_StaticTamperDisable(uint32_t u32TamperSelect)
897 {
898 uint32_t i;
899 uint32_t u32Reg;
900 uint32_t u32TmpReg;
901
902 RTC_WaitAccessEnable();
903 u32Reg = RTC->TAMPCTL;
904
905 u32TmpReg = (RTC_TAMPCTL_TAMP0EN_Msk);
906
907 for(i = 0ul; i < MAX_TAMPER_PIN_NUM; i++)
908 {
909 if(u32TamperSelect & (0x1ul << i))
910 {
911 u32Reg &= ~(u32TmpReg << (i*4ul));
912 }
913 }
914
915 RTC_WaitAccessEnable();
916 RTC->TAMPCTL = u32Reg;
917 }
918
943 void RTC_DynamicTamperEnable(uint32_t u32PairSel, uint32_t u32DebounceEn, uint32_t u32Pair1Source, uint32_t u32Pair2Source)
944 {
945 uint32_t i;
946 uint32_t u32Reg;
947 uint32_t u32TmpReg;
948 uint32_t u32Tamper2Debounce, u32Tamper4Debounce;
949
950 RTC_WaitAccessEnable();
951 u32Reg = RTC->TAMPCTL;
952
953 u32Tamper2Debounce = u32Reg & RTC_TAMPCTL_TAMP2DBEN_Msk;
954 u32Tamper4Debounce = u32Reg & RTC_TAMPCTL_TAMP4DBEN_Msk;
955
956 u32Reg &= ~(RTC_TAMPCTL_TAMP0EN_Msk | RTC_TAMPCTL_TAMP1EN_Msk | RTC_TAMPCTL_TAMP2EN_Msk |
957 RTC_TAMPCTL_TAMP3EN_Msk | RTC_TAMPCTL_TAMP4EN_Msk | RTC_TAMPCTL_TAMP5EN_Msk);
958 u32Reg &= ~(RTC_TAMPCTL_DYN1ISS_Msk | RTC_TAMPCTL_DYN2ISS_Msk);
959 u32Reg |= ((u32Pair1Source & 0x1ul) << RTC_TAMPCTL_DYN1ISS_Pos) | ((u32Pair2Source & 0x1ul) << RTC_TAMPCTL_DYN2ISS_Pos);
960
961 if(u32DebounceEn)
962 {
963 u32TmpReg = (RTC_TAMPCTL_TAMP0EN_Msk | RTC_TAMPCTL_TAMP1EN_Msk |
964 RTC_TAMPCTL_TAMP0DBEN_Msk | RTC_TAMPCTL_TAMP1DBEN_Msk | RTC_TAMPCTL_DYNPR0EN_Msk);
965 }
966 else
967 {
968 u32TmpReg = (RTC_TAMPCTL_TAMP0EN_Msk | RTC_TAMPCTL_TAMP1EN_Msk | RTC_TAMPCTL_DYNPR0EN_Msk);
969 }
970
971 for(i = 0ul; i < MAX_PAIR_NUM; i++)
972 {
973 if(u32PairSel & (0x1ul << i))
974 {
975 u32Reg &= ~((RTC_TAMPCTL_TAMP0DBEN_Msk | RTC_TAMPCTL_TAMP1DBEN_Msk) << (i*8ul));
976 u32Reg |= (u32TmpReg << (i*8ul));
977 }
978 }
979
980 if((u32Pair1Source) && (u32PairSel & RTC_PAIR1_SELECT))
981 {
982 u32Reg &= ~RTC_TAMPCTL_TAMP2EN_Msk;
983 u32Reg |= u32Tamper2Debounce;
984 }
985
986 if((u32Pair2Source) && (u32PairSel & RTC_PAIR2_SELECT))
987 {
988 u32Reg &= ~RTC_TAMPCTL_TAMP4EN_Msk;
989 u32Reg |= u32Tamper4Debounce;
990 }
991
992 RTC_WaitAccessEnable();
993 RTC->TAMPCTL = u32Reg;
994 }
995
1008 void RTC_DynamicTamperDisable(uint32_t u32PairSel)
1009 {
1010 uint32_t i;
1011 uint32_t u32Reg;
1012 uint32_t u32TmpReg;
1013 uint32_t u32Tamper2En = 0ul, u32Tamper4En = 0ul;
1014
1015 RTC_WaitAccessEnable();
1016 u32Reg = RTC->TAMPCTL;
1017
1018 if((u32Reg & RTC_TAMPCTL_DYN1ISS_Msk) && (u32PairSel & RTC_PAIR1_SELECT))
1019 {
1020 u32Tamper2En = u32Reg & RTC_TAMPCTL_TAMP2EN_Msk;
1021 }
1022
1023 if((u32Reg & RTC_TAMPCTL_DYN2ISS_Msk) && (u32PairSel & RTC_PAIR2_SELECT))
1024 {
1025 u32Tamper4En = u32Reg & RTC_TAMPCTL_TAMP4EN_Msk;
1026 }
1027
1028 u32TmpReg = (RTC_TAMPCTL_TAMP0EN_Msk | RTC_TAMPCTL_TAMP1EN_Msk | RTC_TAMPCTL_DYNPR0EN_Msk);
1029
1030 for(i = 0ul; i < MAX_PAIR_NUM; i++)
1031 {
1032 if(u32PairSel & (0x1ul << i))
1033 {
1034 u32Reg &= ~(u32TmpReg << ((i*8ul)));
1035 }
1036 }
1037
1038 u32Reg |= (u32Tamper2En | u32Tamper4En);
1039
1040 RTC_WaitAccessEnable();
1041 RTC->TAMPCTL = u32Reg;
1042 }
1043
1072 void RTC_DynamicTamperConfig(uint32_t u32ChangeRate, uint32_t u32SeedReload, uint32_t u32RefPattern, uint32_t u32Seed)
1073 {
1074 uint32_t u32Reg;
1075 RTC_WaitAccessEnable();
1076 u32Reg = RTC->TAMPCTL;
1077
1078 u32Reg &= ~(RTC_TAMPCTL_DYNSRC_Msk | RTC_TAMPCTL_SEEDRLD_Msk | RTC_TAMPCTL_DYNRATE_Msk);
1079
1080 u32Reg |= (u32ChangeRate) | ((u32SeedReload & 0x1ul) << RTC_TAMPCTL_SEEDRLD_Pos) |
1081 ((u32RefPattern & 0x3ul) << RTC_TAMPCTL_DYNSRC_Pos);
1082
1083 RTC_WaitAccessEnable();
1084 RTC->TAMPSEED = u32Seed; /* need set seed value before re-load seed */
1085 RTC_WaitAccessEnable();
1086 RTC->TAMPCTL = u32Reg;
1087 }
1088 /* end of group RTC_EXPORTED_FUNCTIONS */
1090 /* end of group RTC_Driver */
1092 /* end of group Standard_Driver */
1094
1095 /*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/
RTC_TAMPCTL_DYNSRC_Msk
#define RTC_TAMPCTL_DYNSRC_Msk
Definition: rtc_reg.h:2075
RTC_TAMPCTL_DYNPR0EN_Msk
#define RTC_TAMPCTL_DYNPR0EN_Msk
Definition: rtc_reg.h:2102
RTC_CAL_MON_Pos
#define RTC_CAL_MON_Pos
Definition: rtc_reg.h:1750
RTC_TALM_TENSEC_Msk
#define RTC_TALM_TENSEC_Msk
Definition: rtc_reg.h:1772
RTC_TALM_SEC_Pos
#define RTC_TALM_SEC_Pos
Definition: rtc_reg.h:1768
RTC_TAMPCTL_TAMP1DBEN_Msk
#define RTC_TAMPCTL_TAMP1DBEN_Msk
Definition: rtc_reg.h:2099
RTC_CALM_DAY_Msk
#define RTC_CALM_DAY_Msk
Definition: rtc_reg.h:1787
CLK
#define CLK
Definition: M480.h:368
RTC_TALM_HR_Msk
#define RTC_TALM_HR_Msk
Definition: rtc_reg.h:1781
RTC_CALM_MON_Pos
#define RTC_CALM_MON_Pos
Definition: rtc_reg.h:1792
RTC_TAMPCTL_SEEDRLD_Msk
#define RTC_TAMPCTL_SEEDRLD_Msk
Definition: rtc_reg.h:2078
RTC_INIT_KEY
#define RTC_INIT_KEY
Definition: rtc.h:32
RTC_TAMSK_MTENHR_Pos
#define RTC_TAMSK_MTENHR_Pos
Definition: rtc_reg.h:1873
RTC_CAMSK_MTENDAY_Pos
#define RTC_CAMSK_MTENDAY_Pos
Definition: rtc_reg.h:1879
RTC_TALM_HR_Pos
#define RTC_TALM_HR_Pos
Definition: rtc_reg.h:1780
RTC_TIME_TENMIN_Pos
#define RTC_TIME_TENMIN_Pos
Definition: rtc_reg.h:1735
RTC_TIME_TENSEC_Pos
#define RTC_TIME_TENSEC_Pos
Definition: rtc_reg.h:1729
RTC_Open
void RTC_Open(S_RTC_TIME_DATA_T *sPt)
Initialize RTC module and start counting.
Definition: rtc.c:66
RTC_CAL_YEAR_Pos
#define RTC_CAL_YEAR_Pos
Definition: rtc_reg.h:1756
S_RTC_TIME_DATA_T::u32Hour
uint32_t u32Hour
Definition: rtc.h:121
RTC_EnableInt
void RTC_EnableInt(uint32_t u32IntFlagMask)
Enable RTC Interrupt.
Definition: rtc.c:769
RTC_SetTime
void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
Update RTC Current Time.
Definition: rtc.c:547
RTC_CAL_YEAR_Msk
#define RTC_CAL_YEAR_Msk
Definition: rtc_reg.h:1757
RTC_CAL_TENMON_Pos
#define RTC_CAL_TENMON_Pos
Definition: rtc_reg.h:1753
RTC_DisableSpareRegister
void RTC_DisableSpareRegister(void)
Disable Spare Register.
Definition: rtc.c:825
MAX_PAIR_NUM
#define MAX_PAIR_NUM
Definition: rtc.h:91
RTC_CALM_TENDAY_Pos
#define RTC_CALM_TENDAY_Pos
Definition: rtc_reg.h:1789
RTC_TALM_MIN_Pos
#define RTC_TALM_MIN_Pos
Definition: rtc_reg.h:1774
RTC_CALM_TENYEAR_Msk
#define RTC_CALM_TENYEAR_Msk
Definition: rtc_reg.h:1802
RTC_TIME_TENHR_Msk
#define RTC_TIME_TENHR_Msk
Definition: rtc_reg.h:1742
RTC_DynamicTamperEnable
void RTC_DynamicTamperEnable(uint32_t u32PairSel, uint32_t u32DebounceEn, uint32_t u32Pair1Source, uint32_t u32Pair2Source)
Dynamic Tamper Detect.
Definition: rtc.c:943
RTC_SetAlarmTimeMask
void RTC_SetAlarmTimeMask(uint8_t u8IsTenHMsk, uint8_t u8IsHMsk, uint8_t u8IsTenMMsk, uint8_t u8IsMMsk, uint8_t u8IsTenSMsk, uint8_t u8IsSMsk)
Set RTC Alarm Time Mask Function.
Definition: rtc.c:696
RTC_TAMPCTL_DYN1ISS_Pos
#define RTC_TAMPCTL_DYN1ISS_Pos
Definition: rtc_reg.h:2068
RTC_INIT_ACTIVE_Msk
#define RTC_INIT_ACTIVE_Msk
Definition: rtc_reg.h:1703
RTC_GetDayOfWeek
uint32_t RTC_GetDayOfWeek(void)
Get Day of the Week.
Definition: rtc.c:722
NuMicro.h
NuMicro peripheral access layer header file.
RTC_TAMPCTL_TAMP0DBEN_Pos
#define RTC_TAMPCTL_TAMP0DBEN_Pos
Definition: rtc_reg.h:2089
RTC_CAL_TENDAY_Msk
#define RTC_CAL_TENDAY_Msk
Definition: rtc_reg.h:1748
SYS
#define SYS
Definition: M480.h:367
RTC_WEEKDAY_WEEKDAY_Msk
#define RTC_WEEKDAY_WEEKDAY_Msk
Definition: rtc_reg.h:1766
RTC_PAIR1_SELECT
#define RTC_PAIR1_SELECT
Definition: rtc.h:89
S_RTC_TIME_DATA_T::u32Year
uint32_t u32Year
Definition: rtc.h:117
RTC_TAMSK_MSEC_Pos
#define RTC_TAMSK_MSEC_Pos
Definition: rtc_reg.h:1858
RTC_TAMSK_MTENMIN_Pos
#define RTC_TAMSK_MTENMIN_Pos
Definition: rtc_reg.h:1867
RTC_CALM_YEAR_Pos
#define RTC_CALM_YEAR_Pos
Definition: rtc_reg.h:1798
RTC_CAMSK_MTENYEAR_Pos
#define RTC_CAMSK_MTENYEAR_Pos
Definition: rtc_reg.h:1891
RTC_TIME_TENSEC_Msk
#define RTC_TIME_TENSEC_Msk
Definition: rtc_reg.h:1730
RTC_SetDateAndTime
void RTC_SetDateAndTime(S_RTC_TIME_DATA_T *sPt)
Update Current RTC Date and Time.
Definition: rtc.c:365
RTC_StaticTamperEnable
void RTC_StaticTamperEnable(uint32_t u32TamperSelect, uint32_t u32DetecLevel, uint32_t u32DebounceEn)
Static Tamper Detect.
Definition: rtc.c:855
RTC_TALM_TENMIN_Msk
#define RTC_TALM_TENMIN_Msk
Definition: rtc_reg.h:1778
RTC_TAMPCTL_DYN2ISS_Msk
#define RTC_TAMPCTL_DYN2ISS_Msk
Definition: rtc_reg.h:2072
RTC_AM
#define RTC_AM
Definition: rtc.h:40
RTC_CLKFMT_24HEN_Msk
#define RTC_CLKFMT_24HEN_Msk
Definition: rtc_reg.h:1763
RTC_TAMPCTL_TAMP0DBEN_Msk
#define RTC_TAMPCTL_TAMP0DBEN_Msk
Definition: rtc_reg.h:2090
RTC_TIME_SEC_Pos
#define RTC_TIME_SEC_Pos
Definition: rtc_reg.h:1726
RTC_TAMPCTL_TAMP1EN_Msk
#define RTC_TAMPCTL_TAMP1EN_Msk
Definition: rtc_reg.h:2093
RTC_CALM_TENMON_Pos
#define RTC_CALM_TENMON_Pos
Definition: rtc_reg.h:1795
RTC_TIME_MIN_Pos
#define RTC_TIME_MIN_Pos
Definition: rtc_reg.h:1732
RTC_CAL_TENDAY_Pos
#define RTC_CAL_TENDAY_Pos
Definition: rtc_reg.h:1747
RTC_TALM_TENHR_Pos
#define RTC_TALM_TENHR_Pos
Definition: rtc_reg.h:1783
RTC_WaitAccessEnable
__STATIC_INLINE void RTC_WaitAccessEnable(void)
Wait RTC Access Enable.
Definition: rtc.h:287
RTC_TAMPCTL_DYN2ISS_Pos
#define RTC_TAMPCTL_DYN2ISS_Pos
Definition: rtc_reg.h:2071
RTC_SetAlarmDateMask
void RTC_SetAlarmDateMask(uint8_t u8IsTenYMsk, uint8_t u8IsYMsk, uint8_t u8IsTenMMsk, uint8_t u8IsMMsk, uint8_t u8IsTenDMsk, uint8_t u8IsDMsk)
Set RTC Alarm Date Mask Function.
Definition: rtc.c:671
RTC_Close
void RTC_Close(void)
Disable RTC Clock.
Definition: rtc.c:97
RTC_DynamicTamperConfig
void RTC_DynamicTamperConfig(uint32_t u32ChangeRate, uint32_t u32SeedReload, uint32_t u32RefPattern, uint32_t u32Seed)
Config dynamic tamper.
Definition: rtc.c:1072
RTC_TIME_SEC_Msk
#define RTC_TIME_SEC_Msk
Definition: rtc_reg.h:1727
RTC_CAL_TENYEAR_Msk
#define RTC_CAL_TENYEAR_Msk
Definition: rtc_reg.h:1760
RTC_PM
#define RTC_PM
Definition: rtc.h:41
RTC_CAMSK_MDAY_Pos
#define RTC_CAMSK_MDAY_Pos
Definition: rtc_reg.h:1876
S_RTC_TIME_DATA_T::u32Minute
uint32_t u32Minute
Definition: rtc.h:122
CLK_APBCLK0_RTCCKEN_Msk
#define CLK_APBCLK0_RTCCKEN_Msk
Definition: clk_reg.h:2361
RTC_SPRCTL_SPRRWEN_Msk
#define RTC_SPRCTL_SPRRWEN_Msk
Definition: rtc_reg.h:1895
RTC_TAMPCTL_TAMP4DBEN_Msk
#define RTC_TAMPCTL_TAMP4DBEN_Msk
Definition: rtc_reg.h:2132
S_RTC_TIME_DATA_T::u32AmPm
uint32_t u32AmPm
Definition: rtc.h:125
RTC_TAMPCTL_DYNSRC_Pos
#define RTC_TAMPCTL_DYNSRC_Pos
Definition: rtc_reg.h:2074
RTC_TIME_MIN_Msk
#define RTC_TIME_MIN_Msk
Definition: rtc_reg.h:1733
RTC_CAMSK_MMON_Pos
#define RTC_CAMSK_MMON_Pos
Definition: rtc_reg.h:1882
RTC_TAMPCTL_TAMP0EN_Msk
#define RTC_TAMPCTL_TAMP0EN_Msk
Definition: rtc_reg.h:2084
RTC_TAMSK_MTENSEC_Pos
#define RTC_TAMSK_MTENSEC_Pos
Definition: rtc_reg.h:1861
RTC_SetDate
void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
Update RTC Current Date.
Definition: rtc.c:514
RTC_TALM_TENSEC_Pos
#define RTC_TALM_TENSEC_Pos
Definition: rtc_reg.h:1771
RTC_CALM_DAY_Pos
#define RTC_CALM_DAY_Pos
Definition: rtc_reg.h:1786
RTC_CAMSK_MTENMON_Pos
#define RTC_CAMSK_MTENMON_Pos
Definition: rtc_reg.h:1885
RTC_PAIR2_SELECT
#define RTC_PAIR2_SELECT
Definition: rtc.h:90
RTC_TAMPCTL_TAMP5EN_Msk
#define RTC_TAMPCTL_TAMP5EN_Msk
Definition: rtc_reg.h:2135
RTC_SetAlarmDateAndTime
void RTC_SetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
Update RTC Alarm Date and Time.
Definition: rtc.c:446
RTC_TIME_TENMIN_Msk
#define RTC_TIME_TENMIN_Msk
Definition: rtc_reg.h:1736
RTC_CAL_MON_Msk
#define RTC_CAL_MON_Msk
Definition: rtc_reg.h:1751
RTC_SetAlarmTime
void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
Update RTC Alarm Time.
Definition: rtc.c:622
RTC_TAMPCTL_TAMP2EN_Msk
#define RTC_TAMPCTL_TAMP2EN_Msk
Definition: rtc_reg.h:2105
RTC_TAMPCTL_DYNRATE_Msk
#define RTC_TAMPCTL_DYNRATE_Msk
Definition: rtc_reg.h:2081
RTC_TAMPCTL_TAMP4EN_Msk
#define RTC_TAMPCTL_TAMP4EN_Msk
Definition: rtc_reg.h:2126
S_RTC_TIME_DATA_T
Definition: rtc.h:115
RTC_TAMPCTL_TAMP0LV_Msk
#define RTC_TAMPCTL_TAMP0LV_Msk
Definition: rtc_reg.h:2087
RTC_CAL_DAY_Msk
#define RTC_CAL_DAY_Msk
Definition: rtc_reg.h:1745
RTC_TAMSK_MHR_Pos
#define RTC_TAMSK_MHR_Pos
Definition: rtc_reg.h:1870
S_RTC_TIME_DATA_T::u32Day
uint32_t u32Day
Definition: rtc.h:119
RTC_TIME_HR_Pos
#define RTC_TIME_HR_Pos
Definition: rtc_reg.h:1738
RTC_SetAlarmDate
void RTC_SetAlarmDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
Update RTC Alarm Date.
Definition: rtc.c:592
RTC_EnableSpareAccess
void RTC_EnableSpareAccess(void)
Enable Spare Registers Access.
Definition: rtc.c:809
RTC_CALM_TENMON_Msk
#define RTC_CALM_TENMON_Msk
Definition: rtc_reg.h:1796
RTC_CALM_TENDAY_Msk
#define RTC_CALM_TENDAY_Msk
Definition: rtc_reg.h:1790
RTC_TIME_TENHR_Pos
#define RTC_TIME_TENHR_Pos
Definition: rtc_reg.h:1741
S_RTC_TIME_DATA_T::u32DayOfWeek
uint32_t u32DayOfWeek
Definition: rtc.h:120
RTC_TAMSK_MMIN_Pos
#define RTC_TAMSK_MMIN_Pos
Definition: rtc_reg.h:1864
RTC_CLOCK_12
#define RTC_CLOCK_12
Definition: rtc.h:38
RTC_TAMPCTL_DYN1ISS_Msk
#define RTC_TAMPCTL_DYN1ISS_Msk
Definition: rtc_reg.h:2069
RTC_CAL_TENYEAR_Pos
#define RTC_CAL_TENYEAR_Pos
Definition: rtc_reg.h:1759
MAX_TAMPER_PIN_NUM
#define MAX_TAMPER_PIN_NUM
Definition: rtc.h:80
RTC_CALM_MON_Msk
#define RTC_CALM_MON_Msk
Definition: rtc_reg.h:1793
RTC_TAMPCTL_TAMP0LV_Pos
#define RTC_TAMPCTL_TAMP0LV_Pos
Definition: rtc_reg.h:2086
RTC_CALM_TENYEAR_Pos
#define RTC_CALM_TENYEAR_Pos
Definition: rtc_reg.h:1801
RTC_TIME_HR_Msk
#define RTC_TIME_HR_Msk
Definition: rtc_reg.h:1739
RTC_TALM_TENMIN_Pos
#define RTC_TALM_TENMIN_Pos
Definition: rtc_reg.h:1777
RTC
#define RTC
Definition: M480.h:400
RTC_TICK_TICK_Msk
#define RTC_TICK_TICK_Msk
Definition: rtc_reg.h:1856
RTC_SetTickPeriod
void RTC_SetTickPeriod(uint32_t u32TickSelection)
Set RTC Tick Period Time.
Definition: rtc.c:745
S_RTC_TIME_DATA_T::u32Month
uint32_t u32Month
Definition: rtc.h:118
RTC_TAMPCTL_TAMP3EN_Msk
#define RTC_TAMPCTL_TAMP3EN_Msk
Definition: rtc_reg.h:2114
RTC_TALM_SEC_Msk
#define RTC_TALM_SEC_Msk
Definition: rtc_reg.h:1769
RTC_CALM_YEAR_Msk
#define RTC_CALM_YEAR_Msk
Definition: rtc_reg.h:1799
RTC_CAMSK_MYEAR_Pos
#define RTC_CAMSK_MYEAR_Pos
Definition: rtc_reg.h:1888
S_RTC_TIME_DATA_T::u32Second
uint32_t u32Second
Definition: rtc.h:123
RTC_TALM_TENHR_Msk
#define RTC_TALM_TENHR_Msk
Definition: rtc_reg.h:1784
RTC_YEAR2000
#define RTC_YEAR2000
Definition: rtc.h:70
RTC_DynamicTamperDisable
void RTC_DynamicTamperDisable(uint32_t u32PairSel)
Dynamic Tamper Disable.
Definition: rtc.c:1008
RTC_GetAlarmDateAndTime
void RTC_GetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
Get RTC Alarm Date and Time.
Definition: rtc.c:265
RTC_CAL_DAY_Pos
#define RTC_CAL_DAY_Pos
Definition: rtc_reg.h:1744
RTC_32KCalibration
void RTC_32KCalibration(int32_t i32FrequencyX10000)
Set Frequency Compensation Data.
Definition: rtc.c:110
RTC_TAMPCTL_SEEDRLD_Pos
#define RTC_TAMPCTL_SEEDRLD_Pos
Definition: rtc_reg.h:2077
RTC_GetDateAndTime
void RTC_GetDateAndTime(S_RTC_TIME_DATA_T *sPt)
Get Current RTC Date and Time.
Definition: rtc.c:170
S_RTC_TIME_DATA_T::u32TimeScale
uint32_t u32TimeScale
Definition: rtc.h:124
RTC_TAMPCTL_TAMP2DBEN_Msk
#define RTC_TAMPCTL_TAMP2DBEN_Msk
Definition: rtc_reg.h:2111
RTC_StaticTamperDisable
void RTC_StaticTamperDisable(uint32_t u32TamperSelect)
Static Tamper Disable.
Definition: rtc.c:896
RTC_CAL_TENMON_Msk
#define RTC_CAL_TENMON_Msk
Definition: rtc_reg.h:1754
RTC_DisableInt
void RTC_DisableInt(uint32_t u32IntFlagMask)
Disable RTC Interrupt.
Definition: rtc.c:792
RTC_TALM_MIN_Msk
#define RTC_TALM_MIN_Msk
Definition: rtc_reg.h:1775