]>
Commit | Line | Data |
---|---|---|
0c5890bb L |
1 | |
2 | #ifndef DEBUG_H_ | |
3 | #define DEBUG_H_ | |
4 | ||
d684c216 | 5 | #include "common.h" |
61b0cfe9 | 6 | #ifdef __AVR__ |
e7895944 | 7 | #include <avr/pgmspace.h> |
61b0cfe9 | 8 | #endif |
e7895944 | 9 | |
d684c216 L |
10 | #ifdef DEBUG |
11 | #define _DEBUG 1 | |
12 | #else | |
13 | #define _DEBUG 0 | |
14 | #endif | |
15 | ||
16 | #define debug_cond(cond, fmt, args...) \ | |
17 | do { \ | |
18 | if (cond) \ | |
19 | printf_P(PSTR(fmt), ##args); \ | |
20 | } while (0) | |
21 | ||
22 | #define debug(fmt, args...) \ | |
23 | debug_cond(_DEBUG, fmt, ##args) | |
24 | ||
25 | ||
26 | #if 1 | |
0c5890bb | 27 | #ifdef DEBUG |
e7895944 | 28 | #define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \ |
9b6b4b31 | 29 | fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ ) |
0c5890bb L |
30 | #else |
31 | #define DBG_P(lvl, ...) | |
32 | #endif | |
d684c216 | 33 | #endif /* 0 */ |
0c5890bb | 34 | |
69988dc1 | 35 | |
61b0cfe9 L |
36 | void dump_eep(const uint8_t *addr, unsigned int len, char *title); |
37 | void dump_ram(const uint8_t *addr, unsigned int len, char *title); | |
69988dc1 L |
38 | void printfreelist(const char * title); |
39 | ||
40 | ||
0c5890bb | 41 | #endif /* DEBUG_H_ */ |
d684c216 | 42 |