X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=bike-lights.git;a=blobdiff_plain;f=firmware%2Fadc.c;h=ba30e5ca632c01e8064323d460ce3324fa7dc23a;hp=298256f51580efceadda2b7f843bc20aff0119ed;hb=68424ad19806bd6f0b857e878bf632cf5851e7c5;hpb=fbe444c2a7616054465def48e95cbf625f5df37a diff --git a/firmware/adc.c b/firmware/adc.c index 298256f..ba30e5c 100644 --- a/firmware/adc.c +++ b/firmware/adc.c @@ -16,8 +16,6 @@ static uint16_t adc1_gain20_offset_x16; static void inline setup_mux(unsigned char n) { - ADCSRA |= _BV(ADEN); // enable ADC - /* ADC numbering: PWM LEDs first, then ambient light sensor, battery sensor */ switch (n) { case 0: // pwmled 1: 1.1V, ADC0,1 (PA0,1), gain 20 @@ -100,8 +98,6 @@ void init_adc() } ADCSRA |= _BV(ADIE); // enable IRQ - - ADCSRA &= ~_BV(ADEN); // disable until needed } void susp_adc() @@ -116,8 +112,6 @@ ISR(ADC_vect) { // IRQ handler if (adc_vals) // start the next conversion immediately ADCSRA |= _BV(ADSC); - else - ADCSRA &= ~_BV(ADEN); // the last one, disable ADC if (adc_vals < (1 << sum_shift)) // drop the first conversion, use all others