RTEMS 6.1-rc5
|
Data Structures | |
struct | _adc_config |
Converter configuration. More... | |
struct | _adc_offest_config |
Converter Offset configuration. More... | |
struct | _adc_hardware_compare_config |
ADC hardware compare configuration. More... | |
struct | _adc_channel_config |
ADC channel conversion configuration. More... | |
Macros | |
#define | FSL_ADC_DRIVER_VERSION (MAKE_VERSION(2, 0, 4)) |
ADC driver version. | |
Typedefs | |
typedef enum _adc_status_flags | adc_status_flags_t |
Converter's status flags. | |
typedef enum _adc_reference_voltage_source | adc_reference_voltage_source_t |
Reference voltage source. | |
typedef enum _adc_sample_period_mode | adc_sample_period_mode_t |
Sample time duration. | |
typedef enum _adc_clock_source | adc_clock_source_t |
Clock source. | |
typedef enum _adc_clock_drvier | adc_clock_driver_t |
Clock divider for the converter. | |
typedef enum _adc_resolution | adc_resolution_t |
Converter's resolution. | |
typedef enum _adc_hardware_compare_mode | adc_hardware_compare_mode_t |
Converter hardware compare mode. | |
typedef enum _adc_hardware_average_mode | adc_hardware_average_mode_t |
Converter hardware average mode. | |
typedef struct _adc_config | adc_config_t |
Converter configuration. | |
typedef struct _adc_offest_config | adc_offest_config_t |
Converter Offset configuration. | |
typedef struct _adc_hardware_compare_config | adc_hardware_compare_config_t |
ADC hardware compare configuration. | |
typedef struct _adc_channel_config | adc_channel_config_t |
ADC channel conversion configuration. | |
Initialization | |
void | ADC_Init (ADC_Type *base, const adc_config_t *config) |
Initialize the ADC module. | |
void | ADC_Deinit (ADC_Type *base) |
De-initializes the ADC module. | |
void | ADC_GetDefaultConfig (adc_config_t *config) |
Gets an available pre-defined settings for the converter's configuration. | |
void | ADC_SetChannelConfig (ADC_Type *base, uint32_t channelGroup, const adc_channel_config_t *config) |
Configures the conversion channel. | |
status_t | ADC_DoAutoCalibration (ADC_Type *base) |
Automates the hardware calibration. | |
void | ADC_SetOffsetConfig (ADC_Type *base, const adc_offest_config_t *config) |
Set user defined offset. | |
void | ADC_SetHardwareCompareConfig (ADC_Type *base, const adc_hardware_compare_config_t *config) |
Configures the hardware compare mode. | |
void | ADC_SetHardwareAverageConfig (ADC_Type *base, adc_hardware_average_mode_t mode) |
Configures the hardware average mode. | |
void | ADC_ClearStatusFlags (ADC_Type *base, uint32_t mask) |
Clears the converter's status falgs. | |
#define FSL_ADC_DRIVER_VERSION (MAKE_VERSION(2, 0, 4)) |
ADC driver version.
Version 2.0.4.
typedef struct _adc_hardware_compare_config adc_hardware_compare_config_t |
ADC hardware compare configuration.
In kADC_HardwareCompareMode0, compare true if the result is less than the value1. In kADC_HardwareCompareMode1, compare true if the result is greater than or equal to value1. In kADC_HardwareCompareMode2, Value1 <= Value2, compare true if the result is less than value1 Or the result is Greater than value2. Value1 > Value2, compare true if the result is less than value1 And the result is Greater than value2. In kADC_HardwareCompareMode3, Value1 <= Value2, compare true if the result is greater than or equal to value1 And the result is less than or equal to value2. Value1 > Value2, compare true if the result is greater than or equal to value1 Or the result is less than or equal to value2.
enum _adc_clock_drvier |
Clock divider for the converter.
enum _adc_clock_source |
Converter hardware average mode.
Converter hardware compare mode.
enum _adc_resolution |
Sample time duration.
enum _adc_status_flags |
void ADC_ClearStatusFlags | ( | ADC_Type * | base, |
uint32_t | mask | ||
) |
Clears the converter's status falgs.
base | ADC peripheral base address. |
mask | Mask value for the cleared flags. See "adc_status_flags_t". |
brief Clears the converter's status falgs.
param base ADC peripheral base address. param mask Mask value for the cleared flags. See "adc_status_flags_t".
void ADC_Deinit | ( | ADC_Type * | base | ) |
De-initializes the ADC module.
base | ADC peripheral base address. |
brief De-initializes the ADC module.
param base ADC peripheral base address.
Automates the hardware calibration.
This auto calibration helps to adjust the plus/minus side gain automatically. Execute the calibration before using the converter. Note that the software trigger should be used during calibration.
base | ADC peripheral base address. |
kStatus_Success | Calibration is done successfully. |
kStatus_Fail | Calibration has failed. |
brief Automates the hardware calibration.
This auto calibration helps to adjust the plus/minus side gain automatically. Execute the calibration before using the converter. Note that the software trigger should be used during calibration.
param base ADC peripheral base address.
return Execution status. retval kStatus_Success Calibration is done successfully. retval kStatus_Fail Calibration has failed.
void ADC_GetDefaultConfig | ( | adc_config_t * | config | ) |
Gets an available pre-defined settings for the converter's configuration.
This function initializes the converter configuration structure with available settings. The default values are:
config | Pointer to the configuration structure. |
brief Gets an available pre-defined settings for the converter's configuration.
This function initializes the converter configuration structure with available settings. The default values are: code config->enableAsynchronousClockOutput = true; config->enableOverWrite = false; config->enableContinuousConversion = false; config->enableHighSpeed = false; config->enableLowPower = false; config->enableLongSample = false; config->referenceVoltageSource = kADC_ReferenceVoltageSourceAlt0; config->samplePeriodMode = kADC_SamplePeriod2or12Clocks; config->clockSource = kADC_ClockSourceAD; config->clockDriver = kADC_ClockDriver1; config->resolution = kADC_Resolution12Bit; endcode param base ADC peripheral base address. param config Pointer to the configuration structure.
void ADC_Init | ( | ADC_Type * | base, |
const adc_config_t * | config | ||
) |
Initialize the ADC module.
base | ADC peripheral base address. |
config | Pointer to "adc_config_t" structure. |
brief Initialize the ADC module.
param base ADC peripheral base address. param config Pointer to "adc_config_t" structure.
void ADC_SetChannelConfig | ( | ADC_Type * | base, |
uint32_t | channelGroup, | ||
const adc_channel_config_t * | config | ||
) |
Configures the conversion channel.
This operation triggers the conversion when in software trigger mode. When in hardware trigger mode, this API configures the channel while the external trigger source helps to trigger the conversion.
Note that the "Channel Group" has a detailed description. To allow sequential conversions of the ADC to be triggered by internal peripherals, the ADC has more than one group of status and control registers, one for each conversion. The channel group parameter indicates which group of registers are used, for example channel group 0 is for Group A registers and channel group 1 is for Group B registers. The channel groups are used in a "ping-pong" approach to control the ADC operation. At any point, only one of the channel groups is actively controlling ADC conversions. The channel group 0 is used for both software and hardware trigger modes. Channel groups 1 and greater indicate potentially multiple channel group registers for use only in hardware trigger mode. See the chip configuration information in the appropriate MCU reference manual about the number of SC1n registers (channel groups) specific to this device. None of the channel groups 1 or greater are used for software trigger operation. Therefore, writing to these channel groups does not initiate a new conversion. Updating the channel group 0 while a different channel group is actively controlling a conversion is allowed and vice versa. Writing any of the channel group registers while that specific channel group is actively controlling a conversion aborts the current conversion.
base | ADC peripheral base address. |
channelGroup | Channel group index. |
config | Pointer to the "adc_channel_config_t" structure for the conversion channel. |
brief Configures the conversion channel.
This operation triggers the conversion when in software trigger mode. When in hardware trigger mode, this API configures the channel while the external trigger source helps to trigger the conversion.
Note that the "Channel Group" has a detailed description. To allow sequential conversions of the ADC to be triggered by internal peripherals, the ADC has more than one group of status and control registers, one for each conversion. The channel group parameter indicates which group of registers are used, for example channel group 0 is for Group A registers and channel group 1 is for Group B registers. The channel groups are used in a "ping-pong" approach to control the ADC operation. At any point, only one of the channel groups is actively controlling ADC conversions. The channel group 0 is used for both software and hardware trigger modes. Channel groups 1 and greater indicate potentially multiple channel group registers for use only in hardware trigger mode. See the chip configuration information in the appropriate MCU reference manual about the number of SC1n registers (channel groups) specific to this device. None of the channel groups 1 or greater are used for software trigger operation. Therefore, writing to these channel groups does not initiate a new conversion. Updating the channel group 0 while a different channel group is actively controlling a conversion is allowed and vice versa. Writing any of the channel group registers while that specific channel group is actively controlling a conversion aborts the current conversion.
param base ADC peripheral base address. param channelGroup Channel group index. param config Pointer to the "adc_channel_config_t" structure for the conversion channel.
void ADC_SetHardwareAverageConfig | ( | ADC_Type * | base, |
adc_hardware_average_mode_t | mode | ||
) |
Configures the hardware average mode.
The hardware average mode provides a way to process the conversion result automatically by using hardware. The multiple conversion results are accumulated and averaged internally making them easier to read.
base | ADC peripheral base address. |
mode | Setting the hardware average mode. See "adc_hardware_average_mode_t". |
brief Configures the hardware average mode.
The hardware average mode provides a way to process the conversion result automatically by using hardware. The multiple conversion results are accumulated and averaged internally making them easier to read.
param base ADC peripheral base address. param mode Setting the hardware average mode. See "adc_hardware_average_mode_t".
void ADC_SetHardwareCompareConfig | ( | ADC_Type * | base, |
const adc_hardware_compare_config_t * | config | ||
) |
Configures the hardware compare mode.
The hardware compare mode provides a way to process the conversion result automatically by using hardware. Only the result in the compare range is available. To compare the range, see "adc_hardware_compare_mode_t" or the appopriate reference manual for more information.
base | ADC peripheral base address. |
config | Pointer to "adc_hardware_compare_config_t" structure. |
brief Configures the hardware compare mode.
The hardware compare mode provides a way to process the conversion result automatically by using hardware. Only the result in the compare range is available. To compare the range, see "adc_hardware_compare_mode_t" or the appopriate reference manual for more information.
param base ADC peripheral base address. param Pointer to "adc_hardware_compare_config_t" structure.
void ADC_SetOffsetConfig | ( | ADC_Type * | base, |
const adc_offest_config_t * | config | ||
) |
Set user defined offset.
base | ADC peripheral base address. |
config | Pointer to "adc_offest_config_t" structure. |
brief Set user defined offset.
param base ADC peripheral base address. param config Pointer to "adc_offest_config_t" structure.