MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.21.00.08
 All Data Structures Functions Variables Modules Pages
rtc_b.h
1 //*****************************************************************************
2 //
3 // rtc_b.h - Driver for the RTC_B Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_RTC_B_H__
8 #define __MSP430WARE_RTC_B_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_RTC_B__
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_B_initCalendar() function as the CalendarTime
29 //! parameter.
30 //
31 //*****************************************************************************
32 typedef struct Calendar {
33  //! Seconds of minute between 0-59
34  uint8_t Seconds;
35  //! Minutes of hour between 0-59
36  uint8_t Minutes;
37  //! Hour of day between 0-23
38  uint8_t Hours;
39  //! Day of week between 0-6
40  uint8_t DayOfWeek;
41  //! Day of month between 1-31
42  uint8_t DayOfMonth;
43  //! Month between 0-11
44  uint8_t Month;
45  //! Year between 0-4095
46  uint16_t Year;
47 } Calendar;
48 
49 //*****************************************************************************
50 //
51 //! \brief Used in the RTC_B_configureCalendarAlarm() function as the param
52 //! parameter.
53 //
54 //*****************************************************************************
56  //! Is the alarm condition for the minutes.
57  //! \n Valid values are:
58  //! - \b RTC_B_ALARMCONDITION_OFF [Default]
59  uint8_t minutesAlarm;
60  //! Is the alarm condition for the hours.
61  //! \n Valid values are:
62  //! - \b RTC_B_ALARMCONDITION_OFF [Default]
63  uint8_t hoursAlarm;
64  //! Is the alarm condition for the day of week.
65  //! \n Valid values are:
66  //! - \b RTC_B_ALARMCONDITION_OFF [Default]
67  uint8_t dayOfWeekAlarm;
68  //! Is the alarm condition for the day of the month.
69  //! \n Valid values are:
70  //! - \b RTC_B_ALARMCONDITION_OFF [Default]
71  uint8_t dayOfMonthAlarm;
73 
74 
75 //*****************************************************************************
76 //
77 // The following are values that can be passed to the frequencySelect parameter
78 // for functions: RTC_B_setCalibrationFrequency().
79 //
80 //*****************************************************************************
81 #define RTC_B_CALIBRATIONFREQ_OFF (RTCCALF_0)
82 #define RTC_B_CALIBRATIONFREQ_512HZ (RTCCALF_1)
83 #define RTC_B_CALIBRATIONFREQ_256HZ (RTCCALF_2)
84 #define RTC_B_CALIBRATIONFREQ_1HZ (RTCCALF_3)
85 
86 //*****************************************************************************
87 //
88 // The following are values that can be passed to the offsetDirection parameter
89 // for functions: RTC_B_setCalibrationData().
90 //
91 //*****************************************************************************
92 #define RTC_B_CALIBRATION_DOWN2PPM (!(RTCCALS))
93 #define RTC_B_CALIBRATION_UP4PPM (RTCCALS)
94 
95 //*****************************************************************************
96 //
97 // The following are values that can be passed to the formatSelect parameter
98 // for functions: RTC_B_initCalendar().
99 //
100 //*****************************************************************************
101 #define RTC_B_FORMAT_BINARY (!(RTCBCD))
102 #define RTC_B_FORMAT_BCD (RTCBCD)
103 
104 //*****************************************************************************
105 //
106 // The following are values that can be passed to the param parameter for
107 // functions: RTC_B_configureCalendarAlarm(), RTC_B_configureCalendarAlarm(),
108 // RTC_B_configureCalendarAlarm(), and RTC_B_configureCalendarAlarm().
109 //
110 //*****************************************************************************
111 #define RTC_B_ALARMCONDITION_OFF (0x80)
112 
113 //*****************************************************************************
114 //
115 // The following are values that can be passed to the eventSelect parameter for
116 // functions: RTC_B_setCalendarEvent().
117 //
118 //*****************************************************************************
119 #define RTC_B_CALENDAREVENT_MINUTECHANGE (RTCTEV_0)
120 #define RTC_B_CALENDAREVENT_HOURCHANGE (RTCTEV_1)
121 #define RTC_B_CALENDAREVENT_NOON (RTCTEV_2)
122 #define RTC_B_CALENDAREVENT_MIDNIGHT (RTCTEV_3)
123 
124 //*****************************************************************************
125 //
126 // The following are values that can be passed to the prescaleEventDivider
127 // parameter for functions: RTC_B_definePrescaleEvent().
128 //
129 //*****************************************************************************
130 #define RTC_B_PSEVENTDIVIDER_2 (RT0IP_0)
131 #define RTC_B_PSEVENTDIVIDER_4 (RT0IP_1)
132 #define RTC_B_PSEVENTDIVIDER_8 (RT0IP_2)
133 #define RTC_B_PSEVENTDIVIDER_16 (RT0IP_3)
134 #define RTC_B_PSEVENTDIVIDER_32 (RT0IP_4)
135 #define RTC_B_PSEVENTDIVIDER_64 (RT0IP_5)
136 #define RTC_B_PSEVENTDIVIDER_128 (RT0IP_6)
137 #define RTC_B_PSEVENTDIVIDER_256 (RT0IP_7)
138 
139 //*****************************************************************************
140 //
141 // The following are values that can be passed to the prescaleSelect parameter
142 // for functions: RTC_B_definePrescaleEvent(), RTC_B_getPrescaleValue(), and
143 // RTC_B_setPrescaleValue().
144 //
145 //*****************************************************************************
146 #define RTC_B_PRESCALE_0 (0x0)
147 #define RTC_B_PRESCALE_1 (0x2)
148 
149 //*****************************************************************************
150 //
151 // The following are values that can be passed to the interruptMask parameter
152 // for functions: RTC_B_enableInterrupt(), and RTC_B_disableInterrupt(); the
153 // interruptFlagMask parameter for functions: RTC_B_getInterruptStatus(), and
154 // RTC_B_clearInterrupt() as well as returned by the RTC_B_getInterruptStatus()
155 // function.
156 //
157 //*****************************************************************************
158 #define RTC_B_TIME_EVENT_INTERRUPT RTCTEVIE
159 #define RTC_B_CLOCK_ALARM_INTERRUPT RTCAIE
160 #define RTC_B_CLOCK_READ_READY_INTERRUPT RTCRDYIE
161 #define RTC_B_PRESCALE_TIMER0_INTERRUPT 0x02
162 #define RTC_B_PRESCALE_TIMER1_INTERRUPT 0x01
163 #define RTC_B_OSCILLATOR_FAULT_INTERRUPT RTCOFIE
164 
165 //*****************************************************************************
166 //
167 // Prototypes for the APIs.
168 //
169 //*****************************************************************************
170 
171 //*****************************************************************************
172 //
173 //! \brief Starts the RTC.
174 //!
175 //! This function clears the RTC main hold bit to allow the RTC to function.
176 //!
177 //! \param baseAddress is the base address of the RTC_B module.
178 //!
179 //! \return None
180 //
181 //*****************************************************************************
182 extern void RTC_B_startClock(uint16_t baseAddress);
183 
184 //*****************************************************************************
185 //
186 //! \brief Holds the RTC.
187 //!
188 //! This function sets the RTC main hold bit to disable RTC functionality.
189 //!
190 //! \param baseAddress is the base address of the RTC_B module.
191 //!
192 //! \return None
193 //
194 //*****************************************************************************
195 extern void RTC_B_holdClock(uint16_t baseAddress);
196 
197 //*****************************************************************************
198 //
199 //! \brief Allows and Sets the frequency output to RTCCLK pin for calibration
200 //! measurement.
201 //!
202 //! This function sets a frequency to measure at the RTCCLK output pin. After
203 //! testing the set frequency, the calibration could be set accordingly.
204 //!
205 //! \param baseAddress is the base address of the RTC_B module.
206 //! \param frequencySelect is the frequency output to RTCCLK.
207 //! Valid values are:
208 //! - \b RTC_B_CALIBRATIONFREQ_OFF [Default] - turn off calibration
209 //! output
210 //! - \b RTC_B_CALIBRATIONFREQ_512HZ - output signal at 512Hz for
211 //! calibration
212 //! - \b RTC_B_CALIBRATIONFREQ_256HZ - output signal at 256Hz for
213 //! calibration
214 //! - \b RTC_B_CALIBRATIONFREQ_1HZ - output signal at 1Hz for
215 //! calibration
216 //! \n Modified bits are \b RTCCALF of \b RTCCTL3 register.
217 //!
218 //! \return None
219 //
220 //*****************************************************************************
221 extern void RTC_B_setCalibrationFrequency(uint16_t baseAddress,
222  uint16_t frequencySelect);
223 
224 //*****************************************************************************
225 //
226 //! \brief Sets the specified calibration for the RTC.
227 //!
228 //! This function sets the calibration offset to make the RTC as accurate as
229 //! possible. The offsetDirection can be either +4-ppm or -2-ppm, and the
230 //! offsetValue should be from 1-63 and is multiplied by the direction setting
231 //! (i.e. +4-ppm * 8 (offsetValue) = +32-ppm). Please note, when measuring the
232 //! frequency after setting the calibration, you will only see a change on the
233 //! 1Hz frequency.
234 //!
235 //! \param baseAddress is the base address of the RTC_B module.
236 //! \param offsetDirection is the direction that the calibration offset will
237 //! go.
238 //! Valid values are:
239 //! - \b RTC_B_CALIBRATION_DOWN2PPM - calibrate at steps of -2
240 //! - \b RTC_B_CALIBRATION_UP4PPM - calibrate at steps of +4
241 //! \n Modified bits are \b RTCCALS of \b RTCCTL2 register.
242 //! \param offsetValue is the value that the offset will be a factor of; a
243 //! valid value is any integer from 1-63.
244 //! \n Modified bits are \b RTCCAL of \b RTCCTL2 register.
245 //!
246 //! \return None
247 //
248 //*****************************************************************************
249 extern void RTC_B_setCalibrationData(uint16_t baseAddress,
250  uint8_t offsetDirection,
251  uint8_t offsetValue);
252 
253 //*****************************************************************************
254 //
255 //! \brief Initializes the settings to operate the RTC in calendar mode
256 //!
257 //! This function initializes the Calendar mode of the RTC module. To prevent
258 //! potential erroneous alarm conditions from occurring, the alarm should be
259 //! disabled by clearing the RTCAIE, RTCAIFG and AE bits with APIs:
260 //! RTC_B_disableInterrupt(), RTC_B_clearInterrupt() and
261 //! RTC_B_configureCalendarAlarm() before calendar initialization.
262 //!
263 //! \param baseAddress is the base address of the RTC_B module.
264 //! \param CalendarTime is the pointer to the structure containing the values
265 //! for the Calendar to be initialized to. Valid values should be of
266 //! type pointer to Calendar and should contain the following members
267 //! and corresponding values: \b Seconds between 0-59 \b Minutes between
268 //! 0-59 \b Hours between 0-23 \b DayOfWeek between 0-6 \b DayOfMonth
269 //! between 1-31 \b Year between 0-4095 NOTE: Values beyond the ones
270 //! specified may result in erratic behavior.
271 //! \param formatSelect is the format for the Calendar registers to use.
272 //! Valid values are:
273 //! - \b RTC_B_FORMAT_BINARY [Default]
274 //! - \b RTC_B_FORMAT_BCD
275 //! \n Modified bits are \b RTCBCD of \b RTCCTL1 register.
276 //!
277 //! \return None
278 //
279 //*****************************************************************************
280 extern void RTC_B_initCalendar(uint16_t baseAddress,
281  Calendar *CalendarTime,
282  uint16_t formatSelect);
283 
284 //*****************************************************************************
285 //
286 //! \brief Returns the Calendar Time stored in the Calendar registers of the
287 //! RTC.
288 //!
289 //! This function returns the current Calendar time in the form of a Calendar
290 //! structure. The RTCRDY polling is used in this function to prevent reading
291 //! invalid time.
292 //!
293 //! \param baseAddress is the base address of the RTC_B module.
294 //!
295 //! \return A Calendar structure containing the current time.
296 //
297 //*****************************************************************************
298 extern Calendar RTC_B_getCalendarTime(uint16_t baseAddress);
299 
300 //*****************************************************************************
301 //
302 //! \brief Sets and Enables the desired Calendar Alarm settings.
303 //!
304 //! This function sets a Calendar interrupt condition to assert the RTCAIFG
305 //! interrupt flag. The condition is a logical and of all of the parameters.
306 //! For example if the minutes and hours alarm is set, then the interrupt will
307 //! only assert when the minutes AND the hours change to the specified setting.
308 //! Use the RTC_B_ALARM_OFF for any alarm settings that should not be apart of
309 //! the alarm condition.
310 //!
311 //! \param baseAddress is the base address of the RTC_B module.
312 //! \param param is the pointer to struct for calendar alarm configuration.
313 //!
314 //! \return None
315 //
316 //*****************************************************************************
317 extern void RTC_B_configureCalendarAlarm(uint16_t baseAddress,
319 
320 //*****************************************************************************
321 //
322 //! \brief Sets a single specified Calendar interrupt condition
323 //!
324 //! This function sets a specified event to assert the RTCTEVIFG interrupt.
325 //! This interrupt is independent from the Calendar alarm interrupt.
326 //!
327 //! \param baseAddress is the base address of the RTC_B module.
328 //! \param eventSelect is the condition selected.
329 //! Valid values are:
330 //! - \b RTC_B_CALENDAREVENT_MINUTECHANGE - assert interrupt on every
331 //! minute
332 //! - \b RTC_B_CALENDAREVENT_HOURCHANGE - assert interrupt on every hour
333 //! - \b RTC_B_CALENDAREVENT_NOON - assert interrupt when hour is 12
334 //! - \b RTC_B_CALENDAREVENT_MIDNIGHT - assert interrupt when hour is 0
335 //! \n Modified bits are \b RTCTEV of \b RTCCTL register.
336 //!
337 //! \return None
338 //
339 //*****************************************************************************
340 extern void RTC_B_setCalendarEvent(uint16_t baseAddress,
341  uint16_t eventSelect);
342 
343 //*****************************************************************************
344 //
345 //! \brief Sets up an interrupt condition for the selected Prescaler.
346 //!
347 //! This function sets the condition for an interrupt to assert based on the
348 //! individual prescalers.
349 //!
350 //! \param baseAddress is the base address of the RTC_B module.
351 //! \param prescaleSelect is the prescaler to define an interrupt for.
352 //! Valid values are:
353 //! - \b RTC_B_PRESCALE_0
354 //! - \b RTC_B_PRESCALE_1
355 //! \param prescaleEventDivider is a divider to specify when an interrupt can
356 //! occur based on the clock source of the selected prescaler. (Does not
357 //! affect timer of the selected prescaler).
358 //! Valid values are:
359 //! - \b RTC_B_PSEVENTDIVIDER_2 [Default]
360 //! - \b RTC_B_PSEVENTDIVIDER_4
361 //! - \b RTC_B_PSEVENTDIVIDER_8
362 //! - \b RTC_B_PSEVENTDIVIDER_16
363 //! - \b RTC_B_PSEVENTDIVIDER_32
364 //! - \b RTC_B_PSEVENTDIVIDER_64
365 //! - \b RTC_B_PSEVENTDIVIDER_128
366 //! - \b RTC_B_PSEVENTDIVIDER_256
367 //! \n Modified bits are \b RTxIP of \b RTCPSxCTL register.
368 //!
369 //! \return None
370 //
371 //*****************************************************************************
372 extern void RTC_B_definePrescaleEvent(uint16_t baseAddress,
373  uint8_t prescaleSelect,
374  uint8_t prescaleEventDivider);
375 
376 //*****************************************************************************
377 //
378 //! \brief Returns the selected prescaler value.
379 //!
380 //! This function returns the value of the selected prescale counter register.
381 //! Note that the counter value should be held by calling RTC_B_holdClock()
382 //! before calling this API.
383 //!
384 //! \param baseAddress is the base address of the RTC_B module.
385 //! \param prescaleSelect is the prescaler to obtain the value of.
386 //! Valid values are:
387 //! - \b RTC_B_PRESCALE_0
388 //! - \b RTC_B_PRESCALE_1
389 //!
390 //! \return The value of the specified prescaler count register
391 //
392 //*****************************************************************************
393 extern uint8_t RTC_B_getPrescaleValue(uint16_t baseAddress,
394  uint8_t prescaleSelect);
395 
396 //*****************************************************************************
397 //
398 //! \brief Sets the selected prescaler value.
399 //!
400 //! This function sets the prescale counter value. Before setting the prescale
401 //! counter, it should be held by calling RTC_B_holdClock().
402 //!
403 //! \param baseAddress is the base address of the RTC_B module.
404 //! \param prescaleSelect is the prescaler to set the value for.
405 //! Valid values are:
406 //! - \b RTC_B_PRESCALE_0
407 //! - \b RTC_B_PRESCALE_1
408 //! \param prescaleCounterValue is the specified value to set the prescaler to.
409 //! Valid values are any integer between 0-255
410 //! \n Modified bits are \b RTxPS of \b RTxPS register.
411 //!
412 //! \return None
413 //
414 //*****************************************************************************
415 extern void RTC_B_setPrescaleValue(uint16_t baseAddress,
416  uint8_t prescaleSelect,
417  uint8_t prescaleCounterValue);
418 
419 //*****************************************************************************
420 //
421 //! \brief Enables selected RTC interrupt sources.
422 //!
423 //! This function enables the selected RTC interrupt source. Only the sources
424 //! that are enabled can be reflected to the processor interrupt; disabled
425 //! sources have no effect on the processor. Does not clear interrupt flags.
426 //!
427 //! \param baseAddress is the base address of the RTC_B module.
428 //! \param interruptMask is a bit mask of the interrupts to enable.
429 //! Mask value is the logical OR of any of the following:
430 //! - \b RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in
431 //! counter mode or when Calendar event condition defined by
432 //! defineCalendarEvent() is met.
433 //! - \b RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
434 //! Calendar mode is met.
435 //! - \b RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
436 //! registers are settled.
437 //! - \b RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
438 //! event condition is met.
439 //! - \b RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
440 //! event condition is met.
441 //! - \b RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a
442 //! problem with the 32kHz oscillator, while the RTC is running.
443 //!
444 //! \return None
445 //
446 //*****************************************************************************
447 extern void RTC_B_enableInterrupt(uint16_t baseAddress,
448  uint8_t interruptMask);
449 
450 //*****************************************************************************
451 //
452 //! \brief Disables selected RTC interrupt sources.
453 //!
454 //! This function disables the selected RTC interrupt source. Only the sources
455 //! that are enabled can be reflected to the processor interrupt; disabled
456 //! sources have no effect on the processor.
457 //!
458 //! \param baseAddress is the base address of the RTC_B module.
459 //! \param interruptMask is a bit mask of the interrupts to disable.
460 //! Mask value is the logical OR of any of the following:
461 //! - \b RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in
462 //! counter mode or when Calendar event condition defined by
463 //! defineCalendarEvent() is met.
464 //! - \b RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
465 //! Calendar mode is met.
466 //! - \b RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
467 //! registers are settled.
468 //! - \b RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
469 //! event condition is met.
470 //! - \b RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
471 //! event condition is met.
472 //! - \b RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a
473 //! problem with the 32kHz oscillator, while the RTC is running.
474 //!
475 //! \return None
476 //
477 //*****************************************************************************
478 extern void RTC_B_disableInterrupt(uint16_t baseAddress,
479  uint8_t interruptMask);
480 
481 //*****************************************************************************
482 //
483 //! \brief Returns the status of the selected interrupts flags.
484 //!
485 //! This function returns the status of the interrupt flag for the selected
486 //! channel.
487 //!
488 //! \param baseAddress is the base address of the RTC_B module.
489 //! \param interruptFlagMask is a bit mask of the interrupt flags to return the
490 //! status of.
491 //! Mask value is the logical OR of any of the following:
492 //! - \b RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in
493 //! counter mode or when Calendar event condition defined by
494 //! defineCalendarEvent() is met.
495 //! - \b RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
496 //! Calendar mode is met.
497 //! - \b RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
498 //! registers are settled.
499 //! - \b RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
500 //! event condition is met.
501 //! - \b RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
502 //! event condition is met.
503 //! - \b RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a
504 //! problem with the 32kHz oscillator, while the RTC is running.
505 //!
506 //! \return Logical OR of any of the following:
507 //! - \b RTC_B_TIME_EVENT_INTERRUPT asserts when counter overflows in
508 //! counter mode or when Calendar event condition defined by
509 //! defineCalendarEvent() is met.
510 //! - \b RTC_B_CLOCK_ALARM_INTERRUPT asserts when alarm condition in
511 //! Calendar mode is met.
512 //! - \b RTC_B_CLOCK_READ_READY_INTERRUPT asserts when Calendar
513 //! registers are settled.
514 //! - \b RTC_B_PRESCALE_TIMER0_INTERRUPT asserts when Prescaler 0 event
515 //! condition is met.
516 //! - \b RTC_B_PRESCALE_TIMER1_INTERRUPT asserts when Prescaler 1 event
517 //! condition is met.
518 //! - \b RTC_B_OSCILLATOR_FAULT_INTERRUPT asserts if there is a problem
519 //! with the 32kHz oscillator, while the RTC is running.
520 //! \n indicating the status of the masked interrupts
521 //
522 //*****************************************************************************
523 extern uint8_t RTC_B_getInterruptStatus(uint16_t baseAddress,
524  uint8_t interruptFlagMask);
525 
526 //*****************************************************************************
527 //
528 //! \brief Clears selected RTC interrupt flags.
529 //!
530 //! This function clears the RTC interrupt flag is cleared, so that it no
531 //! longer asserts.
532 //!
533 //! \param baseAddress is the base address of the RTC_B module.
534 //! \param interruptFlagMask is a bit mask of the interrupt flags to be
535 //! cleared.
536 //! Mask value is the logical OR of any of the following:
537 //! - \b RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in
538 //! counter mode or when Calendar event condition defined by
539 //! defineCalendarEvent() is met.
540 //! - \b RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
541 //! Calendar mode is met.
542 //! - \b RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
543 //! registers are settled.
544 //! - \b RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
545 //! event condition is met.
546 //! - \b RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
547 //! event condition is met.
548 //! - \b RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a
549 //! problem with the 32kHz oscillator, while the RTC is running.
550 //!
551 //! \return None
552 //
553 //*****************************************************************************
554 extern void RTC_B_clearInterrupt(uint16_t baseAddress,
555  uint8_t interruptFlagMask);
556 
557 //*****************************************************************************
558 //
559 //! \brief Convert the given BCD value to binary format
560 //!
561 //! This function converts BCD values to binary format. This API uses the
562 //! hardware registers to perform the conversion rather than a software method.
563 //!
564 //! \param baseAddress is the base address of the RTC_B module.
565 //! \param valueToConvert is the raw value in BCD format to convert to Binary.
566 //! \n Modified bits are \b BCD2BIN of \b BCD2BIN register.
567 //!
568 //! \return The binary version of the input parameter
569 //
570 //*****************************************************************************
571 extern uint16_t RTC_B_convertBCDToBinary(uint16_t baseAddress,
572  uint16_t valueToConvert);
573 
574 //*****************************************************************************
575 //
576 //! \brief Convert the given binary value to BCD format
577 //!
578 //! This function converts binary values to BCD format. This API uses the
579 //! hardware registers to perform the conversion rather than a software method.
580 //!
581 //! \param baseAddress is the base address of the RTC_B module.
582 //! \param valueToConvert is the raw value in Binary format to convert to BCD.
583 //! \n Modified bits are \b BIN2BCD of \b BIN2BCD register.
584 //!
585 //! \return The BCD version of the valueToConvert parameter
586 //
587 //*****************************************************************************
588 extern uint16_t RTC_B_convertBinaryToBCD(uint16_t baseAddress,
589  uint16_t valueToConvert);
590 
591 //*****************************************************************************
592 //
593 // Mark the end of the C bindings section for C++ compilers.
594 //
595 //*****************************************************************************
596 #ifdef __cplusplus
597 }
598 #endif
599 
600 #endif
601 #endif // __MSP430WARE_RTC_B_H__
void RTC_B_clearInterrupt(uint16_t baseAddress, uint8_t interruptFlagMask)
Clears selected RTC interrupt flags.
Definition: rtc_b.c:192
uint8_t RTC_B_getPrescaleValue(uint16_t baseAddress, uint8_t prescaleSelect)
Returns the selected prescaler value.
Definition: rtc_b.c:106
uint8_t Hours
Hour of day between 0-23.
Definition: rtc_b.h:38
uint8_t RTC_B_getInterruptStatus(uint16_t baseAddress, uint8_t interruptFlagMask)
Returns the status of the selected interrupts flags.
Definition: rtc_b.c:163
void RTC_B_setPrescaleValue(uint16_t baseAddress, uint8_t prescaleSelect, uint8_t prescaleCounterValue)
Sets the selected prescaler value.
Definition: rtc_b.c:118
Calendar RTC_B_getCalendarTime(uint16_t baseAddress)
Returns the Calendar Time stored in the Calendar registers of the RTC.
Definition: rtc_b.c:63
void RTC_B_setCalibrationFrequency(uint16_t baseAddress, uint16_t frequencySelect)
Allows and Sets the frequency output to RTCCLK pin for calibration measurement.
Definition: rtc_b.c:31
uint16_t Year
Year between 0-4095.
Definition: rtc_b.h:46
uint8_t minutesAlarm
Definition: rtc_b.h:59
void RTC_B_startClock(uint16_t baseAddress)
Starts the RTC.
Definition: rtc_b.c:21
uint8_t DayOfWeek
Day of week between 0-6.
Definition: rtc_b.h:40
void RTC_B_configureCalendarAlarm(uint16_t baseAddress, RTC_B_configureCalendarAlarmParam *param)
Sets and Enables the desired Calendar Alarm settings.
Definition: rtc_b.c:80
void RTC_B_disableInterrupt(uint16_t baseAddress, uint8_t interruptMask)
Disables selected RTC interrupt sources.
Definition: rtc_b.c:146
uint8_t Minutes
Minutes of hour between 0-59.
Definition: rtc_b.h:36
uint8_t Month
Month between 0-11.
Definition: rtc_b.h:44
uint8_t DayOfMonth
Day of month between 1-31.
Definition: rtc_b.h:42
Used in the RTC_B_initCalendar() function as the CalendarTime parameter.
Definition: rtc_b.h:32
uint8_t dayOfMonthAlarm
Definition: rtc_b.h:71
void RTC_B_enableInterrupt(uint16_t baseAddress, uint8_t interruptMask)
Enables selected RTC interrupt sources.
Definition: rtc_b.c:129
void RTC_B_setCalendarEvent(uint16_t baseAddress, uint16_t eventSelect)
Sets a single specified Calendar interrupt condition.
Definition: rtc_b.c:90
uint8_t dayOfWeekAlarm
Definition: rtc_b.h:67
void RTC_B_definePrescaleEvent(uint16_t baseAddress, uint8_t prescaleSelect, uint8_t prescaleEventDivider)
Sets up an interrupt condition for the selected Prescaler.
Definition: rtc_b.c:97
Used in the RTC_B_configureCalendarAlarm() function as the param parameter.
Definition: rtc_b.h:55
void RTC_B_initCalendar(uint16_t baseAddress, Calendar *CalendarTime, uint16_t formatSelect)
Initializes the settings to operate the RTC in calendar mode.
Definition: rtc_b.c:45
uint16_t RTC_B_convertBCDToBinary(uint16_t baseAddress, uint16_t valueToConvert)
Convert the given BCD value to binary format.
Definition: rtc_b.c:216
void RTC_B_holdClock(uint16_t baseAddress)
Holds the RTC.
Definition: rtc_b.c:26
uint8_t Seconds
Seconds of minute between 0-59.
Definition: rtc_b.h:34
uint16_t RTC_B_convertBinaryToBCD(uint16_t baseAddress, uint16_t valueToConvert)
Convert the given binary value to BCD format.
Definition: rtc_b.c:223
void RTC_B_setCalibrationData(uint16_t baseAddress, uint8_t offsetDirection, uint8_t offsetValue)
Sets the specified calibration for the RTC.
Definition: rtc_b.c:38
uint8_t hoursAlarm
Definition: rtc_b.h:63

Copyright 2015, Texas Instruments Incorporated