Data Structures | Macros | Typedefs | Functions
RTC_C

Real Time Clock with alarm support and tamper protection. More...

Data Structures

struct  _RTC_C_Calendar
 

Macros

#define RTC_C_CALIBRATIONFREQ_OFF   (RTC_C_CTL13_CALF_0)
 
#define RTC_C_CALIBRATIONFREQ_512HZ   (RTC_C_CTL13_CALF_1)
 
#define RTC_C_CALIBRATIONFREQ_256HZ   (RTC_C_CTL13_CALF_2)
 
#define RTC_C_CALIBRATIONFREQ_1HZ   (RTC_C_CTL13_CALF_3)
 
#define RTC_C_CALIBRATION_DOWN1PPM   ( !(RTC_C_OCAL_OCALS) )
 
#define RTC_C_CALIBRATION_UP1PPM   (RTC_C_OCAL_OCALS)
 
#define RTC_C_COMPENSATION_DOWN1PPM   ( !(RTC_C_TCMP_TCMPS) )
 
#define RTC_C_COMPENSATION_UP1PPM   (RTC_C_TCMP_TCMPS)
 
#define RTC_C_FORMAT_BINARY   ( !(RTC_C_CTL13_BCD) )
 
#define RTC_C_FORMAT_BCD   (RTC_C_CTL13_BCD)
 
#define RTC_C_ALARMCONDITION_OFF   (0x80)
 
#define RTC_C_CALENDAREVENT_MINUTECHANGE   (RTC_C_CTL13_TEV_0)
 
#define RTC_C_CALENDAREVENT_HOURCHANGE   (RTC_C_CTL13_TEV_1)
 
#define RTC_C_CALENDAREVENT_NOON   (RTC_C_CTL13_TEV_2)
 
#define RTC_C_CALENDAREVENT_MIDNIGHT   (RTC_C_CTL13_TEV_3)
 
#define RTC_C_PRESCALE_0   (0x0)
 
#define RTC_C_PRESCALE_1   (0x1)
 
#define RTC_C_PSEVENTDIVIDER_2   (RTC_C_PS0CTL_RT0IP_0)
 
#define RTC_C_PSEVENTDIVIDER_4   (RTC_C_PS0CTL_RT0IP_1)
 
#define RTC_C_PSEVENTDIVIDER_8   (RTC_C_PS0CTL_RT0IP_2)
 
#define RTC_C_PSEVENTDIVIDER_16   (RTC_C_PS0CTL_RT0IP_3)
 
#define RTC_C_PSEVENTDIVIDER_32   (RTC_C_PS0CTL_RT0IP_4)
 
#define RTC_C_PSEVENTDIVIDER_64   (RTC_C_PS0CTL_RT0IP_5)
 
#define RTC_C_PSEVENTDIVIDER_128   (RTC_C_PS0CTL_RT0IP_6)
 
#define RTC_C_PSEVENTDIVIDER_256   (RTC_C_PS0CTL_RT0IP_7)
 
#define RTC_C_OSCILLATOR_FAULT_INTERRUPT   RTC_C_CTL0_OFIE
 
#define RTC_C_TIME_EVENT_INTERRUPT   RTC_C_CTL0_TEVIE
 
#define RTC_C_CLOCK_ALARM_INTERRUPT   RTC_C_CTL0_AIE
 
#define RTC_C_CLOCK_READ_READY_INTERRUPT   RTC_C_CTL0_RDYIE
 
#define RTC_C_PRESCALE_TIMER0_INTERRUPT   0x02
 
#define RTC_C_PRESCALE_TIMER1_INTERRUPT   0x01
 
#define RTC_C_startClockMultipleInstance(a)   RTC_C_startClock()
 
#define RTC_C_holdClockMultipleInstance(a)   RTC_C_holdClock()
 
#define RTC_C_setCalibrationFrequencyMultipleInstance(a, b)   RTC_C_setCalibrationFrequency(b)
 
#define RTC_C_setCalibrationDataMultipleInstance(a, b, c)   RTC_C_setCalibrationData(b,c)
 
#define RTC_C_setTemperatureCompensationMultipleInstance(a, b, c)   RTC_C_setTemperatureCompensation(b,c)
 
#define RTC_C_initCalendarMultipleInstance(a, b, c)   RTC_C_initCalendar(b,c)
 
#define RTC_C_getCalendarTimeMultipleInstance(a)   RTC_C_getCalendarTime()
 
#define RTC_C_setCalendarAlarmMultipleInstance(a, b, c, d, e)   RTC_C_setCalendarAlarm(b,c,d,e)
 
#define RTC_C_setCalendarEventMultipleInstance(a, b)   RTC_C_setCalendarEvent(b)
 
#define RTC_C_definePrescaleEventMultipleInstance(a, b, c)   RTC_C_definePrescaleEvent(b,c)
 
#define RTC_C_getPrescaleValueMultipleInstance(a, b)   RTC_C_getPrescaleValue(b)
 
#define RTC_C_setPrescaleValueMultipleInstance(a, b, c)   RTC_C_setPrescaleValue(b,c)
 
#define RTC_C_convertBCDToBinaryMultipleInstance(a, b)   RTC_C_convertBCDToBinary(b)
 
#define RTC_C_convertBinaryToBCDMultipleInstance(a, b)   RTC_C_convertBinaryToBCD(b)
 
#define RTC_C_enableInterruptMultipleInstance(a, b)   RTC_C_enableInterrupt(b)
 
#define RTC_C_disableInterruptMultipleInstance(a, b)   RTC_C_disableInterrupt(b)
 
#define RTC_C_getInterruptStatusMultipleInstance(a)   RTC_C_getInterruptStatus()
 
#define RTC_C_getEnabledInterruptStatusMultipleInstance(a)   RTC_C_getEnabledInterruptStatus()
 
#define RTC_C_clearInterruptFlagMultipleInstance(a, b)   RTC_C_clearInterruptFlag(b)
 
#define RTC_C_registerInterruptMultipleInstance(a, b)   RTC_C_registerInterrupt(b)
 
#define RTC_C_unregisterInterruptMultipleInstance(a)   RTC_C_unregisterInterrupt()
 

Typedefs

typedef struct _RTC_C_Calendar RTC_C_Calendar
 

Functions

void RTC_C_startClock (void)
 
void RTC_C_holdClock (void)
 
void RTC_C_setCalibrationFrequency (uint_fast16_t frequencySelect)
 
void RTC_C_setCalibrationData (uint_fast8_t offsetDirection, uint_fast8_t offsetValue)
 
bool RTC_C_setTemperatureCompensation (uint_fast16_t offsetDirection, uint_fast8_t offsetValue)
 
void RTC_C_initCalendar (const RTC_C_Calendar *calendarTime, uint_fast16_t formatSelect)
 
RTC_C_Calendar RTC_C_getCalendarTime (void)
 
void RTC_C_setCalendarAlarm (uint_fast8_t minutesAlarm, uint_fast8_t hoursAlarm, uint_fast8_t dayOfWeekAlarm, uint_fast8_t dayOfmonthAlarm)
 
void RTC_C_setCalendarEvent (uint_fast16_t eventSelect)
 
void RTC_C_definePrescaleEvent (uint_fast8_t prescaleSelect, uint_fast8_t prescaleEventDivider)
 
uint_fast8_t RTC_C_getPrescaleValue (uint_fast8_t prescaleSelect)
 
void RTC_C_setPrescaleValue (uint_fast8_t prescaleSelect, uint_fast8_t prescaleCounterValue)
 
uint16_t RTC_C_convertBCDToBinary (uint16_t valueToConvert)
 
uint16_t RTC_C_convertBinaryToBCD (uint16_t valueToConvert)
 
void RTC_C_enableInterrupt (uint8_t interruptMask)
 
void RTC_C_disableInterrupt (uint8_t interruptMask)
 
uint_fast8_t RTC_C_getInterruptStatus (void)
 
uint_fast8_t RTC_C_getEnabledInterruptStatus (void)
 
void RTC_C_clearInterruptFlag (uint_fast8_t interruptFlagMask)
 
void RTC_C_registerInterrupt (void(*intHandler)(void))
 
void RTC_C_unregisterInterrupt (void)
 

Detailed Description

Real Time Clock with alarm support and tamper protection.


Module Operation


The Real Time Clock (RTC_C) API provides a set of functions for using the SDK L RTC_C modules. Functions are provided to calibrate the clock, initialize the RTC_C modules in Calendar mode, and setup conditions for, and enable, interrupts for the RTC_C modules.

The RTC_C module provides the ability to keep track of the current time and date in calendar mode.

The RTC_C module generates multiple interrupts. There are 2 interrupts that can be defined in calendar mode, and 1 interrupt in counter mode for counter overflow, as well as an interrupt for each prescaler.


Programming Example


The DriverLib package contains a variety of different code examples that demonstrate the usage of the RTC_C module. These code examples are accessible under the examples/ folder of the SDK release as well as through TI Resource Explorer if using Code Composer Studio. These code examples provide a comprehensive list of use cases as well as practical applications involving each module.

Below is a very brief code example showing how to configure the RTC_C module and create a calendar event.

The following is the configuration structure that sets the date:

Next are the actual calls to DriverLib that configure the module:

Macro Definition Documentation

#define RTC_C_CALIBRATIONFREQ_OFF   (RTC_C_CTL13_CALF_0)
#define RTC_C_CALIBRATIONFREQ_512HZ   (RTC_C_CTL13_CALF_1)
#define RTC_C_CALIBRATIONFREQ_256HZ   (RTC_C_CTL13_CALF_2)
#define RTC_C_CALIBRATIONFREQ_1HZ   (RTC_C_CTL13_CALF_3)
#define RTC_C_CALIBRATION_DOWN1PPM   ( !(RTC_C_OCAL_OCALS) )
#define RTC_C_CALIBRATION_UP1PPM   (RTC_C_OCAL_OCALS)
#define RTC_C_COMPENSATION_DOWN1PPM   ( !(RTC_C_TCMP_TCMPS) )
#define RTC_C_COMPENSATION_UP1PPM   (RTC_C_TCMP_TCMPS)
#define RTC_C_FORMAT_BINARY   ( !(RTC_C_CTL13_BCD) )
#define RTC_C_FORMAT_BCD   (RTC_C_CTL13_BCD)
#define RTC_C_ALARMCONDITION_OFF   (0x80)
#define RTC_C_CALENDAREVENT_MINUTECHANGE   (RTC_C_CTL13_TEV_0)
#define RTC_C_CALENDAREVENT_HOURCHANGE   (RTC_C_CTL13_TEV_1)
#define RTC_C_CALENDAREVENT_NOON   (RTC_C_CTL13_TEV_2)
#define RTC_C_CALENDAREVENT_MIDNIGHT   (RTC_C_CTL13_TEV_3)
#define RTC_C_PRESCALE_0   (0x0)
#define RTC_C_PRESCALE_1   (0x1)
#define RTC_C_PSEVENTDIVIDER_2   (RTC_C_PS0CTL_RT0IP_0)
#define RTC_C_PSEVENTDIVIDER_4   (RTC_C_PS0CTL_RT0IP_1)
#define RTC_C_PSEVENTDIVIDER_8   (RTC_C_PS0CTL_RT0IP_2)
#define RTC_C_PSEVENTDIVIDER_16   (RTC_C_PS0CTL_RT0IP_3)
#define RTC_C_PSEVENTDIVIDER_32   (RTC_C_PS0CTL_RT0IP_4)
#define RTC_C_PSEVENTDIVIDER_64   (RTC_C_PS0CTL_RT0IP_5)
#define RTC_C_PSEVENTDIVIDER_128   (RTC_C_PS0CTL_RT0IP_6)
#define RTC_C_PSEVENTDIVIDER_256   (RTC_C_PS0CTL_RT0IP_7)
#define RTC_C_OSCILLATOR_FAULT_INTERRUPT   RTC_C_CTL0_OFIE
#define RTC_C_TIME_EVENT_INTERRUPT   RTC_C_CTL0_TEVIE
#define RTC_C_CLOCK_ALARM_INTERRUPT   RTC_C_CTL0_AIE
#define RTC_C_CLOCK_READ_READY_INTERRUPT   RTC_C_CTL0_RDYIE
#define RTC_C_PRESCALE_TIMER0_INTERRUPT   0x02
#define RTC_C_PRESCALE_TIMER1_INTERRUPT   0x01
#define RTC_C_startClockMultipleInstance (   a)    RTC_C_startClock()
#define RTC_C_holdClockMultipleInstance (   a)    RTC_C_holdClock()
#define RTC_C_setCalibrationFrequencyMultipleInstance (   a,
 
)    RTC_C_setCalibrationFrequency(b)
#define RTC_C_setCalibrationDataMultipleInstance (   a,
  b,
 
)    RTC_C_setCalibrationData(b,c)
#define RTC_C_setTemperatureCompensationMultipleInstance (   a,
  b,
 
)    RTC_C_setTemperatureCompensation(b,c)
#define RTC_C_initCalendarMultipleInstance (   a,
  b,
 
)    RTC_C_initCalendar(b,c)
#define RTC_C_getCalendarTimeMultipleInstance (   a)    RTC_C_getCalendarTime()
#define RTC_C_setCalendarAlarmMultipleInstance (   a,
  b,
  c,
  d,
 
)    RTC_C_setCalendarAlarm(b,c,d,e)
#define RTC_C_setCalendarEventMultipleInstance (   a,
 
)    RTC_C_setCalendarEvent(b)
#define RTC_C_definePrescaleEventMultipleInstance (   a,
  b,
 
)    RTC_C_definePrescaleEvent(b,c)
#define RTC_C_getPrescaleValueMultipleInstance (   a,
 
)    RTC_C_getPrescaleValue(b)
#define RTC_C_setPrescaleValueMultipleInstance (   a,
  b,
 
)    RTC_C_setPrescaleValue(b,c)
#define RTC_C_convertBCDToBinaryMultipleInstance (   a,
 
)    RTC_C_convertBCDToBinary(b)
#define RTC_C_convertBinaryToBCDMultipleInstance (   a,
 
)    RTC_C_convertBinaryToBCD(b)
#define RTC_C_enableInterruptMultipleInstance (   a,
 
)    RTC_C_enableInterrupt(b)
#define RTC_C_disableInterruptMultipleInstance (   a,
 
)    RTC_C_disableInterrupt(b)
#define RTC_C_getInterruptStatusMultipleInstance (   a)    RTC_C_getInterruptStatus()
#define RTC_C_getEnabledInterruptStatusMultipleInstance (   a)    RTC_C_getEnabledInterruptStatus()
#define RTC_C_clearInterruptFlagMultipleInstance (   a,
 
)    RTC_C_clearInterruptFlag(b)
#define RTC_C_registerInterruptMultipleInstance (   a,
 
)    RTC_C_registerInterrupt(b)
#define RTC_C_unregisterInterruptMultipleInstance (   a)    RTC_C_unregisterInterrupt()

Typedef Documentation

Function Documentation

void RTC_C_startClock ( void  )

Starts the RTC.

This function clears the RTC main hold bit to allow the RTC to function.

Returns
None
void RTC_C_holdClock ( void  )

Holds the RTC.

This function sets the RTC main hold bit to disable RTC functionality.

Returns
None

Referenced by PCM_gotoLPM4().

void RTC_C_setCalibrationFrequency ( uint_fast16_t  frequencySelect)

Allows and Sets the frequency output to RTCLK pin for calibration measurement.

Parameters
frequencySelectis the frequency output to RTCLK. Valid values are
  • RTC_C_CALIBRATIONFREQ_OFF - turn off calibration output [Default]
  • RTC_C_CALIBRATIONFREQ_512HZ - output signal at 512Hz for calibration
  • RTC_C_CALIBRATIONFREQ_256HZ - output signal at 256Hz for calibration
  • RTC_C_CALIBRATIONFREQ_1HZ - output signal at 1Hz for calibration

This function sets a frequency to measure at the RTCLK output pin. After testing the set frequency, the calibration could be set accordingly.

Returns
None
void RTC_C_setCalibrationData ( uint_fast8_t  offsetDirection,
uint_fast8_t  offsetValue 
)

Sets the specified calibration for the RTC.

Parameters
offsetDirectionis the direction that the calibration offset will go. Valid values are
  • RTC_C_CALIBRATION_DOWN1PPM - calibrate at steps of -1
  • RTC_C_CALIBRATION_UP1PPM - calibrat at steps of +1
offsetValueis the value that the offset will be a factor of; a valid value is any integer from 1-240.

This function sets the calibration offset to make the RTC as accurate as possible. The offsetDirection can be either +1-ppm or -1-ppm, and the offsetValue should be from 1-240 and is multiplied by the direction setting (i.e. +1-ppm * 8 (offsetValue) = +8-ppm).

Returns
None
bool RTC_C_setTemperatureCompensation ( uint_fast16_t  offsetDirection,
uint_fast8_t  offsetValue 
)

Sets the specified temperature compensation for the RTC.

Parameters
offsetDirectionis the direction that the calibration offset will go. Valid values are
  • RTC_C_COMPENSATION_DOWN1PPM - calibrate at steps of -1
  • RTC_C_COMPENSATION_UP1PPM - calibrate at steps of +1
offsetValueis the value that the offset will be a factor of; a value is any integer from 1-240.

This function sets the calibration offset to make the RTC as accurate as possible. The offsetDirection can be either +1-ppm or -1-ppm, and the offsetValue should be from 1-240 and is multiplied by the direction setting (i.e. +1-ppm * 8 (offsetValue) = +8-ppm).

Returns
true if calibration was set, false if it could not be set
void RTC_C_initCalendar ( const RTC_C_Calendar calendarTime,
uint_fast16_t  formatSelect 
)

Initializes the settings to operate the RTC in Calendar mode.

Parameters
calendarTimeis the structure containing the values for the Calendar to be initialized to. Valid values should be of type Calendar and should contain the following members and corresponding values:
  • seconds between 0-59
  • minutes between 0-59
  • hours between 0-23
  • dayOfWeek between 0-6
  • dayOfmonth between 1-31
  • month between 1-12
  • year between 0-4095
Note
Values beyond the ones specified may result in erratic behavior.
Parameters
formatSelectis the format for the Calendar registers to use. Valid values are
  • RTC_C_FORMAT_BINARY [Default]
  • RTC_C_FORMAT_BCD

This function initializes the Calendar mode of the RTC module.

Returns
None

References _RTC_C_Calendar::dayOfmonth, _RTC_C_Calendar::dayOfWeek, _RTC_C_Calendar::hours, _RTC_C_Calendar::minutes, _RTC_C_Calendar::month, _RTC_C_Calendar::seconds, and _RTC_C_Calendar::year.

RTC_C_Calendar RTC_C_getCalendarTime ( void  )

Returns the Calendar Time stored in the Calendar registers of the RTC.

This function returns the current Calendar time in the form of a Calendar structure.

Returns
A Calendar structure containing the current time.

References _RTC_C_Calendar::dayOfmonth, _RTC_C_Calendar::dayOfWeek, _RTC_C_Calendar::hours, _RTC_C_Calendar::minutes, _RTC_C_Calendar::month, _RTC_C_Calendar::seconds, and _RTC_C_Calendar::year.

void RTC_C_setCalendarAlarm ( uint_fast8_t  minutesAlarm,
uint_fast8_t  hoursAlarm,
uint_fast8_t  dayOfWeekAlarm,
uint_fast8_t  dayOfmonthAlarm 
)

Sets and Enables the desired Calendar Alarm settings.

Parameters
minutesAlarmis the alarm condition for the minutes. Valid values are
  • An integer between 0-59, OR
  • RTC_C_ALARMCONDITION_OFF [Default]
hoursAlarmis the alarm condition for the hours. Valid values are
  • An integer between 0-24, OR
  • RTC_C_ALARMCONDITION_OFF [Default]
dayOfWeekAlarmis the alarm condition for the day of week. Valid values are
  • An integer between 0-6, OR
  • RTC_C_ALARMCONDITION_OFF [Default]
dayOfmonthAlarmis the alarm condition for the day of the month. Valid values are
  • An integer between 0-31, OR
  • RTC_C_ALARMCONDITION_OFF [Default]

This function sets a Calendar interrupt condition to assert the RTCAIFG interrupt flag. The condition is a logical and of all of the parameters. For example if the minutes and hours alarm is set, then the interrupt will only assert when the minutes AND the hours change to the specified setting. Use the RTC_ALARM_OFF for any alarm settings that should not be apart of the alarm condition.

Returns
None
void RTC_C_setCalendarEvent ( uint_fast16_t  eventSelect)

Sets a single specified Calendar interrupt condition.

Parameters
eventSelectis the condition selected. Valid values are
  • RTC_C_CALENDAREVENT_MINUTECHANGE - assert interrupt on every minute
  • RTC_C_CALENDAREVENT_HOURCHANGE - assert interrupt on every hour
  • RTC_C_CALENDAREVENT_NOON - assert interrupt when hour is 12
  • RTC_C_CALENDAREVENT_MIDNIGHT - assert interrupt when hour is 0

This function sets a specified event to assert the RTCTEVIFG interrupt. This interrupt is independent from the Calendar alarm interrupt.

Returns
None
void RTC_C_definePrescaleEvent ( uint_fast8_t  prescaleSelect,
uint_fast8_t  prescaleEventDivider 
)

Sets up an interrupt condition for the selected Prescaler.

Parameters
prescaleSelectis the prescaler to define an interrupt for. Valid values are
  • RTC_C_PRESCALE_0
  • RTC_C_PRESCALE_1
prescaleEventDivideris a divider to specify when an interrupt can occur based on the clock source of the selected prescaler. (Does not affect timer of the selected prescaler). Valid values are
  • RTC_C_PSEVENTDIVIDER_2 [Default]
  • RTC_C_PSEVENTDIVIDER_4
  • RTC_C_PSEVENTDIVIDER_8
  • RTC_C_PSEVENTDIVIDER_16
  • RTC_C_PSEVENTDIVIDER_32
  • RTC_C_PSEVENTDIVIDER_64
  • RTC_C_PSEVENTDIVIDER_128
  • RTC_C_PSEVENTDIVIDER_256

This function sets the condition for an interrupt to assert based on the individual prescalers.

Returns
None

References HWREG8, RTC_C_PRESCALE_0, and RTC_C_PRESCALE_1.

uint_fast8_t RTC_C_getPrescaleValue ( uint_fast8_t  prescaleSelect)

Returns the selected Prescaler value.

Parameters
prescaleSelectis the prescaler to obtain the value of. Valid values are
  • RTC_C_PRESCALE_0
  • RTC_C_PRESCALE_1

This function returns the value of the selected prescale counter register. The counter should be held before reading. If in counter mode, the individual prescaler can be held, while in Calendar mode the whole RTC must be held.

Returns
The value of the specified Prescaler count register

References RTC_C_PRESCALE_0, and RTC_C_PRESCALE_1.

void RTC_C_setPrescaleValue ( uint_fast8_t  prescaleSelect,
uint_fast8_t  prescaleCounterValue 
)

Sets the selected Prescaler value.

Parameters
prescaleSelectis the prescaler to set the value for. Valid values are
  • RTC_C_PRESCALE_0
  • RTC_C_PRESCALE_1
prescaleCounterValueis the specified value to set the prescaler to; a valid value is any integer from 0-255.

This function sets the prescale counter value. Before setting the prescale counter, it should be held.

Returns
None

References RTC_C_PRESCALE_0, and RTC_C_PRESCALE_1.

uint16_t RTC_C_convertBCDToBinary ( uint16_t  valueToConvert)

Returns the given BCD value in Binary Format

Parameters
valueToConvertis the raw value in BCD format to convert to Binary.

This function converts BCD values to Binary format.

Returns
The Binary version of the valueToConvert parameter.
uint16_t RTC_C_convertBinaryToBCD ( uint16_t  valueToConvert)

Returns the given Binary value in BCD Format

Parameters
valueToConvertis the raw value in Binary format to convert to BCD.

This function converts Binary values to BCD format.

Returns
The BCD version of the valueToConvert parameter.
void RTC_C_enableInterrupt ( uint8_t  interruptMask)

Enables selected RTC interrupt sources.

Parameters
interruptMaskis a bit mask of the interrupts to enable. Mask Value is the logical OR of any of the following
  • RTC_C_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by setCalendarEvent() is met.
  • RTC_C_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_C_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_C_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_C_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
  • RTC_C_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a problem with the 32kHz oscillator, while the RTC is running.

This function enables the selected RTC interrupt source. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Returns
None

References RTC_C_PRESCALE_TIMER0_INTERRUPT, and RTC_C_PRESCALE_TIMER1_INTERRUPT.

void RTC_C_disableInterrupt ( uint8_t  interruptMask)

Disables selected RTC interrupt sources.

Parameters
interruptMaskis a bit mask of the interrupts to disable. Mask Value is the logical OR of any of the following
  • RTC_C_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by setCalendarEvent() is met.
  • RTC_C_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_C_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_C_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
  • RTC_C_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a problem with the 32kHz oscillator, while the RTC is running.

This function disables the selected RTC interrupt source. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Returns
None

References RTC_C_PRESCALE_TIMER0_INTERRUPT, and RTC_C_PRESCALE_TIMER1_INTERRUPT.

uint_fast8_t RTC_C_getInterruptStatus ( void  )

Returns the status of the interrupts flags.

Returns
A bit mask of the selected interrupt flag's status. Mask Value is the logical OR of any of the following
  • RTC_C_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by setCalendarEvent() is met.
  • RTC_C_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_C_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_C_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_C_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
  • RTC_C_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a problem with the 32kHz oscillator, while the RTC is running.

References RTC_C_CLOCK_ALARM_INTERRUPT, RTC_C_CLOCK_READ_READY_INTERRUPT, RTC_C_OSCILLATOR_FAULT_INTERRUPT, RTC_C_PRESCALE_TIMER0_INTERRUPT, RTC_C_PRESCALE_TIMER1_INTERRUPT, and RTC_C_TIME_EVENT_INTERRUPT.

Referenced by RTC_C_getEnabledInterruptStatus().

uint_fast8_t RTC_C_getEnabledInterruptStatus ( void  )

Returns the status of the interrupts flags masked with the enabled interrupts. This function is useful to call in ISRs to get a list of pending interrupts that are actually enabled and could have caused the ISR.

Returns
A bit mask of the selected interrupt flag's status. Mask Value is the logical OR of any of the following
  • RTC_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by setCalendarEvent() is met.
  • RTC_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_C_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_C_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
  • RTC_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a problem with the 32kHz oscillator, while the RTC is running.

References RTC_C_CLOCK_ALARM_INTERRUPT, RTC_C_CLOCK_READ_READY_INTERRUPT, RTC_C_getInterruptStatus(), RTC_C_OSCILLATOR_FAULT_INTERRUPT, RTC_C_PRESCALE_TIMER0_INTERRUPT, RTC_C_PRESCALE_TIMER1_INTERRUPT, and RTC_C_TIME_EVENT_INTERRUPT.

void RTC_C_clearInterruptFlag ( uint_fast8_t  interruptFlagMask)

Clears selected RTC interrupt flags.

Parameters
interruptFlagMaskis a bit mask of the interrupt flags to be cleared. Mask Value is the logical OR of any of the following
  • RTC_C_TIME_EVENT_INTERRUPT - asserts when counter overflows in counter mode or when Calendar event condition defined by setCalendarEvent() is met.
  • RTC_C_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in Calendar mode is met.
  • RTC_C_CLOCK_READ_READY_INTERRUPT - asserts when Calendar registers are settled.
  • RTC_C_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0 event condition is met.
  • RTC_C_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1 event condition is met.
  • RTC_C_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a problem with the 32kHz oscillator, while the RTC is running.

This function clears the RTC interrupt flag is cleared, so that it no longer asserts.

Returns
None

References RTC_C_CLOCK_ALARM_INTERRUPT, RTC_C_CLOCK_READ_READY_INTERRUPT, RTC_C_OSCILLATOR_FAULT_INTERRUPT, RTC_C_PRESCALE_TIMER0_INTERRUPT, RTC_C_PRESCALE_TIMER1_INTERRUPT, and RTC_C_TIME_EVENT_INTERRUPT.

void RTC_C_registerInterrupt ( void(*)(void)  intHandler)

Registers an interrupt handler for the RTC interrupt.

Parameters
intHandleris a pointer to the function to be called when the RTC interrupt occurs.

This function registers the handler to be called when a RTC interrupt occurs. This function enables the global interrupt in the interrupt controller; specific AES interrupts must be enabled via RTC_enableInterrupt(). It is the interrupt handler's responsibility to clear the interrupt source via RTC_clearInterruptFlag().

Returns
None.

References INT_RTC_C, Interrupt_enableInterrupt(), and Interrupt_registerInterrupt().

void RTC_C_unregisterInterrupt ( void  )

Unregisters the interrupt handler for the RTC interrupt

This function unregisters the handler to be called when RTC interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

See Also
Interrupt_registerInterrupt() for important information about registering interrupt handlers.
Returns
None.

References INT_RTC_C, Interrupt_disableInterrupt(), and Interrupt_unregisterInterrupt().


Copyright 2018, Texas Instruments Incorporated