RTEMS 6.1-rc5
Loading...
Searching...
No Matches
Data Structures | Enumerator | Variables
Cmp

Data Structures

struct  _cmp_config
 Configures the comparator. More...
 
struct  _cmp_filter_config
 Configures the filter. More...
 
struct  _cmp_dac_config
 Configures the internal DAC. More...
 

Variables

bool _cmp_config::enableCmp
 
cmp_hysteresis_mode_t _cmp_config::hysteresisMode
 
bool _cmp_config::enableHighSpeed
 
bool _cmp_config::enableInvertOutput
 
bool _cmp_config::useUnfilteredOutput
 
bool _cmp_config::enablePinOut
 
uint8_t _cmp_filter_config::filterCount
 
uint8_t _cmp_filter_config::filterPeriod
 
cmp_reference_voltage_source_t _cmp_dac_config::referenceVoltageSource
 
uint8_t _cmp_dac_config::DACValue
 

Driver version

enum  _cmp_interrupt_enable { kCMP_OutputRisingInterruptEnable = CMP_SCR_IER_MASK , kCMP_OutputFallingInterruptEnable = CMP_SCR_IEF_MASK }
 Interrupt enable/disable mask. More...
 
enum  _cmp_status_flags { kCMP_OutputRisingEventFlag = CMP_SCR_CFR_MASK , kCMP_OutputFallingEventFlag = CMP_SCR_CFF_MASK , kCMP_OutputAssertEventFlag = CMP_SCR_COUT_MASK }
 Status flags' mask. More...
 
enum  _cmp_hysteresis_mode { kCMP_HysteresisLevel0 = 0U , kCMP_HysteresisLevel1 = 1U , kCMP_HysteresisLevel2 = 2U , kCMP_HysteresisLevel3 = 3U }
 CMP Hysteresis mode. More...
 
enum  _cmp_reference_voltage_source { kCMP_VrefSourceVin1 = 0U , kCMP_VrefSourceVin2 = 1U }
 CMP Voltage Reference source. More...
 
typedef enum _cmp_hysteresis_mode cmp_hysteresis_mode_t
 CMP Hysteresis mode.
 
typedef enum _cmp_reference_voltage_source cmp_reference_voltage_source_t
 CMP Voltage Reference source.
 
typedef struct _cmp_config cmp_config_t
 Configures the comparator.
 
typedef struct _cmp_filter_config cmp_filter_config_t
 Configures the filter.
 
typedef struct _cmp_dac_config cmp_dac_config_t
 Configures the internal DAC.
 
#define FSL_CMP_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))
 CMP driver version 2.0.2.
 

Initialization

void CMP_Init (CMP_Type *base, const cmp_config_t *config)
 Initializes the CMP.
 
void CMP_Deinit (CMP_Type *base)
 De-initializes the CMP module.
 
void CMP_GetDefaultConfig (cmp_config_t *config)
 Initializes the CMP user configuration structure.
 
void CMP_SetInputChannels (CMP_Type *base, uint8_t positiveChannel, uint8_t negativeChannel)
 Sets the input channels for the comparator.
 

Advanced Features

void CMP_SetFilterConfig (CMP_Type *base, const cmp_filter_config_t *config)
 Configures the filter.
 
void CMP_SetDACConfig (CMP_Type *base, const cmp_dac_config_t *config)
 Configures the internal DAC.
 
void CMP_EnableInterrupts (CMP_Type *base, uint32_t mask)
 Enables the interrupts.
 
void CMP_DisableInterrupts (CMP_Type *base, uint32_t mask)
 Disables the interrupts.
 

Results

uint32_t CMP_GetStatusFlags (CMP_Type *base)
 Gets the status flags.
 
void CMP_ClearStatusFlags (CMP_Type *base, uint32_t mask)
 Clears the status flags.
 

Detailed Description

Enumeration Type Documentation

◆ _cmp_hysteresis_mode

CMP Hysteresis mode.

Enumerator
kCMP_HysteresisLevel0 

Hysteresis level 0.

kCMP_HysteresisLevel1 

Hysteresis level 1.

kCMP_HysteresisLevel2 

Hysteresis level 2.

kCMP_HysteresisLevel3 

Hysteresis level 3.

◆ _cmp_interrupt_enable

Interrupt enable/disable mask.

Enumerator
kCMP_OutputRisingInterruptEnable 

Comparator interrupt enable rising.

kCMP_OutputFallingInterruptEnable 

Comparator interrupt enable falling.

◆ _cmp_reference_voltage_source

CMP Voltage Reference source.

Enumerator
kCMP_VrefSourceVin1 

Vin1 is selected as a resistor ladder network supply reference Vin.

kCMP_VrefSourceVin2 

Vin2 is selected as a resistor ladder network supply reference Vin.

◆ _cmp_status_flags

Status flags' mask.

Enumerator
kCMP_OutputRisingEventFlag 

Rising-edge on the comparison output has occurred.

kCMP_OutputFallingEventFlag 

Falling-edge on the comparison output has occurred.

kCMP_OutputAssertEventFlag 

Return the current value of the analog comparator output.

Function Documentation

◆ CMP_ClearStatusFlags()

void CMP_ClearStatusFlags ( CMP_Type base,
uint32_t  mask 
)

Clears the status flags.

Parameters
baseCMP peripheral base address.
maskMask value for the flags. See "_cmp_status_flags".

brief Clears the status flags.

param base CMP peripheral base address. param mask Mask value for the flags. See "_cmp_status_flags".

◆ CMP_Deinit()

void CMP_Deinit ( CMP_Type base)

De-initializes the CMP module.

This function de-initializes the CMP module. The operations included are as follows.

  • Disabling the CMP module.
  • Disabling the clock for CMP module.

This function disables the clock for the CMP. Note that for some devices, multiple CMP instances share the same clock gate. In this case, before disabling the clock for the CMP, ensure that all the CMP instances are not used.

Parameters
baseCMP peripheral base address.

brief De-initializes the CMP module.

This function de-initializes the CMP module. The operations included are as follows.

  • Disabling the CMP module.
  • Disabling the clock for CMP module.

This function disables the clock for the CMP. Note that for some devices, multiple CMP instances share the same clock gate. In this case, before disabling the clock for the CMP, ensure that all the CMP instances are not used.

param base CMP peripheral base address.

◆ CMP_DisableInterrupts()

void CMP_DisableInterrupts ( CMP_Type base,
uint32_t  mask 
)

Disables the interrupts.

Parameters
baseCMP peripheral base address.
maskMask value for interrupts. See "_cmp_interrupt_enable".

brief Disables the interrupts.

param base CMP peripheral base address. param mask Mask value for interrupts. See "_cmp_interrupt_enable".

◆ CMP_EnableInterrupts()

void CMP_EnableInterrupts ( CMP_Type base,
uint32_t  mask 
)

Enables the interrupts.

Parameters
baseCMP peripheral base address.
maskMask value for interrupts. See "_cmp_interrupt_enable".

brief Enables the interrupts.

param base CMP peripheral base address. param mask Mask value for interrupts. See "_cmp_interrupt_enable".

◆ CMP_GetDefaultConfig()

void CMP_GetDefaultConfig ( cmp_config_t config)

Initializes the CMP user configuration structure.

This function initializes the user configuration structure to these default values.

config->enableCmp = true;
config->hysteresisMode = kCMP_HysteresisLevel0;
config->enableHighSpeed = false;
config->enableInvertOutput = false;
config->useUnfilteredOutput = false;
config->enablePinOut = false;
config->enableTriggerMode = false;
@ kCMP_HysteresisLevel0
Definition: fsl_cmp.h:53
Definition: deflate.c:114
Parameters
configPointer to the configuration structure.

brief Initializes the CMP user configuration structure.

This function initializes the user configuration structure to these default values. code config->enableCmp = true; config->hysteresisMode = kCMP_HysteresisLevel0; config->enableHighSpeed = false; config->enableInvertOutput = false; config->useUnfilteredOutput = false; config->enablePinOut = false; config->enableTriggerMode = false; endcode param config Pointer to the configuration structure.

◆ CMP_GetStatusFlags()

uint32_t CMP_GetStatusFlags ( CMP_Type base)

Gets the status flags.

Parameters
baseCMP peripheral base address.
Returns
Mask value for the asserted flags. See "_cmp_status_flags".

brief Gets the status flags.

param base CMP peripheral base address.

return Mask value for the asserted flags. See "_cmp_status_flags".

◆ CMP_Init()

void CMP_Init ( CMP_Type base,
const cmp_config_t config 
)

Initializes the CMP.

This function initializes the CMP module. The operations included are as follows.

  • Enabling the clock for CMP module.
  • Configuring the comparator.
  • Enabling the CMP module. Note that for some devices, multiple CMP instances share the same clock gate. In this case, to enable the clock for any instance enables all CMPs. See the appropriate MCU reference manual for the clock assignment of the CMP.
Parameters
baseCMP peripheral base address.
configPointer to the configuration structure.

brief Initializes the CMP.

This function initializes the CMP module. The operations included are as follows.

  • Enabling the clock for CMP module.
  • Configuring the comparator.
  • Enabling the CMP module. Note that for some devices, multiple CMP instances share the same clock gate. In this case, to enable the clock for any instance enables all CMPs. See the appropriate MCU reference manual for the clock assignment of the CMP.

param base CMP peripheral base address. param config Pointer to the configuration structure.

◆ CMP_SetDACConfig()

void CMP_SetDACConfig ( CMP_Type base,
const cmp_dac_config_t config 
)

Configures the internal DAC.

Parameters
baseCMP peripheral base address.
configPointer to the configuration structure. "NULL" disables the feature.

brief Configures the internal DAC.

param base CMP peripheral base address. param config Pointer to the configuration structure. "NULL" disables the feature.

◆ CMP_SetFilterConfig()

void CMP_SetFilterConfig ( CMP_Type base,
const cmp_filter_config_t config 
)

Configures the filter.

Parameters
baseCMP peripheral base address.
configPointer to the configuration structure.

brief Configures the filter.

param base CMP peripheral base address. param config Pointer to the configuration structure.

◆ CMP_SetInputChannels()

void CMP_SetInputChannels ( CMP_Type base,
uint8_t  positiveChannel,
uint8_t  negativeChannel 
)

Sets the input channels for the comparator.

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.

Parameters
baseCMP peripheral base address.
positiveChannelPositive side input channel number. Available range is 0-7.
negativeChannelNegative side input channel number. Available range is 0-7.

brief Sets the input channels for the comparator.

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.

param base CMP peripheral base address. param positiveChannel Positive side input channel number. Available range is 0-7. param negativeChannel Negative side input channel number. Available range is 0-7.

Variable Documentation

◆ DACValue

uint8_t _cmp_dac_config::DACValue

Value for the DAC Output Voltage. Available range is 0-63.

◆ enableCmp

bool _cmp_config::enableCmp

Enable the CMP module.

◆ enableHighSpeed

bool _cmp_config::enableHighSpeed

Enable High-speed (HS) comparison mode.

◆ enableInvertOutput

bool _cmp_config::enableInvertOutput

Enable the inverted comparator output.

◆ enablePinOut

bool _cmp_config::enablePinOut

The comparator output is available on the associated pin.

◆ filterCount

uint8_t _cmp_filter_config::filterCount

Filter Sample Count. Available range is 1-7; 0 disables the filter.

◆ filterPeriod

uint8_t _cmp_filter_config::filterPeriod

Filter Sample Period. The divider to the bus clock. Available range is 0-255.

◆ hysteresisMode

cmp_hysteresis_mode_t _cmp_config::hysteresisMode

CMP Hysteresis mode.

◆ referenceVoltageSource

cmp_reference_voltage_source_t _cmp_dac_config::referenceVoltageSource

Supply voltage reference source.

◆ useUnfilteredOutput

bool _cmp_config::useUnfilteredOutput

Set the compare output(COUT) to equal COUTA(true) or COUT(false).