![]() |
S32 SDK
|
Comparator Peripheral Driver.
Definitions
Data Structures | |
struct | cmp_comparator_t |
Defines the block configuration. More... | |
struct | cmp_anmux_t |
Defines the analog mux. More... | |
struct | cmp_dac_t |
Defines the DAC block. More... | |
struct | cmp_trigger_mode_t |
Defines the trigger mode. More... | |
struct | cmp_module_t |
Defines the comparator module configuration. More... | |
Macros | |
#define | CMP_INPUT_FLAGS_MASK 0xFF0000 |
#define | CMP_INPUT_FLAGS_SHIFT 16U |
#define | CMP_ROUND_ROBIN_CHANNELS_MASK 0xFF0000 |
#define | CMP_ROUND_ROBIN_CHANNELS_SHIFT 16U |
Typedefs | |
typedef uint8_t | cmp_ch_list_t |
Comparator channels list (1bit/channel) |------—|------—|--—|------—|------—| |CH7_state|CH6_state|.....|CH1_state|CH0_state| |------—|------—|--—|------—|------—| Implements : cmp_ch_list_t_Class. More... | |
typedef uint8_t | cmp_ch_number_t |
Number of channel Implements : cmp_ch_number_t_Class. More... | |
Enumerations | |
enum | cmp_power_mode_t { CMP_LOW_SPEED = 0U, CMP_HIGH_SPEED = 1U } |
Power Modes selection Implements : cmp_power_mode_t_Class. More... | |
enum | cmp_voltage_reference_t { CMP_VIN1 = 0U, CMP_VIN2 = 1U } |
Voltage Reference selection Implements : cmp_voltage_reference_t_Class. More... | |
enum | cmp_port_mux_t { CMP_DAC = 0U, CMP_MUX = 1U } |
Port Mux Source selection Implements : cmp_port_mux_t_Class. More... | |
enum | cmp_inverter_t { CMP_NORMAL = 0U, CMP_INVERT = 1U } |
Comparator output invert selection Implements : cmp_inverter_t_Class. More... | |
enum | cmp_output_select_t { CMP_COUT = 0U, CMP_COUTA = 1U } |
Comparator output select selection Implements : cmp_output_select_t_Class. More... | |
enum | cmp_output_enable_t { CMP_UNAVAILABLE = 0U, CMP_AVAILABLE = 1U } |
Comparator output pin enable selection Implements : cmp_output_enable_t_Class. More... | |
enum | cmp_offset_t { CMP_LEVEL_OFFSET_0 = 0U, CMP_LEVEL_OFFSET_1 = 1U } |
Comparator hard block offset control Implements : cmp_offset_t_Class. More... | |
enum | cmp_hysteresis_t { CMP_LEVEL_HYS_0 = 0U, CMP_LEVEL_HYS_1 = 1U, CMP_LEVEL_HYS_2 = 2U, CMP_LEVEL_HYS_3 = 3U } |
Comparator hysteresis control Implements : cmp_hysteresis_t_Class. More... | |
enum | cmp_fixed_port_t { CMP_PLUS_FIXED = 0U, CMP_MINUS_FIXED = 1U } |
Comparator Round-Robin fixed port Implements : cmp_fixed_port_t_Class. More... | |
enum | cmp_output_trigger_t { CMP_NO_EVENT = 0U, CMP_FALLING_EDGE = 1U, CMP_RISING_EDGE = 2U, CMP_BOTH_EDGES = 3U } |
Comparator output interrupt configuration Implements : cmp_output_trigger_t_Class. More... | |
enum | cmp_mode_t { CMP_DISABLED = 0U, CMP_CONTINUOUS = 1U, CMP_SAMPLED_NONFILTRED_INT_CLK = 2U, CMP_SAMPLED_NONFILTRED_EXT_CLK = 3U, CMP_SAMPLED_FILTRED_INT_CLK = 4U, CMP_SAMPLED_FILTRED_EXT_CLK = 5U, CMP_WINDOWED = 6U, CMP_WINDOWED_RESAMPLED = 7U, CMP_WINDOWED_FILTRED = 8U } |
Comparator functional modes Implements : cmp_mode_t_Class. More... | |
cMP DRV. | |
status_t | CMP_DRV_Reset (const uint32_t instance) |
Reset all registers. More... | |
status_t | CMP_DRV_GetInitConfigAll (cmp_module_t *config) |
Get reset configuration for all registers. More... | |
status_t | CMP_DRV_Init (const uint32_t instance, const cmp_module_t *const config) |
Configure all comparator features with the given configuration structure. More... | |
status_t | CMP_DRV_GetConfigAll (const uint32_t instance, cmp_module_t *const config) |
Gets the current comparator configuration. More... | |
status_t | CMP_DRV_GetInitConfigDAC (cmp_dac_t *config) |
Get reset configuration for registers related with DAC. More... | |
status_t | CMP_DRV_ConfigDAC (const uint32_t instance, const cmp_dac_t *config) |
Configure only the DAC component. More... | |
status_t | CMP_DRV_GetDACConfig (const uint32_t instance, cmp_dac_t *const config) |
Return current configuration for DAC. More... | |
status_t | CMP_DRV_GetInitConfigMUX (cmp_anmux_t *config) |
Get reset configuration for registers related with MUX. More... | |
status_t | CMP_DRV_ConfigMUX (const uint32_t instance, const cmp_anmux_t *config) |
Configure only the MUX component. More... | |
status_t | CMP_DRV_GetMUXConfig (const uint32_t instance, cmp_anmux_t *const config) |
Return configuration only for the MUX component. More... | |
status_t | CMP_DRV_GetInitTriggerMode (cmp_trigger_mode_t *config) |
Get reset configuration for registers related with Trigger Mode. More... | |
status_t | CMP_DRV_ConfigTriggerMode (const uint32_t instance, const cmp_trigger_mode_t *config) |
Configure trigger mode. More... | |
status_t | CMP_DRV_GetTriggerModeConfig (const uint32_t instance, cmp_trigger_mode_t *const config) |
Get current trigger mode configuration. More... | |
status_t | CMP_DRV_GetOutputFlags (const uint32_t instance, cmp_output_trigger_t *flags) |
Get comparator output flags. More... | |
status_t | CMP_DRV_ClearOutputFlags (const uint32_t instance) |
Clear comparator output flags. More... | |
status_t | CMP_DRV_GetInputFlags (const uint32_t instance, cmp_ch_list_t *flags) |
Gets input channels change flags. More... | |
status_t | CMP_DRV_ClearInputFlags (const uint32_t instance) |
Clear comparator input channels flags. More... | |
status_t | CMP_DRV_GetInitConfigComparator (cmp_comparator_t *config) |
Get reset configuration for registers related with comparator features. More... | |
status_t | CMP_DRV_ConfigComparator (const uint32_t instance, const cmp_comparator_t *config) |
Configure only comparator features. More... | |
status_t | CMP_DRV_GetComparatorConfig (const uint32_t instance, cmp_comparator_t *config) |
Return configuration for comparator from CMP module. More... | |
#define CMP_INPUT_FLAGS_MASK 0xFF0000 |
Definition at line 33 of file cmp_driver.h.
#define CMP_INPUT_FLAGS_SHIFT 16U |
Definition at line 34 of file cmp_driver.h.
#define CMP_ROUND_ROBIN_CHANNELS_MASK 0xFF0000 |
Definition at line 35 of file cmp_driver.h.
#define CMP_ROUND_ROBIN_CHANNELS_SHIFT 16U |
Definition at line 36 of file cmp_driver.h.
typedef uint8_t cmp_ch_list_t |
Comparator channels list (1bit/channel) |------—|------—|--—|------—|------—| |CH7_state|CH6_state|.....|CH1_state|CH0_state| |------—|------—|--—|------—|------—| Implements : cmp_ch_list_t_Class.
Definition at line 157 of file cmp_driver.h.
typedef uint8_t cmp_ch_number_t |
Number of channel Implements : cmp_ch_number_t_Class.
Definition at line 162 of file cmp_driver.h.
enum cmp_fixed_port_t |
Comparator Round-Robin fixed port Implements : cmp_fixed_port_t_Class.
Definition at line 118 of file cmp_driver.h.
enum cmp_hysteresis_t |
Comparator hysteresis control Implements : cmp_hysteresis_t_Class.
Enumerator | |
---|---|
CMP_LEVEL_HYS_0 | |
CMP_LEVEL_HYS_1 | |
CMP_LEVEL_HYS_2 | |
CMP_LEVEL_HYS_3 |
Definition at line 107 of file cmp_driver.h.
enum cmp_inverter_t |
Comparator output invert selection Implements : cmp_inverter_t_Class.
Enumerator | |
---|---|
CMP_NORMAL |
Output signal isn't inverted. |
CMP_INVERT |
Output signal is inverted. |
Definition at line 71 of file cmp_driver.h.
enum cmp_mode_t |
Comparator functional modes Implements : cmp_mode_t_Class.
Definition at line 138 of file cmp_driver.h.
enum cmp_offset_t |
Comparator hard block offset control Implements : cmp_offset_t_Class.
Enumerator | |
---|---|
CMP_LEVEL_OFFSET_0 | |
CMP_LEVEL_OFFSET_1 |
Definition at line 98 of file cmp_driver.h.
enum cmp_output_enable_t |
Comparator output pin enable selection Implements : cmp_output_enable_t_Class.
Enumerator | |
---|---|
CMP_UNAVAILABLE |
Comparator output isn't available to a specific pin |
CMP_AVAILABLE |
Comparator output is available to a specific pin |
Definition at line 89 of file cmp_driver.h.
enum cmp_output_select_t |
Comparator output select selection Implements : cmp_output_select_t_Class.
Enumerator | |
---|---|
CMP_COUT |
Select COUT as comparator output signal. |
CMP_COUTA |
Select COUTA as comparator output signal. |
Definition at line 80 of file cmp_driver.h.
enum cmp_output_trigger_t |
Comparator output interrupt configuration Implements : cmp_output_trigger_t_Class.
Definition at line 127 of file cmp_driver.h.
enum cmp_port_mux_t |
Port Mux Source selection Implements : cmp_port_mux_t_Class.
Enumerator | |
---|---|
CMP_DAC |
Select DAC as source for the comparator port. |
CMP_MUX |
Select MUX8 as source for the comparator port. |
Definition at line 62 of file cmp_driver.h.
enum cmp_power_mode_t |
Power Modes selection Implements : cmp_power_mode_t_Class.
Enumerator | |
---|---|
CMP_LOW_SPEED |
Module in low speed mode. |
CMP_HIGH_SPEED |
Module in high speed mode. |
Definition at line 44 of file cmp_driver.h.
Voltage Reference selection Implements : cmp_voltage_reference_t_Class.
Enumerator | |
---|---|
CMP_VIN1 |
Use Vin1 as supply reference source for DAC. |
CMP_VIN2 |
Use Vin2 as supply reference source for DAC. |
Definition at line 53 of file cmp_driver.h.
status_t CMP_DRV_ClearInputFlags | ( | const uint32_t | instance | ) |
Clear comparator input channels flags.
This function clear comparator input channels flags.
instance | - instance number |
Definition at line 463 of file cmp_driver.c.
status_t CMP_DRV_ClearOutputFlags | ( | const uint32_t | instance | ) |
Clear comparator output flags.
This function clear comparator output flags(rising and falling edge).
instance | - instance number |
Definition at line 418 of file cmp_driver.c.
status_t CMP_DRV_ConfigComparator | ( | const uint32_t | instance, |
const cmp_comparator_t * | config | ||
) |
Configure only comparator features.
This function configure only features related with comparator: DMA request, power mode, output select, interrupts enable, invert, offset, hysteresis.
instance | - instance number |
config | - the configuration structure |
Definition at line 510 of file cmp_driver.c.
Configure only the DAC component.
This function configures the DAC with the options provided in the config structure.
instance | - instance number |
config | - the configuration structure |
Definition at line 238 of file cmp_driver.c.
status_t CMP_DRV_ConfigMUX | ( | const uint32_t | instance, |
const cmp_anmux_t * | config | ||
) |
Configure only the MUX component.
This function configures the MUX with the options provided in the config structure.
instance | - instance number |
config | - the configuration structure |
Definition at line 293 of file cmp_driver.c.
status_t CMP_DRV_ConfigTriggerMode | ( | const uint32_t | instance, |
const cmp_trigger_mode_t * | config | ||
) |
Configure trigger mode.
This function configures the trigger mode with the options provided in the config structure.
instance | - instance number |
config | - the configuration structure |
Definition at line 354 of file cmp_driver.c.
status_t CMP_DRV_GetComparatorConfig | ( | const uint32_t | instance, |
cmp_comparator_t * | config | ||
) |
Return configuration for comparator from CMP module.
This function return configuration for features related with comparator: DMA request, power mode, output select, interrupts enable, invert, offset, hysteresis.
instance | - instance number |
config | - the configuration structure returned |
Definition at line 536 of file cmp_driver.c.
status_t CMP_DRV_GetConfigAll | ( | const uint32_t | instance, |
cmp_module_t *const | config | ||
) |
Gets the current comparator configuration.
This function returns the current configuration for comparator as a configuration structure.
instance | - instance number |
config | - the configuration structure |
Definition at line 180 of file cmp_driver.c.
Return current configuration for DAC.
This function returns current configuration only for DAC.
instance | - instance number |
config | - the configuration structure |
Definition at line 256 of file cmp_driver.c.
status_t CMP_DRV_GetInitConfigAll | ( | cmp_module_t * | config | ) |
Get reset configuration for all registers.
This function returns a configuration structure with reset values for all registers from comparator module.
config | - the configuration structure |
Definition at line 99 of file cmp_driver.c.
status_t CMP_DRV_GetInitConfigComparator | ( | cmp_comparator_t * | config | ) |
Get reset configuration for registers related with comparator features.
This function return a configuration structure with reset values for features associated with comparator (DMA request, power mode, output select, interrupts enable, invert, offset, hysteresis).
config | - the configuration structure |
Definition at line 485 of file cmp_driver.c.
Get reset configuration for registers related with DAC.
This function returns a configuration structure with reset values for features associated with DAC.
config | - the configuration structure |
Definition at line 222 of file cmp_driver.c.
status_t CMP_DRV_GetInitConfigMUX | ( | cmp_anmux_t * | config | ) |
Get reset configuration for registers related with MUX.
This function returns a configuration structure with reset values for features associated with MUX.
config | - the configuration structure |
Definition at line 275 of file cmp_driver.c.
status_t CMP_DRV_GetInitTriggerMode | ( | cmp_trigger_mode_t * | config | ) |
Get reset configuration for registers related with Trigger Mode.
This function returns a configuration structure with reset values for features associated with Trigger Mode.
config | - the configuration structure |
Definition at line 333 of file cmp_driver.c.
status_t CMP_DRV_GetInputFlags | ( | const uint32_t | instance, |
cmp_ch_list_t * | flags | ||
) |
Gets input channels change flags.
This function return in <flags> all input channels flags as uint8_t(1 bite for each channel flag).
instance | - instance number |
flags | - pointer to input flags |
Definition at line 445 of file cmp_driver.c.
status_t CMP_DRV_GetMUXConfig | ( | const uint32_t | instance, |
cmp_anmux_t *const | config | ||
) |
Return configuration only for the MUX component.
This function returns current configuration to determine which signals go to comparator ports.
instance | - instance number |
config | - the configuration structure |
Definition at line 313 of file cmp_driver.c.
status_t CMP_DRV_GetOutputFlags | ( | const uint32_t | instance, |
cmp_output_trigger_t * | flags | ||
) |
Get comparator output flags.
This function returns in <flags> comparator output flags(rising and falling edge).
instance | - instance number |
- | flags - pointer to output flags NO_EVENT RISING_EDGE FALLING_EDGE BOTH_EDGE |
Definition at line 400 of file cmp_driver.c.
status_t CMP_DRV_GetTriggerModeConfig | ( | const uint32_t | instance, |
cmp_trigger_mode_t *const | config | ||
) |
Get current trigger mode configuration.
This function returns the current trigger mode configuration for trigger mode.
instance | - instance number |
config | - the configuration structure |
Definition at line 377 of file cmp_driver.c.
status_t CMP_DRV_Init | ( | const uint32_t | instance, |
const cmp_module_t *const | config | ||
) |
Configure all comparator features with the given configuration structure.
This function configures the comparator module with the options provided in the config structure.
instance | - instance number |
config | - the configuration structure |
Definition at line 137 of file cmp_driver.c.
status_t CMP_DRV_Reset | ( | const uint32_t | instance | ) |
Reset all registers.
This function set all CMP registers to reset values.
instance | - instance number |
Definition at line 69 of file cmp_driver.c.