35 #if defined(ACMP_COUNT) && (ACMP_COUNT > 0)
61 #define ACMP_REF_VALID(ref) ((ref) == ACMP0)
62 #elif (ACMP_COUNT == 2)
63 #define ACMP_REF_VALID(ref) (((ref) == ACMP0) || ((ref) == ACMP1))
65 #error Undefined number of analog comparators (ACMP).
70 #if defined(_ACMP_ROUTE_LOCATION_LOC3)
71 #define _ACMP_ROUTE_LOCATION_MAX _ACMP_ROUTE_LOCATION_LOC3
72 #elif defined(_ACMP_ROUTE_LOCATION_LOC2)
73 #define _ACMP_ROUTE_LOCATION_MAX _ACMP_ROUTE_LOCATION_LOC2
74 #elif defined(_ACMP_ROUTE_LOCATION_LOC1)
75 #define _ACMP_ROUTE_LOCATION_MAX _ACMP_ROUTE_LOCATION_LOC1
76 #elif defined(_ACMP_ROUTELOC0_OUTLOC_LOC31)
77 #define _ACMP_ROUTE_LOCATION_MAX _ACMP_ROUTELOC0_OUTLOC_LOC31
79 #error Undefined max route locations
112 EFM_ASSERT(ACMP_REF_VALID(acmp));
115 #if defined(_ACMP_INPUTSEL_VDDLEVEL_MASK)
116 EFM_ASSERT(init->vddLevel < 64);
128 #
if defined(_ACMP_CTRL_HALFBIAS_MASK)
129 | (init->halfBias << _ACMP_CTRL_HALFBIAS_SHIFT)
132 #if defined(_ACMP_CTRL_WARMTIME_MASK)
133 | (init->warmTime << _ACMP_CTRL_WARMTIME_SHIFT)
135 #
if defined(_ACMP_CTRL_HYSTSEL_MASK)
136 | (init->hysteresisLevel << _ACMP_CTRL_HYSTSEL_SHIFT)
143 #if defined(_ACMP_HYSTERESIS0_MASK)
153 #
if defined(_ACMP_INPUTSEL_LPREF_MASK)
154 | (init->lowPowerReferenceEnabled << _ACMP_INPUTSEL_LPREF_SHIFT)
156 #
if defined(_ACMP_INPUTSEL_VDDLEVEL_MASK)
157 | (init->vddLevel << _ACMP_INPUTSEL_VDDLEVEL_SHIFT)
159 #
if defined(ACMP_INPUTSEL_NEGSEL_CAPSENSE)
160 | ACMP_INPUTSEL_NEGSEL_CAPSENSE
188 EFM_ASSERT(ACMP_REF_VALID(acmp));
190 #if defined(_ACMP_INPUTSEL_POSSEL_CH7)
192 EFM_ASSERT(channel <= _ACMP_INPUTSEL_POSSEL_CH7);
193 #elif defined(_ACMP_INPUTSEL_POSSEL_BUS4XCH31)
195 EFM_ASSERT(channel <= _ACMP_INPUTSEL_POSSEL_BUS4XCH31);
213 EFM_ASSERT(ACMP_REF_VALID(acmp));
228 EFM_ASSERT(ACMP_REF_VALID(acmp));
233 #if defined(_ACMP_EXTIFCTRL_MASK)
273 EFM_ASSERT(ACMP_REF_VALID(acmp));
277 #if defined(_ACMP_HYSTERESIS0_HYST_MASK)
308 EFM_ASSERT(ACMP_REF_VALID(acmp));
311 EFM_ASSERT(location <= _ACMP_ROUTE_LOCATION_MAX);
317 #if defined(_ACMP_ROUTE_MASK)
318 acmp->ROUTE = (location << _ACMP_ROUTE_LOCATION_SHIFT)
319 | (enable << _ACMP_ROUTE_ACMPPEN_SHIFT);
321 #if defined(_ACMP_ROUTELOC0_MASK)
344 EFM_ASSERT(ACMP_REF_VALID(acmp));
347 #if defined(_ACMP_INPUTSEL_NEGSEL_DAC0CH1)
348 EFM_ASSERT(negSel <= _ACMP_INPUTSEL_NEGSEL_DAC0CH1);
349 #elif defined(_ACMP_INPUTSEL_NEGSEL_CAPSENSE)
350 EFM_ASSERT(negSel <= _ACMP_INPUTSEL_NEGSEL_CAPSENSE);
353 #if defined(_ACMP_INPUTSEL_POSSEL_CH7)
354 EFM_ASSERT(posSel <= _ACMP_INPUTSEL_POSSEL_CH7);
377 EFM_ASSERT(ACMP_REF_VALID(acmp));
389 #
if defined(_ACMP_CTRL_HALFBIAS_MASK)
390 | (init->halfBias << _ACMP_CTRL_HALFBIAS_SHIFT)
395 #if defined(_ACMP_CTRL_INPUTRANGE_MASK)
404 #
if defined(_ACMP_CTRL_WARMTIME_MASK)
405 | (init->warmTime << _ACMP_CTRL_WARMTIME_SHIFT)
407 #
if defined(_ACMP_CTRL_HYSTSEL_MASK)
408 | (init->hysteresisLevel << _ACMP_CTRL_HYSTSEL_SHIFT)
416 #
if defined(_ACMP_INPUTSEL_LPREF_MASK)
417 | (init->lowPowerReferenceEnabled << _ACMP_INPUTSEL_LPREF_SHIFT)
419 #
if defined(_ACMP_INPUTSEL_VDDLEVEL_MASK)
420 | (init->vddLevel << _ACMP_INPUTSEL_VDDLEVEL_SHIFT)
428 #if defined(_ACMP_INPUTSEL_VASEL_MASK)
442 EFM_ASSERT(vaconfig->
div0 < 64);
443 EFM_ASSERT(vaconfig->
div1 < 64);
454 #if defined(_ACMP_INPUTSEL_VBSEL_MASK)
468 EFM_ASSERT(vbconfig->
div0 < 64);
469 EFM_ASSERT(vbconfig->
div1 < 64);
ACMP_HysteresisLevel_TypeDef hysteresisLevel_1
void ACMP_VASetup(ACMP_TypeDef *acmp, const ACMP_VAConfig_TypeDef *vaconfig)
Setup the VA Source.
#define _ACMP_INPUTSEL_VLPSEL_SHIFT
ACMP_CapsenseResistor_TypeDef resistor
#define _ACMP_INPUTSEL_NEGSEL_MASK
#define _ACMP_INPUTSEL_VLPSEL_MASK
#define _ACMP_CTRL_INACTVAL_SHIFT
void ACMP_Disable(ACMP_TypeDef *acmp)
Disables the ACMP.
#define _ACMP_HYSTERESIS0_DIVVA_MASK
#define _ACMP_INPUTSEL_POSSEL_MASK
#define _ACMP_INPUTSEL_NEGSEL_SHIFT
Emlib peripheral API "assert" implementation.
void ACMP_VBSetup(ACMP_TypeDef *acmp, const ACMP_VBConfig_TypeDef *vbconfig)
Setup the VB Source.
ACMP_ExternalInput_Typedef
#define _ACMP_INPUTSEL_VASEL_MASK
#define _ACMP_INPUTSEL_CSRESSEL_SHIFT
RAM and peripheral bit-field set and clear API.
#define _ACMP_HYSTERESIS1_RESETVALUE
#define ACMP_INPUTSEL_NEGSEL_VADIV
ACMP_InputRange_TypeDef inputRange
#define _ACMP_HYSTERESIS0_HYST_SHIFT
void ACMP_CapsenseChannelSet(ACMP_TypeDef *acmp, ACMP_Channel_TypeDef channel)
Sets the ACMP channel used for capacative sensing.
ACMP_VLPInput_Typedef vlpInput
bool interruptOnRisingEdge
ACMP_PowerSource_TypeDef powerSource
void ACMP_ExternalInputSelect(ACMP_TypeDef *acmp, ACMP_ExternalInput_Typedef aport)
Select and enable an external input.
#define _ACMP_INPUTSEL_VASEL_SHIFT
#define _ACMP_CTRL_GPIOINV_SHIFT
#define ACMP_CTRL_ACCURACY_HIGH
#define _ACMP_INPUTSEL_VBSEL_SHIFT
#define _ACMP_ROUTELOC0_OUTLOC_SHIFT
#define _ACMP_HYSTERESIS1_HYST_SHIFT
void ACMP_Enable(ACMP_TypeDef *acmp)
Enables the ACMP.
#define _ACMP_CTRL_IFALL_SHIFT
ACMP_VBInput_TypeDef input
#define ACMP_INPUTSEL_CSRESEN
#define _ACMP_CTRL_GPIOINV_MASK
#define _ACMP_CTRL_PWRSEL_SHIFT
#define _ACMP_HYSTERESIS0_DIVVB_SHIFT
ACMP_VAInput_TypeDef input
#define _ACMP_IEN_RESETVALUE
__IOM uint32_t HYSTERESIS0
void ACMP_ChannelSet(ACMP_TypeDef *acmp, ACMP_Channel_TypeDef negSel, ACMP_Channel_TypeDef posSel)
Sets which channels should be used in ACMP comparisons.
#define _ACMP_HYSTERESIS1_DIVVB_SHIFT
void ACMP_CapsenseInit(ACMP_TypeDef *acmp, const ACMP_CapsenseInit_TypeDef *init)
Sets up the ACMP for use in capacative sense applications.
void ACMP_Reset(ACMP_TypeDef *acmp)
Reset ACMP to same state as after a HW reset.
#define _ACMP_CTRL_ACCURACY_MASK
#define _ACMP_CTRL_BIASPROG_MASK
ACMP_Accuracy_TypeDef accuracy
#define ACMP_EXTIFCTRL_EN
#define ACMP_INPUTSEL_VASEL_VDD
Analog Comparator (ACMP) peripheral API.
#define _ACMP_HYSTERESIS1_DIVVB_MASK
#define _ACMP_HYSTERESIS1_DIVVA_MASK
#define _ACMP_INPUTSEL_RESETVALUE
#define _ACMP_HYSTERESIS0_RESETVALUE
#define _ACMP_CTRL_BIASPROG_SHIFT
#define _ACMP_INPUTSEL_POSSEL_SHIFT
#define _ACMP_CTRL_PWRSEL_MASK
#define _ACMP_EXTIFCTRL_APORTSEL_SHIFT
__STATIC_INLINE void BUS_RegMaskedWrite(volatile uint32_t *addr, uint32_t mask, uint32_t val)
Perform peripheral register masked clear and value write.
bool interruptOnFallingEdge
ACMP_HysteresisLevel_TypeDef hysteresisLevel_0
#define ACMP_STATUS_EXTIFACT
#define _ACMP_CTRL_INPUTRANGE_SHIFT
#define _ACMP_CTRL_RESETVALUE
__STATIC_INLINE void BUS_RegBitWrite(volatile uint32_t *addr, unsigned int bit, unsigned int val)
Perform a single-bit write operation on a peripheral register.
#define _ACMP_CTRL_ACCURACY_SHIFT
#define _ACMP_CTRL_IRISE_SHIFT
#define _ACMP_HYSTERESIS0_DIVVB_MASK
void ACMP_Init(ACMP_TypeDef *acmp, const ACMP_Init_TypeDef *init)
Initialize ACMP.
#define _ACMP_HYSTERESIS0_DIVVA_SHIFT
#define _ACMP_CTRL_EN_SHIFT
#define _ACMP_CTRL_FULLBIAS_SHIFT
#define _ACMP_INPUTSEL_VBSEL_MASK
void ACMP_GPIOSetup(ACMP_TypeDef *acmp, uint32_t location, bool enable, bool invert)
Sets up GPIO output from the ACMP.
#define _ACMP_HYSTERESIS1_DIVVA_SHIFT
#define ACMP_ROUTEPEN_OUTPEN
__IOM uint32_t HYSTERESIS1