LETIMER - Low Energy Timer
Description
Low Energy Timer (LETIMER) Peripheral API.
This module contains functions to control the LETIMER peripheral of Silicon Labs 32-bit MCUs and SoCs. The LETIMER is a down-counter that can keep track of time and output configurable waveforms.
Data Structures |
|
struct | LETIMER_Init_TypeDef |
LETIMER initialization structure.
|
|
Functions |
|
uint32_t | LETIMER_CompareGet (LETIMER_TypeDef *letimer, unsigned int comp) |
Get the LETIMER compare register value.
|
|
uint32_t | LETIMER_CounterGet (LETIMER_TypeDef *letimer) |
Get LETIMER counter value.
|
|
void | LETIMER_CounterSet (LETIMER_TypeDef *letimer, uint32_t value) |
Set LETIMER counter value.
|
|
void | LETIMER_CompareSet (LETIMER_TypeDef *letimer, unsigned int comp, uint32_t value) |
Set the LETIMER compare register value.
|
|
void | LETIMER_Enable (LETIMER_TypeDef *letimer, bool enable) |
Start/stop LETIMER.
|
|
void | LETIMER_Init (LETIMER_TypeDef *letimer, const LETIMER_Init_TypeDef *init) |
Initialize LETIMER.
|
|
uint32_t | LETIMER_RepeatGet (LETIMER_TypeDef *letimer, unsigned int rep) |
Get the LETIMER repeat register value.
|
|
void | LETIMER_RepeatSet (LETIMER_TypeDef *letimer, unsigned int rep, uint32_t value) |
Set the LETIMER repeat counter register value.
|
|
void | LETIMER_Reset (LETIMER_TypeDef *letimer) |
Reset LETIMER to the same state that it was in after a hardware reset.
|
|
void | LETIMER_SyncWait (LETIMER_TypeDef *letimer) |
Wait for the LETIMER to complete all synchronization of register changes and commands.
|
|
void | LETIMER_TopSet (LETIMER_TypeDef *letimer, uint32_t value) |
Set the LETIMER top value.
|
|
uint32_t | LETIMER_TopGet (LETIMER_TypeDef *letimer) |
Get the current LETIMER top value.
|
|
void | LETIMER_IntClear (LETIMER_TypeDef *letimer, uint32_t flags) |
Clear one or more pending LETIMER interrupts.
|
|
void | LETIMER_IntDisable (LETIMER_TypeDef *letimer, uint32_t flags) |
Disable one or more LETIMER interrupts.
|
|
void | LETIMER_IntEnable (LETIMER_TypeDef *letimer, uint32_t flags) |
Enable one or more LETIMER interrupts.
|
|
uint32_t | LETIMER_IntGet (LETIMER_TypeDef *letimer) |
Get pending LETIMER interrupt flags.
|
|
uint32_t | LETIMER_IntGetEnabled (LETIMER_TypeDef *letimer) |
Get enabled and pending LETIMER interrupt flags.
|
|
void | LETIMER_IntSet (LETIMER_TypeDef *letimer, uint32_t flags) |
Set one or more pending LETIMER interrupts from SW.
|
|
Macros |
|
#define | LETIMER_INIT_DEFAULT |
Default configuration for LETIMER initialization structure.
|
|
Enumerations |
|
enum |
LETIMER_RepeatMode_TypeDef
{
letimerRepeatFree = _LETIMER_CTRL_REPMODE_FREE, letimerRepeatOneshot = _LETIMER_CTRL_REPMODE_ONESHOT, letimerRepeatBuffered = _LETIMER_CTRL_REPMODE_BUFFERED, letimerRepeatDouble = _LETIMER_CTRL_REPMODE_DOUBLE } |
Repeat mode.
|
|
enum |
LETIMER_UFOA_TypeDef
{
letimerUFOANone = _LETIMER_CTRL_UFOA0_NONE, letimerUFOAToggle = _LETIMER_CTRL_UFOA0_TOGGLE, letimerUFOAPulse = _LETIMER_CTRL_UFOA0_PULSE, letimerUFOAPwm = _LETIMER_CTRL_UFOA0_PWM } |
Underflow action on output.
|
|
Function Documentation
◆ LETIMER_CompareGet()
uint32_t LETIMER_CompareGet | ( | LETIMER_TypeDef * |
letimer,
|
unsigned int |
comp
|
||
) |
Get the LETIMER compare register value.
- Parameters
-
[in] letimer
A pointer to the LETIMER peripheral register block. [in] comp
A compare register to get, either 0 or 1.
- Returns
- A compare register value, 0 if invalid register selected.
◆ LETIMER_CounterGet()
uint32_t LETIMER_CounterGet | ( | LETIMER_TypeDef * |
letimer
|
) |
Get LETIMER counter value.
- Parameters
-
[in] letimer
Pointer to the LETIMER peripheral register block.
- Returns
- Current LETIMER counter value.
◆ LETIMER_CounterSet()
void LETIMER_CounterSet | ( | LETIMER_TypeDef * |
letimer,
|
uint32_t |
value
|
||
) |
Set LETIMER counter value.
- Parameters
-
[in] letimer
Pointer to the LETIMER peripheral register block. [in] value
New counter value.
◆ LETIMER_CompareSet()
void LETIMER_CompareSet | ( | LETIMER_TypeDef * |
letimer,
|
unsigned int |
comp,
|
||
uint32_t |
value
|
||
) |
Set the LETIMER 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 comments in the LETIMER_Sync() internal function call.
- Parameters
-
[in] letimer
A pointer to the LETIMER peripheral register block. [in] comp
A compare register to set, either 0 or 1. [in] value
An initialization value (<= 0x0000ffff).
◆ LETIMER_Enable()
void LETIMER_Enable | ( | LETIMER_TypeDef * |
letimer,
|
bool |
enable
|
||
) |
Start/stop LETIMER.
- Note
- The enabling/disabling of the LETIMER modifies the LETIMER CMD 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 comments in the LETIMER_Sync() internal function call.
- Parameters
-
[in] letimer
A pointer to the LETIMER peripheral register block. [in] enable
True to enable counting, false to disable.
◆ LETIMER_Init()
void LETIMER_Init | ( | LETIMER_TypeDef * |
letimer,
|
const LETIMER_Init_TypeDef * |
init
|
||
) |
Initialize LETIMER.
Note that the compare/repeat values must be set separately with LETIMER_CompareSet() and LETIMER_RepeatSet() . That should probably be done prior using this function if configuring the LETIMER to start when initialization is complete.
- Note
- The initialization of the LETIMER modifies the LETIMER CTRL/CMD registers which require synchronization into the low-frequency domain. If any of those registers are 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 comments in the LETIMER_Sync() internal function call.