|
int | RTC_EnableTimeofdayInterrupt (mxc_rtc_regs_t *rtc) |
| Enables Time-of-Day's Alarm Interrupt. More...
|
|
int | RTC_DisableTimeofdayInterrupt (mxc_rtc_regs_t *rtc) |
| Disable Time-of-Day's Alarm Interrupt. More...
|
|
int | RTC_EnableSubsecondInterrupt (mxc_rtc_regs_t *rtc) |
| Enables Sub-Second's Alarm Interrupt. More...
|
|
int | RTC_DisableSubsecondInterrupt (mxc_rtc_regs_t *rtc) |
| Disable Sub-Second's Alarm Interrupt. More...
|
|
int | RTC_SetTimeofdayAlarm (mxc_rtc_regs_t *rtc, uint32_t ras) |
| Set Time-of-Day alarm value and enable Interrupt. More...
|
|
int | RTC_SetSubsecondAlarm (mxc_rtc_regs_t *rtc, uint32_t rssa) |
| Set Sub-Second alarm value and enable interrupt,. More...
|
|
int | RTC_EnableRTCE (mxc_rtc_regs_t *rtc) |
| Enable/Start the Real Time Clock. More...
|
|
int | RTC_DisableRTCE (mxc_rtc_regs_t *rtc) |
| Disable/Stop the Real Time Clock. More...
|
|
int | RTC_Init (mxc_rtc_regs_t *rtc, uint32_t sec, uint16_t ssec, sys_cfg_rtc_t *sys_cfg) |
| Initialize the sec and ssec registers and enable RTC. More...
|
|
int | RTC_SquareWave (mxc_rtc_regs_t *rtc, rtc_sqwave_en_t sqe, rtc_freq_sel_t ft, const sys_cfg_rtc_t *sys_cfg) |
| Allow generation of Square Wave on the SQW pin. More...
|
|
int | RTC_Trim (mxc_rtc_regs_t *rtc, int8_t trm) |
| Set Trim register value. More...
|
|
int | RTC_CheckBusy (void) |
| Check if BUSY bit is 0. More...
|
|
int | RTC_GetFlags (void) |
| Gets Interrupt flags. More...
|
|
int | RTC_ClearFlags (int flags) |
| Clear Interrupt flag. More...
|
|
int | RTC_GetSubSecond (void) |
| Get SubSecond. More...
|
|
int | RTC_GetSecond (void) |
| Get Second. More...
|
|
int | RTC_GetTime (uint32_t *sec, uint32_t *subsec) |
| Read seconds, then subseconds, and finally seconds. More...
|
|
int | RTC_LoadTrim (void) |
| 32kHz XTAL internal capacitor self-trim routine More...
|
|
int RTC_LoadTrim |
( |
void |
| ) |
|
The RTC is enabled and the sub-second alarm set to trigger every 200 ms. The 32MHz crystal is enabled and used as the system clock. This is the clock for Timer 3 in Continous Mode. On every sub-second alarm, the Timer 3 count value is used in a binary search for the optimal 32kHz internal capacitor trim value.
For 200ms (the wider, the more accurate decision), using the sub-second counter, the window of time is 819 sub-seconds (1 sub-second = 1 4096 cycle = 8 32kHz cycles) or 199.951172... divided by 32MHz/2 (PCLK) cycles or 62.5ns is 0x30d0f2 expected cycle count. This is the number used in the binary search to determine if it's too slow.
Must set system clock to 32 MHz and enable RTC prior to calling this function.
- Returns
- Closest 32K frequency if function is successful.
-
E_BUSY If RTC is busy.