From: Jan "Yenya" Kasprzak Date: Fri, 10 May 2013 11:44:11 +0000 (+0200) Subject: Watchdog handling moved to its own source file X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=56ad7e84d0f55301169aa2c9e8f80f0c871f63da;p=tinyboard.git Watchdog handling moved to its own source file --- diff --git a/projects/step-up/Makefile b/projects/step-up/Makefile index 0e9b728..07bb151 100644 --- a/projects/step-up/Makefile +++ b/projects/step-up/Makefile @@ -1,7 +1,7 @@ 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) diff --git a/projects/step-up/lights.h b/projects/step-up/lights.h index 7a268ef..6318c56 100644 --- a/projects/step-up/lights.h +++ b/projects/step-up/lights.h @@ -75,6 +75,10 @@ pattern_t *status_led_pattern_select(); #define ERR_PWMLED 2 void set_error(unsigned char err); +/* wdt.c */ +void init_wdt(); +void susp_wdt(); + /* main.c */ void power_down(); diff --git a/projects/step-up/main.c b/projects/step-up/main.c index 69657a8..1ac5403 100644 --- a/projects/step-up/main.c +++ b/projects/step-up/main.c @@ -11,11 +11,10 @@ static void hw_setup() { power_all_disable(); - wdt_enable(WDTO_1S); - init_battery(); init_pwm(); init_adc(); + init_wdt(); init_buttons(); @@ -30,9 +29,10 @@ static void hw_suspend() { susp_pwm(); susp_adc(); + susp_wdt(); + susp_buttons(); - wdt_disable(); power_all_disable(); } diff --git a/projects/step-up/wdt.c b/projects/step-up/wdt.c new file mode 100644 index 0000000..050c0c5 --- /dev/null +++ b/projects/step-up/wdt.c @@ -0,0 +1,16 @@ +#include +#include +#include + +#include "lights.h" + +void init_wdt() +{ + wdt_enable(WDTO_1S); +} + +void susp_wdt() +{ + wdt_disable(); +} +