The MCUXpresso SDK provides a peripheral driver for the Comparator (ACMP) module of MCUXpresso SDK devices.
Typical use case
Normal Configuration
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/acmp
Interrupt Configuration
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/acmp
bool acmp_config_t::enablePinOut |
uint8_t acmp_dac_config_t::DACValue |
Enumerator |
---|
kACMP_HysterisisLevel1 |
ACMP hysterisis is 20mv.
>
|
kACMP_HysterisisLevel2 |
ACMP hysterisis is 30mv.
>
|
Enumerator |
---|
kACMP_VrefSourceVin1 |
The DAC selects Bandgap as the reference.
|
kACMP_VrefSourceVin2 |
The DAC selects VDDA as the reference.
|
Enumerator |
---|
kACMP_OutputFallingInterruptMode |
ACMP interrupt on output falling edge.
>
|
kACMP_OutputRisingInterruptMode |
ACMP interrupt on output rising edge.
>
|
kACMP_OutputBothEdgeInterruptMode |
ACMP interrupt on output falling or rising edge.
>
|
Enumerator |
---|
kACMP_ExternalReference0 |
External reference 0 is selected to as input channel.
>
|
kACMP_ExternalReference1 |
External reference 1 is selected to as input channel.
>
|
kACMP_ExternalReference2 |
External reference 2 is selected to as input channel.
>
|
kACMP_InternalDACOutput |
Internal DAC putput is selected to as input channel.
>
|
Enumerator |
---|
kACMP_InterruptFlag |
ACMP interrupt on output valid edge.
>
|
kACMP_OutputFlag |
The current value of the analog comparator output.
>
|
void ACMP_Init |
( |
ACMP_Type * |
base, |
|
|
const acmp_config_t * |
config |
|
) |
| |
The default configuration can be got by calling ACMP_GetDefaultConfig().
- Parameters
-
base | ACMP peripheral base address. |
config | Pointer to ACMP configuration structure. |
void ACMP_Deinit |
( |
ACMP_Type * |
base | ) |
|
- Parameters
-
base | ACMP peripheral basic address. |
This function initializes the user configuration structure to default value. The default value are: Example:
* config->enablePinOut = false;
*
- Parameters
-
config | Pointer to ACMP configuration structure. |
static void ACMP_Enable |
( |
ACMP_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | ACMP peripheral base address. |
enable | Switcher to enable/disable ACMP module. |
- Parameters
-
base | ACMP peripheral base address. |
mode | Select one interrupt mode to generate interrupt. |
static void ACMP_DisableInterrupt |
( |
ACMP_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | ACMP peripheral base address. |
- Parameters
-
base | ACMP peripheral base address. |
PositiveInput | ACMP Positive Input Select. Refer to "acmp_input_channel_selection_t". |
negativeInout | ACMP Negative Input Select. Refer to "acmp_input_channel_selection_t". |
void ACMP_EnableInputPin |
( |
ACMP_Type * |
base, |
|
|
uint32_t |
mask, |
|
|
bool |
enable |
|
) |
| |
The API controls if the corresponding ACMP external pin can be driven by an analog input
- Parameters
-
base | ACMP peripheral base address. |
mask | The mask of the pin associated with channel ADx. Valid range is AD0:0x1U ~ AD3:0x4U. For example: If enable AD0, AD1 and AD2 pins, mask should be set to 0x7U(0x1 | 0x2 | 0x4). |
enable | Switcher to enable/disable ACMP module. |
static uint8_t ACMP_GetStatusFlags |
( |
ACMP_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | ACMP peripheral base address. |
- Returns
- Flags' mask if indicated flags are asserted. See "_acmp_status_flags".
static void ACMP_ClearInterruptFlags |
( |
ACMP_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | ACMP peripheral base address. |