S32 SDK

Detailed Description

Analog to Digital Converter Hardware Abstraction Layer.

This HAL provides low-level access to all hardware features of the ADC.

Enumerations

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

Input Channel selection.

Enumerations and macros to select Input channel.

enum  adc_inputchannel_t {
  ADC_INPUTCHAN_AD0 = 0x00U, ADC_INPUTCHAN_AD1 = 0x01U, ADC_INPUTCHAN_AD2 = 0x02U, ADC_INPUTCHAN_AD3 = 0x03U,
  ADC_INPUTCHAN_AD4 = 0x04U, ADC_INPUTCHAN_AD5 = 0x05U, ADC_INPUTCHAN_AD6 = 0x06U, ADC_INPUTCHAN_AD7 = 0x07U,
  ADC_INPUTCHAN_AD8 = 0x08U, ADC_INPUTCHAN_AD9 = 0x09U, ADC_INPUTCHAN_AD10 = 0x0AU, ADC_INPUTCHAN_AD11 = 0x0BU,
  ADC_INPUTCHAN_AD12 = 0x0CU, ADC_INPUTCHAN_AD13 = 0x0DU, ADC_INPUTCHAN_AD14 = 0x0EU, ADC_INPUTCHAN_AD15 = 0x0FU,
  ADC_INPUTCHAN_AD16 = 0x10U, ADC_INPUTCHAN_AD17 = 0x11U, ADC_INPUTCHAN_AD18 = 0x12U, ADC_INPUTCHAN_AD19 = 0x13U,
  ADC_INPUTCHAN_AD20 = 0x14U, ADC_INPUTCHAN_AD21 = 0x15U, ADC_INPUTCHAN_AD22 = 0x16U, ADC_INPUTCHAN_AD23 = 0x17U,
  ADC_INPUTCHAN_AD24 = 0x18U, ADC_INPUTCHAN_AD25 = 0x19U, ADC_INPUTCHAN_AD26 = 0x1AU, ADC_INPUTCHAN_AD27 = 0x1BU,
  ADC_INPUTCHAN_AD28 = 0x1CU, ADC_INPUTCHAN_AD29 = 0x1DU, ADC_INPUTCHAN_AD30 = 0x1EU, ADC_INPUTCHAN_AD31 = 0x1FU
}
 Input channel selection Implements : adc_inputchannel_t_Class. More...
 

Converter

General ADC functions.

void ADC_HAL_Init (ADC_Type *const baseAddr)
 Initializes the ADC instance to reset values. More...
 
static bool ADC_HAL_GetConvActiveFlag (const ADC_Type *const baseAddr)
 Gets the Conversion Active Flag. More...
 
static adc_clk_divide_t ADC_HAL_GetClockDivide (const ADC_Type *const baseAddr)
 Gets the current ADC clock divider configuration. More...
 
static void ADC_HAL_SetClockDivide (ADC_Type *const baseAddr, const adc_clk_divide_t clockDivide)
 Sets the ADC clock divider configuration. More...
 
static uint8_t ADC_HAL_GetSampleTime (const ADC_Type *const baseAddr)
 Gets the Sample time in AD clock cycles. More...
 
static void ADC_HAL_SetSampleTime (ADC_Type *const baseAddr, uint8_t sampletime)
 Sets the Sample time in AD clock cycles. More...
 
static adc_resolution_t ADC_HAL_GetResolution (const ADC_Type *const baseAddr)
 Gets the Resolution Mode configuration. More...
 
static void ADC_HAL_SetResolution (ADC_Type *const baseAddr, const adc_resolution_t resolution)
 Sets the Resolution Mode configuration. More...
 
static adc_input_clock_t ADC_HAL_GetInputClock (const ADC_Type *const baseAddr)
 Gets the AD Clock Input configuration. More...
 
static void ADC_HAL_SetInputClock (ADC_Type *const baseAddr, const adc_input_clock_t inputClock)
 Sets the AD Clock Input configuration. More...
 
static adc_trigger_t ADC_HAL_GetTriggerMode (const ADC_Type *const baseAddr)
 Gets the ADC Trigger Mode. More...
 
static void ADC_HAL_SetTriggerMode (ADC_Type *const baseAddr, const adc_trigger_t trigger)
 Sets the ADC Trigger Mode. More...
 
static bool ADC_HAL_GetDMAEnableFlag (const ADC_Type *const baseAddr)
 Gets the DMA Enable Flag state. More...
 
static void ADC_HAL_SetDMAEnableFlag (ADC_Type *const baseAddr, const bool state)
 Sets the DMA Enable Flag state. More...
 
static adc_voltage_reference_t ADC_HAL_GetVoltageReference (const ADC_Type *const baseAddr)
 Gets the ADC Reference Voltage selection. More...
 
static void ADC_HAL_SetVoltageReference (ADC_Type *const baseAddr, const adc_voltage_reference_t voltageRef)
 Sets the ADC Reference Voltage selection. More...
 
static bool ADC_HAL_GetContinuousConvFlag (const ADC_Type *const baseAddr)
 Gets the Continuous Conversion Flag state. More...
 
static void ADC_HAL_SetContinuousConvFlag (ADC_Type *const baseAddr, const bool state)
 Sets the Continuous Conversion Flag state. More...
 

Hardware Compare.

Functions to configure the Hardware Compare feature.

static bool ADC_HAL_GetHwCompareEnableFlag (const ADC_Type *const baseAddr)
 Gets the Hardware Compare Enable Flag state. More...
 
static void ADC_HAL_SetHwCompareEnableFlag (ADC_Type *const baseAddr, const bool state)
 Sets the Hardware Compare Enable Flag state. More...
 
static bool ADC_HAL_GetHwCompareGtEnableFlag (const ADC_Type *const baseAddr)
 Gets the Hardware Compare Greater Than Enable Flag state. More...
 
static void ADC_HAL_SetHwCompareGtEnableFlag (ADC_Type *const baseAddr, const bool state)
 Sets the Hardware Compare Greater Than Enable Flag state. More...
 
static bool ADC_HAL_GetHwCompareRangeEnableFlag (const ADC_Type *const baseAddr)
 Gets the Hardware Compare Range Enable state. More...
 
static void ADC_HAL_SetHwCompareRangeEnableFlag (ADC_Type *const baseAddr, const bool state)
 Sets the Hardware Compare Range Enable state. More...
 
static uint16_t ADC_HAL_GetHwCompareComp1Value (const ADC_Type *const baseAddr)
 Gets the Compare Register 1 value. More...
 
static void ADC_HAL_SetHwCompareComp1Value (ADC_Type *const baseAddr, const uint16_t value)
 Sets the Compare Register 1 value. More...
 
static uint16_t ADC_HAL_GetHwCompareComp2Value (const ADC_Type *const baseAddr)
 Gets the Compare Register 2 value. More...
 
static void ADC_HAL_SetHwCompareComp2Value (ADC_Type *const baseAddr, const uint16_t value)
 Sets the Compare Register 2 value. More...
 

Hardware Average.

Functions to configure the Hardware Averaging feature.

static bool ADC_HAL_GetHwAverageEnableFlag (const ADC_Type *const baseAddr)
 Gets the Hardware Average Enable Flag state. More...
 
static void ADC_HAL_SetHwAverageEnableFlag (ADC_Type *const baseAddr, const bool state)
 Sets the Hardware Average Enable Flag state. More...
 
static adc_average_t ADC_HAL_GetHwAverageMode (const ADC_Type *const baseAddr)
 Gets the Hardware Average Mode. More...
 
static void ADC_HAL_SetHwAverageMode (ADC_Type *const baseAddr, const adc_average_t averageMode)
 Sets the Hardware Average Mode. More...
 

Automatic Calibration.

Functions configure and use the Automatic Calibration feature.

static bool ADC_HAL_GetCalibrationActiveFlag (const ADC_Type *const baseAddr)
 Gets the Calibration Active Flag state. More...
 
static void ADC_HAL_SetCalibrationActiveFlag (ADC_Type *const baseAddr, const bool state)
 Sets the Calibration Active Flag state. More...
 
static uint16_t ADC_HAL_GetUserGainValue (const ADC_Type *const baseAddr)
 Gets the User Gain Register value. More...
 
static void ADC_HAL_SetUserGainValue (ADC_Type *const baseAddr, const uint16_t value)
 Sets the User Gain Register value. More...
 
static uint16_t ADC_HAL_GetUserOffsetValue (const ADC_Type *const baseAddr)
 Gets the User Offset Register value. More...
 
static void ADC_HAL_SetUserOffsetValue (ADC_Type *const baseAddr, const uint16_t value)
 Sets the User Offset Register value. More...
 

Converter channels.

Functions to configure and access each ADC converter channel.

static bool ADC_HAL_GetChanInterruptEnableFlag (const ADC_Type *const baseAddr, const uint8_t chanIndex)
 Gets the Channel Interrupt Enable state. More...
 
static void ADC_HAL_SetChanInterruptEnableFlag (ADC_Type *const baseAddr, const uint8_t chanIndex, const bool state)
 Sets the Channel Interrupt Enable to a new state. More...
 
static adc_inputchannel_t ADC_HAL_GetInputChannel (const ADC_Type *const baseAddr, const uint8_t chanIndex)
 Gets the configured input channel for the selected measurement channel. More...
 
static void ADC_HAL_SetInputChannel (ADC_Type *const baseAddr, const uint8_t chanIndex, const adc_inputchannel_t inputChan)
 Sets the input channel configuration for the measurement channel. More...
 
static bool ADC_HAL_GetConvCompleteFlag (const ADC_Type *const baseAddr, const uint8_t chanIndex)
 Gets the measurement channel Conversion Complete Flag state. More...
 
static uint16_t ADC_HAL_GetChanResult (const ADC_Type *const baseAddr, const uint8_t chanIndex)
 Gets the conversion result for the selected measurement channel. More...
 

Trigger latches.

Functions using the trigger latch mechanism.

static void ADC_HAL_ClearLatchTriggers (ADC_Type *const baseAddr)
 Clear the latched triggers. More...
 
static uint32_t ADC_HAL_GetTriggerErrorFlags (const ADC_Type *const baseAddr)
 Get the trigger latch error flags. More...
 
static void ADC_HAL_ClearTriggerErrorFlags (ADC_Type *const baseAddr)
 Clear the latch trigger error flags. More...
 
static uint32_t ADC_HAL_GetTriggerLatchFlags (const ADC_Type *const baseAddr)
 Get the trigger latch flags bits. More...
 
static uint32_t ADC_HAL_GetTriggerProcNumber (const ADC_Type *const baseAddr)
 Get the index of the trigger under process. More...
 

Enumeration Type Documentation

Hardware average selection Implements : adc_average_t_Class.

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

Definition at line 110 of file adc_hal.h.

Clock Divider selection Implements : adc_clk_divide_t_Class.

Enumerator
ADC_CLK_DIVIDE_1 

Input clock divided by 1.

ADC_CLK_DIVIDE_2 

Input clock divided by 2.

ADC_CLK_DIVIDE_4 

Input clock divided by 4.

ADC_CLK_DIVIDE_8 

Input clock divided by 8.

Definition at line 55 of file adc_hal.h.

Input clock source selection Implements : adc_input_clock_t_Class.

Enumerator
ADC_CLK_ALT_1 

Input clock alternative 1.

ADC_CLK_ALT_2 

Input clock alternative 2.

ADC_CLK_ALT_3 

Input clock alternative 3.

ADC_CLK_ALT_4 

Input clock alternative 4.

Definition at line 78 of file adc_hal.h.

Input channel selection Implements : adc_inputchannel_t_Class.

Enumerator
ADC_INPUTCHAN_AD0 

AD0

ADC_INPUTCHAN_AD1 

AD1

ADC_INPUTCHAN_AD2 

AD2

ADC_INPUTCHAN_AD3 

AD3

ADC_INPUTCHAN_AD4 

AD4

ADC_INPUTCHAN_AD5 

AD5

ADC_INPUTCHAN_AD6 

AD6

ADC_INPUTCHAN_AD7 

AD7

ADC_INPUTCHAN_AD8 

AD8

ADC_INPUTCHAN_AD9 

AD9

ADC_INPUTCHAN_AD10 

AD10

ADC_INPUTCHAN_AD11 

AD11

ADC_INPUTCHAN_AD12 

AD12

ADC_INPUTCHAN_AD13 

AD13

ADC_INPUTCHAN_AD14 

AD14

ADC_INPUTCHAN_AD15 

AD15

ADC_INPUTCHAN_AD16 

AD16

ADC_INPUTCHAN_AD17 

AD17

ADC_INPUTCHAN_AD18 

AD18

ADC_INPUTCHAN_AD19 

AD19

ADC_INPUTCHAN_AD20 

AD20

ADC_INPUTCHAN_AD21 

AD21

ADC_INPUTCHAN_AD22 

AD22

ADC_INPUTCHAN_AD23 

AD23

ADC_INPUTCHAN_AD24 

AD24

ADC_INPUTCHAN_AD25 

AD25

ADC_INPUTCHAN_AD26 

AD26

ADC_INPUTCHAN_AD27 

AD27

ADC_INPUTCHAN_AD28 

AD28

ADC_INPUTCHAN_AD29 

AD29

ADC_INPUTCHAN_AD30 

AD30

ADC_INPUTCHAN_AD31 

AD31

Definition at line 128 of file adc_hal.h.

Conversion resolution selection Implements : adc_resolution_t_Class.

Enumerator
ADC_RESOLUTION_8BIT 

8-bit resolution mode

ADC_RESOLUTION_12BIT 

12-bit resolution mode

ADC_RESOLUTION_10BIT 

10-bit resolution mode

Definition at line 67 of file adc_hal.h.

Trigger type selection Implements : adc_trigger_t_Class.

Enumerator
ADC_TRIGGER_SOFTWARE 

Software trigger.

ADC_TRIGGER_HARDWARE 

Hardware trigger.

Definition at line 90 of file adc_hal.h.

Voltage reference selection Implements : adc_voltage_reference_t_Class.

Enumerator
ADC_VOLTAGEREF_VREF 

VrefH and VrefL as Voltage reference.

ADC_VOLTAGEREF_VALT 

ValtH and ValtL as Voltage reference.

Definition at line 100 of file adc_hal.h.

Function Documentation

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]baseAddradc base pointer

Implements : ADC_HAL_ClearLatchTriggers_Activity

Definition at line 1263 of file adc_hal.h.

static void ADC_HAL_ClearTriggerErrorFlags ( ADC_Type *const  baseAddr)
inlinestatic

Clear the latch trigger error flags.

This function clears the trigger latch error flags.

Parameters
[in]baseAddradc base pointer

Implements : ADC_HAL_ClearTriggerErrorFlags_Activity

Definition at line 1295 of file adc_hal.h.

static bool ADC_HAL_GetCalibrationActiveFlag ( const ADC_Type *const  baseAddr)
inlinestatic

Gets the Calibration Active Flag state.

This function returns the state of the Calibration Active Flag. This flag is set if an Auto-Calibration sequence is taking place.

Parameters
[in]baseAddradc base pointer
Returns
the Calibration Active Flag state

Implements : ADC_HAL_GetCalibrationActiveFlag_Activity

Definition at line 933 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]baseAddradc base pointer
[in]chanIndexthe 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]baseAddradc base pointer
[in]chanIndexthe 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 adc_clk_divide_t ADC_HAL_GetClockDivide ( const ADC_Type *const  baseAddr)
inlinestatic

Gets the current ADC clock divider configuration.

This function returns the configured clock divider bitfield value for the ADC instance.

Parameters
[in]baseAddradc base pointer
Returns
the clock divider value. Possible values:
  • ADC_CLK_DIVIDE_1 : Divider set to 1.
  • ADC_CLK_DIVIDE_2 : Divider set to 2.
  • ADC_CLK_DIVIDE_4 : Divider set to 4.
  • ADC_CLK_DIVIDE_8 : Divider set to 8.

Implements : ADC_HAL_GetClockDivide_Activity

Definition at line 227 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]baseAddradc 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_GetConvActiveFlag ( const ADC_Type *const  baseAddr)
inlinestatic

Gets the Conversion Active Flag.

This function checks whether a conversion is currently taking place on the ADC module.

Parameters
[in]baseAddradc base pointer
Returns
Conversion Active Flag state

Implements : ADC_HAL_GetConvActiveFlag_Activity

Definition at line 204 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]baseAddradc base pointer
[in]chanIndexthe 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_GetDMAEnableFlag ( const ADC_Type *const  baseAddr)
inlinestatic

Gets the DMA Enable Flag state.

This function returns the state of the DMA Enable flag. DMA can be used to transfer completed conversion values from the result registers to RAM without CPU intervention.

Parameters
[in]baseAddradc base pointer
Returns
the DMA Enable Flag state

Implements : ADC_HAL_GetDMAEnableFlag_Activity

Definition at line 477 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]baseAddradc base pointer
Returns
the Hardware Average Enable Flag state

Implements : ADC_HAL_GetHwAverageEnableFlag_Activity

Definition at line 832 of file adc_hal.h.

static adc_average_t ADC_HAL_GetHwAverageMode ( const ADC_Type *const  baseAddr)
inlinestatic

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]baseAddradc 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]baseAddradc 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]baseAddradc 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]baseAddradc 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]baseAddradc 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]baseAddradc 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 adc_inputchannel_t ADC_HAL_GetInputChannel ( const ADC_Type *const  baseAddr,
const uint8_t  chanIndex 
)
inlinestatic

Gets the configured input channel for the selected measurement channel.

This function returns the configured input channel for a measurement channel.

Parameters
[in]baseAddradc base pointer
[in]chanIndexthe adc measurement channel index
Returns
the Input Channel selected for the Measurement Channel. Possible values:
  • 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_GetInputChannel_Activity

Definition at line 1146 of file adc_hal.h.

static adc_input_clock_t ADC_HAL_GetInputClock ( const ADC_Type *const  baseAddr)
inlinestatic

Gets the AD Clock Input configuration.

This function returns the configured clock input source for the ADC.

Parameters
[in]baseAddradc base pointer
Returns
the input clock source. Possible values:
  • ADC_CLK_ALT_1 : ADC Input clock source alternative 1.
  • ADC_CLK_ALT_2 : ADC Input clock source alternative 2.
  • ADC_CLK_ALT_3 : ADC Input clock source alternative 3.
  • ADC_CLK_ALT_4 : ADC Input clock source alternative 4.

Implements : ADC_HAL_GetInputClock_Activity

Definition at line 381 of file adc_hal.h.

static adc_resolution_t ADC_HAL_GetResolution ( const ADC_Type *const  baseAddr)
inlinestatic

Gets the Resolution Mode configuration.

This function returns the configured resolution mode for the ADC.

Parameters
[in]baseAddradc base pointer
Returns
the ADC resolution mode. Possible values:
  • ADC_RESOLUTION_8BIT : 8-bit resolution mode.
  • ADC_RESOLUTION_10BIT : 10-bit resolution mode.
  • ADC_RESOLUTION_12BIT : 12-bit resolution mode.

Implements : ADC_HAL_GetResolution_Activity

Definition at line 319 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]baseAddradc base pointer
Returns
the Sample Time in AD Clocks

Implements : ADC_HAL_GetSampleTime_Activity

Definition at line 272 of file adc_hal.h.

static uint32_t ADC_HAL_GetTriggerErrorFlags ( const ADC_Type *const  baseAddr)
inlinestatic

Get the trigger latch error flags.

This function returns the latch trigger error flags

Parameters
[in]baseAddradc base pointer
Returns
The trigger latch error flags

Implements : ADC_HAL_GetTriggerErrorFlags_Activity

Definition at line 1278 of file adc_hal.h.

static uint32_t ADC_HAL_GetTriggerLatchFlags ( const ADC_Type *const  baseAddr)
inlinestatic

Get the trigger latch flags bits.

/ This function returns the trigger latch flags.

Parameters
[in]baseAddradc base pointer
Returns
trigger latch flags

Implements : ADC_HAL_GetTriggerLatchFlags_Activity

Definition at line 1310 of file adc_hal.h.

static adc_trigger_t ADC_HAL_GetTriggerMode ( const ADC_Type *const  baseAddr)
inlinestatic

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]baseAddradc 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 uint32_t ADC_HAL_GetTriggerProcNumber ( const ADC_Type *const  baseAddr)
inlinestatic

Get the index of the trigger under process.

This function returns the index of the trigger currently being processed.

Parameters
[in]baseAddradc base pointer
Returns
the trigger index

Implements : ADC_HAL_GetTriggerProcNumber_Activity

Definition at line 1328 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]baseAddradc 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]baseAddradc base pointer
Returns
the User Offset Register value

Implements : ADC_HAL_GetUserOffsetValue_Activity

Definition at line 1030 of file adc_hal.h.

static adc_voltage_reference_t ADC_HAL_GetVoltageReference ( const ADC_Type *const  baseAddr)
inlinestatic

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]baseAddradc 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.

void ADC_HAL_Init ( ADC_Type *const  baseAddr)

Initializes the ADC instance to reset values.

This function initializes the ADC instance to a known state (the register are written with their reset values from the Reference Manual).

Parameters
[in]baseAddradc base pointer

Definition at line 45 of file adc_hal.c.

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]baseAddradc base pointer
[in]statethe 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]baseAddradc base pointer
[in]chanIndexthe adc measurement channel index
[in]statethe new Channel Interrupt Enable Flag state

Implements : ADC_HAL_SetChanInterruptEnableFlag_Activity

Definition at line 1102 of file adc_hal.h.

static void ADC_HAL_SetClockDivide ( ADC_Type *const  baseAddr,
const adc_clk_divide_t  clockDivide 
)
inlinestatic

Sets the ADC clock divider configuration.

This functions configures the ADC instance clock divider.

Parameters
[in]baseAddradc base pointer
[in]clockDivideclk divider
  • ADC_CLK_DIVIDE_1 : Divider set to 1.
  • ADC_CLK_DIVIDE_2 : Divider set to 2.
  • ADC_CLK_DIVIDE_4 : Divider set to 4.
  • ADC_CLK_DIVIDE_8 : Divider set to 8.

Implements : ADC_HAL_SetClockDivide_Activity

Definition at line 250 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]baseAddradc base pointer
[in]statethe new Continuous Conversion Flag state

Implements : ADC_HAL_SetContinuousConvFlag_Activity

Definition at line 588 of file adc_hal.h.

static void ADC_HAL_SetDMAEnableFlag ( ADC_Type *const  baseAddr,
const bool  state 
)
inlinestatic

Sets the DMA Enable Flag state.

This function configures the DMA Enable Flag. DMA can be used to transfer completed conversion values from the result registers to RAM without CPU intervention.

Parameters
[in]baseAddradc base pointer
[in]statethe new DMA Enable Flag state

Implements : ADC_HAL_SetDMAEnableFlag_Activity

Definition at line 497 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]baseAddradc base pointer
[in]statethe new Hardware Average Enable Flag state

Implements : ADC_HAL_SetHwAverageEnableFlag_Activity

Definition at line 852 of file adc_hal.h.

static void ADC_HAL_SetHwAverageMode ( ADC_Type *const  baseAddr,
const adc_average_t  averageMode 
)
inlinestatic

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]baseAddradc base pointer
[in]averageModethe 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]baseAddradc base pointer
[in]valuethe 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]baseAddradc base pointer
[in]valuethe 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]baseAddradc base pointer
[in]statethe 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]baseAddradc base pointer
[in]statethe 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]baseAddradc base pointer
[in]statethe new Hardware Compare Range Enable Flag state

Implements : ADC_HAL_SetHwCompareRangeEnableFlag_Activity

Definition at line 724 of file adc_hal.h.

static void ADC_HAL_SetInputChannel ( ADC_Type *const  baseAddr,
const uint8_t  chanIndex,
const adc_inputchannel_t  inputChan 
)
inlinestatic

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]baseAddradc base pointer
[in]chanIndexthe adc measurement channel index
[in]inputChanthe 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_SetInputClock ( ADC_Type *const  baseAddr,
const adc_input_clock_t  inputClock 
)
inlinestatic

Sets the AD Clock Input configuration.

This function configures the clock input source for the ADC.

Parameters
[in]baseAddradc base pointer
[in]inputClockthe new input clock source
  • ADC_CLK_ALT_1 : ADC Input clock source alternative 1.
  • ADC_CLK_ALT_2 : ADC Input clock source alternative 2.
  • ADC_CLK_ALT_3 : ADC Input clock source alternative 3.
  • ADC_CLK_ALT_4 : ADC Input clock source alternative 4.

Implements : ADC_HAL_SetInputClock_Activity

Definition at line 405 of file adc_hal.h.

static void ADC_HAL_SetResolution ( ADC_Type *const  baseAddr,
const adc_resolution_t  resolution 
)
inlinestatic

Sets the Resolution Mode configuration.

This function configures the ADC resolution mode.

Parameters
[in]baseAddradc base pointer
[in]resolutionthe adc resolution mode
  • ADC_RESOLUTION_8BIT : 8-bit resolution mode.
  • ADC_RESOLUTION_10BIT : 10-bit resolution mode.
  • ADC_RESOLUTION_12BIT : 12-bit resolution mode.

Implements : ADC_HAL_SetResolution_Activity

Definition at line 357 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]baseAddradc base pointer
[in]sampletimeSample time in AD Clocks

Implements : ADC_HAL_SetSampleTime_Activity

Definition at line 294 of file adc_hal.h.

static void ADC_HAL_SetTriggerMode ( ADC_Type *const  baseAddr,
const adc_trigger_t  trigger 
)
inlinestatic

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]baseAddradc base pointer
[in]triggerthe 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]baseAddradc base pointer
[in]valuethe 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]baseAddradc base pointer
[in]valuethe new User Offset Register value

Implements : ADC_HAL_SetUserOffsetValue_Activity

Definition at line 1052 of file adc_hal.h.

static void ADC_HAL_SetVoltageReference ( ADC_Type *const  baseAddr,
const adc_voltage_reference_t  voltageRef 
)
inlinestatic

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]baseAddradc base pointer
[in]voltageRefthe 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.