56 #define CMP_INPUT_FLAGS_MASK 0xFF0000
57 #define CMP_INPUT_FLAGS_SHIFT 16U
58 #define CMP_ROUND_ROBIN_CHANNELS_MASK 0xFF0000
59 #define CMP_ROUND_ROBIN_CHANNELS_SHIFT 16U
197 #if defined(__cplusplus)
285 return (
cmp_output_trigger_t) (((uint32_t)rising_enabled << (uint32_t)1U) | ((uint32_t)falling_enabled));
301 uint32_t tmp = baseAddr->
C0;
321 return (
cmp_output_trigger_t) (((uint32_t)rising_enabled << (uint32_t)1U) | ((uint32_t)falling_enabled));
332 uint32_t tmp = baseAddr->
C0;
419 uint32_t tmp = baseAddr->
C0;
421 return ( uint8_t ) (tmp);
433 uint32_t tmp = baseAddr->
C0;
637 uint32_t tmp = baseAddr->
C0;
639 return ( uint8_t ) (tmp);
652 uint32_t tmp = baseAddr->
C0;
683 uint32_t tmp = baseAddr->
C0;
701 uint32_t tmp = baseAddr->
C0;
719 uint32_t tmp = baseAddr->
C0;
763 uint32_t tmp = baseAddr->
C1;
779 uint32_t tmp = baseAddr->
C1;
795 uint32_t tmp = baseAddr->
C1;
811 uint32_t tmp = baseAddr->
C1;
828 uint32_t tmp = baseAddr->
C1;
845 uint32_t tmp = baseAddr->
C1;
913 uint32_t tmp = baseAddr->
C1;
927 uint32_t tmp = baseAddr->
C1;
941 uint32_t tmp = baseAddr->
C1;
955 uint32_t tmp = baseAddr->
C1;
969 uint32_t tmp = baseAddr->
C1;
971 return ( uint8_t ) (tmp);
983 uint32_t tmp = baseAddr->
C1;
1078 uint32_t tmp = baseAddr->
C2;
1092 uint32_t tmp = baseAddr->
C2;
1109 uint32_t tmp = baseAddr->
C2;
1122 uint32_t tmp = baseAddr->
C2;
1138 uint32_t tmp = baseAddr->
C2;
1140 return ( uint8_t ) (tmp);
1152 uint32_t tmp = baseAddr->
C2;
1166 uint32_t tmp = baseAddr->
C2;
1168 return ( uint8_t ) (tmp);
1180 uint32_t tmp = baseAddr->
C2;
1194 uint32_t tmp = baseAddr->
C2;
1208 uint32_t tmp = baseAddr->
C2;
1215 #if defined(__cplusplus)
#define CMP_C2_INITMOD_SHIFT
static cmp_hysteresis_t CMP_HAL_GetHysteresis(const CMP_Type *baseAddr)
Return the current hysteresis level.
static void CMP_HAL_SetInitDelay(CMP_Type *baseAddr, uint8_t to_set)
Set the comparator and DAC initialization delay.
static void CMP_HAL_ClearOutputRisingFlag(CMP_Type *baseAddr)
Clear rising edge flag.
static cmp_ch_number_t CMP_HAL_GetFixedChannel(const CMP_Type *baseAddr)
Return which channel is selected for fixed mux port(as fixed reference)
#define CMP_C1_INNSEL_SHIFT
#define CMP_C0_PMODE_MASK
static cmp_ch_list_t CMP_HAL_GetInputChangedFlags(const CMP_Type *baseAddr)
Return all input changed flags.
#define CMP_C1_INPSEL_MASK
static void CMP_HAL_SetAnalogComparatorState(CMP_Type *baseAddr, bool to_set)
Set the analog comparator module state.
#define CMP_C0_FILTER_CNT(x)
static void CMP_HAL_SetInverterState(CMP_Type *baseAddr, cmp_inverter_t to_set)
Configure the comparator output inverter mode.
#define CMP_C0_INVT_SHIFT
static cmp_output_trigger_t CMP_HAL_GetOutputEvent(const CMP_Type *baseAddr)
Return type of event occurred at the comparator output.
#define CMP_C1_VOSEL_MASK
static void CMP_HAL_SetFilterSamplePeriod(CMP_Type *baseAddr, uint8_t to_set)
Set the filter sample period(clock cycles)
#define CMP_INPUT_FLAGS_SHIFT
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 edg...
static void CMP_HAL_SetVoltageReference(CMP_Type *baseAddr, cmp_voltage_reference_t to_set)
Set the voltage reference.
cmp_power_mode_t
Power Modes selection Implements : cmp_power_mode_t_Class.
#define CMP_C2_RRIE_SHIFT
#define CMP_C1_INPSEL_SHIFT
#define CMP_C2_FXMP_SHIFT
static void CMP_HAL_SetComparatorOutputSource(CMP_Type *baseAddr, cmp_output_select_t to_set)
Select the comparator output signal source.
static void CMP_HAL_SetDMATriggerState(CMP_Type *baseAddr, bool to_set)
Configure the DMA transfer trigger.
static void CMP_HAL_SetPositivePortInput(CMP_Type *baseAddr, cmp_port_mux_t to_set)
Set the source for positive port of the comparator.
cmp_port_mux_t
Port Mux Source selection Implements : cmp_port_mux_t_Class.
cmp_output_trigger_t
Comparator output interrupt configuration Implements : cmp_output_trigger_t_Class.
static void CMP_HAL_SetDACState(CMP_Type *baseAddr, bool to_set)
Set the DAC state (enabled/disabled)
#define CMP_C0_FILTER_CNT_MASK
#define CMP_ROUND_ROBIN_CHANNELS_MASK
static cmp_ch_number_t CMP_HAL_GetMinusMUXControl(const CMP_Type *baseAddr)
Determine which input is selected for the minus mux.
#define CMP_C2_FXMXCH_SHIFT
static void CMP_HAL_SetRoundRobinState(CMP_Type *baseAddr, bool to_set)
Set the round robin operation state.
#define CMP_C1_DACEN_MASK
static void CMP_HAL_ClearOutputEvent(CMP_Type *baseAddr)
Clear all output flags.
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)
static void CMP_HAL_SetPowerMode(CMP_Type *baseAddr, cmp_power_mode_t to_set)
Set the power mode.
static uint8_t CMP_HAL_GetVoltage(const CMP_Type *baseAddr)
Return the current output voltage level(0-255)
static void CMP_HAL_SetVoltage(CMP_Type *baseAddr, uint8_t to_set)
Set the output voltage level.
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...
static cmp_voltage_reference_t CMP_HAL_GetVoltageReference(const CMP_Type *baseAddr)
Return the current voltage reference.
static bool CMP_HAL_GetOutputRisingFlag(const CMP_Type *baseAddr)
Verify if a rising edge occurred on COUT.
static bool CMP_HAL_GetWindowingModeState(const CMP_Type *baseAddr)
#define CMP_C1_PSEL_SHIFT
uint8_t cmp_ch_list_t
Comparator channels list (1bit/channel) |------—|------—|--—|------—|------—| |CH7_state|CH6_sta...
static bool CMP_HAL_GetComparatorOutput(const CMP_Type *baseAddr)
Return the analog comparator output value.
static cmp_offset_t CMP_HAL_GetOffset(const CMP_Type *baseAddr)
Return the current offset level.
#define CMP_C2_FXMXCH_MASK
static cmp_ch_list_t CMP_HAL_GetRoundRobinChannels(const CMP_Type *baseAddr)
Return which channels are used for round-robin checker.
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)
static void CMP_HAL_SetPresetState(CMP_Type *baseAddr, cmp_ch_list_t to_set)
Defines the pre-set state of input channels.
#define CMP_C0_HYSTCTR_MASK
uint8_t cmp_ch_number_t
Number of channel Implements : cmp_ch_number_t_Class.
static bool CMP_HAL_GetDACOutputState(const CMP_Type *baseAddr)
Get if the DAC output is enabled to go outside of this block.
static cmp_inverter_t CMP_HAL_GetInverterState(const CMP_Type *baseAddr)
Return the current comparator output inverter.
#define CMP_C0_HYSTCTR(x)
static cmp_port_mux_t CMP_HAL_GetNegativePortInput(const CMP_Type *baseAddr)
Return the current source for negative port of the comparator.
static void CMP_HAL_ClearInputChangedFlags(CMP_Type *baseAddr)
Clear all input changed flags.
static cmp_ch_list_t CMP_HAL_GetLastComparisonResult(const CMP_Type *baseAddr)
Return last input comparison results for all channels.
static uint8_t CMP_HAL_GetInitDelay(const CMP_Type *baseAddr)
Return the comparator and DAC initialization delay.
static cmp_port_mux_t CMP_HAL_GetPositivePortInput(const CMP_Type *baseAddr)
Return the current source for positive port of the comparator.
static void CMP_HAL_SetSamplingState(CMP_Type *baseAddr, bool to_set)
Set the sampling mode state.
static void CMP_HAL_SetOffset(CMP_Type *baseAddr, cmp_offset_t to_set)
Set the offset level.
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.
#define CMP_C0_FILTER_CNT_SHIFT
static uint8_t CMP_HAL_GetFilterSamplePeriod(const CMP_Type *baseAddr)
Return the sample period for filter(clock cycles)
#define CMP_C2_INITMOD_MASK
#define CMP_C0_OFFSET_SHIFT
#define CMP_C0_DMAEN_SHIFT
#define CMP_C2_ACOn_SHIFT
cmp_offset_t
Comparator hard block offset control Implements : cmp_offset_t_Class.
cmp_output_enable_t
Comparator output pin enable selection Implements : cmp_output_enable_t_Class.
#define CMP_INPUT_FLAGS_MASK
static bool CMP_HAL_GetDMATriggerState(const CMP_Type *baseAddr)
Verify if the DMA transfer trigger is enabled.
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 accept...
#define CMP_C1_VOSEL_SHIFT
cmp_mode_t
Comparator functional modes Implements : cmp_mode_t_Class.
#define CMP_C2_NSAM_SHIFT
static void CMP_HAL_SetRoundRobinSamplesNumber(CMP_Type *baseAddr, uint8_t to_set)
Set how many round-robin clock cycles takes sampling.
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 ...
static cmp_power_mode_t CMP_HAL_GetPowerMode(const CMP_Type *baseAddr)
Return the current power mode.
static void CMP_HAL_SetRoundRobinChannels(CMP_Type *baseAddr, cmp_ch_list_t to_set)
Set which channels are use for round-robin checker.
#define CMP_ROUND_ROBIN_CHANNELS_SHIFT
#define CMP_C0_DMAEN_MASK
cmp_hysteresis_t
Comparator hysteresis control Implements : cmp_hysteresis_t_Class.
static uint8_t CMP_HAL_GetRoundRobinSamplesNumber(const CMP_Type *baseAddr)
Return how many round-robin clock cycles takes sampling.
void CMP_HAL_Init(CMP_Type *baseAddr)
Initializes the comparator registers with reset values.
static void CMP_HAL_ClearOutputFallingFlag(CMP_Type *baseAddr)
Clear falling edge flag.
static void CMP_HAL_SetMinusMUXControl(CMP_Type *baseAddr, cmp_ch_number_t to_set)
Select input for the minus mux.
static bool CMP_HAL_GetSamplingState(const CMP_Type *baseAddr)
Verify if the sampling mode is selected.
cmp_inverter_t
Comparator output invert selection Implements : cmp_inverter_t_Class.
static void CMP_HAL_SetRoundRobinInterruptState(CMP_Type *baseAddr, bool to_set)
Set the round robin interrupt state.
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)
static void CMP_HAL_SetWindowingModeState(CMP_Type *baseAddr, bool to_set)
Set the windowing mode state.
static void CMP_HAL_SetDACOutputState(CMP_Type *baseAddr, bool to_set)
Set if the DAC output is enabled to go outside of this block.
static void CMP_HAL_SetPlusMuxControl(CMP_Type *baseAddr, cmp_ch_number_t to_set)
Select input for the plus mux.
static cmp_ch_number_t CMP_HAL_GetPlusMUXControl(const CMP_Type *baseAddr)
Determine which input is selected for the plus mux.
#define CMP_C2_INITMOD(x)
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...
static void CMP_HAL_SetHysteresis(CMP_Type *baseAddr, cmp_hysteresis_t to_set)
Set the hysteresis level.
static bool CMP_HAL_GetAnalogComparatorState(const CMP_Type *baseAddr)
Verify if the analog comparator module is enabled.
static void CMP_HAL_SetNegativePortInput(CMP_Type *baseAddr, cmp_port_mux_t to_set)
Set the source for negative port of the comparator.
static void CMP_HAL_SetFixedPort(CMP_Type *baseAddr, cmp_fixed_port_t to_set)
Set the fixed port for round-robin operation.
static cmp_fixed_port_t CMP_HAL_GetFixedPort(const CMP_Type *baseAddr)
Return the port fixed for round-robin operation.
cmp_fixed_port_t
Comparator Round-Robin fixed port Implements : cmp_fixed_port_t_Class.
#define CMP_C1_MSEL_SHIFT
static bool CMP_HAL_GetOutputFallingFlag(const CMP_Type *baseAddr)
Verify if a falling-edge occurred on COUT.
#define CMP_C1_INNSEL_MASK
static cmp_output_select_t CMP_HAL_GetComparatorOutputSource(const CMP_Type *baseAddr)
Return the current comparator output selected.
cmp_voltage_reference_t
Voltage Reference selection Implements : cmp_voltage_reference_t_Class.
#define CMP_C0_PMODE_SHIFT
static bool CMP_HAL_GetRoundRobinState(const CMP_Type *baseAddr)
Verify if the round robin operation is enabled.
#define CMP_C1_VRSEL_SHIFT
static bool CMP_HAL_GetRoundRobinInterruptState(const CMP_Type *baseAddr)
Verify if the round robin interrupt is enabled.
#define CMP_C0_COUT_SHIFT
#define CMP_C0_OFFSET_MASK
#define CMP_C0_HYSTCTR_SHIFT
cmp_output_select_t
Comparator output select selection Implements : cmp_output_select_t_Class.
#define CMP_C1_DACEN_SHIFT
static bool CMP_HAL_GetDACState(const CMP_Type *baseAddr)
Verify if the DAC is enabled.