]> cloudbase.mooo.com Git - z180-stamp.git/blob - include/debug.h
7c19e40fd186fb240e07ea91a70fe4d92ec50950
[z180-stamp.git] / include / debug.h
1
2 #ifndef DEBUG_H_
3 #define DEBUG_H_
4
5 #include "common.h"
6 #include <avr/pgmspace.h>
7
8 #ifdef DEBUG
9 #define _DEBUG 1
10 #else
11 #define _DEBUG 0
12 #endif
13
14 #define debug_cond(cond, fmt, args...) \
15 do { \
16 if (cond) \
17 printf_P(PSTR(fmt), ##args); \
18 } while (0)
19
20 #define debug(fmt, args...) \
21 debug_cond(_DEBUG, fmt, ##args)
22
23
24 #if 1
25 #ifdef DEBUG
26 #define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \
27 fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ )
28 #else
29 #define DBG_P(lvl, ...)
30 #endif
31 #endif /* 0 */
32
33
34 void printfreelist(const char * title);
35
36
37 #endif /* DEBUG_H_ */
38