rtc_c.h
Go to the documentation of this file.
1 #ifndef RTC_C_H_
2 #define RTC_C_H_
3 
4 //*****************************************************************************
5 //
8 //
9 //*****************************************************************************
10 
11 
12 //*****************************************************************************
13 //
14 // If building with a C++ compiler, make all of the definitions in this header
15 // have a C binding.
16 //
17 //*****************************************************************************
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include <stdint.h>
24 #include <stdbool.h>
25 #include <msp.h>
26 
27 //*****************************************************************************
28 //
29 //The following is a struct that can be passed to RTC_CalendarInit() in the
30 //CalendarTime parameter, as well as returned by RTC_getCalendarTime()
31 //
32 //*****************************************************************************
33 typedef struct _RTC_C_Calendar
34 {
35  uint_fast8_t seconds;
36  uint_fast8_t minutes;
37  uint_fast8_t hours;
38  uint_fast8_t dayOfWeek;
39  uint_fast8_t dayOfmonth;
40  uint_fast8_t month;
41  uint_fast16_t year;
43 
44 //*****************************************************************************
45 //
46 //The following are values that can be passed to RTC_setCalibrationData()
47 //
48 //*****************************************************************************
49 #define RTC_C_CALIBRATIONFREQ_OFF (RTC_C_CTL13_CALF_0)
50 #define RTC_C_CALIBRATIONFREQ_512HZ (RTC_C_CTL13_CALF_1)
51 #define RTC_C_CALIBRATIONFREQ_256HZ (RTC_C_CTL13_CALF_2)
52 #define RTC_C_CALIBRATIONFREQ_1HZ (RTC_C_CTL13_CALF_3)
53 
54 //*****************************************************************************
55 //
56 //The following are values that can be passed to RTC_setCalibrationData()
57 //
58 //*****************************************************************************
59 #define RTC_C_CALIBRATION_DOWN1PPM ( !(RTC_C_OCAL_OCALS) )
60 #define RTC_C_CALIBRATION_UP1PPM (RTC_C_OCAL_OCALS)
61 
62 //*****************************************************************************
63 //
64 //The following are values that can be passed to
65 //RTC_setTemperatureCompensation()
66 //
67 //*****************************************************************************
68 #define RTC_C_COMPENSATION_DOWN1PPM ( !(RTC_C_TCMP_TCMPS) )
69 #define RTC_C_COMPENSATION_UP1PPM (RTC_C_TCMP_TCMPS)
70 
71 //*****************************************************************************
72 //
73 //The following are values that can be passed to RTC_iniRTC_Calendar()
74 //
75 //*****************************************************************************
76 #define RTC_C_FORMAT_BINARY ( !(RTC_C_CTL13_BCD) )
77 #define RTC_C_FORMAT_BCD (RTC_C_CTL13_BCD)
78 
79 //*****************************************************************************
80 //
81 //The following is a value that can be passed to RTC_seRTC_CalendarAlarm()
82 //
83 //*****************************************************************************
84 #define RTC_C_ALARMCONDITION_OFF (0x80)
85 
86 //*****************************************************************************
87 //
88 //The following are values that can be passed to RTC_seRTC_CalendarEvent()
89 //in the eventSelect parameter.
90 //
91 //*****************************************************************************
92 #define RTC_C_CALENDAREVENT_MINUTECHANGE (RTC_C_CTL13_TEV_0)
93 #define RTC_C_CALENDAREVENT_HOURCHANGE (RTC_C_CTL13_TEV_1)
94 #define RTC_C_CALENDAREVENT_NOON (RTC_C_CTL13_TEV_2)
95 #define RTC_C_CALENDAREVENT_MIDNIGHT (RTC_C_CTL13_TEV_3)
96 
97 //*****************************************************************************
98 //
99 //The following are values that can be passed to RTC_definePrescaleEvent()
100 //
101 //*****************************************************************************
102 #define RTC_C_PRESCALE_0 (0x0)
103 #define RTC_C_PRESCALE_1 (0x1)
104 
105 //*****************************************************************************
106 //
107 //The following are values that can be passed to RTC_definePrescaleEvent()
108 //in the prescaleEventDivider parameter.
109 //
110 //*****************************************************************************
111 #define RTC_C_PSEVENTDIVIDER_2 (RTC_C_PS0CTL_RT0IP_0)
112 #define RTC_C_PSEVENTDIVIDER_4 (RTC_C_PS0CTL_RT0IP_1)
113 #define RTC_C_PSEVENTDIVIDER_8 (RTC_C_PS0CTL_RT0IP_2)
114 #define RTC_C_PSEVENTDIVIDER_16 (RTC_C_PS0CTL_RT0IP_3)
115 #define RTC_C_PSEVENTDIVIDER_32 (RTC_C_PS0CTL_RT0IP_4)
116 #define RTC_C_PSEVENTDIVIDER_64 (RTC_C_PS0CTL_RT0IP_5)
117 #define RTC_C_PSEVENTDIVIDER_128 (RTC_C_PS0CTL_RT0IP_6)
118 #define RTC_C_PSEVENTDIVIDER_256 (RTC_C_PS0CTL_RT0IP_7)
119 
120 //*****************************************************************************
121 //
122 //The following are values that can be passed to the interrupt functions
123 //
124 //*****************************************************************************
125 #define RTC_C_OSCILLATOR_FAULT_INTERRUPT RTC_C_CTL0_OFIE
126 #define RTC_C_TIME_EVENT_INTERRUPT RTC_C_CTL0_TEVIE
127 #define RTC_C_CLOCK_ALARM_INTERRUPT RTC_C_CTL0_AIE
128 #define RTC_C_CLOCK_READ_READY_INTERRUPT RTC_C_CTL0_RDYIE
129 #define RTC_C_PRESCALE_TIMER0_INTERRUPT 0x02
130 #define RTC_C_PRESCALE_TIMER1_INTERRUPT 0x01
131 
132 //*****************************************************************************
133 //
139 //
140 //*****************************************************************************
141 extern void RTC_C_startClock(void);
142 
143 //*****************************************************************************
144 //
150 //
151 //*****************************************************************************
152 extern void RTC_C_holdClock(void);
153 
154 //*****************************************************************************
155 //
174 //
175 //*****************************************************************************
176 extern void RTC_C_setCalibrationFrequency(uint_fast16_t frequencySelect);
177 
178 //*****************************************************************************
179 //
195 //
196 //*****************************************************************************
197 extern void RTC_C_setCalibrationData(uint_fast8_t offsetDirection,
198  uint_fast8_t offsetValue);
199 
200 //*****************************************************************************
201 //
218 //
219 //*****************************************************************************
220 extern bool RTC_C_setTemperatureCompensation(uint_fast16_t offsetDirection,
221  uint_fast8_t offsetValue);
222 
223 //*****************************************************************************
224 //
246 //
247 //*****************************************************************************
248 extern void RTC_C_initCalendar(const RTC_C_Calendar *calendarTime,
249  uint_fast16_t formatSelect);
250 
251 //*****************************************************************************
252 //
260 //
261 //*****************************************************************************
263 
264 //*****************************************************************************
265 //
293 //
294 //*****************************************************************************
295 extern void RTC_C_setCalendarAlarm(uint_fast8_t minutesAlarm,
296  uint_fast8_t hoursAlarm, uint_fast8_t dayOfWeekAlarm,
297  uint_fast8_t dayOfmonthAlarm);
298 
299 //*****************************************************************************
300 //
315 //
316 //*****************************************************************************
317 extern void RTC_C_setCalendarEvent(uint_fast16_t eventSelect);
318 
319 //*****************************************************************************
320 //
344 //
345 //*****************************************************************************
346 extern void RTC_C_definePrescaleEvent(uint_fast8_t prescaleSelect,
347  uint_fast8_t prescaleEventDivider);
348 
349 //*****************************************************************************
350 //
364 //
365 //*****************************************************************************
366 extern uint_fast8_t RTC_C_getPrescaleValue(uint_fast8_t prescaleSelect);
367 
368 //*****************************************************************************
369 //
383 //
384 //*****************************************************************************
385 extern void RTC_C_setPrescaleValue(uint_fast8_t prescaleSelect,
386  uint_fast8_t prescaleCounterValue);
387 
388 //*****************************************************************************
389 //
398 //
399 //*****************************************************************************
400 extern uint16_t RTC_C_convertBCDToBinary(uint16_t valueToConvert);
401 
402 //*****************************************************************************
403 //
406 
413 //
414 //*****************************************************************************
415 extern uint16_t RTC_C_convertBinaryToBCD(uint16_t valueToConvert);
416 
417 //*****************************************************************************
418 //
442 //
443 //*****************************************************************************
444 extern void RTC_C_enableInterrupt(uint8_t interruptMask);
445 
446 //*****************************************************************************
447 //
471 //
472 //*****************************************************************************
473 extern void RTC_C_disableInterrupt(uint8_t interruptMask);
474 
475 //*****************************************************************************
476 //
494 //
495 //*****************************************************************************
496 extern uint_fast8_t RTC_C_getInterruptStatus(void);
497 
498 //*****************************************************************************
499 //
520 //
521 //*****************************************************************************
522 extern uint_fast8_t RTC_C_getEnabledInterruptStatus(void);
523 
524 //*****************************************************************************
525 //
548 //
549 //*****************************************************************************
550 extern void RTC_C_clearInterruptFlag(uint_fast8_t interruptFlagMask);
551 
552 //*****************************************************************************
553 //
566 //
567 //*****************************************************************************
568 extern void RTC_C_registerInterrupt(void (*intHandler)(void));
569 
570 //*****************************************************************************
571 //
582 //
583 //*****************************************************************************
584 extern void RTC_C_unregisterInterrupt(void);
585 
586 /* Defines for future devices that might have multiple instances */
587 #define RTC_C_startClockMultipleInstance(a) RTC_C_startClock()
588 #define RTC_C_holdClockMultipleInstance(a) RTC_C_holdClock()
589 #define RTC_C_setCalibrationFrequencyMultipleInstance(a,b) RTC_C_setCalibrationFrequency(b)
590 #define RTC_C_setCalibrationDataMultipleInstance(a,b,c) RTC_C_setCalibrationData(b,c)
591 #define RTC_C_setTemperatureCompensationMultipleInstance(a,b,c) RTC_C_setTemperatureCompensation(b,c)
592 #define RTC_C_initCalendarMultipleInstance(a,b,c) RTC_C_initCalendar(b,c)
593 #define RTC_C_getCalendarTimeMultipleInstance(a) RTC_C_getCalendarTime()
594 #define RTC_C_setCalendarAlarmMultipleInstance(a,b,c,d,e) RTC_C_setCalendarAlarm(b,c,d,e)
595 #define RTC_C_setCalendarEventMultipleInstance(a,b) RTC_C_setCalendarEvent(b)
596 #define RTC_C_definePrescaleEventMultipleInstance(a,b,c) RTC_C_definePrescaleEvent(b,c)
597 #define RTC_C_getPrescaleValueMultipleInstance(a,b) RTC_C_getPrescaleValue(b)
598 #define RTC_C_setPrescaleValueMultipleInstance(a,b,c) RTC_C_setPrescaleValue(b,c)
599 #define RTC_C_convertBCDToBinaryMultipleInstance(a,b) RTC_C_convertBCDToBinary(b)
600 #define RTC_C_convertBinaryToBCDMultipleInstance(a,b) RTC_C_convertBinaryToBCD(b)
601 #define RTC_C_enableInterruptMultipleInstance(a,b) RTC_C_enableInterrupt(b)
602 #define RTC_C_disableInterruptMultipleInstance(a,b) RTC_C_disableInterrupt(b)
603 #define RTC_C_getInterruptStatusMultipleInstance(a) RTC_C_getInterruptStatus()
604 #define RTC_C_getEnabledInterruptStatusMultipleInstance(a) RTC_C_getEnabledInterruptStatus()
605 #define RTC_C_clearInterruptFlagMultipleInstance(a,b) RTC_C_clearInterruptFlag(b)
606 #define RTC_C_registerInterruptMultipleInstance(a,b) RTC_C_registerInterrupt(b)
607 #define RTC_C_unregisterInterruptMultipleInstance(a) RTC_C_unregisterInterrupt()
608 
609 //*****************************************************************************
610 //
611 // Mark the end of the C bindings section for C++ compilers.
612 //
613 //*****************************************************************************
614 #ifdef __cplusplus
615 }
616 #endif
617 
618 //*****************************************************************************
619 //
620 // Close the Doxygen group.
622 //
623 //*****************************************************************************
624 
625 #endif /* RTC_H */
void RTC_C_startClock(void)
Definition: rtc_c.c:6
Definition: rtc_c.h:33
void RTC_C_definePrescaleEvent(uint_fast8_t prescaleSelect, uint_fast8_t prescaleEventDivider)
Definition: rtc_c.c:103
uint_fast8_t RTC_C_getEnabledInterruptStatus(void)
Definition: rtc_c.c:230
void RTC_C_setCalibrationData(uint_fast8_t offsetDirection, uint_fast8_t offsetValue)
Definition: rtc_c.c:27
void RTC_C_setPrescaleValue(uint_fast8_t prescaleSelect, uint_fast8_t prescaleCounterValue)
Definition: rtc_c.c:125
uint_fast8_t hours
Definition: rtc_c.h:37
uint_fast16_t year
Definition: rtc_c.h:41
uint_fast8_t minutes
Definition: rtc_c.h:36
void RTC_C_holdClock(void)
Definition: rtc_c.c:13
void RTC_C_setCalendarEvent(uint_fast16_t eventSelect)
Definition: rtc_c.c:96
uint_fast8_t dayOfmonth
Definition: rtc_c.h:39
void RTC_C_registerInterrupt(void(*intHandler)(void))
Definition: rtc_c.c:291
uint_fast8_t RTC_C_getInterruptStatus(void)
Definition: rtc_c.c:199
RTC_C_Calendar RTC_C_getCalendarTime(void)
Definition: rtc_c.c:69
void RTC_C_clearInterruptFlag(uint_fast8_t interruptFlagMask)
Definition: rtc_c.c:268
void RTC_C_disableInterrupt(uint8_t interruptMask)
Definition: rtc_c.c:176
void RTC_C_unregisterInterrupt(void)
Definition: rtc_c.c:297
bool RTC_C_setTemperatureCompensation(uint_fast16_t offsetDirection, uint_fast8_t offsetValue)
Definition: rtc_c.c:35
void RTC_C_initCalendar(const RTC_C_Calendar *calendarTime, uint_fast16_t formatSelect)
Definition: rtc_c.c:49
struct _RTC_C_Calendar RTC_C_Calendar
uint16_t RTC_C_convertBinaryToBCD(uint16_t valueToConvert)
Definition: rtc_c.c:148
void RTC_C_setCalendarAlarm(uint_fast8_t minutesAlarm, uint_fast8_t hoursAlarm, uint_fast8_t dayOfWeekAlarm, uint_fast8_t dayOfmonthAlarm)
Definition: rtc_c.c:87
uint_fast8_t month
Definition: rtc_c.h:40
void RTC_C_enableInterrupt(uint8_t interruptMask)
Definition: rtc_c.c:154
uint_fast8_t RTC_C_getPrescaleValue(uint_fast8_t prescaleSelect)
Definition: rtc_c.c:111
uint_fast8_t dayOfWeek
Definition: rtc_c.h:38
uint_fast8_t seconds
Definition: rtc_c.h:35
uint16_t RTC_C_convertBCDToBinary(uint16_t valueToConvert)
Definition: rtc_c.c:142
void RTC_C_setCalibrationFrequency(uint_fast16_t frequencySelect)
Definition: rtc_c.c:20

Copyright 2016, Texas Instruments Incorporated