![]() |
S32 SDK
|
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:
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.
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).
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:
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).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()
.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.
There are two separate ways for triggering an ADC conversion from a control channel:
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:
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:
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... | |
enum adc_average_t |
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.
enum adc_clk_divide_t |
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.
enum adc_input_clock_t |
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.
enum adc_inputchannel_t |
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
Definition at line 156 of file adc_driver.h.
enum adc_latch_clear_t |
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.
enum adc_pretrigger_sel_t |
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.
enum adc_resolution_t |
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.
enum adc_sw_pretrigger_t |
Software pretriggers which may be set from Trigger Latching and Arbitration Unit.
Implements : adc_sw_pretrigger_t_Class
Definition at line 113 of file adc_driver.h.
enum adc_trigger_sel_t |
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.
enum adc_trigger_t |
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.
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.
[in] | instance | instance 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.
[in] | instance | instance number of the ADC |
[in] | clearMode | The clearing method for the latched triggers
|
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.
[in] | instance | instance 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.
[in] | instance | instance number |
[in] | chanIndex | the control channel index |
[in] | config | the 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.
[in] | instance | instance number |
[in] | config | the 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.
[in] | instance | instance number |
[in] | config | the 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.
[in] | instance | instance number |
[in] | config | the 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.
[in] | instance | instance number |
[in] | config | the 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
[in] | instance | instance number |
[in] | chanIndex | the control channel index |
[out] | config | the 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.
[in] | instance | instance number |
[in] | chanIndex | the converter control channel index |
[out] | result | the 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.
[in] | instance | instance number |
[in] | chanIndex | the adc control channel index |
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.
[in] | instance | instance number |
[out] | config | the 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.
[in] | instance | instance number |
[out] | config | the 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.
[in] | instance | instance number |
[out] | config | the 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.
[in] | instance | instance number of the ADC |
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.
[in] | instance | instance number of the ADC |
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.
[in] | instance | instance number |
[out] | config | the 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.
[out] | config | the 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.
[out] | config | the 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.
[out] | config | the 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.
[out] | config | the 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.
[out] | config | the 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.
[in] | instance | instance 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.
[in] | instance | instance number |
[in] | swPretrigger | the 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.
[in] | instance | instance number |
Definition at line 409 of file adc_driver.c.