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)
250 void ACMP_ExternalInputSelect(
ACMP_TypeDef *acmp, ACMP_ExternalInput_Typedef aport)
252 acmp->EXTIFCTRL = (aport << _ACMP_EXTIFCTRL_APORTSEL_SHIFT)
254 while (!(acmp->
STATUS & ACMP_STATUS_EXTIFACT))
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.
ACMP_CapsenseResistor_TypeDef resistor
#define _ACMP_ROUTELOC0_OUTLOC_SHIFT
void ACMP_Disable(ACMP_TypeDef *acmp)
Disables the ACMP.
Emlib peripheral API "assert" implementation.
#define _ACMP_INPUTSEL_NEGSEL_MASK
void ACMP_VBSetup(ACMP_TypeDef *acmp, const ACMP_VBConfig_TypeDef *vbconfig)
Setup the VB Source.
RAM and peripheral bit-field set and clear API.
#define _ACMP_INPUTSEL_POSSEL_SHIFT
ACMP_InputRange_TypeDef inputRange
#define _ACMP_INPUTSEL_POSSEL_MASK
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
#define _ACMP_INPUTSEL_CSRESSEL_SHIFT
#define _ACMP_INPUTSEL_VLPSEL_SHIFT
#define _ACMP_HYSTERESIS1_RESETVALUE
#define _ACMP_IEN_RESETVALUE
#define ACMP_INPUTSEL_CSRESEN
#define _ACMP_HYSTERESIS1_HYST_SHIFT
void ACMP_Enable(ACMP_TypeDef *acmp)
Enables the ACMP.
#define _ACMP_INPUTSEL_VASEL_SHIFT
#define _ACMP_CTRL_IFALL_SHIFT
ACMP_VBInput_TypeDef input
#define _ACMP_CTRL_PWRSEL_SHIFT
#define _ACMP_HYSTERESIS0_DIVVA_MASK
#define _ACMP_HYSTERESIS0_DIVVA_SHIFT
#define _ACMP_INPUTSEL_RESETVALUE
#define ACMP_CTRL_ACCURACY_HIGH
#define _ACMP_INPUTSEL_VLPSEL_MASK
#define _ACMP_CTRL_ACCURACY_MASK
ACMP_VAInput_TypeDef input
__IOM uint32_t HYSTERESIS0
#define _ACMP_HYSTERESIS0_RESETVALUE
#define _ACMP_CTRL_GPIOINV_MASK
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_ROUTEPEN_OUTPEN
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_INPUTSEL_VBSEL_MASK
#define ACMP_INPUTSEL_NEGSEL_VADIV
#define _ACMP_CTRL_PWRSEL_MASK
#define _ACMP_HYSTERESIS0_DIVVB_SHIFT
#define _ACMP_CTRL_EN_SHIFT
#define _ACMP_HYSTERESIS1_DIVVA_SHIFT
#define _ACMP_CTRL_RESETVALUE
ACMP_Accuracy_TypeDef accuracy
#define _ACMP_CTRL_BIASPROG_MASK
#define _ACMP_CTRL_GPIOINV_SHIFT
#define _ACMP_HYSTERESIS0_DIVVB_MASK
#define _ACMP_INPUTSEL_VASEL_MASK
#define _ACMP_CTRL_ACCURACY_SHIFT
#define _ACMP_INPUTSEL_VBSEL_SHIFT
#define _ACMP_CTRL_BIASPROG_SHIFT
#define _ACMP_INPUTSEL_NEGSEL_SHIFT
Analog Comparator (ACMP) peripheral API.
#define _ACMP_CTRL_IRISE_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
#define ACMP_INPUTSEL_VASEL_VDD
#define _ACMP_CTRL_INACTVAL_SHIFT
ACMP_HysteresisLevel_TypeDef hysteresisLevel_0
#define _ACMP_HYSTERESIS1_DIVVA_MASK
#define _ACMP_CTRL_FULLBIAS_SHIFT
#define _ACMP_CTRL_INPUTRANGE_SHIFT
__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.
void ACMP_Init(ACMP_TypeDef *acmp, const ACMP_Init_TypeDef *init)
Initialize ACMP.
#define _ACMP_HYSTERESIS0_HYST_SHIFT
#define _ACMP_HYSTERESIS1_DIVVB_MASK
void ACMP_GPIOSetup(ACMP_TypeDef *acmp, uint32_t location, bool enable, bool invert)
Sets up GPIO output from the ACMP.
#define _ACMP_HYSTERESIS1_DIVVB_SHIFT
__IOM uint32_t HYSTERESIS1