MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
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 1-12
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: \n\b Seconds between 0-59 \n\b Minutes
268 //! between 0-59 \n\b Hours between 0-23 \n\b DayOfWeek between 0-6 \n\b
269 //! DayOfMonth between 1-31 \n\b Month between 1-12 \n\b Year between
270 //! 0-4095 \n\b NOTE: Values beyond the ones specified may result in
271 //! erratic behavior.
272 //! \param formatSelect is the format for the Calendar registers to use.
273 //! Valid values are:
274 //! - \b RTC_B_FORMAT_BINARY [Default]
275 //! - \b RTC_B_FORMAT_BCD
276 //! \n Modified bits are \b RTCBCD of \b RTCCTL1 register.
277 //!
278 //! \return None
279 //
280 //*****************************************************************************
281 extern void RTC_B_initCalendar(uint16_t baseAddress,
282  Calendar *CalendarTime,
283  uint16_t formatSelect);
284 
285 //*****************************************************************************
286 //
287 //! \brief Returns the Calendar Time stored in the Calendar registers of the
288 //! RTC.
289 //!
290 //! This function returns the current Calendar time in the form of a Calendar
291 //! structure. The RTCRDY polling is used in this function to prevent reading
292 //! invalid time.
293 //!
294 //! \param baseAddress is the base address of the RTC_B module.
295 //!
296 //! \return A Calendar structure containing the current time.
297 //
298 //*****************************************************************************
299 extern Calendar RTC_B_getCalendarTime(uint16_t baseAddress);
300 
301 //*****************************************************************************
302 //
303 //! \brief Sets and Enables the desired Calendar Alarm settings.
304 //!
305 //! This function sets a Calendar interrupt condition to assert the RTCAIFG
306 //! interrupt flag. The condition is a logical and of all of the parameters.
307 //! For example if the minutes and hours alarm is set, then the interrupt will
308 //! only assert when the minutes AND the hours change to the specified setting.
309 //! Use the RTC_B_ALARM_OFF for any alarm settings that should not be apart of
310 //! the alarm condition.
311 //!
312 //! \param baseAddress is the base address of the RTC_B module.
313 //! \param param is the pointer to struct for calendar alarm configuration.
314 //!
315 //! \return None
316 //
317 //*****************************************************************************
318 extern void RTC_B_configureCalendarAlarm(uint16_t baseAddress,
320 
321 //*****************************************************************************
322 //
323 //! \brief Sets a single specified Calendar interrupt condition
324 //!
325 //! This function sets a specified event to assert the RTCTEVIFG interrupt.
326 //! This interrupt is independent from the Calendar alarm interrupt.
327 //!
328 //! \param baseAddress is the base address of the RTC_B module.
329 //! \param eventSelect is the condition selected.
330 //! Valid values are:
331 //! - \b RTC_B_CALENDAREVENT_MINUTECHANGE - assert interrupt on every
332 //! minute
333 //! - \b RTC_B_CALENDAREVENT_HOURCHANGE - assert interrupt on every hour
334 //! - \b RTC_B_CALENDAREVENT_NOON - assert interrupt when hour is 12
335 //! - \b RTC_B_CALENDAREVENT_MIDNIGHT - assert interrupt when hour is 0
336 //! \n Modified bits are \b RTCTEV of \b RTCCTL register.
337 //!
338 //! \return None
339 //
340 //*****************************************************************************
341 extern void RTC_B_setCalendarEvent(uint16_t baseAddress,
342  uint16_t eventSelect);
343 
344 //*****************************************************************************
345 //
346 //! \brief Sets up an interrupt condition for the selected Prescaler.
347 //!
348 //! This function sets the condition for an interrupt to assert based on the
349 //! individual prescalers.
350 //!
351 //! \param baseAddress is the base address of the RTC_B module.
352 //! \param prescaleSelect is the prescaler to define an interrupt for.
353 //! Valid values are:
354 //! - \b RTC_B_PRESCALE_0
355 //! - \b RTC_B_PRESCALE_1
356 //! \param prescaleEventDivider is a divider to specify when an interrupt can
357 //! occur based on the clock source of the selected prescaler. (Does not
358 //! affect timer of the selected prescaler).
359 //! Valid values are:
360 //! - \b RTC_B_PSEVENTDIVIDER_2 [Default]
361 //! - \b RTC_B_PSEVENTDIVIDER_4
362 //! - \b RTC_B_PSEVENTDIVIDER_8
363 //! - \b RTC_B_PSEVENTDIVIDER_16
364 //! - \b RTC_B_PSEVENTDIVIDER_32
365 //! - \b RTC_B_PSEVENTDIVIDER_64
366 //! - \b RTC_B_PSEVENTDIVIDER_128
367 //! - \b RTC_B_PSEVENTDIVIDER_256
368 //! \n Modified bits are \b RTxIP of \b RTCPSxCTL register.
369 //!
370 //! \return None
371 //
372 //*****************************************************************************
373 extern void RTC_B_definePrescaleEvent(uint16_t baseAddress,
374  uint8_t prescaleSelect,
375  uint8_t prescaleEventDivider);
376 
377 //*****************************************************************************
378 //
379 //! \brief Returns the selected prescaler value.
380 //!
381 //! This function returns the value of the selected prescale counter register.
382 //! Note that the counter value should be held by calling RTC_B_holdClock()
383 //! before calling this API.
384 //!
385 //! \param baseAddress is the base address of the RTC_B module.
386 //! \param prescaleSelect is the prescaler to obtain the value of.
387 //! Valid values are:
388 //! - \b RTC_B_PRESCALE_0
389 //! - \b RTC_B_PRESCALE_1
390 //!
391 //! \return The value of the specified prescaler count register
392 //
393 //*****************************************************************************
394 extern uint8_t RTC_B_getPrescaleValue(uint16_t baseAddress,
395  uint8_t prescaleSelect);
396 
397 //*****************************************************************************
398 //
399 //! \brief Sets the selected prescaler value.
400 //!
401 //! This function sets the prescale counter value. Before setting the prescale
402 //! counter, it should be held by calling RTC_B_holdClock().
403 //!
404 //! \param baseAddress is the base address of the RTC_B module.
405 //! \param prescaleSelect is the prescaler to set the value for.
406 //! Valid values are:
407 //! - \b RTC_B_PRESCALE_0
408 //! - \b RTC_B_PRESCALE_1
409 //! \param prescaleCounterValue is the specified value to set the prescaler to.
410 //! Valid values are any integer between 0-255
411 //! \n Modified bits are \b RTxPS of \b RTxPS register.
412 //!
413 //! \return None
414 //
415 //*****************************************************************************
416 extern void RTC_B_setPrescaleValue(uint16_t baseAddress,
417  uint8_t prescaleSelect,
418  uint8_t prescaleCounterValue);
419 
420 //*****************************************************************************
421 //
422 //! \brief Enables selected RTC interrupt sources.
423 //!
424 //! This function enables the selected RTC interrupt source. Only the sources
425 //! that are enabled can be reflected to the processor interrupt; disabled
426 //! sources have no effect on the processor. Does not clear interrupt flags.
427 //!
428 //! \param baseAddress is the base address of the RTC_B module.
429 //! \param interruptMask is a bit mask of the interrupts to enable.
430 //! Mask value is the logical OR of any of the following:
431 //! - \b RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in
432 //! counter mode or when Calendar event condition defined by
433 //! defineCalendarEvent() is met.
434 //! - \b RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
435 //! Calendar mode is met.
436 //! - \b RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
437 //! registers are settled.
438 //! - \b RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
439 //! event condition is met.
440 //! - \b RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
441 //! event condition is met.
442 //! - \b RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a
443 //! problem with the 32kHz oscillator, while the RTC is running.
444 //!
445 //! \return None
446 //
447 //*****************************************************************************
448 extern void RTC_B_enableInterrupt(uint16_t baseAddress,
449  uint8_t interruptMask);
450 
451 //*****************************************************************************
452 //
453 //! \brief Disables selected RTC interrupt sources.
454 //!
455 //! This function disables the selected RTC interrupt source. Only the sources
456 //! that are enabled can be reflected to the processor interrupt; disabled
457 //! sources have no effect on the processor.
458 //!
459 //! \param baseAddress is the base address of the RTC_B module.
460 //! \param interruptMask is a bit mask of the interrupts to disable.
461 //! Mask value is the logical OR of any of the following:
462 //! - \b RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in
463 //! counter mode or when Calendar event condition defined by
464 //! defineCalendarEvent() is met.
465 //! - \b RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
466 //! Calendar mode is met.
467 //! - \b RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
468 //! registers are settled.
469 //! - \b RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
470 //! event condition is met.
471 //! - \b RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
472 //! event condition is met.
473 //! - \b RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a
474 //! problem with the 32kHz oscillator, while the RTC is running.
475 //!
476 //! \return None
477 //
478 //*****************************************************************************
479 extern void RTC_B_disableInterrupt(uint16_t baseAddress,
480  uint8_t interruptMask);
481 
482 //*****************************************************************************
483 //
484 //! \brief Returns the status of the selected interrupts flags.
485 //!
486 //! This function returns the status of the interrupt flag for the selected
487 //! channel.
488 //!
489 //! \param baseAddress is the base address of the RTC_B module.
490 //! \param interruptFlagMask is a bit mask of the interrupt flags to return the
491 //! status of.
492 //! Mask value is the logical OR of any of the following:
493 //! - \b RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in
494 //! counter mode or when Calendar event condition defined by
495 //! defineCalendarEvent() is met.
496 //! - \b RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
497 //! Calendar mode is met.
498 //! - \b RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
499 //! registers are settled.
500 //! - \b RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
501 //! event condition is met.
502 //! - \b RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
503 //! event condition is met.
504 //! - \b RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a
505 //! problem with the 32kHz oscillator, while the RTC is running.
506 //!
507 //! \return Logical OR of any of the following:
508 //! - \b RTC_B_TIME_EVENT_INTERRUPT asserts when counter overflows in
509 //! counter mode or when Calendar event condition defined by
510 //! defineCalendarEvent() is met.
511 //! - \b RTC_B_CLOCK_ALARM_INTERRUPT asserts when alarm condition in
512 //! Calendar mode is met.
513 //! - \b RTC_B_CLOCK_READ_READY_INTERRUPT asserts when Calendar
514 //! registers are settled.
515 //! - \b RTC_B_PRESCALE_TIMER0_INTERRUPT asserts when Prescaler 0 event
516 //! condition is met.
517 //! - \b RTC_B_PRESCALE_TIMER1_INTERRUPT asserts when Prescaler 1 event
518 //! condition is met.
519 //! - \b RTC_B_OSCILLATOR_FAULT_INTERRUPT asserts if there is a problem
520 //! with the 32kHz oscillator, while the RTC is running.
521 //! \n indicating the status of the masked interrupts
522 //
523 //*****************************************************************************
524 extern uint8_t RTC_B_getInterruptStatus(uint16_t baseAddress,
525  uint8_t interruptFlagMask);
526 
527 //*****************************************************************************
528 //
529 //! \brief Clears selected RTC interrupt flags.
530 //!
531 //! This function clears the RTC interrupt flag is cleared, so that it no
532 //! longer asserts.
533 //!
534 //! \param baseAddress is the base address of the RTC_B module.
535 //! \param interruptFlagMask is a bit mask of the interrupt flags to be
536 //! cleared.
537 //! Mask value is the logical OR of any of the following:
538 //! - \b RTC_B_TIME_EVENT_INTERRUPT - asserts when counter overflows in
539 //! counter mode or when Calendar event condition defined by
540 //! defineCalendarEvent() is met.
541 //! - \b RTC_B_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in
542 //! Calendar mode is met.
543 //! - \b RTC_B_CLOCK_READ_READY_INTERRUPT - asserts when Calendar
544 //! registers are settled.
545 //! - \b RTC_B_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0
546 //! event condition is met.
547 //! - \b RTC_B_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1
548 //! event condition is met.
549 //! - \b RTC_B_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a
550 //! problem with the 32kHz oscillator, while the RTC is running.
551 //!
552 //! \return None
553 //
554 //*****************************************************************************
555 extern void RTC_B_clearInterrupt(uint16_t baseAddress,
556  uint8_t interruptFlagMask);
557 
558 //*****************************************************************************
559 //
560 //! \brief Convert the given BCD value to binary format
561 //!
562 //! This function converts BCD values to binary format. This API uses the
563 //! hardware registers to perform the conversion rather than a software method.
564 //!
565 //! \param baseAddress is the base address of the RTC_B module.
566 //! \param valueToConvert is the raw value in BCD format to convert to Binary.
567 //! \n Modified bits are \b BCD2BIN of \b BCD2BIN register.
568 //!
569 //! \return The binary version of the input parameter
570 //
571 //*****************************************************************************
572 extern uint16_t RTC_B_convertBCDToBinary(uint16_t baseAddress,
573  uint16_t valueToConvert);
574 
575 //*****************************************************************************
576 //
577 //! \brief Convert the given binary value to BCD format
578 //!
579 //! This function converts binary values to BCD format. This API uses the
580 //! hardware registers to perform the conversion rather than a software method.
581 //!
582 //! \param baseAddress is the base address of the RTC_B module.
583 //! \param valueToConvert is the raw value in Binary format to convert to BCD.
584 //! \n Modified bits are \b BIN2BCD of \b BIN2BCD register.
585 //!
586 //! \return The BCD version of the valueToConvert parameter
587 //
588 //*****************************************************************************
589 extern uint16_t RTC_B_convertBinaryToBCD(uint16_t baseAddress,
590  uint16_t valueToConvert);
591 
592 //*****************************************************************************
593 //
594 // Mark the end of the C bindings section for C++ compilers.
595 //
596 //*****************************************************************************
597 #ifdef __cplusplus
598 }
599 #endif
600 
601 #endif
602 #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_a.h:63
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_a.h:71
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_a.h:65
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_a.h:61
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
Used in the RTC_A_initCalendar() function as the CalendarTime parameter.
Definition: rtc_a.h:57
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_a.h:59
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 2020, Texas Instruments Incorporated