The MCUXpresso SDK provides a peripheral driver for the Analog comparator (LPC_ACOMP) module of MCUXpresso SDK devices.
Typical use case
Polling Configuration
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/acomp/acomp_basic
Interrupt Configuration
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/acomp/acomp_interrupt
| struct acomp_ladder_config_t |
| Enumerator |
|---|
| kACOMP_LadderRefVoltagePinVDD |
Supply from pin VDD.
|
| kACOMP_LadderRefVoltagePinVDDCMP |
Supply from pin VDDCMP.
|
| Enumerator |
|---|
| kACOMP_InterruptsFallingEdgeEnable |
Enable the falling edge interrupts.
|
| kACOMP_InterruptsRisingEdgeEnable |
Enable the rising edge interrupts.
|
| kACOMP_InterruptsBothEdgesEnable |
Enable the both edges interrupts.
|
| kACOMP_InterruptsDisable |
Disable the interrupts.
|
| Enumerator |
|---|
| kACOMP_HysteresisNoneSelection |
None (the output will switch as the voltages cross).
|
| kACOMP_Hysteresis5MVSelection |
5Mv.
|
| kACOMP_Hysteresis10MVSelection |
10Mv.
|
| kACOMP_Hysteresis15MVSelection |
15Mv.
|
- Parameters
-
| base | ACOMP peripheral base address. |
| config | Pointer to "acomp_config_t" structure. |
| void ACOMP_Deinit |
( |
ACOMP_Type * |
base | ) |
|
- Parameters
-
| base | ACOMP peripheral base address. |
This function initializes the converter configuration structure with available settings. The default values are:
* config->enableSyncToBusClk = false;
* config->hysteresisSelection = kACOMP_hysteresisNoneSelection;
*
In default configuration, the ACOMP's output would be used directly and switch as the voltages cross.
- Parameters
-
| base | ACOMP peripheral base address. |
| config | Pointer to the configuration structure. |
- Parameters
-
| base | ACOMP peripheral base address. |
| enable | Enable/Disable interrupt feature. |
| static bool ACOMP_GetInterruptsStatusFlags |
( |
ACOMP_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
| base | ACOMP peripheral base address. |
- Returns
- Reflect the state ACOMP edge-detect status, true or false.
| static void ACOMP_ClearInterruptsStatusFlags |
( |
ACOMP_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
| base | ACOMP peripheral base address. |
| static bool ACOMP_GetOutputStatusFlags |
( |
ACOMP_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
| base | ACOMP peripheral base address. |
- Returns
- Reflect the state of the comparator output, true or false.
| static void ACOMP_SetInputChannel |
( |
ACOMP_Type * |
base, |
|
|
uint32_t |
postiveInputChannel, |
|
|
uint32_t |
negativeInputChannel |
|
) |
| |
|
inlinestatic |
- Parameters
-
| base | ACOMP peripheral base address. |
| postiveInputChannel | The index of postive input channel. |
| negativeInputChannel | The index of negative input channel. |
- Parameters
-
| base | ACOMP peripheral base address. |
| config | The structure for voltage ladder. If the config is NULL, voltage ladder would be diasbled, otherwise the voltage ladder would be configured and enabled. |
| bool acomp_config_t::enableSyncToBusClk |
If false, Comparator output is used directly.
| uint8_t acomp_ladder_config_t::ladderValue |
00000 = Vss, 00001 = 1*Vref/31, ..., 11111 = Vref.