S32 SDK
adc_hal.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "device_registers.h"

Go to the source code of this file.

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

Functions

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