M471M/R1/S BSP V3.01.000
The Board Support Package for M4521
rtc.c
Go to the documentation of this file.
1/**************************************************************************/
8#include "NuMicro.h"
9
10
12
13/*---------------------------------------------------------------------------------------------------------*/
14/* Macro, type and constant definitions */
15/*---------------------------------------------------------------------------------------------------------*/
16#define RTC_GLOBALS
17
18/*---------------------------------------------------------------------------------------------------------*/
19/* Global file scope (static) variables */
20/*---------------------------------------------------------------------------------------------------------*/
21static volatile uint32_t g_u32hiYear, g_u32loYear, g_u32hiMonth, g_u32loMonth, g_u32hiDay, g_u32loDay;
22static volatile uint32_t g_u32hiHour, g_u32loHour, g_u32hiMin, g_u32loMin, g_u32hiSec, g_u32loSec;
23
25
26
27
28
67{
68 uint32_t u32TimeOutCount = SystemCoreClock; /* 1 second timeout */
69
70 RTC->INIT = RTC_INIT_KEY;
71
72 if(RTC->INIT != RTC_INIT_ACTIVE_Msk)
73 {
74 RTC->INIT = RTC_INIT_KEY;
75 while (RTC->INIT != RTC_INIT_ACTIVE_Msk)
76 {
77 if(u32TimeOutCount == 0) return -1;
78 u32TimeOutCount--;
79 }
80 }
81
82 if (sPt == NULL)
83 {
84 /* No RTC date/time data */
85 }
86 else
87 {
88 /* Set RTC date and time */
90 /* Waiting for RTC settings stable */
91 while(((RTC->RWEN & RTC_RWEN_RWENF_Msk) == RTC_RWEN_RWENF_Msk) && (u32TimeOutCount-- > 0));
92 if(u32TimeOutCount == 0)
93 return -1;
94 }
95 return 0;
96}
97
107void RTC_Close(void)
108{
109 CLK->APBCLK0 &= ~CLK_APBCLK0_RTCCKEN_Msk;
110}
111
121void RTC_32KCalibration(int32_t i32FrequencyX100)
122{
123 int32_t i32RegInt, i32RegFra;
124
125 /* Compute integer and fraction for RTC FCR register */
126 i32RegInt = (i32FrequencyX100 / 100) - RTC_FCR_REFERENCE;
127 i32RegFra = (((i32FrequencyX100 % 100)) * 60) / 100;
128
129 /* Judge Integer part is reasonable */
130 if((i32RegInt < 0) | (i32RegInt > 15))
131 {
132 return ;
133 }
134
136 RTC->FREQADJ = (uint32_t)((i32RegInt << 8) | i32RegFra);
137}
138
158{
159 uint32_t u32Tmp;
160
161 sPt->u32TimeScale = RTC->CLKFMT & RTC_CLKFMT_24HEN_Msk; /* 12/24-hour */
162 sPt->u32DayOfWeek = RTC->WEEKDAY & RTC_WEEKDAY_WEEKDAY_Msk; /* Day of the week */
163
164 /* Get [Date digit] data */
165 g_u32hiYear = (RTC->CAL & RTC_CAL_TENYEAR_Msk) >> RTC_CAL_TENYEAR_Pos;
166 g_u32loYear = (RTC->CAL & RTC_CAL_YEAR_Msk) >> RTC_CAL_YEAR_Pos;
167 g_u32hiMonth = (RTC->CAL & RTC_CAL_TENMON_Msk) >> RTC_CAL_TENMON_Pos;
168 g_u32loMonth = (RTC->CAL & RTC_CAL_MON_Msk) >> RTC_CAL_MON_Pos;
169 g_u32hiDay = (RTC->CAL & RTC_CAL_TENDAY_Msk) >> RTC_CAL_TENDAY_Pos;
170 g_u32loDay = (RTC->CAL & RTC_CAL_DAY_Msk) >> RTC_CAL_DAY_Pos;
171
172 /* Get [Time digit] data */
173 g_u32hiHour = (RTC->TIME & RTC_TIME_TENHR_Msk) >> RTC_TIME_TENHR_Pos;
174 g_u32loHour = (RTC->TIME & RTC_TIME_HR_Msk) >> RTC_TIME_HR_Pos;
175 g_u32hiMin = (RTC->TIME & RTC_TIME_TENMIN_Msk) >> RTC_TIME_TENMIN_Pos;
176 g_u32loMin = (RTC->TIME & RTC_TIME_MIN_Msk) >> RTC_TIME_MIN_Pos;
177 g_u32hiSec = (RTC->TIME & RTC_TIME_TENSEC_Msk) >> RTC_TIME_TENSEC_Pos;
178 g_u32loSec = (RTC->TIME & RTC_TIME_SEC_Msk) >> RTC_TIME_SEC_Pos;
179
180 /* Compute to 20XX year */
181 u32Tmp = (g_u32hiYear * 10);
182 u32Tmp += g_u32loYear;
183 sPt->u32Year = u32Tmp + RTC_YEAR2000;
184
185 /* Compute 0~12 month */
186 u32Tmp = (g_u32hiMonth * 10);
187 sPt->u32Month = u32Tmp + g_u32loMonth;
188
189 /* Compute 0~31 day */
190 u32Tmp = (g_u32hiDay * 10);
191 sPt->u32Day = u32Tmp + g_u32loDay;
192
193 /* Compute 12/24 hour */
194 if(sPt->u32TimeScale == RTC_CLOCK_12)
195 {
196 u32Tmp = (g_u32hiHour * 10);
197 u32Tmp += g_u32loHour;
198 sPt->u32Hour = u32Tmp; /* AM: 1~12. PM: 21~32. */
199
200 if(sPt->u32Hour >= 21)
201 {
202 sPt->u32AmPm = RTC_PM;
203 sPt->u32Hour -= 20;
204 }
205 else
206 {
207 sPt->u32AmPm = RTC_AM;
208 }
209
210 u32Tmp = (g_u32hiMin * 10);
211 u32Tmp += g_u32loMin;
212 sPt->u32Minute = u32Tmp;
213
214 u32Tmp = (g_u32hiSec * 10);
215 u32Tmp += g_u32loSec;
216 sPt->u32Second = u32Tmp;
217 }
218 else
219 {
220 u32Tmp = (g_u32hiHour * 10);
221 u32Tmp += g_u32loHour;
222 sPt->u32Hour = u32Tmp;
223
224 u32Tmp = (g_u32hiMin * 10);
225 u32Tmp += g_u32loMin;
226 sPt->u32Minute = u32Tmp;
227
228 u32Tmp = (g_u32hiSec * 10);
229 u32Tmp += g_u32loSec;
230 sPt->u32Second = u32Tmp;
231 }
232}
233
253{
254 uint32_t u32Tmp;
255
256 sPt->u32TimeScale = RTC->CLKFMT & RTC_CLKFMT_24HEN_Msk; /* 12/24-hour */
257 sPt->u32DayOfWeek = RTC->WEEKDAY & RTC_WEEKDAY_WEEKDAY_Msk; /* Day of the week */
258
259 /* Get alarm [Date digit] data */
261 g_u32hiYear = (RTC->CALM & RTC_CALM_TENYEAR_Msk) >> RTC_CALM_TENYEAR_Pos;
262 g_u32loYear = (RTC->CALM & RTC_CALM_YEAR_Msk) >> RTC_CALM_YEAR_Pos;
263 g_u32hiMonth = (RTC->CALM & RTC_CALM_TENMON_Msk) >> RTC_CALM_TENMON_Pos;
264 g_u32loMonth = (RTC->CALM & RTC_CALM_MON_Msk) >> RTC_CALM_MON_Pos;
265 g_u32hiDay = (RTC->CALM & RTC_CALM_TENDAY_Msk) >> RTC_CALM_TENDAY_Pos;
266 g_u32loDay = (RTC->CALM & RTC_CALM_DAY_Msk) >> RTC_CALM_DAY_Pos;
267
268 /* Get alarm [Time digit] data */
270 g_u32hiHour = (RTC->TALM & RTC_TALM_TENHR_Msk) >> RTC_TALM_TENHR_Pos;
271 g_u32loHour = (RTC->TALM & RTC_TALM_HR_Msk) >> RTC_TALM_HR_Pos;
272 g_u32hiMin = (RTC->TALM & RTC_TALM_TENMIN_Msk) >> RTC_TALM_TENMIN_Pos;
273 g_u32loMin = (RTC->TALM & RTC_TALM_MIN_Msk) >> RTC_TALM_MIN_Pos;
274 g_u32hiSec = (RTC->TALM & RTC_TALM_TENSEC_Msk) >> RTC_TALM_TENSEC_Pos;
275 g_u32loSec = (RTC->TALM & RTC_TALM_SEC_Msk) >> RTC_TALM_SEC_Pos;
276
277 /* Compute to 20XX year */
278 u32Tmp = (g_u32hiYear * 10);
279 u32Tmp += g_u32loYear;
280 sPt->u32Year = u32Tmp + RTC_YEAR2000;
281
282 /* Compute 0~12 month */
283 u32Tmp = (g_u32hiMonth * 10);
284 sPt->u32Month = u32Tmp + g_u32loMonth;
285
286 /* Compute 0~31 day */
287 u32Tmp = (g_u32hiDay * 10);
288 sPt->u32Day = u32Tmp + g_u32loDay;
289
290 /* Compute 12/24 hour */
291 if(sPt->u32TimeScale == RTC_CLOCK_12)
292 {
293 u32Tmp = (g_u32hiHour * 10);
294 u32Tmp += g_u32loHour;
295 sPt->u32Hour = u32Tmp; /* AM: 1~12. PM: 21~32. */
296
297 if(sPt->u32Hour >= 21)
298 {
299 sPt->u32AmPm = RTC_PM;
300 sPt->u32Hour -= 20;
301 }
302 else
303 {
304 sPt->u32AmPm = RTC_AM;
305 }
306
307 u32Tmp = (g_u32hiMin * 10);
308 u32Tmp += g_u32loMin;
309 sPt->u32Minute = u32Tmp;
310
311 u32Tmp = (g_u32hiSec * 10);
312 u32Tmp += g_u32loSec;
313 sPt->u32Second = u32Tmp;
314
315 }
316 else
317 {
318 u32Tmp = (g_u32hiHour * 10);
319 u32Tmp += g_u32loHour;
320 sPt->u32Hour = u32Tmp;
321
322 u32Tmp = (g_u32hiMin * 10);
323 u32Tmp += g_u32loMin;
324 sPt->u32Minute = u32Tmp;
325
326 u32Tmp = (g_u32hiSec * 10);
327 u32Tmp += g_u32loSec;
328 sPt->u32Second = u32Tmp;
329 }
330}
331
353{
354 uint32_t u32RegCAL, u32RegTIME;
355
356 if(sPt == 0)
357 return ;
358
359 /*-----------------------------------------------------------------------------------------------------*/
360 /* Set RTC 24/12 hour setting and Day of the Week */
361 /*-----------------------------------------------------------------------------------------------------*/
363 if(sPt->u32TimeScale == RTC_CLOCK_12)
364 {
365 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
366
367 /*-------------------------------------------------------------------------------------------------*/
368 /* Important, range of 12-hour PM mode is 21 up to 32 */
369 /*-------------------------------------------------------------------------------------------------*/
370 if(sPt->u32AmPm == RTC_PM)
371 sPt->u32Hour += 20;
372 }
373 else
374 {
375 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
376 }
377
378 /* Set Day of the Week */
379 RTC->WEEKDAY = sPt->u32DayOfWeek;
380
381 /*-----------------------------------------------------------------------------------------------------*/
382 /* Set RTC Current Date and Time */
383 /*-----------------------------------------------------------------------------------------------------*/
384 u32RegCAL = ((sPt->u32Year - RTC_YEAR2000) / 10) << 20;
385 u32RegCAL |= (((sPt->u32Year - RTC_YEAR2000) % 10) << 16);
386 u32RegCAL |= ((sPt->u32Month / 10) << 12);
387 u32RegCAL |= ((sPt->u32Month % 10) << 8);
388 u32RegCAL |= ((sPt->u32Day / 10) << 4);
389 u32RegCAL |= (sPt->u32Day % 10);
390
391 u32RegTIME = ((sPt->u32Hour / 10) << 20);
392 u32RegTIME |= ((sPt->u32Hour % 10) << 16);
393 u32RegTIME |= ((sPt->u32Minute / 10) << 12);
394 u32RegTIME |= ((sPt->u32Minute % 10) << 8);
395 u32RegTIME |= ((sPt->u32Second / 10) << 4);
396 u32RegTIME |= (sPt->u32Second % 10);
397
398 /*-----------------------------------------------------------------------------------------------------*/
399 /* Set RTC Calender and Time Loading */
400 /*-----------------------------------------------------------------------------------------------------*/
402 RTC->CAL = (uint32_t)u32RegCAL;
403 RTC->TIME = (uint32_t)u32RegTIME;
404}
405
427{
428 uint32_t u32RegCALM, u32RegTALM;
429
430 if(sPt == 0)
431 return ;
432
433 /*-----------------------------------------------------------------------------------------------------*/
434 /* Set RTC 24/12 hour setting and Day of the Week */
435 /*-----------------------------------------------------------------------------------------------------*/
437 if(sPt->u32TimeScale == RTC_CLOCK_12)
438 {
439 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
440
441 /*-------------------------------------------------------------------------------------------------*/
442 /* Important, range of 12-hour PM mode is 21 up to 32 */
443 /*-------------------------------------------------------------------------------------------------*/
444 if(sPt->u32AmPm == RTC_PM)
445 sPt->u32Hour += 20;
446 }
447 else
448 {
449 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
450 }
451
452 /* Set Day of the Week */
453 RTC->WEEKDAY = sPt->u32DayOfWeek;
454
455 /*-----------------------------------------------------------------------------------------------------*/
456 /* Set RTC Alarm Date and Time */
457 /*-----------------------------------------------------------------------------------------------------*/
458 u32RegCALM = ((sPt->u32Year - RTC_YEAR2000) / 10) << 20;
459 u32RegCALM |= (((sPt->u32Year - RTC_YEAR2000) % 10) << 16);
460 u32RegCALM |= ((sPt->u32Month / 10) << 12);
461 u32RegCALM |= ((sPt->u32Month % 10) << 8);
462 u32RegCALM |= ((sPt->u32Day / 10) << 4);
463 u32RegCALM |= (sPt->u32Day % 10);
464
465 u32RegTALM = ((sPt->u32Hour / 10) << 20);
466 u32RegTALM |= ((sPt->u32Hour % 10) << 16);
467 u32RegTALM |= ((sPt->u32Minute / 10) << 12);
468 u32RegTALM |= ((sPt->u32Minute % 10) << 8);
469 u32RegTALM |= ((sPt->u32Second / 10) << 4);
470 u32RegTALM |= (sPt->u32Second % 10);
471
473 RTC->CALM = (uint32_t)u32RegCALM;
474 RTC->TALM = (uint32_t)u32RegTALM;
475}
476
491void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
492{
493 uint32_t u32RegCAL;
494
495 u32RegCAL = ((u32Year - RTC_YEAR2000) / 10) << 20;
496 u32RegCAL |= (((u32Year - RTC_YEAR2000) % 10) << 16);
497 u32RegCAL |= ((u32Month / 10) << 12);
498 u32RegCAL |= ((u32Month % 10) << 8);
499 u32RegCAL |= ((u32Day / 10) << 4);
500 u32RegCAL |= (u32Day % 10);
501
503
504 /* Set Day of the Week */
505 RTC->WEEKDAY = u32DayOfWeek & RTC_WEEKDAY_WEEKDAY_Msk;
506
507 /* Set RTC Calender Loading */
508 RTC->CAL = (uint32_t)u32RegCAL;
509}
510
524void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
525{
526 uint32_t u32RegTIME;
527
528 /* Important, range of 12-hour PM mode is 21 up to 32 */
529 if((u32TimeMode == RTC_CLOCK_12) && (u32AmPm == RTC_PM))
530 u32Hour += 20;
531
532 u32RegTIME = ((u32Hour / 10) << 20);
533 u32RegTIME |= ((u32Hour % 10) << 16);
534 u32RegTIME |= ((u32Minute / 10) << 12);
535 u32RegTIME |= ((u32Minute % 10) << 8);
536 u32RegTIME |= ((u32Second / 10) << 4);
537 u32RegTIME |= (u32Second % 10);
538
539 /*-----------------------------------------------------------------------------------------------------*/
540 /* Set RTC 24/12 hour setting and Day of the Week */
541 /*-----------------------------------------------------------------------------------------------------*/
543 if(u32TimeMode == RTC_CLOCK_12)
544 {
545 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
546 }
547 else
548 {
549 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
550 }
551
552 RTC->TIME = (uint32_t)u32RegTIME;
553}
554
566void RTC_SetAlarmDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
567{
568 uint32_t u32RegCALM;
569
570 u32RegCALM = ((u32Year - RTC_YEAR2000) / 10) << 20;
571 u32RegCALM |= (((u32Year - RTC_YEAR2000) % 10) << 16);
572 u32RegCALM |= ((u32Month / 10) << 12);
573 u32RegCALM |= ((u32Month % 10) << 8);
574 u32RegCALM |= ((u32Day / 10) << 4);
575 u32RegCALM |= (u32Day % 10);
576
578
579 /* Set RTC Alarm Date */
580 RTC->CALM = (uint32_t)u32RegCALM;
581}
582
596void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
597{
598 uint32_t u32RegTALM;
599
600 /* Important, range of 12-hour PM mode is 21 up to 32 */
601 if((u32TimeMode == RTC_CLOCK_12) && (u32AmPm == RTC_PM))
602 u32Hour += 20;
603
604 u32RegTALM = ((u32Hour / 10) << 20);
605 u32RegTALM |= ((u32Hour % 10) << 16);
606 u32RegTALM |= ((u32Minute / 10) << 12);
607 u32RegTALM |= ((u32Minute % 10) << 8);
608 u32RegTALM |= ((u32Second / 10) << 4);
609 u32RegTALM |= (u32Second % 10);
610
611 /*-----------------------------------------------------------------------------------------------------*/
612 /* Set RTC 24/12 hour setting and Day of the Week */
613 /*-----------------------------------------------------------------------------------------------------*/
615 if(u32TimeMode == RTC_CLOCK_12)
616 {
617 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
618 }
619 else
620 {
621 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
622 }
623
624 /* Set RTC Alarm Time */
625 RTC->TALM = (uint32_t)u32RegTALM;
626}
627
643uint32_t RTC_GetDayOfWeek(void)
644{
645 return (RTC->WEEKDAY & RTC_WEEKDAY_WEEKDAY_Msk);
646}
647
666void RTC_SetTickPeriod(uint32_t u32TickSelection)
667{
669
670 RTC->TICK = (RTC->TICK & ~RTC_TICK_TICK_Msk) | u32TickSelection;
671}
672
685void RTC_EnableInt(uint32_t u32IntFlagMask)
686{
687 RTC->INTEN |= u32IntFlagMask;
688}
689
702void RTC_DisableInt(uint32_t u32IntFlagMask)
703{
704 if(u32IntFlagMask & RTC_INTEN_ALMIEN_Msk)
705 {
706 RTC->INTEN &= ~RTC_INTEN_ALMIEN_Msk;
707 RTC->INTSTS = RTC_INTSTS_ALMIF_Msk;
708 }
709
710 if(u32IntFlagMask & RTC_INTEN_TICKIEN_Msk)
711 {
712 RTC->INTEN &= ~RTC_INTEN_TICKIEN_Msk;
713 RTC->INTSTS = RTC_INTSTS_TICKIF_Msk;
714 }
715
716 if(u32IntFlagMask & RTC_INTEN_SNPDIEN_Msk)
717 {
718 RTC->INTEN &= ~RTC_INTEN_SNPDIEN_Msk;
719 RTC->INTSTS = RTC_INTSTS_SNPDIF_Msk;
720 }
721}
722
733{
735
736 RTC->SPRCTL |= RTC_SPRCTL_SPRRWEN_Msk;
737
738 while(!(RTC->SPRCTL & RTC_SPRCTL_SPRRWRDY_Msk));
739}
740
751{
753
754 RTC->SPRCTL &= ~RTC_SPRCTL_SPRRWEN_Msk;
755}
756
770void RTC_EnableSnooperDetection(uint32_t u32PinCondition)
771{
773
774 RTC->SPRCTL = ((RTC->SPRCTL & ~RTC_SNOOPER_DETECT_Msk) | u32PinCondition) | RTC_SPRCTL_SNPDEN_Msk;
775}
776
787{
789
790 RTC->SPRCTL &= ~RTC_SPRCTL_SNPDEN_Msk;
791}
792 /* end of group RTC_EXPORTED_FUNCTIONS */
794 /* end of group RTC_Driver */
796 /* end of group Standard_Driver */
798
#define RTC_TALM_MIN_Msk
Definition: M471M_R1_S.h:7736
#define RTC_INTEN_TICKIEN_Msk
Definition: M471M_R1_S.h:7772
#define RTC_CAL_TENDAY_Msk
Definition: M471M_R1_S.h:7709
#define RTC_CAL_TENYEAR_Msk
Definition: M471M_R1_S.h:7721
#define RTC_SPRCTL_SPRRWRDY_Msk
Definition: M471M_R1_S.h:7841
#define RTC_SPRCTL_SNPDEN_Msk
Definition: M471M_R1_S.h:7826
#define RTC_INTSTS_SNPDIF_Msk
Definition: M471M_R1_S.h:7784
#define RTC_CALM_DAY_Pos
Definition: M471M_R1_S.h:7747
#define RTC_TIME_SEC_Msk
Definition: M471M_R1_S.h:7688
#define RTC_TIME_TENSEC_Msk
Definition: M471M_R1_S.h:7691
#define RTC_TALM_HR_Pos
Definition: M471M_R1_S.h:7741
#define RTC_TALM_TENMIN_Pos
Definition: M471M_R1_S.h:7738
#define RTC_TALM_SEC_Pos
Definition: M471M_R1_S.h:7729
#define RTC_INTSTS_ALMIF_Msk
Definition: M471M_R1_S.h:7778
#define RTC_CAL_YEAR_Msk
Definition: M471M_R1_S.h:7718
#define RTC_TIME_TENSEC_Pos
Definition: M471M_R1_S.h:7690
#define RTC_CAL_MON_Pos
Definition: M471M_R1_S.h:7711
#define RTC_SPRCTL_SPRRWEN_Msk
Definition: M471M_R1_S.h:7832
#define RTC_CALM_DAY_Msk
Definition: M471M_R1_S.h:7748
#define RTC_TALM_TENSEC_Pos
Definition: M471M_R1_S.h:7732
#define RTC_TIME_MIN_Msk
Definition: M471M_R1_S.h:7694
#define RTC_TALM_TENMIN_Msk
Definition: M471M_R1_S.h:7739
#define RTC_CALM_TENYEAR_Msk
Definition: M471M_R1_S.h:7763
#define RTC_TIME_TENHR_Pos
Definition: M471M_R1_S.h:7702
#define RTC_CALM_YEAR_Pos
Definition: M471M_R1_S.h:7759
#define RTC_INTEN_ALMIEN_Msk
Definition: M471M_R1_S.h:7769
#define RTC_TIME_HR_Msk
Definition: M471M_R1_S.h:7700
#define RTC_CAL_TENMON_Pos
Definition: M471M_R1_S.h:7714
#define RTC_CALM_TENDAY_Pos
Definition: M471M_R1_S.h:7750
#define RTC_CAL_DAY_Pos
Definition: M471M_R1_S.h:7705
#define RTC_CLKFMT_24HEN_Msk
Definition: M471M_R1_S.h:7724
#define RTC_CALM_TENMON_Pos
Definition: M471M_R1_S.h:7756
#define RTC_TALM_HR_Msk
Definition: M471M_R1_S.h:7742
#define RTC_CAL_TENMON_Msk
Definition: M471M_R1_S.h:7715
#define RTC_INTSTS_TICKIF_Msk
Definition: M471M_R1_S.h:7781
#define RTC_CALM_MON_Msk
Definition: M471M_R1_S.h:7754
#define RTC_CAL_TENYEAR_Pos
Definition: M471M_R1_S.h:7720
#define RTC_TIME_TENMIN_Msk
Definition: M471M_R1_S.h:7697
#define RTC_CAL_MON_Msk
Definition: M471M_R1_S.h:7712
#define RTC_TALM_TENSEC_Msk
Definition: M471M_R1_S.h:7733
#define RTC_CAL_TENDAY_Pos
Definition: M471M_R1_S.h:7708
#define RTC_WEEKDAY_WEEKDAY_Msk
Definition: M471M_R1_S.h:7727
#define RTC_CAL_YEAR_Pos
Definition: M471M_R1_S.h:7717
#define RTC_INTEN_SNPDIEN_Msk
Definition: M471M_R1_S.h:7775
#define RTC_CALM_TENMON_Msk
Definition: M471M_R1_S.h:7757
#define RTC_CALM_MON_Pos
Definition: M471M_R1_S.h:7753
#define RTC_TIME_TENMIN_Pos
Definition: M471M_R1_S.h:7696
#define RTC_INIT_ACTIVE_Msk
Definition: M471M_R1_S.h:7670
#define RTC_TIME_HR_Pos
Definition: M471M_R1_S.h:7699
#define RTC_TIME_MIN_Pos
Definition: M471M_R1_S.h:7693
#define RTC_TALM_TENHR_Pos
Definition: M471M_R1_S.h:7744
#define RTC_CALM_TENDAY_Msk
Definition: M471M_R1_S.h:7751
#define RTC_TALM_SEC_Msk
Definition: M471M_R1_S.h:7730
#define RTC_CAL_DAY_Msk
Definition: M471M_R1_S.h:7706
#define RTC_CALM_YEAR_Msk
Definition: M471M_R1_S.h:7760
#define RTC_TIME_SEC_Pos
Definition: M471M_R1_S.h:7687
#define RTC_TIME_TENHR_Msk
Definition: M471M_R1_S.h:7703
#define RTC_TALM_TENHR_Msk
Definition: M471M_R1_S.h:7745
#define RTC_TALM_MIN_Pos
Definition: M471M_R1_S.h:7735
#define RTC_RWEN_RWENF_Msk
Definition: M471M_R1_S.h:7679
#define RTC_CALM_TENYEAR_Pos
Definition: M471M_R1_S.h:7762
NuMicro peripheral access layer header file.
#define NULL
Definition: M471M_R1_S.h:13908
#define CLK
Definition: M471M_R1_S.h:13818
#define RTC
Definition: M471M_R1_S.h:13834
#define RTC_CLOCK_12
Definition: rtc.h:37
#define RTC_INIT_KEY
Definition: rtc.h:31
#define RTC_PM
Definition: rtc.h:40
#define RTC_FCR_REFERENCE
Definition: rtc.h:79
#define RTC_AM
Definition: rtc.h:39
#define RTC_YEAR2000
Definition: rtc.h:78
void RTC_EnableInt(uint32_t u32IntFlagMask)
Enable RTC Interrupt.
Definition: rtc.c:685
void RTC_DisableSnooperDetection(void)
Disable Snooper Pin Detect.
Definition: rtc.c:786
uint32_t RTC_GetDayOfWeek(void)
Get Day of the Week.
Definition: rtc.c:643
void RTC_SetDateAndTime(S_RTC_TIME_DATA_T *sPt)
Update Current RTC Date and Time.
Definition: rtc.c:352
uint32_t u32Month
Definition: rtc.h:93
uint32_t u32AmPm
Definition: rtc.h:100
void RTC_GetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
Get RTC Alarm Date and Time.
Definition: rtc.c:252
void RTC_SetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
Update RTC Alarm Date and Time.
Definition: rtc.c:426
uint32_t u32Hour
Definition: rtc.h:96
void RTC_EnableSpareAccess(void)
Enable Spare Registers Access.
Definition: rtc.c:732
int32_t RTC_Open(S_RTC_TIME_DATA_T *sPt)
Initialize RTC module and start counting.
Definition: rtc.c:66
static __INLINE int32_t RTC_WaitAccessEnable(void)
Wait RTC Access Enable.
Definition: rtc.h:228
void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
Update RTC Current Date.
Definition: rtc.c:491
void RTC_Close(void)
Disable RTC Clock.
Definition: rtc.c:107
void RTC_32KCalibration(int32_t i32FrequencyX100)
Set 32k Frequency Compensation Data.
Definition: rtc.c:121
uint32_t u32Minute
Definition: rtc.h:97
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:524
uint32_t u32Day
Definition: rtc.h:94
uint32_t u32DayOfWeek
Definition: rtc.h:95
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:596
void RTC_DisableInt(uint32_t u32IntFlagMask)
Disable RTC Interrupt.
Definition: rtc.c:702
uint32_t u32Year
Definition: rtc.h:92
void RTC_DisableSpareRegister(void)
Disable Spare Register.
Definition: rtc.c:750
void RTC_SetTickPeriod(uint32_t u32TickSelection)
Set RTC Tick Period Time.
Definition: rtc.c:666
void RTC_EnableSnooperDetection(uint32_t u32PinCondition)
Enable Snooper Pin Detect.
Definition: rtc.c:770
void RTC_SetAlarmDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
Update RTC Alarm Date.
Definition: rtc.c:566
uint32_t u32Second
Definition: rtc.h:98
uint32_t u32TimeScale
Definition: rtc.h:99
void RTC_GetDateAndTime(S_RTC_TIME_DATA_T *sPt)
Get Current RTC Date and Time.
Definition: rtc.c:157
uint32_t SystemCoreClock