Tool/software:
Hi experts.
please let me know how to implement the function to read ADC 2-channel using CC2640R2L 5*5 IC.
when the program is written as follows, ADC_CO is normally open, but ADC_SMOKE is not open and returned as null.
could you give me some advise?
///////////////////////////////////////////////////////////////////////////////
ADC_Handle adc_co;
ADC_Params params_co;
ADC_Handle adc_smoke;
ADC_Params params_smoke;
bool ADC12_Init()
{
Board_initADC();
ADC_Params_init(¶ms_co);
params_co.isProtected = true;
adc_co = ADC_open(Board_ADC0, ¶ms_co);
if (adc_co != NULL) return false;
ADC_Params_init(¶ms_smoke);
params_smoke.isProtected = true;
adc_smoke = ADC_open(Board_ADC1, ¶ms_smoke);
if (adc_smoke != NULL) return false;
return true;
}
bool ADC12_CO_Data_Acquisition(uint16_t *punAdcValue)
{
uint16_t adcValue = 0;
if (ADC_convert(adc_co, &adcValue) != ADC_STATUS_SUCCESS) return false;
uint32_t resultUv = ADC_convertToMicroVolts(adc_co, adcValue);
*(punAdcValue) = adcValue;
return true;
}
bool ADC12_Smoke_Data_Acquisition(uint16_t *punAdcValue)
{
uint16_t adcValue = 0;
if (ADC_convert(adc_smoke, &adcValue) != ADC_STATUS_SUCCESS) return false;
uint32_t resultUv = ADC_convertToMicroVolts(adc_smoke, adcValue);
*(punAdcValue) = adcValue;
return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////
thanks
regards,