The analog comparator allows a system wakeup to be triggered by the voltage level of a differential or single-ended analog input applied through the port pins.
This module also contains functions for configuring and enabling the comparator.
An enum describing the input channel of the analog comparator.
Definition at line 36 of file hal_ancmp.h.
{ HAL_ANCMP_INP_AIN0 = HAL_INP_AIN0, HAL_ANCMP_INP_AIN1 = HAL_INP_AIN1, HAL_ANCMP_INP_AIN2 = HAL_INP_AIN2, HAL_ANCMP_INP_AIN3 = HAL_INP_AIN3, HAL_ANCMP_INP_AIN4 = HAL_INP_AIN4, HAL_ANCMP_INP_AIN5 = HAL_INP_AIN5, HAL_ANCMP_INP_AIN6 = HAL_INP_AIN6, HAL_ANCMP_INP_AIN7 = HAL_INP_AIN7, HAL_ANCMP_INP_AIN8 = HAL_INP_AIN8, HAL_ANCMP_INP_AIN9 = HAL_INP_AIN9, HAL_ANCMP_INP_AIN10 = HAL_INP_AIN10, HAL_ANCMP_INP_AIN11 = HAL_INP_AIN11, HAL_ANCMP_INP_AIN12 = HAL_INP_AIN12, HAL_ANCMP_INP_AIN13 = HAL_INP_AIN13 } hal_ancmp_input_channel_t;
enum hal_ancmp_pol_t |
An enum describing the reference of the analog comparator.
HAL_ANCMP_NON_INVERTING |
Non-inverting output polarity |
HAL_ANCMP_INVERTING |
Inverting output polarity |
Definition at line 56 of file hal_ancmp.h.
{ HAL_ANCMP_NON_INVERTING = 0x00, HAL_ANCMP_INVERTING = 0x01 } hal_ancmp_pol_t;
An enum describing the reference of the analog comparator.
Definition at line 64 of file hal_ancmp.h.
{ HAL_ANCMP_REF_SCALE_25 = 0x00, HAL_ANCMP_REF_SCALE_50 = 0x01, HAL_ANCMP_REF_SCALE_75 = 0x02, HAL_ANCMP_REF_SCALE_100 = 0x03, } hal_ancmp_ref_scale_t;
enum hal_ancmp_ref_t |
An enum describing the reference of the analog comparator.
Definition at line 74 of file hal_ancmp.h.
{ HAL_ANCMP_REF_VDD = 0x00, HAL_ANCMP_REF_EXT = 0x01 } hal_ancmp_ref_t;
void hal_ancmp_set_polarity | ( | hal_ancmp_pol_t | polarity ) |
Function to set the output polarity. Use this function set the output polarity of the analog comparator.
polarity | The output polarity |
Definition at line 25 of file hal_ancmp.c.
void hal_ancmp_set_ref_voltage_scale | ( | hal_ancmp_ref_scale_t | scale ) |
Function to set the reference voltage scaling. Use this function to set reference voltage scaling of the analog comparator.
scale | The reference voltage scaling |
Definition at line 30 of file hal_ancmp.c.
void hal_ancmp_set_reference | ( | hal_ancmp_ref_t | ref ) |
Function to set the reference of the analog comparator. Use this function to set the reference of the analog comparator.
ref | The reference of the analog comparator |
Definition at line 35 of file hal_ancmp.c.
void hal_ancmp_set_input_channel | ( | hal_ancmp_input_channel_t | chsel ) |
Function to set the input channel of the analog comparator. This function uses the ADC HAL to set the input channel of the analog comp.
chsel | The input channel of the analog comparator |
Definition at line 40 of file hal_ancmp.c.
{ hal_adc_input_channel_t channel; channel = (hal_adc_input_channel_t)chsel; hal_adc_set_input_channel(channel); }
void hal_ancmp_enable | ( | _Bool | en ) |
Function to enable the analog comparator. Use this function to enable the analog comparator.
en | True to enable, false to disable the analog comparator |
< The value of bit 0
< The value of bit 0
Definition at line 47 of file hal_ancmp.c.