Hmm, that looks promising. I'm not quite sure what's going on in this section of code. It looks like the switch is based on g_APinDescription[ulPin].ulAnalogChannel, but then it's doing the mux update based only on ulChannel. Is that defined outside of the excerpt, or is this a typo in the library?
Either way, I tried a few things to see if it would work, but they're giving me type issues. I did this:
unsigned int analogvalue4, analogvalue5;
uint8_t analog[16000];
// analogRead(4);
delay(1);
for(int i=0; i<16000; i=i+4) {
adc_enable_channel(ADC, ADC0);
analogvalue4 = analogRead(0);
analogvalue5 = analogRead(1);
analog[i] = (analogvalue4 >> 8) & 0xFF;
analog[i+1] = analogvalue4 & 0xFF;
analog[i+2] = (analogvalue5 >> 8) & 0xFF;
analog[i+3] = analogvalue5 & 0xFF;
delayMicroseconds(ADCdelay);
}
SerialUSB.write(analog, 16000);
but it gives the error
StimEvaluationCommands.ino: In function 'void evaluatecommand(String)':
StimEvaluationCommands:29: error: cannot convert '_EAnalogChannel' to 'adc_channel_num_t' for argument '2' to 'void adc_enable_channel(Adc*, adc_channel_num_t)'
so apparently the type of the second argument is something called "adc_channel_num_t" but I am not sure what that is. It looks like maybe a numref, but I don't see what the correct way to do this is.