Instead of calling functions to convert once, what if you call one function and then it converts the voltages on all the pins for you in the background, and all you need to do is read from an array? I know it's slower but it runs in the background so your normal programming operates faster (the interrupt routine isn't long).
Just wanted to know what you think.
uint8_t currentADC; // pin currently being read
// just a flag to indicate that all channels have been read at least once
uint8_t ADCAllFlag;
uint8_t ADCRes[8]; // result array
void analogInit()
{
sei(); // enable interrupts
currentADC = 0;
ADCAllFlag = 0;
ADMUX = 0b01100000; // select reference, channel 0
DIDR0 = 0b11111111; // disable normal port function
DDRA = 0; // all inputs
PORTA = 0; // clear, no pullups
ADCSRA = 0b10001111; // set ADC clk prescaler, enable ADC and interrupt
sbi(ADCSRA, ADSC); // starts conversion
while(bit_is_clear(ADCAllFlag, 0)); // wait for first read to finish
}
ISR(SIG_ADC)
{
ADCRes[currentADC] = ADCH; // load into result array
currentADC++; // increment
if(currentADC > 7)
{
currentADC = 0; // reset counter
ADCAllFlag = 1; // set the flag
}
ADMUX = 0b01100000 + currentADC; // sets channel
sbi(ADCSRA, ADSC); // starts conversion
}