RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Data Structures | Enumerator | Variables
Acmp

Data Structures

struct  _acmp_config
 Configuration for ACMP. More...
 
struct  _acmp_channel_config
 Configuration for channel. More...
 
struct  _acmp_filter_config
 Configuration for filter. More...
 
struct  _acmp_dac_config
 Configuration for DAC. More...
 
struct  _acmp_round_robin_config
 Configuration for round robin mode. More...
 

Variables

acmp_hysteresis_mode_t _acmp_config::hysteresisMode
 
bool _acmp_config::enableHighSpeed
 
bool _acmp_config::enableInvertOutput
 
bool _acmp_config::useUnfilteredOutput
 
bool _acmp_config::enablePinOut
 
uint32_t _acmp_channel_config::plusMuxInput
 
uint32_t _acmp_channel_config::minusMuxInput
 
bool _acmp_filter_config::enableSample
 
uint32_t _acmp_filter_config::filterCount
 
uint32_t _acmp_filter_config::filterPeriod
 
acmp_reference_voltage_source_t _acmp_dac_config::referenceVoltageSource
 
uint32_t _acmp_dac_config::DACValue
 
acmp_fixed_port_t _acmp_round_robin_config::fixedPort
 
uint32_t _acmp_round_robin_config::fixedChannelNumber
 
uint32_t _acmp_round_robin_config::checkerChannelMask
 
uint32_t _acmp_round_robin_config::sampleClockCount
 
uint32_t _acmp_round_robin_config::delayModulus
 

Driver version

enum  _acmp_interrupt_enable { kACMP_OutputRisingInterruptEnable = (1U << 0U) , kACMP_OutputFallingInterruptEnable = (1U << 1U) , kACMP_RoundRobinInterruptEnable = (1U << 2U) }
 Interrupt enable/disable mask. More...
 
enum  _acmp_status_flags { kACMP_OutputRisingEventFlag = CMP_C0_CFR_MASK , kACMP_OutputFallingEventFlag = CMP_C0_CFF_MASK , kACMP_OutputAssertEventFlag = CMP_C0_COUT_MASK }
 Status flag mask. More...
 
enum  _acmp_hysteresis_mode { kACMP_HysteresisLevel0 = 0U , kACMP_HysteresisLevel1 = 1U , kACMP_HysteresisLevel2 = 2U , kACMP_HysteresisLevel3 = 3U }
 Comparator hard block hysteresis control. More...
 
enum  _acmp_reference_voltage_source { kACMP_VrefSourceVin1 = 0U , kACMP_VrefSourceVin2 = 1U }
 CMP Voltage Reference source. More...
 
enum  _acmp_fixed_port { kACMP_FixedPlusPort = 0U , kACMP_FixedMinusPort = 1U }
 Fixed mux port. More...
 
typedef enum _acmp_hysteresis_mode acmp_hysteresis_mode_t
 Comparator hard block hysteresis control.
 
typedef enum _acmp_reference_voltage_source acmp_reference_voltage_source_t
 CMP Voltage Reference source.
 
typedef enum _acmp_fixed_port acmp_fixed_port_t
 Fixed mux port.
 
typedef struct _acmp_config acmp_config_t
 Configuration for ACMP.
 
typedef struct _acmp_channel_config acmp_channel_config_t
 Configuration for channel.
 
typedef struct _acmp_filter_config acmp_filter_config_t
 Configuration for filter.
 
typedef struct _acmp_dac_config acmp_dac_config_t
 Configuration for DAC.
 
typedef struct _acmp_round_robin_config acmp_round_robin_config_t
 Configuration for round robin mode.
 
#define FSL_ACMP_DRIVER_VERSION   (MAKE_VERSION(2U, 0U, 6U))
 ACMP driver version 2.0.6.
 
#define CMP_C0_CFx_MASK   (CMP_C0_CFR_MASK | CMP_C0_CFF_MASK)
 The mask of status flags cleared by writing 1.
 
#define CMP_C1_CHNn_MASK   0xFF0000U /* C1_CHN0 - C1_CHN7. */
 
#define CMP_C2_CHnF_MASK   0xFF0000U /* C2_CH0F - C2_CH7F. */
 

Initialization and deinitialization

void ACMP_Init (CMP_Type *base, const acmp_config_t *config)
 Initializes the ACMP.
 
void ACMP_Deinit (CMP_Type *base)
 Deinitializes the ACMP.
 
void ACMP_GetDefaultConfig (acmp_config_t *config)
 Gets the default configuration for ACMP.
 

Basic Operations

void ACMP_Enable (CMP_Type *base, bool enable)
 Enables or disables the ACMP.
 
void ACMP_SetChannelConfig (CMP_Type *base, const acmp_channel_config_t *config)
 Sets the channel configuration.
 

Advanced Operations

void ACMP_EnableDMA (CMP_Type *base, bool enable)
 Enables or disables DMA.
 
void ACMP_EnableWindowMode (CMP_Type *base, bool enable)
 Enables or disables window mode.
 
void ACMP_SetFilterConfig (CMP_Type *base, const acmp_filter_config_t *config)
 Configures the filter.
 
void ACMP_SetDACConfig (CMP_Type *base, const acmp_dac_config_t *config)
 Configures the internal DAC.
 
void ACMP_SetRoundRobinConfig (CMP_Type *base, const acmp_round_robin_config_t *config)
 Configures the round robin mode.
 
void ACMP_SetRoundRobinPreState (CMP_Type *base, uint32_t mask)
 Defines the pre-set state of channels in round robin mode.
 
void ACMP_ClearRoundRobinStatusFlags (CMP_Type *base, uint32_t mask)
 Clears the channel input changed flags in round robin mode.
 

Interrupts

void ACMP_EnableInterrupts (CMP_Type *base, uint32_t mask)
 Enables interrupts.
 
void ACMP_DisableInterrupts (CMP_Type *base, uint32_t mask)
 Disables interrupts.
 

Status

uint32_t ACMP_GetStatusFlags (CMP_Type *base)
 Gets status flags.
 
void ACMP_ClearStatusFlags (CMP_Type *base, uint32_t mask)
 Clears status flags.
 

Detailed Description

Typedef Documentation

◆ acmp_channel_config_t

Configuration for channel.

The comparator's port can be input from channel mux or DAC. If port input is from channel mux, detailed channel number for the mux should be configured.

◆ acmp_hysteresis_mode_t

Comparator hard block hysteresis control.

See chip data sheet to get the actual hysteresis value with each level.

Enumeration Type Documentation

◆ _acmp_fixed_port

Fixed mux port.

Enumerator
kACMP_FixedPlusPort 

Only the inputs to the Minus port are swept in each round.

kACMP_FixedMinusPort 

Only the inputs to the Plus port are swept in each round.

◆ _acmp_hysteresis_mode

Comparator hard block hysteresis control.

See chip data sheet to get the actual hysteresis value with each level.

Enumerator
kACMP_HysteresisLevel0 

Offset is level 0 and Hysteresis is level 0.

kACMP_HysteresisLevel1 

Offset is level 0 and Hysteresis is level 1.

kACMP_HysteresisLevel2 

Offset is level 0 and Hysteresis is level 2.

kACMP_HysteresisLevel3 

Offset is level 0 and Hysteresis is level 3.

◆ _acmp_interrupt_enable

Interrupt enable/disable mask.

Enumerator
kACMP_OutputRisingInterruptEnable 

Enable the interrupt when comparator outputs rising.

kACMP_OutputFallingInterruptEnable 

Enable the interrupt when comparator outputs falling.

kACMP_RoundRobinInterruptEnable 

Enable the Round-Robin interrupt.

◆ _acmp_reference_voltage_source

CMP Voltage Reference source.

Enumerator
kACMP_VrefSourceVin1 

Vin1 is selected as resistor ladder network supply reference Vin.

kACMP_VrefSourceVin2 

Vin2 is selected as resistor ladder network supply reference Vin.

◆ _acmp_status_flags

Status flag mask.

Enumerator
kACMP_OutputRisingEventFlag 

Rising-edge on compare output has occurred.

kACMP_OutputFallingEventFlag 

Falling-edge on compare output has occurred.

kACMP_OutputAssertEventFlag 

Return the current value of the analog comparator output.

Function Documentation

◆ ACMP_ClearRoundRobinStatusFlags()

void ACMP_ClearRoundRobinStatusFlags ( CMP_Type base,
uint32_t  mask 
)

Clears the channel input changed flags in round robin mode.

Parameters
baseACMP peripheral base address.
maskMask of channel index. Available range is channel0:0x01 to channel7:0x80.

brief Clears the channel input changed flags in round robin mode.

param base ACMP peripheral base address. param mask Mask of channel index. Available range is channel0:0x01 to channel7:0x80.

◆ ACMP_ClearStatusFlags()

void ACMP_ClearStatusFlags ( CMP_Type base,
uint32_t  mask 
)

Clears status flags.

Parameters
baseACMP peripheral base address.
maskStatus flags mask. See "_acmp_status_flags".

brief Clears status flags.

param base ACMP peripheral base address. param mask Status flags mask. See "_acmp_status_flags".

◆ ACMP_Deinit()

void ACMP_Deinit ( CMP_Type base)

Deinitializes the ACMP.

Parameters
baseACMP peripheral base address.

brief Deinitializes the ACMP.

param base ACMP peripheral base address.

◆ ACMP_DisableInterrupts()

void ACMP_DisableInterrupts ( CMP_Type base,
uint32_t  mask 
)

Disables interrupts.

Parameters
baseACMP peripheral base address.
maskInterrupts mask. See "_acmp_interrupt_enable".

brief Disables interrupts.

param base ACMP peripheral base address. param mask Interrupts mask. See "_acmp_interrupt_enable".

◆ ACMP_Enable()

void ACMP_Enable ( CMP_Type base,
bool  enable 
)

Enables or disables the ACMP.

Parameters
baseACMP peripheral base address.
enableTrue to enable the ACMP.

brief Enables or disables the ACMP.

param base ACMP peripheral base address. param enable True to enable the ACMP.

◆ ACMP_EnableDMA()

void ACMP_EnableDMA ( CMP_Type base,
bool  enable 
)

Enables or disables DMA.

Parameters
baseACMP peripheral base address.
enableTrue to enable DMA.

brief Enables or disables DMA.

param base ACMP peripheral base address. param enable True to enable DMA.

◆ ACMP_EnableInterrupts()

void ACMP_EnableInterrupts ( CMP_Type base,
uint32_t  mask 
)

Enables interrupts.

Parameters
baseACMP peripheral base address.
maskInterrupts mask. See "_acmp_interrupt_enable".

brief Enables interrupts.

param base ACMP peripheral base address. param mask Interrupts mask. See "_acmp_interrupt_enable".

◆ ACMP_EnableWindowMode()

void ACMP_EnableWindowMode ( CMP_Type base,
bool  enable 
)

Enables or disables window mode.

Parameters
baseACMP peripheral base address.
enableTrue to enable window mode.

brief Enables or disables window mode.

param base ACMP peripheral base address. param enable True to enable window mode.

◆ ACMP_GetDefaultConfig()

void ACMP_GetDefaultConfig ( acmp_config_t config)

Gets the default configuration for ACMP.

This function initializes the user configuration structure to default value. The default value are:

Example:

config->enableHighSpeed = false;
config->enableInvertOutput = false;
config->useUnfilteredOutput = false;
config->enablePinOut = false;
config->enableHysteresisBothDirections = false;
config->hysteresisMode = kACMP_hysteresisMode0;
Definition: deflate.c:114
Parameters
configPointer to ACMP configuration structure.

brief Gets the default configuration for ACMP.

This function initializes the user configuration structure to default value. The default value are:

Example: code config->enableHighSpeed = false; config->enableInvertOutput = false; config->useUnfilteredOutput = false; config->enablePinOut = false; config->enableHysteresisBothDirections = false; config->hysteresisMode = kACMP_hysteresisMode0; endcode

param config Pointer to ACMP configuration structure.

◆ ACMP_GetStatusFlags()

uint32_t ACMP_GetStatusFlags ( CMP_Type base)

Gets status flags.

Parameters
baseACMP peripheral base address.
Returns
Status flags asserted mask. See "_acmp_status_flags".

brief Gets status flags.

param base ACMP peripheral base address. return Status flags asserted mask. See "_acmp_status_flags".

◆ ACMP_Init()

void ACMP_Init ( CMP_Type base,
const acmp_config_t config 
)

Initializes the ACMP.

The default configuration can be got by calling ACMP_GetDefaultConfig().

Parameters
baseACMP peripheral base address.
configPointer to ACMP configuration structure.

brief Initializes the ACMP.

The default configuration can be got by calling ACMP_GetDefaultConfig().

param base ACMP peripheral base address. param config Pointer to ACMP configuration structure.

◆ ACMP_SetChannelConfig()

void ACMP_SetChannelConfig ( CMP_Type base,
const acmp_channel_config_t config 
)

Sets the channel configuration.

Note that the plus/minus mux's setting is only valid when the positive/negative port's input isn't from DAC but from channel mux.

Example:

acmp_channel_config_t configStruct = {0};
configStruct.positivePortInput = kACMP_PortInputFromDAC;
configStruct.negativePortInput = kACMP_PortInputFromMux;
configStruct.minusMuxInput = 1U;
ACMP_SetChannelConfig(CMP0, &configStruct);
void ACMP_SetChannelConfig(CMP_Type *base, const acmp_channel_config_t *config)
Sets the channel configuration.
Definition: fsl_acmp.c:230
uint32_t minusMuxInput
Definition: fsl_acmp.h:139
Configuration for channel.
Definition: fsl_acmp.h:131
Parameters
baseACMP peripheral base address.
configPointer to channel configuration structure.

brief Sets the channel configuration.

Note that the plus/minus mux's setting is only valid when the positive/negative port's input isn't from DAC but from channel mux.

Example: code acmp_channel_config_t configStruct = {0}; configStruct.positivePortInput = kACMP_PortInputFromDAC; configStruct.negativePortInput = kACMP_PortInputFromMux; configStruct.minusMuxInput = 1U; ACMP_SetChannelConfig(CMP0, &configStruct); endcode

param base ACMP peripheral base address. param config Pointer to channel configuration structure.

◆ ACMP_SetDACConfig()

void ACMP_SetDACConfig ( CMP_Type base,
const acmp_dac_config_t config 
)

Configures the internal DAC.

Example:

acmp_dac_config_t configStruct = {0};
configStruct.DACValue = 20U;
configStruct.enableOutput = false;
configStruct.workMode = kACMP_DACWorkLowSpeedMode;
ACMP_SetDACConfig(CMP0, &configStruct);
uint32_t DACValue
Definition: fsl_acmp.h:154
void ACMP_SetDACConfig(CMP_Type *base, const acmp_dac_config_t *config)
Configures the internal DAC.
Definition: fsl_acmp.c:348
acmp_reference_voltage_source_t referenceVoltageSource
Definition: fsl_acmp.h:153
@ kACMP_VrefSourceVin1
Definition: fsl_acmp.h:82
Configuration for DAC.
Definition: fsl_acmp.h:152
Parameters
baseACMP peripheral base address.
configPointer to DAC configuration structure. "NULL" is for disabling the feature.

brief Configures the internal DAC.

Example: code acmp_dac_config_t configStruct = {0}; configStruct.referenceVoltageSource = kACMP_VrefSourceVin1; configStruct.DACValue = 20U; configStruct.enableOutput = false; configStruct.workMode = kACMP_DACWorkLowSpeedMode; ACMP_SetDACConfig(CMP0, &configStruct); endcode

param base ACMP peripheral base address. param config Pointer to DAC configuration structure. "NULL" is for disabling the feature.

◆ ACMP_SetFilterConfig()

void ACMP_SetFilterConfig ( CMP_Type base,
const acmp_filter_config_t config 
)

Configures the filter.

The filter can be enabled when the filter count is bigger than 1, the filter period is greater than 0 and the sample clock is from divided bus clock or the filter is bigger than 1 and the sample clock is from external clock. Detailed usage can be got from the reference manual.

Example:

acmp_filter_config_t configStruct = {0};
configStruct.filterCount = 5U;
configStruct.filterPeriod = 200U;
configStruct.enableSample = false;
ACMP_SetFilterConfig(CMP0, &configStruct);
void ACMP_SetFilterConfig(CMP_Type *base, const acmp_filter_config_t *config)
Configures the filter.
Definition: fsl_acmp.c:315
bool enableSample
Definition: fsl_acmp.h:145
uint32_t filterPeriod
Definition: fsl_acmp.h:147
uint32_t filterCount
Definition: fsl_acmp.h:146
Configuration for filter.
Definition: fsl_acmp.h:144
Parameters
baseACMP peripheral base address.
configPointer to filter configuration structure.

brief Configures the filter.

The filter can be enabled when the filter count is bigger than 1, the filter period is greater than 0 and the sample clock is from divided bus clock or the filter is bigger than 1 and the sample clock is from external clock. Detailed usage can be got from the reference manual.

Example: code acmp_filter_config_t configStruct = {0}; configStruct.filterCount = 5U; configStruct.filterPeriod = 200U; configStruct.enableSample = false; ACMP_SetFilterConfig(CMP0, &configStruct); endcode

param base ACMP peripheral base address. param config Pointer to filter configuration structure.

◆ ACMP_SetRoundRobinConfig()

void ACMP_SetRoundRobinConfig ( CMP_Type base,
const acmp_round_robin_config_t config 
)

Configures the round robin mode.

Example:

acmp_round_robin_config_t configStruct = {0};
configStruct.fixedChannelNumber = 3U;
configStruct.checkerChannelMask = 0xF7U;
configStruct.sampleClockCount = 0U;
configStruct.delayModulus = 0U;
ACMP_SetRoundRobinConfig(CMP0, &configStruct);
uint32_t checkerChannelMask
Definition: fsl_acmp.h:170
uint32_t fixedChannelNumber
Definition: fsl_acmp.h:169
uint32_t delayModulus
Definition: fsl_acmp.h:173
acmp_fixed_port_t fixedPort
Definition: fsl_acmp.h:168
uint32_t sampleClockCount
Definition: fsl_acmp.h:172
void ACMP_SetRoundRobinConfig(CMP_Type *base, const acmp_round_robin_config_t *config)
Configures the round robin mode.
Definition: fsl_acmp.c:407
@ kACMP_FixedPlusPort
Definition: fsl_acmp.h:98
Configuration for round robin mode.
Definition: fsl_acmp.h:167
Parameters
baseACMP peripheral base address.
configPointer to round robin mode configuration structure. "NULL" is for disabling the feature.

brief Configures the round robin mode.

Example: code acmp_round_robin_config_t configStruct = {0}; configStruct.fixedPort = kACMP_FixedPlusPort; configStruct.fixedChannelNumber = 3U; configStruct.checkerChannelMask = 0xF7U; configStruct.sampleClockCount = 0U; configStruct.delayModulus = 0U; ACMP_SetRoundRobinConfig(CMP0, &configStruct); endcode param base ACMP peripheral base address. param config Pointer to round robin mode configuration structure. "NULL" is for disabling the feature.

◆ ACMP_SetRoundRobinPreState()

void ACMP_SetRoundRobinPreState ( CMP_Type base,
uint32_t  mask 
)

Defines the pre-set state of channels in round robin mode.

Note: The pre-state has different circuit with get-round-robin-result in the SOC even though they are same bits. So get-round-robin-result can't return the same value as the value are set by pre-state.

Parameters
baseACMP peripheral base address.
maskMask of round robin channel index. Available range is channel0:0x01 to channel7:0x80.

brief Defines the pre-set state of channels in round robin mode.

Note: The pre-state has different circuit with get-round-robin-result in the SOC even though they are same bits. So get-round-robin-result can't return the same value as the value are set by pre-state.

param base ACMP peripheral base address. param mask Mask of round robin channel index. Available range is channel0:0x01 to channel7:0x80.

Variable Documentation

◆ checkerChannelMask

uint32_t _acmp_round_robin_config::checkerChannelMask

Mask of checker channel index. Available range is channel0:0x01 to channel7:0x80 for round-robin checker.

◆ DACValue

uint32_t _acmp_dac_config::DACValue

Value for DAC Output Voltage. Available range is 0-255.

◆ delayModulus

uint32_t _acmp_round_robin_config::delayModulus

Comparator and DAC initialization delay modulus.

◆ enableHighSpeed

bool _acmp_config::enableHighSpeed

Enable High Speed (HS) comparison mode.

◆ enableInvertOutput

bool _acmp_config::enableInvertOutput

Enable inverted comparator output.

◆ enablePinOut

bool _acmp_config::enablePinOut

The comparator output is available on the associated pin.

◆ enableSample

bool _acmp_filter_config::enableSample

Using external SAMPLE as sampling clock input, or using divided bus clock.

◆ filterCount

uint32_t _acmp_filter_config::filterCount

Filter Sample Count. Available range is 1-7, 0 would cause the filter disabled.

◆ filterPeriod

uint32_t _acmp_filter_config::filterPeriod

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

◆ fixedChannelNumber

uint32_t _acmp_round_robin_config::fixedChannelNumber

Indicates which channel is fixed in the fixed mux port.

◆ fixedPort

acmp_fixed_port_t _acmp_round_robin_config::fixedPort

Fixed mux port.

◆ hysteresisMode

acmp_hysteresis_mode_t _acmp_config::hysteresisMode

Hysteresis mode.

◆ minusMuxInput

uint32_t _acmp_channel_config::minusMuxInput

Minus mux input channel(0~7).

◆ plusMuxInput

uint32_t _acmp_channel_config::plusMuxInput

Plus mux input channel(0~7).

◆ referenceVoltageSource

acmp_reference_voltage_source_t _acmp_dac_config::referenceVoltageSource

Supply voltage reference source.

◆ sampleClockCount

uint32_t _acmp_round_robin_config::sampleClockCount

Specifies how many round-robin clock cycles(0~3) later the sample takes place.

◆ useUnfilteredOutput

bool _acmp_config::useUnfilteredOutput

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