]> www.fi.muni.cz Git - tinyboard.git/commitdiff
Merge branch 'master' of ssh://anxur.fi.muni.cz/~kas/html/git/tinyboard
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 May 2013 13:25:26 +0000 (15:25 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 May 2013 13:25:26 +0000 (15:25 +0200)
projects/step-up/adc.c
projects/step-up/main.c
projects/step-up/pwm.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
index 55e2ef75737cd58e437d7750954ccc7078b393d1..20f339e3b79d7305f95cc20cce9af80eef084a27 100644 (file)
@@ -9,6 +9,8 @@
 
 static void hw_setup()
 {
+       power_all_disable();
+
        wdt_enable(WDTO_1S);
 
        //init_battery();
@@ -67,9 +69,6 @@ int main(void)
 {
        init_log();
 
-       power_usi_disable(); // Once for lifetime
-       ACSR |= _BV(ACD);    // disable analog comparator
-
        log_set_state(3);
 
        hw_setup();
index f16aaa3175440cd44b84abafb3b477baa5d74e31..18a14253552a7c7628f1dc9dde24e1512af83437 100644 (file)
@@ -1,5 +1,6 @@
 #include <avr/io.h>
 #include <avr/interrupt.h>
+#include <avr/power.h>
 #include <util/delay.h>
 #include <util/atomic.h>
 
@@ -24,6 +25,8 @@ static void inline enable_pll()
 
 void init_pwm()
 {
+       power_timer1_enable();
+
        enable_pll();
 
        TCCR1 = _BV(CTC1) | _BV(CS10);  // no clock prescaling