LETIMEREMLIB
Detailed 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 |
Macros |
|
#define | LETIMER_INIT_DEFAULT |
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 } |
enum |
LETIMER_UFOA_TypeDef
{
letimerUFOANone = _LETIMER_CTRL_UFOA0_NONE, letimerUFOAToggle = _LETIMER_CTRL_UFOA0_TOGGLE, letimerUFOAPulse = _LETIMER_CTRL_UFOA0_PULSE, letimerUFOAPwm = _LETIMER_CTRL_UFOA0_PWM } |
Functions |
|
uint32_t | LETIMER_CompareGet ( LETIMER_TypeDef *letimer, unsigned int comp) |
Get the LETIMER compare register value.
|
|
void | LETIMER_CompareSet ( LETIMER_TypeDef *letimer, unsigned int comp, uint32_t value) |
Set the LETIMER compare register value.
|
|
__STATIC_INLINE uint32_t | LETIMER_CounterGet ( LETIMER_TypeDef *letimer) |
Get LETIMER counter 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.
|
|
__STATIC_INLINE void | LETIMER_IntClear ( LETIMER_TypeDef *letimer, uint32_t flags) |
Clear one or more pending LETIMER interrupts.
|
|
__STATIC_INLINE void | LETIMER_IntDisable ( LETIMER_TypeDef *letimer, uint32_t flags) |
Disable one or more LETIMER interrupts.
|
|
__STATIC_INLINE void | LETIMER_IntEnable ( LETIMER_TypeDef *letimer, uint32_t flags) |
Enable one or more LETIMER interrupts.
|
|
__STATIC_INLINE uint32_t | LETIMER_IntGet ( LETIMER_TypeDef *letimer) |
Get pending LETIMER interrupt flags.
|
|
__STATIC_INLINE uint32_t | LETIMER_IntGetEnabled ( LETIMER_TypeDef *letimer) |
Get enabled and pending LETIMER interrupt flags.
|
|
__STATIC_INLINE void | LETIMER_IntSet ( LETIMER_TypeDef *letimer, uint32_t flags) |
Set one or more pending LETIMER interrupts from SW.
|
|
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.
|
|
__STATIC_INLINE uint32_t | LETIMER_TopGet ( LETIMER_TypeDef *letimer) |
Get the current LETIMER top value.
|
|
void | LETIMER_TopSet ( LETIMER_TypeDef *letimer, uint32_t value) |
Set the LETIMER top value.
|
|
Macro Definition Documentation
#define LETIMER_INIT_DEFAULT |
Default configuration for LETIMER initialization structure.
Definition at line
128
of file
em_letimer.h
.
Referenced by MIC_init() .
Enumeration Type Documentation
Repeat mode.
Definition at line
59
of file
em_letimer.h
.
enum LETIMER_UFOA_TypeDef |
Underflow action on output.
Definition at line
77
of file
em_letimer.h
.
Function Documentation
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.
Definition at line
135
of file
em_letimer.c
.
References LETIMER_TypeDef::COMP0 , and LETIMER_TypeDef::COMP1 .
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).
Definition at line
180
of file
em_letimer.c
.
References _LETIMER_COMP0_COMP0_MASK , _LETIMER_COMP0_COMP0_SHIFT , LETIMER_TypeDef::COMP0 , and LETIMER_TypeDef::COMP1 .
Referenced by LETIMER_TopSet() , and MIC_init() .
__STATIC_INLINE 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.
Definition at line
162
of file
em_letimer.h
.
References LETIMER_TypeDef::CNT .
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.
Definition at line
233
of file
em_letimer.c
.
References LETIMER_TypeDef::CMD , LETIMER_CMD_START , LETIMER_CMD_STOP , LETIMER_SYNCBUSY_CMD , and LETIMER_TypeDef::SYNCBUSY .
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.
- Parameters
-
[in] letimer
A pointer to the LETIMER peripheral register block. [in] init
A pointer to the LETIMER initialization structure.
Definition at line
327
of file
em_letimer.c
.
References _LETIMER_CTRL_REPMODE_SHIFT , _LETIMER_CTRL_UFOA0_SHIFT , _LETIMER_CTRL_UFOA1_SHIFT , LETIMER_Init_TypeDef::bufTop , LETIMER_TypeDef::CMD , LETIMER_TypeDef::COMP0 , LETIMER_Init_TypeDef::comp0Top , LETIMER_TypeDef::CTRL , LETIMER_Init_TypeDef::debugRun , LETIMER_Init_TypeDef::enable , LETIMER_CMD_START , LETIMER_CMD_STOP , LETIMER_CTRL_BUFTOP , LETIMER_CTRL_COMP0TOP , LETIMER_CTRL_DEBUGRUN , LETIMER_CTRL_OPOL0 , LETIMER_CTRL_OPOL1 , LETIMER_STATUS_RUNNING , LETIMER_SYNCBUSY_CMD , LETIMER_Init_TypeDef::out0Pol , LETIMER_Init_TypeDef::out1Pol , LETIMER_Init_TypeDef::repMode , LETIMER_TypeDef::STATUS , LETIMER_TypeDef::SYNCBUSY , LETIMER_Init_TypeDef::topValue , LETIMER_Init_TypeDef::ufoa0 , and LETIMER_Init_TypeDef::ufoa1 .
Referenced by MIC_init() .
__STATIC_INLINE void LETIMER_IntClear | ( | LETIMER_TypeDef * |
letimer,
|
uint32_t |
flags
|
||
) |
Clear one or more pending LETIMER interrupts.
- Parameters
-
[in] letimer
Pointer to LETIMER peripheral register block. [in] flags
Pending LETIMER interrupt source to clear. Use a bitwise logic OR combination of valid interrupt flags for the LETIMER module (LETIMER_IF_nnn).
Definition at line
185
of file
em_letimer.h
.
References LETIMER_TypeDef::IFC .
Referenced by LETIMER_Reset() .
__STATIC_INLINE void LETIMER_IntDisable | ( | LETIMER_TypeDef * |
letimer,
|
uint32_t |
flags
|
||
) |
Disable one or more LETIMER interrupts.
- Parameters
-
[in] letimer
Pointer to LETIMER peripheral register block. [in] flags
LETIMER interrupt sources to disable. Use a bitwise logic OR combination of valid interrupt flags for the LETIMER module (LETIMER_IF_nnn).
Definition at line
205
of file
em_letimer.h
.
References LETIMER_TypeDef::IEN .
__STATIC_INLINE void LETIMER_IntEnable | ( | LETIMER_TypeDef * |
letimer,
|
uint32_t |
flags
|
||
) |
Enable one or more LETIMER interrupts.
- Note
- Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. To ignore a pending interrupt, consider using LETIMER_IntClear() prior to enabling the interrupt.
- Parameters
-
[in] letimer
Pointer to the LETIMER peripheral register block. [in] flags
LETIMER interrupt sources to enable. Use a bitwise logic OR combination of valid interrupt flags for the LETIMER module (LETIMER_IF_nnn).
Definition at line
226
of file
em_letimer.h
.
References LETIMER_TypeDef::IEN .
__STATIC_INLINE uint32_t LETIMER_IntGet | ( | LETIMER_TypeDef * |
letimer
|
) |
Get pending LETIMER interrupt flags.
- Note
- Event bits are not cleared by the use of this function.
- Parameters
-
[in] letimer
Pointer to LETIMER peripheral register block.
- Returns
- LETIMER interrupt sources pending. A bitwise logic OR combination of valid interrupt flags for the LETIMER module (LETIMER_IF_nnn).
Definition at line
245
of file
em_letimer.h
.
References LETIMER_TypeDef::IF .
__STATIC_INLINE uint32_t LETIMER_IntGetEnabled | ( | LETIMER_TypeDef * |
letimer
|
) |
Get enabled and pending LETIMER interrupt flags.
Useful for handling more interrupt sources in the same interrupt handler.
- Note
- Event bits are not cleared by the use of this function.
- Parameters
-
[in] letimer
Pointer to LETIMER peripheral register block.
- Returns
-
Pending and enabled LETIMER interrupt sources. Return value is the bitwise AND combination of
- the OR combination of enabled interrupt sources in LETIMER_IEN_nnn register (LETIMER_IEN_nnn) and
- the OR combination of valid interrupt flags of the LETIMER module (LETIMER_IF_nnn).
Definition at line
271
of file
em_letimer.h
.
References LETIMER_TypeDef::IEN , and LETIMER_TypeDef::IF .
__STATIC_INLINE void LETIMER_IntSet | ( | LETIMER_TypeDef * |
letimer,
|
uint32_t |
flags
|
||
) |
Set one or more pending LETIMER interrupts from SW.
- Parameters
-
[in] letimer
Pointer to LETIMER peripheral register block. [in] flags
LETIMER interrupt sources to set to pending. Use a bitwise logic OR combination of valid interrupt flags for the LETIMER module (LETIMER_IF_nnn).
Definition at line
294
of file
em_letimer.h
.
References LETIMER_TypeDef::IFS .
uint32_t LETIMER_RepeatGet | ( | LETIMER_TypeDef * |
letimer,
|
unsigned int |
rep
|
||
) |
Get the LETIMER repeat register value.
- Parameters
-
[in] letimer
A pointer to the LETIMER peripheral register block. [in] rep
Repeat register to get, either 0 or 1.
- Returns
- Repeat register value, 0 if invalid register selected.
Definition at line
423
of file
em_letimer.c
.
References LETIMER_TypeDef::REP0 , and LETIMER_TypeDef::REP1 .
void LETIMER_RepeatSet | ( | LETIMER_TypeDef * |
letimer,
|
unsigned int |
rep,
|
||
uint32_t |
value
|
||
) |
Set the LETIMER repeat counter register value.
- Note
- The setting of a repeat counter 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] rep
Repeat counter register to set, either 0 or 1. [in] value
An initialization value (<= 0x0000ffff).
Definition at line
468
of file
em_letimer.c
.
References _LETIMER_REP0_REP0_MASK , _LETIMER_REP0_REP0_SHIFT , LETIMER_TypeDef::REP0 , and LETIMER_TypeDef::REP1 .
Referenced by MIC_init() .
void LETIMER_Reset | ( | LETIMER_TypeDef * |
letimer
|
) |
Reset LETIMER to the same state that it was in after a hardware reset.
- Note
- The ROUTE register is NOT reset by this function to allow for a centralized setup of this feature.
- Parameters
-
[in] letimer
A pointer to the LETIMER peripheral register block.
Definition at line
522
of file
em_letimer.c
.
References _LETIMER_COMP0_RESETVALUE , _LETIMER_COMP1_RESETVALUE , _LETIMER_CTRL_RESETVALUE , _LETIMER_IEN_RESETVALUE , _LETIMER_IF_MASK , _LETIMER_REP0_RESETVALUE , _LETIMER_REP1_RESETVALUE , _LETIMER_SYNCBUSY_MASK , LETIMER_TypeDef::CMD , LETIMER_TypeDef::COMP0 , LETIMER_TypeDef::COMP1 , LETIMER_TypeDef::CTRL , LETIMER_TypeDef::IEN , LETIMER0 , LETIMER_CMD_CLEAR , LETIMER_CMD_CTO0 , LETIMER_CMD_CTO1 , LETIMER_CMD_STOP , LETIMER_IntClear() , LETIMER_TypeDef::REP0 , and LETIMER_TypeDef::REP1 .
__STATIC_INLINE uint32_t LETIMER_TopGet | ( | LETIMER_TypeDef * |
letimer
|
) |
Get the current LETIMER top value.
- Parameters
-
[in] letimer
A pointer to the LETIMER peripheral register block.
- Returns
- The top value. This will be a 16 bit value on series-0 and series-1 devices and a 24 bit value on series-2 devices.
Definition at line
322
of file
em_letimer.h
.
References LETIMER_TypeDef::COMP0 .
void LETIMER_TopSet | ( | LETIMER_TypeDef * |
letimer,
|
uint32_t |
value
|
||
) |
Set the LETIMER top value.
- Note
- The LETIMER is a down-counter, so when the counter reaches 0 then the top value will be loaded into the counter. This function can be used to set the top value.
If the LETIMER is not already configured to use a top value then this function will enable that functionality for the user.
- Parameters
-
[in] letimer
A pointer to the LETIMER peripheral register block. [in] value
The top value. This can be a 16 bit value on series-0 and series-1 devices and a 24 bit value on series-2 devices.
Definition at line
592
of file
em_letimer.c
.
References LETIMER_TypeDef::CTRL , LETIMER_CompareSet() , LETIMER_CTRL_COMP0TOP , and LETIMER_SyncWait() .