X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=projects%2Fstep-up%2Fadc.c;h=daf7bfe4bdb305c9cb05ce65d036a346ccb03b1a;hb=3079ccda1c6d82058c801bf8192c616230a2ef93;hp=9daf99158ad26aa9391d24f3731409624c2cc9f4;hpb=4b42bb17f2df1ab0fb731c309ec586ab2f143fc3;p=tinyboard.git diff --git a/projects/step-up/adc.c b/projects/step-up/adc.c index 9daf991..daf7bfe 100644 --- a/projects/step-up/adc.c +++ b/projects/step-up/adc.c @@ -1,5 +1,6 @@ #include #include +#include #include #include "lights.h" @@ -132,6 +133,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 @@ -202,8 +206,7 @@ ISR(ADC_vect) { // IRQ handler switch (current_adc) { case 0: // pwmled_adc(current_adc, adc_sum); - log_word(0x9000+adc_sum); - return; + pwmled_adc(1, adc_sum); break; }