]> www.fi.muni.cz Git - bike-lights.git/commitdiff
watchdog timer in main loop
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Thu, 30 Aug 2012 09:07:33 +0000 (11:07 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 31 Aug 2012 21:08:11 +0000 (23:08 +0200)
main.c

diff --git a/main.c b/main.c
index 416a6519dd3313729f203092130bf851ca886472..efebdabafb5d2aa30571b65e49ca1683b006a2c6 100644 (file)
--- a/main.c
+++ b/main.c
@@ -2,6 +2,7 @@
 #include <util/delay.h>
 #include <avr/sleep.h>
 #include <avr/interrupt.h>
+#include <avr/wdt.h>
 
 #include "lights.h"
 
@@ -23,8 +24,9 @@ void hw_setup()
 int main(void)
 {
        log_init();
+       wdt_enable(WDTO_1S);
 
-       _delay_ms(1500);
+       _delay_ms(100);
 
        hw_setup();
 
@@ -32,8 +34,10 @@ int main(void)
 
        sei();
 #if 1
-       while (1)
+       while (1) {
+               wdt_reset();
                sleep_mode();
+       }
 #endif
 
 #if 0