RTEMS 6.1-rc6
|
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... | |
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. | |
enum _cmp_hysteresis_mode |
enum _cmp_status_flags |
void CMP_ClearStatusFlags | ( | CMP_Type * | base, |
uint32_t | mask | ||
) |
Clears the status flags.
base | CMP peripheral base address. |
mask | Mask 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".
void CMP_Deinit | ( | CMP_Type * | base | ) |
De-initializes the CMP module.
This function de-initializes the CMP module. The operations included are as follows.
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.
base | CMP peripheral base address. |
brief De-initializes the CMP module.
This function de-initializes the CMP module. The operations included are as follows.
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.
void CMP_DisableInterrupts | ( | CMP_Type * | base, |
uint32_t | mask | ||
) |
Disables the interrupts.
base | CMP peripheral base address. |
mask | Mask 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".
void CMP_EnableInterrupts | ( | CMP_Type * | base, |
uint32_t | mask | ||
) |
Enables the interrupts.
base | CMP peripheral base address. |
mask | Mask 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".
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 | Pointer 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.
uint32_t CMP_GetStatusFlags | ( | CMP_Type * | base | ) |
Gets the status flags.
base | CMP peripheral base address. |
brief Gets the status flags.
param base CMP peripheral base address.
return Mask value for the asserted flags. See "_cmp_status_flags".
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.
base | CMP peripheral base address. |
config | Pointer to the configuration structure. |
brief Initializes the CMP.
This function initializes the CMP module. The operations included are as follows.
param base CMP peripheral base address. param config Pointer to the configuration structure.
void CMP_SetDACConfig | ( | CMP_Type * | base, |
const cmp_dac_config_t * | config | ||
) |
Configures the internal DAC.
base | CMP peripheral base address. |
config | Pointer 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.
void CMP_SetFilterConfig | ( | CMP_Type * | base, |
const cmp_filter_config_t * | config | ||
) |
Configures the filter.
base | CMP peripheral base address. |
config | Pointer to the configuration structure. |
brief Configures the filter.
param base CMP peripheral base address. param config Pointer to the configuration structure.
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.
base | CMP peripheral base address. |
positiveChannel | Positive side input channel number. Available range is 0-7. |
negativeChannel | Negative 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.
uint8_t _cmp_dac_config::DACValue |
Value for the DAC Output Voltage. Available range is 0-63.
bool _cmp_config::enableCmp |
Enable the CMP module.
bool _cmp_config::enableHighSpeed |
Enable High-speed (HS) comparison mode.
bool _cmp_config::enableInvertOutput |
Enable the inverted comparator output.
bool _cmp_config::enablePinOut |
The comparator output is available on the associated pin.
uint8_t _cmp_filter_config::filterCount |
Filter Sample Count. Available range is 1-7; 0 disables the filter.
uint8_t _cmp_filter_config::filterPeriod |
Filter Sample Period. The divider to the bus clock. Available range is 0-255.
cmp_hysteresis_mode_t _cmp_config::hysteresisMode |
CMP Hysteresis mode.
cmp_reference_voltage_source_t _cmp_dac_config::referenceVoltageSource |
Supply voltage reference source.
bool _cmp_config::useUnfilteredOutput |
Set the compare output(COUT) to equal COUTA(true) or COUT(false).