7 #ifndef __MSP430WARE_RTC_A_H__
8 #define __MSP430WARE_RTC_A_H__
12 #ifdef __MSP430_HAS_RTC__
32 typedef struct RTC_A_configureCalendarAlarmParam {
44 uint8_t dayOfWeekAlarm;
48 uint8_t dayOfMonthAlarm;
49 } RTC_A_configureCalendarAlarmParam;
57 typedef struct Calendar {
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)
92 #define RTC_A_CALIBRATION_DOWN2PPM (!(RTCCALS))
93 #define RTC_A_CALIBRATION_UP4PPM (RTCCALS)
101 #define RTC_A_FORMAT_BINARY (!(RTCBCD))
102 #define RTC_A_FORMAT_BCD (RTCBCD)
111 #define RTC_A_ALARMCONDITION_OFF (0x80)
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)
132 #define RTC_A_PRESCALE_0 (0x0)
133 #define RTC_A_PRESCALE_1 (0x2)
141 #define RTC_A_CLOCKSELECT_ACLK (RTCSSEL_0)
142 #define RTC_A_CLOCKSELECT_SMCLK (RTCSSEL_1)
143 #define RTC_A_CLOCKSELECT_RT1PS (RTCSSEL_2)
151 #define RTC_A_PSCLOCKSELECT_ACLK (RT1SSEL_0)
152 #define RTC_A_PSCLOCKSELECT_SMCLK (RT1SSEL_1)
153 #define RTC_A_PSCLOCKSELECT_RT0PS (RT1SSEL_2)
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)
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)
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)
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
228 extern void RTC_A_startClock(uint16_t baseAddress);
241 extern void RTC_A_holdClock(uint16_t baseAddress);
267 extern void RTC_A_setCalibrationFrequency(uint16_t baseAddress,
268 uint16_t frequencySelect);
295 extern void RTC_A_setCalibrationData(uint16_t baseAddress,
296 uint8_t offsetDirection,
297 uint8_t offsetValue);
325 extern void RTC_A_initCounter(uint16_t baseAddress,
326 uint16_t clockSelect,
327 uint16_t counterSizeSelect);
357 extern void RTC_A_initCalendar(uint16_t baseAddress,
358 Calendar *CalendarTime,
359 uint16_t formatSelect);
375 extern Calendar RTC_A_getCalendarTime(uint16_t baseAddress);
394 extern void RTC_A_configureCalendarAlarm(uint16_t baseAddress,
395 RTC_A_configureCalendarAlarmParam *
param);
417 extern void RTC_A_setCalendarEvent(uint16_t baseAddress,
418 uint16_t eventSelect);
433 extern uint32_t RTC_A_getCounterValue(uint16_t baseAddress);
448 extern void RTC_A_setCounterValue(uint16_t baseAddress,
449 uint32_t counterValue);
488 extern void RTC_A_initCounterPrescale(uint16_t baseAddress,
489 uint8_t prescaleSelect,
490 uint16_t prescaleClockSelect,
491 uint16_t prescaleDivider);
512 extern void RTC_A_holdCounterPrescale(uint16_t baseAddress,
513 uint8_t prescaleSelect);
531 extern void RTC_A_startCounterPrescale(uint16_t baseAddress,
532 uint8_t prescaleSelect);
563 extern void RTC_A_definePrescaleEvent(uint16_t baseAddress,
564 uint8_t prescaleSelect,
565 uint8_t prescaleEventDivider);
584 extern uint8_t RTC_A_getPrescaleValue(uint16_t baseAddress,
585 uint8_t prescaleSelect);
606 extern void RTC_A_setPrescaleValue(uint16_t baseAddress,
607 uint8_t prescaleSelect,
608 uint8_t prescaleCounterValue);
636 extern void RTC_A_enableInterrupt(uint16_t baseAddress,
637 uint8_t interruptMask);
665 extern void RTC_A_disableInterrupt(uint16_t baseAddress,
666 uint8_t interruptMask);
706 extern uint8_t RTC_A_getInterruptStatus(uint16_t baseAddress,
707 uint8_t interruptFlagMask);
735 extern void RTC_A_clearInterrupt(uint16_t baseAddress,
736 uint8_t interruptFlagMask);
MPU_initThreeSegmentsParam param