RTCCEMLIB
Detailed Description
Real Time Counter (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.
Data Structures |
|
struct | RTCC_CCChConf_TypeDef |
struct | RTCC_Init_TypeDef |
Macros |
|
#define | RTCC_CH_INIT_CAPTURE_DEFAULT |
#define | RTCC_CH_INIT_COMPARE_DEFAULT |
#define | RTCC_CH_VALID (ch) ( (ch) < 3) |
#define | RTCC_INIT_DEFAULT |
Enumerations |
|
enum |
RTCC_CapComChMode_TypeDef
{
rtccCapComChModeOff = _RTCC_CC_CTRL_MODE_OFF, rtccCapComChModeCapture = _RTCC_CC_CTRL_MODE_INPUTCAPTURE, rtccCapComChModeCompare = _RTCC_CC_CTRL_MODE_OUTPUTCOMPARE } |
enum |
RTCC_CntMode_TypeDef
{
rtccCntModeNormal = _RTCC_CTRL_CNTMODE_NORMAL, rtccCntModeCalendar = _RTCC_CTRL_CNTMODE_CALENDAR } |
enum |
RTCC_CntPresc_TypeDef
{
rtccCntPresc_1 = _RTCC_CTRL_CNTPRESC_DIV1, rtccCntPresc_2 = _RTCC_CTRL_CNTPRESC_DIV2, rtccCntPresc_4 = _RTCC_CTRL_CNTPRESC_DIV4, rtccCntPresc_8 = _RTCC_CTRL_CNTPRESC_DIV8, rtccCntPresc_16 = _RTCC_CTRL_CNTPRESC_DIV16, rtccCntPresc_32 = _RTCC_CTRL_CNTPRESC_DIV32, rtccCntPresc_64 = _RTCC_CTRL_CNTPRESC_DIV64, rtccCntPresc_128 = _RTCC_CTRL_CNTPRESC_DIV128, rtccCntPresc_256 = _RTCC_CTRL_CNTPRESC_DIV256, rtccCntPresc_512 = _RTCC_CTRL_CNTPRESC_DIV512, rtccCntPresc_1024 = _RTCC_CTRL_CNTPRESC_DIV1024, rtccCntPresc_2048 = _RTCC_CTRL_CNTPRESC_DIV2048, rtccCntPresc_4096 = _RTCC_CTRL_CNTPRESC_DIV4096, rtccCntPresc_8192 = _RTCC_CTRL_CNTPRESC_DIV8192, rtccCntPresc_16384 = _RTCC_CTRL_CNTPRESC_DIV16384, rtccCntPresc_32768 = _RTCC_CTRL_CNTPRESC_DIV32768 } |
enum |
RTCC_CompBase_TypeDef
{
rtccCompBaseCnt = _RTCC_CC_CTRL_COMPBASE_CNT, rtccCompBasePreCnt = _RTCC_CC_CTRL_COMPBASE_PRECNT } |
enum |
RTCC_CompMatchOutAction_TypeDef
{
rtccCompMatchOutActionPulse = _RTCC_CC_CTRL_CMOA_PULSE, rtccCompMatchOutActionToggle = _RTCC_CC_CTRL_CMOA_TOGGLE, rtccCompMatchOutActionClear = _RTCC_CC_CTRL_CMOA_CLEAR, rtccCompMatchOutActionSet = _RTCC_CC_CTRL_CMOA_SET } |
enum |
RTCC_DayCompareMode_TypeDef
{
rtccDayCompareModeMonth = _RTCC_CC_CTRL_DAYCC_MONTH, rtccDayCompareModeWeek = _RTCC_CC_CTRL_DAYCC_WEEK } |
enum |
RTCC_InEdgeSel_TypeDef
{
rtccInEdgeRising = _RTCC_CC_CTRL_ICEDGE_RISING, rtccInEdgeFalling = _RTCC_CC_CTRL_ICEDGE_FALLING, rtccInEdgeBoth = _RTCC_CC_CTRL_ICEDGE_BOTH, rtccInEdgeNone = _RTCC_CC_CTRL_ICEDGE_NONE } |
enum |
RTCC_PrescMode_TypeDef
{
rtccCntTickPresc = _RTCC_CTRL_CNTTICK_PRESC, rtccCntTickCCV0Match = _RTCC_CTRL_CNTTICK_CCV0MATCH } |
enum |
RTCC_PRSSel_TypeDef
{
rtccPRSCh0 = _RTCC_CC_CTRL_PRSSEL_PRSCH0, rtccPRSCh1 = _RTCC_CC_CTRL_PRSSEL_PRSCH1, rtccPRSCh2 = _RTCC_CC_CTRL_PRSSEL_PRSCH2, rtccPRSCh3 = _RTCC_CC_CTRL_PRSSEL_PRSCH3, rtccPRSCh4 = _RTCC_CC_CTRL_PRSSEL_PRSCH4, rtccPRSCh5 = _RTCC_CC_CTRL_PRSSEL_PRSCH5, rtccPRSCh6 = _RTCC_CC_CTRL_PRSSEL_PRSCH6, rtccPRSCh7 = _RTCC_CC_CTRL_PRSSEL_PRSCH7 } |
Functions |
|
__STATIC_INLINE uint32_t | RTCC_ChannelCCVGet (int ch) |
Get RTCC capture/compare register value (CCV) for selected channel.
|
|
__STATIC_INLINE void | RTCC_ChannelCCVSet (int ch, uint32_t value) |
Set RTCC capture/compare register value (CCV) for selected channel.
|
|
__STATIC_INLINE uint32_t | RTCC_ChannelDateGet (int ch) |
Get the calendar DATE register content for selected channel.
|
|
__STATIC_INLINE void | RTCC_ChannelDateSet (int ch, uint32_t date) |
Set the calendar DATE register for selected channel.
|
|
void | RTCC_ChannelInit (int ch, RTCC_CCChConf_TypeDef const *confPtr) |
Configure the selected capture/compare channel of the RTCC.
|
|
__STATIC_INLINE uint32_t | RTCC_ChannelTimeGet (int ch) |
Get the calendar TIME register content for selected channel.
|
|
__STATIC_INLINE void | RTCC_ChannelTimeSet (int ch, uint32_t time) |
Set the calendar TIME register for selected channel.
|
|
__STATIC_INLINE uint32_t | RTCC_CombinedCounterGet (void) |
Get the combined CNT/PRECNT register content.
|
|
__STATIC_INLINE uint32_t | RTCC_CounterGet (void) |
Get RTCC counter value.
|
|
__STATIC_INLINE void | RTCC_CounterSet (uint32_t value) |
Set RTCC CNT counter.
|
|
__STATIC_INLINE uint32_t | RTCC_DateGet (void) |
Get DATE register value.
|
|
__STATIC_INLINE void | RTCC_DateSet (uint32_t date) |
Set RTCC DATE register.
|
|
__STATIC_INLINE void | RTCC_EM4WakeupEnable (bool enable) |
Enable/disable EM4 wakeup capability.
|
|
void | RTCC_Enable (bool enable) |
Enable/disable RTCC.
|
|
void | RTCC_Init (const RTCC_Init_TypeDef *init) |
Initialize RTCC.
|
|
__STATIC_INLINE void | RTCC_IntClear (uint32_t flags) |
Clear one or more pending RTCC interrupts.
|
|
__STATIC_INLINE void | RTCC_IntDisable (uint32_t flags) |
Disable one or more RTCC interrupts.
|
|
__STATIC_INLINE void | RTCC_IntEnable (uint32_t flags) |
Enable one or more RTCC interrupts.
|
|
__STATIC_INLINE uint32_t | RTCC_IntGet (void) |
Get pending RTCC interrupt flags.
|
|
__STATIC_INLINE uint32_t | RTCC_IntGetEnabled (void) |
Get enabled and pending RTCC interrupt flags.
|
|
__STATIC_INLINE void | RTCC_IntSet (uint32_t flags) |
Set one or more pending RTCC interrupts from SW.
|
|
__STATIC_INLINE void | RTCC_Lock (void) |
Lock RTCC registers.
|
|
__STATIC_INLINE uint32_t | RTCC_PreCounterGet (void) |
Get RTCC pre-counter value.
|
|
__STATIC_INLINE void | RTCC_PreCounterSet (uint32_t preCntVal) |
Set RTCC pre-counter value.
|
|
void | RTCC_Reset (void) |
Restore RTCC to its reset state.
|
|
__STATIC_INLINE void | RTCC_RetentionRamPowerDown (void) |
Power down the retention ram.
|
|
void | RTCC_StatusClear (void) |
Clear STATUS register.
|
|
__STATIC_INLINE uint32_t | RTCC_StatusGet (void) |
Get STATUS register value.
|
|
__STATIC_INLINE uint32_t | RTCC_TimeGet (void) |
Get TIME register value.
|
|
__STATIC_INLINE void | RTCC_TimeSet (uint32_t time) |
Set RTCC TIME register.
|
|
__STATIC_INLINE void | RTCC_Unlock (void) |
Unlock RTCC registers.
|
|
Macro Definition Documentation
#define RTCC_CH_INIT_CAPTURE_DEFAULT |
Default RTCC channel input capture init structure.
Definition at line
292
of file
em_rtcc.h
.
#define RTCC_CH_INIT_COMPARE_DEFAULT |
Default RTCC channel output compare init structure.
Definition at line
280
of file
em_rtcc.h
.
#define RTCC_CH_VALID | ( |
ch
|
) | ( (ch) < 3) |
Validation of valid RTCC channel for assert statements.
Definition at line
304
of file
em_rtcc.h
.
Referenced by RTCC_ChannelCCVGet() , RTCC_ChannelCCVSet() , RTCC_ChannelDateGet() , RTCC_ChannelDateSet() , RTCC_ChannelInit() , RTCC_ChannelTimeGet() , and RTCC_ChannelTimeSet() .
#define RTCC_INIT_DEFAULT |
Default RTCC init structure.
Definition at line
251
of file
em_rtcc.h
.
Referenced by UDELAY_Calibrate() .
Enumeration Type Documentation
enum RTCC_CntMode_TypeDef |
Counter prescaler selection.
Definition at line
86
of file
em_rtcc.h
.
enum RTCC_PRSSel_TypeDef |
Function Documentation
__STATIC_INLINE uint32_t RTCC_ChannelCCVGet | ( | int |
ch
|
) |
Get RTCC capture/compare register value (CCV) for selected channel.
- Parameters
-
[in] ch
Channel selector.
- Returns
- Capture/compare register value.
Definition at line
320
of file
em_rtcc.h
.
References RTCC , and RTCC_CH_VALID .
__STATIC_INLINE void RTCC_ChannelCCVSet | ( | int |
ch,
|
uint32_t |
value
|
||
) |
Set RTCC capture/compare register value (CCV) for selected channel.
- Parameters
-
[in] ch
Channel selector. [in] value
CCV value.
Definition at line
336
of file
em_rtcc.h
.
References RTCC , and RTCC_CH_VALID .
__STATIC_INLINE uint32_t RTCC_ChannelDateGet | ( | int |
ch
|
) |
Get the calendar DATE register content for selected channel.
- Parameters
-
[in] ch
Channel selector.
- Returns
- DATE register value.
Definition at line
352
of file
em_rtcc.h
.
References RTCC , and RTCC_CH_VALID .
__STATIC_INLINE void RTCC_ChannelDateSet | ( | int |
ch,
|
uint32_t |
date
|
||
) |
Set the calendar DATE register for selected channel.
- Parameters
-
[in] ch
Channel selector. [in] date
DATE value.
Definition at line
368
of file
em_rtcc.h
.
References RTCC , and RTCC_CH_VALID .
void RTCC_ChannelInit | ( | int |
ch,
|
RTCC_CCChConf_TypeDef const * |
confPtr
|
||
) |
Configure the selected capture/compare channel of the RTCC.
Use this function to configure a RTCC channel. Select capture/compare mode, match output action, overflow output action and PRS input configuration. Refer to the configuration structure RTCC_CCChConf_TypeDef for more details.
- Parameters
-
[in] ch
Channel selector. [in] confPtr
Pointer to configuration structure.
Configure the selected capture/compare channel.
Definition at line
81
of file
em_rtcc.c
.
References _RTCC_CC_CTRL_CMOA_SHIFT , _RTCC_CC_CTRL_COMPBASE_SHIFT , _RTCC_CC_CTRL_COMPMASK_MASK , _RTCC_CC_CTRL_COMPMASK_SHIFT , _RTCC_CC_CTRL_DAYCC_SHIFT , _RTCC_CC_CTRL_ICEDGE_SHIFT , _RTCC_CC_CTRL_MODE_SHIFT , _RTCC_CC_CTRL_PRSSEL_SHIFT , RTCC_CCChConf_TypeDef::chMode , RTCC_CCChConf_TypeDef::compBase , RTCC_CCChConf_TypeDef::compMask , RTCC_CCChConf_TypeDef::compMatchOutAction , RTCC_CCChConf_TypeDef::dayCompMode , RTCC_CCChConf_TypeDef::inputEdgeSel , RTCC_CCChConf_TypeDef::prsSel , RTCC , and RTCC_CH_VALID .
Referenced by RTCDRV_Init() .
__STATIC_INLINE uint32_t RTCC_ChannelTimeGet | ( | int |
ch
|
) |
Get the calendar TIME register content for selected channel.
- Parameters
-
[in] ch
Channel selector.
- Returns
- TIME register value.
Definition at line
386
of file
em_rtcc.h
.
References RTCC , and RTCC_CH_VALID .
__STATIC_INLINE void RTCC_ChannelTimeSet | ( | int |
ch,
|
uint32_t |
time
|
||
) |
Set the calendar TIME register for selected channel.
- Parameters
-
[in] ch
Channel selector. [in] time
TIME value.
Definition at line
402
of file
em_rtcc.h
.
References RTCC , and RTCC_CH_VALID .
__STATIC_INLINE uint32_t RTCC_CombinedCounterGet | ( | void |
|
) |
Get the combined CNT/PRECNT register content.
- Returns
- CNT/PRECNT register value.
Definition at line
415
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE uint32_t RTCC_CounterGet | ( | void |
|
) |
Get RTCC counter value.
- Returns
- Current RTCC counter value.
Definition at line
427
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_CounterSet | ( | uint32_t |
value
|
) |
Set RTCC CNT counter.
- Parameters
-
[in] value
CNT value.
Definition at line
439
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE uint32_t RTCC_DateGet | ( | void |
|
) |
Get DATE register value.
- Returns
- Current DATE register value.
Definition at line
451
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_DateSet | ( | uint32_t |
date
|
) |
Set RTCC DATE register.
- Parameters
-
[in] date
DATE value.
Definition at line
463
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_EM4WakeupEnable | ( | bool |
enable
|
) |
Enable/disable EM4 wakeup capability.
- Parameters
-
[in] enable
True to enable EM4 wakeup, false to disable.
Definition at line
475
of file
em_rtcc.h
.
References RTCC , and RTCC_EM4WUEN_EM4WU .
void RTCC_Enable | ( | bool |
enable
|
) |
Enable/disable RTCC.
- Parameters
-
[in] enable
True to enable RTCC, false to disable.
Definition at line
105
of file
em_rtcc.c
.
References _RTCC_CTRL_ENABLE_SHIFT , BUS_RegBitWrite() , and RTCC .
Referenced by RTCDRV_DeInit() , and UDELAY_Calibrate() .
void RTCC_Init | ( | const RTCC_Init_TypeDef * |
init
|
) |
Initialize RTCC.
Note that the compare values must be set separately with RTCC_CompareSet(). That should probably be done prior to the use of this function if configuring the RTCC to start when initialization is completed.
- Parameters
-
[in] init
Pointer to RTCC initialization structure.
Definition at line
123
of file
em_rtcc.c
.
References _RTCC_CTRL_BUMODETSEN_SHIFT , _RTCC_CTRL_CCV1TOP_SHIFT , _RTCC_CTRL_CNTMODE_SHIFT , _RTCC_CTRL_CNTPRESC_SHIFT , _RTCC_CTRL_CNTTICK_SHIFT , _RTCC_CTRL_DEBUGRUN_SHIFT , _RTCC_CTRL_ENABLE_SHIFT , _RTCC_CTRL_LYEARCORRDIS_SHIFT , _RTCC_CTRL_OSCFDETEN_SHIFT , _RTCC_CTRL_PRECCV0TOP_SHIFT , RTCC_Init_TypeDef::cntMode , RTCC_Init_TypeDef::cntWrapOnCCV1 , RTCC_Init_TypeDef::debugRun , RTCC_Init_TypeDef::disLeapYearCorr , RTCC_Init_TypeDef::enaBackupModeSet , RTCC_Init_TypeDef::enable , RTCC_Init_TypeDef::enaOSCFailDetect , RTCC_Init_TypeDef::precntWrapOnCCV0 , RTCC_Init_TypeDef::presc , RTCC_Init_TypeDef::prescMode , and RTCC .
Referenced by RTCDRV_Init() , and UDELAY_Calibrate() .
__STATIC_INLINE void RTCC_IntClear | ( | uint32_t |
flags
|
) |
Clear one or more pending RTCC interrupts.
- Parameters
-
[in] flags
RTCC interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources.
Definition at line
496
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_IntDisable | ( | uint32_t |
flags
|
) |
Disable one or more RTCC interrupts.
- Parameters
-
[in] flags
RTCC interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt.
Definition at line
509
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_IntEnable | ( | uint32_t |
flags
|
) |
Enable one or more RTCC interrupts.
- Note
- Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. Consider using RTCC_IntClear() prior to enabling if such a pending interrupt should be ignored.
- Parameters
-
[in] flags
RTCC interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt.
Definition at line
527
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE uint32_t RTCC_IntGet | ( | void |
|
) |
Get pending RTCC interrupt flags.
- Note
- The event bits are not cleared by the use of this function.
- Returns
- Pending RTCC interrupt sources. Returns a set of interrupt flags OR-ed together for the interrupt sources set.
Definition at line
543
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE uint32_t RTCC_IntGetEnabled | ( | void |
|
) |
Get enabled and pending RTCC interrupt flags.
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.
Definition at line
559
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_IntSet | ( | uint32_t |
flags
|
) |
Set one or more pending RTCC interrupts from SW.
- Parameters
-
[in] flags
RTCC interrupt sources to set to pending. Use a set of interrupt flags (RTCC_IFS_nnn).
Definition at line
577
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_Lock | ( | void |
|
) |
Lock RTCC registers.
- 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 can not be written to.
Definition at line
591
of file
em_rtcc.h
.
References CMU , CMU_LOCK_LOCKKEY_LOCK , CMU_LOCK_LOCKKEY_LOCKED , CMU_LOCK_LOCKKEY_UNLOCK , RTCC , and RTCC_LOCK_LOCKKEY_LOCK .
__STATIC_INLINE uint32_t RTCC_PreCounterGet | ( | void |
|
) |
Get RTCC pre-counter value.
- Returns
- Current RTCC pre-counter value.
Definition at line
620
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_PreCounterSet | ( | uint32_t |
preCntVal
|
) |
Set RTCC pre-counter value.
- Parameters
-
[in] preCntVal
RTCC pre-counter value to be set.
Definition at line
632
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_RetentionRamPowerDown | ( | void |
|
) |
Power down the retention ram.
- Note
- Once retention ram is powered down, it cannot be powered up again.
Definition at line
646
of file
em_rtcc.h
.
References RTCC , and RTCC_POWERDOWN_RAM .
__STATIC_INLINE uint32_t RTCC_StatusGet | ( | void |
|
) |
Get STATUS register value.
- Returns
- Current STATUS register value.
Definition at line
664
of file
em_rtcc.h
.
References RTCC , and RTCC_SYNCBUSY_CMD .
__STATIC_INLINE uint32_t RTCC_TimeGet | ( | void |
|
) |
Get TIME register value.
- Returns
- Current TIME register value.
Definition at line
679
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_TimeSet | ( | uint32_t |
time
|
) |
Set RTCC TIME register.
- Parameters
-
[in] time
TIME value.
Definition at line
691
of file
em_rtcc.h
.
References RTCC .
__STATIC_INLINE void RTCC_Unlock | ( | void |
|
) |
Unlock RTCC registers.
- 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 can not be written to.
Definition at line
705
of file
em_rtcc.h
.
References CMU , CMU_LOCK_LOCKKEY_LOCK , CMU_LOCK_LOCKKEY_LOCKED , CMU_LOCK_LOCKKEY_UNLOCK , RTCC , and RTCC_LOCK_LOCKKEY_UNLOCK .
Referenced by RTCC_Reset() .