diff --git a/firmware/app.c b/firmware/app.c index 5a9db04..9262690 100644 --- a/firmware/app.c +++ b/firmware/app.c @@ -1,6 +1,7 @@ #include "lib/system.h" #include "lib/hal.h" #include +#include #define TIMER_INMENU TIMER_APP0 #define TIMER_AUX TIMER_APP1 @@ -98,12 +99,34 @@ void system_test() display_update(); } +// Note: This is only for watchdog testing. +// Never use _delay_ms(...) in your programs. Use timer_* functions instead. +void wdt_test() +{ + int i = 50; + display_clear(0); + while (i--) { + led[0].b = !led[0].b; + display_update(); + _delay_ms(100); + } + led[0].b = 0; + led[0].r = 1; + display_update(); + _delay_ms(2000); +} + void app_init() { return; } -#define APP_COUNT 3 +void app_suspend() +{ + return; +} + +#define APP_COUNT 4 enum app_return app_mainloop() { static int app_sel = 0; @@ -136,6 +159,9 @@ enum app_return app_mainloop() case 2: system_test(); break; + case 3: + wdt_test(); + break; default: app_sel = 0; break; diff --git a/firmware/lib/system.c b/firmware/lib/system.c index bda2719..a2ff486 100644 --- a/firmware/lib/system.c +++ b/firmware/lib/system.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -7,6 +8,7 @@ #include "pm.h" extern void app_init(); +extern void app_suspend(); extern enum app_return app_mainloop(); struct cRGB led[STRIPLEN]; @@ -39,6 +41,7 @@ void boot_animation(enum BOOT_COLOR color_offset) _delay_ms(10); display_clear(); for(int i = 0; i