diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2014-09-30 16:08:30 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2014-09-30 16:08:30 +0200 |
commit | 74a2f8409f3bfb462de36bca04ad44ac65473f7b (patch) | |
tree | a410c5d07b7d6456fbc4741ce7b0adb67e172ed4 | |
parent | 6708da2661d693f855b6f56d69af1e2fb8502463 (diff) | |
download | hourglass-74a2f8409f3bfb462de36bca04ad44ac65473f7b.tar.gz hourglass-74a2f8409f3bfb462de36bca04ad44ac65473f7b.tar.bz2 hourglass-74a2f8409f3bfb462de36bca04ad44ac65473f7b.zip |
LED error code for assert()
-rw-r--r-- | common.c | 15 | ||||
-rw-r--r-- | common.h | 7 |
2 files changed, 18 insertions, 4 deletions
@@ -1,4 +1,19 @@ #include "common.h" +#include "pwm.h" volatile uint8_t wakeup = 0; +/* shutdown device signaling internal error + */ +void shutdownError () { + pwmSet (0, PWM_ON); + for (uint8_t i = 1; i < PWM_LED_COUNT-1; i++) { + pwmSet (i, PWM_OFF); + } + pwmSet (PWM_LED_COUNT-1, PWM_ON); + sleep_enable (); + while (1) { + sleep_cpu (); + } +} + @@ -17,10 +17,7 @@ #include <avr/interrupt.h> #define assert(x) if (!(x)) { \ puts("assert in " __FILE__ ":" #x); \ - sleep_enable (); \ - while (1) { \ - sleep_cpu (); \ - } \ + shutdownError (); \ } #include <stdbool.h> @@ -45,5 +42,7 @@ enum { wakeup &= ~(1 << x); \ } +void shutdownError (); + #endif /* COMMON_H */ |