RTCC - Real Timer Counter/Calendar#
Real Time Counter and Calendar (RTCC) Peripheral API.
This module contains functions to control the RTCC peripheral of Silicon Labs 32-bit MCUs and SoCs. The RTCC ensures timekeeping in low energy modes. The RTCC also includes a BCD calendar mode for easy time and date keeping.
Modules#
Enumerations#
Counter prescaler selection.
Prescaler mode of the RTCC counter.
Capture/Compare channel mode.
Compare match output action mode.
Input edge select.
Capture/Compare channel compare mode.
Typedefs#
PRS channel number.
Functions#
Get the RTCC compare register value for a selected channel.
Set the RTCC compare register value for a selected channel.
Get the RTCC input capture register value for a selected channel.
Get the RTCC capture/compare register value for a selected channel.
Set RTCC capture/compare register value for a selected channel.
Get the combined CNT/PRECNT register content.
Get the RTCC counter value.
Set the RTCC CNT counter.
Enable/disable RTCC counting.
Initialize RTCC.
Configure the selected capture/compare channel of the RTCC.
Clear one or more pending RTCC interrupts.
Disable one or more RTCC interrupts.
Enable one or more RTCC interrupts.
Get pending RTCC interrupt flags.
Get enabled and pending RTCC interrupt flags.
Set one or more pending RTCC interrupts from SW.
Lock RTCC registers.
Get the RTCC pre-counter value.
Set the RTCC pre-counter value.
Restore RTCC to its reset state.
Clear the STATUS register.
Get the STATUS register value.
Wait for the RTCC to complete all synchronization of register changes and commands.
Start the RTCC counter.
Stop the RTCC counter.
Unlock RTCC registers.
Macros#
Default RTCC initialization structure.
Default RTCC channel output compare initialization structure.
Default RTCC channel input capture initialization structure.
Number of RTCC capture/compare channels.
Enumeration Documentation#
RTCC_CntPresc_TypeDef#
RTCC_CntPresc_TypeDef
Counter prescaler selection.
Enumerator | |
---|---|
rtccCntPresc_1 | Divide clock by 1. |
rtccCntPresc_2 | Divide clock by 2. |
rtccCntPresc_4 | Divide clock by 4. |
rtccCntPresc_8 | Divide clock by 8. |
rtccCntPresc_16 | Divide clock by 16. |
rtccCntPresc_32 | Divide clock by 32. |
rtccCntPresc_64 | Divide clock by 64. |
rtccCntPresc_128 | Divide clock by 128. |
rtccCntPresc_256 | Divide clock by 256. |
rtccCntPresc_512 | Divide clock by 512. |
rtccCntPresc_1024 | Divide clock by 1024. |
rtccCntPresc_2048 | Divide clock by 2048. |
rtccCntPresc_4096 | Divide clock by 4096. |
rtccCntPresc_8192 | Divide clock by 8192. |
rtccCntPresc_16384 | Divide clock by 16384. |
rtccCntPresc_32768 | Divide clock by 32768. |
102
of file platform/emlib/inc/em_rtcc.h
RTCC_PrescMode_TypeDef#
RTCC_PrescMode_TypeDef
Prescaler mode of the RTCC counter.
Enumerator | |
---|---|
rtccCntTickPresc | CNT register ticks according to the prescaler value. |
rtccCntTickCCV0Match | CNT register ticks when PRECNT matches the 15 least significant bits of ch. |
134
of file platform/emlib/inc/em_rtcc.h
RTCC_CapComChMode_TypeDef#
RTCC_CapComChMode_TypeDef
Capture/Compare channel mode.
Enumerator | |
---|---|
rtccCapComChModeOff | Capture/Compare channel turned off. |
rtccCapComChModeCapture | Capture mode. |
rtccCapComChModeCompare | Compare mode. |
145
of file platform/emlib/inc/em_rtcc.h
RTCC_CompMatchOutAction_TypeDef#
RTCC_CompMatchOutAction_TypeDef
Compare match output action mode.
Enumerator | |
---|---|
rtccCompMatchOutActionPulse | Generate a pulse. |
rtccCompMatchOutActionToggle | Toggle output. |
rtccCompMatchOutActionClear | Clear output. |
rtccCompMatchOutActionSet | Set output. |
152
of file platform/emlib/inc/em_rtcc.h
RTCC_InEdgeSel_TypeDef#
RTCC_InEdgeSel_TypeDef
Input edge select.
Enumerator | |
---|---|
rtccInEdgeRising | Rising edges detected. |
rtccInEdgeFalling | Falling edges detected. |
rtccInEdgeBoth | Both edges detected. |
rtccInEdgeNone | No edge detection, signal is left as is. |
181
of file platform/emlib/inc/em_rtcc.h
RTCC_CompBase_TypeDef#
RTCC_CompBase_TypeDef
Capture/Compare channel compare mode.
Enumerator | |
---|---|
rtccCompBaseCnt | CCVx is compared with the CNT register. |
rtccCompBasePreCnt | CCVx is compared with a CNT[16:0] and PRECNT[14:0]. |
189
of file platform/emlib/inc/em_rtcc.h
Typedef Documentation#
RTCC_PRSSel_TypeDef#
typedef uint8_t RTCC_PRSSel_TypeDef
PRS channel number.
This type is used when configuring input capture mode on a RTCC channel.
161
of file platform/emlib/inc/em_rtcc.h
Function Documentation#
RTCC_ChannelCompareValueGet#
uint32_t RTCC_ChannelCompareValueGet (int ch)
Get the RTCC compare register value for a selected channel.
[in] | ch | Channel selector. |
Returns
Compare register value.
401
of file platform/emlib/inc/em_rtcc.h
RTCC_ChannelCompareValueSet#
void RTCC_ChannelCompareValueSet (int ch, uint32_t value)
Set the RTCC compare register value for a selected channel.
[in] | ch | Channel selector. |
[in] | value | Compare register value |
421
of file platform/emlib/inc/em_rtcc.h
RTCC_ChannelCaptureValueGet#
uint32_t RTCC_ChannelCaptureValueGet (int ch)
Get the RTCC input capture register value for a selected channel.
[in] | ch | Channel selector. |
Returns
Capture register value.
441
of file platform/emlib/inc/em_rtcc.h
RTCC_ChannelCCVGet#
uint32_t RTCC_ChannelCCVGet (int ch)
Get the RTCC capture/compare register value for a selected channel.
[in] | ch | Channel selector. |
For parts with separate capture compare value registers, this function returns the compare value.
Returns
Capture/compare register value.
463
of file platform/emlib/inc/em_rtcc.h
RTCC_ChannelCCVSet#
void RTCC_ChannelCCVSet (int ch, uint32_t value)
Set RTCC capture/compare register value for a selected channel.
[in] | ch | Channel selector. |
[in] | value | Capture/compare register value |
For parts with separate capture compare value registers, this function sets the compare value.
480
of file platform/emlib/inc/em_rtcc.h
RTCC_CombinedCounterGet#
uint32_t RTCC_CombinedCounterGet (void )
Get the combined CNT/PRECNT register content.
N/A |
Returns
CNT/PRECNT register value.
558
of file platform/emlib/inc/em_rtcc.h
RTCC_CounterGet#
uint32_t RTCC_CounterGet (void )
Get the RTCC counter value.
N/A |
Returns
Current RTCC counter value.
575
of file platform/emlib/inc/em_rtcc.h
RTCC_CounterSet#
void RTCC_CounterSet (uint32_t value)
Set the RTCC CNT counter.
[in] | value | CNT value. |
592
of file platform/emlib/inc/em_rtcc.h
RTCC_Enable#
void RTCC_Enable (bool enable)
Enable/disable RTCC counting.
[in] | enable | True to enable RTCC counting, false to disable counting. |
112
of file platform/emlib/src/em_rtcc.c
RTCC_Init#
void RTCC_Init (const RTCC_Init_TypeDef * init)
Initialize RTCC.
[in] | init | A pointer to the RTCC initialization structure. |
Note that the compare values must be set separately with RTCC_CompareSet(), which should probably be done prior to the use of this function if configuring the RTCC to start when initialization is completed.
152
of file platform/emlib/src/em_rtcc.c
RTCC_ChannelInit#
void RTCC_ChannelInit (int ch, RTCC_CCChConf_TypeDef const * confPtr)
Configure the selected capture/compare channel of the RTCC.
[in] | ch | A channel selector. |
[in] | confPtr | A pointer to the configuration structure. |
Use this function to configure an RTCC channel. Select capture/compare mode, match output action, overflow output action, and PRS input configuration. See the configuration structure RTCC_CCChConf_TypeDef for more details.
74
of file platform/emlib/src/em_rtcc.c
RTCC_IntClear#
void RTCC_IntClear (uint32_t flags)
Clear one or more pending RTCC interrupts.
[in] | flags | RTCC interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources. |
661
of file platform/emlib/inc/em_rtcc.h
RTCC_IntDisable#
void RTCC_IntDisable (uint32_t flags)
Disable one or more RTCC interrupts.
[in] | flags | RTCC interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt. |
678
of file platform/emlib/inc/em_rtcc.h
RTCC_IntEnable#
void RTCC_IntEnable (uint32_t flags)
Enable one or more RTCC interrupts.
[in] | flags | RTCC interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt. |
Note
Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. To ignore a pending interrupt, consider using RTCC_IntClear() prior to enabling the interrupt.
696
of file platform/emlib/inc/em_rtcc.h
RTCC_IntGet#
uint32_t RTCC_IntGet (void )
Get pending RTCC interrupt flags.
N/A |
Note
Event bits are not cleared by using this function.
Returns
Pending RTCC interrupt sources. Returns a set of interrupt flags OR-ed together for the interrupt sources set.
712
of file platform/emlib/inc/em_rtcc.h
RTCC_IntGetEnabled#
uint32_t RTCC_IntGetEnabled (void )
Get enabled and pending RTCC interrupt flags.
N/A |
Useful for handling more interrupt sources in the same interrupt handler.
Returns
Pending and enabled RTCC interrupt sources. Returns a set of interrupt flags OR-ed together for the interrupt sources set.
728
of file platform/emlib/inc/em_rtcc.h
RTCC_IntSet#
void RTCC_IntSet (uint32_t flags)
Set one or more pending RTCC interrupts from SW.
[in] | flags | RTCC interrupt sources to set to pending. Use a set of interrupt flags (RTCC_IFS_nnn). |
746
of file platform/emlib/inc/em_rtcc.h
RTCC_Lock#
void RTCC_Lock (void )
Lock RTCC registers.
N/A |
Note
When RTCC registers are locked, RTCC_CTRL, RTCC_PRECNT, RTCC_CNT, RTCC_TIME, RTCC_DATE, RTCC_IEN, RTCC_POWERDOWN and RTCC_CCx_XXX registers cannot be written to.
764
of file platform/emlib/inc/em_rtcc.h
RTCC_PreCounterGet#
uint32_t RTCC_PreCounterGet (void )
Get the RTCC pre-counter value.
N/A |
Returns
Current RTCC pre-counter value.
793
of file platform/emlib/inc/em_rtcc.h
RTCC_PreCounterSet#
void RTCC_PreCounterSet (uint32_t preCntVal)
Set the RTCC pre-counter value.
[in] | preCntVal | RTCC pre-counter value to be set. |
810
of file platform/emlib/inc/em_rtcc.h
RTCC_Reset#
void RTCC_Reset (void )
Restore RTCC to its reset state.
N/A |
187
of file platform/emlib/src/em_rtcc.c
RTCC_StatusClear#
void RTCC_StatusClear (void )
Clear the STATUS register.
N/A |
238
of file platform/emlib/src/em_rtcc.c
RTCC_StatusGet#
uint32_t RTCC_StatusGet (void )
Get the STATUS register value.
N/A |
Returns
Current STATUS register value.
850
of file platform/emlib/inc/em_rtcc.h
RTCC_SyncWait#
void RTCC_SyncWait (void )
Wait for the RTCC to complete all synchronization of register changes and commands.
N/A |
870
of file platform/emlib/inc/em_rtcc.h
RTCC_Start#
void RTCC_Start (void )
Start the RTCC counter.
N/A |
This function will send a start command to the RTCC peripheral. The RTCC peripheral will use some LF clock ticks before the command is executed. The RTCC_SyncWait() function can be used to wait for the start command to be executed.
Note
This function requires the RTCC to be enabled.
890
of file platform/emlib/inc/em_rtcc.h
RTCC_Stop#
void RTCC_Stop (void )
Stop the RTCC counter.
N/A |
This function will send a stop command to the RTCC peripheral. The RTCC peripheral will use some LF clock ticks before the command is executed. The RTCC_SyncWait() function can be used to wait for the stop command to be executed.
Note
This function requires the RTCC to be enabled.
909
of file platform/emlib/inc/em_rtcc.h
RTCC_Unlock#
void RTCC_Unlock (void )
Unlock RTCC registers.
N/A |
Note
When RTCC registers are locked, RTCC_CTRL, RTCC_PRECNT, RTCC_CNT, RTCC_TIME, RTCC_DATE, RTCC_IEN, RTCC_POWERDOWN and RTCC_CCx_XXX registers cannot be written to.
951
of file platform/emlib/inc/em_rtcc.h
Macro Definition Documentation#
RTCC_INIT_DEFAULT#
#define RTCC_INIT_DEFAULTValue:
Default RTCC initialization structure.
289
of file platform/emlib/inc/em_rtcc.h
RTCC_CH_INIT_COMPARE_DEFAULT#
#define RTCC_CH_INIT_COMPARE_DEFAULTValue:
Default RTCC channel output compare initialization structure.
332
of file platform/emlib/inc/em_rtcc.h
RTCC_CH_INIT_CAPTURE_DEFAULT#
#define RTCC_CH_INIT_CAPTURE_DEFAULTValue:
Default RTCC channel input capture initialization structure.
342
of file platform/emlib/inc/em_rtcc.h
RTCC_CH_VALID#
#define RTCC_CH_VALIDValue:
(ch)
Number of RTCC capture/compare channels.
Validation of valid RTCC channel for assert statements.
385
of file platform/emlib/inc/em_rtcc.h