aboutsummaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2014-07-22 16:24:43 +0200
committerLars-Dominik Braun <lars@6xq.net>2014-07-22 16:55:41 +0200
commit5055ee55d1330b52182a35378f5b4f8055cefc54 (patch)
treec05e12595509b2a744cba542dcb5eda879345f20 /common.h
parentbedbcdc4de680720deff4b6e113a3ec1a0690482 (diff)
downloadhourglass-5055ee55d1330b52182a35378f5b4f8055cefc54.tar.gz
hourglass-5055ee55d1330b52182a35378f5b4f8055cefc54.tar.bz2
hourglass-5055ee55d1330b52182a35378f5b4f8055cefc54.zip
Convert printf into puts
Removes ~1.5k code size, still not working.
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 */