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.
/* The ACMP is a high-frequency peripheral so we need to enable
* both the HFPER clock and the ACMP0 clock. */
CMU_ClockEnable(cmuClock_HFPER, true);
CMU_ClockEnable(cmuClock_ACMP0, true);
/* Initialize with default settings. */
ACMP_Init_TypeDef init = ACMP_INIT_DEFAULT;
init.enable = false;
ACMP_Init(ACMP0, &init);
/* In this example we want to compare an analog input to the 2.5 V
* internal reference. To achieve this we first have to configure the
* VB source which is used for internal reference voltages. */
ACMP_VBConfig_TypeDef vbconfig = ACMP_VBCONFIG_DEFAULT;
vbconfig.input = acmpVBInput2V5;
ACMP_VBSetup(ACMP0, &vbconfig);
/* Now we select the two inputs to compare. Here we compare the APORT0XCH0
* input to the internal 2.5V reference that we previously configured. When
* APORT0XCH0 is lower than 2.5 V then the ACMP output is 0 and when
* APORT0XCH0 is is higher than 2.5 V then the ACMP output is 1. */
ACMP_ChannelSet(ACMP0, acmpInputVBDIV, acmpInputAPORT0XCH0);
/* 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, 0, true, false);
/* Finally we enable the ACMP. */
ACMP_Enable(ACMP0);
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#
Enumerations#
Resistor values used for the internal capacitive sense resistor.
Hysteresis level.
Adjust ACMP performance for a given input voltage range.
ACMP Power source.
ACMP accuracy mode.
ACMP input to the VA divider.
ACMP input to the VB divider.
ACMP Low-Power Input Selection.
ACMP Input Selection.
ACMP external input select.
Functions#
Set up ACMP for use in capacitive sense applications.
Set the ACMP channel used for capacitive sensing.
Disable ACMP.
Enable ACMP.
Select and enable external input.
Reset ACMP to the same state that it was in after a hardware reset.
Set up GPIO output from ACMP.
Set which channels should be used in ACMP comparisons.
Initialize ACMP.
Set up the VA source.
Set up the VB Source.
Clear one or more pending ACMP interrupts.
Disable one or more ACMP interrupts.
Enable one or more ACMP interrupts.
Get pending ACMP interrupt flags.
Get enabled and pending ACMP interrupt flags.
Set one or more pending ACMP interrupts from software.
Macros#
A default configuration for capacitive sense mode initialization.
Default configuration for ACMP regular initialization.
VA default configuration.
VB default configuration.
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. |
acmpResistor7 | Resistor value 7. |
ACMP_HysteresisLevel_TypeDef#
ACMP_HysteresisLevel_TypeDef
Hysteresis level.
See data sheet for your device for details on each level.
Enumerator | |
---|---|
acmpHysteresisLevel0 | Hysteresis level 0. |
acmpHysteresisLevel1 | Hysteresis level 1. |
acmpHysteresisLevel2 | Hysteresis level 2. |
acmpHysteresisLevel3 | Hysteresis level 3. |
acmpHysteresisLevel4 | Hysteresis level 4. |
acmpHysteresisLevel5 | Hysteresis level 5. |
acmpHysteresisLevel6 | Hysteresis level 6. |
acmpHysteresisLevel7 | Hysteresis level 7. |
acmpHysteresisLevel8 | Hysteresis level 8. |
acmpHysteresisLevel9 | Hysteresis level 9. |
acmpHysteresisLevel10 | Hysteresis level 10. |
acmpHysteresisLevel11 | Hysteresis level 11. |
acmpHysteresisLevel12 | Hysteresis level 12. |
acmpHysteresisLevel13 | Hysteresis level 13. |
acmpHysteresisLevel14 | Hysteresis level 14. |
acmpHysteresisLevel15 | Hysteresis level 15. |
ACMP_InputRange_TypeDef#
ACMP_InputRange_TypeDef
Adjust ACMP performance for a given input voltage range.
Enumerator | |
---|---|
acmpInputRangeFull | Input can be from 0 to VDD. |
acmpInputRangeHigh | Input will always be greater than VDD/2. |
acmpInputRangeLow | Input will always be less than VDD/2. |
ACMP_PowerSource_TypeDef#
ACMP_PowerSource_TypeDef
ACMP Power source.
Enumerator | |
---|---|
acmpPowerSourceAvdd | Power ACMP using the AVDD supply. |
acmpPowerSourceDvdd | Power ACMP using the DVDD supply. |
acmpPowerSourceIOVdd0 | Power ACMP using the IOVDD/IOVDD0 supply. |
acmpPowerSourceIOVdd1 | Power ACMP using the IOVDD1 supply (if the part has two I/O voltages). |
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. |
ACMP_VAInput_TypeDef#
ACMP_VAInput_TypeDef
ACMP input to the VA divider.
This enumeration is used to select the input for the VA Divider.
Enumerator | |
---|---|
acmpVAInputVDD | Select VDD for the VA divider. |
acmpVAInputAPORT2YCH0 | Select APORT2Y CHannel 0 for the VA divider. |
acmpVAInputAPORT2YCH2 | Select APORT2Y CHannel 2 for the VA divider. |
acmpVAInputAPORT2YCH4 | Select APORT2Y CHannel 4 for the VA divider. |
acmpVAInputAPORT2YCH6 | Select APORT2Y CHannel 6 for the VA divider. |
acmpVAInputAPORT2YCH8 | Select APORT2Y CHannel 8 for the VA divider. |
acmpVAInputAPORT2YCH10 | Select APORT2Y CHannel 10 for the VA divider. |
acmpVAInputAPORT2YCH12 | Select APORT2Y CHannel 12 for the VA divider. |
acmpVAInputAPORT2YCH14 | Select APORT2Y CHannel 14 for the VA divider. |
acmpVAInputAPORT2YCH16 | Select APORT2Y CHannel 16 for the VA divider. |
acmpVAInputAPORT2YCH18 | Select APORT2Y CHannel 18 for the VA divider. |
acmpVAInputAPORT2YCH20 | Select APORT2Y CHannel 20 for the VA divider. |
acmpVAInputAPORT2YCH22 | Select APORT2Y CHannel 22 for the VA divider. |
acmpVAInputAPORT2YCH24 | Select APORT2Y CHannel 24 for the VA divider. |
acmpVAInputAPORT2YCH26 | Select APORT2Y CHannel 26 for the VA divider. |
acmpVAInputAPORT2YCH28 | Select APORT2Y CHannel 28 for the VA divider. |
acmpVAInputAPORT2YCH30 | Select APORT2Y CHannel 30 for the VA divider. |
acmpVAInputAPORT1XCH0 | Select APORT1X CHannel 0 for the VA divider. |
acmpVAInputAPORT1YCH1 | Select APORT1Y CHannel 1 for the VA divider. |
acmpVAInputAPORT1XCH2 | Select APORT1X CHannel 2 for the VA divider. |
acmpVAInputAPORT1YCH3 | Select APORT1Y CHannel 3 for the VA divider. |
acmpVAInputAPORT1XCH4 | Select APORT1X CHannel 4 for the VA divider. |
acmpVAInputAPORT1YCH5 | Select APORT1Y CHannel 5 for the VA divider. |
acmpVAInputAPORT1XCH6 | Select APORT1X CHannel 6 for the VA divider. |
acmpVAInputAPORT1YCH7 | Select APORT1Y CHannel 7 for the VA divider. |
acmpVAInputAPORT1XCH8 | Select APORT1X CHannel 8 for the VA divider. |
acmpVAInputAPORT1YCH9 | Select APORT1Y CHannel 9 for the VA divider. |
acmpVAInputAPORT1XCH10 | Select APORT1X CHannel 10 for the VA divider. |
acmpVAInputAPORT1YCH11 | Select APORT1Y CHannel 11 for the VA divider. |
acmpVAInputAPORT1XCH12 | Select APORT1X CHannel 12 for the VA divider. |
acmpVAInputAPORT1YCH13 | Select APORT1Y CHannel 13 for the VA divider. |
acmpVAInputAPORT1XCH14 | Select APORT1X CHannel 14 for the VA divider. |
acmpVAInputAPORT1YCH15 | Select APORT1Y CHannel 15 for the VA divider. |
acmpVAInputAPORT1XCH16 | Select APORT1X CHannel 16 for the VA divider. |
acmpVAInputAPORT1YCH17 | Select APORT1Y CHannel 17 for the VA divider. |
acmpVAInputAPORT1XCH18 | Select APORT1X CHannel 18 for the VA divider. |
acmpVAInputAPORT1YCH19 | Select APORT1Y CHannel 19 for the VA divider. |
acmpVAInputAPORT1XCH20 | Select APORT1X CHannel 20 for the VA divider. |
acmpVAInputAPORT1YCH21 | Select APORT1Y CHannel 21 for the VA divider. |
acmpVAInputAPORT1XCH22 | Select APORT1X CHannel 22 for the VA divider. |
acmpVAInputAPORT1YCH23 | Select APORT1Y CHannel 23 for the VA divider. |
acmpVAInputAPORT1XCH24 | Select APORT1X CHannel 24 for the VA divider. |
acmpVAInputAPORT1YCH25 | Select APORT1Y CHannel 25 for the VA divider. |
acmpVAInputAPORT1XCH26 | Select APORT1X CHannel 26 for the VA divider. |
acmpVAInputAPORT1YCH27 | Select APORT1Y CHannel 27 for the VA divider. |
acmpVAInputAPORT1XCH28 | Select APORT1X CHannel 28 for the VA divider. |
acmpVAInputAPORT1YCH29 | Select APORT1Y CHannel 29 for the VA divider. |
acmpVAInputAPORT1XCH30 | Select APORT1X CHannel 30 for the VA divider. |
acmpVAInputAPORT1YCH31 | Select APORT1Y CHannel 31 for the VA divider. |
ACMP_VBInput_TypeDef#
ACMP_VBInput_TypeDef
ACMP input to the VB divider.
This enumeration is used to select the input for the VB divider.
Enumerator | |
---|---|
acmpVBInput1V25 | Mode 1V25 for ACMP_INPUTSEL. |
acmpVBInput2V5 | Mode 2V5 for ACMP_INPUTSEL. |
ACMP_VLPInput_Typedef#
ACMP_VLPInput_Typedef
ACMP Low-Power Input Selection.
Enumerator | |
---|---|
acmpVLPInputVADIV | Mode VADIV for ACMP_INPUTSEL. |
acmpVLPInputVBDIV | Mode VBDIV for ACMP_INPUTSEL. |
ACMP_Channel_TypeDef#
ACMP_Channel_TypeDef
ACMP Input Selection.
Enumerator | |
---|---|
acmpInputAPORT0XCH0 | Select Dedicated APORT0X CHannel 0. |
acmpInputAPORT0XCH1 | Select Dedicated APORT0X CHannel 1. |
acmpInputAPORT0XCH2 | Select Dedicated APORT0X CHannel 2. |
acmpInputAPORT0XCH3 | Select Dedicated APORT0X CHannel 3. |
acmpInputAPORT0XCH4 | Select Dedicated APORT0X CHannel 4. |
acmpInputAPORT0XCH5 | Select Dedicated APORT0X CHannel 5. |
acmpInputAPORT0XCH6 | Select Dedicated APORT0X CHannel 6. |
acmpInputAPORT0XCH7 | Select Dedicated APORT0X CHannel 7. |
acmpInputAPORT0XCH8 | Select Dedicated APORT0X CHannel 8. |
acmpInputAPORT0XCH9 | Select Dedicated APORT0X CHannel 9. |
acmpInputAPORT0XCH10 | Select Dedicated APORT0X CHannel 10. |
acmpInputAPORT0XCH11 | Select Dedicated APORT0X CHannel 11. |
acmpInputAPORT0XCH12 | Select Dedicated APORT0X CHannel 12. |
acmpInputAPORT0XCH13 | Select Dedicated APORT0X CHannel 13. |
acmpInputAPORT0XCH14 | Select Dedicated APORT0X CHannel 14. |
acmpInputAPORT0XCH15 | Select Dedicated APORT0X CHannel 15. |
acmpInputAPORT0YCH0 | Select Dedicated APORT0Y CHannel 0. |
acmpInputAPORT0YCH1 | Select Dedicated APORT0Y CHannel 1. |
acmpInputAPORT0YCH2 | Select Dedicated APORT0Y CHannel 2. |
acmpInputAPORT0YCH3 | Select Dedicated APORT0Y CHannel 3. |
acmpInputAPORT0YCH4 | Select Dedicated APORT0Y CHannel 4. |
acmpInputAPORT0YCH5 | Select Dedicated APORT0Y CHannel 5. |
acmpInputAPORT0YCH6 | Select Dedicated APORT0Y CHannel 6. |
acmpInputAPORT0YCH7 | Select Dedicated APORT0Y CHannel 7. |
acmpInputAPORT0YCH8 | Select Dedicated APORT0Y CHannel 8. |
acmpInputAPORT0YCH9 | Select Dedicated APORT0Y CHannel 9. |
acmpInputAPORT0YCH10 | Select Dedicated APORT0Y CHannel 10. |
acmpInputAPORT0YCH11 | Select Dedicated APORT0Y CHannel 11. |
acmpInputAPORT0YCH12 | Select Dedicated APORT0Y CHannel 12. |
acmpInputAPORT0YCH13 | Select Dedicated APORT0Y CHannel 13. |
acmpInputAPORT0YCH14 | Select Dedicated APORT0Y CHannel 14. |
acmpInputAPORT0YCH15 | Select Dedicated APORT0Y CHannel 15. |
acmpInputAPORT1XCH0 | Select Dedicated APORT1X CHannel 0. |
acmpInputAPORT1YCH1 | Select Dedicated APORT1Y CHannel 1. |
acmpInputAPORT1XCH2 | Select Dedicated APORT1X CHannel 2. |
acmpInputAPORT1YCH3 | Select Dedicated APORT1Y CHannel 3. |
acmpInputAPORT1XCH4 | Select Dedicated APORT1X CHannel 4. |
acmpInputAPORT1YCH5 | Select Dedicated APORT1Y CHannel 5. |
acmpInputAPORT1XCH6 | Select Dedicated APORT1X CHannel 6. |
acmpInputAPORT1YCH7 | Select Dedicated APORT1Y CHannel 7. |
acmpInputAPORT1XCH8 | Select Dedicated APORT1X CHannel 8. |
acmpInputAPORT1YCH9 | Select Dedicated APORT1Y CHannel 9. |
acmpInputAPORT1XCH10 | Select Dedicated APORT1X CHannel 10. |
acmpInputAPORT1YCH11 | Select Dedicated APORT1Y CHannel 11. |
acmpInputAPORT1XCH12 | Select Dedicated APORT1X CHannel 12. |
acmpInputAPORT1YCH13 | Select Dedicated APORT1Y CHannel 13. |
acmpInputAPORT1XCH14 | Select Dedicated APORT1X CHannel 14. |
acmpInputAPORT1YCH15 | Select Dedicated APORT1Y CHannel 15. |
acmpInputAPORT1XCH16 | Select Dedicated APORT1X CHannel 16. |
acmpInputAPORT1YCH17 | Select Dedicated APORT1Y CHannel 17. |
acmpInputAPORT1XCH18 | Select Dedicated APORT1X CHannel 18. |
acmpInputAPORT1YCH19 | Select Dedicated APORT1Y CHannel 19. |
acmpInputAPORT1XCH20 | Select Dedicated APORT1X CHannel 20. |
acmpInputAPORT1YCH21 | Select Dedicated APORT1Y CHannel 21. |
acmpInputAPORT1XCH22 | Select Dedicated APORT1X CHannel 22. |
acmpInputAPORT1YCH23 | Select Dedicated APORT1Y CHannel 23. |
acmpInputAPORT1XCH24 | Select Dedicated APORT1X CHannel 24. |
acmpInputAPORT1YCH25 | Select Dedicated APORT1Y CHannel 25. |
acmpInputAPORT1XCH26 | Select Dedicated APORT1X CHannel 26. |
acmpInputAPORT1YCH27 | Select Dedicated APORT1Y CHannel 27. |
acmpInputAPORT1XCH28 | Select Dedicated APORT1X CHannel 28. |
acmpInputAPORT1YCH29 | Select Dedicated APORT1Y CHannel 29. |
acmpInputAPORT1XCH30 | Select Dedicated APORT1X CHannel 30. |
acmpInputAPORT1YCH31 | Select Dedicated APORT1Y CHannel 31. |
acmpInputAPORT2YCH0 | Select Dedicated APORT2Y CHannel 0. |
acmpInputAPORT2XCH1 | Select Dedicated APORT2X CHannel 1. |
acmpInputAPORT2YCH2 | Select Dedicated APORT2Y CHannel 2. |
acmpInputAPORT2XCH3 | Select Dedicated APORT2X CHannel 3. |
acmpInputAPORT2YCH4 | Select Dedicated APORT2Y CHannel 4. |
acmpInputAPORT2XCH5 | Select Dedicated APORT2X CHannel 5. |
acmpInputAPORT2YCH6 | Select Dedicated APORT2Y CHannel 6. |
acmpInputAPORT2XCH7 | Select Dedicated APORT2X CHannel 7. |
acmpInputAPORT2YCH8 | Select Dedicated APORT2Y CHannel 8. |
acmpInputAPORT2XCH9 | Select Dedicated APORT2X CHannel 9. |
acmpInputAPORT2YCH10 | Select Dedicated APORT2Y CHannel 10. |
acmpInputAPORT2XCH11 | Select Dedicated APORT2X CHannel 11. |
acmpInputAPORT2YCH12 | Select Dedicated APORT2Y CHannel 12. |
acmpInputAPORT2XCH13 | Select Dedicated APORT2X CHannel 13. |
acmpInputAPORT2YCH14 | Select Dedicated APORT2Y CHannel 14. |
acmpInputAPORT2XCH15 | Select Dedicated APORT2X CHannel 15. |
acmpInputAPORT2YCH16 | Select Dedicated APORT2Y CHannel 16. |
acmpInputAPORT2XCH17 | Select Dedicated APORT2X CHannel 17. |
acmpInputAPORT2YCH18 | Select Dedicated APORT2Y CHannel 18. |
acmpInputAPORT2XCH19 | Select Dedicated APORT2X CHannel 19. |
acmpInputAPORT2YCH20 | Select Dedicated APORT2Y CHannel 20. |
acmpInputAPORT2XCH21 | Select Dedicated APORT2X CHannel 21. |
acmpInputAPORT2YCH22 | Select Dedicated APORT2Y CHannel 22. |
acmpInputAPORT2XCH23 | Select Dedicated APORT2X CHannel 23. |
acmpInputAPORT2YCH24 | Select Dedicated APORT2Y CHannel 24. |
acmpInputAPORT2XCH25 | Select Dedicated APORT2X CHannel 25. |
acmpInputAPORT2YCH26 | Select Dedicated APORT2Y CHannel 26. |
acmpInputAPORT2XCH27 | Select Dedicated APORT2X CHannel 27. |
acmpInputAPORT2YCH28 | Select Dedicated APORT2Y CHannel 28. |
acmpInputAPORT2XCH29 | Select Dedicated APORT2X CHannel 29. |
acmpInputAPORT2YCH30 | Select Dedicated APORT2Y CHannel 30. |
acmpInputAPORT2XCH31 | Select Dedicated APORT2X CHannel 31. |
acmpInputAPORT3XCH0 | Select Dedicated APORT3X CHannel 0. |
acmpInputAPORT3YCH1 | Select Dedicated APORT3Y CHannel 1. |
acmpInputAPORT3XCH2 | Select Dedicated APORT3X CHannel 2. |
acmpInputAPORT3YCH3 | Select Dedicated APORT3Y CHannel 3. |
acmpInputAPORT3XCH4 | Select Dedicated APORT3X CHannel 4. |
acmpInputAPORT3YCH5 | Select Dedicated APORT3Y CHannel 5. |
acmpInputAPORT3XCH6 | Select Dedicated APORT3X CHannel 6. |
acmpInputAPORT3YCH7 | Select Dedicated APORT3Y CHannel 7. |
acmpInputAPORT3XCH8 | Select Dedicated APORT3X CHannel 8. |
acmpInputAPORT3YCH9 | Select Dedicated APORT3Y CHannel 9. |
acmpInputAPORT3XCH10 | Select Dedicated APORT3X CHannel 10. |
acmpInputAPORT3YCH11 | Select Dedicated APORT3Y CHannel 11. |
acmpInputAPORT3XCH12 | Select Dedicated APORT3X CHannel 12. |
acmpInputAPORT3YCH13 | Select Dedicated APORT3Y CHannel 13. |
acmpInputAPORT3XCH14 | Select Dedicated APORT3X CHannel 14. |
acmpInputAPORT3YCH15 | Select Dedicated APORT3Y CHannel 15. |
acmpInputAPORT3XCH16 | Select Dedicated APORT3X CHannel 16. |
acmpInputAPORT3YCH17 | Select Dedicated APORT3Y CHannel 17. |
acmpInputAPORT3XCH18 | Select Dedicated APORT3X CHannel 18. |
acmpInputAPORT3YCH19 | Select Dedicated APORT3Y CHannel 19. |
acmpInputAPORT3XCH20 | Select Dedicated APORT3X CHannel 20. |
acmpInputAPORT3YCH21 | Select Dedicated APORT3Y CHannel 21. |
acmpInputAPORT3XCH22 | Select Dedicated APORT3X CHannel 22. |
acmpInputAPORT3YCH23 | Select Dedicated APORT3Y CHannel 23. |
acmpInputAPORT3XCH24 | Select Dedicated APORT3X CHannel 24. |
acmpInputAPORT3YCH25 | Select Dedicated APORT3Y CHannel 25. |
acmpInputAPORT3XCH26 | Select Dedicated APORT3X CHannel 26. |
acmpInputAPORT3YCH27 | Select Dedicated APORT3Y CHannel 27. |
acmpInputAPORT3XCH28 | Select Dedicated APORT3X CHannel 28. |
acmpInputAPORT3YCH29 | Select Dedicated APORT3Y CHannel 29. |
acmpInputAPORT3XCH30 | Select Dedicated APORT3X CHannel 30. |
acmpInputAPORT3YCH31 | Select Dedicated APORT3Y CHannel 31. |
acmpInputAPORT4YCH0 | Select Dedicated APORT4Y CHannel 0. |
acmpInputAPORT4XCH1 | Select Dedicated APORT4X CHannel 1. |
acmpInputAPORT4YCH2 | Select Dedicated APORT4Y CHannel 2. |
acmpInputAPORT4XCH3 | Select Dedicated APORT4X CHannel 3. |
acmpInputAPORT4YCH4 | Select Dedicated APORT4Y CHannel 4. |
acmpInputAPORT4XCH5 | Select Dedicated APORT4X CHannel 5. |
acmpInputAPORT4YCH6 | Select Dedicated APORT4Y CHannel 6. |
acmpInputAPORT4XCH7 | Select Dedicated APORT4X CHannel 7. |
acmpInputAPORT4YCH8 | Select Dedicated APORT4Y CHannel 8. |
acmpInputAPORT4XCH9 | Select Dedicated APORT4X CHannel 9. |
acmpInputAPORT4YCH10 | Select Dedicated APORT4Y CHannel 10. |
acmpInputAPORT4XCH11 | Select Dedicated APORT4X CHannel 11. |
acmpInputAPORT4YCH12 | Select Dedicated APORT4Y CHannel 12. |
acmpInputAPORT4XCH13 | Select Dedicated APORT4X CHannel 13. |
acmpInputAPORT4YCH16 | Select Dedicated APORT4Y CHannel 14. |
acmpInputAPORT4XCH17 | Select Dedicated APORT4X CHannel 15. |
acmpInputAPORT4YCH18 | Select Dedicated APORT4Y CHannel 16. |
acmpInputAPORT4XCH19 | Select Dedicated APORT4X CHannel 17. |
acmpInputAPORT4YCH20 | Select Dedicated APORT4Y CHannel 18. |
acmpInputAPORT4XCH21 | Select Dedicated APORT4X CHannel 19. |
acmpInputAPORT4YCH22 | Select Dedicated APORT4Y CHannel 20. |
acmpInputAPORT4XCH23 | Select Dedicated APORT4X CHannel 21. |
acmpInputAPORT4YCH24 | Select Dedicated APORT4Y CHannel 22. |
acmpInputAPORT4XCH25 | Select Dedicated APORT4X CHannel 23. |
acmpInputAPORT4YCH26 | Select Dedicated APORT4Y CHannel 24. |
acmpInputAPORT4XCH27 | Select Dedicated APORT4X CHannel 25. |
acmpInputAPORT4YCH28 | Select Dedicated APORT4Y CHannel 26. |
acmpInputAPORT4XCH29 | Select Dedicated APORT4X CHannel 27. |
acmpInputAPORT4YCH30 | Select Dedicated APORT4Y CHannel 28. |
acmpInputAPORT4YCH14 | Select Dedicated APORT4X CHannel 29. |
acmpInputAPORT4XCH15 | Select Dedicated APORT4Y CHannel 30. |
acmpInputAPORT4XCH31 | Select Dedicated APORT4X CHannel 31. |
acmpInputDACOUT0 | Select DAC Channel 0 Output. |
acmpInputDACOUT1 | Select DAC Channel 1 Output. |
acmpInputVLP | Select Low-Power Sampled Voltage. |
acmpInputVBDIV | Select Divided VB Voltage. |
acmpInputVADIV | Select Divided VA Voltage. |
acmpInputVDD | ACMPVDD as selected via PWRSEL. |
acmpInputVSS | Select VSS. |
ACMP_ExternalInput_Typedef#
ACMP_ExternalInput_Typedef
ACMP external input select.
This type is used to select which APORT is used by an external module, such as LESENSE, when it's taking control over the ACMP input.
Enumerator | |
---|---|
acmpExternalInputAPORT0X | Select APORT0X as an external input. |
acmpExternalInputAPORT0Y | Select APORT0Y as an external input. |
acmpExternalInputAPORT1X | Select APORT1X as an external input. |
acmpExternalInputAPORT1Y | Select APORT1Y as an external input. |
acmpExternalInputAPORT1XY | Select APORT1XY as an external input. |
acmpExternalInputAPORT2X | Select APORT2X as an external input. |
acmpExternalInputAPORT2Y | Select APORT2Y as an external input. |
acmpExternalInputAPORT2YX | Select APORT2YX as an external input. |
acmpExternalInputAPORT3X | Select APORT3X as an external input. |
acmpExternalInputAPORT3Y | Select APORT3Y as an external input. |
acmpExternalInputAPORT3XY | Select APORT3XY as an external input. |
acmpExternalInputAPORT4X | Select APORT4X as an external input. |
acmpExternalInputAPORT4Y | Select APORT4Y as an external input. |
acmpExternalInputAPORT4YX | Select APORT4YX as an external input. |
Function Documentation#
ACMP_CapsenseInit#
void ACMP_CapsenseInit (ACMP_TypeDef * acmp, const ACMP_CapsenseInit_TypeDef * init)
Set up ACMP for use in capacitive sense applications.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
const ACMP_CapsenseInit_TypeDef * | [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).
ACMP_CapsenseChannelSet#
void ACMP_CapsenseChannelSet (ACMP_TypeDef * acmp, ACMP_Channel_TypeDef channel)
Set the ACMP channel used for capacitive sensing.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
ACMP_Channel_TypeDef | [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).
ACMP_Disable#
void ACMP_Disable (ACMP_TypeDef * acmp)
Disable ACMP.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
ACMP_Enable#
void ACMP_Enable (ACMP_TypeDef * acmp)
Enable ACMP.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
ACMP_ExternalInputSelect#
void ACMP_ExternalInputSelect (ACMP_TypeDef * acmp, ACMP_ExternalInput_Typedef aport)
Select and enable external input.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
ACMP_ExternalInput_Typedef | [in] | aport | This parameter decides which APORT(s) the ACMP will use when it's controlled by an external module. |
This is used when an external module needs to take control of the ACMP POSSEL field to configure the APORT input for the ACMP. Modules, such as LESENSE, use this to change the ACMP input during a scan sequence.
ACMP_Reset#
void ACMP_Reset (ACMP_TypeDef * acmp)
Reset ACMP to the same state that it was in after a hardware reset.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [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.
ACMP_GPIOSetup#
void ACMP_GPIOSetup (ACMP_TypeDef * acmp, uint32_t location, bool enable, bool invert)
Set up GPIO output from ACMP.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
uint32_t | N/A | location | The pin location to use. See the data sheet for location to pin mappings. |
bool | N/A | enable | Enable or disable pin output. |
bool | N/A | invert | Invert output. |
Note
GPIO must be enabled in the CMU before this function call, i.e.,
CMU_ClockEnable(cmuClock_GPIO, true);
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
ACMP_Channel_TypeDef | N/A | negSel | A channel to use on the negative input to the ACMP. |
ACMP_Channel_TypeDef | N/A | posSel | A channel to use on the positive input to the ACMP. |
ACMP_Init#
void ACMP_Init (ACMP_TypeDef * acmp, const ACMP_Init_TypeDef * init)
Initialize ACMP.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
const ACMP_Init_TypeDef * | [in] | init | A pointer to the initialization structure used to configure ACMP. |
ACMP_VASetup#
void ACMP_VASetup (ACMP_TypeDef * acmp, const ACMP_VAConfig_TypeDef * vaconfig)
Set up the VA source.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
const ACMP_VAConfig_TypeDef * | [in] | vaconfig | A pointer to the structure used to configure the VA source. This structure contains the input source and the 2 divider values. |
ACMP_VBSetup#
void ACMP_VBSetup (ACMP_TypeDef * acmp, const ACMP_VBConfig_TypeDef * vbconfig)
Set up the VB Source.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
const ACMP_VBConfig_TypeDef * | [in] | vbconfig | A pointer to the structure used to configure the VB source. This structure contains the input source and the 2 divider values. |
ACMP_IntClear#
void ACMP_IntClear (ACMP_TypeDef * acmp, uint32_t flags)
Clear one or more pending ACMP interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
uint32_t | [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. |
ACMP_IntDisable#
void ACMP_IntDisable (ACMP_TypeDef * acmp, uint32_t flags)
Disable one or more ACMP interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
uint32_t | [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. |
ACMP_IntEnable#
void ACMP_IntEnable (ACMP_TypeDef * acmp, uint32_t flags)
Enable one or more ACMP interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
uint32_t | [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.
ACMP_IntGet#
uint32_t ACMP_IntGet (ACMP_TypeDef * acmp)
Get pending ACMP interrupt flags.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [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.
ACMP_IntGetEnabled#
uint32_t ACMP_IntGetEnabled (ACMP_TypeDef * acmp)
Get enabled and pending ACMP interrupt flags.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [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).
ACMP_IntSet#
void ACMP_IntSet (ACMP_TypeDef * acmp, uint32_t flags)
Set one or more pending ACMP interrupts from software.
Type | Direction | Argument Name | Description |
---|---|---|---|
ACMP_TypeDef * | [in] | acmp | A pointer to the ACMP peripheral register block. |
uint32_t | [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. |