]>
Commit | Line | Data |
---|---|---|
0c5890bb L |
1 | |
2 | #ifndef DEBUG_H_ | |
3 | #define DEBUG_H_ | |
4 | ||
d684c216 | 5 | #include "common.h" |
e7895944 L |
6 | #include <avr/pgmspace.h> |
7 | ||
d684c216 L |
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 | |
0c5890bb | 25 | #ifdef DEBUG |
e7895944 | 26 | #define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \ |
9b6b4b31 | 27 | fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ ) |
0c5890bb L |
28 | #else |
29 | #define DBG_P(lvl, ...) | |
30 | #endif | |
d684c216 | 31 | #endif /* 0 */ |
0c5890bb L |
32 | |
33 | #endif /* DEBUG_H_ */ | |
d684c216 | 34 |