]> www.fi.muni.cz Git - tinyboard.git/blobdiff - projects/step-up/main.c
WDT-based timing instead of ADC-based
[tinyboard.git] / projects / step-up / main.c
index 383aa5eed990ead218315efe687846100b1f3df0..e5141024d74f214e08e75162cc7f25f824289ed5 100644 (file)
@@ -11,11 +11,10 @@ static void hw_setup()
 {
        power_all_disable();
 
-       wdt_enable(WDTO_1S);
-
        init_battery();
        init_pwm();
        init_adc();
+       init_wdt();
 
        init_buttons();
 
@@ -26,16 +25,15 @@ static void hw_setup()
        set_sleep_mode(SLEEP_MODE_IDLE);
 }
 
-#if 0
 static void hw_suspend()
 {
        susp_pwm();
        susp_adc();
-       susp_tmr();
-       susp_gpio();
+       susp_wdt();
+
        susp_buttons();
 
-       wdt_disable();
+       power_all_disable();
 }
 
 void power_down()
@@ -60,7 +58,6 @@ void power_down()
        // ok, so I will wake up
        hw_setup();
 }
-#endif
 
 int main(void)
 {
@@ -69,12 +66,11 @@ int main(void)
        log_set_state(3);
 
        hw_setup();
-       // power_down(); - not while still debugging
+       power_down();
 
        sei();
 #if 1
        while (1) {
-               wdt_reset();
                sleep_mode();
        }
 #endif