]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | #ifndef DEBUG_H_ | |
3 | #define DEBUG_H_ | |
4 | ||
5 | #include "common.h" | |
6 | #ifdef __AVR__ | |
7 | #include <avr/pgmspace.h> | |
8 | #endif | |
9 | ||
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 | |
27 | #ifdef DEBUG | |
28 | #define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \ | |
29 | fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ ) | |
30 | #else | |
31 | #define DBG_P(lvl, ...) | |
32 | #endif | |
33 | #endif /* 0 */ | |
34 | ||
35 | ||
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); | |
38 | void printfreelist(const char * title); | |
39 | ||
40 | ||
41 | #endif /* DEBUG_H_ */ | |
42 |