]> www.fi.muni.cz Git - bike-lights.git/blobdiff - firmware/main.c
Watchdog-based timing
[bike-lights.git] / firmware / main.c
index 8166771478bd207e8cced92f6bf9f11eaef4a754..0e3395779e9c7a2c84afd71d912ef4b64868bb9f 100644 (file)
@@ -3,24 +3,22 @@
 #include <avr/sleep.h>
 #include <avr/interrupt.h>
 #include <avr/power.h>
-#include <avr/wdt.h>
 
 #include "lights.h"
 
 static void hw_setup()
 {
-       wdt_enable(WDTO_1S);
-
        init_battery();
        init_pwm();
        init_adc();
        init_tmr();
        init_buttons();
 
-       pwmled_init();
-       gpio_init();
-       ambient_init();
-       pattern_init();
+       init_pwmled();
+       init_gpio();
+       init_ambient();
+       init_pattern();
+       init_control();
 
        set_sleep_mode(SLEEP_MODE_IDLE);
 }
@@ -31,9 +29,8 @@ static void hw_suspend()
        susp_adc();
        susp_tmr();
        susp_gpio();
+       susp_ambient();
        susp_buttons();
-
-       wdt_disable();
 }
 
 void power_down()
@@ -61,7 +58,7 @@ void power_down()
 
 int main(void)
 {
-       log_init();
+       init_log();
 
        power_usi_disable(); // Once for lifetime
        ACSRA |= _BV(ACD);   // disable analog comparator
@@ -74,7 +71,6 @@ int main(void)
        sei();
 #if 1
        while (1) {
-               wdt_reset();
                sleep_mode();
        }
 #endif