S32 SDK
Comparator HAL

Detailed Description

Comparator Hardware Abstraction Layer.

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_HAL.

void CMP_HAL_Init (CMP_Type *baseAddr)
 Initializes the comparator registers with reset values. More...
 
cmp_mode_t CMP_HAL_GetFunctionalMode (const CMP_Type *baseAddr)
 Gets the comparator functional mode. If you want to get filter count and filter period please use CMP_HAL_GetFilterSamplePeriod and CMP_HAL_GetSamplingState. More...
 
void CMP_HAL_SetFunctionalMode (CMP_Type *baseAddr, cmp_mode_t mode, uint8_t filter_sample_count, uint8_t filter_sample_period)
 Sets the comparator functional mode (mode, filter count, filter period) More...
 
static bool CMP_HAL_GetDMATriggerState (const CMP_Type *baseAddr)
 Verify if the DMA transfer trigger is enabled. More...
 
static void CMP_HAL_SetDMATriggerState (CMP_Type *baseAddr, bool to_set)
 Configure the DMA transfer trigger. More...
 
static cmp_output_trigger_t CMP_HAL_GetOutputInterruptTrigger (const CMP_Type *baseAddr)
 Return the comparator output interrupts source configuration(none, rising edge, falling edge or both edges) More...
 
static void CMP_HAL_SetOutputInterruptTrigger (CMP_Type *baseAddr, cmp_output_trigger_t to_set)
 Set the comparator output interrupts source configuration(none, rising edge, falling edge or both edges) More...
 
static cmp_output_trigger_t CMP_HAL_GetOutputEvent (const CMP_Type *baseAddr)
 Return type of event occurred at the comparator output. More...
 
static void CMP_HAL_ClearOutputEvent (CMP_Type *baseAddr)
 Clear all output flags. More...
 
static bool CMP_HAL_GetOutputRisingFlag (const CMP_Type *baseAddr)
 Verify if a rising edge occurred on COUT. More...
 
static void CMP_HAL_ClearOutputRisingFlag (CMP_Type *baseAddr)
 Clear rising edge flag. More...
 
static bool CMP_HAL_GetOutputFallingFlag (const CMP_Type *baseAddr)
 Verify if a falling-edge occurred on COUT. More...
 
static void CMP_HAL_ClearOutputFallingFlag (CMP_Type *baseAddr)
 Clear falling edge flag. More...
 
static bool CMP_HAL_GetComparatorOutput (const CMP_Type *baseAddr)
 Return the analog comparator output value. More...
 
static uint8_t CMP_HAL_GetFilterSamplePeriod (const CMP_Type *baseAddr)
 Return the sample period for filter(clock cycles) More...
 
static void CMP_HAL_SetFilterSamplePeriod (CMP_Type *baseAddr, uint8_t to_set)
 Set the filter sample period(clock cycles) More...
 
static bool CMP_HAL_GetSamplingState (const CMP_Type *baseAddr)
 Verify if the sampling mode is selected. More...
 
static void CMP_HAL_SetSamplingState (CMP_Type *baseAddr, bool to_set)
 Set the sampling mode state. More...
 
static bool CMP_HAL_GetWindowingModeState (const CMP_Type *baseAddr)
 
static void CMP_HAL_SetWindowingModeState (CMP_Type *baseAddr, bool to_set)
 Set the windowing mode state. More...
 
static cmp_power_mode_t CMP_HAL_GetPowerMode (const CMP_Type *baseAddr)
 Return the current power mode. More...
 
static void CMP_HAL_SetPowerMode (CMP_Type *baseAddr, cmp_power_mode_t to_set)
 Set the power mode. More...
 
static cmp_inverter_t CMP_HAL_GetInverterState (const CMP_Type *baseAddr)
 Return the current comparator output inverter. More...
 
static void CMP_HAL_SetInverterState (CMP_Type *baseAddr, cmp_inverter_t to_set)
 Configure the comparator output inverter mode. More...
 
static cmp_output_select_t CMP_HAL_GetComparatorOutputSource (const CMP_Type *baseAddr)
 Return the current comparator output selected. More...
 
static void CMP_HAL_SetComparatorOutputSource (CMP_Type *baseAddr, cmp_output_select_t to_set)
 Select the comparator output signal source. More...
 
static cmp_output_enable_t CMP_HAL_GetOutputPinState (const CMP_Type *baseAddr)
 Verify if the comparator output state(available/not available in a packaged pin) More...
 
static void CMP_HAL_SetOutputPinState (CMP_Type *baseAddr, cmp_output_enable_t to_set)
 Set the comparator output pin state(available/not available in a packaged pin) More...
 
static bool CMP_HAL_GetAnalogComparatorState (const CMP_Type *baseAddr)
 Verify if the analog comparator module is enabled. More...
 
static void CMP_HAL_SetAnalogComparatorState (CMP_Type *baseAddr, bool to_set)
 Set the analog comparator module state. More...
 
static uint8_t CMP_HAL_GetFilterSampleCount (const CMP_Type *baseAddr)
 Return the number of consecutive samples that must agree prior to the comparator output filter accepting a new output state. More...
 
static void CMP_HAL_SetFilterSampleCount (CMP_Type *baseAddr, uint8_t to_set)
 Set the number of consecutive samples that must agree prior to the comparator output filter accepting a new output state. More...
 
static cmp_offset_t CMP_HAL_GetOffset (const CMP_Type *baseAddr)
 Return the current offset level. More...
 
static void CMP_HAL_SetOffset (CMP_Type *baseAddr, cmp_offset_t to_set)
 Set the offset level. More...
 
static cmp_hysteresis_t CMP_HAL_GetHysteresis (const CMP_Type *baseAddr)
 Return the current hysteresis level. More...
 
static void CMP_HAL_SetHysteresis (CMP_Type *baseAddr, cmp_hysteresis_t to_set)
 Set the hysteresis level. More...
 
static void CMP_HAL_SetDACOutputState (CMP_Type *baseAddr, bool to_set)
 Set if the DAC output is enabled to go outside of this block. More...
 
static bool CMP_HAL_GetDACOutputState (const CMP_Type *baseAddr)
 Get if the DAC output is enabled to go outside of this block. More...
 
static cmp_port_mux_t CMP_HAL_GetPositivePortInput (const CMP_Type *baseAddr)
 Return the current source for positive port of the comparator. More...
 
static void CMP_HAL_SetPositivePortInput (CMP_Type *baseAddr, cmp_port_mux_t to_set)
 Set the source for positive port of the comparator. More...
 
static cmp_port_mux_t CMP_HAL_GetNegativePortInput (const CMP_Type *baseAddr)
 Return the current source for negative port of the comparator. More...
 
static void CMP_HAL_SetNegativePortInput (CMP_Type *baseAddr, cmp_port_mux_t to_set)
 Set the source for negative port of the comparator. More...
 
static cmp_ch_list_t CMP_HAL_GetRoundRobinChannels (const CMP_Type *baseAddr)
 Return which channels are used for round-robin checker. More...
 
static void CMP_HAL_SetRoundRobinChannels (CMP_Type *baseAddr, cmp_ch_list_t to_set)
 Set which channels are use for round-robin checker. More...
 
static bool CMP_HAL_GetDACState (const CMP_Type *baseAddr)
 Verify if the DAC is enabled. More...
 
static void CMP_HAL_SetDACState (CMP_Type *baseAddr, bool to_set)
 Set the DAC state (enabled/disabled) More...
 
static cmp_voltage_reference_t CMP_HAL_GetVoltageReference (const CMP_Type *baseAddr)
 Return the current voltage reference. More...
 
static void CMP_HAL_SetVoltageReference (CMP_Type *baseAddr, cmp_voltage_reference_t to_set)
 Set the voltage reference. More...
 
static cmp_ch_number_t CMP_HAL_GetPlusMUXControl (const CMP_Type *baseAddr)
 Determine which input is selected for the plus mux. More...
 
static void CMP_HAL_SetPlusMuxControl (CMP_Type *baseAddr, cmp_ch_number_t to_set)
 Select input for the plus mux. More...
 
static cmp_ch_number_t CMP_HAL_GetMinusMUXControl (const CMP_Type *baseAddr)
 Determine which input is selected for the minus mux. More...
 
static void CMP_HAL_SetMinusMUXControl (CMP_Type *baseAddr, cmp_ch_number_t to_set)
 Select input for the minus mux. More...
 
static uint8_t CMP_HAL_GetVoltage (const CMP_Type *baseAddr)
 Return the current output voltage level(0-255) More...
 
static void CMP_HAL_SetVoltage (CMP_Type *baseAddr, uint8_t to_set)
 Set the output voltage level. More...
 
static bool CMP_HAL_GetRoundRobinState (const CMP_Type *baseAddr)
 Verify if the round robin operation is enabled. More...
 
static void CMP_HAL_SetRoundRobinState (CMP_Type *baseAddr, bool to_set)
 Set the round robin operation state. More...
 
static bool CMP_HAL_GetRoundRobinInterruptState (const CMP_Type *baseAddr)
 Verify if the round robin interrupt is enabled. More...
 
static void CMP_HAL_SetRoundRobinInterruptState (CMP_Type *baseAddr, bool to_set)
 Set the round robin interrupt state. More...
 
static cmp_fixed_port_t CMP_HAL_GetFixedPort (const CMP_Type *baseAddr)
 Return the port fixed for round-robin operation. More...
 
static void CMP_HAL_SetFixedPort (CMP_Type *baseAddr, cmp_fixed_port_t to_set)
 Set the fixed port for round-robin operation. More...
 
static cmp_ch_number_t CMP_HAL_GetFixedChannel (const CMP_Type *baseAddr)
 Return which channel is selected for fixed mux port(as fixed reference) More...
 
static void CMP_HAL_SetFixedChannel (CMP_Type *baseAddr, cmp_ch_number_t to_set)
 Set which channel is used as the fixed reference input for the fixed mux port. More...
 
static cmp_ch_list_t CMP_HAL_GetInputChangedFlags (const CMP_Type *baseAddr)
 Return all input changed flags. More...
 
static void CMP_HAL_ClearInputChangedFlags (CMP_Type *baseAddr)
 Clear all input changed flags. More...
 
static uint8_t CMP_HAL_GetRoundRobinSamplesNumber (const CMP_Type *baseAddr)
 Return how many round-robin clock cycles takes sampling. More...
 
static void CMP_HAL_SetRoundRobinSamplesNumber (CMP_Type *baseAddr, uint8_t to_set)
 Set how many round-robin clock cycles takes sampling. More...
 
static uint8_t CMP_HAL_GetInitDelay (const CMP_Type *baseAddr)
 Return the comparator and DAC initialization delay. More...
 
static void CMP_HAL_SetInitDelay (CMP_Type *baseAddr, uint8_t to_set)
 Set the comparator and DAC initialization delay. More...
 
static cmp_ch_list_t CMP_HAL_GetLastComparisonResult (const CMP_Type *baseAddr)
 Return last input comparison results for all channels. More...
 
static void CMP_HAL_SetPresetState (CMP_Type *baseAddr, cmp_ch_list_t to_set)
 Defines the pre-set state of input channels. More...
 

Macro Definition Documentation

#define CMP_INPUT_FLAGS_MASK   0xFF0000

Definition at line 56 of file cmp_hal.h.

#define CMP_INPUT_FLAGS_SHIFT   16U

Definition at line 57 of file cmp_hal.h.

#define CMP_ROUND_ROBIN_CHANNELS_MASK   0xFF0000

Definition at line 58 of file cmp_hal.h.

#define CMP_ROUND_ROBIN_CHANNELS_SHIFT   16U

Definition at line 59 of file cmp_hal.h.

Typedef Documentation

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 180 of file cmp_hal.h.

typedef uint8_t cmp_ch_number_t

Number of channel Implements : cmp_ch_number_t_Class.

Definition at line 185 of file cmp_hal.h.

Enumeration Type Documentation

Comparator Round-Robin fixed port Implements : cmp_fixed_port_t_Class.

Enumerator
CMP_PLUS_FIXED 

The Plus port is fixed. Only the inputs to the Minus port are swept in each round.

CMP_MINUS_FIXED 

The Minus port is fixed. Only the inputs to the Plus port are swept in each round.

Definition at line 141 of file cmp_hal.h.

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 130 of file cmp_hal.h.

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 94 of file cmp_hal.h.

enum cmp_mode_t

Comparator functional modes Implements : cmp_mode_t_Class.

Enumerator
CMP_DISABLED 
CMP_CONTINUOUS 
CMP_SAMPLED_NONFILTRED_INT_CLK 
CMP_SAMPLED_NONFILTRED_EXT_CLK 
CMP_SAMPLED_FILTRED_INT_CLK 
CMP_SAMPLED_FILTRED_EXT_CLK 
CMP_WINDOWED 
CMP_WINDOWED_RESAMPLED 
CMP_WINDOWED_FILTRED 

Definition at line 161 of file cmp_hal.h.

Comparator hard block offset control Implements : cmp_offset_t_Class.

Enumerator
CMP_LEVEL_OFFSET_0 
CMP_LEVEL_OFFSET_1 

Definition at line 121 of file cmp_hal.h.

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 112 of file cmp_hal.h.

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 103 of file cmp_hal.h.

Comparator output interrupt configuration Implements : cmp_output_trigger_t_Class.

Enumerator
CMP_NO_EVENT 

Comparator output interrupts are disabled OR no event occurred.

CMP_FALLING_EDGE 

Comparator output interrupts will be generated only on falling edge OR only falling edge event occurred.

CMP_RISING_EDGE 

Comparator output interrupts will be generated only on rising edge OR only rising edge event occurred.

CMP_BOTH_EDGES 

Comparator output interrupts will be generated on both edges OR both edges event occurred.

Definition at line 150 of file cmp_hal.h.

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 85 of file cmp_hal.h.

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 67 of file cmp_hal.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 76 of file cmp_hal.h.

Function Documentation

static void CMP_HAL_ClearInputChangedFlags ( CMP_Type baseAddr)
inlinestatic

Clear all input changed flags.

Parameters
baseAddr- cmp base pointer
Returns
- void Implements : CMP_HAL_ClearInputChangedFlags_Activity

Definition at line 1120 of file cmp_hal.h.

static void CMP_HAL_ClearOutputEvent ( CMP_Type baseAddr)
inlinestatic

Clear all output flags.

Parameters
baseAddr- cmp base pointer
Returns
- void Implements : CMP_HAL_ClearOutputEvent_Activity

Definition at line 330 of file cmp_hal.h.

static void CMP_HAL_ClearOutputFallingFlag ( CMP_Type baseAddr)
inlinestatic

Clear falling edge flag.

Parameters
baseAddr- cmp base pointer
Returns
- void Implements : CMP_HAL_ClearOutputFallingFlag_Activity

Definition at line 391 of file cmp_hal.h.

static void CMP_HAL_ClearOutputRisingFlag ( CMP_Type baseAddr)
inlinestatic

Clear rising edge flag.

Parameters
baseAddr- cmp base pointer
Returns
- void Implements : CMP_HAL_ClearOutputRisingFlag_Activity

Definition at line 363 of file cmp_hal.h.

static bool CMP_HAL_GetAnalogComparatorState ( const CMP_Type baseAddr)
inlinestatic

Verify if the analog comparator module is enabled.

Parameters
baseAddr- cmp base pointer
Returns
- module state true - module is enabled false - module is disabled Implements : CMP_HAL_GetAnalogComparatorState_Activity

Definition at line 610 of file cmp_hal.h.

static bool CMP_HAL_GetComparatorOutput ( const CMP_Type baseAddr)
inlinestatic

Return the analog comparator output value.

Parameters
baseAddr- cmp base pointer
Returns
- analog comparator output value Implements : CMP_HAL_GetComparatorOutput_Activity

Definition at line 406 of file cmp_hal.h.

static cmp_output_select_t CMP_HAL_GetComparatorOutputSource ( const CMP_Type baseAddr)
inlinestatic

Return the current comparator output selected.

Parameters
baseAddr- cmp base pointer
Returns
- comparator output signal source CMP_COUT CMP_COUTA Implements : CMP_HAL_GetComparatorOutputSource_Activity

Definition at line 555 of file cmp_hal.h.

static bool CMP_HAL_GetDACOutputState ( const CMP_Type baseAddr)
inlinestatic

Get if the DAC output is enabled to go outside of this block.

Parameters
baseAddr- cmp base pointer
to_set- DAC output state true - DAC output go outside of DAC block(to packaged pin) false - DAC output doesn't go outside of DAC block(to packaged pin)
Returns
- void Implements : CMP_HAL_GetDACOutputState_Activity

Definition at line 748 of file cmp_hal.h.

static bool CMP_HAL_GetDACState ( const CMP_Type baseAddr)
inlinestatic

Verify if the DAC is enabled.

Parameters
baseAddr- cmp base pointer
Returns
- dac state true - DAC is enabled false - DAC is disabled Implements : CMP_HAL_GetDACState_Activity

Definition at line 859 of file cmp_hal.h.

static bool CMP_HAL_GetDMATriggerState ( const CMP_Type baseAddr)
inlinestatic

Verify if the DMA transfer trigger is enabled.

Parameters
baseAddr- cmp base pointer
Returns
- DMA transfer trigger state true - DMA trigger is enabled false - DAM trigger is disabled Implements : CMP_HAL_GetDMATriggerState_Activity

Definition at line 252 of file cmp_hal.h.

static uint8_t CMP_HAL_GetFilterSampleCount ( const CMP_Type baseAddr)
inlinestatic

Return the number of consecutive samples that must agree prior to the comparator output filter accepting a new output state.

Parameters
baseAddr- cmp base pointer
Returns
- filter sample count Implements : CMP_HAL_GetFilterSampleCount_Activity

Definition at line 635 of file cmp_hal.h.

static uint8_t CMP_HAL_GetFilterSamplePeriod ( const CMP_Type baseAddr)
inlinestatic

Return the sample period for filter(clock cycles)

Parameters
baseAddr- cmp base pointer
Returns
- sampling period(in bus cycles) Implements : CMP_HAL_GetFilterSamplePeriod_Activity

Definition at line 417 of file cmp_hal.h.

static cmp_ch_number_t CMP_HAL_GetFixedChannel ( const CMP_Type baseAddr)
inlinestatic

Return which channel is selected for fixed mux port(as fixed reference)

Parameters
baseAddr- cmp base pointer
Returns
- fixed channel CMP_PLUS_FIXED CMP_MINUS_FIXED Implements : CMP_HAL_GetFixedChannel_Activity

Definition at line 1076 of file cmp_hal.h.

static cmp_fixed_port_t CMP_HAL_GetFixedPort ( const CMP_Type baseAddr)
inlinestatic

Return the port fixed for round-robin operation.

Parameters
baseAddr- cmp base pointer
Returns
- fixed port Implements : CMP_HAL_GetFixedPort_Activity

Definition at line 1049 of file cmp_hal.h.

cmp_mode_t CMP_HAL_GetFunctionalMode ( const CMP_Type baseAddr)

Gets the comparator functional mode. If you want to get filter count and filter period please use CMP_HAL_GetFilterSamplePeriod and CMP_HAL_GetSamplingState.

Parameters
baseAddr- cmp base pointer
Returns
- functional mode CMP_DISABLED CMP_CONTINUOUS CMP_SAMPLED_NONFILTRED_INT_CLK CMP_SAMPLED_NONFILTRED_EXT_CLK CMP_SAMPLED_FILTRED_INT_CLK CMP_SAMPLED_FILTRED_EXT_CLK CMP_WINDOWED CMP_WINDOWED_RESAMPLED CMP_WINDOWED_FILTRED

Definition at line 150 of file cmp_hal.c.

static cmp_hysteresis_t CMP_HAL_GetHysteresis ( const CMP_Type baseAddr)
inlinestatic

Return the current hysteresis level.

Parameters
baseAddr- cmp base pointer
Returns
- current hysteresis level CMP_LEVEL_HYS_0 CMP_LEVEL_HYS_1 CMP_LEVEL_HYS_2 CMP_LEVEL_HYS_3 Implements : CMP_HAL_GetHysteresis_Activity

Definition at line 699 of file cmp_hal.h.

static uint8_t CMP_HAL_GetInitDelay ( const CMP_Type baseAddr)
inlinestatic

Return the comparator and DAC initialization delay.

Parameters
baseAddr- cmp base pointer
Returns
- delay(round-robin clock period) Implements : CMP_HAL_GetInitDelay_Activity

Definition at line 1164 of file cmp_hal.h.

static cmp_ch_list_t CMP_HAL_GetInputChangedFlags ( const CMP_Type baseAddr)
inlinestatic

Return all input changed flags.

Parameters
baseAddr- cmp base pointer
Returns
- flags status |-----—|-----—|--—|-----—|-----—| |CH7_flag|CH6_flag|.....|CH1_flag|CH0_flag| |-----—|-----—|--—|-----—|-----—| Implements : CMP_HAL_GetInputChangedFlags_Activity

Definition at line 1107 of file cmp_hal.h.

static cmp_inverter_t CMP_HAL_GetInverterState ( const CMP_Type baseAddr)
inlinestatic

Return the current comparator output inverter.

Parameters
baseAddrcmp base pointer
Returns
- inverter state CMP_NORMAL CMP_INVERT Implements : CMP_HAL_GetInverterState_Activity

Definition at line 528 of file cmp_hal.h.

static cmp_ch_list_t CMP_HAL_GetLastComparisonResult ( const CMP_Type baseAddr)
inlinestatic

Return last input comparison results for all channels.

Parameters
baseAddr- cmp base pointer
Returns
- comparison results Implements : CMP_HAL_GetLastComparisonResult_Activity

Definition at line 1192 of file cmp_hal.h.

static cmp_ch_number_t CMP_HAL_GetMinusMUXControl ( const CMP_Type baseAddr)
inlinestatic

Determine which input is selected for the minus mux.

Parameters
baseAddr- cmp base pointer
Returns
- channel for the minus mux Implements : CMP_HAL_GetMinusMUXControl_Activity

Definition at line 939 of file cmp_hal.h.

static cmp_port_mux_t CMP_HAL_GetNegativePortInput ( const CMP_Type baseAddr)
inlinestatic

Return the current source for negative port of the comparator.

Parameters
baseAddr- cmp base pointer
Returns
- signal source CMP_DAC CMP_MUX Implements : CMP_HAL_GetNegativePortInput_Activity

Definition at line 793 of file cmp_hal.h.

static cmp_offset_t CMP_HAL_GetOffset ( const CMP_Type baseAddr)
inlinestatic

Return the current offset level.

Parameters
baseAddr- cmp base pointer
Returns
- offset level CMP_LEVEL_OFFSET_0 CMP_LEVEL_OFFSET_1 Implements : CMP_HAL_GetOffset_Activity

Definition at line 667 of file cmp_hal.h.

static cmp_output_trigger_t CMP_HAL_GetOutputEvent ( const CMP_Type baseAddr)
inlinestatic

Return type of event occurred at the comparator output.

Parameters
baseAddr- cmp base pointer
Returns
- comparator output flags CMP_NO_EVENT CMP_FALLING_EDGE CMP_RISING_EDGE CMP_BOTH_EDGES Implements : CMP_HAL_GetOutputEvent_Activity

Definition at line 317 of file cmp_hal.h.

static bool CMP_HAL_GetOutputFallingFlag ( const CMP_Type baseAddr)
inlinestatic

Verify if a falling-edge occurred on COUT.

Parameters
baseAddrcmp base pointer
Returns
- Falling edge flag state true - falling-edge event occurred on COUT false - falling-edge event doesn't occurred on COUT Implements : CMP_HAL_GetOutputFallingFlag_Activity

Definition at line 380 of file cmp_hal.h.

static cmp_output_trigger_t CMP_HAL_GetOutputInterruptTrigger ( const CMP_Type baseAddr)
inlinestatic

Return the comparator output interrupts source configuration(none, rising edge, falling edge or both edges)

Parameters
baseAddr- cmp base pointer
Returns
- comparator output interrupts configuration CMP_NO_EVENT CMP_FALLING_EDGE CMP_RISING_EDGE CMP_BOTH_EDGES Implements : CMP_HAL_GetOutputInterruptTrigger_Activity

Definition at line 281 of file cmp_hal.h.

static cmp_output_enable_t CMP_HAL_GetOutputPinState ( const CMP_Type baseAddr)
inlinestatic

Verify if the comparator output state(available/not available in a packaged pin)

Parameters
baseAddr- cmp base pointer
Returns
- comparator output state CMP_UNAVAILABLE CMP_AVAILABLE Implements : CMP_HAL_GetOutputPinState_Activity

Definition at line 582 of file cmp_hal.h.

static bool CMP_HAL_GetOutputRisingFlag ( const CMP_Type baseAddr)
inlinestatic

Verify if a rising edge occurred on COUT.

Parameters
baseAddr- cmp base pointer
Returns
- rising-edge flag state true - rising-edge event occurred on COUT false - rising-edge event doesn't occurred on COUT Implements : CMP_HAL_GetOutputRisingFlag_Activity

Definition at line 352 of file cmp_hal.h.

static cmp_ch_number_t CMP_HAL_GetPlusMUXControl ( const CMP_Type baseAddr)
inlinestatic

Determine which input is selected for the plus mux.

Parameters
baseAddr- cmp base pointer
Returns
- channel for the plus mux Implements : CMP_HAL_GetPlusMUXControl_Activity

Definition at line 911 of file cmp_hal.h.

static cmp_port_mux_t CMP_HAL_GetPositivePortInput ( const CMP_Type baseAddr)
inlinestatic

Return the current source for positive port of the comparator.

Parameters
baseAddr- cmp base pointer
Returns
- signal source CMP_DAC CMP_MUX Implements : CMP_HAL_GetPositivePortInput_Activity

Definition at line 761 of file cmp_hal.h.

static cmp_power_mode_t CMP_HAL_GetPowerMode ( const CMP_Type baseAddr)
inlinestatic

Return the current power mode.

Parameters
baseAddr- cmp base pointer
Returns
- current power mode CMP_LOW_SPEED CMP_HIGH_SPEED Implements : CMP_HAL_GetPowerMode_Activity

Definition at line 502 of file cmp_hal.h.

static cmp_ch_list_t CMP_HAL_GetRoundRobinChannels ( const CMP_Type baseAddr)
inlinestatic

Return which channels are used for round-robin checker.

Parameters
baseAddr- cmp base pointer
Returns
- channels states, one bite for each channel state |------—|------—|--—|------—|------—| |CH7_state|CH6_state|.....|CH1_state|CH0_state| |------—|------—|--—|------—|------—| Implements : CMP_HAL_GetRoundRobinChannels_Activity

Definition at line 826 of file cmp_hal.h.

static bool CMP_HAL_GetRoundRobinInterruptState ( const CMP_Type baseAddr)
inlinestatic

Verify if the round robin interrupt is enabled.

Parameters
baseAddr- cmp base pointer
Returns
- round-robin interrupt state true - round robin interrupt is enabled false - round robin interrupt is disabled Implements : CMP_HAL_GetRoundRobinInterruptState_Activity

Definition at line 1024 of file cmp_hal.h.

static uint8_t CMP_HAL_GetRoundRobinSamplesNumber ( const CMP_Type baseAddr)
inlinestatic

Return how many round-robin clock cycles takes sampling.

Parameters
baseAddr- cmp base pointer
Returns
- number of sample clocks Implements : CMP_HAL_GetRoundRobinSamplesNumber_Activity

Definition at line 1136 of file cmp_hal.h.

static bool CMP_HAL_GetRoundRobinState ( const CMP_Type baseAddr)
inlinestatic

Verify if the round robin operation is enabled.

Parameters
baseAddr-cmp base pointer
Returns
- round-robin operation state true - round robin operation is enabled false - round robin operation is disabled Implements : CMP_HAL_GetRoundRobinState_Activity

Definition at line 997 of file cmp_hal.h.

static bool CMP_HAL_GetSamplingState ( const CMP_Type baseAddr)
inlinestatic

Verify if the sampling mode is selected.

Parameters
baseAddr- cmp base pointer
Returns
- sampling mode state true - sampling mode is used false - sampling mode isn't used Implements : CMP_HAL_GetSamplingState_Activity

Definition at line 448 of file cmp_hal.h.

static uint8_t CMP_HAL_GetVoltage ( const CMP_Type baseAddr)
inlinestatic

Return the current output voltage level(0-255)

Parameters
baseAddr- cmp base pointer
Returns
- voltage level Implements : CMP_HAL_GetVoltage_Activity

Definition at line 967 of file cmp_hal.h.

static cmp_voltage_reference_t CMP_HAL_GetVoltageReference ( const CMP_Type baseAddr)
inlinestatic

Return the current voltage reference.

Parameters
baseAddr- cmp base pointer
Returns
- voltage referece CMP_VIN1 CMP_VIN2 Implements : CMP_HAL_GetVoltageReference_Activity

Definition at line 886 of file cmp_hal.h.

static bool CMP_HAL_GetWindowingModeState ( const CMP_Type baseAddr)
inlinestatic

Verify if the windowing mode is selected

Parameters
baseAddr- cmp base pointer
Returns
- windowing mode state true - windowing mode is used false - windowing mode isn't used Implements : CMP_HAL_GetWindowingModeState_Activity

Definition at line 475 of file cmp_hal.h.

void CMP_HAL_Init ( CMP_Type baseAddr)

Initializes the comparator registers with reset values.

Parameters
baseAddr- cmp base pointer
Returns
- void

Definition at line 42 of file cmp_hal.c.

static void CMP_HAL_SetAnalogComparatorState ( CMP_Type baseAddr,
bool  to_set 
)
inlinestatic

Set the analog comparator module state.

Parameters
baseAddr- cmp base pointer
to_set- analog comparator module state true - module is enabled false - module is disabled Implements : CMP_HAL_SetAnalogComparatorState_Activity

Definition at line 623 of file cmp_hal.h.

static void CMP_HAL_SetComparatorOutputSource ( CMP_Type baseAddr,
cmp_output_select_t  to_set 
)
inlinestatic

Select the comparator output signal source.

Parameters
baseAddr- cmp base pointer
to_set- comparator output signal source CMP_COUT CMP_COUTA
Returns
void Implements : CMP_HAL_SetComparatorOutputSource_Activity

Definition at line 569 of file cmp_hal.h.

static void CMP_HAL_SetDACOutputState ( CMP_Type baseAddr,
bool  to_set 
)
inlinestatic

Set if the DAC output is enabled to go outside of this block.

Parameters
baseAddr- cmp base pointer
to_set- DAC output state true - DAC output go outside of DAC block(to packaged pin) false - DAC output doesn't go outside of DAC block(to packaged pin)
Returns
- void Implements : CMP_HAL_SetDACOutputState_Activity

Definition at line 734 of file cmp_hal.h.

static void CMP_HAL_SetDACState ( CMP_Type baseAddr,
bool  to_set 
)
inlinestatic

Set the DAC state (enabled/disabled)

Parameters
baseAddr- cmp base pointer
to_set- DAC state true - DAC is enabled false - DAC is disabled
Returns
- void Implements : CMP_HAL_SetDACState_Activity

Definition at line 873 of file cmp_hal.h.

static void CMP_HAL_SetDMATriggerState ( CMP_Type baseAddr,
bool  to_set 
)
inlinestatic

Configure the DMA transfer trigger.

Parameters
baseAddr- cmp base pointer
to_set- DMA transfer trigger state true - DMA trigger is enabled false - DAM trigger is disabled
Returns
- void Implements : CMP_HAL_SetDMATriggerState_Activity

Definition at line 266 of file cmp_hal.h.

static void CMP_HAL_SetFilterSampleCount ( CMP_Type baseAddr,
uint8_t  to_set 
)
inlinestatic

Set the number of consecutive samples that must agree prior to the comparator output filter accepting a new output state.

Parameters
baseAddr- cmp base pointer
to_set- filter sample count(min value 0, max value 7)
Returns
- void Implements : CMP_HAL_SetFilterSampleCount_Activity

Definition at line 650 of file cmp_hal.h.

static void CMP_HAL_SetFilterSamplePeriod ( CMP_Type baseAddr,
uint8_t  to_set 
)
inlinestatic

Set the filter sample period(clock cycles)

Parameters
baseAddr-cmp base pointer
to_set- number of bus cycles
Returns
- void Implements : CMP_HAL_SetFilterSamplePeriod_Activity

Definition at line 431 of file cmp_hal.h.

static void CMP_HAL_SetFixedChannel ( CMP_Type baseAddr,
cmp_ch_number_t  to_set 
)
inlinestatic

Set which channel is used as the fixed reference input for the fixed mux port.

Parameters
baseAddr- cmp base pointer
to_set- fixed channel
Returns
- void Implements : CMP_HAL_SetFixedChannel_Activity

Definition at line 1090 of file cmp_hal.h.

static void CMP_HAL_SetFixedPort ( CMP_Type baseAddr,
cmp_fixed_port_t  to_set 
)
inlinestatic

Set the fixed port for round-robin operation.

Parameters
baseAddr- cmp base pointer
to_set- fixed port CMP_PLUS_FIXED CMP_MINUS_FIXED
Returns
- void Implements : CMP_HAL_SetFixedPort_Activity

Definition at line 1063 of file cmp_hal.h.

void CMP_HAL_SetFunctionalMode ( CMP_Type baseAddr,
cmp_mode_t  mode,
uint8_t  filter_sample_count,
uint8_t  filter_sample_period 
)

Sets the comparator functional mode (mode, filter count, filter period)

Parameters
baseAddr- cmp base pointer
mode- functional mode CMP_DISABLED CMP_CONTINUOUS CMP_SAMPLED_NONFILTRED_INT_CLK CMP_SAMPLED_NONFILTRED_EXT_CLK CMP_SAMPLED_FILTRED_INT_CLK CMP_SAMPLED_FILTRED_EXT_CLK CMP_WINDOWED CMP_WINDOWED_RESAMPLED CMP_WINDOWED_FILTRED
filter_sample_count- number of consecutive samples that must agree prior to the comparator ouput filter accepting a new output state
filter_sample_period- sampling period
Returns
-void

Definition at line 81 of file cmp_hal.c.

static void CMP_HAL_SetHysteresis ( CMP_Type baseAddr,
cmp_hysteresis_t  to_set 
)
inlinestatic

Set the hysteresis level.

Parameters
baseAddr- cmp base pointer
to_set- hysteresis level CMP_LEVEL_HYS_0 CMP_LEVEL_HYS_1 CMP_LEVEL_HYS_2 CMP_LEVEL_HYS_3
Returns
- void Implements : CMP_HAL_SetHysteresis_Activity

Definition at line 717 of file cmp_hal.h.

static void CMP_HAL_SetInitDelay ( CMP_Type baseAddr,
uint8_t  to_set 
)
inlinestatic

Set the comparator and DAC initialization delay.

Parameters
baseAddr- cmp base pointer
to_set- delay (min value 0, max value 63)
Returns
- void Implements : CMP_HAL_SetInitDelay_Activity

Definition at line 1178 of file cmp_hal.h.

static void CMP_HAL_SetInverterState ( CMP_Type baseAddr,
cmp_inverter_t  to_set 
)
inlinestatic

Configure the comparator output inverter mode.

Parameters
baseAddr- cmp base pointer
to_set- comparator output inverter mode CMP_NORMAL CMP_INVERT
Returns
- void Implements : CMP_HAL_SetInverterState_Activity

Definition at line 542 of file cmp_hal.h.

static void CMP_HAL_SetMinusMUXControl ( CMP_Type baseAddr,
cmp_ch_number_t  to_set 
)
inlinestatic

Select input for the minus mux.

Parameters
baseAddr- cmp base pointer
to_set- channel for the minus mux
Returns
- void Implements : CMP_HAL_SetMinusMUXControl_Activity

Definition at line 953 of file cmp_hal.h.

static void CMP_HAL_SetNegativePortInput ( CMP_Type baseAddr,
cmp_port_mux_t  to_set 
)
inlinestatic

Set the source for negative port of the comparator.

Parameters
baseAddr- cmp base pointer
to_set- signal source CMP_DAC CMP_MUX
Returns
- void Implements : CMP_HAL_SetNegativePortInput_Activity

Definition at line 809 of file cmp_hal.h.

static void CMP_HAL_SetOffset ( CMP_Type baseAddr,
cmp_offset_t  to_set 
)
inlinestatic

Set the offset level.

Parameters
baseAddr- cmp base pointer
to_set- offset level CMP_LEVEL_OFFSET_0 CMP_LEVEL_OFFSET_1
Returns
- void Implements : CMP_HAL_SetOffset_Activity

Definition at line 681 of file cmp_hal.h.

static void CMP_HAL_SetOutputInterruptTrigger ( CMP_Type baseAddr,
cmp_output_trigger_t  to_set 
)
inlinestatic

Set the comparator output interrupts source configuration(none, rising edge, falling edge or both edges)

Parameters
baseAddr- cmp base pointer
to_set- comparator output interrupts configuration CMP_NO_EVENT CMP_FALLING_EDGE CMP_RISING_EDGE CMP_BOTH_EDGES
Returns
- void Implements : CMP_HAL_SetOutputInterruptTrigger_Activity

Definition at line 299 of file cmp_hal.h.

static void CMP_HAL_SetOutputPinState ( CMP_Type baseAddr,
cmp_output_enable_t  to_set 
)
inlinestatic

Set the comparator output pin state(available/not available in a packaged pin)

Parameters
baseAddr- cmp base pointer
to_set- comparator output state CMP_UNAVAILABLE CMP_AVAILABLE
Returns
- void Implements : CMP_HAL_SetOutputPinState_Activity

Definition at line 596 of file cmp_hal.h.

static void CMP_HAL_SetPlusMuxControl ( CMP_Type baseAddr,
cmp_ch_number_t  to_set 
)
inlinestatic

Select input for the plus mux.

Parameters
baseAddrcmp base pointer
to_set- channel for the plus mux
Returns
- void Implements : CMP_HAL_SetPlusMuxControl_Activity

Definition at line 925 of file cmp_hal.h.

static void CMP_HAL_SetPositivePortInput ( CMP_Type baseAddr,
cmp_port_mux_t  to_set 
)
inlinestatic

Set the source for positive port of the comparator.

Parameters
baseAddrcmp base pointer
to_set- signal source CMP_DAC CMP_MUX
Returns
- void Implements : CMP_HAL_SetPositivePortInput_Activity

Definition at line 777 of file cmp_hal.h.

static void CMP_HAL_SetPowerMode ( CMP_Type baseAddr,
cmp_power_mode_t  to_set 
)
inlinestatic

Set the power mode.

Parameters
baseAddr- cmp base pointer
to_set- power mode CMP_LOW_SPEED CMP_HIGH_SPEED Implements : CMP_HAL_SetPowerMode_Activity

Definition at line 515 of file cmp_hal.h.

static void CMP_HAL_SetPresetState ( CMP_Type baseAddr,
cmp_ch_list_t  to_set 
)
inlinestatic

Defines the pre-set state of input channels.

Parameters
baseAddrcmp base pointer
to_set- state
Returns
void Implements : CMP_HAL_SetPresetState_Activity

Definition at line 1206 of file cmp_hal.h.

static void CMP_HAL_SetRoundRobinChannels ( CMP_Type baseAddr,
cmp_ch_list_t  to_set 
)
inlinestatic

Set which channels are use for round-robin checker.

Parameters
baseAddr- cmp base pointer
to_set- channels states, one bite for each channel state |------—|------—|--—|------—|------—| |CH7_state|CH6_state|.....|CH1_state|CH0_state| |------—|------—|--—|------—|------—|
Returns
- void Implements : CMP_HAL_SetRoundRobinChannels_Activity

Definition at line 843 of file cmp_hal.h.

static void CMP_HAL_SetRoundRobinInterruptState ( CMP_Type baseAddr,
bool  to_set 
)
inlinestatic

Set the round robin interrupt state.

Parameters
baseAddr- cmp base pointer
to_set- round robin interrupt state true - round robin interrupt is enabled false - round robin interrupt is disabled
Returns
- void Implements : CMP_HAL_SetRoundRobinInterruptState_Activity

Definition at line 1038 of file cmp_hal.h.

static void CMP_HAL_SetRoundRobinSamplesNumber ( CMP_Type baseAddr,
uint8_t  to_set 
)
inlinestatic

Set how many round-robin clock cycles takes sampling.

Parameters
baseAddr- cmp base pointer
to_set- number of sample clocks(min value 0, max value 3)
Returns
- void Implements : CMP_HAL_SetRoundRobinSamplesNumber_Activity

Definition at line 1150 of file cmp_hal.h.

static void CMP_HAL_SetRoundRobinState ( CMP_Type baseAddr,
bool  to_set 
)
inlinestatic

Set the round robin operation state.

Parameters
baseAddrcmp base pointer
to_set- round robin operation state true - round robin operation is enabled false - round robin operation is disabled
Returns
- void Implements : CMP_HAL_SetRoundRobinState_Activity

Definition at line 1011 of file cmp_hal.h.

static void CMP_HAL_SetSamplingState ( CMP_Type baseAddr,
bool  to_set 
)
inlinestatic

Set the sampling mode state.

Parameters
baseAddr- cmp the base pointer
to_set- sampling mode state true - sampling mode is used false - sampling mode isn't used
Returns
- void Implements : CMP_HAL_SetSamplingState_Activity

Definition at line 462 of file cmp_hal.h.

static void CMP_HAL_SetVoltage ( CMP_Type baseAddr,
uint8_t  to_set 
)
inlinestatic

Set the output voltage level.

Parameters
baseAddr- cmp base pointer
to_set- voltage level
Returns
- void Implements : CMP_HAL_SetVoltage_Activity

Definition at line 981 of file cmp_hal.h.

static void CMP_HAL_SetVoltageReference ( CMP_Type baseAddr,
cmp_voltage_reference_t  to_set 
)
inlinestatic

Set the voltage reference.

Parameters
baseAddr- cmp base pointer
to_set- voltage reference CMP_VIN1 CMP_VIN2
Returns
- void Implements : CMP_HAL_SetVoltageReference_Activity

Definition at line 900 of file cmp_hal.h.

static void CMP_HAL_SetWindowingModeState ( CMP_Type baseAddr,
bool  to_set 
)
inlinestatic

Set the windowing mode state.

Parameters
baseAddr- cmp base pointer
to_set- windowing mode state; true - windowing mode is used false - windowing mode isn't used
Returns
void Implements : CMP_HAL_SetWindowingModeState_Activity

Definition at line 489 of file cmp_hal.h.