From: Jan "Yenya" Kasprzak Date: Thu, 29 Nov 2012 13:05:08 +0000 (+0100) Subject: adc.c: keep ADC enabled X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=68424ad19806bd6f0b857e878bf632cf5851e7c5;p=bike-lights.git adc.c: keep ADC enabled --- 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