Go to the source code of this file.
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... | |
Functions | |
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) |
Get the trigger error flags bits of the ADC instance. More... | |