diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2014-07-22 16:24:43 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2014-07-22 16:55:41 +0200 |
commit | 5055ee55d1330b52182a35378f5b4f8055cefc54 (patch) | |
tree | c05e12595509b2a744cba542dcb5eda879345f20 /common.h | |
parent | bedbcdc4de680720deff4b6e113a3ec1a0690482 (diff) | |
download | hourglass-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.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 */ |