summaryrefslogtreecommitdiff
path: root/include/debug.h
diff options
context:
space:
mode:
authorLeo C2014-08-21 11:36:14 +0200
committerLeo C2014-08-21 11:36:14 +0200
commit21a24f90c5aaaaf13f91716208b32cde163c5918 (patch)
treeefc6f9ebab5f84d3af20493821444f220b957962 /include/debug.h
parentdea9a31523216caa153c589426b175d52aa43634 (diff)
downloadz180-stamp-21a24f90c5aaaaf13f91716208b32cde163c5918.zip
Create include directory
Diffstat (limited to 'include/debug.h')
-rw-r--r--include/debug.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/debug.h b/include/debug.h
new file mode 100644
index 0000000..7c19e40
--- /dev/null
+++ b/include/debug.h
@@ -0,0 +1,38 @@
+
+#ifndef DEBUG_H_
+#define DEBUG_H_
+
+#include "common.h"
+#include <avr/pgmspace.h>
+
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
+
+#define debug_cond(cond, fmt, args...) \
+ do { \
+ if (cond) \
+ printf_P(PSTR(fmt), ##args); \
+ } while (0)
+
+#define debug(fmt, args...) \
+ debug_cond(_DEBUG, fmt, ##args)
+
+
+#if 1
+#ifdef DEBUG
+#define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \
+ fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ )
+#else
+#define DBG_P(lvl, ...)
+#endif
+#endif /* 0 */
+
+
+void printfreelist(const char * title);
+
+
+#endif /* DEBUG_H_ */
+