Real Time Counter (RTC) Peripheral API.
More...
Data Structures |
struct | RTC_Init_TypeDef |
Defines |
#define | RTC_INIT_DEFAULT |
Functions |
uint32_t | RTC_CompareGet (unsigned int comp) |
| Get RTC compare register value.
|
void | RTC_CompareSet (unsigned int comp, uint32_t value) |
| Set RTC compare register value.
|
__STATIC_INLINE uint32_t | RTC_CounterGet (void) |
| Get RTC counter value.
|
void | RTC_CounterReset (void) |
| Restart RTC counter from zero.
|
void | RTC_Enable (bool enable) |
| Enable/disable RTC.
|
void | RTC_FreezeEnable (bool enable) |
| RTC register synchronization freeze control.
|
void | RTC_Init (const RTC_Init_TypeDef *init) |
| Initialize RTC.
|
__STATIC_INLINE void | RTC_IntClear (uint32_t flags) |
| Clear one or more pending RTC interrupts.
|
__STATIC_INLINE void | RTC_IntDisable (uint32_t flags) |
| Disable one or more RTC interrupts.
|
__STATIC_INLINE void | RTC_IntEnable (uint32_t flags) |
| Enable one or more RTC interrupts.
|
__STATIC_INLINE uint32_t | RTC_IntGet (void) |
| Get pending RTC interrupt flags.
|
__STATIC_INLINE void | RTC_IntSet (uint32_t flags) |
| Set one or more pending RTC interrupts from SW.
|
void | RTC_Reset (void) |
| Restore RTC to reset state.
|
Detailed Description
Real Time Counter (RTC) Peripheral API.
Define Documentation
Value:{ true, \
false, \
true \
}
Suggested default config for RTC init structure.
Definition at line 69 of file em_rtc.h.
Function Documentation
uint32_t RTC_CompareGet |
( |
unsigned int |
comp |
) |
|
Get RTC compare register value.
- Parameters:
-
[in] | comp | Compare register to get, either 0 or 1 |
- Returns:
- Compare register value, 0 if invalid register selected.
Definition at line 115 of file em_rtc.c.
void RTC_CompareSet |
( |
unsigned int |
comp, |
|
|
uint32_t |
value | |
|
) |
| | |
Set RTC compare register value.
- Note:
- The setting of a compare register requires synchronization into the low frequency domain. If the same register is modified before a previous update has completed, this function will stall until the previous synchronization has completed. This only applies to the Gecko Family, see comment in the RTC_Sync() internal function call.
- Parameters:
-
[in] | comp | Compare register to set, either 0 or 1 |
[in] | value | Initialization value (<= 0x00ffffff) |
Definition at line 159 of file em_rtc.c.
__STATIC_INLINE uint32_t RTC_CounterGet |
( |
void |
|
) |
|
Get RTC counter value.
- Returns:
- Current RTC counter value.
Definition at line 90 of file em_rtc.h.
void RTC_CounterReset |
( |
void |
|
) |
|
void RTC_Enable |
( |
bool |
enable |
) |
|
Enable/disable RTC.
- Note:
- The enabling/disabling of the RTC modifies the RTC CTRL register which requires synchronization into the low frequency domain. If this register is modified before a previous update to the same register has completed, this function will stall until the previous synchronization has completed. This only applies to the Gecko Family, see comment in the RTC_Sync() internal function call.
- Parameters:
-
[in] | enable | true to enable counting, false to disable. |
Definition at line 214 of file em_rtc.c.
References BITBAND_Peripheral().
Referenced by RTC_CounterReset().
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).
- Note:
- When enabling freeze mode, this function will wait for all current ongoing RTC synchronization to LF domain to complete (Normally synchronization will not be in progress.) However for this reason, when using freeze mode, modifications of registers requiring LF synchronization should be done within one freeze enable/disable block to avoid unecessary stalling. This only applies to the Gecko Family, see the reference manual chapter about Access to Low Energy Peripherals (Asynchronos Registers) for details.
- Parameters:
-
[in] | enable |
- true - enable freeze, modified registers are not propagated to the LF domain
- false - disables freeze, modified registers are propagated to LF domain
|
Definition at line 258 of file em_rtc.c.
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.
- Note:
- The initialization of the RTC modifies the RTC CTRL register which requires synchronization into the low frequency domain. If this register is modified before a previous update to the same register has completed, this function will stall until the previous synchronization has completed. This only applies to the Gecko Family, see comment in the RTC_Sync() internal function call.
- Parameters:
-
[in] | init | Pointer to RTC initialization structure. |
Definition at line 302 of file em_rtc.c.
References RTC_Init_TypeDef::comp0Top, RTC_Init_TypeDef::debugRun, and RTC_Init_TypeDef::enable.
__STATIC_INLINE void RTC_IntClear |
( |
uint32_t |
flags |
) |
|
Clear one or more pending RTC interrupts.
- Parameters:
-
[in] | flags | RTC interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources for the RTC module (RTC_IFS_nnn). |
Definition at line 109 of file em_rtc.h.
__STATIC_INLINE void RTC_IntDisable |
( |
uint32_t |
flags |
) |
|
Disable one or more RTC interrupts.
- Parameters:
-
[in] | flags | RTC interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt sources for the RTC module (RTC_IFS_nnn). |
Definition at line 124 of file em_rtc.h.
__STATIC_INLINE void RTC_IntEnable |
( |
uint32_t |
flags |
) |
|
Enable one or more RTC interrupts.
- Note:
- Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. Consider using RTC_IntClear() prior to enabling if such a pending interrupt should be ignored.
- Parameters:
-
[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 144 of file em_rtc.h.
__STATIC_INLINE uint32_t RTC_IntGet |
( |
void |
|
) |
|
Get pending RTC interrupt flags.
- Note:
- The event bits are not cleared by the use of this function.
- Returns:
- Pending RTC interrupt sources. Returns a set of interrupt flags OR-ed together for multiple interrupt sources in the RTC module (RTC_IFS_nnn).
Definition at line 161 of file em_rtc.h.
__STATIC_INLINE void RTC_IntSet |
( |
uint32_t |
flags |
) |
|
Set one or more pending RTC interrupts from SW.
- Parameters:
-
[in] | flags | RTC interrupt sources to set to pending. Use a set of interrupt flags OR-ed together to set multiple interrupt sources for the RTC module (RTC_IFS_nnn). |
Definition at line 176 of file em_rtc.h.
Restore RTC to reset state.
Definition at line 343 of file em_rtc.c.