aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2012-10-09 14:36:13 +0900
committertmk <nobody@nowhere>2012-10-17 15:55:37 +0900
commit373ab0e7192811944786c095facb80938c33f1d5 (patch)
treeaf609b1318ebb8e08897460af7dc894c389cea02
parent16ba9bda5601ebef6e4db04a5ad079af32370815 (diff)
downloadqmk_firmware-373ab0e7192811944786c095facb80938c33f1d5.tar.gz
qmk_firmware-373ab0e7192811944786c095facb80938c33f1d5.zip
Add keycode.h and remove usb_keycodes.h.
-rw-r--r--common/command.c38
-rw-r--r--common/host.c2
-rw-r--r--common/keyboard.c44
-rw-r--r--common/keycode.h441
-rw-r--r--common/mousekey.c54
-rw-r--r--common/usb_keycodes.h436
-rw-r--r--keyboard/hhkb/config.h2
-rw-r--r--keyboard/hhkb/keymap.c51
8 files changed, 536 insertions, 532 deletions
diff --git a/common/command.c b/common/command.c
index 0020d8a17..f9cdaf57d 100644
--- a/common/command.c
+++ b/common/command.c
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include <stdint.h> 17#include <stdint.h>
18#include <stdbool.h> 18#include <stdbool.h>
19#include <util/delay.h> 19#include <util/delay.h>
20#include "usb_keycodes.h" 20#include "keycode.h"
21#include "host.h" 21#include "host.h"
22#include "print.h" 22#include "print.h"
23#include "debug.h" 23#include "debug.h"
@@ -74,10 +74,10 @@ uint8_t command_extra(void)
74static uint8_t command_common(void) 74static uint8_t command_common(void)
75{ 75{
76 switch (host_get_first_key()) { 76 switch (host_get_first_key()) {
77 case KB_H: 77 case KC_H:
78 help(); 78 help();
79 break; 79 break;
80 case KB_B: 80 case KC_B:
81 host_clear_keyboard_report(); 81 host_clear_keyboard_report();
82 host_send_keyboard_report(); 82 host_send_keyboard_report();
83 print("jump to bootloader... "); 83 print("jump to bootloader... ");
@@ -85,7 +85,7 @@ static uint8_t command_common(void)
85 bootloader_jump(); // not return 85 bootloader_jump(); // not return
86 print("not supported.\n"); 86 print("not supported.\n");
87 break; 87 break;
88 case KB_D: 88 case KC_D:
89 debug_enable = !debug_enable; 89 debug_enable = !debug_enable;
90 if (debug_enable) { 90 if (debug_enable) {
91 last_print_enable = true; 91 last_print_enable = true;
@@ -101,34 +101,34 @@ static uint8_t command_common(void)
101 debug_mouse = false; 101 debug_mouse = false;
102 } 102 }
103 break; 103 break;
104 case KB_X: // debug matrix toggle 104 case KC_X: // debug matrix toggle
105 debug_matrix = !debug_matrix; 105 debug_matrix = !debug_matrix;
106 if (debug_matrix) 106 if (debug_matrix)
107 print("debug matrix enabled.\n"); 107 print("debug matrix enabled.\n");
108 else 108 else
109 print("debug matrix disabled.\n"); 109 print("debug matrix disabled.\n");
110 break; 110 break;
111 case KB_K: // debug keyboard toggle 111 case KC_K: // debug keyboard toggle
112 debug_keyboard = !debug_keyboard; 112 debug_keyboard = !debug_keyboard;
113 if (debug_keyboard) 113 if (debug_keyboard)
114 print("debug keyboard enabled.\n"); 114 print("debug keyboard enabled.\n");
115 else 115 else
116 print("debug keyboard disabled.\n"); 116 print("debug keyboard disabled.\n");
117 break; 117 break;
118 case KB_M: // debug mouse toggle 118 case KC_M: // debug mouse toggle
119 debug_mouse = !debug_mouse; 119 debug_mouse = !debug_mouse;
120 if (debug_mouse) 120 if (debug_mouse)
121 print("debug mouse enabled.\n"); 121 print("debug mouse enabled.\n");
122 else 122 else
123 print("debug mouse disabled.\n"); 123 print("debug mouse disabled.\n");
124 break; 124 break;
125 case KB_V: // print version & information 125 case KC_V: // print version & information
126 print(STR(DESCRIPTION) "\n"); 126 print(STR(DESCRIPTION) "\n");
127 break; 127 break;
128 case KB_T: // print timer 128 case KC_T: // print timer
129 print("timer: "); phex16(timer_count); print("\n"); 129 print("timer: "); phex16(timer_count); print("\n");
130 break; 130 break;
131 case KB_P: // print toggle 131 case KC_P: // print toggle
132 if (last_print_enable) { 132 if (last_print_enable) {
133 print("print disabled.\n"); 133 print("print disabled.\n");
134 last_print_enable = false; 134 last_print_enable = false;
@@ -137,7 +137,7 @@ static uint8_t command_common(void)
137 print("print enabled.\n"); 137 print("print enabled.\n");
138 } 138 }
139 break; 139 break;
140 case KB_S: 140 case KC_S:
141 print("host_keyboard_leds:"); phex(host_keyboard_leds()); print("\n"); 141 print("host_keyboard_leds:"); phex(host_keyboard_leds()); print("\n");
142#ifdef HOST_PJRC 142#ifdef HOST_PJRC
143 print("UDCON: "); phex(UDCON); print("\n"); 143 print("UDCON: "); phex(UDCON); print("\n");
@@ -156,7 +156,7 @@ static uint8_t command_common(void)
156#endif 156#endif
157 break; 157 break;
158#ifdef NKRO_ENABLE 158#ifdef NKRO_ENABLE
159 case KB_N: 159 case KC_N:
160 // send empty report before change 160 // send empty report before change
161 host_clear_keyboard_report(); 161 host_clear_keyboard_report();
162 host_send_keyboard_report(); 162 host_send_keyboard_report();
@@ -168,7 +168,7 @@ static uint8_t command_common(void)
168 break; 168 break;
169#endif 169#endif
170#ifdef EXTRAKEY_ENABLE 170#ifdef EXTRAKEY_ENABLE
171 case KB_ESC: 171 case KC_ESC:
172 host_clear_keyboard_report(); 172 host_clear_keyboard_report();
173 host_send_keyboard_report(); 173 host_send_keyboard_report();
174#ifdef HOST_PJRC 174#ifdef HOST_PJRC
@@ -186,23 +186,23 @@ static uint8_t command_common(void)
186#endif 186#endif
187 break; 187 break;
188#endif 188#endif
189 case KB_BSPC: 189 case KC_BSPC:
190 matrix_init(); 190 matrix_init();
191 print("clear matrix\n"); 191 print("clear matrix\n");
192 break; 192 break;
193 case KB_0: 193 case KC_0:
194 switch_layer(0); 194 switch_layer(0);
195 break; 195 break;
196 case KB_1: 196 case KC_1:
197 switch_layer(1); 197 switch_layer(1);
198 break; 198 break;
199 case KB_2: 199 case KC_2:
200 switch_layer(2); 200 switch_layer(2);
201 break; 201 break;
202 case KB_3: 202 case KC_3:
203 switch_layer(3); 203 switch_layer(3);
204 break; 204 break;
205 case KB_4: 205 case KC_4:
206 switch_layer(4); 206 switch_layer(4);
207 break; 207 break;
208 default: 208 default:
diff --git a/common/host.c b/common/host.c
index 0a03807f7..37f707d0b 100644
--- a/common/host.c
+++ b/common/host.c
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18#include <stdint.h> 18#include <stdint.h>
19#include <avr/interrupt.h> 19#include <avr/interrupt.h>
20#include "usb_keycodes.h" 20#include "keycode.h"
21#include "host.h" 21#include "host.h"
22#include "util.h" 22#include "util.h"
23#include "debug.h" 23#include "debug.h"
diff --git a/common/keyboard.c b/common/keyboard.c
index 328941df3..6adad8882 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19#include "keymap.h" 19#include "keymap.h"
20#include "host.h" 20#include "host.h"
21#include "led.h" 21#include "led.h"
22#include "usb_keycodes.h" 22#include "keycode.h"
23#include "timer.h" 23#include "timer.h"
24#include "print.h" 24#include "print.h"
25#include "debug.h" 25#include "debug.h"
@@ -157,58 +157,58 @@ debug("register_code\n");
157debug("consumer\n"); 157debug("consumer\n");
158 uint16_t usage = 0; 158 uint16_t usage = 0;
159 switch (code) { 159 switch (code) {
160 case KB_AUDIO_MUTE: 160 case KC_AUDIO_MUTE:
161 usage = AUDIO_MUTE; 161 usage = AUDIO_MUTE;
162 break; 162 break;
163 case KB_AUDIO_VOL_UP: 163 case KC_AUDIO_VOL_UP:
164 usage = AUDIO_VOL_UP; 164 usage = AUDIO_VOL_UP;
165 break; 165 break;
166 case KB_AUDIO_VOL_DOWN: 166 case KC_AUDIO_VOL_DOWN:
167 usage = AUDIO_VOL_DOWN; 167 usage = AUDIO_VOL_DOWN;
168 break; 168 break;
169 case KB_MEDIA_NEXT_TRACK: 169 case KC_MEDIA_NEXT_TRACK:
170 usage = TRANSPORT_NEXT_TRACK; 170 usage = TRANSPORT_NEXT_TRACK;
171 break; 171 break;
172 case KB_MEDIA_PREV_TRACK: 172 case KC_MEDIA_PREV_TRACK:
173 usage = TRANSPORT_PREV_TRACK; 173 usage = TRANSPORT_PREV_TRACK;
174 break; 174 break;
175 case KB_MEDIA_STOP: 175 case KC_MEDIA_STOP:
176 usage = TRANSPORT_STOP; 176 usage = TRANSPORT_STOP;
177 break; 177 break;
178 case KB_MEDIA_PLAY_PAUSE: 178 case KC_MEDIA_PLAY_PAUSE:
179 usage = TRANSPORT_PLAY_PAUSE; 179 usage = TRANSPORT_PLAY_PAUSE;
180 break; 180 break;
181 case KB_MEDIA_SELECT: 181 case KC_MEDIA_SELECT:
182 usage = AL_CC_CONFIG; 182 usage = AL_CC_CONFIG;
183 break; 183 break;
184 case KB_MAIL: 184 case KC_MAIL:
185 usage = AL_EMAIL; 185 usage = AL_EMAIL;
186 break; 186 break;
187 case KB_CALCULATOR: 187 case KC_CALCULATOR:
188 usage = AL_CALCULATOR; 188 usage = AL_CALCULATOR;
189 break; 189 break;
190 case KB_MY_COMPUTER: 190 case KC_MY_COMPUTER:
191 usage = AL_LOCAL_BROWSER; 191 usage = AL_LOCAL_BROWSER;
192 break; 192 break;
193 case KB_WWW_SEARCH: 193 case KC_WWW_SEARCH:
194 usage = AC_SEARCH; 194 usage = AC_SEARCH;
195 break; 195 break;
196 case KB_WWW_HOME: 196 case KC_WWW_HOME:
197 usage = AC_HOME; 197 usage = AC_HOME;
198 break; 198 break;
199 case KB_WWW_BACK: 199 case KC_WWW_BACK:
200 usage = AC_BACK; 200 usage = AC_BACK;
201 break; 201 break;
202 case KB_WWW_FORWARD: 202 case KC_WWW_FORWARD:
203 usage = AC_FORWARD; 203 usage = AC_FORWARD;
204 break; 204 break;
205 case KB_WWW_STOP: 205 case KC_WWW_STOP:
206 usage = AC_STOP; 206 usage = AC_STOP;
207 break; 207 break;
208 case KB_WWW_REFRESH: 208 case KC_WWW_REFRESH:
209 usage = AC_REFRESH; 209 usage = AC_REFRESH;
210 break; 210 break;
211 case KB_WWW_FAVORITES: 211 case KC_WWW_FAVORITES:
212 usage = AC_BOOKMARKS; 212 usage = AC_BOOKMARKS;
213 break; 213 break;
214 } 214 }
@@ -218,13 +218,13 @@ debug("usage: "); phex16(usage); debug("\n");
218 else if IS_SYSTEM(code) { 218 else if IS_SYSTEM(code) {
219 uint16_t usage = 0; 219 uint16_t usage = 0;
220 switch (code) { 220 switch (code) {
221 case KB_SYSTEM_POWER: 221 case KC_SYSTEM_POWER:
222 usage = SYSTEM_POWER_DOWN; 222 usage = SYSTEM_POWER_DOWN;
223 break; 223 break;
224 case KB_SYSTEM_SLEEP: 224 case KC_SYSTEM_SLEEP:
225 usage = SYSTEM_SLEEP; 225 usage = SYSTEM_SLEEP;
226 break; 226 break;
227 case KB_SYSTEM_WAKE: 227 case KC_SYSTEM_WAKE:
228 usage = SYSTEM_WAKE_UP; 228 usage = SYSTEM_WAKE_UP;
229 break; 229 break;
230 } 230 }
diff --git a/common/keycode.h b/common/keycode.h
new file mode 100644
index 000000000..4ed78a46a
--- /dev/null
+++ b/common/keycode.h
@@ -0,0 +1,441 @@
1/*
2Copyright 2011,2012 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/*
19 * Keycodes based on HID Usage Keyboard/Keypad Page(0x07) plus special codes
20 * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
21 */
22#ifndef KEYCODE_H
23#define KEYCODE_H
24
25
26#define IS_ERROR(code) (KC_ROLL_OVER <= (code) && (code) <= KC_UNDEFINED)
27#define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF)
28#define IS_KEY(code) (KC_A <= (code) && (code) <= KC_EXSEL)
29#define IS_MOD(code) (KC_LCTRL <= (code) && (code) <= KC_RGUI)
30
31#define IS_FN(code) (KC_FN0 <= (code) && (code) <= KC_FN7)
32#define IS_MOUSEKEY(code) (KC_MS_UP <= (code) && (code) <= KC_MS_WH_RIGHT)
33#define IS_MOUSEKEY_MOVE(code) (KC_MS_UP <= (code) && (code) <= KC_MS_RIGHT)
34#define IS_MOUSEKEY_BUTTON(code) (KC_MS_BTN1 <= (code) && (code) <= KC_MS_BTN5)
35#define IS_MOUSEKEY_WHEEL(code) (KC_MS_WH_UP <= (code) && (code) <= KC_MS_WH_RIGHT)
36
37#define IS_SPECIAL(code) ((0xB0 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF))
38#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_WFAV)
39#define IS_SYSTEM(code) (KC_POWER <= (code) && (code) <= KC_WAKE)
40
41#define MOD_BIT(code) (1<<MOD_INDEX(code))
42#define MOD_INDEX(code) ((code) & 0x07)
43#define FN_BIT(code) (1<<FN_INDEX(code))
44#define FN_INDEX(code) ((code) - KC_FN0)
45
46
47/*
48 * Short names for ease of definition of keymap
49 */
50#define KC_LCTL KC_LCTRL
51#define KC_RCTL KC_RCTRL
52#define KC_LSFT KC_LSHIFT
53#define KC_RSFT KC_RSHIFT
54#define KC_ESC KC_ESCAPE
55#define KC_BSPC KC_BSPACE
56#define KC_ENT KC_ENTER
57#define KC_DEL KC_DELETE
58#define KC_INS KC_INSERT
59#define KC_CAPS KC_CAPSLOCK
60#define KC_RGHT KC_RIGHT
61#define KC_PGDN KC_PGDOWN
62#define KC_PSCR KC_PSCREEN
63#define KC_SLCK KC_SCKLOCK
64#define KC_PAUS KC_PAUSE
65#define KC_BRK KC_PAUSE
66#define KC_NLCK KC_NUMLOCK
67#define KC_SPC KC_SPACE
68#define KC_MINS KC_MINUS
69#define KC_EQL KC_EQUAL
70#define KC_GRV KC_GRAVE
71#define KC_RBRC KC_RBRACKET
72#define KC_LBRC KC_LBRACKET
73#define KC_COMM KC_COMMA
74#define KC_BSLS KC_BSLASH
75#define KC_SLSH KC_SLASH
76#define KC_SCLN KC_SCOLON
77#define KC_QUOT KC_QUOTE
78#define KC_APP KC_APPLICATION
79#define KC_NUHS KC_NONUS_HASH
80#define KC_NUBS KC_NONUS_BSLASH
81#define KC_ERAS KC_ALT_ERASE,
82#define KC_CLR KC_CLEAR
83/* Japanese specific */
84#define KC_ZKHK KC_GRAVE
85#define KC_RO KC_INT1
86#define KC_KANA KC_INT2
87#define KC_JYEN KC_INT3
88#define KC_HENK KC_INT4
89#define KC_MHEN KC_INT5
90/* Keypad */
91#define KC_P1 KC_KP_1
92#define KC_P2 KC_KP_2
93#define KC_P3 KC_KP_3
94#define KC_P4 KC_KP_4
95#define KC_P5 KC_KP_5
96#define KC_P6 KC_KP_6
97#define KC_P7 KC_KP_7
98#define KC_P8 KC_KP_8
99#define KC_P9 KC_KP_9
100#define KC_P0 KC_KP_0
101#define KC_PDOT KC_KP_DOT
102#define KC_PCMM KC_KP_COMMA
103#define KC_PSLS KC_KP_SLASH
104#define KC_PAST KC_KP_ASTERISK
105#define KC_PMNS KC_KP_MINUS
106#define KC_PPLS KC_KP_PLUS
107#define KC_PEQL KC_KP_EQUAL
108#define KC_PENT KC_KP_ENTER
109/* Mousekey */
110#define KC_MS_U KC_MS_UP
111#define KC_MS_D KC_MS_DOWN
112#define KC_MS_L KC_MS_LEFT
113#define KC_MS_R KC_MS_RIGHT
114#define KC_BTN1 KC_MS_BTN1
115#define KC_BTN2 KC_MS_BTN2
116#define KC_BTN3 KC_MS_BTN3
117#define KC_BTN4 KC_MS_BTN4
118#define KC_BTN5 KC_MS_BTN5
119#define KC_WH_U KC_MS_WH_UP
120#define KC_WH_D KC_MS_WH_DOWN
121#define KC_WH_L KC_MS_WH_LEFT
122#define KC_WH_R KC_MS_WH_RIGHT
123/* Sytem Control */
124#define KC_PWR KC_SYSTEM_POWER
125#define KC_SLEP KC_SYSTEM_SLEEP
126#define KC_WAKE KC_SYSTEM_WAKE
127/* Consumer Page */
128#define KC_MUTE KC_AUDIO_MUTE
129#define KC_VOLU KC_AUDIO_VOL_UP
130#define KC_VOLD KC_AUDIO_VOL_DOWN
131#define KC_MNXT KC_MEDIA_NEXT_TRACK
132#define KC_MPRV KC_MEDIA_PREV_TRACK
133#define KC_MSTP KC_MEDIA_STOP
134#define KC_MPLY KC_MEDIA_PLAY_PAUSE
135#define KC_MSEL KC_MEDIA_SELECT
136#define KC_MAIL KC_MAIL
137#define KC_CALC KC_CALCULATOR
138#define KC_MYCM KC_MY_COMPUTER
139#define KC_WSCH KC_WWW_SEARCH
140#define KC_WHOM KC_WWW_HOME
141#define KC_WBAK KC_WWW_BACK
142#define KC_WFWD KC_WWW_FORWARD
143#define KC_WSTP KC_WWW_STOP
144#define KC_WREF KC_WWW_REFRESH
145#define KC_WFAV KC_WWW_FAVORITES
146
147
148/* USB HID Keyboard/Keypad Usage(0x07) */
149enum hid_keyboard_keypad_usage {
150 KC_NO = 0x00,
151 KC_ROLL_OVER,
152 KC_POST_FAIL,
153 KC_UNDEFINED,
154 KC_A,
155 KC_B,
156 KC_C,
157 KC_D,
158 KC_E,
159 KC_F,
160 KC_G,
161 KC_H,
162 KC_I,
163 KC_J,
164 KC_K,
165 KC_L,
166 KC_M, /* 0x10 */
167 KC_N,
168 KC_O,
169 KC_P,
170 KC_Q,
171 KC_R,
172 KC_S,
173 KC_T,
174 KC_U,
175 KC_V,
176 KC_W,
177 KC_X,
178 KC_Y,
179 KC_Z,
180 KC_1,
181 KC_2,
182 KC_3, /* 0x20 */
183 KC_4,
184 KC_5,
185 KC_6,
186 KC_7,
187 KC_8,
188 KC_9,
189 KC_0,
190 KC_ENTER,
191 KC_ESCAPE,
192 KC_BSPACE,
193 KC_TAB,
194 KC_SPACE,
195 KC_MINUS,
196 KC_EQUAL,
197 KC_LBRACKET,
198 KC_RBRACKET, /* 0x30 */
199 KC_BSLASH, /* \ (and |) */
200 KC_NONUS_HASH, /* Non-US # and ~ */
201 KC_SCOLON, /* ; (and :) */
202 KC_QUOTE, /* ' and " */
203 KC_GRAVE, /* Grave accent and tilde */
204 KC_COMMA, /* , and < */
205 KC_DOT, /* . and > */
206 KC_SLASH, /* / and ? */
207 KC_CAPSLOCK,
208 KC_F1,
209 KC_F2,
210 KC_F3,
211 KC_F4,
212 KC_F5,
213 KC_F6,
214 KC_F7, /* 0x40 */
215 KC_F8,
216 KC_F9,
217 KC_F10,
218 KC_F11,
219 KC_F12,
220 KC_PSCREEN,
221 KC_SCKLOCK,
222 KC_PAUSE,
223 KC_INSERT,
224 KC_HOME,
225 KC_PGUP,
226 KC_DELETE,
227 KC_END,
228 KC_PGDOWN,
229 KC_RIGHT,
230 KC_LEFT, /* 0x50 */
231 KC_DOWN,
232 KC_UP,
233 KC_NUMLOCK,
234 KC_KP_SLASH,
235 KC_KP_ASTERISK,
236 KC_KP_MINUS,
237 KC_KP_PLUS,
238 KC_KP_ENTER,
239 KC_KP_1,
240 KC_KP_2,
241 KC_KP_3,
242 KC_KP_4,
243 KC_KP_5,
244 KC_KP_6,
245 KC_KP_7,
246 KC_KP_8, /* 0x60 */
247 KC_KP_9,
248 KC_KP_0,
249 KC_KP_DOT,
250 KC_NONUS_BSLASH, /* Non-US \ and | */
251 KC_APPLICATION,
252 KC_POWER,
253 KC_KP_EQUAL,
254 KC_F13,
255 KC_F14,
256 KC_F15,
257 KC_F16,
258 KC_F17,
259 KC_F18,
260 KC_F19,
261 KC_F20,
262 KC_F21, /* 0x70 */
263 KC_F22,
264 KC_F23,
265 KC_F24,
266 KC_EXECUTE,
267 KC_HELP,
268 KC_MENU,
269 KC_SELECT,
270 KC_STOP,
271 KC_AGAIN,
272 KC_UNDO,
273 KC_CUT,
274 KC_COPY,
275 KC_PASTE,
276 KC_FIND,
277 KC__MUTE,
278 KC__VOLUP, /* 0x80 */
279 KC__VOLDOWN,
280 KC_LOCKING_CAPS, /* locking Caps Lock */
281 KC_LOCKING_NUM, /* locking Num Lock */
282 KC_LOCKING_SCROLL, /* locking Scroll Lock */
283 KC_KP_COMMA,
284 KC_KP_EQUAL_AS400, /* equal sign on AS/400 */
285 KC_INT1,
286 KC_INT2,
287 KC_INT3,
288 KC_INT4,
289 KC_INT5,
290 KC_INT6,
291 KC_INT7,
292 KC_INT8,
293 KC_INT9,
294 KC_LANG1, /* 0x90 */
295 KC_LANG2,
296 KC_LANG3,
297 KC_LANG4,
298 KC_LANG5,
299 KC_LANG6,
300 KC_LANG7,
301 KC_LANG8,
302 KC_LANG9,
303 KC_ALT_ERASE,
304 KC_SYSREQ,
305 KC_CANCEL,
306 KC_CLEAR,
307 KC_PRIOR,
308 KC_RETURN,
309 KC_SEPARATOR,
310 KC_OUT, /* 0xA0 */
311 KC_OPER,
312 KC_CLEAR_AGAIN,
313 KC_CRSEL,
314 KC_EXSEL, /* 0xA4 */
315
316 /* NOTE: 0xA5-DF are used for internal special purpose */
317
318#if 0
319 /* NOTE: Following codes(0xB0-DD) are not used. Leave them for reference. */
320 KC_KP_00 = 0xB0,
321 KC_KP_000,
322 KC_THOUSANDS_SEPARATOR,
323 KC_DECIMAL_SEPARATOR,
324 KC_CURRENCY_UNIT,
325 KC_CURRENCY_SUB_UNIT,
326 KC_KP_LPAREN,
327 KC_KP_RPAREN,
328 KC_KP_LCBRACKET, /* { */
329 KC_KP_RCBRACKET, /* } */
330 KC_KP_TAB,
331 KC_KP_BSPACE,
332 KC_KP_A,
333 KC_KP_B,
334 KC_KP_C,
335 KC_KP_D,
336 KC_KP_E, /* 0xC0 */
337 KC_KP_F,
338 KC_KP_XOR,
339 KC_KP_HAT,
340 KC_KP_PERC,
341 KC_KP_LT,
342 KC_KP_GT,
343 KC_KP_AND,
344 KC_KP_LAZYAND,
345 KC_KP_OR,
346 KC_KP_LAZYOR,
347 KC_KP_COLON,
348 KC_KP_HASH,
349 KC_KP_SPACE,
350 KC_KP_ATMARK,
351 KC_KP_EXCLAMATION,
352 KC_KP_MEM_STORE, /* 0xD0 */
353 KC_KP_MEM_RECALL,
354 KC_KP_MEM_CLEAR,
355 KC_KP_MEM_ADD,
356 KC_KP_MEM_SUB,
357 KC_KP_MEM_MUL,
358 KC_KP_MEM_DIV,
359 KC_KP_PLUS_MINUS,
360 KC_KP_CLEAR,
361 KC_KP_CLEAR_ENTRY,
362 KC_KP_BINARY,
363 KC_KP_OCTAL,
364 KC_KP_DECIMAL,
365 KC_KP_HEXADECIMAL, /* 0xDD */
366#endif
367
368 /* Modifiers */
369 KC_LCTRL = 0xE0,
370 KC_LSHIFT,
371 KC_LALT,
372 KC_LGUI,
373 KC_RCTRL,
374 KC_RSHIFT,
375 KC_RALT,
376 KC_RGUI,
377
378 /* NOTE: 0xE8-FF are used for internal special purpose */
379};
380
381/* Special keycodes */
382/* NOTE: 0xA5-DF and 0xE8-FF are used for internal special purpose */
383enum internal_special_keycodes {
384 /* System Control */
385 KC_SYSTEM_POWER = 0xA5,
386 KC_SYSTEM_SLEEP,
387 KC_SYSTEM_WAKE, /* 0xA7 */
388 /* 0xA8-AF */
389
390 /* Consumer Page */
391 KC_AUDIO_MUTE = 0xB0,
392 KC_AUDIO_VOL_UP,
393 KC_AUDIO_VOL_DOWN,
394 KC_MEDIA_NEXT_TRACK,
395 KC_MEDIA_PREV_TRACK,
396 KC_MEDIA_STOP,
397 KC_MEDIA_PLAY_PAUSE,
398 KC_MEDIA_SELECT,
399 KC_MAIL,
400 KC_CALCULATOR,
401 KC_MY_COMPUTER,
402 KC_WWW_SEARCH,
403 KC_WWW_HOME,
404 KC_WWW_BACK,
405 KC_WWW_FORWARD,
406 KC_WWW_STOP,
407 KC_WWW_REFRESH, /* 0xC0 */
408 KC_WWW_FAVORITES, /* 0xC1 */
409 /* 0xC2-DF vacant for future use */
410
411 /* 0xE0-E7 for Modifiers. DO NOT USE. */
412
413 /* Layer Switching */
414 KC_FN0 = 0xE8,
415 KC_FN1,
416 KC_FN2,
417 KC_FN3,
418 KC_FN4,
419 KC_FN5,
420 KC_FN6,
421 KC_FN7, /* 0xEF */
422
423 /* Mousekey */
424 KC_MS_UP = 0xF0,
425 KC_MS_DOWN,
426 KC_MS_LEFT,
427 KC_MS_RIGHT,
428 KC_MS_BTN1,
429 KC_MS_BTN2,
430 KC_MS_BTN3,
431 KC_MS_BTN4,
432 KC_MS_BTN5,
433 /* Mousekey wheel */
434 KC_MS_WH_UP,
435 KC_MS_WH_DOWN,
436 KC_MS_WH_LEFT,
437 KC_MS_WH_RIGHT, /* 0xFC */
438 /* 0xFD-FF vacant for future use */
439};
440
441#endif /* KEYCODE_H */
diff --git a/common/mousekey.c b/common/mousekey.c
index 222d9e445..58a6e35bb 100644
--- a/common/mousekey.c
+++ b/common/mousekey.c
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18#include <stdint.h> 18#include <stdint.h>
19#include <util/delay.h> 19#include <util/delay.h>
20#include "usb_keycodes.h" 20#include "keycode.h"
21#include "host.h" 21#include "host.h"
22#include "timer.h" 22#include "timer.h"
23#include "print.h" 23#include "print.h"
@@ -90,36 +90,36 @@ void mousekey_task(void)
90 90
91void mousekey_on(uint8_t code) 91void mousekey_on(uint8_t code)
92{ 92{
93 if (code == KB_MS_UP) report.y = MOUSEKEY_MOVE_INIT * -1; 93 if (code == KC_MS_UP) report.y = MOUSEKEY_MOVE_INIT * -1;
94 else if (code == KB_MS_DOWN) report.y = MOUSEKEY_MOVE_INIT; 94 else if (code == KC_MS_DOWN) report.y = MOUSEKEY_MOVE_INIT;
95 else if (code == KB_MS_LEFT) report.x = MOUSEKEY_MOVE_INIT * -1; 95 else if (code == KC_MS_LEFT) report.x = MOUSEKEY_MOVE_INIT * -1;
96 else if (code == KB_MS_RIGHT) report.x = MOUSEKEY_MOVE_INIT; 96 else if (code == KC_MS_RIGHT) report.x = MOUSEKEY_MOVE_INIT;
97 else if (code == KB_MS_WH_UP) report.v = MOUSEKEY_WHEEL_INIT; 97 else if (code == KC_MS_WH_UP) report.v = MOUSEKEY_WHEEL_INIT;
98 else if (code == KB_MS_WH_DOWN) report.v = MOUSEKEY_WHEEL_INIT * -1; 98 else if (code == KC_MS_WH_DOWN) report.v = MOUSEKEY_WHEEL_INIT * -1;
99 else if (code == KB_MS_WH_LEFT) report.h = MOUSEKEY_WHEEL_INIT * -1; 99 else if (code == KC_MS_WH_LEFT) report.h = MOUSEKEY_WHEEL_INIT * -1;
100 else if (code == KB_MS_WH_RIGHT) report.h = MOUSEKEY_WHEEL_INIT; 100 else if (code == KC_MS_WH_RIGHT) report.h = MOUSEKEY_WHEEL_INIT;
101 else if (code == KB_MS_BTN1) report.buttons |= MOUSE_BTN1; 101 else if (code == KC_MS_BTN1) report.buttons |= MOUSE_BTN1;
102 else if (code == KB_MS_BTN2) report.buttons |= MOUSE_BTN2; 102 else if (code == KC_MS_BTN2) report.buttons |= MOUSE_BTN2;
103 else if (code == KB_MS_BTN3) report.buttons |= MOUSE_BTN3; 103 else if (code == KC_MS_BTN3) report.buttons |= MOUSE_BTN3;
104 else if (code == KB_MS_BTN4) report.buttons |= MOUSE_BTN4; 104 else if (code == KC_MS_BTN4) report.buttons |= MOUSE_BTN4;
105 else if (code == KB_MS_BTN5) report.buttons |= MOUSE_BTN5; 105 else if (code == KC_MS_BTN5) report.buttons |= MOUSE_BTN5;
106} 106}
107 107
108void mousekey_off(uint8_t code) 108void mousekey_off(uint8_t code)
109{ 109{
110 if (code == KB_MS_UP && report.y < 0) report.y = 0; 110 if (code == KC_MS_UP && report.y < 0) report.y = 0;
111 else if (code == KB_MS_DOWN && report.y > 0) report.y = 0; 111 else if (code == KC_MS_DOWN && report.y > 0) report.y = 0;
112 else if (code == KB_MS_LEFT && report.x < 0) report.x = 0; 112 else if (code == KC_MS_LEFT && report.x < 0) report.x = 0;
113 else if (code == KB_MS_RIGHT && report.x > 0) report.x = 0; 113 else if (code == KC_MS_RIGHT && report.x > 0) report.x = 0;
114 else if (code == KB_MS_WH_UP && report.v > 0) report.v = 0; 114 else if (code == KC_MS_WH_UP && report.v > 0) report.v = 0;
115 else if (code == KB_MS_WH_DOWN && report.v < 0) report.v = 0; 115 else if (code == KC_MS_WH_DOWN && report.v < 0) report.v = 0;
116 else if (code == KB_MS_WH_LEFT && report.h < 0) report.h = 0; 116 else if (code == KC_MS_WH_LEFT && report.h < 0) report.h = 0;
117 else if (code == KB_MS_WH_RIGHT && report.h > 0) report.h = 0; 117 else if (code == KC_MS_WH_RIGHT && report.h > 0) report.h = 0;
118 else if (code == KB_MS_BTN1) report.buttons &= ~MOUSE_BTN1; 118 else if (code == KC_MS_BTN1) report.buttons &= ~MOUSE_BTN1;
119 else if (code == KB_MS_BTN2) report.buttons &= ~MOUSE_BTN2; 119 else if (code == KC_MS_BTN2) report.buttons &= ~MOUSE_BTN2;
120 else if (code == KB_MS_BTN3) report.buttons &= ~MOUSE_BTN3; 120 else if (code == KC_MS_BTN3) report.buttons &= ~MOUSE_BTN3;
121 else if (code == KB_MS_BTN4) report.buttons &= ~MOUSE_BTN4; 121 else if (code == KC_MS_BTN4) report.buttons &= ~MOUSE_BTN4;
122 else if (code == KB_MS_BTN5) report.buttons &= ~MOUSE_BTN5; 122 else if (code == KC_MS_BTN5) report.buttons &= ~MOUSE_BTN5;
123 123
124 if (report.x == 0 && report.y == 0 && report.v == 0 && report.h == 0) 124 if (report.x == 0 && report.y == 0 && report.v == 0 && report.h == 0)
125 mousekey_repeat = 0; 125 mousekey_repeat = 0;
diff --git a/common/usb_keycodes.h b/common/usb_keycodes.h
deleted file mode 100644
index 6a4437418..000000000
--- a/common/usb_keycodes.h
+++ /dev/null
@@ -1,436 +0,0 @@
1/*
2Copyright 2011 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/*
19 * Key codes: HID Keyboard/Keypad Page(0x07)
20 * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
21 */
22#ifndef USB_KEYCODES_H
23#define USB_KEYCODES_H
24
25
26#define IS_ERROR(code) (KB_ROLL_OVER <= (code) && (code) <= KB_UNDEFINED)
27#define IS_ANY(code) (KB_A <= (code) && (code) <= 0xFF)
28#define IS_KEY(code) (KB_A <= (code) && (code) <= KB_EXSEL)
29#define IS_MOD(code) (KB_LCTRL <= (code) && (code) <= KB_RGUI)
30
31#define IS_FN(code) (KB_FN0 <= (code) && (code) <= KB_FN7)
32#define IS_MOUSEKEY(code) (KB_MS_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
33#define IS_MOUSEKEY_MOVE(code) (KB_MS_UP <= (code) && (code) <= KB_MS_RIGHT)
34#define IS_MOUSEKEY_BUTTON(code) (KB_MS_BTN1 <= (code) && (code) <= KB_MS_BTN5)
35#define IS_MOUSEKEY_WHEEL(code) (KB_MS_WH_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
36
37#define IS_SPECIAL(code) ((0xB0 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF))
38#define IS_CONSUMER(code) (KB_MUTE <= (code) && (code) <= KB_WFAV)
39#define IS_SYSTEM(code) (KB_POWER <= (code) && (code) <= KB_WAKE)
40
41#define MOD_BIT(code) (1<<((code) & 0x07))
42#define FN_BIT(code) (1<<((code) - KB_FN0))
43#define FN_INDEX(code) ((code) - KB_FN0)
44
45
46/* Short names */
47#define KB_LCTL KB_LCTRL
48#define KB_RCTL KB_RCTRL
49#define KB_LSFT KB_LSHIFT
50#define KB_RSFT KB_RSHIFT
51#define KB_ESC KB_ESCAPE
52#define KB_BSPC KB_BSPACE
53#define KB_ENT KB_ENTER
54#define KB_DEL KB_DELETE
55#define KB_INS KB_INSERT
56#define KB_CAPS KB_CAPSLOCK
57#define KB_RGHT KB_RIGHT
58#define KB_PGDN KB_PGDOWN
59#define KB_PSCR KB_PSCREEN
60#define KB_SLCK KB_SCKLOCK
61#define KB_PAUS KB_PAUSE
62#define KB_BRK KB_PAUSE
63#define KB_NLCK KB_NUMLOCK
64#define KB_SPC KB_SPACE
65#define KB_MINS KB_MINUS
66#define KB_EQL KB_EQUAL
67#define KB_GRV KB_GRAVE
68#define KB_RBRC KB_RBRACKET
69#define KB_LBRC KB_LBRACKET
70#define KB_COMM KB_COMMA
71#define KB_BSLS KB_BSLASH
72#define KB_SLSH KB_SLASH
73#define KB_SCLN KB_SCOLON
74#define KB_QUOT KB_QUOTE
75#define KB_APP KB_APPLICATION
76#define KB_NUHS KB_NONUS_HASH
77#define KB_NUBS KB_NONUS_BSLASH
78#define KB_ERAS KB_ALT_ERASE,
79#define KB_CLR KB_CLEAR
80/* for Japanese */
81#define KB_ZKHK KB_GRAVE
82#define KB_RO KB_INT1
83#define KB_KANA KB_INT2
84#define KB_JYEN KB_INT3
85#define KB_HENK KB_INT4
86#define KB_MHEN KB_INT5
87/* Keypad */
88#define KB_P1 KB_KP_1
89#define KB_P2 KB_KP_2
90#define KB_P3 KB_KP_3
91#define KB_P4 KB_KP_4
92#define KB_P5 KB_KP_5
93#define KB_P6 KB_KP_6
94#define KB_P7 KB_KP_7
95#define KB_P8 KB_KP_8
96#define KB_P9 KB_KP_9
97#define KB_P0 KB_KP_0
98#define KB_PDOT KB_KP_DOT
99#define KB_PCMM KB_KP_COMMA
100#define KB_PSLS KB_KP_SLASH
101#define KB_PAST KB_KP_ASTERISK
102#define KB_PMNS KB_KP_MINUS
103#define KB_PPLS KB_KP_PLUS
104#define KB_PEQL KB_KP_EQUAL
105#define KB_PENT KB_KP_ENTER
106/* Mousekey */
107#define KB_MS_U KB_MS_UP
108#define KB_MS_D KB_MS_DOWN
109#define KB_MS_L KB_MS_LEFT
110#define KB_MS_R KB_MS_RIGHT
111#define KB_BTN1 KB_MS_BTN1
112#define KB_BTN2 KB_MS_BTN2
113#define KB_BTN3 KB_MS_BTN3
114#define KB_BTN4 KB_MS_BTN4
115#define KB_BTN5 KB_MS_BTN5
116#define KB_WH_U KB_MS_WH_UP
117#define KB_WH_D KB_MS_WH_DOWN
118#define KB_WH_L KB_MS_WH_LEFT
119#define KB_WH_R KB_MS_WH_RIGHT
120/* Sytem Control & Consumer usage */
121#define KB_PWR KB_SYSTEM_POWER
122#define KB_SLEP KB_SYSTEM_SLEEP
123#define KB_WAKE KB_SYSTEM_WAKE
124#define KB_MUTE KB_AUDIO_MUTE
125#define KB_VOLU KB_AUDIO_VOL_UP
126#define KB_VOLD KB_AUDIO_VOL_DOWN
127#define KB_MNXT KB_MEDIA_NEXT_TRACK
128#define KB_MPRV KB_MEDIA_PREV_TRACK
129#define KB_MSTP KB_MEDIA_STOP
130#define KB_MPLY KB_MEDIA_PLAY_PAUSE
131#define KB_MSEL KB_MEDIA_SELECT
132#define KB_MAIL KB_MAIL
133#define KB_CALC KB_CALCULATOR
134#define KB_MYCM KB_MY_COMPUTER
135#define KB_WSCH KB_WWW_SEARCH
136#define KB_WHOM KB_WWW_HOME
137#define KB_WBAK KB_WWW_BACK
138#define KB_WFWD KB_WWW_FORWARD
139#define KB_WSTP KB_WWW_STOP
140#define KB_WREF KB_WWW_REFRESH
141#define KB_WFAV KB_WWW_FAVORITES
142
143
144/* Special keycode */
145/* NOTE: 0xA5-DF and 0xE8-FF can be used for internal special purpose */
146enum special_keycodes {
147 /* System Control */
148 KB_SYSTEM_POWER = 0xA5,
149 KB_SYSTEM_SLEEP,
150 KB_SYSTEM_WAKE, /* 0xA7 */
151 /* 0xA8-AF */
152
153 /* Consumer Page */
154 KB_AUDIO_MUTE = 0xB0,
155 KB_AUDIO_VOL_UP,
156 KB_AUDIO_VOL_DOWN,
157 KB_MEDIA_NEXT_TRACK,
158 KB_MEDIA_PREV_TRACK,
159 KB_MEDIA_STOP,
160 KB_MEDIA_PLAY_PAUSE,
161 KB_MEDIA_SELECT,
162 KB_MAIL,
163 KB_CALCULATOR,
164 KB_MY_COMPUTER,
165 KB_WWW_SEARCH,
166 KB_WWW_HOME,
167 KB_WWW_BACK,
168 KB_WWW_FORWARD,
169 KB_WWW_STOP,
170 KB_WWW_REFRESH, /* 0xC0 */
171 KB_WWW_FAVORITES, /* 0xC1 */
172 /* 0xC2-DF vacant for future use */
173
174 /* 0xE0-E7 for Modifiers. DO NOT USE. */
175
176 /* Layer Switching */
177 KB_FN0 = 0xE8,
178 KB_FN1,
179 KB_FN2,
180 KB_FN3,
181 KB_FN4,
182 KB_FN5,
183 KB_FN6,
184 KB_FN7, /* 0xEF */
185
186 /* Mousekey */
187 KB_MS_UP = 0xF0,
188 KB_MS_DOWN,
189 KB_MS_LEFT,
190 KB_MS_RIGHT,
191 KB_MS_BTN1,
192 KB_MS_BTN2,
193 KB_MS_BTN3,
194 KB_MS_BTN4,
195 KB_MS_BTN5,
196 /* Mousekey wheel */
197 KB_MS_WH_UP,
198 KB_MS_WH_DOWN,
199 KB_MS_WH_LEFT,
200 KB_MS_WH_RIGHT, /* 0xFC */
201 /* 0xFD-FF vacant for future use */
202};
203
204/* USB HID Keyboard/Keypad Usage(0x07) */
205enum keycodes {
206 KB_NO = 0x00,
207 KB_ROLL_OVER,
208 KB_POST_FAIL,
209 KB_UNDEFINED,
210 KB_A,
211 KB_B,
212 KB_C,
213 KB_D,
214 KB_E,
215 KB_F,
216 KB_G,
217 KB_H,
218 KB_I,
219 KB_J,
220 KB_K,
221 KB_L,
222 KB_M, /* 0x10 */
223 KB_N,
224 KB_O,
225 KB_P,
226 KB_Q,
227 KB_R,
228 KB_S,
229 KB_T,
230 KB_U,
231 KB_V,
232 KB_W,
233 KB_X,
234 KB_Y,
235 KB_Z,
236 KB_1,
237 KB_2,
238 KB_3, /* 0x20 */
239 KB_4,
240 KB_5,
241 KB_6,
242 KB_7,
243 KB_8,
244 KB_9,
245 KB_0,
246 KB_ENTER,
247 KB_ESCAPE,
248 KB_BSPACE,
249 KB_TAB,
250 KB_SPACE,
251 KB_MINUS,
252 KB_EQUAL,
253 KB_LBRACKET,
254 KB_RBRACKET, /* 0x30 */
255 KB_BSLASH, /* \ (and |) */
256 KB_NONUS_HASH, /* Non-US # and ~ */
257 KB_SCOLON, /* ; (and :) */
258 KB_QUOTE, /* ' and " */
259 KB_GRAVE, /* Grave accent and tilde */
260 KB_COMMA, /* , and < */
261 KB_DOT, /* . and > */
262 KB_SLASH, /* / and ? */
263 KB_CAPSLOCK,
264 KB_F1,
265 KB_F2,
266 KB_F3,
267 KB_F4,
268 KB_F5,
269 KB_F6,
270 KB_F7, /* 0x40 */
271 KB_F8,
272 KB_F9,
273 KB_F10,
274 KB_F11,
275 KB_F12,
276 KB_PSCREEN,
277 KB_SCKLOCK,
278 KB_PAUSE,
279 KB_INSERT,
280 KB_HOME,
281 KB_PGUP,
282 KB_DELETE,
283 KB_END,
284 KB_PGDOWN,
285 KB_RIGHT,
286 KB_LEFT, /* 0x50 */
287 KB_DOWN,
288 KB_UP,
289 KB_NUMLOCK,
290 KB_KP_SLASH,
291 KB_KP_ASTERISK,
292 KB_KP_MINUS,
293 KB_KP_PLUS,
294 KB_KP_ENTER,
295 KB_KP_1,
296 KB_KP_2,
297 KB_KP_3,
298 KB_KP_4,
299 KB_KP_5,
300 KB_KP_6,
301 KB_KP_7,
302 KB_KP_8, /* 0x60 */
303 KB_KP_9,
304 KB_KP_0,
305 KB_KP_DOT,
306 KB_NONUS_BSLASH, /* Non-US \ and | */
307 KB_APPLICATION,
308 KB_POWER,
309 KB_KP_EQUAL,
310 KB_F13,
311 KB_F14,
312 KB_F15,
313 KB_F16,
314 KB_F17,
315 KB_F18,
316 KB_F19,
317 KB_F20,
318 KB_F21, /* 0x70 */
319 KB_F22,
320 KB_F23,
321 KB_F24,
322 KB_EXECUTE,
323 KB_HELP,
324 KB_MENU,
325 KB_SELECT,
326 KB_STOP,
327 KB_AGAIN,
328 KB_UNDO,
329 KB_CUT,
330 KB_COPY,
331 KB_PASTE,
332 KB_FIND,
333 KB__MUTE,
334 KB__VOLUP, /* 0x80 */
335 KB__VOLDOWN,
336 KB_LOCKING_CAPS, /* locking Caps Lock */
337 KB_LOCKING_NUM, /* locking Num Lock */
338 KB_LOCKING_SCROLL, /* locking Scroll Lock */
339 KB_KP_COMMA,
340 KB_KP_EQUAL_AS400, /* equal sign on AS/400 */
341 KB_INT1,
342 KB_INT2,
343 KB_INT3,
344 KB_INT4,
345 KB_INT5,
346 KB_INT6,
347 KB_INT7,
348 KB_INT8,
349 KB_INT9,
350 KB_LANG1, /* 0x90 */
351 KB_LANG2,
352 KB_LANG3,
353 KB_LANG4,
354 KB_LANG5,
355 KB_LANG6,
356 KB_LANG7,
357 KB_LANG8,
358 KB_LANG9,
359 KB_ALT_ERASE,
360 KB_SYSREQ,
361 KB_CANCEL,
362 KB_CLEAR,
363 KB_PRIOR,
364 KB_RETURN,
365 KB_SEPARATOR,
366 KB_OUT, /* 0xA0 */
367 KB_OPER,
368 KB_CLEAR_AGAIN,
369 KB_CRSEL,
370 KB_EXSEL, /* 0xA4 */
371
372 /* NOTE: 0xA5-DF are used for internal special purpose */
373
374#if 0
375 KB_KP_00 = 0xB0,
376 KB_KP_000,
377 KB_THOUSANDS_SEPARATOR,
378 KB_DECIMAL_SEPARATOR,
379 KB_CURRENCY_UNIT,
380 KB_CURRENCY_SUB_UNIT,
381 KB_KP_LPAREN,
382 KB_KP_RPAREN,
383 KB_KP_LCBRACKET, /* { */
384 KB_KP_RCBRACKET, /* } */
385 KB_KP_TAB,
386 KB_KP_BSPACE,
387 KB_KP_A,
388 KB_KP_B,
389 KB_KP_C,
390 KB_KP_D,
391 KB_KP_E, /* 0xC0 */
392 KB_KP_F,
393 KB_KP_XOR,
394 KB_KP_HAT,
395 KB_KP_PERC,
396 KB_KP_LT,
397 KB_KP_GT,
398 KB_KP_AND,
399 KB_KP_LAZYAND,
400 KB_KP_OR,
401 KB_KP_LAZYOR,
402 KB_KP_COLON,
403 KB_KP_HASH,
404 KB_KP_SPACE,
405 KB_KP_ATMARK,
406 KB_KP_EXCLAMATION,
407 KB_KP_MEM_STORE, /* 0xD0 */
408 KB_KP_MEM_RECALL,
409 KB_KP_MEM_CLEAR,
410 KB_KP_MEM_ADD,
411 KB_KP_MEM_SUB,
412 KB_KP_MEM_MUL,
413 KB_KP_MEM_DIV,
414 KB_KP_PLUS_MINUS,
415 KB_KP_CLEAR,
416 KB_KP_CLEAR_ENTRY,
417 KB_KP_BINARY,
418 KB_KP_OCTAL,
419 KB_KP_DECIMAL,
420 KB_KP_HEXADECIMAL, /* 0xDD */
421#endif
422
423 /* Modifiers */
424 KB_LCTRL = 0xE0,
425 KB_LSHIFT,
426 KB_LALT,
427 KB_LGUI,
428 KB_RCTRL,
429 KB_RSHIFT,
430 KB_RALT,
431 KB_RGUI,
432
433 /* NOTE: 0xE8-FF are used for internal special purpose */
434};
435
436#endif /* USB_KEYCODES_H */
diff --git a/keyboard/hhkb/config.h b/keyboard/hhkb/config.h
index 17a449406..e10a7ab37 100644
--- a/keyboard/hhkb/config.h
+++ b/keyboard/hhkb/config.h
@@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
38 38
39 39
40/* key combination for command */ 40/* key combination for command */
41#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT))) 41#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
42 42
43/* mouse keys */ 43/* mouse keys */
44#ifdef MOUSEKEY_ENABLE 44#ifdef MOUSEKEY_ENABLE
diff --git a/keyboard/hhkb/keymap.c b/keyboard/hhkb/keymap.c
index 43f777c56..3cfa5ff33 100644
--- a/keyboard/hhkb/keymap.c
+++ b/keyboard/hhkb/keymap.c
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
22#include <stdbool.h> 22#include <stdbool.h>
23#include <avr/pgmspace.h> 23#include <avr/pgmspace.h>
24#include "host.h" 24#include "host.h"
25#include "usb_keycodes.h" 25#include "keycode.h"
26#include "print.h" 26#include "print.h"
27#include "debug.h" 27#include "debug.h"
28#include "util.h" 28#include "util.h"
@@ -39,14 +39,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
39 K35, K36, K37, K57, K56 \ 39 K35, K36, K37, K57, K56 \
40) \ 40) \
41{ \ 41{ \
42 { KB_##K00, KB_##K01, KB_##K02, KB_##K03, KB_##K04, KB_##K05, KB_##K06, KB_##K07 }, \ 42 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
43 { KB_##K10, KB_##K11, KB_##K12, KB_##K13, KB_##K14, KB_##K15, KB_##K16, KB_##K17 }, \ 43 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
44 { KB_##K20, KB_##K21, KB_##K22, KB_##K23, KB_##K24, KB_##K25, KB_##K26, KB_NO }, \ 44 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \
45 { KB_##K30, KB_##K31, KB_##K32, KB_##K33, KB_##K34, KB_##K35, KB_##K36, KB_##K37 }, \ 45 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
46 { KB_##K40, KB_##K41, KB_##K42, KB_##K43, KB_##K44, KB_##K45, KB_##K46, KB_NO }, \ 46 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \
47 { KB_##K50, KB_##K51, KB_##K52, KB_##K53, KB_##K54, KB_##K55, KB_##K56, KB_##K57 }, \ 47 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
48 { KB_##K60, KB_##K61, KB_##K62, KB_##K63, KB_##K64, KB_##K65, KB_##K66, KB_NO }, \ 48 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_NO }, \
49 { KB_##K70, KB_##K71, KB_##K72, KB_##K73, KB_##K74, KB_##K75, KB_##K76, KB_NO } \ 49 { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_NO } \
50} 50}
51 51
52#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)])) 52#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)]))
@@ -67,14 +67,14 @@ static const uint8_t PROGMEM fn_layer[] = {
67// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. 67// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
68// See layer.c for details. 68// See layer.c for details.
69static const uint8_t PROGMEM fn_keycode[] = { 69static const uint8_t PROGMEM fn_keycode[] = {
70 KB_NO, // Fn0 70 KC_NO, // Fn0
71 KB_NO, // Fn1 71 KC_NO, // Fn1
72 KB_SLSH, // Fn2 72 KC_SLSH, // Fn2
73 KB_SCLN, // Fn3 73 KC_SCLN, // Fn3
74 KB_NO, // Fn4 74 KC_NO, // Fn4
75 KB_SPC, // Fn5 75 KC_SPC, // Fn5
76 KB_NO, // Fn6 76 KC_NO, // Fn6
77 KB_NO // Fn7 77 KC_NO // Fn7
78}; 78};
79 79
80static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 80static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -95,7 +95,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
95 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ 95 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
96 LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,ENT, \ 96 LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,ENT, \
97 LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,FN1, \ 97 LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,FN1, \
98 LGUI,LALT, SPC, RALT,FN4), 98 LGUI,LALT, FN5, RALT,FN4),
99 99
100 /* Layer 1: HHKB mode (HHKB Fn) 100 /* Layer 1: HHKB mode (HHKB Fn)
101 * ,-----------------------------------------------------------. 101 * ,-----------------------------------------------------------.
@@ -151,10 +151,10 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
151 */ 151 */
152#ifdef HOST_IWRAP 152#ifdef HOST_IWRAP
153// iWRAP does not support mouse wheel, use these keycodes to remap as wheel 153// iWRAP does not support mouse wheel, use these keycodes to remap as wheel
154#define KB_KPPL KB_KP_PLUS 154#define KC_KPPL KC_KP_PLUS
155#define KB_KPMI KB_KP_MINUS 155#define KC_KPMI KC_KP_MINUS
156#define KB_KPAS KB_KP_ASTERISK 156#define KC_KPAS KC_KP_ASTERISK
157#define KB_KPSL KB_KP_SLASH 157#define KC_KPSL KC_KP_SLASH
158 KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ 158 KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
159 TAB, KPAS,KPPL,MS_U,KPMI,KPSL,KPAS,KPPL,KPMI,KPSL,NO, NO, NO, BSPC, \ 159 TAB, KPAS,KPPL,MS_U,KPMI,KPSL,KPAS,KPPL,KPMI,KPSL,NO, NO, NO, BSPC, \
160 LCTL,NO, MS_L,MS_D,MS_R,NO, MS_L,MS_D,MS_U,MS_R,FN3, NO, ENT, \ 160 LCTL,NO, MS_L,MS_D,MS_R,NO, MS_L,MS_D,MS_U,MS_R,FN3, NO, ENT, \
@@ -181,14 +181,13 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
181 * |Gui |Alt |xxxxxxxxxxxxxxxxxxxxxxx|Alt |Gui| 181 * |Gui |Alt |xxxxxxxxxxxxxxxxxxxxxxx|Alt |Gui|
182 * `--------------------------------------------' 182 * `--------------------------------------------'
183 */ 183 */
184/*
185 KEYMAP(MINS,0, 9, 8, 7, 6, 5, 4, 3, 2, 1, NO, NO, NO, ESC, \ 184 KEYMAP(MINS,0, 9, 8, 7, 6, 5, 4, 3, 2, 1, NO, NO, NO, ESC, \
186 BSPC,P, O, I, U, Y, T, R, E, W, Q, NO, NO, TAB, \ 185 BSPC,P, O, I, U, Y, T, R, E, W, Q, NO, NO, TAB, \
187 LCTL,SCLN,L, K, J, H, G, F, D, S, A, RCTL,RCTL, \ 186 LCTL,SCLN,L, K, J, H, G, F, D, S, A, RCTL,RCTL, \
188 LSFT,SLSH,DOT, COMM,M, N, B, V, C, X, Z, RSFT,NO, \ 187 LSFT,SLSH,DOT, COMM,M, N, B, V, C, X, Z, RSFT,NO, \
189 LGUI,LALT, FN5, RALT,RGUI) 188 LGUI,LALT, FN5, RALT,RGUI),
190*/ 189
191 /* Mouse mode (Space) */ 190 /* Layer5: another Mouse mode (Space) */
192#ifdef HOST_IWRAP 191#ifdef HOST_IWRAP
193 KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ 192 KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
194 TAB, KPAS,KPPL,MS_U,KPMI,KPSL,KPAS,KPPL,KPMI,KPSL,NO, NO, NO, BSPC, \ 193 TAB, KPAS,KPPL,MS_U,KPMI,KPSL,KPAS,KPPL,KPMI,KPSL,NO, NO, NO, BSPC, \