2 Copyright 2011 Jun Wako <wakojun@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
30 * Debug output control
43 extern debug_config_t debug_config;
49 /* for backward compatibility */
50 #define debug_enable (debug_config.enable)
51 #define debug_matrix (debug_config.matrix)
52 #define debug_keyboard (debug_config.keyboard)
53 #define debug_mouse (debug_config.mouse)
61 #define dprint(s) do { if (debug_enable) print(s); } while (0)
62 #define dprintln(s) do { if (debug_enable) println(s); } while (0)
63 #define dprintf(fmt, ...) do { if (debug_enable) xprintf(fmt, ##__VA_ARGS__); } while (0)
64 #define dmsg(s) dprintf("%s at %s: %S\n", __FILE__, __LINE__, PSTR(s))
66 /* Deprecated. DO NOT USE these anymore, use dprintf instead. */
67 #define debug(s) do { if (debug_enable) print(s); } while (0)
68 #define debugln(s) do { if (debug_enable) println(s); } while (0)
69 #define debug_msg(s) do { \
71 print(__FILE__); print(" at "); print_dec(__LINE__); print(" in "); print(": "); print(s); \
74 #define debug_dec(data) do { if (debug_enable) print_dec(data); } while (0)
75 #define debug_decs(data) do { if (debug_enable) print_decs(data); } while (0)
76 #define debug_hex4(data) do { if (debug_enable) print_hex4(data); } while (0)
77 #define debug_hex8(data) do { if (debug_enable) print_hex8(data); } while (0)
78 #define debug_hex16(data) do { if (debug_enable) print_hex16(data); } while (0)
79 #define debug_hex32(data) do { if (debug_enable) print_hex32(data); } while (0)
80 #define debug_bin8(data) do { if (debug_enable) print_bin8(data); } while (0)
81 #define debug_bin16(data) do { if (debug_enable) print_bin16(data); } while (0)
82 #define debug_bin32(data) do { if (debug_enable) print_bin32(data); } while (0)
83 #define debug_bin_reverse8(data) do { if (debug_enable) print_bin_reverse8(data); } while (0)
84 #define debug_bin_reverse16(data) do { if (debug_enable) print_bin_reverse16(data); } while (0)
85 #define debug_bin_reverse32(data) do { if (debug_enable) print_bin_reverse32(data); } while (0)
86 #define debug_hex(data) debug_hex8(data)
87 #define debug_bin(data) debug_bin8(data)
88 #define debug_bin_reverse(data) debug_bin8(data)
94 #define dprintf(fmt, ...)
99 #define debug_dec(data)
100 #define debug_decs(data)
101 #define debug_hex4(data)
102 #define debug_hex8(data)
103 #define debug_hex16(data)
104 #define debug_hex32(data)
105 #define debug_bin8(data)
106 #define debug_bin16(data)
107 #define debug_bin32(data)
108 #define debug_bin_reverse8(data)
109 #define debug_bin_reverse16(data)
110 #define debug_bin_reverse32(data)
111 #define debug_hex(data)
112 #define debug_bin(data)
113 #define debug_bin_reverse(data)
115 #endif /* NO_DEBUG */