#define AMBIENT_ADC N_PWMLEDS
#define BATTERY_ADC (N_PWMLEDS + 1)
#define ADC1_GAIN20 (N_PWMLEDS + 2)
-#define BUTTON_ADC (N_PWMLEDS + 2)
+#define BUTTON_ADC (N_PWMLEDS + 3)
#define NUM_ADCS 7
volatile static unsigned char current_adc;
ADMUX = _BV(REFS1) | _BV(MUX2);
sum_shift = PWMLED_ADC_SHIFT;
break;
- case 3: // ambient light: 1.1V, ADC5 (PA6), single-ended
+ case AMBIENT_ADC: // ambient light: 1.1V, ADC5 (PA6), single-ended
ADMUX = _BV(REFS1) | _BV(MUX2) | _BV(MUX0);
sum_shift = 3; // 3 measurements
break;
- case 4: // batt voltage: 1.1V, ADC6 (PA7), single-ended
+ case BATTERY_ADC: // batt voltage: 1.1V, ADC6 (PA7), single-ended
ADMUX = _BV(REFS1) | _BV(MUX2) | _BV(MUX1);
sum_shift = 0; // 1 measurement
break;
- case 5: // gain stage offset: 1.1V, ADC1,1, gain 20
+ case ADC1_GAIN20: // gain stage offset: 1.1V, ADC1,1, gain 20
ADMUX = _BV(REFS1) | _BV(MUX3) | _BV(MUX2) | _BV(MUX0);
sum_shift = 0; // 1 measurement
break;
- case 6: // buttons: 1.1V, ADC3, single-ended
+ case BUTTON_ADC: // buttons: 1.1V, ADC3, single-ended
PORTA |= _BV(PA3); // +5V to the voltage splitter
ADMUX = _BV(REFS1) | _BV(MUX1) | _BV(MUX0);
sum_shift = 0;