X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=firmware%2Fadc.c;h=ba30e5ca632c01e8064323d460ce3324fa7dc23a;hb=64a3d3a699cd60b7a6b4b06c5c38689975a3d460;hp=d0ee1c40f3377f17e40bd1f7662d662f72f8034f;hpb=5090774fd8ca593d3b247b099b3b6a40e837475e;p=bike-lights.git diff --git a/firmware/adc.c b/firmware/adc.c index d0ee1c4..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 @@ -158,5 +152,7 @@ void timer_start_adcs() { if (current_adc == NUM_ADCS) // Don't start if in progress start_next_adc(); + else + log_byte(0x99); }