ACMP - Analog Comparator#

Analog comparator (ACMP) Peripheral API.

The Analog Comparator is used to compare voltage of two analog inputs with a digital output indicating which input voltage is higher. Inputs can either be one of the selectable internal references or from external pins. Response time and current consumption can be configured by altering the current supply to the comparator.

ACMP is available down to EM3 and is able to wake up the system when input signals pass a certain threshold. Use ACMP_IntEnable() to enable an edge interrupt to use this functionality.

This example shows how to use the em_acmp.h API for comparing an input pin to an internal 2.5 V reference voltage.

/* Initialize with default settings. */
ACMP_Init_TypeDef init = ACMP_INIT_DEFAULT;
ACMP_Init(ACMP0, &init);

/* In this example we want to compare an analog input to the 2.5 V
 * internal reference. The default settings resets the divider for
 * acmpInputVREFDIV2V5, which we can use as a 2.5 V reference. */

/* Now we select the two inputs to compare. Here we compare the acmpInputPD2
 * input to the internal 2.5V reference. When acmpInputPD2 is lower than
 * 2.5 V then the ACMP output is 0 and when acmpInputPD2 is is higher than
 * 2.5 V then the ACMP output is 1. */
ACMP_ChannelSet(ACMP0, acmpInputVREFDIV2V5, acmpInputPD2);

/* Allocate CDEVEN0 to ACMP0 to be able to use the input. */
GPIO->CDBUSALLOC = GPIO_CDBUSALLOC_CDEVEN0_ACMP0;

/* To be able to probe the output we can send the ACMP output to a pin.
 * The second argument to this function is the pin location which is
 * device dependent. */
ACMP_GPIOSetup(ACMP0, gpioPortD, 1, true, false);

Note

  • ACMP can also be used to compare two separate input pins.

ACMP also contains specialized hardware for capacitive sensing. This module contains the ACMP_CapsenseInit() function to initialize ACMP for capacitive sensing and the ACMP_CapsenseChannelSet() function to select the current capsense channel.

For applications that require capacitive sensing it is recommended to use a library, such as cslib, which is provided by Silicon Labs.

Modules#

ACMP_CapsenseInit_TypeDef

ACMP_Init_TypeDef

Enumerations#

enum
acmpResistor0 = _ACMP_INPUTCTRL_CSRESSEL_RES0
acmpResistor1 = _ACMP_INPUTCTRL_CSRESSEL_RES1
acmpResistor2 = _ACMP_INPUTCTRL_CSRESSEL_RES2
acmpResistor3 = _ACMP_INPUTCTRL_CSRESSEL_RES3
acmpResistor4 = _ACMP_INPUTCTRL_CSRESSEL_RES4
acmpResistor5 = _ACMP_INPUTCTRL_CSRESSEL_RES5
acmpResistor6 = _ACMP_INPUTCTRL_CSRESSEL_RES6
}

Resistor values used for the internal capacitive sense resistor.

enum
acmpHysteresisDisabled = _ACMP_CFG_HYST_DISABLED
acmpHysteresis10Sym = _ACMP_CFG_HYST_SYM10MV
acmpHysteresis20Sym = _ACMP_CFG_HYST_SYM20MV
acmpHysteresis30Sym = _ACMP_CFG_HYST_SYM30MV
acmpHysteresis10Pos = _ACMP_CFG_HYST_POS10MV
acmpHysteresis20Pos = _ACMP_CFG_HYST_POS20MV
acmpHysteresis30Pos = _ACMP_CFG_HYST_POS30MV
acmpHysteresis10Neg = _ACMP_CFG_HYST_NEG10MV
acmpHysteresis20Neg = _ACMP_CFG_HYST_NEG20MV
acmpHysteresis30Neg = _ACMP_CFG_HYST_NEG30MV
}

Hysteresis level.

enum
acmpInputRangeFull = _ACMP_CFG_INPUTRANGE_FULL
acmpInputRangeReduced = _ACMP_CFG_INPUTRANGE_REDUCED
}

Adjust ACMP performance for a given input voltage range.

enum
acmpAccuracyLow = _ACMP_CFG_ACCURACY_LOW
acmpAccuracyHigh = _ACMP_CFG_ACCURACY_HIGH
}

ACMP accuracy mode.

enum
acmpInputVSS = _ACMP_INPUTCTRL_POSSEL_VSS
acmpInputVREFDIVAVDD = _ACMP_INPUTCTRL_POSSEL_VREFDIVAVDD
acmpInputVREFDIVAVDDLP = _ACMP_INPUTCTRL_POSSEL_VREFDIVAVDDLP
acmpInputVREFDIV1V25 = _ACMP_INPUTCTRL_POSSEL_VREFDIV1V25
acmpInputVREFDIV1V25LP = _ACMP_INPUTCTRL_POSSEL_VREFDIV1V25LP
acmpInputVREFDIV2V5 = _ACMP_INPUTCTRL_POSSEL_VREFDIV2V5
acmpInputVREFDIV2V5LP = _ACMP_INPUTCTRL_POSSEL_VREFDIV2V5LP
acmpInputVSENSE01DIV4 = _ACMP_INPUTCTRL_POSSEL_VSENSE01DIV4
acmpInputVSENSE01DIV4LP = _ACMP_INPUTCTRL_POSSEL_VSENSE01DIV4LP
acmpInputVSENSE11DIV4 = _ACMP_INPUTCTRL_POSSEL_VSENSE11DIV4
acmpInputVSENSE11DIV4LP = _ACMP_INPUTCTRL_POSSEL_VSENSE11DIV4LP
acmpInputCAPSENSE = _ACMP_INPUTCTRL_NEGSEL_CAPSENSE
acmpInputVDACOUT0 = _ACMP_INPUTCTRL_POSSEL_VDACOUT0
acmpInputVDACOUT1 = _ACMP_INPUTCTRL_POSSEL_VDACOUT1
acmpInputEXTPA = _ACMP_INPUTCTRL_POSSEL_EXTPA
acmpInputEXTPB = _ACMP_INPUTCTRL_POSSEL_EXTPB
acmpInputEXTPC = _ACMP_INPUTCTRL_POSSEL_EXTPC
acmpInputEXTPD = _ACMP_INPUTCTRL_POSSEL_EXTPD
acmpInputPA0 = _ACMP_INPUTCTRL_POSSEL_PA0
acmpInputPA1 = _ACMP_INPUTCTRL_POSSEL_PA1
acmpInputPA2 = _ACMP_INPUTCTRL_POSSEL_PA2
acmpInputPA3 = _ACMP_INPUTCTRL_POSSEL_PA3
acmpInputPA4 = _ACMP_INPUTCTRL_POSSEL_PA4
acmpInputPA5 = _ACMP_INPUTCTRL_POSSEL_PA5
acmpInputPA6 = _ACMP_INPUTCTRL_POSSEL_PA6
acmpInputPA7 = _ACMP_INPUTCTRL_POSSEL_PA7
acmpInputPA8 = _ACMP_INPUTCTRL_POSSEL_PA8
acmpInputPA9 = _ACMP_INPUTCTRL_POSSEL_PA9
acmpInputPA10 = _ACMP_INPUTCTRL_POSSEL_PA10
acmpInputPA11 = _ACMP_INPUTCTRL_POSSEL_PA11
acmpInputPA12 = _ACMP_INPUTCTRL_POSSEL_PA12
acmpInputPA13 = _ACMP_INPUTCTRL_POSSEL_PA13
acmpInputPA14 = _ACMP_INPUTCTRL_POSSEL_PA14
acmpInputPA15 = _ACMP_INPUTCTRL_POSSEL_PA15
acmpInputPB0 = _ACMP_INPUTCTRL_POSSEL_PB0
acmpInputPB1 = _ACMP_INPUTCTRL_POSSEL_PB1
acmpInputPB2 = _ACMP_INPUTCTRL_POSSEL_PB2
acmpInputPB3 = _ACMP_INPUTCTRL_POSSEL_PB3
acmpInputPB4 = _ACMP_INPUTCTRL_POSSEL_PB4
acmpInputPB5 = _ACMP_INPUTCTRL_POSSEL_PB5
acmpInputPB6 = _ACMP_INPUTCTRL_POSSEL_PB6
acmpInputPB7 = _ACMP_INPUTCTRL_POSSEL_PB7
acmpInputPB8 = _ACMP_INPUTCTRL_POSSEL_PB8
acmpInputPB9 = _ACMP_INPUTCTRL_POSSEL_PB9
acmpInputPB10 = _ACMP_INPUTCTRL_POSSEL_PB10
acmpInputPB11 = _ACMP_INPUTCTRL_POSSEL_PB11
acmpInputPB12 = _ACMP_INPUTCTRL_POSSEL_PB12
acmpInputPB13 = _ACMP_INPUTCTRL_POSSEL_PB13
acmpInputPB14 = _ACMP_INPUTCTRL_POSSEL_PB14
acmpInputPB15 = _ACMP_INPUTCTRL_POSSEL_PB15
acmpInputPC0 = _ACMP_INPUTCTRL_POSSEL_PC0
acmpInputPC1 = _ACMP_INPUTCTRL_POSSEL_PC1
acmpInputPC2 = _ACMP_INPUTCTRL_POSSEL_PC2
acmpInputPC3 = _ACMP_INPUTCTRL_POSSEL_PC3
acmpInputPC4 = _ACMP_INPUTCTRL_POSSEL_PC4
acmpInputPC5 = _ACMP_INPUTCTRL_POSSEL_PC5
acmpInputPC6 = _ACMP_INPUTCTRL_POSSEL_PC6
acmpInputPC7 = _ACMP_INPUTCTRL_POSSEL_PC7
acmpInputPC8 = _ACMP_INPUTCTRL_POSSEL_PC8
acmpInputPC9 = _ACMP_INPUTCTRL_POSSEL_PC9
acmpInputPC10 = _ACMP_INPUTCTRL_POSSEL_PC10
acmpInputPC11 = _ACMP_INPUTCTRL_POSSEL_PC11
acmpInputPC12 = _ACMP_INPUTCTRL_POSSEL_PC12
acmpInputPC13 = _ACMP_INPUTCTRL_POSSEL_PC13
acmpInputPC14 = _ACMP_INPUTCTRL_POSSEL_PC14
acmpInputPC15 = _ACMP_INPUTCTRL_POSSEL_PC15
acmpInputPD0 = _ACMP_INPUTCTRL_POSSEL_PD0
acmpInputPD1 = _ACMP_INPUTCTRL_POSSEL_PD1
acmpInputPD2 = _ACMP_INPUTCTRL_POSSEL_PD2
acmpInputPD3 = _ACMP_INPUTCTRL_POSSEL_PD3
acmpInputPD4 = _ACMP_INPUTCTRL_POSSEL_PD4
acmpInputPD5 = _ACMP_INPUTCTRL_POSSEL_PD5
acmpInputPD6 = _ACMP_INPUTCTRL_POSSEL_PD6
acmpInputPD7 = _ACMP_INPUTCTRL_POSSEL_PD7
acmpInputPD8 = _ACMP_INPUTCTRL_POSSEL_PD8
acmpInputPD9 = _ACMP_INPUTCTRL_POSSEL_PD9
acmpInputPD10 = _ACMP_INPUTCTRL_POSSEL_PD10
acmpInputPD11 = _ACMP_INPUTCTRL_POSSEL_PD11
acmpInputPD12 = _ACMP_INPUTCTRL_POSSEL_PD12
acmpInputPD13 = _ACMP_INPUTCTRL_POSSEL_PD13
acmpInputPD14 = _ACMP_INPUTCTRL_POSSEL_PD14
acmpInputPD15 = _ACMP_INPUTCTRL_POSSEL_PD15
}

ACMP Input Selection.

Functions#

void
ACMP_CapsenseInit(ACMP_TypeDef *acmp, const ACMP_CapsenseInit_TypeDef *init)

Set up ACMP for use in capacitive sense applications.

void
ACMP_CapsenseChannelSet(ACMP_TypeDef *acmp, ACMP_Channel_TypeDef channel)

Set the ACMP channel used for capacitive sensing.

void
ACMP_ChannelSet(ACMP_TypeDef *acmp, ACMP_Channel_TypeDef negSel, ACMP_Channel_TypeDef posSel)

Set which channels should be used in ACMP comparisons.

void
ACMP_Disable(ACMP_TypeDef *acmp)

Disable ACMP.

void
ACMP_Enable(ACMP_TypeDef *acmp)

Enable ACMP.

void
ACMP_GPIOSetup(ACMP_TypeDef *acmp, GPIO_Port_TypeDef port, unsigned int pin, bool enable, bool invert)

Sets up GPIO output from the ACMP.

void
ACMP_Init(ACMP_TypeDef *acmp, const ACMP_Init_TypeDef *init)

Initialize ACMP.

void
ACMP_Reset(ACMP_TypeDef *acmp)

Reset ACMP to the same state that it was in after a hardware reset.

void
ACMP_IntClear(ACMP_TypeDef *acmp, uint32_t flags)

Clear one or more pending ACMP interrupts.

void
ACMP_IntDisable(ACMP_TypeDef *acmp, uint32_t flags)

Disable one or more ACMP interrupts.

void
ACMP_IntEnable(ACMP_TypeDef *acmp, uint32_t flags)

Enable one or more ACMP interrupts.

uint32_t
ACMP_IntGet(ACMP_TypeDef *acmp)

Get pending ACMP interrupt flags.

uint32_t
ACMP_IntGetEnabled(ACMP_TypeDef *acmp)

Get enabled and pending ACMP interrupt flags.

void
ACMP_IntSet(ACMP_TypeDef *acmp, uint32_t flags)

Set one or more pending ACMP interrupts from software.

ACMP_PortPinToInput(GPIO_Port_TypeDef port, uint8_t pin)

Convert GPIO port/pin to ACMP input selection.

Macros#

#define

A default configuration for capacitive sense mode initialization.

#define

Analog comparator reset value.

#define

Capacitive sense mode configuration default values.

#define

Default configuration for ACMP regular initialization.

Enumeration Documentation#

ACMP_CapsenseResistor_TypeDef#

ACMP_CapsenseResistor_TypeDef

Resistor values used for the internal capacitive sense resistor.

See data sheet for your device for details on each resistor value.

Enumerator
acmpResistor0

Resistor value 0.

acmpResistor1

Resistor value 1.

acmpResistor2

Resistor value 2.

acmpResistor3

Resistor value 3.

acmpResistor4

Resistor value 4.

acmpResistor5

Resistor value 5.

acmpResistor6

Resistor value 6.


Definition at line 57 of file platform/emlib/inc/em_acmp.h

ACMP_HysteresisLevel_TypeDef#

ACMP_HysteresisLevel_TypeDef

Hysteresis level.

See data sheet for your device for details on each level.

Enumerator
acmpHysteresisDisabled

Mode DISABLED for ACMP_CFG.

acmpHysteresis10Sym

Mode HYST10SYM for ACMP_CFG.

acmpHysteresis20Sym

Mode HYST20SYM for ACMP_CFG.

acmpHysteresis30Sym

Mode HYST30SYM for ACMP_CFG.

acmpHysteresis10Pos

Mode HYST10POS for ACMP_CFG.

acmpHysteresis20Pos

Mode HYST20POS for ACMP_CFG.

acmpHysteresis30Pos

Mode HYST30POS for ACMP_CFG.

acmpHysteresis10Neg

Mode HYST10NEG for ACMP_CFG.

acmpHysteresis20Neg

Mode HYST20NEG for ACMP_CFG.

acmpHysteresis30Neg

Mode HYST30NEG for ACMP_CFG.


Definition at line 82 of file platform/emlib/inc/em_acmp.h

ACMP_InputRange_TypeDef#

ACMP_InputRange_TypeDef

Adjust ACMP performance for a given input voltage range.

Enumerator
acmpInputRangeFull

Input can be from 0 to VDD.

acmpInputRangeReduced

Input can be from 0 to VDD-0.7 V.


Definition at line 153 of file platform/emlib/inc/em_acmp.h

ACMP_Accuracy_TypeDef#

ACMP_Accuracy_TypeDef

ACMP accuracy mode.

Enumerator
acmpAccuracyLow

Low-accuracy mode which consumes less current.

acmpAccuracyHigh

High-accuracy mode which consumes more current.


Definition at line 184 of file platform/emlib/inc/em_acmp.h

ACMP_Channel_TypeDef#

ACMP_Channel_TypeDef

ACMP Input Selection.

Enumerator
acmpInputVSS

Select VSS.

acmpInputVREFDIVAVDD

Select Divided AVDD.

acmpInputVREFDIVAVDDLP

Select Low-Power Divided AVDD.

acmpInputVREFDIV1V25

Select Divided 1V25 reference.

acmpInputVREFDIV1V25LP

Select Low-power Divided 1V25 reference.

acmpInputVREFDIV2V5

Select Divided 2V5 reference.

acmpInputVREFDIV2V5LP

Select Low-power Divided 2V5 reference.

acmpInputVSENSE01DIV4

Select VSENSE0 divided by 4.

acmpInputVSENSE01DIV4LP

Select Low-power VSENSE0 divided by 4.

acmpInputVSENSE11DIV4

VSENSE1 divided by 4.

acmpInputVSENSE11DIV4LP

Low-power VSENSE1 divided by 4.

acmpInputCAPSENSE

Select Low-Power Divided AVDD.

acmpInputVDACOUT0

Select VDAC0 channel 0 output.

acmpInputVDACOUT1

Select VDAC0 channel 1 output.

acmpInputEXTPA

Select external interface, base is PA0.

acmpInputEXTPB

Select external interface, base is PB0.

acmpInputEXTPC

Select external interface, base is PC0.

acmpInputEXTPD

Select external interface, base is PD0.

acmpInputPA0

Select Port A Pin0.

acmpInputPA1

Select Port A Pin1.

acmpInputPA2

Select Port A Pin2.

acmpInputPA3

Select Port A Pin3.

acmpInputPA4

Select Port A Pin4.

acmpInputPA5

Select Port A Pin5.

acmpInputPA6

Select Port A Pin6.

acmpInputPA7

Select Port A Pin7.

acmpInputPA8

Select Port A Pin8.

acmpInputPA9

Select Port A Pin9.

acmpInputPA10

Select Port A Pin10.

acmpInputPA11

Select Port A Pin11.

acmpInputPA12

Select Port A Pin12.

acmpInputPA13

Select Port A Pin13.

acmpInputPA14

Select Port A Pin14.

acmpInputPA15

Select Port A Pin15.

acmpInputPB0

Select Port B Pin0.

acmpInputPB1

Select Port B Pin1.

acmpInputPB2

Select Port B Pin2.

acmpInputPB3

Select Port B Pin3.

acmpInputPB4

Select Port B Pin4.

acmpInputPB5

Select Port B Pin5.

acmpInputPB6

Select Port B Pin6.

acmpInputPB7

Select Port B Pin7.

acmpInputPB8

Select Port B Pin8.

acmpInputPB9

Select Port B Pin9.

acmpInputPB10

Select Port B Pin10.

acmpInputPB11

Select Port B Pin11.

acmpInputPB12

Select Port B Pin12.

acmpInputPB13

Select Port B Pin13.

acmpInputPB14

Select Port B Pin14.

acmpInputPB15

Select Port B Pin15.

acmpInputPC0

Select Port C Pin0.

acmpInputPC1

Select Port C Pin1.

acmpInputPC2

Select Port C Pin2.

acmpInputPC3

Select Port C Pin3.

acmpInputPC4

Select Port C Pin4.

acmpInputPC5

Select Port C Pin5.

acmpInputPC6

Select Port C Pin6.

acmpInputPC7

Select Port C Pin7.

acmpInputPC8

Select Port C Pin8.

acmpInputPC9

Select Port C Pin9.

acmpInputPC10

Select Port C Pin10.

acmpInputPC11

Select Port C Pin11.

acmpInputPC12

Select Port C Pin12.

acmpInputPC13

Select Port C Pin13.

acmpInputPC14

Select Port C Pin14.

acmpInputPC15

Select Port C Pin15.

acmpInputPD0

Select Port D Pin0.

acmpInputPD1

Select Port D Pin1.

acmpInputPD2

Select Port D Pin2.

acmpInputPD3

Select Port D Pin3.

acmpInputPD4

Select Port D Pin4.

acmpInputPD5

Select Port D Pin5.

acmpInputPD6

Select Port D Pin6.

acmpInputPD7

Select Port D Pin7.

acmpInputPD8

Select Port D Pin8.

acmpInputPD9

Select Port D Pin9.

acmpInputPD10

Select Port D Pin10.

acmpInputPD11

Select Port D Pin11.

acmpInputPD12

Select Port D Pin12.

acmpInputPD13

Select Port D Pin13.

acmpInputPD14

Select Port D Pin14.

acmpInputPD15

Select Port D Pin15.


Definition at line 274 of file platform/emlib/inc/em_acmp.h

Function Documentation#

ACMP_CapsenseInit#

void ACMP_CapsenseInit (ACMP_TypeDef * acmp, const ACMP_CapsenseInit_TypeDef * init)

Set up ACMP for use in capacitive sense applications.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

[in]init

A pointer to the initialization structure used to configure ACMP for capacitive sensing operation.

This function sets up ACMP for use in capacitive sense applications. To use the capacitive sense functionality in the ACMP, use the PRS output of the ACMP module to count the number of oscillations in the capacitive sense circuit (possibly using a TIMER).

Note

  • A basic example of capacitive sensing can be found in the STK BSP (capsense demo).

  • A call to ACMP_CapsenseInit will enable and disable the ACMP peripheral, which can cause side effects if it was previously set up.


Definition at line 166 of file platform/emlib/src/em_acmp.c

ACMP_CapsenseChannelSet#

void ACMP_CapsenseChannelSet (ACMP_TypeDef * acmp, ACMP_Channel_TypeDef channel)

Set the ACMP channel used for capacitive sensing.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

[in]channel

The ACMP channel to use for capacitive sensing (Possel).

Note

  • A basic example of capacitive sensing can be found in the STK BSP (capsense demo).

  • Can only be called when the peripheral is enabled.


Definition at line 248 of file platform/emlib/src/em_acmp.c

ACMP_ChannelSet#

void ACMP_ChannelSet (ACMP_TypeDef * acmp, ACMP_Channel_TypeDef negSel, ACMP_Channel_TypeDef posSel)

Set which channels should be used in ACMP comparisons.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

N/AnegSel

A channel to use on the negative input to the ACMP.

N/AposSel

A channel to use on the positive input to the ACMP.

Note

  • Can only be called when the peripheral is enabled.

  • If GPIO is used for both posSel and negSel, they cannot both use even or odd pins.


Definition at line 507 of file platform/emlib/src/em_acmp.c

ACMP_Disable#

void ACMP_Disable (ACMP_TypeDef * acmp)

Disable ACMP.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.


Definition at line 286 of file platform/emlib/src/em_acmp.c

ACMP_Enable#

void ACMP_Enable (ACMP_TypeDef * acmp)

Enable ACMP.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.


Definition at line 315 of file platform/emlib/src/em_acmp.c

ACMP_GPIOSetup#

void ACMP_GPIOSetup (ACMP_TypeDef * acmp, GPIO_Port_TypeDef port, unsigned int pin, bool enable, bool invert)

Sets up GPIO output from the ACMP.

Parameters
[in]acmp

Pointer to the ACMP peripheral register block.

N/Aport

The GPIO port to use.

N/Apin

The GPIO pin to use.

N/Aenable

Enable or disable pin output.

N/Ainvert

Invert output.

Note

  • GPIO must be enabled in the CMU before this function call, i.e.

    CMU_ClockEnable(cmuClock_GPIO, true); 

Definition at line 422 of file platform/emlib/src/em_acmp.c

ACMP_Init#

void ACMP_Init (ACMP_TypeDef * acmp, const ACMP_Init_TypeDef * init)

Initialize ACMP.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

[in]init

A pointer to the initialization structure used to configure ACMP.

Note

  • A call to ACMP_Init can cause side effects since it can enable/disable the peripheral.


Definition at line 580 of file platform/emlib/src/em_acmp.c

ACMP_Reset#

void ACMP_Reset (ACMP_TypeDef * acmp)

Reset ACMP to the same state that it was in after a hardware reset.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

Note

  • The GPIO ACMP ROUTE register is NOT reset by this function to allow for centralized setup of this feature.

  • The peripheral may be enabled and disabled during reset.


Definition at line 367 of file platform/emlib/src/em_acmp.c

ACMP_IntClear#

void ACMP_IntClear (ACMP_TypeDef * acmp, uint32_t flags)

Clear one or more pending ACMP interrupts.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

[in]flags

Pending ACMP interrupt source to clear. Use a bitwise logic OR combination of valid interrupt flags for the ACMP module. The flags can be, for instance, ACMP_IFC_EDGE or ACMP_IFC_WARMUP.


Definition at line 993 of file platform/emlib/inc/em_acmp.h

ACMP_IntDisable#

void ACMP_IntDisable (ACMP_TypeDef * acmp, uint32_t flags)

Disable one or more ACMP interrupts.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

[in]flags

ACMP interrupt sources to disable. Use a bitwise logic OR combination of valid interrupt flags for the ACMP module. The flags can be, for instance, ACMP_IEN_EDGE or ACMP_IEN_WARMUP.


Definition at line 1014 of file platform/emlib/inc/em_acmp.h

ACMP_IntEnable#

void ACMP_IntEnable (ACMP_TypeDef * acmp, uint32_t flags)

Enable one or more ACMP interrupts.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

[in]flags

ACMP interrupt sources to enable. Use a bitwise logic OR combination of valid interrupt flags for the ACMP module. The flags can be, for instance, ACMP_IEN_EDGE or ACMP_IEN_WARMUP.

Note

  • Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. Consider using ACMP_IntClear() prior to enabling if a pending interrupt should be ignored.


Definition at line 1036 of file platform/emlib/inc/em_acmp.h

ACMP_IntGet#

uint32_t ACMP_IntGet (ACMP_TypeDef * acmp)

Get pending ACMP interrupt flags.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

Note

  • This function does not clear event bits.

Returns

  • Pending ACMP interrupt sources. A bitwise logic OR combination of valid interrupt flags for the ACMP module. The pending interrupt sources can be, for instance, ACMP_IF_EDGE or ACMP_IF_WARMUP.


Definition at line 1060 of file platform/emlib/inc/em_acmp.h

ACMP_IntGetEnabled#

uint32_t ACMP_IntGetEnabled (ACMP_TypeDef * acmp)

Get enabled and pending ACMP interrupt flags.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

Useful for handling more interrupt sources in the same interrupt handler.

Note

  • This function does not clear interrupt flags.

Returns

  • Pending and enabled ACMP interrupt sources. The return value is the bitwise AND combination of

    • the OR combination of enabled interrupt sources in ACMPx_IEN_nnn register (ACMPx_IEN_nnn) and

    • the OR combination of valid interrupt flags of the ACMP module (ACMPx_IF_nnn).


Definition at line 1084 of file platform/emlib/inc/em_acmp.h

ACMP_IntSet#

void ACMP_IntSet (ACMP_TypeDef * acmp, uint32_t flags)

Set one or more pending ACMP interrupts from software.

Parameters
[in]acmp

A pointer to the ACMP peripheral register block.

[in]flags

ACMP interrupt sources to set as pending. Use a bitwise logic OR combination of valid interrupt flags for the ACMP module. The flags can be, for instance, ACMP_IFS_EDGE or ACMP_IFS_WARMUP.


Definition at line 1108 of file platform/emlib/inc/em_acmp.h

ACMP_PortPinToInput#

ACMP_Channel_TypeDef ACMP_PortPinToInput (GPIO_Port_TypeDef port, uint8_t pin)

Convert GPIO port/pin to ACMP input selection.

Parameters
[in]port

GPIO port

[in]pin

GPIO pin

Returns

  • ACMP input selection


Definition at line 1131 of file platform/emlib/inc/em_acmp.h

Macro Definition Documentation#

PM5507_ACMP_CFG_BIAS_DEFAULT#

#define PM5507_ACMP_CFG_BIAS_DEFAULT
Value:
0x00000004UL

A default configuration for capacitive sense mode initialization.

Analog comparator CFG with initial bias value


Definition at line 696 of file platform/emlib/inc/em_acmp.h

PM5507_ACMP_CFG_RESETVALUE#

#define PM5507_ACMP_CFG_RESETVALUE
Value:
0x00000004UL

Analog comparator reset value.


Definition at line 698 of file platform/emlib/inc/em_acmp.h

ACMP_CAPSENSE_INIT_DEFAULT#

#define ACMP_CAPSENSE_INIT_DEFAULT
Value:
{ \
PM5507_ACMP_CFG_BIAS_DEFAULT, /* Using biasProg default value. */ \
acmpHysteresisDisabled, /* Disable hysteresis. */ \
acmpResistor5, /* Use internal resistor value 5. */ \
0x3F, /* Set VREFDIV to maximum to disable divide. */ \
true /* Enable after init. */ \
}

Capacitive sense mode configuration default values.


Definition at line 701 of file platform/emlib/inc/em_acmp.h

ACMP_INIT_DEFAULT#

#define ACMP_INIT_DEFAULT
Value:
{ \
PM5507_ACMP_CFG_BIAS_DEFAULT, /* Using biasProg default value. */ \
acmpInputRangeFull, /* Input range from 0 to Vdd. */ \
acmpAccuracyLow, /* Low accuracy, less current usage. */ \
acmpHysteresisDisabled, /* Disable hysteresis. */ \
false, /* Output 0 when ACMP is inactive. */ \
0x3F, /* Set VREFDIV to maximum to disable divide. */ \
true /* Enable after init. */ \
}

Default configuration for ACMP regular initialization.


Definition at line 844 of file platform/emlib/inc/em_acmp.h