]> www.fi.muni.cz Git - tinyboard.git/blobdiff - projects/step-up/adc.c
Merge branch 'master' of ssh://anxur.fi.muni.cz/~kas/html/git/tinyboard
[tinyboard.git] / projects / step-up / adc.c
index 2bd4bfff81804ad3ad00d87fb790ea7c1f9da269..fc4c7caac3a201b3526c2f5a4908aabc24c5f67b 100644 (file)
@@ -1,5 +1,6 @@
 #include <avr/io.h>
 #include <avr/interrupt.h>
+#include <avr/power.h>
 #include <avr/sleep.h>
 
 #include "lights.h"
@@ -105,6 +106,9 @@ void init_adc()
        current_slow_adc = NUM_ADCS;
        current_adc = 0;
 
+       power_adc_enable();
+       ACSR |= _BV(ACD);       // but disable the analog comparator
+
        ADCSRA = _BV(ADEN)                      // enable
                | _BV(ADPS1) | _BV(ADPS0)       // CLK/8 = 125 kHz
                // | _BV(ADPS2)                 // CLK/16 = 62.5 kHz