diff options
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -10,8 +10,18 @@ sleep_disable (); #define __unused__ __attribute__ ((unused)) -/* print assert messages */ -#define __ASSERT_USE_STDERR + +/* define lightweight assert (without printf) that halts the cpu */ +#include <stdio.h> +#include <avr/sleep.h> +#include <avr/interrupt.h> +#define assert(x) if (!(x)) { \ + puts("assert in " __FILE__ ":" #x); \ + sleep_enable (); \ + while (1) { \ + sleep_cpu (); \ + } \ + } #endif /* COMMON_H */ |