50 #ifndef WATCHDOG_CONF_TIMEOUT
51 #define WATCHDOG_CONF_TIMEOUT WDTO_2S
59 #ifndef WATCHDOG_CONF_BALANCE
60 #define WATCHDOG_CONF_BALANCE 0
63 #include "dev/watchdog.h"
65 #include <avr/interrupt.h>
68 void *watchdog_return_addr
__attribute__ ((section (
".noinit")));
72 #if !defined (MCUSR) && defined (MCUCSR)
73 #warning *** MCUSR not defined, using MCUCSR instead ***
77 #if WATCHDOG_CONF_BALANCE && WATCHDOG_CONF_TIMEOUT >= 0
78 static int stopped = 0;
88 watchdog_return_addr = 0;
91 #if WATCHDOG_CONF_BALANCE && WATCHDOG_CONF_TIMEOUT >= 0
99 #if WATCHDOG_CONF_TIMEOUT >= 0
100 #if WATCHDOG_CONF_BALANCE
105 wdt_enable(WATCHDOG_CONF_TIMEOUT);
106 #if defined (__AVR_ATmega1284P__)
114 watchdog_periodic(
void)
116 #if WATCHDOG_CONF_TIMEOUT >= 0
117 #if WATCHDOG_CONF_BALANCE
127 #if WATCHDOG_CONF_TIMEOUT >= 0
128 #if WATCHDOG_CONF_BALANCE
132 #if defined (__AVR_ATmega1284P__)
133 WDTCSR &= ~_BV(WDIE);
139 watchdog_reboot(
void)
142 wdt_enable(WDTO_15MS);
147 #if defined (__AVR_ATmega1284P__)
152 watchdog_return_addr = (
void *)((
unsigned int)__builtin_return_address(0)<<1);