Hi,
I tested the adc single channel example program with my analog sensors and it works. I re-use the code and try to make it work at Simple Peripheral.
void ADC_Read(void) { uint16_t i; ADC_Handle adc; ADC_Params params; int_fast16_t res; uint16_t pressureValues[ADC_SAMPLE_COUNT]; uint16_t pressureValue = 0; ADC_Params_init(¶ms); adc = ADC_open(Board_ADC0, ¶ms); if (adc == NULL) { while (1); } for (i = 0; i < ADC_SAMPLE_COUNT; i++) { res = ADC_convert(adc, &pressureValues[i]); if (res == ADC_STATUS_SUCCESS) { pressureValue += pressureValues[i]; } else { while(1); } } pressureValue >>= 3; ADC_close(adc); }
I call ADC_Read() at SimplePeripheral_init(). When I debug step the code, the return of ADC_open() is NULL and goes to while(1). Why does that happen? adc single channel example program and Simple Peripheral example program have same board files so should work.
-kel