![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a peripheral driver for the Comparator (ACMP) module of MCUXpresso SDK devices.
The ACMP driver is created to help the user better operate the ACMP module. This driver can be considered as a basic comparator with advanced features. The APIs for a basic comparator can make the CMP work as a general comparator, which compares the two input channel's voltage and creates the output of the comparator result immediately. The APIs for advanced feature can be used as the plug-in function based on the basic comparator, and can provide more ways to process the comparator's output.
Example use of ACMP API.
Files | |
file | fsl_acmp.h |
Data Structures | |
struct | acmp_config_t |
Describes ACMP configuration structure. More... | |
Enumerations | |
enum | acmp_channel_t { kACMP_Channel0 = 0U, kACMP_Channel1 = 1U } |
Analog comparator channel. More... | |
enum | acmp_reference_voltage_source_t |
Analog comparator reference voltage source. | |
enum | acmp_hysteresis_t { kACMP_HysteresisDisable = 0U, kACMP_HysteresisEnable = 1U } |
Analog comparator hysteresis status. More... | |
enum | acmp_triger_edge_t |
Analog comparator interrupt triger edge. | |
enum | acmp_reference_voltage_divider_t { kACMP_ReferenceVoltageDivider1 = 1U, kACMP_ReferenceVoltageDivider2, kACMP_ReferenceVoltageDivider3, kACMP_ReferenceVoltageDivider4, kACMP_ReferenceVoltageDivider5, kACMP_ReferenceVoltageDivider6, kACMP_ReferenceVoltageDivider7, kACMP_ReferenceVoltageDivider8, kACMP_ReferenceVoltageDivider9, kACMP_ReferenceVoltageDivider10, kACMP_ReferenceVoltageDivider11, kACMP_ReferenceVoltageDivider12, kACMP_ReferenceVoltageDivider13, kACMP_ReferenceVoltageDivider14, kACMP_ReferenceVoltageDivider15 } |
Analog comparator reference voltage divider. More... | |
Functions | |
void | ACMP_Init (SYSCON_Type *base, const acmp_config_t *config) |
Initializes the ACMP with configuration. More... | |
void | ACMP_Enable (SYSCON_Type *base, acmp_channel_t ch) |
Enable the ACMP module. More... | |
void | ACMP_Disable (SYSCON_Type *base, acmp_channel_t ch) |
Disable the ACMP module. More... | |
void | ACMP_EnableInterrupts (SYSCON_Type *base, acmp_channel_t ch) |
Enables the ACMP interrupt. More... | |
void | ACMP_DisableInterrupts (SYSCON_Type *base, acmp_channel_t ch) |
Disables the ACMP interrupt. More... | |
uint8_t | ACMP_GetValue (SYSCON_Type *base, acmp_channel_t ch) |
Get the ACMP value. More... | |
static void | ACMP_Deinit (SYSCON_Type *base) |
Disable the ACMP module. More... | |
void | ACMP_GetDefaultConfig (acmp_config_t *config) |
Gets the default configuration structure. More... | |
Driver version | |
#define | FSL_ACMP_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
QN ACMP driver version. | |
struct acmp_config_t |
Data Fields | |
acmp_channel_t | ch |
Analog comparator channel. | |
acmp_reference_voltage_source_t | refSrc |
Analog comparator reference voltage source. | |
acmp_reference_voltage_divider_t | refDiv |
Analog comparator reference voltage divider. | |
acmp_hysteresis_t | hystEn |
Analog comparator hysteresis. | |
acmp_triger_edge_t | trigerEdge |
Analog comparator channel. | |
enum acmp_channel_t |
enum acmp_hysteresis_t |
void ACMP_Init | ( | SYSCON_Type * | base, |
const acmp_config_t * | config | ||
) |
This function configures the ACMP module with the user-defined settings.
base | ACMP peripheral base address. |
config | pointer to configuration structure |
void ACMP_Enable | ( | SYSCON_Type * | base, |
acmp_channel_t | ch | ||
) |
This function enable the ACMP module.
base | ACMP peripheral base address. |
ch | Specified the channel to be enabled |
void ACMP_Disable | ( | SYSCON_Type * | base, |
acmp_channel_t | ch | ||
) |
This function disable the ACMP module.
base | ACMP peripheral base address. |
ch | Specified the channel to be disabled |
void ACMP_EnableInterrupts | ( | SYSCON_Type * | base, |
acmp_channel_t | ch | ||
) |
This function enables the ACMP interrupt.
base | ACMP peripheral base address. |
ch | Specified the channel. |
void ACMP_DisableInterrupts | ( | SYSCON_Type * | base, |
acmp_channel_t | ch | ||
) |
This function disables the ACMP interrupt.
base | ACMP peripheral base address. |
ch | Specified the channel |
uint8_t ACMP_GetValue | ( | SYSCON_Type * | base, |
acmp_channel_t | ch | ||
) |
This function get ACMP output value.
base | ACMP peripheral base address. |
ch | Specified the channel |
|
inlinestatic |
This function disable the ACMP module.
base | ACMP peripheral base address. |
void ACMP_GetDefaultConfig | ( | acmp_config_t * | config | ) |
This function initializes the ACMP configuration structure to a default value. The default values are: config->ch = kACMP_Channel0; config->refSrc = kACMP_ReferenceSourceExternalReferenceVoltage; config->hystEn = kACMP_HysteresisDisable; config->trigerEdge = kACMP_TrigerRising; config->refDiv = kACMP_ReferenceVoltageDivider1;
config | Pointer to configuration structure. |