aboutsummaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common.h')
-rw-r--r--common.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/common.h b/common.h
index 26b371d..5957da3 100644
--- a/common.h
+++ b/common.h
@@ -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 */