From: Jan "Yenya" Kasprzak Date: Thu, 30 Aug 2012 09:07:33 +0000 (+0200) Subject: watchdog timer in main loop X-Git-Tag: gedasymbols-20120913~22 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=82fc1468b79eef0ec94d74df7c6f6427571a353a;p=bike-lights.git watchdog timer in main loop --- diff --git a/main.c b/main.c index 416a651..efebdab 100644 --- a/main.c +++ b/main.c @@ -2,6 +2,7 @@ #include #include #include +#include #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