Hi, experts:
I want to use 5 adc channels, here's my way: "Conversion Mode" is set as single, I get adc result once at a time, then change to another channel in code dynamically by this function below:
static void adc_change_ch(uint32_t ch)
{
DL_ADC12_configConversionMem(ADC12_0_INST, ADC12_0_ADCMEM_0,
ch, DL_ADC12_REFERENCE_VOLTAGE_VDDA, DL_ADC12_SAMPLE_TIMER_SOURCE_SCOMP0, DL_ADC12_AVERAGING_MODE_ENABLED,
DL_ADC12_BURN_OUT_SOURCE_DISABLED, DL_ADC12_TRIGGER_MODE_AUTO_NEXT, DL_ADC12_WINDOWS_COMP_MODE_DISABLED);
DL_ADC12_enableConversions(ADC12_0_INST);
DL_ADC12_startConversion(ADC12_0_INST);
}
static uint32_t g_adc_channel[ADC_MAX] = {
DL_ADC12_INPUT_CHAN_0,
DL_ADC12_INPUT_CHAN_1,
DL_ADC12_INPUT_CHAN_2,
DL_ADC12_INPUT_CHAN_3,
};
adc_change_ch(g_adc_channel[g_type]);
Does it work?
And what is the pin mapped to the channel in this way? Thanks.
Bill