]> git.gir.st - tmk_keyboard.git/blob - common/debug.h
Merge branch 'keymap2'
[tmk_keyboard.git] / common / debug.h
1 /*
2 Copyright 2011 Jun Wako <wakojun@gmail.com>
3
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.
8
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.
13
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/>.
16 */
17
18 #ifndef DEBUG_H
19 #define DEBUG_H 1
20
21 #include <stdbool.h>
22 #include "print.h"
23
24
25 #define debug(s) do { if (debug_enable) print(s); } while (0)
26 #define debugln(s) do { if (debug_enable) println(s); } while (0)
27 #define debug_S(s) do { if (debug_enable) print_S(s); } while (0)
28 #define debug_P(s) do { if (debug_enable) print_P(s); } while (0)
29 #define debug_msg(s) do { \
30 if (debug_enable) { \
31 print(__FILE__); print(" at "); print_dec(__LINE__); print(" in "); print(": "); print(s); \
32 } \
33 } while (0)
34
35
36
37 #define debug_dec(data) do { if (debug_enable) print_dec(data); } while (0)
38 #define debug_decs(data) do { if (debug_enable) print_decs(data); } while (0)
39 #define debug_hex4(data) do { if (debug_enable) print_hex4(data); } while (0)
40 #define debug_hex8(data) do { if (debug_enable) print_hex8(data); } while (0)
41 #define debug_hex16(data) do { if (debug_enable) print_hex16(data); } while (0)
42 #define debug_hex32(data) do { if (debug_enable) print_hex32(data); } while (0)
43 #define debug_bin8(data) do { if (debug_enable) print_bin8(data); } while (0)
44 #define debug_bin16(data) do { if (debug_enable) print_bin16(data); } while (0)
45 #define debug_bin32(data) do { if (debug_enable) print_bin32(data); } while (0)
46 #define debug_bin_reverse8(data) do { if (debug_enable) print_bin_reverse8(data); } while (0)
47 #define debug_bin_reverse16(data) do { if (debug_enable) print_bin_reverse16(data); } while (0)
48 #define debug_bin_reverse32(data) do { if (debug_enable) print_bin_reverse32(data); } while (0)
49
50 #define debug_hex(data) debug_hex8(data)
51 #define debug_bin(data) debug_bin8(data)
52 #define debug_bin_reverse(data) debug_bin8(data)
53
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 extern bool debug_enable;
60 extern bool debug_matrix;
61 extern bool debug_keyboard;
62 extern bool debug_mouse;
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68 #endif
Imprint / Impressum