]> www.fi.muni.cz Git - tinyboard.git/blobdiff - projects/step-up/wdt.c
WDT-based timing instead of ADC-based
[tinyboard.git] / projects / step-up / wdt.c
index 050c0c550f5c762242a345fbb80e81db5915f2c3..9cfa08eb09f136b0841304501986e7bc89498258 100644 (file)
@@ -6,7 +6,8 @@
 
 void init_wdt()
 {
-       wdt_enable(WDTO_1S);
+       wdt_enable(WDTO_60MS);
+       WDTCR |= _BV(WDIE);
 }
 
 void susp_wdt()
@@ -14,3 +15,13 @@ void susp_wdt()
        wdt_disable();
 }
 
+ISR(WDT_vect) {
+       ++jiffies;
+
+       if (jiffies & 0x000F) {
+               need_battery_adc = 1; // about every 1s
+       }
+
+       patterns_next_tick();
+       timer_check_buttons();
+}