PROGRAM=lights
SRC=main.c logging.c pwm.c adc.c pwmled.c pattern.c buttons.c control.c \
- battery.c
+ battery.c wdt.c
OBJ=$(SRC:.c=.o)
#define ERR_PWMLED 2
void set_error(unsigned char err);
+/* wdt.c */
+void init_wdt();
+void susp_wdt();
+
/* main.c */
void power_down();
{
power_all_disable();
- wdt_enable(WDTO_1S);
-
init_battery();
init_pwm();
init_adc();
+ init_wdt();
init_buttons();
{
susp_pwm();
susp_adc();
+ susp_wdt();
+
susp_buttons();
- wdt_disable();
power_all_disable();
}
--- /dev/null
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <avr/wdt.h>
+
+#include "lights.h"
+
+void init_wdt()
+{
+ wdt_enable(WDTO_1S);
+}
+
+void susp_wdt()
+{
+ wdt_disable();
+}
+