MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.
Driver Overview | |
CMP Peripheral and Driver Overview | |
Content including 1) peripheral features, work logic and work method; 2) driver design logic and use method; 3) typical use case. | |
The Driver Change Log | |
The current cmp driver version is 2.0.0. | |
Data Structures | |
struct | cmp_dac_config_t |
CMP internal DAC configuration structure. More... | |
union | cmp_dma_interrupt_config_t |
CMP dma/interrupt configure union. More... | |
struct | cmp_config_t |
CMP configuration structure. More... | |
Driver version | |
#define | FSL_CMP_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
CMP driver version 2.0.0. More... | |
CMP Initialization and de-initialization interfaces | |
void | CMP_GetDefaultConfig (cmp_config_t *psConfig) |
Initializes the CMP user configuration structure. More... | |
void | CMP_Init (CMP_Type *base, const cmp_config_t *psConfig) |
Initializes the CMP. More... | |
void | CMP_Deinit (CMP_Type *base) |
De-initializes the CMP module. More... | |
CMP functional interfaces | |
static void | CMP_Enable (CMP_Type *base, bool bEnable) |
Enables/disables the CMP module. More... | |
static void | CMP_SetInputChannel (CMP_Type *base, cmp_input_mux_t ePlusChannel, cmp_input_mux_t eMinusChannel) |
Sets the input channels for the comparator. More... | |
static void | CMP_SelectOutputSource (CMP_Type *base, cmp_output_source_t eOutputSource) |
Select comparator output source. More... | |
static void | CMP_EnableOuputPin (CMP_Type *base, bool bEnable) |
Enable/Disable Comparator output pin. More... | |
static uint8_t | CMP_GetComparatorOutput (CMP_Type *base) |
Get Comparator output. More... | |
static void | CMP_SetHysteresisLevel (CMP_Type *base, cmp_hysteresis_level_t eHysteresisLevel) |
Sets hysteresis level. More... | |
static void | CMP_SetComparasionSpeedMode (CMP_Type *base, cmp_comparasion_speed_mode_t eComparatorSpeedMode) |
Sets comparison speed mode. More... | |
static void | CMP_EnableInvertOutput (CMP_Type *base, bool bEnable) |
Enable/Disable comparator invert feature. More... | |
static void | CMP_EnableWindow (CMP_Type *base, bool bEnable) |
Enable the window function. More... | |
static void | CMP_SetWindowOutputMode (CMP_Type *base, cmp_window_output_mode_t eWindowOutputMode) |
Set the window output mode. More... | |
static void | CMP_EnableExternalSampleMode (CMP_Type *base, bool bEnable) |
Enable/Disable external Sample mode. More... | |
static void | CMP_SetExternalSampleCount (CMP_Type *base, cmp_external_sample_count_t eSampleCount) |
Sets external sample count. More... | |
static void | CMP_SetInternalFilterCount (CMP_Type *base, cmp_filter_count_t eFilterCount) |
Sets internal filter count. More... | |
static void | CMP_SetInternalFilterPeriod (CMP_Type *base, uint8_t u8FilterPeriod) |
Sets the internal filter period. More... | |
void | CMP_SetDACConfig (CMP_Type *base, const cmp_dac_config_t *psConfig) |
Configures the internal DAC. More... | |
static void | CMP_SetDACOutputVoltage (CMP_Type *base, uint8_t u8OutputVoltageDivider) |
Sets DAC output voltage. More... | |
static void | CMP_EnableInternalDAC (CMP_Type *base, bool bEnable) |
Enable/Disable internal DAC. More... | |
static void | CMP_SetDACReferenceVoltageSource (CMP_Type *base, cmp_dac_vref_source_t eDACVrefSource) |
Sets internal DAC's reference voltage source. More... | |
CMP interrupt interfaces | |
static void | CMP_EnableInterrupt (CMP_Type *base, cmp_interrupt_request_t eInterruptRequest) |
Interrupt request to enable. More... | |
CMP status interfaces | |
static cmp_output_flag_t | CMP_GetStatusFlags (CMP_Type *base) |
Gets the status flags. More... | |
static void | CMP_ClearStatusFlags (CMP_Type *base, cmp_output_flag_t eOutputFlag) |
Clears the status flags. More... | |
CMP DMA interfaces | |
static void | CMP_EnableDMA (CMP_Type *base, cmp_dma_request_t eDMARequestType) |
Enables CMP DMA request. More... | |
static void * | CMP_GetComparatorResultRegisterAddress (CMP_Type *base) |
Get CMP result register address for DMA access. More... | |
struct cmp_dac_config_t |
Data Fields | |
cmp_dac_vref_source_t | eDACVrefSource |
DAC reference voltage source. More... | |
uint8_t | u8DACOutputVoltageDivider |
divider Value for the DAC Output Voltage, DAC output voltage = (VREF / 256) * (u8DACOutputVoltageDivider + 1). More... | |
bool | bEnableInternalDAC |
flag to control if the internal DAC need to be enabled | |
cmp_dac_vref_source_t cmp_dac_config_t::eDACVrefSource |
uint8_t cmp_dac_config_t::u8DACOutputVoltageDivider |
union cmp_dma_interrupt_config_t |
Data Fields | |
cmp_dma_request_t | eDMARequest |
dma request type | |
cmp_interrupt_request_t | eInterruptRequest |
interrupt request type | |
struct cmp_config_t |
Data Fields | |
cmp_hysteresis_level_t | eHysteresisLevel |
CMP hysteresis leveL. | |
cmp_comparasion_speed_mode_t | eComparasionSpeedMode |
CMP comparison speed mode. | |
cmp_work_mode_t | eWorkMode |
CMP work mode. | |
cmp_input_mux_t | ePlusInput |
CMP plus input mux, the definition of this enum is in soc header file. | |
cmp_input_mux_t | eMinusInput |
CMP minus input mux, the definition of this enum is in soc header file. | |
cmp_dac_config_t | sDacConfig |
CMP internal DAC configuration structure cmp_dac_config_t. | |
bool | bInvertComparatorOutputPolarity |
Inverted comparator output polarity. More... | |
cmp_window_output_mode_t | eWindowOutputMode |
only works when cmp work mode is kCMP_WorkModeWindowEnabledAndNoExternalSample | |
cmp_filter_count_t | eFilterCount |
Filter Count.Available range is 0-7, 0 is disable internal filter can be used in internal sampling mode only. More... | |
uint8_t | u8FilterPeriod |
Filter Period. More... | |
cmp_external_sample_count_t | eExternalSampleCount |
Available range is 1 - 7, used in external sampling mode only. | |
cmp_output_source_t | eOutputSource |
cmp output source | |
bool | bEnableOutputPin |
the comparator output(CMPO) is driven out on the associated CMPO output pin | |
cmp_dma_interrupt_config_t | uDmaInterruptConfig |
CMP interrupt/dma configuration. | |
bool | bCMPEnable |
flag to control if CMP module start immediately when the configuration is done | |
bool cmp_config_t::bInvertComparatorOutputPolarity |
cmp_filter_count_t cmp_config_t::eFilterCount |
uint8_t cmp_config_t::u8FilterPeriod |
The divider to the bus clock. Available range is 0-255, can be used in internal sampling mode. When the filter clock from internal divided bus clock, setting the sample period to 0 will disable the filter
#define FSL_CMP_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
enum cmp_dma_request_t |
enum cmp_output_flag_t |
enum cmp_filter_count_t |
enum cmp_output_source_t |
enum cmp_work_mode_t |
void CMP_GetDefaultConfig | ( | cmp_config_t * | psConfig | ) |
This function initializes the user configuration structure to the default values. It is corresponding to the continuous mode configurations.
psConfig | pointer of cmp_config_t. |
void CMP_Init | ( | CMP_Type * | base, |
const cmp_config_t * | psConfig | ||
) |
This function initializes the CMP module. The operations included are as follows.
base | CMP peripheral base address. |
psConfig | Pointer to the configuration structure. |
void CMP_Deinit | ( | CMP_Type * | base | ) |
This function de-initializes the CMP module. The operations included are as follows.
base | CMP peripheral base address. |
|
inlinestatic |
base | CMP peripheral base address. |
enable | Enables or disables the module. |
|
inlinestatic |
This function sets the input channels for the comparator. Note that two input channels cannot be set the same way in the application. When the user selects the same input from the analog mux to the positive and negative port, the comparator is disabled automatically.
base | CMP peripheral base address. |
ePlusChannel | Plus side input channel number, cmp_input_mux_t. |
eMinusChannel | Minus side input channel number, cmp_input_mux_t. |
|
inlinestatic |
base | CMP peripheral base address. |
eOutputSource | The output signal to be set, please reference cmp_output_source_t for details. |
|
inlinestatic |
base | CMP peripheral base address. |
bEnable | Enable/Disable comparator output pin. true – CMPO is available on the associate CMPO output pin. false – CMPO is not available on the associate CMPO output pin. |
|
inlinestatic |
base | CMP peripheral base address. |
current | analog comparator output 0 or 1 |
|
inlinestatic |
base | CMP peripheral base address. |
eHysteresisLevel | The programmable hysteresis level to be set, please refer to cmp_hysteresis_level_t for details. |
|
inlinestatic |
base | CMP peripheral base address. |
eComparatorSpeedMode | The comparison speed mode, please reference cmp_comparasion_speed_mode_t for details. |
|
inlinestatic |
base | CMP peripheral base address. |
bEnable | Enable/Disable comparator invert feature. true – Inverts the comparator output. false – Does not invert the comparator output. |
|
inlinestatic |
base | CMP peripheral base address. |
bEnable | true is enable, false is disable. |
|
inlinestatic |
base | CMP peripheral base address. |
eWindowOutputMode | cmp_window_output_mode_t. |
|
inlinestatic |
base | CMP peripheral base address. |
bEnable | true is using external sample mode, false is using interface sample mode. |
|
inlinestatic |
base | CMP peripheral base address. |
eSampleCount | The number of consecutive samples that must agree prior to the comparator output filter accepting a new output state, cmp_external_sample_count_t. |
|
inlinestatic |
base | CMP peripheral base address. |
eFilterCount | The number of consecutive samples that must agree prior to the comparator output filter accepting a new output state, cmp_filter_count_t. |
|
inlinestatic |
It is used as the divider to bus clock.
base | CMP peripheral base address. |
u8FilterPeriod | Filter Period. The divider to the bus clock. Available range is 0-255. |
void CMP_SetDACConfig | ( | CMP_Type * | base, |
const cmp_dac_config_t * | psConfig | ||
) |
base | CMP peripheral base address. |
psConfig | Pointer to the configuration structure. |
|
inlinestatic |
base | CMP peripheral base address. |
u8OutputVoltageDivider | The digital value which is related to the desired DAC output voltage, |
|
inlinestatic |
base | CMP peripheral base address. |
bEnable | Enable/Disable internal DAC. true – Enable internal DAC. false – Disable internal DAC. |
|
inlinestatic |
base | CMP peripheral base address. |
eDACVrefSource | reference voltage source, please cmp_dac_vref_source_t |
|
inlinestatic |
base | CMP peripheral base address. |
eInterruptRequest | Mask value for interrupts. See cmp_interrupt_request_t. |
|
inlinestatic |
base | CMP peripheral base address. |
Mask | value for the asserted flags. cmp_output_flag_t. |
|
inlinestatic |
base | CMP peripheral base address. |
eOutputFlag | Mask value for the output flags, cmp_output_flag_t |
|
inlinestatic |
base | CMP peripheral base address. |
eDMARequestType | cmp_dma_request_t |
|
inlinestatic |
base | CMP peripheral base address. |