EFM32 Wonder Gecko Software Documentation
efm32wg-doc-5.1.2
|
Voltage Comparator (VCMP) Peripheral API.
This module contains functions to control the VCMP peripheral of Silicon Labs 32-bit MCUs and SoCs. The VCMP monitors the input voltage supply and generates interrupts on events using as little as 100 nA.
Data Structures | |
struct | VCMP_Init_TypeDef |
Macros | |
#define | VCMP_INIT_DEFAULT |
Enumerations | |
enum | VCMP_Hysteresis_TypeDef { vcmpHystNone, vcmpHyst20mV } |
enum | VCMP_WarmTime_TypeDef { vcmpWarmTime4Cycles = _VCMP_CTRL_WARMTIME_4CYCLES, vcmpWarmTime8Cycles = _VCMP_CTRL_WARMTIME_8CYCLES, vcmpWarmTime16Cycles = _VCMP_CTRL_WARMTIME_16CYCLES, vcmpWarmTime32Cycles = _VCMP_CTRL_WARMTIME_32CYCLES, vcmpWarmTime64Cycles = _VCMP_CTRL_WARMTIME_64CYCLES, vcmpWarmTime128Cycles = _VCMP_CTRL_WARMTIME_128CYCLES, vcmpWarmTime256Cycles = _VCMP_CTRL_WARMTIME_256CYCLES, vcmpWarmTime512Cycles = _VCMP_CTRL_WARMTIME_512CYCLES } |
Functions | |
__STATIC_INLINE void | VCMP_Disable (void) |
Disable Voltage Comparator. | |
__STATIC_INLINE void | VCMP_Enable (void) |
Enable Voltage Comparator. | |
void | VCMP_Init (const VCMP_Init_TypeDef *vcmpInit) |
Configure and enable Voltage Comparator. More... | |
__STATIC_INLINE void | VCMP_IntClear (uint32_t flags) |
Clear one or more pending VCMP interrupts. More... | |
__STATIC_INLINE void | VCMP_IntDisable (uint32_t flags) |
Disable one or more VCMP interrupts. More... | |
__STATIC_INLINE void | VCMP_IntEnable (uint32_t flags) |
Enable one or more VCMP interrupts. More... | |
__STATIC_INLINE uint32_t | VCMP_IntGet (void) |
Get pending VCMP interrupt flags. More... | |
__STATIC_INLINE uint32_t | VCMP_IntGetEnabled (void) |
Get enabled and pending VCMP interrupt flags. More... | |
__STATIC_INLINE void | VCMP_IntSet (uint32_t flags) |
Set one or more pending VCMP interrupts from SW. More... | |
void | VCMP_LowPowerRefSet (bool enable) |
Enable or disable Low Power Reference setting. More... | |
__STATIC_INLINE bool | VCMP_Ready (void) |
VCMP output is ready. | |
void | VCMP_TriggerSet (int level) |
Configure trigger level of voltage comparator. More... | |
__STATIC_INLINE bool | VCMP_VDDHigher (void) |
Returns true, if Voltage Comparator indicated VDD > trigger level, else false. | |
__STATIC_INLINE bool | VCMP_VDDLower (void) |
Returns true, if Voltage Comparator indicated VDD < trigger level, else false. | |
__STATIC_INLINE uint32_t | VCMP_VoltageToLevel (float v) |
Calculate voltage to trigger level. More... | |
#define VCMP_INIT_DEFAULT |
Default VCMP initialization structure
Definition at line 123 of file em_vcmp.h.
Referenced by VDDCHECK_LowVoltage().
Warm-up Time in High Frequency Peripheral Clock cycles
void VCMP_Init | ( | const VCMP_Init_TypeDef * | vcmpInit | ) |
Configure and enable Voltage Comparator.
[in] | vcmpInit | VCMP Initialization structure |
Definition at line 60 of file em_vcmp.c.
References _VCMP_CTRL_BIASPROG_MASK, _VCMP_CTRL_BIASPROG_SHIFT, _VCMP_CTRL_INACTVAL_SHIFT, _VCMP_CTRL_WARMTIME_MASK, _VCMP_CTRL_WARMTIME_SHIFT, VCMP_Init_TypeDef::biasProg, VCMP_Init_TypeDef::enable, VCMP_Init_TypeDef::halfBias, VCMP_Init_TypeDef::hyst, VCMP_Init_TypeDef::inactive, VCMP_Init_TypeDef::irqFalling, VCMP_Init_TypeDef::irqRising, VCMP_Init_TypeDef::lowPowerRef, VCMP_Init_TypeDef::triggerLevel, VCMP, VCMP_CTRL_EN, VCMP_CTRL_HALFBIAS, VCMP_CTRL_HYSTEN, VCMP_CTRL_IFALL, VCMP_CTRL_IRISE, VCMP_IF_EDGE, VCMP_IntClear(), VCMP_LowPowerRefSet(), VCMP_Ready(), VCMP_TriggerSet(), vcmpHyst20mV, vcmpHystNone, and VCMP_Init_TypeDef::warmup.
Referenced by VDDCHECK_LowVoltage().
__STATIC_INLINE void VCMP_IntClear | ( | uint32_t | flags | ) |
Clear one or more pending VCMP interrupts.
[in] | flags | VCMP interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources for the VCMP module (VCMP_IFS_nnn). |
Definition at line 243 of file em_vcmp.h.
References VCMP.
Referenced by VCMP_Init().
__STATIC_INLINE void VCMP_IntDisable | ( | uint32_t | flags | ) |
__STATIC_INLINE void VCMP_IntEnable | ( | uint32_t | flags | ) |
__STATIC_INLINE uint32_t VCMP_IntGet | ( | void | ) |
Get pending VCMP interrupt flags.
Definition at line 305 of file em_vcmp.h.
References VCMP.
__STATIC_INLINE uint32_t VCMP_IntGetEnabled | ( | void | ) |
Get enabled and pending VCMP interrupt flags.
Useful for handling more interrupt sources in the same interrupt handler.
Definition at line 329 of file em_vcmp.h.
References VCMP.
__STATIC_INLINE void VCMP_IntSet | ( | uint32_t | flags | ) |
void VCMP_LowPowerRefSet | ( | bool | enable | ) |
Enable or disable Low Power Reference setting.
[in] | enable | If true, enables low power reference, if false disable low power reference |
Definition at line 155 of file em_vcmp.c.
References VCMP, and VCMP_INPUTSEL_LPREF.
Referenced by VCMP_Init().
void VCMP_TriggerSet | ( | int | level | ) |
Configure trigger level of voltage comparator.
[in] | level | Trigger value, in range 0-63 |
Definition at line 175 of file em_vcmp.c.
References _VCMP_INPUTSEL_TRIGLEVEL_MASK, _VCMP_INPUTSEL_TRIGLEVEL_SHIFT, and VCMP.
Referenced by VCMP_Init().
__STATIC_INLINE uint32_t VCMP_VoltageToLevel | ( | float | v | ) |
Calculate voltage to trigger level.
[in] | v | Voltage Level for trigger |
Definition at line 175 of file em_vcmp.h.
Referenced by VDDCHECK_LowVoltage().