This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc, each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc, for your further reference.
|
enum | adc16_input_channel_t {
kADC16_Input0Channel = 0U,
kADC16_Input1Channel = 1U,
kADC16_Input2Channel = 2U,
kADC16_Input3Channel = 3U,
kADC16_Input4Channel = 4U,
kADC16_Input5Channel = 5U,
kADC16_Input6Channel = 6U,
kADC16_Input7Channel = 7U,
kADC16_Input8Channel = 8U,
kADC16_Input9Channel = 9U,
kADC16_Input10Channel = 10U,
kADC16_Input11Channel = 11U,
kADC16_Input12Channel = 12U,
kADC16_Input13Channel = 13U,
kADC16_Input14Channel = 14U,
kADC16_Input15Channel = 15U,
kADC16_Input16Channel = 16U,
kADC16_Input17Channel = 17U,
kADC16_Input18Channel = 18U,
kADC16_Input19Channel = 19U,
kADC16_Input20Channel = 20U,
kADC16_Input21Channel = 21U,
kADC16_Input22Channel = 22U,
kADC16_Input23Channel = 23U,
kADC16_Reserved1 = 24U,
kADC16_Reserved2 = 25U,
kADC16_TempSensor = 26U,
kADC16_ABandgap = 27U,
kADC16_Reserved3 = 28U,
kADC16_VREFSH = 29U,
kADC16_VREFSL = 30U,
kADC16_ModuleDisabled = 31U
} |
| The enumeration all of ADC16 Input channels. More...
|
|
enum | adc16_clock_divider_t {
kADC16_ClockDivider1 = 0U,
kADC16_ClockDivider2 = 1U,
kADC16_ClockDivider4 = 2U,
kADC16_ClockDivider8 = 3U
} |
| The enumeration ADC16 clock divider. More...
|
|
enum | adc16_resolution_t {
kADC16_Resolution8bit = 0U,
kADC16_Resolution12bit = 1U,
kADC16_Resolution10bit = 2U,
kADC16_Resolution16bit = 3U
} |
| The enumeration ADC16 Conversion resolution mode. More...
|
|
enum | adc16_clock_source_t {
kADC16_ClockSourceAlt0 = 0U,
kADC16_ClockSourceAlt1 = 1U,
kADC16_ClockSourceAlt2 = 2U,
kADC16_ClockSourceAlt3 = 3U,
kADC16_ClockSourceAsynchronousClock = kADC16_ClockSourceAlt3
} |
| The enumeration of ADC16 clock source. More...
|
|
enum | adc16_sample_mode_t {
kADC16_SampleCycle24 = 0U,
kADC16_SampleCycle16 = 1U,
kADC16_SampleCycle10 = 2U,
kADC16_SampleCycle6 = 3U,
kADC16_SampleDisabled = 4U
} |
| The enumeration of ADC16 sample mode. More...
|
|
enum | adc16_compare_mode {
kADC16_LessThanThreshold = 0U,
kADC16_GreaterThanOrEqualThreshold = 1U,
kADC16_TriggerOutsideCompareRangeMode1 = 2U,
kADC16_TriggerInsideCompareRangeMode1 = 3U,
kADC16_TriggerInsideCompareRangeMode2 = 4U,
kADC16_TriggerOutsideCompareRangeMode2 = 5U
} |
| The enumeration ADC16 Automatic compare mode. More...
|
|
enum | adc16_reference_voltage_source_t {
kADC16_ReferenceVoltageSourceVref = 0U,
kADC16_ReferenceVoltageSourceValt = 1U,
kADC16_ReferenceVoltageSourceBandgap = 2U
} |
| The enumeration ADC16 Reference voltage source. More...
|
|
enum | adc16_hardware_average_mode_t {
kADC16_HardwareAverageCount4 = 0U,
kADC16_HardwareAverageCount8 = 1U,
kADC16_HardwareAverageCount16 = 2U,
kADC16_HardwareAverageCount32 = 3U,
kADC16_HardwareAverageDisabled = 4U
} |
| The enumeration ADC16's Hardware average mode. More...
|
|
enum | adc16_trigger_source_t {
kADC16_SoftWareTrigger = 0U,
kADC16_HardWareTrigger = 1U
} |
| The enumeration ADC16’s conversion trigger source. More...
|
|
struct adc16_hardware_compare_t |
int16_t adc16_hardware_compare_t::i16Value1 |
int16_t adc16_hardware_compare_t::i16Value2 |
bool adc16_config_t::bEnableAsynchronousClock |
bool adc16_config_t::bEnableHighSpeed |
bool adc16_config_t::bEnableLowPower |
uint32_t adc16_config_t::u32GroupId |
bool adc16_config_t::bEnableInterruptOnConversionCompleted |
bool adc16_config_t::bEnableContinuousConversion |
Enumerator |
---|
kADC16_Input0Channel |
AD0 is selected as input.
|
kADC16_Input1Channel |
AD1 is selected as input.
|
kADC16_Input2Channel |
AD2 is selected as input.
|
kADC16_Input3Channel |
AD3 is selected as input.
|
kADC16_Input4Channel |
AD4 is selected as input.
|
kADC16_Input5Channel |
AD5 is selected as input.
|
kADC16_Input6Channel |
AD6 is selected as input.
|
kADC16_Input7Channel |
AD7 is selected as input.
|
kADC16_Input8Channel |
AD8 is selected as input.
|
kADC16_Input9Channel |
AD9 is selected as input.
|
kADC16_Input10Channel |
AD10 is selected as input.
|
kADC16_Input11Channel |
AD11 is selected as input.
|
kADC16_Input12Channel |
AD12 is selected as input.
|
kADC16_Input13Channel |
AD13 is selected as input.
|
kADC16_Input14Channel |
AD14 is selected as input.
|
kADC16_Input15Channel |
AD15 is selected as input.
|
kADC16_Input16Channel |
AD16 is selected as input.
|
kADC16_Input17Channel |
AD17 is selected as input.
|
kADC16_Input18Channel |
AD18 is selected as input.
|
kADC16_Input19Channel |
AD19 is selected as input.
|
kADC16_Input20Channel |
AD20 is selected as input.
|
kADC16_Input21Channel |
AD21 is selected as input.
|
kADC16_Input22Channel |
AD22 is selected as input.
|
kADC16_Input23Channel |
AD23 is selected as input.
|
kADC16_Reserved1 |
Reserved.
|
kADC16_Reserved2 |
Reserved.
|
kADC16_TempSensor |
Temp Sensor (single-ended) is selected as input.
|
kADC16_ABandgap |
ABandgap (single-ended) is selected as input.
|
kADC16_Reserved3 |
Reserved.
|
kADC16_VREFSH |
High reference voltage is selected as input.
|
kADC16_VREFSL |
Low reference voltage is selected as input.
|
kADC16_ModuleDisabled |
Module is disabled.
|
Enumerator |
---|
kADC16_ClockDivider1 |
For divider 1 from the input clock to the module.
|
kADC16_ClockDivider2 |
For divider 2 from the input clock to the module.
|
kADC16_ClockDivider4 |
For divider 4 from the input clock to the module.
|
kADC16_ClockDivider8 |
For divider 8 from the input clock to the module.
|
Enumerator |
---|
kADC16_Resolution8bit |
single-ended 8-bit conversion
|
kADC16_Resolution12bit |
single-ended 12-bit conversion
|
kADC16_Resolution10bit |
single-ended 10-bit conversion
|
kADC16_Resolution16bit |
single-ended 16-bit conversion
|
Enumerator |
---|
kADC16_ClockSourceAlt0 |
Selection Bus clock.
|
kADC16_ClockSourceAlt1 |
Selection (Bus clock)/2.
|
kADC16_ClockSourceAlt2 |
Selection Alternate clock (ALTCLK).
|
kADC16_ClockSourceAlt3 |
Selection Asynchronous clock (ADACK).
|
kADC16_ClockSourceAsynchronousClock |
Using internal asynchronous clock.
|
Enumerator |
---|
kADC16_SampleCycle24 |
20 extra ADCK cycles, 24 ADCK cycles total.
|
kADC16_SampleCycle16 |
12 extra ADCK cycles, 16 ADCK cycles total.
|
kADC16_SampleCycle10 |
6 extra ADCK cycles, 10 ADCK cycles total.
|
kADC16_SampleCycle6 |
2 extra ADCK cycles, 6 ADCK cycles total.
|
kADC16_SampleDisabled |
Disable the sample feature.
|
Enumerator |
---|
kADC16_LessThanThreshold |
Less than threshold.
|
kADC16_GreaterThanOrEqualThreshold |
Greater than or equal to threshold.
|
kADC16_TriggerOutsideCompareRangeMode1 |
Compare true if the result is less than CV1 Or the result is greater than CV2.
|
kADC16_TriggerInsideCompareRangeMode1 |
Compare true if the result is less than CV1 And the result is greater than CV2.
|
kADC16_TriggerInsideCompareRangeMode2 |
Compare true if the result is greater than or equal to CV1 And the result is less than or equal to CV2.
|
kADC16_TriggerOutsideCompareRangeMode2 |
Compare true if the result is greater than or equal to CV1 Or the result is less than or equal to CV2.
|
Enumerator |
---|
kADC16_ReferenceVoltageSourceVref |
For external pins pair of VrefH and VrefL.
|
kADC16_ReferenceVoltageSourceValt |
For alternate reference pair of ValtH and ValtL.
|
kADC16_ReferenceVoltageSourceBandgap |
For bandgap voltage from V BGH and V BGL.
|
Enumerator |
---|
kADC16_HardwareAverageCount4 |
For hardware average with 4 samples.
|
kADC16_HardwareAverageCount8 |
For hardware average with 8 samples.
|
kADC16_HardwareAverageCount16 |
For hardware average with 16 samples.
|
kADC16_HardwareAverageCount32 |
For hardware average with 32 samples.
|
kADC16_HardwareAverageDisabled |
Disable the hardware average feature.
|
Enumerator |
---|
kADC16_SoftWareTrigger |
Software trigger Conversion.
|
kADC16_HardWareTrigger |
Hardware trigger Conversion.
|
- Parameters
-
base | ADC16 peripheral base address. |
psConfig | Pointer to configuration structure. |
This function initializes the converter configuration structure with available settings. The default values are as follows.
*
* psConfig->bEnableAsynchronousClock = true;
* psConfig->eResolution = KADC16_Resolution12bit;
* psConfig->eLongSampleMode = kADC16_LongSampleDisabled;
* psConfig->bEnableHighSpeed = false;
* psConfig->bEnableLowPower = false;
* psConfig->u32GroupId = 0U;
* psConfig->bEnableInterruptOnConversionCompleted = false;
* psConfig->bEnableDMA = false;
* psConfig->bEnableContinuousConversion = false;
* psConfig->psHardwareCompare = NULL;
*
- Parameters
-
void ADC16_Deinit |
( |
SADC_Type * |
base | ) |
|
- Parameters
-
base | ADC16 peripheral base address |
status_t ADC16_DoAutoCalibration |
( |
SADC_Type * |
base | ) |
|
This auto calibration helps to adjust the plus/minus side gain automatically. Execute the calibration before using the converter. Note that the hardware trigger should be used during the calibration.
- Parameters
-
base | ADC16 peripheral base address. |
- Returns
- Execution status.
- Return values
-
kStatus_Success | Calibration is done successfully. |
kStatus_Fail | Calibration has failed. |
static void ADC16_SetOffsetValue |
( |
SADC_Type * |
base, |
|
|
int16_t |
i16Value |
|
) |
| |
|
inlinestatic |
This offset value takes effect on the conversion result. If the offset value is not zero, the reading result is subtracted by it. Note, the hardware calibration fills the offset value automatically.
- Parameters
-
base | ADC16 peripheral base address. |
i16Value | Setting offset value. |
static void ADC16_EnableAssisTrrigger |
( |
SADC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
This ASSITRGEN register is used to help correctly generate the conversion type. When ASSITRGEN is set, the write to the ADCSC1 COCO bit will be reflected in the ADTRG register, and the operation of ADCSC1 will be delayed by 1/2 cycle.When ASSITRGEN is set, the user must ensure that no hardware trigger occurs when writing ADCSC1 COCO,so that the correct conversion type can be generated when the value of the ADTRG register changes.
- Parameters
-
base | ADC16 peripheral base address. |
enable | Switcher of the assist trigger feature. "true" means enabled, "false" means not enabled. |
static void ADC16_EnableDMA |
( |
SADC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | ADC16 peripheral base address. |
enable | Switcher of the DMA feature. "true" means enabled, "false" means not enabled. |
static void ADC16_EnableInterrupt |
( |
SADC_Type * |
base, |
|
|
uint32_t |
u32GroupId |
|
) |
| |
|
inlinestatic |
The u32GroupId is for Group registers. For example,u32GroupId 0 is for Group A registers.
- Parameters
-
base | ADC16 peripheral base address. |
u32GroupId | group identification. |
static void ADC16_DisableInterrupt |
( |
SADC_Type * |
base, |
|
|
uint32_t |
u32GroupId |
|
) |
| |
|
inlinestatic |
The u32GroupId is for Group registers. For example,u32GroupId 0 is for Group A registers.
- Parameters
-
base | ADC16 peripheral base address. |
u32GroupId | group identification. |
- Parameters
-
base | ADC16 peripheral base address. |
eTriggerSource | Setting the trigger conversion mode. See adc16_trigger_source_t. |
void Adc16_DoSoftwareTrigger |
( |
SADC_Type * |
base, |
|
|
uint32_t |
u32GroupId |
|
) |
| |
The u32GroupId is for Group registers. For example,u32GroupId 0 is for Group A registers.
- Parameters
-
base | ADC16 peripheral base address. |
u32GroupId | group identification. |
void Adc16_AbortSoftwareTrigger |
( |
SADC_Type * |
base, |
|
|
uint32_t |
u32GroupId |
|
) |
| |
The u32GroupId is for Group registers. For example,u32GroupId 0 is for Group A registers.
- Parameters
-
base | ADC16 peripheral base address. |
u32GroupId | group identification. |
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 "adc16_hardware_compare_mode_t" or the appopriate reference manual for more information.
- Parameters
-
base | ADC16 peripheral base address. |
psConfig | Pointer to the "adc16_hardware_compare_config_t" structure. Passing "NULL" disables the feature. |
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
-
void ADC16_ClearCalibrationCompletedFlag |
( |
SADC_Type * |
base | ) |
|
- Parameters
-
base | ADC16 peripheral base address. |
void ADC16_AssginChannelToGroup |
( |
SADC_Type * |
base, |
|
|
uint32_t |
u32GroupId, |
|
|
adc16_input_channel_t |
eChannel |
|
) |
| |
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 " u32GroupId " has a detailed description. one for each conversion. The u32GroupId parameter indicates which group of registers are used, for example, u32GroupId 0 is for Group A registers. At any point, only one of ,the u32GroupId is actively controlling ADC conversions.The u32GroupId 0 is used for both software and hardware trigger modes. See the chip configuration information in the appropriate MCU reference manual for the number of SC1n registers (u32GroupId) specific to this device. Therefore, writing to these u32GroupId does not initiate a new conversion. Writing any of the u32GroupId registers while that specific u32GroupId is actively controlling a conversion aborts the current conversion.
- Parameters
-
base | ADC16 peripheral base address. |
u32GroupId | group identification. u32GroupId is for Group registers. |
eChannel | Setting the conversion channel . See adc16_input_channel_t. |
static uint32_t ADC16_GetGroupConversionValue |
( |
SADC_Type * |
base, |
|
|
uint32_t |
u32GroupId |
|
) |
| |
|
inlinestatic |
The u32GroupId is for Group registers. For example,u32GroupId 0 is for Group A registers.
- Parameters
-
base | ADC16 peripheral base address. |
u32GroupId | group identification. |
- Returns
- Conversion value.
bool ADC16_IsGroupConversionCompleted |
( |
SADC_Type * |
base, |
|
|
uint32_t |
u32GroupId |
|
) |
| |
The u32GroupId is for Group registers. For example,u32GroupId 0 is for Group A registers.
- Parameters
-
base | ADC16 peripheral base address. |
u32GroupId | group identification. |