sys/rtc.h
#include <sys/rtc.h>
This header includes defines for the Real-Time Clock (RTC) used in the CE. The toolchain allows both direct access to the hardware registers, and using TI’s helper routines.
API Documentation
CE Real-Time Clock define file.
- Authors
Matt “MateoConLechuga” Waltz
Jacob “jacobly” Young
Defines
-
rtc_Enable(int)
Enables the Real-Time-Clock (RTC).
- Parameters
int – Interrupt mask to enable specific RTC interrupts.
-
rtc_Set(sec, min, hr, day)
Sets the Real-Time-Clock (RTC) with new values.
Note
The set values do not take effect until the next RTC second. Verify the values have been loaded by waiting for rtc_IsBusy() to be false. The RTC will also need to be enabled.
- Parameters
sec – Second value to load.
min – Minute value to load.
hr – Hour value to load.
day – Day value to load.
-
rtc_SetAlarm(sec, min, hr)
Sets the Real-Time-Clock (RTC) alarm with new values.
- Parameters
sec – Second alarm value.
min – Minute alarm value.
hr – Hour alarm value.
-
rtc_Disable()
Disables the Real-Time-Clock (RTC).
-
rtc_IsBusy()
Checks if the RTC is busy setting newly loaded values.
-
rtc_AckInterrupt(mask)
Acknowledges an RTC interrupt.
This should be used to clear the condition that is causing the interrupt.
- Parameters
mask – RTC interrupt mask.
-
rtc_ChkInterrupt(mask)
Checks if a RTC interrupt condition has occurred.
- Parameters
mask – RTC interrupt mask.
-
rtc_Time()
Gets a combination of the RTC time; useful for seeding random numbers via srand().
-
rtc_Seconds
RTC seconds.
-
rtc_Minutes
RTC minutes.
-
rtc_Hours
RTC hours.
-
rtc_Days
RTC days.
-
rtc_AlarmSeconds
RTC alarm seconds.
-
rtc_AlarmMinutes
RTC alarm minutes.
-
rtc_AlarmHours
RTC alarm hours.
-
RTC_LOAD_INT
RTC load operation complete.
-
RTC_ALARM_INT
RTC alarm interrupt.
-
RTC_DAY_INT
RTC interrupt on day change.
-
RTC_HR_INT
RTC interrupt on hour change.
-
RTC_MIN_INT
RTC interrupt on minute change.
-
RTC_SEC_INT
RTC interrupt on second change.
-
RTC_INT_MASK
RTC mask for all interrupts.
Functions
-
void boot_SetDate(uint8_t day, uint8_t month, uint16_t year)
Sets the calculator’s date.
Performs checks to ensure date is within range
- Parameters
day – [in] Day to set
month – [in] Month to set
year – [in] Year to set
-
void boot_GetDate(uint8_t *day, uint8_t *month, uint16_t *year)
Gets the calculator’s date.
- Parameters
day – [out] Pointer to variable to store day
month – [out] Pointer to variable to store month
year – [out] Pointer to variable to store year
-
void boot_SetTime(uint8_t seconds, uint8_t minutes, uint8_t hours)
Sets the calculator’s time.
Performs checks to ensure time is within range.
Warning
This function doesn’t wait until the previous full RTC load operation is completed before attempting to start a new one. This may lead to issues, for example if you call boot_SetDate() before this function. To mitigate this, use boot_SetDate() (which doesn’t have this bug), after boot_SetTime() or validate rtc_IsBusy() is false before calling boot_SetTime().
- Parameters
seconds – [in] Seconds to set
minutes – [in] Minutes to set
hours – [in] Hours to set
-
void boot_GetTime(uint8_t *seconds, uint8_t *minutes, uint8_t *hours)
Gets the calculator’s time.
Note
You can read
rtc_Seconds
,rtc_Minutes
, andrtc_Hours
directly, but you should double check thatrtc_Seconds
didn’t change while readingrtc_Minutes
andrtc_Hours
.- Parameters
seconds – [out] Pointer to variable to store seconds
minutes – [out] Pointer to variable to store minutes
hours – [out] Pointer to variable to store hours
-
bool boot_IsAfterNoon(void)
Checks if past noon.
- Returns
True if past noon