MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
rtc_a.h
1 //*****************************************************************************
2 //
3 // rtc_a.h - Driver for the RTC_A Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_RTC_A_H__
8 #define __MSP430WARE_RTC_A_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_RTC__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include "inc/hw_memmap.h"
26 //*****************************************************************************
27 //
28 //! \brief Used in the RTC_A_configureCalendarAlarm() function as the param
29 //! parameter.
30 //
31 //*****************************************************************************
33  //! Is the alarm condition for the minutes.
34  //! \n Valid values are:
35  //! - \b RTC_A_ALARMCONDITION_OFF [Default]
36  uint8_t minutesAlarm;
37  //! Is the alarm condition for the hours.
38  //! \n Valid values are:
39  //! - \b RTC_A_ALARMCONDITION_OFF [Default]
40  uint8_t hoursAlarm;
41  //! Is the alarm condition for the day of week.
42  //! \n Valid values are:
43  //! - \b RTC_A_ALARMCONDITION_OFF [Default]
44  uint8_t dayOfWeekAlarm;
45  //! Is the alarm condition for the day of the month.
46  //! \n Valid values are:
47  //! - \b RTC_A_ALARMCONDITION_OFF [Default]
48  uint8_t dayOfMonthAlarm;
50 
51 //*****************************************************************************
52 //
53 //! \brief Used in the RTC_A_initCalendar() function as the CalendarTime
54 //! parameter.
55 //
56 //*****************************************************************************
57 typedef struct Calendar {
58  //! Seconds of minute between 0-59
59  uint8_t Seconds;
60  //! Minutes of hour between 0-59
61  uint8_t Minutes;
62  //! Hour of day between 0-23
63  uint8_t Hours;
64  //! Day of week between 0-6
65  uint8_t DayOfWeek;
66  //! Day of month between 1-31
67  uint8_t DayOfMonth;
68  //! Month between 1-12
69  uint8_t Month;
70  //! Year between 0-4095
71  uint16_t Year;
72 } Calendar;
73 
74 
75 //*****************************************************************************
76 //
77 // The following are values that can be passed to the frequencySelect parameter
78 // for functions: RTC_A_setCalibrationFrequency().
79 //
80 //*****************************************************************************
81 #define RTC_A_CALIBRATIONFREQ_OFF (RTCCALF_0)
82 #define RTC_A_CALIBRATIONFREQ_512HZ (RTCCALF_1)
83 #define RTC_A_CALIBRATIONFREQ_256HZ (RTCCALF_2)
84 #define RTC_A_CALIBRATIONFREQ_1HZ (RTCCALF_3)
85 
86 //*****************************************************************************
87 //
88 // The following are values that can be passed to the offsetDirection parameter
89 // for functions: RTC_A_setCalibrationData().
90 //
91 //*****************************************************************************
92 #define RTC_A_CALIBRATION_DOWN2PPM (!(RTCCALS))
93 #define RTC_A_CALIBRATION_UP4PPM (RTCCALS)
94 
95 //*****************************************************************************
96 //
97 // The following are values that can be passed to the formatSelect parameter
98 // for functions: RTC_A_initCalendar().
99 //
100 //*****************************************************************************
101 #define RTC_A_FORMAT_BINARY (!(RTCBCD))
102 #define RTC_A_FORMAT_BCD (RTCBCD)
103 
104 //*****************************************************************************
105 //
106 // The following are values that can be passed to the param parameter for
107 // functions: RTC_A_configureCalendarAlarm(), RTC_A_configureCalendarAlarm(),
108 // RTC_A_configureCalendarAlarm(), and RTC_A_configureCalendarAlarm().
109 //
110 //*****************************************************************************
111 #define RTC_A_ALARMCONDITION_OFF (0x80)
112 
113 //*****************************************************************************
114 //
115 // The following are values that can be passed to the eventSelect parameter for
116 // functions: RTC_A_setCalendarEvent().
117 //
118 //*****************************************************************************
119 #define RTC_A_CALENDAREVENT_MINUTECHANGE (RTCTEV_0)
120 #define RTC_A_CALENDAREVENT_HOURCHANGE (RTCTEV_1)
121 #define RTC_A_CALENDAREVENT_NOON (RTCTEV_2)
122 #define RTC_A_CALENDAREVENT_MIDNIGHT (RTCTEV_3)
123 
124 //*****************************************************************************
125 //
126 // The following are values that can be passed to the prescaleSelect parameter
127 // for functions: RTC_A_initCounterPrescale(), RTC_A_holdCounterPrescale(),
128 // RTC_A_startCounterPrescale(), RTC_A_definePrescaleEvent(),
129 // RTC_A_getPrescaleValue(), and RTC_A_setPrescaleValue().
130 //
131 //*****************************************************************************
132 #define RTC_A_PRESCALE_0 (0x0)
133 #define RTC_A_PRESCALE_1 (0x2)
134 
135 //*****************************************************************************
136 //
137 // The following are values that can be passed to the clockSelect parameter for
138 // functions: RTC_A_initCounter().
139 //
140 //*****************************************************************************
141 #define RTC_A_CLOCKSELECT_ACLK (RTCSSEL_0)
142 #define RTC_A_CLOCKSELECT_SMCLK (RTCSSEL_1)
143 #define RTC_A_CLOCKSELECT_RT1PS (RTCSSEL_2)
144 
145 //*****************************************************************************
146 //
147 // The following are values that can be passed to the prescaleClockSelect
148 // parameter for functions: RTC_A_initCounterPrescale().
149 //
150 //*****************************************************************************
151 #define RTC_A_PSCLOCKSELECT_ACLK (RT1SSEL_0)
152 #define RTC_A_PSCLOCKSELECT_SMCLK (RT1SSEL_1)
153 #define RTC_A_PSCLOCKSELECT_RT0PS (RT1SSEL_2)
154 
155 //*****************************************************************************
156 //
157 // The following are values that can be passed to the counterSizeSelect
158 // parameter for functions: RTC_A_initCounter().
159 //
160 //*****************************************************************************
161 #define RTC_A_COUNTERSIZE_8BIT (RTCTEV_0)
162 #define RTC_A_COUNTERSIZE_16BIT (RTCTEV_1)
163 #define RTC_A_COUNTERSIZE_24BIT (RTCTEV_2)
164 #define RTC_A_COUNTERSIZE_32BIT (RTCTEV_3)
165 
166 //*****************************************************************************
167 //
168 // The following are values that can be passed to the prescaleDivider parameter
169 // for functions: RTC_A_initCounterPrescale().
170 //
171 //*****************************************************************************
172 #define RTC_A_PSDIVIDER_2 (RT0PSDIV_0)
173 #define RTC_A_PSDIVIDER_4 (RT0PSDIV_1)
174 #define RTC_A_PSDIVIDER_8 (RT0PSDIV_2)
175 #define RTC_A_PSDIVIDER_16 (RT0PSDIV_3)
176 #define RTC_A_PSDIVIDER_32 (RT0PSDIV_4)
177 #define RTC_A_PSDIVIDER_64 (RT0PSDIV_5)
178 #define RTC_A_PSDIVIDER_128 (RT0PSDIV_6)
179 #define RTC_A_PSDIVIDER_256 (RT0PSDIV_7)
180 
181 //*****************************************************************************
182 //
183 // The following are values that can be passed to the prescaleEventDivider
184 // parameter for functions: RTC_A_definePrescaleEvent().
185 //
186 //*****************************************************************************
187 #define RTC_A_PSEVENTDIVIDER_2 (RT0IP_0)
188 #define RTC_A_PSEVENTDIVIDER_4 (RT0IP_1)
189 #define RTC_A_PSEVENTDIVIDER_8 (RT0IP_2)
190 #define RTC_A_PSEVENTDIVIDER_16 (RT0IP_3)
191 #define RTC_A_PSEVENTDIVIDER_32 (RT0IP_4)
192 #define RTC_A_PSEVENTDIVIDER_64 (RT0IP_5)
193 #define RTC_A_PSEVENTDIVIDER_128 (RT0IP_6)
194 #define RTC_A_PSEVENTDIVIDER_256 (RT0IP_7)
195 
196 //*****************************************************************************
197 //
198 // The following are values that can be passed to the interruptMask parameter
199 // for functions: RTC_A_enableInterrupt(), and RTC_A_disableInterrupt(); the
200 // interruptFlagMask parameter for functions: RTC_A_getInterruptStatus(), and
201 // RTC_A_clearInterrupt() as well as returned by the RTC_A_getInterruptStatus()
202 // function.
203 //
204 //*****************************************************************************
205 #define RTC_A_TIME_EVENT_INTERRUPT RTCTEVIE
206 #define RTC_A_CLOCK_ALARM_INTERRUPT RTCAIE
207 #define RTC_A_CLOCK_READ_READY_INTERRUPT RTCRDYIE
208 #define RTC_A_PRESCALE_TIMER0_INTERRUPT 0x02
209 #define RTC_A_PRESCALE_TIMER1_INTERRUPT 0x01
210 
211 //*****************************************************************************
212 //
213 // Prototypes for the APIs.
214 //
215 //*****************************************************************************
216 
217 //*****************************************************************************
218 //
219 //! \brief Starts the RTC.
220 //!
221 //! This function clears the RTC main hold bit to allow the RTC to function.
222 //!
223 //! \param baseAddress is the base address of the RTC_A module.
224 //!
225 //! \return None
226 //
227 //*****************************************************************************
228 extern void RTC_A_startClock(uint16_t baseAddress);
229 
230 //*****************************************************************************
231 //
232 //! \brief Holds the RTC.
233 //!
234 //! This function sets the RTC main hold bit to disable RTC functionality.
235 //!
236 //! \param baseAddress is the base address of the RTC_A module.
237 //!
238 //! \return None
239 //
240 //*****************************************************************************
241 extern void RTC_A_holdClock(uint16_t baseAddress);
242 
243 //*****************************************************************************
244 //
245 //! \brief Allows and Sets the frequency output to RTCCLK pin for calibration
246 //! measurement.
247 //!
248 //! This function sets a frequency to measure at the RTCCLK output pin. After
249 //! testing the set frequency, the calibration could be set accordingly.
250 //!
251 //! \param baseAddress is the base address of the RTC_A module.
252 //! \param frequencySelect is the frequency output to RTCCLK.
253 //! Valid values are:
254 //! - \b RTC_A_CALIBRATIONFREQ_OFF [Default] - turn off calibration
255 //! output
256 //! - \b RTC_A_CALIBRATIONFREQ_512HZ - output signal at 512Hz for
257 //! calibration
258 //! - \b RTC_A_CALIBRATIONFREQ_256HZ - output signal at 256Hz for
259 //! calibration
260 //! - \b RTC_A_CALIBRATIONFREQ_1HZ - output signal at 1Hz for
261 //! calibration
262 //! \n Modified bits are \b RTCCALF of \b RTCCTL3 register.
263 //!
264 //! \return None
265 //
266 //*****************************************************************************
267 extern void RTC_A_setCalibrationFrequency(uint16_t baseAddress,
268  uint16_t frequencySelect);
269 
270 //*****************************************************************************
271 //
272 //! \brief Sets the specified calibration for the RTC.
273 //!
274 //! This function sets the calibration offset to make the RTC as accurate as
275 //! possible. The offsetDirection can be either +4-ppm or -2-ppm, and the
276 //! offsetValue should be from 1-63 and is multiplied by the direction setting
277 //! (i.e. +4-ppm * 8 (offsetValue) = +32-ppm). Please note, when measuring the
278 //! frequency after setting the calibration, you will only see a change on the
279 //! 1Hz frequency.
280 //!
281 //! \param baseAddress is the base address of the RTC_A module.
282 //! \param offsetDirection is the direction that the calibration offset will
283 //! go.
284 //! Valid values are:
285 //! - \b RTC_A_CALIBRATION_DOWN2PPM - calibrate at steps of -2
286 //! - \b RTC_A_CALIBRATION_UP4PPM - calibrate at steps of +4
287 //! \n Modified bits are \b RTCCALS of \b RTCCTL2 register.
288 //! \param offsetValue is the value that the offset will be a factor of; a
289 //! valid value is any integer from 1-63.
290 //! \n Modified bits are \b RTCCAL of \b RTCCTL2 register.
291 //!
292 //! \return None
293 //
294 //*****************************************************************************
295 extern void RTC_A_setCalibrationData(uint16_t baseAddress,
296  uint8_t offsetDirection,
297  uint8_t offsetValue);
298 
299 //*****************************************************************************
300 //
301 //! \brief Initializes the settings to operate the RTC in Counter mode.
302 //!
303 //! This function initializes the Counter mode of the RTC_A. Setting the clock
304 //! source and counter size will allow an interrupt from the RTCTEVIFG once an
305 //! overflow to the counter register occurs.
306 //!
307 //! \param baseAddress is the base address of the RTC_A module.
308 //! \param clockSelect is the selected clock for the counter mode to use.
309 //! Valid values are:
310 //! - \b RTC_A_CLOCKSELECT_ACLK [Default]
311 //! - \b RTC_A_CLOCKSELECT_SMCLK
312 //! - \b RTC_A_CLOCKSELECT_RT1PS - use Prescaler 1 as source to RTC
313 //! \n Modified bits are \b RTCSSEL of \b RTCCTL1 register.
314 //! \param counterSizeSelect is the size of the counter.
315 //! Valid values are:
316 //! - \b RTC_A_COUNTERSIZE_8BIT [Default]
317 //! - \b RTC_A_COUNTERSIZE_16BIT
318 //! - \b RTC_A_COUNTERSIZE_24BIT
319 //! - \b RTC_A_COUNTERSIZE_32BIT
320 //! \n Modified bits are \b RTCTEV of \b RTCCTL1 register.
321 //!
322 //! \return None
323 //
324 //*****************************************************************************
325 extern void RTC_A_initCounter(uint16_t baseAddress,
326  uint16_t clockSelect,
327  uint16_t counterSizeSelect);
328 
329 //*****************************************************************************
330 //
331 //! \brief Initializes the settings to operate the RTC in calendar mode
332 //!
333 //! This function initializes the Calendar mode of the RTC module. To prevent
334 //! potential erroneous alarm conditions from occurring, the alarm should be
335 //! disabled by clearing the RTCAIE, RTCAIFG and AE bits with APIs:
336 //! RTC_A_disableInterrupt(), RTC_A_clearInterrupt() and
337 //! RTC_A_configureCalendarAlarm() before calendar initialization.
338 //!
339 //! \param baseAddress is the base address of the RTC_A module.
340 //! \param CalendarTime is the pointer to the structure containing the values
341 //! for the Calendar to be initialized to. Valid values should be of
342 //! type pointer to Calendar and should contain the following members
343 //! and corresponding values: \n\b Seconds between 0-59 \n\b Minutes
344 //! between 0-59 \n\b Hours between 0-23 \n\b DayOfWeek between 0-6 \n\b
345 //! DayOfMonth between 1-31 \n\b Month between 1-12 \n\b Year between
346 //! 0-4095 \n\b NOTE: Values beyond the ones specified may result in
347 //! erratic behavior.
348 //! \param formatSelect is the format for the Calendar registers to use.
349 //! Valid values are:
350 //! - \b RTC_A_FORMAT_BINARY [Default]
351 //! - \b RTC_A_FORMAT_BCD
352 //! \n Modified bits are \b RTCBCD of \b RTCCTL1 register.
353 //!
354 //! \return None
355 //
356 //*****************************************************************************
357 extern void RTC_A_initCalendar(uint16_t baseAddress,
358  Calendar *CalendarTime,
359  uint16_t formatSelect);
360 
361 //*****************************************************************************
362 //
363 //! \brief Returns the Calendar Time stored in the Calendar registers of the
364 //! RTC.
365 //!
366 //! This function returns the current Calendar time in the form of a Calendar
367 //! structure. The RTCRDY polling is used in this function to prevent reading
368 //! invalid time.
369 //!
370 //! \param baseAddress is the base address of the RTC_A module.
371 //!
372 //! \return A Calendar structure containing the current time.
373 //
374 //*****************************************************************************
375 extern Calendar RTC_A_getCalendarTime(uint16_t baseAddress);
376 
377 //*****************************************************************************
378 //
379 //! \brief Sets and Enables the desired Calendar Alarm settings.
380 //!
381 //! This function sets a Calendar interrupt condition to assert the RTCAIFG
382 //! interrupt flag. The condition is a logical and of all of the parameters.
383 //! For example if the minutes and hours alarm is set, then the interrupt will
384 //! only assert when the minutes AND the hours change to the specified setting.
385 //! Use the RTC_A_ALARM_OFF for any alarm settings that should not be apart of
386 //! the alarm condition.
387 //!
388 //! \param baseAddress is the base address of the RTC_A module.
389 //! \param param is the pointer to struct for calendar alarm configuration.
390 //!
391 //! \return None
392 //
393 //*****************************************************************************
394 extern void RTC_A_configureCalendarAlarm(uint16_t baseAddress,
396 
397 //*****************************************************************************
398 //
399 //! \brief Sets a single specified Calendar interrupt condition
400 //!
401 //! This function sets a specified event to assert the RTCTEVIFG interrupt.
402 //! This interrupt is independent from the Calendar alarm interrupt.
403 //!
404 //! \param baseAddress is the base address of the RTC_A module.
405 //! \param eventSelect is the condition selected.
406 //! Valid values are:
407 //! - \b RTC_A_CALENDAREVENT_MINUTECHANGE - assert interrupt on every
408 //! minute
409 //! - \b RTC_A_CALENDAREVENT_HOURCHANGE - assert interrupt on every hour
410 //! - \b RTC_A_CALENDAREVENT_NOON - assert interrupt when hour is 12
411 //! - \b RTC_A_CALENDAREVENT_MIDNIGHT - assert interrupt when hour is 0
412 //! \n Modified bits are \b RTCTEV of \b RTCCTL register.
413 //!
414 //! \return None
415 //
416 //*****************************************************************************
417 extern void RTC_A_setCalendarEvent(uint16_t baseAddress,
418  uint16_t eventSelect);
419 
420 //*****************************************************************************
421 //
422 //! \brief Returns the value of the Counter register.
423 //!
424 //! This function returns the value of the counter register for the RTC_A
425 //! module. It will return the 32-bit value no matter the size set during
426 //! initialization. The RTC should be held before trying to use this function.
427 //!
428 //! \param baseAddress is the base address of the RTC_A module.
429 //!
430 //! \return The raw value of the full 32-bit Counter Register.
431 //
432 //*****************************************************************************
433 extern uint32_t RTC_A_getCounterValue(uint16_t baseAddress);
434 
435 //*****************************************************************************
436 //
437 //! \brief Sets the value of the Counter register
438 //!
439 //! This function sets the counter register of the RTC_A module.
440 //!
441 //! \param baseAddress is the base address of the RTC_A module.
442 //! \param counterValue is the value to set the Counter register to; a valid
443 //! value may be any 32-bit integer.
444 //!
445 //! \return None
446 //
447 //*****************************************************************************
448 extern void RTC_A_setCounterValue(uint16_t baseAddress,
449  uint32_t counterValue);
450 
451 //*****************************************************************************
452 //
453 //! \brief Initializes the Prescaler for Counter mode.
454 //!
455 //! This function initializes the selected prescaler for the counter mode in
456 //! the RTC_A module. If the RTC is initialized in Calendar mode, then these
457 //! are automatically initialized. The Prescalers can be used to divide a clock
458 //! source additionally before it gets to the main RTC clock.
459 //!
460 //! \param baseAddress is the base address of the RTC_A module.
461 //! \param prescaleSelect is the prescaler to initialize.
462 //! Valid values are:
463 //! - \b RTC_A_PRESCALE_0
464 //! - \b RTC_A_PRESCALE_1
465 //! \param prescaleClockSelect is the clock to drive the selected prescaler.
466 //! Valid values are:
467 //! - \b RTC_A_PSCLOCKSELECT_ACLK
468 //! - \b RTC_A_PSCLOCKSELECT_SMCLK
469 //! - \b RTC_A_PSCLOCKSELECT_RT0PS - use Prescaler 0 as source to
470 //! Prescaler 1 (May only be used if prescaleSelect is
471 //! RTC_A_PRESCALE_1)
472 //! \n Modified bits are \b RTxSSEL of \b RTCPSxCTL register.
473 //! \param prescaleDivider is the divider for the selected clock source.
474 //! Valid values are:
475 //! - \b RTC_A_PSDIVIDER_2 [Default]
476 //! - \b RTC_A_PSDIVIDER_4
477 //! - \b RTC_A_PSDIVIDER_8
478 //! - \b RTC_A_PSDIVIDER_16
479 //! - \b RTC_A_PSDIVIDER_32
480 //! - \b RTC_A_PSDIVIDER_64
481 //! - \b RTC_A_PSDIVIDER_128
482 //! - \b RTC_A_PSDIVIDER_256
483 //! \n Modified bits are \b RTxPSDIV of \b RTCPSxCTL register.
484 //!
485 //! \return None
486 //
487 //*****************************************************************************
488 extern void RTC_A_initCounterPrescale(uint16_t baseAddress,
489  uint8_t prescaleSelect,
490  uint16_t prescaleClockSelect,
491  uint16_t prescaleDivider);
492 
493 //*****************************************************************************
494 //
495 //! \brief Holds the selected Prescaler.
496 //!
497 //! This function holds the prescale counter from continuing. This will only
498 //! work in counter mode, in Calendar mode, the RTC_A_holdClock() must be used.
499 //! In counter mode, if using both prescalers in conjunction with the main RTC
500 //! counter, then stopping RT0PS will stop RT1PS, but stopping RT1PS will not
501 //! stop RT0PS.
502 //!
503 //! \param baseAddress is the base address of the RTC_A module.
504 //! \param prescaleSelect is the prescaler to hold.
505 //! Valid values are:
506 //! - \b RTC_A_PRESCALE_0
507 //! - \b RTC_A_PRESCALE_1
508 //!
509 //! \return None
510 //
511 //*****************************************************************************
512 extern void RTC_A_holdCounterPrescale(uint16_t baseAddress,
513  uint8_t prescaleSelect);
514 
515 //*****************************************************************************
516 //
517 //! \brief Starts the selected Prescaler.
518 //!
519 //! This function starts the selected prescale counter. This function will only
520 //! work if the RTC is in counter mode.
521 //!
522 //! \param baseAddress is the base address of the RTC_A module.
523 //! \param prescaleSelect is the prescaler to start.
524 //! Valid values are:
525 //! - \b RTC_A_PRESCALE_0
526 //! - \b RTC_A_PRESCALE_1
527 //!
528 //! \return None
529 //
530 //*****************************************************************************
531 extern void RTC_A_startCounterPrescale(uint16_t baseAddress,
532  uint8_t prescaleSelect);
533 
534 //*****************************************************************************
535 //
536 //! \brief Sets up an interrupt condition for the selected Prescaler.
537 //!
538 //! This function sets the condition for an interrupt to assert based on the
539 //! individual prescalers.
540 //!
541 //! \param baseAddress is the base address of the RTC_A module.
542 //! \param prescaleSelect is the prescaler to define an interrupt for.
543 //! Valid values are:
544 //! - \b RTC_A_PRESCALE_0
545 //! - \b RTC_A_PRESCALE_1
546 //! \param prescaleEventDivider is a divider to specify when an interrupt can
547 //! occur based on the clock source of the selected prescaler. (Does not
548 //! affect timer of the selected prescaler).
549 //! Valid values are:
550 //! - \b RTC_A_PSEVENTDIVIDER_2 [Default]
551 //! - \b RTC_A_PSEVENTDIVIDER_4
552 //! - \b RTC_A_PSEVENTDIVIDER_8
553 //! - \b RTC_A_PSEVENTDIVIDER_16
554 //! - \b RTC_A_PSEVENTDIVIDER_32
555 //! - \b RTC_A_PSEVENTDIVIDER_64
556 //! - \b RTC_A_PSEVENTDIVIDER_128
557 //! - \b RTC_A_PSEVENTDIVIDER_256
558 //! \n Modified bits are \b RTxIP of \b RTCPSxCTL register.
559 //!
560 //! \return None
561 //
562 //*****************************************************************************
563 extern void RTC_A_definePrescaleEvent(uint16_t baseAddress,
564  uint8_t prescaleSelect,
565  uint8_t prescaleEventDivider);
566 
567 //*****************************************************************************
568 //
569 //! \brief Returns the selected prescaler value.
570 //!
571 //! This function returns the value of the selected prescale counter register.
572 //! Note that the counter value should be held by calling RTC_A_holdClock()
573 //! before calling this API.
574 //!
575 //! \param baseAddress is the base address of the RTC_A module.
576 //! \param prescaleSelect is the prescaler to obtain the value of.
577 //! Valid values are:
578 //! - \b RTC_A_PRESCALE_0
579 //! - \b RTC_A_PRESCALE_1
580 //!
581 //! \return The value of the specified prescaler count register
582 //
583 //*****************************************************************************
584 extern uint8_t RTC_A_getPrescaleValue(uint16_t baseAddress,
585  uint8_t prescaleSelect);
586 
587 //*****************************************************************************
588 //
589 //! \brief Sets the selected prescaler value.
590 //!
591 //! This function sets the prescale counter value. Before setting the prescale
592 //! counter, it should be held by calling RTC_A_holdClock().
593 //!
594 //! \param baseAddress is the base address of the RTC_A module.
595 //! \param prescaleSelect is the prescaler to set the value for.
596 //! Valid values are:
597 //! - \b RTC_A_PRESCALE_0
598 //! - \b RTC_A_PRESCALE_1
599 //! \param prescaleCounterValue is the specified value to set the prescaler to.
600 //! Valid values are any integer between 0-255
601 //! \n Modified bits are \b RTxPS of \b RTxPS register.
602 //!
603 //! \return None
604 //
605 //*****************************************************************************
606 extern void RTC_A_setPrescaleValue(uint16_t baseAddress,
607  uint8_t prescaleSelect,
608  uint8_t prescaleCounterValue);
609 
610 //*****************************************************************************
611 //
612 //! \brief Enables selected RTC interrupt sources.
613 //!
614 //! This function enables the selected RTC interrupt source. Only the sources
615 //! that are enabled can be reflected to the processor interrupt; disabled
616 //! sources have no effect on the processor. Does not clear interrupt flags.
617 //!
618 //! \param baseAddress is the base address of the RTC_A module.
619 //! \param interruptMask is a bit mask of the interrupts to enable.
620 //! Mask value is the logical OR of any of the following:
621 //! - \b RTC_A_TIME_EVENT_INTERRUPT - asserts when counter overflows in
622 //! counter mode or when Calendar event condition defined by
623 //! defineCalendarEvent() is met.
624 //! - \b RTC_A_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
625 //! Calendar mode is met.
626 //! - \b RTC_A_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
627 //! registers are settled.
628 //! - \b RTC_A_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
629 //! event condition is met.
630 //! - \b RTC_A_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
631 //! event condition is met.
632 //!
633 //! \return None
634 //
635 //*****************************************************************************
636 extern void RTC_A_enableInterrupt(uint16_t baseAddress,
637  uint8_t interruptMask);
638 
639 //*****************************************************************************
640 //
641 //! \brief Disables selected RTC interrupt sources.
642 //!
643 //! This function disables the selected RTC interrupt source. Only the sources
644 //! that are enabled can be reflected to the processor interrupt; disabled
645 //! sources have no effect on the processor.
646 //!
647 //! \param baseAddress is the base address of the RTC_A module.
648 //! \param interruptMask is a bit mask of the interrupts to disable.
649 //! Mask value is the logical OR of any of the following:
650 //! - \b RTC_A_TIME_EVENT_INTERRUPT - asserts when counter overflows in
651 //! counter mode or when Calendar event condition defined by
652 //! defineCalendarEvent() is met.
653 //! - \b RTC_A_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
654 //! Calendar mode is met.
655 //! - \b RTC_A_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
656 //! registers are settled.
657 //! - \b RTC_A_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
658 //! event condition is met.
659 //! - \b RTC_A_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
660 //! event condition is met.
661 //!
662 //! \return None
663 //
664 //*****************************************************************************
665 extern void RTC_A_disableInterrupt(uint16_t baseAddress,
666  uint8_t interruptMask);
667 
668 //*****************************************************************************
669 //
670 //! \brief Returns the status of the selected interrupts flags.
671 //!
672 //! This function returns the status of the interrupt flag for the selected
673 //! channel.
674 //!
675 //! \param baseAddress is the base address of the RTC_A module.
676 //! \param interruptFlagMask is a bit mask of the interrupt flags to return the
677 //! status of.
678 //! Mask value is the logical OR of any of the following:
679 //! - \b RTC_A_TIME_EVENT_INTERRUPT - asserts when counter overflows in
680 //! counter mode or when Calendar event condition defined by
681 //! defineCalendarEvent() is met.
682 //! - \b RTC_A_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
683 //! Calendar mode is met.
684 //! - \b RTC_A_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
685 //! registers are settled.
686 //! - \b RTC_A_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
687 //! event condition is met.
688 //! - \b RTC_A_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
689 //! event condition is met.
690 //!
691 //! \return Logical OR of any of the following:
692 //! - \b RTC_A_TIME_EVENT_INTERRUPT asserts when counter overflows in
693 //! counter mode or when Calendar event condition defined by
694 //! defineCalendarEvent() is met.
695 //! - \b RTC_A_CLOCK_ALARM_INTERRUPT asserts when alarm condition in
696 //! Calendar mode is met.
697 //! - \b RTC_A_CLOCK_READ_READY_INTERRUPT asserts when Calendar
698 //! registers are settled.
699 //! - \b RTC_A_PRESCALE_TIMER0_INTERRUPT asserts when Prescaler 0 event
700 //! condition is met.
701 //! - \b RTC_A_PRESCALE_TIMER1_INTERRUPT asserts when Prescaler 1 event
702 //! condition is met.
703 //! \n indicating the status of the masked interrupts
704 //
705 //*****************************************************************************
706 extern uint8_t RTC_A_getInterruptStatus(uint16_t baseAddress,
707  uint8_t interruptFlagMask);
708 
709 //*****************************************************************************
710 //
711 //! \brief Clears selected RTC interrupt flags.
712 //!
713 //! This function clears the RTC interrupt flag is cleared, so that it no
714 //! longer asserts.
715 //!
716 //! \param baseAddress is the base address of the RTC_A module.
717 //! \param interruptFlagMask is a bit mask of the interrupt flags to be
718 //! cleared.
719 //! Mask value is the logical OR of any of the following:
720 //! - \b RTC_A_TIME_EVENT_INTERRUPT - asserts when counter overflows in
721 //! counter mode or when Calendar event condition defined by
722 //! defineCalendarEvent() is met.
723 //! - \b RTC_A_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
724 //! Calendar mode is met.
725 //! - \b RTC_A_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
726 //! registers are settled.
727 //! - \b RTC_A_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
728 //! event condition is met.
729 //! - \b RTC_A_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
730 //! event condition is met.
731 //!
732 //! \return None
733 //
734 //*****************************************************************************
735 extern void RTC_A_clearInterrupt(uint16_t baseAddress,
736  uint8_t interruptFlagMask);
737 
738 //*****************************************************************************
739 //
740 // Mark the end of the C bindings section for C++ compilers.
741 //
742 //*****************************************************************************
743 #ifdef __cplusplus
744 }
745 #endif
746 
747 #endif
748 #endif // __MSP430WARE_RTC_A_H__
void RTC_A_setCalibrationData(uint16_t baseAddress, uint8_t offsetDirection, uint8_t offsetValue)
Sets the specified calibration for the RTC.
Definition: rtc_a.c:38
uint8_t RTC_A_getInterruptStatus(uint16_t baseAddress, uint8_t interruptFlagMask)
Returns the status of the selected interrupts flags.
Definition: rtc_a.c:219
uint8_t Hours
Hour of day between 0-23.
Definition: rtc_a.h:63
uint8_t hoursAlarm
Definition: rtc_a.h:40
uint32_t RTC_A_getCounterValue(uint16_t baseAddress)
Returns the value of the Counter register.
Definition: rtc_a.c:108
void RTC_A_initCalendar(uint16_t baseAddress, Calendar *CalendarTime, uint16_t formatSelect)
Initializes the settings to operate the RTC in calendar mode.
Definition: rtc_a.c:56
void RTC_A_setPrescaleValue(uint16_t baseAddress, uint8_t prescaleSelect, uint8_t prescaleCounterValue)
Sets the selected prescaler value.
Definition: rtc_a.c:174
void RTC_A_clearInterrupt(uint16_t baseAddress, uint8_t interruptFlagMask)
Clears selected RTC interrupt flags.
Definition: rtc_a.c:248
uint8_t dayOfMonthAlarm
Definition: rtc_a.h:48
uint16_t Year
Year between 0-4095.
Definition: rtc_a.h:71
uint8_t DayOfWeek
Day of week between 0-6.
Definition: rtc_a.h:65
uint8_t Minutes
Minutes of hour between 0-59.
Definition: rtc_a.h:61
void RTC_A_holdCounterPrescale(uint16_t baseAddress, uint8_t prescaleSelect)
Holds the selected Prescaler.
Definition: rtc_a.c:137
void RTC_A_enableInterrupt(uint16_t baseAddress, uint8_t interruptMask)
Enables selected RTC interrupt sources.
Definition: rtc_a.c:185
uint8_t Month
Month between 1-12.
Definition: rtc_a.h:69
uint8_t DayOfMonth
Day of month between 1-31.
Definition: rtc_a.h:67
uint8_t dayOfWeekAlarm
Definition: rtc_a.h:44
Used in the RTC_A_initCalendar() function as the CalendarTime parameter.
Definition: rtc_a.h:57
void RTC_A_startCounterPrescale(uint16_t baseAddress, uint8_t prescaleSelect)
Starts the selected Prescaler.
Definition: rtc_a.c:143
Calendar RTC_A_getCalendarTime(uint16_t baseAddress)
Returns the Calendar Time stored in the Calendar registers of the RTC.
Definition: rtc_a.c:74
void RTC_A_setCalibrationFrequency(uint16_t baseAddress, uint16_t frequencySelect)
Allows and Sets the frequency output to RTCCLK pin for calibration measurement.
Definition: rtc_a.c:31
void RTC_A_definePrescaleEvent(uint16_t baseAddress, uint8_t prescaleSelect, uint8_t prescaleEventDivider)
Sets up an interrupt condition for the selected Prescaler.
Definition: rtc_a.c:149
void RTC_A_configureCalendarAlarm(uint16_t baseAddress, RTC_A_configureCalendarAlarmParam *param)
Sets and Enables the desired Calendar Alarm settings.
Definition: rtc_a.c:91
uint8_t RTC_A_getPrescaleValue(uint16_t baseAddress, uint8_t prescaleSelect)
Returns the selected prescaler value.
Definition: rtc_a.c:158
void RTC_A_initCounter(uint16_t baseAddress, uint16_t clockSelect, uint16_t counterSizeSelect)
Initializes the settings to operate the RTC in Counter mode.
Definition: rtc_a.c:45
void RTC_A_startClock(uint16_t baseAddress)
Starts the RTC.
Definition: rtc_a.c:21
void RTC_A_holdClock(uint16_t baseAddress)
Holds the RTC.
Definition: rtc_a.c:26
void RTC_A_setCalendarEvent(uint16_t baseAddress, uint16_t eventSelect)
Sets a single specified Calendar interrupt condition.
Definition: rtc_a.c:101
void RTC_A_disableInterrupt(uint16_t baseAddress, uint8_t interruptMask)
Disables selected RTC interrupt sources.
Definition: rtc_a.c:202
Used in the RTC_A_configureCalendarAlarm() function as the param parameter.
Definition: rtc_a.h:32
void RTC_A_setCounterValue(uint16_t baseAddress, uint32_t counterValue)
Sets the value of the Counter register.
Definition: rtc_a.c:120
void RTC_A_initCounterPrescale(uint16_t baseAddress, uint8_t prescaleSelect, uint16_t prescaleClockSelect, uint16_t prescaleDivider)
Initializes the Prescaler for Counter mode.
Definition: rtc_a.c:127
uint8_t minutesAlarm
Definition: rtc_a.h:36
uint8_t Seconds
Seconds of minute between 0-59.
Definition: rtc_a.h:59

Copyright 2020, Texas Instruments Incorporated