NANO103 BSP V3.01.004
The Board Support Package for Nano103 Series
rtc.c
Go to the documentation of this file.
1/**************************************************************************/
14#include <stdio.h>
15#include "Nano103.h"
16
17/*---------------------------------------------------------------------------------------------------------*/
18/* Includes of local headers */
19/*---------------------------------------------------------------------------------------------------------*/
20
21
22
31
32/*---------------------------------------------------------------------------------------------------------*/
33/* Macro, type and constant definitions */
34/*---------------------------------------------------------------------------------------------------------*/
35#define RTC_GLOBALS
36
37/*---------------------------------------------------------------------------------------------------------*/
38/* Global file scope (static) variables */
39/*---------------------------------------------------------------------------------------------------------*/
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;
42
43void RTC_RWEN(void)
44{
45 uint32_t u32TimeOutCount = SystemCoreClock; // 1 second timeout
46 uint32_t i = 0;
47
48 RTC->RWEN = RTC_WRITE_KEY;
49
50 //while(!(RTC->RWEN & RTC_RWEN_RWENF_Msk)) RTC->RWEN = RTC_WRITE_KEY;
51 while(!(RTC->RWEN & RTC_RWEN_RWENF_Msk))
52 {
53 RTC->RWEN = RTC_WRITE_KEY;
54 i++;
55 if(i > u32TimeOutCount) break;
56 }
57
58 u32TimeOutCount = SystemCoreClock;
59 i = 0;
60 while(RTC->RWEN & RTC_RWEN_RTCBUSY_Msk)
61 {
62 i++;
63 if(i > u32TimeOutCount) break;
64 }
65}
66
68
82void RTC_32KCalibration(int32_t i32FrequencyX10000)
83{
84 uint64_t u64Compensate;
85
86 //u64Compensate = (uint64_t)(0x64000000000);
87 u64Compensate = (uint64_t)(0x2710000000000);
88 u64Compensate = (uint64_t)(u64Compensate / (uint64_t)i32FrequencyX10000);
89
90 if(u64Compensate >= 0x400000)
91 {
92 u64Compensate = 0x3FFFFF;
93 }
94
95 RTC_RWEN();
96 RTC->FREQADJ = (uint32_t)u64Compensate;
97
98}
99
124{
125 uint32_t u32TimeOutCount = SystemCoreClock; // 1 second timeout
126 uint32_t u32Reg;
127
128 RTC->INIT = RTC_INIT_KEY;
129
130 if(RTC->INIT != 0x1)
131 {
132 while(RTC->INIT != 0x1)
133 {
134 if(u32TimeOutCount == 0) return -1;
135 u32TimeOutCount--;
136 }
137 }
138
139 if(sPt == NULL)
140 return -1;
141
142 /*-----------------------------------------------------------------------------------------------------*/
143 /* Second, set RTC 24/12 hour setting */
144 /*-----------------------------------------------------------------------------------------------------*/
145 if (sPt->u32TimeScale == RTC_CLOCK_12)
146 {
147 RTC_RWEN();
148 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
149
150 /*-------------------------------------------------------------------------------------------------*/
151 /* important, range of 12-hour PM mode is 21 up to 32 */
152 /*-------------------------------------------------------------------------------------------------*/
153 if (sPt->u32AmPm == RTC_PM)
154 sPt->u32Hour += 20;
155 }
156 else
157 {
158 RTC_RWEN();
159 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
160 }
161
162 /*-----------------------------------------------------------------------------------------------------*/
163 /* Set RTC Calender Loading */
164 /*-----------------------------------------------------------------------------------------------------*/
165 u32Reg = ((sPt->u32Year - RTC_YEAR2000) / 10) << 20;
166 u32Reg |= (((sPt->u32Year - RTC_YEAR2000) % 10) << 16);
167 u32Reg |= ((sPt->u32Month / 10) << 12);
168 u32Reg |= ((sPt->u32Month % 10) << 8);
169 u32Reg |= ((sPt->u32Day / 10) << 4);
170 u32Reg |= (sPt->u32Day % 10);
171 g_u32Reg = u32Reg;
172
173 RTC_RWEN();
174 RTC->CAL = (uint32_t)g_u32Reg;
175
176 /*-----------------------------------------------------------------------------------------------------*/
177 /* Set RTC Time Loading */
178 /*-----------------------------------------------------------------------------------------------------*/
179 u32Reg = ((sPt->u32Hour / 10) << 20);
180 u32Reg |= ((sPt->u32Hour % 10) << 16);
181 u32Reg |= ((sPt->u32Minute / 10) << 12);
182 u32Reg |= ((sPt->u32Minute % 10) << 8);
183 u32Reg |= ((sPt->u32Second / 10) << 4);
184 u32Reg |= (sPt->u32Second % 10);
185 g_u32Reg = u32Reg;
186
187 RTC_RWEN();
188 RTC->TIME = (uint32_t)g_u32Reg;
189
190 RTC_RWEN();
191 RTC->WEEKDAY = sPt->u32DayOfWeek;
192
193 return 0;
194}
195
215{
216 uint32_t u32Tmp;
217
218 sPt->u32TimeScale = RTC->CLKFMT & RTC_CLKFMT_24HEN_Msk; /* 12/24-hour */
219 sPt->u32DayOfWeek = RTC->WEEKDAY & RTC_WEEKDAY_WEEKDAY_Msk; /* Day of week */
220
221 g_u32hiYear = (RTC->CAL & RTC_CAL_TENYEAR_Msk) >> RTC_CAL_TENYEAR_Pos;
222 g_u32loYear = (RTC->CAL & RTC_CAL_YEAR_Msk) >> RTC_CAL_YEAR_Pos;
223 g_u32hiMonth = (RTC->CAL & RTC_CAL_TENMON_Msk) >> RTC_CAL_TENMON_Pos;
224 g_u32loMonth = (RTC->CAL & RTC_CAL_MON_Msk) >> RTC_CAL_MON_Pos;
225 g_u32hiDay = (RTC->CAL & RTC_CAL_TENDAY_Msk) >> RTC_CAL_TENDAY_Pos;
226 g_u32loDay = (RTC->CAL & RTC_CAL_DAY_Msk);
227
228 g_u32hiHour = (RTC->TIME & RTC_TIME_TENHR_Msk) >> RTC_TIME_TENHR_Pos;
229 g_u32loHour = (RTC->TIME & RTC_TIME_HR_Msk) >> RTC_TIME_HR_Pos;
230 g_u32hiMin = (RTC->TIME & RTC_TIME_TENMIN_Msk) >> RTC_TIME_TENMIN_Pos;
231 g_u32loMin = (RTC->TIME & RTC_TIME_MIN_Msk) >> RTC_TIME_MIN_Pos;
232 g_u32hiSec = (RTC->TIME & RTC_TIME_TENSEC_Msk) >> RTC_TIME_TENSEC_Pos;
233 g_u32loSec = (RTC->TIME & RTC_TIME_SEC_Msk);
234
235 u32Tmp = (g_u32hiYear * 10); /* Compute to 20XX year */
236 u32Tmp += g_u32loYear;
237 sPt->u32Year = u32Tmp + RTC_YEAR2000;
238
239 u32Tmp = (g_u32hiMonth * 10); /* Compute 0~12 month */
240 sPt->u32Month = u32Tmp + g_u32loMonth;
241
242 u32Tmp = (g_u32hiDay * 10); /* Compute 0~31 day */
243 sPt->u32Day = u32Tmp + g_u32loDay;
244
245 if (sPt->u32TimeScale == RTC_CLOCK_12) /* Compute12/24 hour */
246 {
247 u32Tmp = (g_u32hiHour * 10);
248 u32Tmp+= g_u32loHour;
249 sPt->u32Hour = u32Tmp; /* AM: 1~12. PM: 21~32. */
250
251 if (sPt->u32Hour >= 21)
252 {
253 sPt->u32AmPm = RTC_PM;
254 sPt->u32Hour -= 20;
255 }
256 else
257 {
258 sPt->u32AmPm = RTC_AM;
259 }
260
261 u32Tmp = (g_u32hiMin * 10);
262 u32Tmp+= g_u32loMin;
263 sPt->u32Minute = u32Tmp;
264
265 u32Tmp = (g_u32hiSec * 10);
266 u32Tmp+= g_u32loSec;
267 sPt->u32Second = u32Tmp;
268
269 }
270 else
271 {
272 u32Tmp = (g_u32hiHour * 10);
273 u32Tmp += g_u32loHour;
274 sPt->u32Hour = u32Tmp;
275
276 u32Tmp = (g_u32hiMin * 10);
277 u32Tmp += g_u32loMin;
278 sPt->u32Minute = u32Tmp;
279
280 u32Tmp = (g_u32hiSec * 10);
281 u32Tmp += g_u32loSec;
282 sPt->u32Second = u32Tmp;
283 }
284
285}
286
287
288
308{
309 uint32_t u32Tmp;
310
311 sPt->u32TimeScale = RTC->CLKFMT & RTC_CLKFMT_24HEN_Msk; /* 12/24-hour */
312 sPt->u32DayOfWeek = RTC->WEEKDAY & RTC_WEEKDAY_WEEKDAY_Msk; /* Day of week */
313
314 g_u32hiYear = (RTC->CALM & RTC_CALM_TENYEAR_Msk) >> RTC_CALM_TENYEAR_Pos;
315 g_u32loYear = (RTC->CALM & RTC_CALM_YEAR_Msk) >> RTC_CALM_YEAR_Pos;
316 g_u32hiMonth = (RTC->CALM & RTC_CALM_TENMON_Msk) >> RTC_CALM_TENMON_Pos;
317 g_u32loMonth = (RTC->CALM & RTC_CALM_MON_Msk) >> RTC_CALM_MON_Pos;
318 g_u32hiDay = (RTC->CALM & RTC_CALM_TENDAY_Msk) >> RTC_CALM_TENDAY_Pos;
319 g_u32loDay = (RTC->CALM & RTC_CALM_DAY_Msk);
320
321 g_u32hiHour = (RTC->TALM & RTC_TALM_TENHR_Msk) >> RTC_TALM_TENHR_Pos;
322 g_u32loHour = (RTC->TALM & RTC_TALM_HR_Msk) >> RTC_TALM_HR_Pos;
323 g_u32hiMin = (RTC->TALM & RTC_TALM_TENMIN_Msk) >> RTC_TALM_TENMIN_Pos;
324 g_u32loMin = (RTC->TALM & RTC_TALM_MIN_Msk) >> RTC_TALM_MIN_Pos;
325 g_u32hiSec = (RTC->TALM & RTC_TALM_TENSEC_Msk) >> RTC_TALM_TENSEC_Pos;
326 g_u32loSec = (RTC->TALM & RTC_TALM_SEC_Msk);
327
328 u32Tmp = (g_u32hiYear * 10); /* Compute to 20XX year */
329 u32Tmp += g_u32loYear;
330 sPt->u32Year = u32Tmp + RTC_YEAR2000;
331
332 u32Tmp = (g_u32hiMonth * 10); /* Compute 0~12 month */
333 sPt->u32Month = u32Tmp + g_u32loMonth;
334
335 u32Tmp = (g_u32hiDay * 10); /* Compute 0~31 day */
336 sPt->u32Day = u32Tmp + g_u32loDay;
337
338 if (sPt->u32TimeScale == RTC_CLOCK_12) /* Compute12/24 hour */
339 {
340 u32Tmp = (g_u32hiHour * 10);
341 u32Tmp += g_u32loHour;
342 sPt->u32Hour = u32Tmp; /* AM: 1~12. PM: 21~32. */
343
344 if (sPt->u32Hour >= 21)
345 {
346 sPt->u32AmPm = RTC_PM;
347 sPt->u32Hour -= 20;
348 }
349 else
350 {
351 sPt->u32AmPm = RTC_AM;
352 }
353
354 u32Tmp = (g_u32hiMin * 10);
355 u32Tmp += g_u32loMin;
356 sPt->u32Minute = u32Tmp;
357
358 u32Tmp = (g_u32hiSec * 10);
359 u32Tmp += g_u32loSec;
360 sPt->u32Second = u32Tmp;
361
362 }
363 else
364 {
365 u32Tmp = (g_u32hiHour * 10);
366 u32Tmp += g_u32loHour;
367 sPt->u32Hour = u32Tmp;
368
369 u32Tmp = (g_u32hiMin * 10);
370 u32Tmp+= g_u32loMin;
371 sPt->u32Minute = u32Tmp;
372
373 u32Tmp = (g_u32hiSec * 10);
374 u32Tmp += g_u32loSec;
375 sPt->u32Second = u32Tmp;
376 }
377
378}
379
380
381
405{
406 uint32_t u32Reg;
407
408 if (sPt->u32TimeScale == RTC_CLOCK_12)
409 {
410 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
411
412 /*-----------------------------------------------------------------------------------------*/
413 /* important, range of 12-hour PM mode is 21 upto 32 */
414 /*-----------------------------------------------------------------------------------------*/
415 if (sPt->u32AmPm == RTC_PM)
416 sPt->u32Hour += 20;
417 }
418 else
419 {
420 RTC_RWEN();
421 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
422 }
423
424 RTC_RWEN();
425 RTC->WEEKDAY = sPt->u32DayOfWeek & RTC_WEEKDAY_WEEKDAY_Msk;
426
427 u32Reg = ((sPt->u32Year - RTC_YEAR2000) / 10) << 20;
428 u32Reg |= (((sPt->u32Year - RTC_YEAR2000) % 10) << 16);
429 u32Reg |= ((sPt->u32Month / 10) << 12);
430 u32Reg |= ((sPt->u32Month % 10) << 8);
431 u32Reg |= ((sPt->u32Day / 10) << 4);
432 u32Reg |= (sPt->u32Day % 10);
433 g_u32Reg = u32Reg;
434
435 RTC_RWEN();
436 RTC->CAL = (uint32_t)g_u32Reg;
437
438 u32Reg = ((sPt->u32Hour / 10) << 20);
439 u32Reg |= ((sPt->u32Hour % 10) << 16);
440 u32Reg |= ((sPt->u32Minute / 10) << 12);
441 u32Reg |= ((sPt->u32Minute % 10) << 8);
442 u32Reg |= ((sPt->u32Second / 10) << 4);
443 u32Reg |= (sPt->u32Second % 10);
444 g_u32Reg = u32Reg;
445
446 RTC_RWEN();
447 RTC->TIME = (uint32_t)g_u32Reg;
448
449}
450
472{
473 uint32_t u32Reg;
474
475 RTC_RWEN();
476
477 if (sPt->u32TimeScale == RTC_CLOCK_12)
478 {
479 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
480
481 /*-----------------------------------------------------------------------------------------*/
482 /* important, range of 12-hour PM mode is 21 up to 32 */
483 /*-----------------------------------------------------------------------------------------*/
484 if (sPt->u32AmPm == RTC_PM)
485 sPt->u32Hour += 20;
486 }
487 else
488 {
489 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
490 }
491
492 RTC_RWEN();
493 RTC->WEEKDAY = sPt->u32DayOfWeek & RTC_WEEKDAY_WEEKDAY_Msk;
494
495
496 u32Reg = ((sPt->u32Year - RTC_YEAR2000) / 10) << 20;
497 u32Reg |= (((sPt->u32Year - RTC_YEAR2000) % 10) << 16);
498 u32Reg |= ((sPt->u32Month / 10) << 12);
499 u32Reg |= ((sPt->u32Month % 10) << 8);
500 u32Reg |= ((sPt->u32Day / 10) << 4);
501 u32Reg |= (sPt->u32Day % 10);
502 g_u32Reg = u32Reg;
503
504 RTC_RWEN();
505 RTC->CALM = (uint32_t)g_u32Reg;
506
507 u32Reg = ((sPt->u32Hour / 10) << 20);
508 u32Reg |= ((sPt->u32Hour % 10) << 16);
509 u32Reg |= ((sPt->u32Minute / 10) << 12);
510 u32Reg |= ((sPt->u32Minute % 10) << 8);
511 u32Reg |= ((sPt->u32Second / 10) << 4);
512 u32Reg |= (sPt->u32Second % 10);
513 g_u32Reg = u32Reg;
514
515 RTC_RWEN();
516 RTC->TALM = (uint32_t)g_u32Reg;
517
518}
519
520
534void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
535{
536 __IO uint32_t u32Reg;
537
538 RTC_RWEN();
539 RTC->WEEKDAY = u32DayOfWeek & RTC_WEEKDAY_WEEKDAY_Msk;
540
541 u32Reg = ((u32Year - RTC_YEAR2000) / 10) << 20;
542 u32Reg |= (((u32Year - RTC_YEAR2000) % 10) << 16);
543 u32Reg |= ((u32Month / 10) << 12);
544 u32Reg |= ((u32Month % 10) << 8);
545 u32Reg |= ((u32Day / 10) << 4);
546 u32Reg |= (u32Day % 10);
547 g_u32Reg = u32Reg;
548
549 RTC_RWEN();
550 RTC->CAL = (uint32_t)g_u32Reg;
551
552}
553
566void RTC_SetTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
567{
568 __IO uint32_t u32Reg;
569
570 RTC_RWEN();
571
572 if (u32TimeMode == RTC_CLOCK_12)
573 {
574 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
575
576 if (u32AmPm == RTC_PM) /* important, range of 12-hour PM mode is 21 upto 32 */
577 u32Hour += 20;
578 }
579 else if(u32TimeMode == RTC_CLOCK_24)
580 {
581 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
582 }
583
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);
590
591 g_u32Reg = u32Reg;
592
593 RTC_RWEN();
594 RTC->TIME = (uint32_t)g_u32Reg;
595
596}
597
608void RTC_SetAlarmDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
609{
610 __IO uint32_t u32Reg;
611
612 u32Reg = ((u32Year - RTC_YEAR2000) / 10) << 20;
613 u32Reg |= (((u32Year - RTC_YEAR2000) % 10) << 16);
614 u32Reg |= ((u32Month / 10) << 12);
615 u32Reg |= ((u32Month % 10) << 8);
616 u32Reg |= ((u32Day / 10) << 4);
617 u32Reg |= (u32Day % 10);
618 g_u32Reg = u32Reg;
619
620 RTC_RWEN();
621 RTC->CALM = (uint32_t)g_u32Reg;
622
623}
624
637void RTC_SetAlarmTime(uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
638{
639 __IO uint32_t u32Reg;
640
641 RTC_RWEN();
642
643 if (u32TimeMode == RTC_CLOCK_12)
644 {
645 RTC->CLKFMT &= ~RTC_CLKFMT_24HEN_Msk;
646
647 if (u32AmPm == RTC_PM) /* important, range of 12-hour PM mode is 21 up to 32 */
648 u32Hour += 20;
649 }
650 else if(u32TimeMode == RTC_CLOCK_24)
651 {
652 RTC->CLKFMT |= RTC_CLKFMT_24HEN_Msk;
653 }
654
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);
661
662 g_u32Reg = u32Reg;
663
664 RTC_RWEN();
665 RTC->TALM = (uint32_t)g_u32Reg;
666
667}
668
669
680void RTC_EnableTamperDetection(uint32_t u32PinCondition)
681{
682 RTC_RWEN();
683
684 /* detection edge select */
685 if(u32PinCondition)
686 RTC->SPRCTL |= RTC_SPRCTL_SNPTYPE0_Msk;
687 else
688 RTC->SPRCTL &= ~RTC_SPRCTL_SNPTYPE0_Msk;
689
690 RTC_RWEN();
691 /* enable snooper pin event detection */
692 RTC->SPRCTL |= RTC_SPRCTL_SNPDEN_Msk;
693}
694
704{
705 RTC_RWEN();
706
707 RTC->SPRCTL &= ~RTC_SPRCTL_SNPDEN_Msk;
708}
709
718uint32_t RTC_GetDayOfWeek(void)
719{
720 return (RTC->WEEKDAY & RTC_WEEKDAY_WEEKDAY_Msk);
721}
722
723
742void RTC_SetTickPeriod(uint32_t u32TickSelection)
743{
744 RTC_RWEN();
745
746 RTC->TICK = RTC->TICK & ~RTC_TICK_TICK_Msk | u32TickSelection;
747}
748
760void RTC_EnableInt(uint32_t u32IntFlagMask)
761{
762 RTC_RWEN();
763
764 RTC->INTEN |= u32IntFlagMask;
765}
766
778void RTC_DisableInt(uint32_t u32IntFlagMask)
779{
780 RTC_RWEN();
781 if(u32IntFlagMask & RTC_INTEN_TICKIEN_Msk)
782 {
783 RTC->INTEN &= ~RTC_INTEN_TICKIEN_Msk;
784 RTC->INTSTS = RTC_INTSTS_TICKIF_Msk;
785 }
786
787 RTC_RWEN();
788 if(u32IntFlagMask & RTC_INTEN_ALMIEN_Msk)
789 {
790 RTC->INTEN &= ~RTC_INTEN_ALMIEN_Msk;
791 RTC->INTSTS = RTC_INTSTS_ALMIF_Msk;
792 }
793
794 RTC_RWEN();
795 if(u32IntFlagMask & RTC_INTEN_SNPDIEN_Msk)
796 {
797 RTC->INTEN &= ~RTC_INTEN_SNPDIEN_Msk;
798 RTC->INTSTS = RTC_INTSTS_SNPDIF_Msk;
799 }
800
801}
802
809void RTC_Close(void)
810{
811 CLK->APBCLK &= ~CLK_APBCLK_RTCCKEN_Msk;
812}
813
814 /* end of group NANO103_RTC_EXPORTED_FUNCTIONS */
816 /* end of group NANO103_RTC_Driver */
818 /* end of group NANO103_Device_Driver */
820
821/*** (C) COPYRIGHT 2015 Nuvoton Technology Corp. ***/
822
823
NANO103 peripheral access layer header file. This file contains all the peripheral register's definit...
#define RTC_TALM_MIN_Msk
Definition: Nano103.h:10225
#define RTC_INTEN_TICKIEN_Msk
Definition: Nano103.h:10261
#define RTC_CAL_TENDAY_Msk
Definition: Nano103.h:10198
#define RTC_CAL_TENYEAR_Msk
Definition: Nano103.h:10210
#define RTC_SPRCTL_SNPDEN_Msk
Definition: Nano103.h:10315
#define RTC_INTSTS_SNPDIF_Msk
Definition: Nano103.h:10273
#define RTC_TIME_SEC_Msk
Definition: Nano103.h:10177
#define RTC_TIME_TENSEC_Msk
Definition: Nano103.h:10180
#define RTC_TALM_HR_Pos
Definition: Nano103.h:10230
#define RTC_TALM_TENMIN_Pos
Definition: Nano103.h:10227
#define RTC_INTSTS_ALMIF_Msk
Definition: Nano103.h:10267
#define RTC_CAL_YEAR_Msk
Definition: Nano103.h:10207
#define RTC_SPRCTL_SNPTYPE0_Msk
Definition: Nano103.h:10318
#define RTC_TIME_TENSEC_Pos
Definition: Nano103.h:10179
#define RTC_CAL_MON_Pos
Definition: Nano103.h:10200
#define RTC_CALM_DAY_Msk
Definition: Nano103.h:10237
#define RTC_TALM_TENSEC_Pos
Definition: Nano103.h:10221
#define RTC_TIME_MIN_Msk
Definition: Nano103.h:10183
#define RTC_TALM_TENMIN_Msk
Definition: Nano103.h:10228
#define RTC_CALM_TENYEAR_Msk
Definition: Nano103.h:10252
#define RTC_TIME_TENHR_Pos
Definition: Nano103.h:10191
#define RTC_CALM_YEAR_Pos
Definition: Nano103.h:10248
#define RTC_RWEN_RTCBUSY_Msk
Definition: Nano103.h:10171
#define RTC_INTEN_ALMIEN_Msk
Definition: Nano103.h:10258
#define RTC_TIME_HR_Msk
Definition: Nano103.h:10189
#define RTC_CAL_TENMON_Pos
Definition: Nano103.h:10203
#define RTC_CALM_TENDAY_Pos
Definition: Nano103.h:10239
#define RTC_CLKFMT_24HEN_Msk
Definition: Nano103.h:10213
#define RTC_CALM_TENMON_Pos
Definition: Nano103.h:10245
#define RTC_TALM_HR_Msk
Definition: Nano103.h:10231
#define RTC_CAL_TENMON_Msk
Definition: Nano103.h:10204
#define RTC_INTSTS_TICKIF_Msk
Definition: Nano103.h:10270
#define RTC_CALM_MON_Msk
Definition: Nano103.h:10243
#define RTC_CAL_TENYEAR_Pos
Definition: Nano103.h:10209
#define RTC_TIME_TENMIN_Msk
Definition: Nano103.h:10186
#define RTC_CAL_MON_Msk
Definition: Nano103.h:10201
#define RTC_TALM_TENSEC_Msk
Definition: Nano103.h:10222
#define RTC_CAL_TENDAY_Pos
Definition: Nano103.h:10197
#define RTC_WEEKDAY_WEEKDAY_Msk
Definition: Nano103.h:10216
#define RTC_CAL_YEAR_Pos
Definition: Nano103.h:10206
#define RTC_INTEN_SNPDIEN_Msk
Definition: Nano103.h:10264
#define RTC_CALM_TENMON_Msk
Definition: Nano103.h:10246
#define RTC_CALM_MON_Pos
Definition: Nano103.h:10242
#define RTC_TIME_TENMIN_Pos
Definition: Nano103.h:10185
#define RTC_TIME_HR_Pos
Definition: Nano103.h:10188
#define RTC_TIME_MIN_Pos
Definition: Nano103.h:10182
#define RTC_TALM_TENHR_Pos
Definition: Nano103.h:10233
#define RTC_CALM_TENDAY_Msk
Definition: Nano103.h:10240
#define RTC_TALM_SEC_Msk
Definition: Nano103.h:10219
#define RTC_CAL_DAY_Msk
Definition: Nano103.h:10195
#define RTC_CALM_YEAR_Msk
Definition: Nano103.h:10249
#define RTC_TIME_TENHR_Msk
Definition: Nano103.h:10192
#define RTC_TALM_TENHR_Msk
Definition: Nano103.h:10234
#define RTC_TALM_MIN_Pos
Definition: Nano103.h:10224
#define RTC_RWEN_RWENF_Msk
Definition: Nano103.h:10168
#define RTC_CALM_TENYEAR_Pos
Definition: Nano103.h:10251
#define CLK
Pointer to CLK register structure.
Definition: Nano103.h:13802
#define RTC
Pointer to RTC register structure.
Definition: Nano103.h:13781
#define RTC_CLOCK_24
Definition: rtc.h:43
#define RTC_CLOCK_12
Definition: rtc.h:42
#define RTC_INIT_KEY
Definition: rtc.h:35
#define RTC_PM
Definition: rtc.h:46
#define RTC_AM
Definition: rtc.h:45
#define RTC_WRITE_KEY
Definition: rtc.h:36
#define RTC_YEAR2000
Definition: rtc.h:40
void RTC_EnableInt(uint32_t u32IntFlagMask)
The function is used to enable specified interrupt.
Definition: rtc.c:760
void RTC_32KCalibration(int32_t i32FrequencyX100)
Set Frequency Compensation Data.
Definition: rtc.c:82
uint32_t RTC_GetDayOfWeek(void)
This function is used to get day of week.
Definition: rtc.c:718
void RTC_SetDateAndTime(S_RTC_TIME_DATA_T *sPt)
This function is used to update date/time to RTC.
Definition: rtc.c:404
uint32_t u32Month
Definition: rtc.h:83
uint32_t u32AmPm
Definition: rtc.h:90
void RTC_GetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
Read alarm date/time from RTC setting.
Definition: rtc.c:307
void RTC_SetAlarmDateAndTime(S_RTC_TIME_DATA_T *sPt)
This function is used to set alarm date/time to RTC.
Definition: rtc.c:471
uint32_t u32Hour
Definition: rtc.h:86
void RTC_EnableTamperDetection(uint32_t u32PinCondition)
This function is used to: .
Definition: rtc.c:680
int32_t RTC_Open(S_RTC_TIME_DATA_T *sPt)
This function is used to: .
Definition: rtc.c:123
void RTC_SetDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
This function is used to update date to RTC.
Definition: rtc.c:534
void RTC_Close(void)
Disable RTC clock.
Definition: rtc.c:809
uint32_t u32Minute
Definition: rtc.h:87
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.
Definition: rtc.c:566
uint32_t u32Day
Definition: rtc.h:84
uint32_t u32DayOfWeek
Definition: rtc.h:85
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.
Definition: rtc.c:637
void RTC_DisableInt(uint32_t u32IntFlagMask)
The function is used to disable specified interrupt.
Definition: rtc.c:778
void RTC_DisableTamperDetection(void)
This function is used to disable tamper detection function.
Definition: rtc.c:703
uint32_t u32Year
Definition: rtc.h:82
void RTC_SetTickPeriod(uint32_t u32TickSelection)
The function is used to set time tick period for periodic time tick Interrupt.
Definition: rtc.c:742
void RTC_SetAlarmDate(uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
This function is used to set alarm date to RTC.
Definition: rtc.c:608
uint32_t u32Second
Definition: rtc.h:88
uint32_t u32TimeScale
Definition: rtc.h:89
void RTC_GetDateAndTime(S_RTC_TIME_DATA_T *sPt)
Read current date/time from RTC setting.
Definition: rtc.c:214
#define NULL
NULL pointer.
Definition: Nano103.h:13963
RTC define Time Data Struct.
Definition: rtc.h:81
uint32_t SystemCoreClock