]> git.donarmstrong.com Git - qmk_firmware.git/blob - tmk_core/common/command.h
Defined IS_(HOST_)LED_ON/OFF() and improved LED documentation (#4853)
[qmk_firmware.git] / tmk_core / common / command.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 #pragma once
19
20 /* FIXME: Add doxygen comments for the behavioral defines in here. */
21
22 /* TODO: Refactoring */
23 typedef enum { ONESHOT, CONSOLE, MOUSEKEY } command_state_t;
24 extern command_state_t command_state;
25
26 /* This allows to extend commands. Return false when command is not processed. */
27 bool command_extra(uint8_t code);
28 bool command_console_extra(uint8_t code);
29
30 #ifdef COMMAND_ENABLE
31 uint8_t numkey2num(uint8_t code);
32 bool command_proc(uint8_t code);
33 #else
34 #define command_proc(code)      false
35 #endif
36
37
38 #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
39 #define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS  true
40 #endif
41
42 #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
43 #define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS  true
44 #endif
45
46 #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
47 #define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
48 #endif
49
50 #ifndef MAGIC_KEY_HELP1
51 #define MAGIC_KEY_HELP1          H
52 #endif
53
54 #ifndef MAGIC_KEY_HELP2
55 #define MAGIC_KEY_HELP2          SLASH
56 #endif
57
58 #ifndef MAGIC_KEY_DEBUG
59 #define MAGIC_KEY_DEBUG          D
60 #endif
61
62 #ifndef MAGIC_KEY_DEBUG_MATRIX
63 #define MAGIC_KEY_DEBUG_MATRIX   X
64 #endif
65
66 #ifndef MAGIC_KEY_DEBUG_KBD
67 #define MAGIC_KEY_DEBUG_KBD      K
68 #endif
69
70 #ifndef MAGIC_KEY_DEBUG_MOUSE
71 #define MAGIC_KEY_DEBUG_MOUSE    M
72 #endif
73
74 #ifndef MAGIC_KEY_VERSION
75 #define MAGIC_KEY_VERSION        V
76 #endif
77
78 #ifndef MAGIC_KEY_STATUS
79 #define MAGIC_KEY_STATUS         S
80 #endif
81
82 #ifndef MAGIC_KEY_CONSOLE
83 #define MAGIC_KEY_CONSOLE        C
84 #endif
85
86 #ifndef MAGIC_KEY_LAYER0_ALT1
87 #define MAGIC_KEY_LAYER0_ALT1    ESC
88 #endif
89
90 #ifndef MAGIC_KEY_LAYER0_ALT2
91 #define MAGIC_KEY_LAYER0_ALT2    GRAVE
92 #endif
93
94 #ifndef MAGIC_KEY_LAYER0
95 #define MAGIC_KEY_LAYER0         0
96 #endif
97
98 #ifndef MAGIC_KEY_LAYER1
99 #define MAGIC_KEY_LAYER1         1
100 #endif
101
102 #ifndef MAGIC_KEY_LAYER2
103 #define MAGIC_KEY_LAYER2         2
104 #endif
105
106 #ifndef MAGIC_KEY_LAYER3
107 #define MAGIC_KEY_LAYER3         3
108 #endif
109
110 #ifndef MAGIC_KEY_LAYER4
111 #define MAGIC_KEY_LAYER4         4
112 #endif
113
114 #ifndef MAGIC_KEY_LAYER5
115 #define MAGIC_KEY_LAYER5         5
116 #endif
117
118 #ifndef MAGIC_KEY_LAYER6
119 #define MAGIC_KEY_LAYER6         6
120 #endif
121
122 #ifndef MAGIC_KEY_LAYER7
123 #define MAGIC_KEY_LAYER7         7
124 #endif
125
126 #ifndef MAGIC_KEY_LAYER8
127 #define MAGIC_KEY_LAYER8         8
128 #endif
129
130 #ifndef MAGIC_KEY_LAYER9
131 #define MAGIC_KEY_LAYER9         9
132 #endif
133
134 #ifndef MAGIC_KEY_BOOTLOADER
135 #define MAGIC_KEY_BOOTLOADER     PAUSE
136 #endif
137
138 #ifndef MAGIC_KEY_LOCK
139 #define MAGIC_KEY_LOCK           CAPS
140 #endif
141
142 #ifndef MAGIC_KEY_EEPROM
143 #define MAGIC_KEY_EEPROM         E
144 #endif
145
146 #ifndef MAGIC_KEY_NKRO
147 #define MAGIC_KEY_NKRO           N
148 #endif
149
150 #ifndef MAGIC_KEY_SLEEP_LED
151 #define MAGIC_KEY_SLEEP_LED      Z
152
153 #endif
154
155 #define XMAGIC_KC(key) KC_##key
156 #define MAGIC_KC(key) XMAGIC_KC(key)