Functions | |
void | RTC_C_startClock (uint16_t baseAddress) |
Starts the RTC. More... | |
void | RTC_C_holdClock (uint16_t baseAddress) |
Holds the RTC. More... | |
void | RTC_C_setCalibrationFrequency (uint16_t baseAddress, uint16_t frequencySelect) |
Allows and Sets the frequency output to RTCCLK pin for calibration measurement. More... | |
void | RTC_C_setCalibrationData (uint16_t baseAddress, uint8_t offsetDirection, uint8_t offsetValue) |
Sets the specified calibration for the RTC. More... | |
void | RTC_C_initCounter (uint16_t baseAddress, uint16_t clockSelect, uint16_t counterSizeSelect) |
Initializes the settings to operate the RTC in Counter mode. More... | |
bool | RTC_C_setTemperatureCompensation (uint16_t baseAddress, uint16_t offsetDirection, uint8_t offsetValue) |
Sets the specified temperature compensation for the RTC. More... | |
void | RTC_C_initCalendar (uint16_t baseAddress, Calendar *CalendarTime, uint16_t formatSelect) |
Initializes the settings to operate the RTC in calendar mode. More... | |
Calendar | RTC_C_getCalendarTime (uint16_t baseAddress) |
Returns the Calendar Time stored in the Calendar registers of the RTC. More... | |
void | RTC_C_configureCalendarAlarm (uint16_t baseAddress, RTC_C_configureCalendarAlarmParam *param) |
Sets and Enables the desired Calendar Alarm settings. More... | |
void | RTC_C_setCalendarEvent (uint16_t baseAddress, uint16_t eventSelect) |
Sets a single specified Calendar interrupt condition. More... | |
uint32_t | RTC_C_getCounterValue (uint16_t baseAddress) |
Returns the value of the Counter register. More... | |
void | RTC_C_setCounterValue (uint16_t baseAddress, uint32_t counterValue) |
Sets the value of the Counter register. More... | |
void | RTC_C_initCounterPrescale (uint16_t baseAddress, uint8_t prescaleSelect, uint16_t prescaleClockSelect, uint16_t prescaleDivider) |
Initializes the Prescaler for Counter mode. More... | |
void | RTC_C_holdCounterPrescale (uint16_t baseAddress, uint8_t prescaleSelect) |
Holds the selected Prescaler. More... | |
void | RTC_C_startCounterPrescale (uint16_t baseAddress, uint8_t prescaleSelect) |
Starts the selected Prescaler. More... | |
void | RTC_C_definePrescaleEvent (uint16_t baseAddress, uint8_t prescaleSelect, uint8_t prescaleEventDivider) |
Sets up an interrupt condition for the selected Prescaler. More... | |
uint8_t | RTC_C_getPrescaleValue (uint16_t baseAddress, uint8_t prescaleSelect) |
Returns the selected prescaler value. More... | |
void | RTC_C_setPrescaleValue (uint16_t baseAddress, uint8_t prescaleSelect, uint8_t prescaleCounterValue) |
Sets the selected Prescaler value. More... | |
void | RTC_C_enableInterrupt (uint16_t baseAddress, uint8_t interruptMask) |
Enables selected RTC interrupt sources. More... | |
void | RTC_C_disableInterrupt (uint16_t baseAddress, uint8_t interruptMask) |
Disables selected RTC interrupt sources. More... | |
uint8_t | RTC_C_getInterruptStatus (uint16_t baseAddress, uint8_t interruptFlagMask) |
Returns the status of the selected interrupts flags. More... | |
void | RTC_C_clearInterrupt (uint16_t baseAddress, uint8_t interruptFlagMask) |
Clears selected RTC interrupt flags. More... | |
uint16_t | RTC_C_convertBCDToBinary (uint16_t baseAddress, uint16_t valueToConvert) |
Convert the given BCD value to binary format. More... | |
uint16_t | RTC_C_convertBinaryToBCD (uint16_t baseAddress, uint16_t valueToConvert) |
Convert the given binary value to BCD format. More... | |
void RTC_C_clearInterrupt | ( | uint16_t | baseAddress, |
uint8_t | interruptFlagMask | ||
) |
Clears selected RTC interrupt flags.
This function clears the RTC interrupt flag is cleared, so that it no longer asserts.
baseAddress | is the base address of the RTC_C module. |
interruptFlagMask | is a bit mask of the interrupt flags to be cleared. Mask value is the logical OR of any of the following:
|
void RTC_C_configureCalendarAlarm | ( | uint16_t | baseAddress, |
RTC_C_configureCalendarAlarmParam * | param | ||
) |
Sets and Enables the desired Calendar Alarm settings.
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_C_ALARM_OFF for any alarm settings that should not be apart of the alarm condition.
baseAddress | is the base address of the RTC_C module. |
param | is the pointer to struct for calendar alarm configuration. |
References RTC_C_configureCalendarAlarmParam::dayOfMonthAlarm, RTC_C_configureCalendarAlarmParam::dayOfWeekAlarm, RTC_C_configureCalendarAlarmParam::hoursAlarm, and RTC_C_configureCalendarAlarmParam::minutesAlarm.
uint16_t RTC_C_convertBCDToBinary | ( | uint16_t | baseAddress, |
uint16_t | valueToConvert | ||
) |
Convert the given BCD value to binary format.
This function converts BCD values to binary format. This API uses the hardware registers to perform the conversion rather than a software method.
baseAddress | is the base address of the RTC_C module. |
valueToConvert | is the raw value in BCD format to convert to Binary. Modified bits are BCD2BIN of BCD2BIN register. |
uint16_t RTC_C_convertBinaryToBCD | ( | uint16_t | baseAddress, |
uint16_t | valueToConvert | ||
) |
Convert the given binary value to BCD format.
This function converts binary values to BCD format. This API uses the hardware registers to perform the conversion rather than a software method.
baseAddress | is the base address of the RTC_C module. |
valueToConvert | is the raw value in Binary format to convert to BCD. Modified bits are BIN2BCD of BIN2BCD register. |
void RTC_C_definePrescaleEvent | ( | uint16_t | baseAddress, |
uint8_t | prescaleSelect, | ||
uint8_t | prescaleEventDivider | ||
) |
Sets up an interrupt condition for the selected Prescaler.
This function sets the condition for an interrupt to assert based on the individual prescalers.
baseAddress | is the base address of the RTC_C module. |
prescaleSelect | is the prescaler to define an interrupt for. Valid values are:
|
prescaleEventDivider | is 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:
|
void RTC_C_disableInterrupt | ( | uint16_t | baseAddress, |
uint8_t | interruptMask | ||
) |
Disables selected RTC interrupt sources.
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.
baseAddress | is the base address of the RTC_C module. |
interruptMask | is a bit mask of the interrupts to disable. Mask value is the logical OR of any of the following:
|
void RTC_C_enableInterrupt | ( | uint16_t | baseAddress, |
uint8_t | interruptMask | ||
) |
Enables selected RTC interrupt sources.
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. Does not clear interrupt flags.
baseAddress | is the base address of the RTC_C module. |
interruptMask | is a bit mask of the interrupts to enable. Mask value is the logical OR of any of the following:
|
Calendar RTC_C_getCalendarTime | ( | uint16_t | baseAddress | ) |
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. The RTCRDY polling is used in this function to prevent reading invalid time.
baseAddress | is the base address of the RTC_C module. |
References Calendar::DayOfMonth, Calendar::DayOfWeek, Calendar::Hours, Calendar::Minutes, Calendar::Month, Calendar::Seconds, and Calendar::Year.
uint32_t RTC_C_getCounterValue | ( | uint16_t | baseAddress | ) |
Returns the value of the Counter register.
This function returns the value of the counter register for the RTC_C module. It will return the 32-bit value no matter the size set during initialization. The RTC should be held before trying to use this function.
baseAddress | is the base address of the RTC_C module. |
uint8_t RTC_C_getInterruptStatus | ( | uint16_t | baseAddress, |
uint8_t | interruptFlagMask | ||
) |
Returns the status of the selected interrupts flags.
This function returns the status of the interrupt flag for the selected channel.
baseAddress | is the base address of the RTC_C module. |
interruptFlagMask | is a bit mask of the interrupt flags to return the status of. Mask value is the logical OR of any of the following:
|
uint8_t RTC_C_getPrescaleValue | ( | uint16_t | baseAddress, |
uint8_t | prescaleSelect | ||
) |
Returns the selected prescaler value.
This function returns the value of the selected prescale counter register. Note that the counter value should be held by calling RTC_C_holdClock() before calling this API.
baseAddress | is the base address of the RTC_C module. |
prescaleSelect | is the prescaler to obtain the value of. Valid values are:
|
void RTC_C_holdClock | ( | uint16_t | baseAddress | ) |
Holds the RTC.
This function sets the RTC main hold bit to disable RTC functionality.
baseAddress | is the base address of the RTC_C module. |
void RTC_C_holdCounterPrescale | ( | uint16_t | baseAddress, |
uint8_t | prescaleSelect | ||
) |
Holds the selected Prescaler.
This function holds the prescale counter from continuing. This will only work in counter mode, in Calendar mode, the RTC_C_holdClock() must be used. In counter mode, if using both prescalers in conjunction with the main RTC counter, then stopping RT0PS will stop RT1PS, but stopping RT1PS will not stop RT0PS.
baseAddress | is the base address of the RTC_C module. |
prescaleSelect | is the prescaler to hold. Valid values are:
|
void RTC_C_initCalendar | ( | uint16_t | baseAddress, |
Calendar * | CalendarTime, | ||
uint16_t | formatSelect | ||
) |
Initializes the settings to operate the RTC in calendar mode.
This function initializes the Calendar mode of the RTC module. To prevent potential erroneous alarm conditions from occurring, the alarm should be disabled by clearing the RTCAIE, RTCAIFG and AE bits with APIs: RTC_C_disableInterrupt(), RTC_C_clearInterrupt() and RTC_C_configureCalendarAlarm() before calendar initialization.
baseAddress | is the base address of the RTC_C module. |
CalendarTime | is the pointer to the structure containing the values for the Calendar to be initialized to. Valid values should be of type pointer to 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 Year between 0-4095 NOTE: Values beyond the ones specified may result in erratic behavior. |
formatSelect | is the format for the Calendar registers to use. Valid values are:
|
References Calendar::DayOfMonth, Calendar::DayOfWeek, Calendar::Hours, Calendar::Minutes, Calendar::Month, Calendar::Seconds, and Calendar::Year.
void RTC_C_initCounter | ( | uint16_t | baseAddress, |
uint16_t | clockSelect, | ||
uint16_t | counterSizeSelect | ||
) |
Initializes the settings to operate the RTC in Counter mode.
This function initializes the Counter mode of the RTC_C. Setting the clock source and counter size will allow an interrupt from the RTCTEVIFG once an overflow to the counter register occurs.
baseAddress | is the base address of the RTC_C module. |
clockSelect | is the selected clock for the counter mode to use. Valid values are:
|
counterSizeSelect | is the size of the counter. Valid values are:
|
void RTC_C_initCounterPrescale | ( | uint16_t | baseAddress, |
uint8_t | prescaleSelect, | ||
uint16_t | prescaleClockSelect, | ||
uint16_t | prescaleDivider | ||
) |
Initializes the Prescaler for Counter mode.
This function initializes the selected prescaler for the counter mode in the RTC_C module. If the RTC is initialized in Calendar mode, then these are automatically initialized. The Prescalers can be used to divide a clock source additionally before it gets to the main RTC clock.
baseAddress | is the base address of the RTC_C module. |
prescaleSelect | is the prescaler to initialize. Valid values are:
|
prescaleClockSelect | is the clock to drive the selected prescaler. Valid values are:
|
prescaleDivider | is the divider for the selected clock source. Valid values are:
|
void RTC_C_setCalendarEvent | ( | uint16_t | baseAddress, |
uint16_t | eventSelect | ||
) |
Sets a single specified Calendar interrupt condition.
This function sets a specified event to assert the RTCTEVIFG interrupt. This interrupt is independent from the Calendar alarm interrupt.
baseAddress | is the base address of the RTC_C module. |
eventSelect | is the condition selected. Valid values are:
|
void RTC_C_setCalibrationData | ( | uint16_t | baseAddress, |
uint8_t | offsetDirection, | ||
uint8_t | offsetValue | ||
) |
Sets the specified calibration for the RTC.
This function sets the calibration offset to make the RTC as accurate as possible. The offsetDirection can be either +4-ppm or -2-ppm, and the offsetValue should be from 1-63 and is multiplied by the direction setting (i.e. +4-ppm * 8 (offsetValue) = +32-ppm).
baseAddress | is the base address of the RTC_C module. |
offsetDirection | is the direction that the calibration offset will go. Valid values are:
|
offsetValue | is the value that the offset will be a factor of; a valid value is any integer from 1-240. Modified bits are RTC0CALx of RTC0CAL register. |
void RTC_C_setCalibrationFrequency | ( | uint16_t | baseAddress, |
uint16_t | frequencySelect | ||
) |
Allows and Sets the frequency output to RTCCLK pin for calibration measurement.
This function sets a frequency to measure at the RTCCLK output pin. After testing the set frequency, the calibration could be set accordingly.
baseAddress | is the base address of the RTC_C module. |
frequencySelect | is the frequency output to RTCCLK. Valid values are:
|
void RTC_C_setCounterValue | ( | uint16_t | baseAddress, |
uint32_t | counterValue | ||
) |
Sets the value of the Counter register.
This function sets the counter register of the RTC_C module.
baseAddress | is the base address of the RTC_C module. |
counterValue | is the value to set the Counter register to; a valid value may be any 32-bit integer. |
void RTC_C_setPrescaleValue | ( | uint16_t | baseAddress, |
uint8_t | prescaleSelect, | ||
uint8_t | prescaleCounterValue | ||
) |
Sets the selected Prescaler value.
This function sets the prescale counter value. Before setting the prescale counter, it should be held by calling RTC_C_holdClock().
baseAddress | is the base address of the RTC_C module. |
prescaleSelect | is the prescaler to set the value for. Valid values are:
|
prescaleCounterValue | is the specified value to set the prescaler to. Valid values are any integer between 0-255 Modified bits are RTxPS of RTxPS register. |
bool RTC_C_setTemperatureCompensation | ( | uint16_t | baseAddress, |
uint16_t | offsetDirection, | ||
uint8_t | offsetValue | ||
) |
Sets the specified temperature compensation for the RTC.
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).
baseAddress | is the base address of the RTC_C module. |
offsetDirection | is the direction that the calibration offset wil go Valid values are:
|
offsetValue | is the value that the offset will be a factor of; a valid value is any integer from 1-240. Modified bits are RTCTCMPx of RTCTCMP register. |
void RTC_C_startClock | ( | uint16_t | baseAddress | ) |
Starts the RTC.
This function clears the RTC main hold bit to allow the RTC to function.
baseAddress | is the base address of the RTC_C module. |
void RTC_C_startCounterPrescale | ( | uint16_t | baseAddress, |
uint8_t | prescaleSelect | ||
) |
Starts the selected Prescaler.
This function starts the selected prescale counter. This function will only work if the RTC is in counter mode.
baseAddress | is the base address of the RTC_C module. |
prescaleSelect | is the prescaler to start. Valid values are:
|