fix 'MUX5 not declared' compile error for chips that don't have A8-15

This commit is contained in:
Michael Moon 2011-06-22 11:23:19 +10:00
parent 9bd8a048ea
commit a262d72788
1 changed files with 9 additions and 5 deletions

View File

@ -49,7 +49,9 @@ void analog_init() {
// ADC frequency must be less than 200khz or we lose precision. At 16MHz system clock, we must use the full prescale value of 128 to get an ADC clock of 125khz.
ADCSRA = MASK(ADEN) | MASK(ADPS2) | MASK(ADPS1) | MASK(ADPS0);
#ifdef ADCSRB
ADCSRB = 0;
#endif
adc_counter = 0;
@ -81,10 +83,12 @@ ISR(ADC_vect, ISR_NOBLOCK) {
// start next conversion
ADMUX = (adc_counter & 0x07) | REFERENCE;
#ifdef MUX5
if (adc_counter & 0x08)
ADCSRB |= MASK(MUX5);
else
ADCSRB &= ~MASK(MUX5);
#endif
ADCSRA |= MASK(ADSC);
}