EFM32 Happy Gecko Software Documentation
efm32hg-doc-5.1.2
|
Real Time Counter (RTC) Peripheral API.
This module contains functions to control the RTC peripheral of Silicon Labs 32-bit MCUs and SoCs. The RTC ensures timekeeping in low energy modes.
Data Structures | |
struct | RTC_Init_TypeDef |
Macros | |
#define | RTC_INIT_DEFAULT |
Functions | |
uint32_t | RTC_CompareGet (unsigned int comp) |
Get RTC compare register value. More... | |
void | RTC_CompareSet (unsigned int comp, uint32_t value) |
Set RTC compare register value. More... | |
__STATIC_INLINE uint32_t | RTC_CounterGet (void) |
Get RTC counter value. More... | |
void | RTC_CounterReset (void) |
Restart RTC counter from zero. | |
__STATIC_INLINE void | RTC_CounterSet (uint32_t value) |
Set the RTC counter value. More... | |
void | RTC_Enable (bool enable) |
Enable/disable RTC. More... | |
void | RTC_FreezeEnable (bool enable) |
RTC register synchronization freeze control. More... | |
void | RTC_Init (const RTC_Init_TypeDef *init) |
Initialize RTC. More... | |
__STATIC_INLINE void | RTC_IntClear (uint32_t flags) |
Clear one or more pending RTC interrupts. More... | |
__STATIC_INLINE void | RTC_IntDisable (uint32_t flags) |
Disable one or more RTC interrupts. More... | |
__STATIC_INLINE void | RTC_IntEnable (uint32_t flags) |
Enable one or more RTC interrupts. More... | |
__STATIC_INLINE uint32_t | RTC_IntGet (void) |
Get pending RTC interrupt flags. More... | |
__STATIC_INLINE uint32_t | RTC_IntGetEnabled (void) |
Get enabled and pending RTC interrupt flags. Useful for handling more interrupt sources in the same interrupt handler. More... | |
__STATIC_INLINE void | RTC_IntSet (uint32_t flags) |
Set one or more pending RTC interrupts from SW. More... | |
void | RTC_Reset (void) |
Restore RTC to reset state. | |
#define RTC_INIT_DEFAULT |
Suggested default config for RTC init structure.
Definition at line 68 of file em_rtc.h.
Referenced by UDELAY_Calibrate().
uint32_t RTC_CompareGet | ( | unsigned int | comp | ) |
void RTC_CompareSet | ( | unsigned int | comp, |
uint32_t | value | ||
) |
Set RTC compare register value.
[in] | comp | Compare register to set, either 0 or 1 |
[in] | value | Initialization value (<= 0x00ffffff) |
Definition at line 161 of file em_rtc.c.
References _RTC_COMP0_COMP0_MASK, _RTC_COMP0_COMP0_SHIFT, RTC, RTC_SYNCBUSY_COMP0, and RTC_SYNCBUSY_COMP1.
__STATIC_INLINE uint32_t RTC_CounterGet | ( | void | ) |
__STATIC_INLINE void RTC_CounterSet | ( | uint32_t | value | ) |
void RTC_Enable | ( | bool | enable | ) |
Enable/disable RTC.
[in] | enable | true to enable counting, false to disable. |
Definition at line 217 of file em_rtc.c.
References _RTC_CTRL_EN_SHIFT, BUS_RegBitWrite(), RTC, and RTC_SYNCBUSY_CTRL.
Referenced by RTC_CounterReset(), RTCDRV_DeInit(), and UDELAY_Calibrate().
void RTC_FreezeEnable | ( | bool | enable | ) |
RTC register synchronization freeze control.
Some RTC registers require synchronization into the low frequency (LF) domain. The freeze feature allows for several such registers to be modified before passing them to the LF domain simultaneously (which takes place when the freeze mode is disabled).
[in] | enable |
|
Definition at line 261 of file em_rtc.c.
References RTC, and RTC_FREEZE_REGFREEZE.
Referenced by UDELAY_Calibrate().
void RTC_Init | ( | const RTC_Init_TypeDef * | init | ) |
Initialize RTC.
Note that the compare values must be set separately with RTC_CompareSet(). That should probably be done prior to the use of this function if configuring the RTC to start when initialization is completed.
[in] | init | Pointer to RTC initialization structure. |
Definition at line 305 of file em_rtc.c.
References RTC_Init_TypeDef::comp0Top, RTC_Init_TypeDef::debugRun, RTC_Init_TypeDef::enable, RTC, RTC_CTRL_COMP0TOP, RTC_CTRL_DEBUGRUN, RTC_CTRL_EN, and RTC_SYNCBUSY_CTRL.
Referenced by RTCDRV_Init(), and UDELAY_Calibrate().
__STATIC_INLINE void RTC_IntClear | ( | uint32_t | flags | ) |
__STATIC_INLINE void RTC_IntDisable | ( | uint32_t | flags | ) |
__STATIC_INLINE void RTC_IntEnable | ( | uint32_t | flags | ) |
Enable one or more RTC interrupts.
[in] | flags | RTC interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt sources for the RTC module (RTC_IFS_nnn). |
Definition at line 158 of file em_rtc.h.
References RTC.
__STATIC_INLINE uint32_t RTC_IntGet | ( | void | ) |
Get pending RTC interrupt flags.
Definition at line 175 of file em_rtc.h.
References RTC.
__STATIC_INLINE uint32_t RTC_IntGetEnabled | ( | void | ) |
Get enabled and pending RTC interrupt flags. Useful for handling more interrupt sources in the same interrupt handler.
Definition at line 195 of file em_rtc.h.
References RTC.
__STATIC_INLINE void RTC_IntSet | ( | uint32_t | flags | ) |