Analog to Digital Converter Hardware Abstraction Layer.
This HAL provides low-level access to all hardware features of the ADC.
|
enum | adc_clk_divide_t { ADC_CLK_DIVIDE_1 = 0x00U,
ADC_CLK_DIVIDE_2 = 0x01U,
ADC_CLK_DIVIDE_4 = 0x02U,
ADC_CLK_DIVIDE_8 = 0x03U
} |
| Clock Divider selection Implements : adc_clk_divide_t_Class. More...
|
|
enum | adc_resolution_t { ADC_RESOLUTION_8BIT = 0x00U,
ADC_RESOLUTION_12BIT = 0x01U,
ADC_RESOLUTION_10BIT = 0x02U
} |
| Conversion resolution selection Implements : adc_resolution_t_Class. More...
|
|
enum | adc_input_clock_t { ADC_CLK_ALT_1 = 0x00U,
ADC_CLK_ALT_2 = 0x01U,
ADC_CLK_ALT_3 = 0x02U,
ADC_CLK_ALT_4 = 0x03U
} |
| Input clock source selection Implements : adc_input_clock_t_Class. More...
|
|
enum | adc_trigger_t { ADC_TRIGGER_SOFTWARE = 0x00U,
ADC_TRIGGER_HARDWARE = 0x01U
} |
| Trigger type selection Implements : adc_trigger_t_Class. More...
|
|
enum | adc_voltage_reference_t { ADC_VOLTAGEREF_VREF = 0x00U,
ADC_VOLTAGEREF_VALT = 0x01U
} |
| Voltage reference selection Implements : adc_voltage_reference_t_Class. More...
|
|
enum | adc_average_t { ADC_AVERAGE_4 = 0x00U,
ADC_AVERAGE_8 = 0x01U,
ADC_AVERAGE_16 = 0x02U,
ADC_AVERAGE_32 = 0x03U
} |
| Hardware average selection Implements : adc_average_t_Class. More...
|
|
static void ADC_HAL_ClearLatchTriggers |
( |
ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Clear the latched triggers.
This function clears the latched triggers, except for the one under process. Before calling this function, make sure the hardware trigger source of the ADC is disabled.
- Parameters
-
[in] | baseAddr | adc base pointer |
Implements : ADC_HAL_ClearLatchTriggers_Activity
Definition at line 1263 of file adc_hal.h.
static bool ADC_HAL_GetChanInterruptEnableFlag |
( |
const ADC_Type *const |
baseAddr, |
|
|
const uint8_t |
chanIndex |
|
) |
| |
|
inlinestatic |
Gets the Channel Interrupt Enable state.
This function returns the state of the Channel Interrupt Enable Flag. If the flag is set, an interrupt is generated when the a conversion is completed for the channel.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | chanIndex | the adc measurement channel index |
- Returns
- the Channel Interrupt Enable Flag state
Implements : ADC_HAL_GetChanInterruptEnableFlag_Activity
Definition at line 1079 of file adc_hal.h.
static uint16_t ADC_HAL_GetChanResult |
( |
const ADC_Type *const |
baseAddr, |
|
|
const uint8_t |
chanIndex |
|
) |
| |
|
inlinestatic |
Gets the conversion result for the selected measurement channel.
This function returns the conversion result from a measurement channel. This automatically clears the Conversion Complete Flag (CoCo flag) for that channel.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | chanIndex | the adc measurement channel index |
- Returns
- the Measurement Channel Conversion Result
Implements : ADC_HAL_GetChanResult_Activity
Definition at line 1236 of file adc_hal.h.
static bool ADC_HAL_GetContinuousConvFlag |
( |
const ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Gets the Continuous Conversion Flag state.
This functions returns the state of the Continuous Conversion Flag. This feature can be used to continuously sample a single channel. When this is active, the channel cannot be changed (by software or hardware trigger) until this feature is turned off.
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the Continuous Conversion Flag state
Implements : ADC_HAL_GetContinuousConvFlag_Activity
Definition at line 566 of file adc_hal.h.
static bool ADC_HAL_GetConvCompleteFlag |
( |
const ADC_Type *const |
baseAddr, |
|
|
const uint8_t |
chanIndex |
|
) |
| |
|
inlinestatic |
Gets the measurement channel Conversion Complete Flag state.
This function returns the state of the Conversion Complete Flag for a measurement channel. This flag is set when a conversion is complete or the the condition generated by the Hardware Compare feature is evaluated to true.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | chanIndex | the adc measurement channel index |
- Returns
- the Conversion Complete Flag state
Implements : ADC_HAL_GetConvCompleteFlag_Activity
Definition at line 1214 of file adc_hal.h.
static bool ADC_HAL_GetHwAverageEnableFlag |
( |
const ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Gets the Hardware Average Enable Flag state.
This function returns the state of the Hardware Average Enable Flag. Hardware averaging can be used to obtain an average value over multiple consecutive conversions on the same channel.
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the Hardware Average Enable Flag state
Implements : ADC_HAL_GetHwAverageEnableFlag_Activity
Definition at line 832 of file adc_hal.h.
Gets the Hardware Average Mode.
This function returns the configured Hardware Average Mode. The mode selects the number of samples to average: 4, 8, 16 or 32.
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the Hardware Average Mode selection. Possible values:
- ADC_AVERAGE_4 : Hardware average of 4 samples..
- ADC_AVERAGE_8 : Hardware average of 8 samples.
- ADC_AVERAGE_16 : Hardware average of 16 samples.
- ADC_AVERAGE_32 : Hardware average of 32 samples.
Implements : ADC_HAL_GetHwAverageMode_Activity
Definition at line 878 of file adc_hal.h.
static uint16_t ADC_HAL_GetHwCompareComp1Value |
( |
const ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Gets the Compare Register 1 value.
This function returns the value written in the Hardware Compare Register 1. This value defines the upper or lower limit for the Hardware Compare Range. This value is always 12-bit resolution value (for lower resolution modes, internal bit shifting will take place).
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the Compare Register 1 value
Implements : ADC_HAL_GetHwCompareComp1Value_Activity
Definition at line 747 of file adc_hal.h.
static uint16_t ADC_HAL_GetHwCompareComp2Value |
( |
const ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Gets the Compare Register 2 value.
This function returns the value written in the Hardware Compare Register 2. This value defines the upper or lower limit for the Hardware Compare Range. This value is always 12-bit resolution (for lower resolution modes, internal bit shifting will take place).
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the Compare Register 2 value
Implements : ADC_HAL_GetHwCompareComp2Value_Activity
Definition at line 786 of file adc_hal.h.
static bool ADC_HAL_GetHwCompareEnableFlag |
( |
const ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Gets the Hardware Compare Enable Flag state.
This function returns the state of the Hardware Compare Enable Flag. Hardware Compare can be used to check if the ADC result is within or outside of a predefined range.
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the Hardware Compare Enable Flag state
Implements : ADC_HAL_GetHwCompareEnableFlag_Activity
Definition at line 618 of file adc_hal.h.
static bool ADC_HAL_GetHwCompareGtEnableFlag |
( |
const ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Gets the Hardware Compare Greater Than Enable Flag state.
This function returns the Hardware Compare Greater Than Enable Flag. Using this feature, the ADC can be configured to check if the measured value is within or outside of a predefined range.
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the Hardware Compare Greater Than Enable Flag state
Implements : ADC_HAL_GetHwCompareGtEnableFlag_Activity
Definition at line 660 of file adc_hal.h.
static bool ADC_HAL_GetHwCompareRangeEnableFlag |
( |
const ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Gets the Hardware Compare Range Enable state.
This function returns the state of the Hardware Compare Range Enable Flag. This feature allows configuration of a range with two non-zero values or with a non-zero and zero value.
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the Hardware Compare Range Enable Flag state
Implements : ADC_HAL_GetHwCompareRangeEnableFlag_Activity
Definition at line 703 of file adc_hal.h.
static uint8_t ADC_HAL_GetSampleTime |
( |
const ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Gets the Sample time in AD clock cycles.
This function gets the sample time (in AD clocks) configured for the ADC. Selection of 2 to 256 ADCK is possible. The value returned by this function is the sample time minus 1. A sample time of 1 is not supported.
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the Sample Time in AD Clocks
Implements : ADC_HAL_GetSampleTime_Activity
Definition at line 272 of file adc_hal.h.
Gets the ADC Trigger Mode.
This function returns the configured triggering mode for the ADC. In Software Triggering Mode, the user can start conversions by setting an input channel in the ADC measurement channel A (index 0). When in Hardware trigger mode, a conversion is started by another peripheral ( like PDB or TRGMUX).
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the current trigger mode. Possible values:
- ADC_TRIGGER_SOFTWARE : Software triggering.
- ADC_TRIGGER_HARDWARE : Hardware triggering.
Implements : ADC_HAL_GetTriggerMode_Activity
Definition at line 431 of file adc_hal.h.
static uint16_t ADC_HAL_GetUserGainValue |
( |
const ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Gets the User Gain Register value.
This function returns the value in the User Gain Register. The value in this register is the amplification applied to the measured data before being written in the result register.
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the User Gain Register value
Implements : ADC_HAL_GetUserGainValue_Activity
Definition at line 975 of file adc_hal.h.
static uint16_t ADC_HAL_GetUserOffsetValue |
( |
const ADC_Type *const |
baseAddr | ) |
|
|
inlinestatic |
Gets the User Offset Register value.
This function returns the value in the User Offset Register. The value in this register is subtracted from the measured data before being written in the result register. This value is 16-bit signed value. To preserve resolution, lower-order bits will be ignored in low resolution-modes.
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the User Offset Register value
Implements : ADC_HAL_GetUserOffsetValue_Activity
Definition at line 1030 of file adc_hal.h.
Gets the ADC Reference Voltage selection.
This function returns the configured reference voltage selection for the ADC. Reference voltage can be selected between the pairs (VrefH, VrefL) and (ValtH, ValtL).
- Parameters
-
[in] | baseAddr | adc base pointer |
- Returns
- the voltage reference input pair. Possible values:
- ADC_VOLTAGEREF_VREF : VrefL and VrefH used as voltage reference.
- ADC_VOLTAGEREF_VALT : ValtL and ValtH used as voltage reference.
Implements : ADC_HAL_GetVoltageReference_Activity
Definition at line 520 of file adc_hal.h.
static void ADC_HAL_SetCalibrationActiveFlag |
( |
ADC_Type *const |
baseAddr, |
|
|
const bool |
state |
|
) |
| |
|
inlinestatic |
Sets the Calibration Active Flag state.
This functions starts or aborts an Auto-Calibration sequence. If this is set, it will remain set until the sequence is finished.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | state | the new Calibration Active Flag state |
Implements : ADC_HAL_SetCalibrationActiveFlag_Activity
Definition at line 953 of file adc_hal.h.
static void ADC_HAL_SetChanInterruptEnableFlag |
( |
ADC_Type *const |
baseAddr, |
|
|
const uint8_t |
chanIndex, |
|
|
const bool |
state |
|
) |
| |
|
inlinestatic |
Sets the Channel Interrupt Enable to a new state.
This function configures the state of the Interrupt Enable Flag for a measurement channel. If the flag is set, an interrupt is generated when the a conversion is completed for the channel.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | chanIndex | the adc measurement channel index |
[in] | state | the new Channel Interrupt Enable Flag state |
Implements : ADC_HAL_SetChanInterruptEnableFlag_Activity
Definition at line 1102 of file adc_hal.h.
static void ADC_HAL_SetContinuousConvFlag |
( |
ADC_Type *const |
baseAddr, |
|
|
const bool |
state |
|
) |
| |
|
inlinestatic |
Sets the Continuous Conversion Flag state.
This function configures the Continuous Conversion. This feature can be used to continuously sample a single channel. When this is active, the channel cannot be changed (by software or hardware trigger) until this feature is turned off.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | state | the new Continuous Conversion Flag state |
Implements : ADC_HAL_SetContinuousConvFlag_Activity
Definition at line 588 of file adc_hal.h.
static void ADC_HAL_SetHwAverageEnableFlag |
( |
ADC_Type *const |
baseAddr, |
|
|
const bool |
state |
|
) |
| |
|
inlinestatic |
Sets the Hardware Average Enable Flag state.
This function configures the Hardware Average Enable Flag. Hardware averaging can be used to obtain an average value over multiple consecutive conversions on the same channel.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | state | the new Hardware Average Enable Flag state |
Implements : ADC_HAL_SetHwAverageEnableFlag_Activity
Definition at line 852 of file adc_hal.h.
Sets the Hardware Average Mode.
This function configures the Hardware Average Mode. The mode selects the number of samples to average: 4, 8, 16 or 32.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | averageMode | the new Hardware Average Mode.
- ADC_AVERAGE_4 : Hardware average of 4 samples..
- ADC_AVERAGE_8 : Hardware average of 8 samples.
- ADC_AVERAGE_16 : Hardware average of 16 samples.
- ADC_AVERAGE_32 : Hardware average of 32 samples.
|
Implements : ADC_HAL_SetHwAverageMode_Activity
Definition at line 903 of file adc_hal.h.
static void ADC_HAL_SetHwCompareComp1Value |
( |
ADC_Type *const |
baseAddr, |
|
|
const uint16_t |
value |
|
) |
| |
|
inlinestatic |
Sets the Compare Register 1 value.
This function writes a 12-bit value in the Hardware Compare Register 1. This value defines the upper or lower limit for the Hardware Compare Range. This value is always 12-bit resolution (for lower resolution modes, internal bit shifting will take place).
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | value | the new Compare Register 1 value |
Implements : ADC_HAL_SetHwCompareComp1Value_Activity
Definition at line 766 of file adc_hal.h.
static void ADC_HAL_SetHwCompareComp2Value |
( |
ADC_Type *const |
baseAddr, |
|
|
const uint16_t |
value |
|
) |
| |
|
inlinestatic |
Sets the Compare Register 2 value.
This function writes a 12-bit value in the Hardware Compare Register 2. This value defines the upper or lower limit for the Hardware Compare Range. This value is always 12-bit resolution value (for lower resolution modes, internal bit shifting will take place).
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | value | the new Compare Register 2 value |
Implements : ADC_HAL_SetHwCompareComp2Value_Activity
Definition at line 805 of file adc_hal.h.
static void ADC_HAL_SetHwCompareEnableFlag |
( |
ADC_Type *const |
baseAddr, |
|
|
const bool |
state |
|
) |
| |
|
inlinestatic |
Sets the Hardware Compare Enable Flag state.
This functions configures the Hardware Compare Enable Flag. Hardware Compare can be used to check if the ADC result is within or outside of a predefined range.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | state | the new Hardware Compare Enable Flag state |
Implements : ADC_HAL_SetHwCompareEnableFlag_Activity
Definition at line 638 of file adc_hal.h.
static void ADC_HAL_SetHwCompareGtEnableFlag |
( |
ADC_Type *const |
baseAddr, |
|
|
const bool |
state |
|
) |
| |
|
inlinestatic |
Sets the Hardware Compare Greater Than Enable Flag state.
This function configures the Hardware Compare Greater Than Enable Flag. Using this feature, the ADC can be configured to check if the measured value is within or outside of a predefined range.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | state | the new Hardware Compare Greater Than Enable Flag state |
Implements : ADC_HAL_SetHwCompareGtEnableFlag_Activity
Definition at line 681 of file adc_hal.h.
static void ADC_HAL_SetHwCompareRangeEnableFlag |
( |
ADC_Type *const |
baseAddr, |
|
|
const bool |
state |
|
) |
| |
|
inlinestatic |
Sets the Hardware Compare Range Enable state.
This function configures the Hardware Compare Range Enable Flag. This feature allows configuration of a range with two non-zero values or with a non-zero and zero value.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | state | the new Hardware Compare Range Enable Flag state |
Implements : ADC_HAL_SetHwCompareRangeEnableFlag_Activity
Definition at line 724 of file adc_hal.h.
Sets the input channel configuration for the measurement channel.
This function configures the input channel for a measurement channel. In software trigger mode, configuring channel A (index 0) will start a new conversion immediately.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | chanIndex | the adc measurement channel index |
[in] | inputChan | the Input Channel selected for the Measurement Channel
- ADC_INPUTCHAN_AD0 : AD0 selected as input.
- ADC_INPUTCHAN_AD1 : AD1 selected as input.
- ADC_INPUTCHAN_AD2 : AD2 selected as input.
- ADC_INPUTCHAN_AD3 : AD3 selected as input.
- ADC_INPUTCHAN_AD4 : AD4 selected as input.
- ADC_INPUTCHAN_AD5 : AD5 selected as input.
- ADC_INPUTCHAN_AD6 : AD6 selected as input.
- ADC_INPUTCHAN_AD7 : AD7 selected as input.
- ADC_INPUTCHAN_AD8 : AD8 selected as input.
- ADC_INPUTCHAN_AD9 : AD9 selected as input.
- ADC_INPUTCHAN_AD10 : AD10 selected as input.
- ADC_INPUTCHAN_AD11 : AD11 selected as input.
- ADC_INPUTCHAN_AD12 : AD12 selected as input.
- ADC_INPUTCHAN_AD13 : AD13 selected as input.
- ADC_INPUTCHAN_AD14 : AD14 selected as input.
- ADC_INPUTCHAN_AD15 : AD15 selected as input.
- ADC_INPUTCHAN_TEMP : Temp Sensor selected as input.
- ADC_INPUTCHAN_BANDGAP : Band Gap selected as input.
- ADC_INPUTCHAN_VREFSH : VREFSH selected as input.
- ADC_INPUTCHAN_VREFSL : VREFSL selected as input.
- ADC_INPUTCHAN_DISABLED : Channel Disabled.
|
Implements : ADC_HAL_SetInputChannel_Activity
Definition at line 1190 of file adc_hal.h.
static void ADC_HAL_SetSampleTime |
( |
ADC_Type *const |
baseAddr, |
|
|
uint8_t |
sampletime |
|
) |
| |
|
inlinestatic |
Sets the Sample time in AD clock cycles.
This function configures the sample time for the ADC (in ADCK clocks). The actual sample time will be the value provided plus 1. Selection of 2 to 256 ADCK is possible. A real sample time of 1 is not supported (a parameter value of 0 will be automatically be changed to 1).
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | sampletime | Sample time in AD Clocks |
Implements : ADC_HAL_SetSampleTime_Activity
Definition at line 294 of file adc_hal.h.
Sets the ADC Trigger Mode.
This function configures the ADC triggering mode. In Software Triggering Mode, the user can start conversions by setting an input channel in the ADC measurement channel A (index 0). When in Hardware trigger mode, a conversion is started by another peripheral (like PDB or TRGMUX).
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | trigger | the desired trigger mode
- ADC_TRIGGER_SOFTWARE : Software triggering.
- ADC_TRIGGER_HARDWARE : Hardware triggering.
|
Implements : ADC_HAL_SetTriggerMode_Activity
Definition at line 456 of file adc_hal.h.
static void ADC_HAL_SetUserGainValue |
( |
ADC_Type *const |
baseAddr, |
|
|
const uint16_t |
value |
|
) |
| |
|
inlinestatic |
Sets the User Gain Register value.
This function configures the User Gain Register. The value in this register is the amplification applied to the measured data before being written in the result register.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | value | the new User Gain Register value |
Implements : ADC_HAL_SetUserGainValue_Activity
Definition at line 995 of file adc_hal.h.
static void ADC_HAL_SetUserOffsetValue |
( |
ADC_Type *const |
baseAddr, |
|
|
const uint16_t |
value |
|
) |
| |
|
inlinestatic |
Sets the User Offset Register value.
This function configures the User Offset Register. The value in this register is subtracted from the measured data before being written in the result register. This value is 16-bit signed value. To preserve resolution, lower-order bits will be ignored in low resolution-modes.
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | value | the new User Offset Register value |
Implements : ADC_HAL_SetUserOffsetValue_Activity
Definition at line 1052 of file adc_hal.h.
Sets the ADC Reference Voltage selection.
This function configures the ADC Reference Voltage. Reference voltage can be selected between the pairs (VrefH, VrefL) and (ValtH, ValtL).
- Parameters
-
[in] | baseAddr | adc base pointer |
[in] | voltageRef | the new voltage reference input
- ADC_VOLTAGEREF_VREF : VrefL and VrefH used as voltage reference.
- ADC_VOLTAGEREF_VALT : ValtL and ValtH used as voltage reference.
|
Implements : ADC_HAL_SetVoltageReference_Activity
Definition at line 543 of file adc_hal.h.