$(COMMON_DIR)/action_layer.c \
$(COMMON_DIR)/action_util.c \
$(COMMON_DIR)/keymap.c \
- $(COMMON_DIR)/timer.c \
$(COMMON_DIR)/print.c \
- $(COMMON_DIR)/bootloader.c \
- $(COMMON_DIR)/suspend.c \
- $(COMMON_DIR)/xprintf.S \
- $(COMMON_DIR)/util.c
+ $(COMMON_DIR)/debug.c \
+ $(COMMON_DIR)/util.c \
+ $(COMMON_DIR)/avr/suspend.c \
+ $(COMMON_DIR)/avr/xprintf.S \
+ $(COMMON_DIR)/avr/timer.c \
+ $(COMMON_DIR)/avr/bootloader.c
# Option modules
#define DEBUG_H 1
#include "print.h"
- #include "debug_config.h"
- uint8_t raw;
+ /*
+ * Debug output control
+ */
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+ typedef union {
+ struct {
+ bool enable:1;
+ bool matrix:1;
+ bool keyboard:1;
+ bool mouse:1;
+ uint8_t reserved:4;
+ };
++ uint8_t raw;
+ } debug_config_t;
+
+ extern debug_config_t debug_config;
+ debug_config_t debug_config __attribute__ ((weak)) = {};
+
+ #ifdef __cplusplus
+ }
+ #endif
+
+ #define debug_enable (debug_config.enable)
+ #define debug_matrix (debug_config.matrix)
+ #define debug_keyboard (debug_config.keyboard)
+ #define debug_mouse (debug_config.mouse)
+
+
+
+ /*
+ * Debug print utils
+ */
#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 { \
+ #define dprint(s) do { if (debug_enable) print(s); } while (0)
+ #define dprintln(s) do { if (debug_enable) println(s); } while (0)
+ #define dprintf(fmt, ...) do { if (debug_enable) xprintf(fmt, ##__VA_ARGS__); } while (0)
+ #define dmsg(s) dprintf("%s at %s: %S\n", __FILE__, __LINE__, PSTR(s))
+
+ /* Deprecated. DO NOT USE these anymore, use dprintf instead. */
+ #define debug(s) do { if (debug_enable) print(s); } while (0)
+ #define debugln(s) do { if (debug_enable) println(s); } while (0)
+ #define debug_msg(s) do { \
if (debug_enable) { \
print(__FILE__); print(" at "); print_dec(__LINE__); print(" in "); print(": "); print(s); \
} \