aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2014-11-24 14:33:50 +0900
committertmk <nobody@nowhere>2014-11-24 14:33:50 +0900
commita9963960459662c0775d8d2f1f5bbc738b7f4ddd (patch)
tree68c4eb2cfaa34a2c4bad71094b020210ec92c45b /common
parent363950982a291c3bfa03ac6362061b1d37dc06b0 (diff)
downloadqmk_firmware-a9963960459662c0775d8d2f1f5bbc738b7f4ddd.tar.gz
qmk_firmware-a9963960459662c0775d8d2f1f5bbc738b7f4ddd.zip
Fix debug.h
Diffstat (limited to 'common')
-rw-r--r--common/debug.h15
-rw-r--r--common/debug_config.h51
2 files changed, 7 insertions, 59 deletions
diff --git a/common/debug.h b/common/debug.h
index 472dd478c..3cbe2092d 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -18,16 +18,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18#ifndef DEBUG_H 18#ifndef DEBUG_H
19#define DEBUG_H 1 19#define DEBUG_H 1
20 20
21#include <stdbool.h>
21#include "print.h" 22#include "print.h"
22 23
23 24
24/*
25 * Debug output control
26 */
27#ifdef __cplusplus 25#ifdef __cplusplus
28extern "C" { 26extern "C" {
29#endif 27#endif
30 28
29/*
30 * Debug output control
31 */
31typedef union { 32typedef union {
32 struct { 33 struct {
33 bool enable:1; 34 bool enable:1;
@@ -40,19 +41,18 @@ typedef union {
40} debug_config_t; 41} debug_config_t;
41 42
42extern debug_config_t debug_config; 43extern debug_config_t debug_config;
43debug_config_t debug_config __attribute__ ((weak)) = {};
44 44
45#ifdef __cplusplus 45#ifdef __cplusplus
46} 46}
47#endif 47#endif
48 48
49/* for backward compatibility */
49#define debug_enable (debug_config.enable) 50#define debug_enable (debug_config.enable)
50#define debug_matrix (debug_config.matrix) 51#define debug_matrix (debug_config.matrix)
51#define debug_keyboard (debug_config.keyboard) 52#define debug_keyboard (debug_config.keyboard)
52#define debug_mouse (debug_config.mouse) 53#define debug_mouse (debug_config.mouse)
53 54
54 55
55
56/* 56/*
57 * Debug print utils 57 * Debug print utils
58 */ 58 */
@@ -87,9 +87,8 @@ debug_config_t debug_config __attribute__ ((weak)) = {};
87#define debug_bin(data) debug_bin8(data) 87#define debug_bin(data) debug_bin8(data)
88#define debug_bin_reverse(data) debug_bin8(data) 88#define debug_bin_reverse(data) debug_bin8(data)
89 89
90#else 90#else /* NO_DEBUG */
91 91
92/* NO_DEBUG */
93#define dprint(s) 92#define dprint(s)
94#define dprintln(s) 93#define dprintln(s)
95#define dprintf(fmt, ...) 94#define dprintf(fmt, ...)
@@ -113,6 +112,6 @@ debug_config_t debug_config __attribute__ ((weak)) = {};
113#define debug_bin(data) 112#define debug_bin(data)
114#define debug_bin_reverse(data) 113#define debug_bin_reverse(data)
115 114
116#endif 115#endif /* NO_DEBUG */
117 116
118#endif 117#endif
diff --git a/common/debug_config.h b/common/debug_config.h
deleted file mode 100644
index 28bc34cd5..000000000
--- a/common/debug_config.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2Copyright 2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef DEBUG_CONFIG_H
19#define DEBUG_CONFIG_H 1
20
21#include <stdbool.h>
22
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/* NOTE: Not portable. Bit field order depends on implementation */
29typedef union {
30 struct {
31 bool enable:1;
32 bool matrix:1;
33 bool keyboard:1;
34 bool mouse:1;
35 uint8_t reserved:4;
36 };
37 uint8_t raw;
38} debug_config_t;
39extern debug_config_t debug_config;
40
41/* for backward compatibility */
42#define debug_enable (debug_config.enable)
43#define debug_matrix (debug_config.matrix)
44#define debug_keyboard (debug_config.keyboard)
45#define debug_mouse (debug_config.mouse)
46
47#ifdef __cplusplus
48}
49#endif
50
51#endif