RTEMS 6.1-rc1
Data Structures | Macros | Typedefs | Enumerations
Adc_12b1msps_sar

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

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. More...
 
typedef struct _adc_channel_config adc_channel_config_t
 ADC channel conversion configuration.
 

Enumerations

enum  _adc_status_flags { kADC_ConversionActiveFlag = ADC_GS_ADACT_MASK , kADC_CalibrationFailedFlag = ADC_GS_CALF_MASK , kADC_AsynchronousWakeupInterruptFlag }
 Converter's status flags. More...
 
enum  _adc_reference_voltage_source { kADC_ReferenceVoltageSourceAlt0 = 0U }
 Reference voltage source. More...
 
enum  _adc_sample_period_mode {
  kADC_SamplePeriod2or12Clocks = 0U , kADC_SamplePeriod4or16Clocks = 1U , kADC_SamplePeriod6or20Clocks = 2U , kADC_SamplePeriod8or24Clocks = 3U ,
  kADC_SamplePeriodLong12Clcoks = kADC_SamplePeriod2or12Clocks , kADC_SamplePeriodLong16Clcoks = kADC_SamplePeriod4or16Clocks , kADC_SamplePeriodLong20Clcoks = kADC_SamplePeriod6or20Clocks , kADC_SamplePeriodLong24Clcoks = kADC_SamplePeriod8or24Clocks ,
  kADC_SamplePeriodShort2Clocks = kADC_SamplePeriod2or12Clocks , kADC_SamplePeriodShort4Clocks = kADC_SamplePeriod4or16Clocks , kADC_SamplePeriodShort6Clocks = kADC_SamplePeriod6or20Clocks , kADC_SamplePeriodShort8Clocks = kADC_SamplePeriod8or24Clocks
}
 Sample time duration. More...
 
enum  _adc_clock_source { kADC_ClockSourceIPG = 0U , kADC_ClockSourceIPGDiv2 = 1U , kADC_ClockSourceALT = 2U , kADC_ClockSourceAD = 3U }
 Clock source. More...
 
enum  _adc_clock_drvier { kADC_ClockDriver1 = 0U , kADC_ClockDriver2 = 1U , kADC_ClockDriver4 = 2U , kADC_ClockDriver8 = 3U }
 Clock divider for the converter. More...
 
enum  _adc_resolution { kADC_Resolution8Bit = 0U , kADC_Resolution10Bit = 1U , kADC_Resolution12Bit = 2U }
 Converter's resolution. More...
 
enum  _adc_hardware_compare_mode { kADC_HardwareCompareMode0 = 0U , kADC_HardwareCompareMode1 = 1U , kADC_HardwareCompareMode2 = 2U , kADC_HardwareCompareMode3 = 3U }
 Converter hardware compare mode. More...
 
enum  _adc_hardware_average_mode {
  kADC_HardwareAverageCount4 = 0U , kADC_HardwareAverageCount8 = 1U , kADC_HardwareAverageCount16 = 2U , kADC_HardwareAverageCount32 = 3U ,
  kADC_HardwareAverageDiasable = 4U
}
 Converter hardware average mode. More...
 

Initialization

void ADC_Init (ADC_Type *base, const adc_config_t *config)
 Initialize the ADC module. More...
 
void ADC_Deinit (ADC_Type *base)
 De-initializes the ADC module. More...
 
void ADC_GetDefaultConfig (adc_config_t *config)
 Gets an available pre-defined settings for the converter's configuration. More...
 
void ADC_SetChannelConfig (ADC_Type *base, uint32_t channelGroup, const adc_channel_config_t *config)
 Configures the conversion channel. More...
 
status_t ADC_DoAutoCalibration (ADC_Type *base)
 Automates the hardware calibration. More...
 
void ADC_SetOffsetConfig (ADC_Type *base, const adc_offest_config_t *config)
 Set user defined offset. More...
 
void ADC_SetHardwareCompareConfig (ADC_Type *base, const adc_hardware_compare_config_t *config)
 Configures the hardware compare mode. More...
 
void ADC_SetHardwareAverageConfig (ADC_Type *base, adc_hardware_average_mode_t mode)
 Configures the hardware average mode. More...
 
void ADC_ClearStatusFlags (ADC_Type *base, uint32_t mask)
 Clears the converter's status falgs. More...
 

Detailed Description

Macro Definition Documentation

◆ FSL_ADC_DRIVER_VERSION

#define FSL_ADC_DRIVER_VERSION   (MAKE_VERSION(2, 0, 4))

ADC driver version.

Version 2.0.4.

Typedef Documentation

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

Enumeration Type Documentation

◆ _adc_clock_drvier

Clock divider for the converter.

Enumerator
kADC_ClockDriver1 

For divider 1 from the input clock to the module.

kADC_ClockDriver2 

For divider 2 from the input clock to the module.

kADC_ClockDriver4 

For divider 4 from the input clock to the module.

kADC_ClockDriver8 

For divider 8 from the input clock to the module.

◆ _adc_clock_source

Clock source.

Enumerator
kADC_ClockSourceIPG 

Select IPG clock to generate ADCK.

kADC_ClockSourceIPGDiv2 

Select IPG clock divided by 2 to generate ADCK.

kADC_ClockSourceALT 

Select alternate clock to generate ADCK.

kADC_ClockSourceAD 

Select Asynchronous clock to generate ADCK.

◆ _adc_hardware_average_mode

Converter hardware average mode.

Enumerator
kADC_HardwareAverageCount4 

For hardware average with 4 samples.

kADC_HardwareAverageCount8 

For hardware average with 8 samples.

kADC_HardwareAverageCount16 

For hardware average with 16 samples.

kADC_HardwareAverageCount32 

For hardware average with 32 samples.

kADC_HardwareAverageDiasable 

Disable the hardware average function.

◆ _adc_hardware_compare_mode

Converter hardware compare mode.

Enumerator
kADC_HardwareCompareMode0 

Compare true if the result is less than the value1.

kADC_HardwareCompareMode1 

Compare true if the result is greater than or equal to value1.

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

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.

◆ _adc_reference_voltage_source

Reference voltage source.

Enumerator
kADC_ReferenceVoltageSourceAlt0 

For external pins pair of VrefH and VrefL.

◆ _adc_resolution

Converter's resolution.

Enumerator
kADC_Resolution8Bit 

Single End 8-bit resolution.

kADC_Resolution10Bit 

Single End 10-bit resolution.

kADC_Resolution12Bit 

Single End 12-bit resolution.

◆ _adc_sample_period_mode

Sample time duration.

Enumerator
kADC_SamplePeriod2or12Clocks 

Long sample 12 clocks or short sample 2 clocks.

kADC_SamplePeriod4or16Clocks 

Long sample 16 clocks or short sample 4 clocks.

kADC_SamplePeriod6or20Clocks 

Long sample 20 clocks or short sample 6 clocks.

kADC_SamplePeriod8or24Clocks 

Long sample 24 clocks or short sample 8 clocks.

kADC_SamplePeriodLong12Clcoks 

Long sample 12 clocks.

kADC_SamplePeriodLong16Clcoks 

Long sample 16 clocks.

kADC_SamplePeriodLong20Clcoks 

Long sample 20 clocks.

kADC_SamplePeriodLong24Clcoks 

Long sample 24 clocks.

kADC_SamplePeriodShort2Clocks 

Short sample 2 clocks.

kADC_SamplePeriodShort4Clocks 

Short sample 4 clocks.

kADC_SamplePeriodShort6Clocks 

Short sample 6 clocks.

kADC_SamplePeriodShort8Clocks 

Short sample 8 clocks.

◆ _adc_status_flags

Converter's status flags.

Enumerator
kADC_ConversionActiveFlag 

Conversion is active,not support w1c.

kADC_CalibrationFailedFlag 

Calibration is failed,support w1c.

kADC_AsynchronousWakeupInterruptFlag 

Asynchronous wakeup interrupt occurred, support w1c.

Function Documentation

◆ ADC_ClearStatusFlags()

void ADC_ClearStatusFlags ( ADC_Type base,
uint32_t  mask 
)

Clears the converter's status falgs.

Parameters
baseADC peripheral base address.
maskMask 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".

◆ ADC_Deinit()

void ADC_Deinit ( ADC_Type base)

De-initializes the ADC module.

Parameters
baseADC peripheral base address.

brief De-initializes the ADC module.

param base ADC peripheral base address.

◆ ADC_DoAutoCalibration()

status_t ADC_DoAutoCalibration ( ADC_Type base)

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.

Parameters
baseADC peripheral base address.
Returns
Execution status.
Return values
kStatus_SuccessCalibration is done successfully.
kStatus_FailCalibration 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.

◆ ADC_GetDefaultConfig()

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->enableAsynchronousClockOutput = true;
config->enableOverWrite = false;
config->enableContinuousConversion = false;
config->enableHighSpeed = false;
config->enableLowPower = false;
config->enableLongSample = false;
config->referenceVoltageSource = kADC_ReferenceVoltageSourceAlt0;
config->clockSource = kADC_ClockSourceAD;
config->clockDriver = kADC_ClockDriver1;
@ kADC_SamplePeriod2or12Clocks
Definition: fsl_adc.h:50
@ kADC_ClockSourceAD
Definition: fsl_adc.h:77
@ kADC_ReferenceVoltageSourceAlt0
Definition: fsl_adc.h:41
@ kADC_Resolution12Bit
Definition: fsl_adc.h:98
@ kADC_ClockDriver1
Definition: fsl_adc.h:85
Definition: deflate.c:114
Parameters
configPointer 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.

◆ ADC_Init()

void ADC_Init ( ADC_Type base,
const adc_config_t config 
)

Initialize the ADC module.

Parameters
baseADC peripheral base address.
configPointer to "adc_config_t" structure.

brief Initialize the ADC module.

param base ADC peripheral base address. param config Pointer to "adc_config_t" structure.

◆ ADC_SetChannelConfig()

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.

Parameters
baseADC peripheral base address.
channelGroupChannel group index.
configPointer 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.

◆ ADC_SetHardwareAverageConfig()

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.

Parameters
baseADC peripheral base address.
modeSetting 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".

◆ ADC_SetHardwareCompareConfig()

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.

Parameters
baseADC peripheral base address.
configPointer 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.

◆ ADC_SetOffsetConfig()

void ADC_SetOffsetConfig ( ADC_Type base,
const adc_offest_config_t config 
)

Set user defined offset.

Parameters
baseADC peripheral base address.
configPointer 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.