S32 SDK

Detailed Description

Analog to Digital Converter Peripheral Driver.

The ADC is a configurable 12-bit (selectable to between 8-bit, 10-bit and 12-bit resolution) single-ended SAR converter.

Features of the ADC include:

Hardware background

The ADC included in the S32K14x series is a selectable resolution (8, 10, 12-bit), single-ended, SAR converter. Depending on the device variant, each ADC instance has up to 40 selectable input channels (up to 32 external and up to 8 internal) and up to 32 control channels (each with a result register, an input channel selection register and interrupt enable).

Sample time is configurable through selection of A/D clock and a configurable sample time (in A/D clocks).

Also provided are the Hardware Average and Hardware Compare Features.

Hardware Average will sample a selectable number of measurements and average them before signaling a Conversion Complete.

Hardware Compare can be used to signal if an input channel goes outside (or inside) of a predefined range.

The Calibration features can be used to automatically calibrate or fine-tune the ADC before use.

Driver consideration

The ADC Driver provides access to all features, but not all need to be configured to use the ADC. The user application can use the default for most settings, changing only what is necessary. For example, if Compare or Average features are not used, the user does not need to configure them.

The Driver uses structures for configuration. Each structure contains members that are specific to its respective functionality. There is a converter structure, a hardware compare structure, a hardware average structure and a calibration structure. Each struct has a corresponding InitStruct() method that can be used to initialize the members to reset values, so the user can change only the values that are specific to the application.

The Driver also includes support for configuring the Trigger Latching and Arbitration Unit controlled from a separate hardware module - System Integration Module (SIM).

Interrupt handling

The ADC Driver in S32 SDK does not use interrupts internally. These can be defined by the user application. There are two ways to add an ADC interrupt:

  1. Using the weak symbols defined by start-up code. If the methods ADCx_Handler(void) (x denotes instance number) are not defined, the linker uses a default ISR. An error will be generated if methods with the same name are defined multiple times. This method works regardless of the placement of the interrupt vector table (Flash or RAM).
  2. Using the Interrupt Manager's INT_SYS_InstallHandler() method. This can be used to dynamically change the ISR at run-time. This method works only if the interrupt vector table is located in RAM (S32 SDK behavior). To get the ADC instance's interrupt number, use ADC_DRV_GetInterruptNumber().

Clocking and pin configuration

The ADC Driver does not handle clock setup (from PCC) or any kind of pin configuration (done by PORT module). This is handled by the Clock Manager and PORT module, respectively. The driver assumes that correct clock configurations have been made, so it is the user's responsibility to set up clocking and pin configurations correctly.

Triggering a conversion

There are two separate ways for triggering an ADC conversion from a control channel:

  1. Software triggering Only conversion from first control channel may be triggered from software - must enabled at converter configuration Initiated by writing a valid input channel ID to the first control channel - use ADC_DRV_ConfigChan().
  2. Hardware triggering Conversion from any control channel may be hardware triggered - however for first control channel it must be enabled at converter configuration.

Data Structures

struct  adc_converter_config_t
 Defines the converter configuration. More...
 
struct  adc_compare_config_t
 Defines the hardware compare configuration. More...
 
struct  adc_average_config_t
 Defines the hardware average configuration. More...
 
struct  adc_chan_config_t
 Defines the control channel configuration. More...
 
struct  adc_calibration_t
 Defines the user calibration configuration. More...
 

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. More...
 
enum  adc_resolution_t { ADC_RESOLUTION_8BIT = 0x00U, ADC_RESOLUTION_12BIT = 0x01U, ADC_RESOLUTION_10BIT = 0x02U }
 Conversion resolution selection. 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. More...
 
enum  adc_trigger_t { ADC_TRIGGER_SOFTWARE = 0x00U, ADC_TRIGGER_HARDWARE = 0x01U }
 Trigger type selection. More...
 
enum  adc_pretrigger_sel_t { ADC_PRETRIGGER_SEL_PDB = 0x00U, ADC_PRETRIGGER_SEL_TRGMUX = 0x01U, ADC_PRETRIGGER_SEL_SW = 0x02U }
 Pretrigger types selectable from Trigger Latching and Arbitration Unit. More...
 
enum  adc_trigger_sel_t { ADC_TRIGGER_SEL_PDB = 0x00U, ADC_TRIGGER_SEL_TRGMUX = 0x01U }
 Trigger source selectable from Trigger Latching and Arbitration Unit. More...
 
enum  adc_sw_pretrigger_t {
  ADC_SW_PRETRIGGER_DISABLED = 0x00U, ADC_SW_PRETRIGGER_0 = 0x04U, ADC_SW_PRETRIGGER_1 = 0x05U, ADC_SW_PRETRIGGER_2 = 0x06U,
  ADC_SW_PRETRIGGER_3 = 0x07U
}
 Software pretriggers which may be set from Trigger Latching and Arbitration Unit. More...
 
enum  adc_voltage_reference_t { ADC_VOLTAGEREF_VREF = 0x00U, ADC_VOLTAGEREF_VALT = 0x01U }
 Voltage reference selection. More...
 
enum  adc_average_t { ADC_AVERAGE_4 = 0x00U, ADC_AVERAGE_8 = 0x01U, ADC_AVERAGE_16 = 0x02U, ADC_AVERAGE_32 = 0x03U }
 Hardware average selection. More...
 
enum  adc_inputchannel_t {
  ADC_INPUTCHAN_EXT0 = 0x00U, ADC_INPUTCHAN_EXT1 = 0x01U, ADC_INPUTCHAN_EXT2 = 0x02U, ADC_INPUTCHAN_EXT3 = 0x03U,
  ADC_INPUTCHAN_EXT4 = 0x04U, ADC_INPUTCHAN_EXT5 = 0x05U, ADC_INPUTCHAN_EXT6 = 0x06U, ADC_INPUTCHAN_EXT7 = 0x07U,
  ADC_INPUTCHAN_EXT8 = 0x08U, ADC_INPUTCHAN_EXT9 = 0x09U, ADC_INPUTCHAN_EXT10 = 0x0AU, ADC_INPUTCHAN_EXT11 = 0x0BU,
  ADC_INPUTCHAN_EXT12 = 0x0CU, ADC_INPUTCHAN_EXT13 = 0x0DU, ADC_INPUTCHAN_EXT14 = 0x0EU, ADC_INPUTCHAN_EXT15 = 0x0FU,
  ADC_INPUTCHAN_DISABLED = ADC_SC1_ADCH_MASK, ADC_INPUTCHAN_INT0 = 0x15, ADC_INPUTCHAN_INT1 = 0x16, ADC_INPUTCHAN_INT2 = 0x17,
  ADC_INPUTCHAN_INT3 = 0x1C, ADC_INPUTCHAN_TEMP = 0x1A, ADC_INPUTCHAN_BANDGAP = 0x1B, ADC_INPUTCHAN_VREFSH = 0x1D,
  ADC_INPUTCHAN_VREFSL = 0x1E
}
 Enumeration of input channels assignable to a control channel.
Note 0: entries in this enum are affected by ::FEATURE_ADC_NUM_EXT_CHANS, which is device dependent and controlled from "device_name"_features.h file.
Note 1: the actual number of external channels may differ between device packages and ADC instances. Reading a channel that is not connected externally, will return a random value within the range. Please refer to the Reference Manual for the maximum number of external channels for each device variant and ADC instance. More...
 
enum  adc_latch_clear_t { ADC_LATCH_CLEAR_WAIT, ADC_LATCH_CLEAR_FORCE }
 Defines the trigger latch clear method Implements : adc_latch_clear_t_Class. More...
 

Converter

Converter specific methods. These are used to configure and use the A/D Converter specific functionality, including:

  • clock input and divider
  • sample time in A/D clocks
  • resolution
  • trigger source
  • voltage reference
  • enable DMA
  • enable continuous conversion on one channel

To start a conversion, a control channel (see Channel Configuration) and a trigger source must be configured. Once a conversion is started, the user application can wait for it to be finished by calling the ADC_DRV_WaitConvDone() function.

Only the first control channel can be triggered by software. To start a conversion in this case, an input channel must be written in the channel selection register using the ADC_DRV_ConfigChan() method. Writing a value to the control channel while a conversion is being performed on that channel will start a new conversion.

void ADC_DRV_InitConverterStruct (adc_converter_config_t *const config)
 Initializes the converter configuration structure. More...
 
void ADC_DRV_ConfigConverter (const uint32_t instance, const adc_converter_config_t *const config)
 Configures the converter with the given configuration structure. More...
 
void ADC_DRV_GetConverterConfig (const uint32_t instance, adc_converter_config_t *const config)
 Gets the current converter configuration. More...
 
void ADC_DRV_Reset (const uint32_t instance)
 Resets the converter (sets all configurations to reset values) More...
 
void ADC_DRV_WaitConvDone (const uint32_t instance)
 Waits for a conversion/calibration to finish. More...
 
bool ADC_DRV_GetConvCompleteFlag (const uint32_t instance, const uint8_t chanIndex)
 Gets the control channel Conversion Complete Flag state. More...
 

Hardware Compare

The Hardware Compare feature of the S32K144 ADC is a versatile mechanism that can be used to monitor that a value is within certain values. Measurements can be monitored to be within certain ranges:

  • less than/ greater than a fixed value
  • inside or outside of a certain range

Two compare values can be configured (the second value is used only for range function mode). The compare values must be written in 12-bit resolution mode regardless of the actual used resolution mode.

Once the hardware compare feature is enabled, a conversion is considered complete only when the measured value is within the allowable range set by the configuration.

void ADC_DRV_InitHwCompareStruct (adc_compare_config_t *const config)
 Initializes the Hardware Compare configuration structure. More...
 
void ADC_DRV_ConfigHwCompare (const uint32_t instance, const adc_compare_config_t *const config)
 Configures the Hardware Compare feature with the given configuration structure. More...
 
void ADC_DRV_GetHwCompareConfig (const uint32_t instance, adc_compare_config_t *const config)
 Gets the current Hardware Compare configuration. More...
 

Hardware Average

The Hardware Average feature of the S32K144 allows for a set of measurements to be averaged together as a single conversion. The number of samples to be averaged is selectable (4, 8, 16 or 32 samples).

void ADC_DRV_InitHwAverageStruct (adc_average_config_t *const config)
 Initializes the Hardware Average configuration structure. More...
 
void ADC_DRV_ConfigHwAverage (const uint32_t instance, const adc_average_config_t *const config)
 Configures the Hardware Average feature with the given configuration structure. More...
 
void ADC_DRV_GetHwAverageConfig (const uint32_t instance, adc_average_config_t *const config)
 Gets the current Hardware Average configuration. More...
 

Channel configuration

Control register specific functions. These functions control configurations for each control channel (input channel selection and interrupt enable).

When software triggering is enabled, calling the ADC_DRV_ConfigChan() method for control channel 0 starts a new conversion.

After a conversion is finished, the result can be retrieved using the ADC_DRV_GetChanResult() method.

void ADC_DRV_InitChanStruct (adc_chan_config_t *const config)
 Initializes the control channel configuration structure. More...
 
void ADC_DRV_ConfigChan (const uint32_t instance, const uint8_t chanIndex, const adc_chan_config_t *const config)
 Configures the selected control channel with the given configuration structure. More...
 
void ADC_DRV_GetChanConfig (const uint32_t instance, const uint8_t chanIndex, adc_chan_config_t *const config)
 Gets the current control channel configuration for the selected channel index. More...
 
void ADC_DRV_SetSwPretrigger (const uint32_t instance, const adc_sw_pretrigger_t swPretrigger)
 This function sets the software pretrigger - affects only first 4 control channels. More...
 
void ADC_DRV_GetChanResult (const uint32_t instance, const uint8_t chanIndex, uint16_t *const result)
 Gets the last result for the selected control channel. More...
 

Automatic Calibration

These methods control the Calibration feature of the ADC.

The ADC_DRV_AutoCalibration() method can be called to execute a calibration sequence, or a calibration can be retrieved with the ADC_DRV_GetUserCalibration() and saved to non-volatile storage, to avoid calibration on every power-on. The calibration structure can be written with the ADC_DRV_ConfigUserCalibration() method.

void ADC_DRV_AutoCalibration (const uint32_t instance)
 Executes an Auto-Calibration. More...
 
void ADC_DRV_InitUserCalibrationStruct (adc_calibration_t *const config)
 Initializes the User Calibration configuration structure. More...
 
void ADC_DRV_ConfigUserCalibration (const uint32_t instance, const adc_calibration_t *const config)
 Configures the User Calibration feature with the given configuration structure. More...
 
void ADC_DRV_GetUserCalibration (const uint32_t instance, adc_calibration_t *const config)
 Gets the current User Calibration configuration. More...
 

Interrupts

This method returns the interrupt number for an ADC instance, which can be used to configure the interrupt, like in Interrupt Manager.

IRQn_Type ADC_DRV_GetInterruptNumber (const uint32_t instance)
 Returns the interrupt number for the ADC instance. More...
 

Latched triggers processing

These functions provide basic operations for using the trigger latch mechanism.

void ADC_DRV_ClearLatchedTriggers (const uint32_t instance, const adc_latch_clear_t clearMode)
 Clear latched triggers under processing. More...
 
void ADC_DRV_ClearTriggerErrors (const uint32_t instance)
 Clear all latch trigger error. More...
 
uint32_t ADC_DRV_GetTriggerErrorFlags (const uint32_t instance)
 This function returns the trigger error flags bits of the ADC instance. 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 138 of file adc_driver.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 41 of file adc_driver.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 66 of file adc_driver.h.

Enumeration of input channels assignable to a control channel.
Note 0: entries in this enum are affected by ::FEATURE_ADC_NUM_EXT_CHANS, which is device dependent and controlled from "device_name"_features.h file.
Note 1: the actual number of external channels may differ between device packages and ADC instances. Reading a channel that is not connected externally, will return a random value within the range. Please refer to the Reference Manual for the maximum number of external channels for each device variant and ADC instance.

Implements : adc_inputchannel_t_Class

Enumerator
ADC_INPUTCHAN_EXT0 

External input channel 0

ADC_INPUTCHAN_EXT1 

External input channel 1

ADC_INPUTCHAN_EXT2 

External input channel 2

ADC_INPUTCHAN_EXT3 

External input channel 3

ADC_INPUTCHAN_EXT4 

External input channel 4

ADC_INPUTCHAN_EXT5 

External input channel 5

ADC_INPUTCHAN_EXT6 

External input channel 6

ADC_INPUTCHAN_EXT7 

External input channel 7

ADC_INPUTCHAN_EXT8 

External input channel 8

ADC_INPUTCHAN_EXT9 

External input channel 9

ADC_INPUTCHAN_EXT10 

External input channel 10

ADC_INPUTCHAN_EXT11 

External input channel 11

ADC_INPUTCHAN_EXT12 

External input channel 12

ADC_INPUTCHAN_EXT13 

External input channel 13

ADC_INPUTCHAN_EXT14 

External input channel 14

ADC_INPUTCHAN_EXT15 

External input channel 15

ADC_INPUTCHAN_DISABLED 

Channel disabled

ADC_INPUTCHAN_INT0 

Internal input channel 0

ADC_INPUTCHAN_INT1 

Internal input channel 1

ADC_INPUTCHAN_INT2 

Internal input channel 2

ADC_INPUTCHAN_INT3 

Internal input channel 3

ADC_INPUTCHAN_TEMP 

Temperature Sensor

ADC_INPUTCHAN_BANDGAP 

Band Gap

ADC_INPUTCHAN_VREFSH 

Voltage Reference Select High

ADC_INPUTCHAN_VREFSL 

Voltage Reference Select Low

Definition at line 156 of file adc_driver.h.

Defines the trigger latch clear method Implements : adc_latch_clear_t_Class.

Enumerator
ADC_LATCH_CLEAR_WAIT 

Clear by waiting all latched triggers to be processed

ADC_LATCH_CLEAR_FORCE 

Process current trigger and clear all latched

Definition at line 291 of file adc_driver.h.

Pretrigger types selectable from Trigger Latching and Arbitration Unit.

Implements : adc_pretrigger_sel_t_Class

Enumerator
ADC_PRETRIGGER_SEL_PDB 

PDB pretrigger selected.

ADC_PRETRIGGER_SEL_TRGMUX 

TRGMUX pretrigger selected.

ADC_PRETRIGGER_SEL_SW 

Software pretrigger selected.

Definition at line 90 of file adc_driver.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 54 of file adc_driver.h.

Software pretriggers which may be set from Trigger Latching and Arbitration Unit.

Implements : adc_sw_pretrigger_t_Class

Enumerator
ADC_SW_PRETRIGGER_DISABLED 

SW pretrigger disabled.

ADC_SW_PRETRIGGER_0 

SW pretrigger 0.

ADC_SW_PRETRIGGER_1 

SW pretrigger 1.

ADC_SW_PRETRIGGER_2 

SW pretrigger 2.

ADC_SW_PRETRIGGER_3 

SW pretrigger 3.

Definition at line 113 of file adc_driver.h.

Trigger source selectable from Trigger Latching and Arbitration Unit.

Implements : adc_trigger_sel_t_Class

Enumerator
ADC_TRIGGER_SEL_PDB 

PDB trigger selected.

ADC_TRIGGER_SEL_TRGMUX 

TRGMUX trigger selected.

Definition at line 102 of file adc_driver.h.

Trigger type selection.

Implements : adc_trigger_t_Class

Enumerator
ADC_TRIGGER_SOFTWARE 

Software trigger.

ADC_TRIGGER_HARDWARE 

Hardware trigger.

Definition at line 79 of file adc_driver.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 127 of file adc_driver.h.

Function Documentation

void ADC_DRV_AutoCalibration ( const uint32_t  instance)

Executes an Auto-Calibration.

This functions executes an Auto-Calibration sequence. It is recommended to run this sequence before using the ADC converter.

Parameters
[in]instanceinstance number

Definition at line 490 of file adc_driver.c.

void ADC_DRV_ClearLatchedTriggers ( const uint32_t  instance,
const adc_latch_clear_t  clearMode 
)

Clear latched triggers under processing.

This function clears all trigger latched flags of the ADC instance. This function must be called after the hardware trigger source for the ADC has been deactivated.

Parameters
[in]instanceinstance number of the ADC
[in]clearModeThe clearing method for the latched triggers
  • ADC_LATCH_CLEAR_WAIT : Wait for all latched triggers to be processed.
  • ADC_LATCH_CLEAR_FORCE : Clear latched triggers and wait for trigger being process to finish.

Definition at line 605 of file adc_driver.c.

void ADC_DRV_ClearTriggerErrors ( const uint32_t  instance)

Clear all latch trigger error.

This function clears all trigger error flags of the ADC instance.

Parameters
[in]instanceinstance number of the ADC

Definition at line 630 of file adc_driver.c.

void ADC_DRV_ConfigChan ( const uint32_t  instance,
const uint8_t  chanIndex,
const adc_chan_config_t *const  config 
)

Configures the selected control channel with the given configuration structure.

When Software Trigger mode is enabled, configuring control channel index 0, implicitly triggers a new conversion on the selected ADC input channel. Therefore, ADC_DRV_ConfigChan can be used for sw-triggering conversions.

Configuring any control channel while it is actively controlling a conversion (sw or hw triggered) will implicitly abort the on-going conversion.

Parameters
[in]instanceinstance number
[in]chanIndexthe control channel index
[in]configthe configuration structure

Definition at line 331 of file adc_driver.c.

void ADC_DRV_ConfigConverter ( const uint32_t  instance,
const adc_converter_config_t *const  config 
)

Configures the converter with the given configuration structure.

This function configures the ADC converter with the options provided in the provided structure.

Parameters
[in]instanceinstance number
[in]configthe configuration structure

Definition at line 83 of file adc_driver.c.

void ADC_DRV_ConfigHwAverage ( const uint32_t  instance,
const adc_average_config_t *const  config 
)

Configures the Hardware Average feature with the given configuration structure.

This function sets the configuration for the Hardware Average feature.

Parameters
[in]instanceinstance number
[in]configthe configuration structure

Definition at line 268 of file adc_driver.c.

void ADC_DRV_ConfigHwCompare ( const uint32_t  instance,
const adc_compare_config_t *const  config 
)

Configures the Hardware Compare feature with the given configuration structure.

This functions sets the configuration for the Hardware Compare feature using the configuration structure.

Parameters
[in]instanceinstance number
[in]configthe configuration structure

Definition at line 205 of file adc_driver.c.

void ADC_DRV_ConfigUserCalibration ( const uint32_t  instance,
const adc_calibration_t *const  config 
)

Configures the User Calibration feature with the given configuration structure.

This function sets the configuration for the user calibration registers.

Parameters
[in]instanceinstance number
[in]configthe configuration structure

Definition at line 551 of file adc_driver.c.

void ADC_DRV_GetChanConfig ( const uint32_t  instance,
const uint8_t  chanIndex,
adc_chan_config_t *const  config 
)

Gets the current control channel configuration for the selected channel index.

This function returns the configuration for a control channel

Parameters
[in]instanceinstance number
[in]chanIndexthe control channel index
[out]configthe configuration structure

Definition at line 352 of file adc_driver.c.

void ADC_DRV_GetChanResult ( const uint32_t  instance,
const uint8_t  chanIndex,
uint16_t *const  result 
)

Gets the last result for the selected control channel.

This function returns the conversion result from a control channel.

Parameters
[in]instanceinstance number
[in]chanIndexthe converter control channel index
[out]resultthe result raw value

Definition at line 456 of file adc_driver.c.

bool ADC_DRV_GetConvCompleteFlag ( const uint32_t  instance,
const uint8_t  chanIndex 
)

Gets the control channel Conversion Complete Flag state.

This function returns the state of the Conversion Complete flag for a control channel. This flag is set when a conversion is complete or the condition generated by the Hardware Compare feature is evaluated to true.

Parameters
[in]instanceinstance number
[in]chanIndexthe adc control channel index
Returns
the Conversion Complete Flag state

Definition at line 429 of file adc_driver.c.

void ADC_DRV_GetConverterConfig ( const uint32_t  instance,
adc_converter_config_t *const  config 
)

Gets the current converter configuration.

This functions returns the configuration for converter in the form of a configuration structure.

Parameters
[in]instanceinstance number
[out]configthe configuration structure

Definition at line 110 of file adc_driver.c.

void ADC_DRV_GetHwAverageConfig ( const uint32_t  instance,
adc_average_config_t *const  config 
)

Gets the current Hardware Average configuration.

This function returns the configuration for the Hardware Average feature.

Parameters
[in]instanceinstance number
[out]configthe configuration structure

Definition at line 287 of file adc_driver.c.

void ADC_DRV_GetHwCompareConfig ( const uint32_t  instance,
adc_compare_config_t *const  config 
)

Gets the current Hardware Compare configuration.

This function returns the configuration for the Hardware Compare feature.

Parameters
[in]instanceinstance number
[out]configthe configuration structure

Definition at line 227 of file adc_driver.c.

IRQn_Type ADC_DRV_GetInterruptNumber ( const uint32_t  instance)

Returns the interrupt number for the ADC instance.

This function returns the interrupt number for the specified ADC instance.

Parameters
[in]instanceinstance number of the ADC
Returns
irq_number: the interrupt number (index) of the ADC instance, used to configure the interrupt

Definition at line 588 of file adc_driver.c.

uint32_t ADC_DRV_GetTriggerErrorFlags ( const uint32_t  instance)

This function returns the trigger error flags bits of the ADC instance.

Parameters
[in]instanceinstance number of the ADC
Returns
trigErrorFlags The Trigger Error Flags bit-mask

Definition at line 646 of file adc_driver.c.

void ADC_DRV_GetUserCalibration ( const uint32_t  instance,
adc_calibration_t *const  config 
)

Gets the current User Calibration configuration.

This function returns the current user calibration register values.

Parameters
[in]instanceinstance number
[out]configthe configuration structure

Definition at line 570 of file adc_driver.c.

void ADC_DRV_InitChanStruct ( adc_chan_config_t *const  config)

Initializes the control channel configuration structure.

This function initializes the control channel configuration structure to default values (Reference Manual resets). This function should be called on a structure before using it to configure a channel (ADC_DRV_ConfigChan), otherwise all members must be written by the caller. This function insures that all members are written with safe values, so the user can modify only the desired members.

Parameters
[out]configthe configuration structure

Definition at line 309 of file adc_driver.c.

void ADC_DRV_InitConverterStruct ( adc_converter_config_t *const  config)

Initializes the converter configuration structure.

This function initializes the members of the adc_converter_config_t structure to default values (Reference Manual resets). This function should be called on a structure before using it to configure the converter with ADC_DRV_ConfigConverter(), otherwise all members must be written (initialized) by the user. This function insures that all members are written with safe values, so the user can modify only the desired members.

Parameters
[out]configthe configuration structure

Definition at line 59 of file adc_driver.c.

void ADC_DRV_InitHwAverageStruct ( adc_average_config_t *const  config)

Initializes the Hardware Average configuration structure.

This function initializes the Hardware Average configuration structure to default values (Reference Manual resets). This function should be called before configuring the Hardware Average feature (ADC_DRV_ConfigHwAverage), otherwise all members must be written by the caller. This function insures that all members are written with safe values, so the user can modify the desired members.

Parameters
[out]configthe configuration structure

Definition at line 252 of file adc_driver.c.

void ADC_DRV_InitHwCompareStruct ( adc_compare_config_t *const  config)

Initializes the Hardware Compare configuration structure.

This function initializes the Hardware Compare configuration structure to default values (Reference Manual resets). This function should be called before configuring the Hardware Compare feature (ADC_DRV_ConfigHwCompare), otherwise all members must be written by the caller. This function insures that all members are written with safe values, so the user can modify the desired members.

Parameters
[out]configthe configuration structure

Definition at line 186 of file adc_driver.c.

void ADC_DRV_InitUserCalibrationStruct ( adc_calibration_t *const  config)

Initializes the User Calibration configuration structure.

This function initializes the User Calibration configuration structure to default values (Reference Manual resets). This function should be called on a structure before using it to configure the User Calibration feature (ADC_DRV_ConfigUserCalibration), otherwise all members must be written by the caller. This function insures that all members are written with safe values, so the user can modify only the desired members.

Parameters
[out]configthe configuration structure

Definition at line 535 of file adc_driver.c.

void ADC_DRV_Reset ( const uint32_t  instance)

Resets the converter (sets all configurations to reset values)

This function resets all the internal ADC registers to reset values.

Parameters
[in]instanceinstance number

Definition at line 137 of file adc_driver.c.

void ADC_DRV_SetSwPretrigger ( const uint32_t  instance,
const adc_sw_pretrigger_t  swPretrigger 
)

This function sets the software pretrigger - affects only first 4 control channels.

Parameters
[in]instanceinstance number
[in]swPretriggerthe swPretrigger to be enabled

Definition at line 372 of file adc_driver.c.

void ADC_DRV_WaitConvDone ( const uint32_t  instance)

Waits for a conversion/calibration to finish.

This functions waits for a conversion to complete by continuously polling the Conversion Active Flag.

Parameters
[in]instanceinstance number

Definition at line 409 of file adc_driver.c.