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