X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;ds=sidebyside;f=common%2Fdebug.h;h=8aaa5ed915e2b62a9ada6ff3b9e6b628cc21122c;hb=9d7278682e674816d467aaf9020c478e333b1168;hp=9cc8d882f376d8b954ce041ff715d65b09db2093;hpb=c5060ea81942b0e3f8577536ff78402a19abe3d3;p=max%2Ftmk_keyboard.git
diff --git a/common/debug.h b/common/debug.h
index 9cc8d882..8aaa5ed9 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -18,28 +18,45 @@ along with this program. If not, see .
#ifndef DEBUG_H
#define DEBUG_H 1
-#include
#include "print.h"
-
-
-#define debug(s) if(debug_enable) print_P(PSTR(s))
-#define debug_hex(c) if(debug_enable) phex(c)
-#define debug_hex16(i) if(debug_enable) phex16(i)
-#define debug_bin(c) if(debug_enable) pbin(c)
-#define debug_bin_reverse(c) if(debug_enable) pbin_reverse(c)
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern bool debug_enable;
-extern bool debug_matrix;
-extern bool debug_keyboard;
-extern bool debug_mouse;
-
-#ifdef __cplusplus
-}
+#include "debug_config.h"
+
+
+#ifndef NO_DEBUG
+
+#define dprint(s) do { if (debug_enable) print(s); } while (0)
+#define dprintln() do { if (debug_enable) print_crlf(); } while (0)
+#define dprintf(fmt, ...) do { if (debug_enable) __xprintf(PSTR(fmt), ##__VA_ARGS__); } while (0)
+#define dmsg(s) dprintf("%s at %s: %S\n", __FILE__, __LINE__, PSTR(s))
+
+/* DO NOT USE these anymore */
+#define debug(s) do { if (debug_enable) print(s); } while (0)
+#define debugln(s) do { if (debug_enable) print_crlf(); } while (0)
+#define debug_S(s) do { if (debug_enable) print_S(s); } while (0)
+#define debug_P(s) do { if (debug_enable) print_P(s); } while (0)
+#define debug_msg(s) do { \
+ if (debug_enable) { \
+ print(__FILE__); print(" at "); print_dec(__LINE__); print(" in "); print(": "); print(s); \
+ } \
+} while (0)
+#define debug_dec(data) do { if (debug_enable) print_dec(data); } while (0)
+#define debug_decs(data) do { if (debug_enable) print_decs(data); } while (0)
+#define debug_hex4(data) do { if (debug_enable) print_hex4(data); } while (0)
+#define debug_hex8(data) do { if (debug_enable) print_hex8(data); } while (0)
+#define debug_hex16(data) do { if (debug_enable) print_hex16(data); } while (0)
+#define debug_hex32(data) do { if (debug_enable) print_hex32(data); } while (0)
+#define debug_bin8(data) do { if (debug_enable) print_bin8(data); } while (0)
+#define debug_bin16(data) do { if (debug_enable) print_bin16(data); } while (0)
+#define debug_bin32(data) do { if (debug_enable) print_bin32(data); } while (0)
+#define debug_bin_reverse8(data) do { if (debug_enable) print_bin_reverse8(data); } while (0)
+#define debug_bin_reverse16(data) do { if (debug_enable) print_bin_reverse16(data); } while (0)
+#define debug_bin_reverse32(data) do { if (debug_enable) print_bin_reverse32(data); } while (0)
+#define debug_hex(data) debug_hex8(data)
+#define debug_bin(data) debug_bin8(data)
+#define debug_bin_reverse(data) debug_bin8(data)
+
+#else
+#include "nodebug.h"
#endif
#endif