Added watchdog
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Mon, 14 Mar 2016 03:40:07 +0000 (20:40 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Mon, 14 Mar 2016 03:40:07 +0000 (20:40 -0700)
src/main.c

index 8ef03ee1e48da274a3fe487dd1043d49c6c9a36c..05abdb636cbe66a42b7d1962eabe9b89de140024 100644 (file)
@@ -40,6 +40,7 @@
 
 #include <avr/interrupt.h>
 #include <avr/pgmspace.h>
+#include <avr/wdt.h>
 
 #include <stdio.h>
 
@@ -80,10 +81,15 @@ static void init() {
 
 
 int main() {
+  wdt_enable(WDTO_250MS);
+
   init();
 
   // main loop
-  while (1) controller_run(); // single pass through the controller
+  while (1) {
+    controller_run(); // single pass through the controller
+    wdt_reset();
+  }
 
   return 0;
 }