From 373ab0e7192811944786c095facb80938c33f1d5 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 9 Oct 2012 14:36:13 +0900 Subject: Add keycode.h and remove usb_keycodes.h. --- common/keycode.h | 441 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 441 insertions(+) create mode 100644 common/keycode.h (limited to 'common/keycode.h') 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 @@ +/* +Copyright 2011,2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +/* + * Keycodes based on HID Usage Keyboard/Keypad Page(0x07) plus special codes + * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf + */ +#ifndef KEYCODE_H +#define KEYCODE_H + + +#define IS_ERROR(code) (KC_ROLL_OVER <= (code) && (code) <= KC_UNDEFINED) +#define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF) +#define IS_KEY(code) (KC_A <= (code) && (code) <= KC_EXSEL) +#define IS_MOD(code) (KC_LCTRL <= (code) && (code) <= KC_RGUI) + +#define IS_FN(code) (KC_FN0 <= (code) && (code) <= KC_FN7) +#define IS_MOUSEKEY(code) (KC_MS_UP <= (code) && (code) <= KC_MS_WH_RIGHT) +#define IS_MOUSEKEY_MOVE(code) (KC_MS_UP <= (code) && (code) <= KC_MS_RIGHT) +#define IS_MOUSEKEY_BUTTON(code) (KC_MS_BTN1 <= (code) && (code) <= KC_MS_BTN5) +#define IS_MOUSEKEY_WHEEL(code) (KC_MS_WH_UP <= (code) && (code) <= KC_MS_WH_RIGHT) + +#define IS_SPECIAL(code) ((0xB0 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF)) +#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_WFAV) +#define IS_SYSTEM(code) (KC_POWER <= (code) && (code) <= KC_WAKE) + +#define MOD_BIT(code) (1< */ + KC_SLASH, /* / and ? */ + KC_CAPSLOCK, + KC_F1, + KC_F2, + KC_F3, + KC_F4, + KC_F5, + KC_F6, + KC_F7, /* 0x40 */ + KC_F8, + KC_F9, + KC_F10, + KC_F11, + KC_F12, + KC_PSCREEN, + KC_SCKLOCK, + KC_PAUSE, + KC_INSERT, + KC_HOME, + KC_PGUP, + KC_DELETE, + KC_END, + KC_PGDOWN, + KC_RIGHT, + KC_LEFT, /* 0x50 */ + KC_DOWN, + KC_UP, + KC_NUMLOCK, + KC_KP_SLASH, + KC_KP_ASTERISK, + KC_KP_MINUS, + KC_KP_PLUS, + KC_KP_ENTER, + KC_KP_1, + KC_KP_2, + KC_KP_3, + KC_KP_4, + KC_KP_5, + KC_KP_6, + KC_KP_7, + KC_KP_8, /* 0x60 */ + KC_KP_9, + KC_KP_0, + KC_KP_DOT, + KC_NONUS_BSLASH, /* Non-US \ and | */ + KC_APPLICATION, + KC_POWER, + KC_KP_EQUAL, + KC_F13, + KC_F14, + KC_F15, + KC_F16, + KC_F17, + KC_F18, + KC_F19, + KC_F20, + KC_F21, /* 0x70 */ + KC_F22, + KC_F23, + KC_F24, + KC_EXECUTE, + KC_HELP, + KC_MENU, + KC_SELECT, + KC_STOP, + KC_AGAIN, + KC_UNDO, + KC_CUT, + KC_COPY, + KC_PASTE, + KC_FIND, + KC__MUTE, + KC__VOLUP, /* 0x80 */ + KC__VOLDOWN, + KC_LOCKING_CAPS, /* locking Caps Lock */ + KC_LOCKING_NUM, /* locking Num Lock */ + KC_LOCKING_SCROLL, /* locking Scroll Lock */ + KC_KP_COMMA, + KC_KP_EQUAL_AS400, /* equal sign on AS/400 */ + KC_INT1, + KC_INT2, + KC_INT3, + KC_INT4, + KC_INT5, + KC_INT6, + KC_INT7, + KC_INT8, + KC_INT9, + KC_LANG1, /* 0x90 */ + KC_LANG2, + KC_LANG3, + KC_LANG4, + KC_LANG5, + KC_LANG6, + KC_LANG7, + KC_LANG8, + KC_LANG9, + KC_ALT_ERASE, + KC_SYSREQ, + KC_CANCEL, + KC_CLEAR, + KC_PRIOR, + KC_RETURN, + KC_SEPARATOR, + KC_OUT, /* 0xA0 */ + KC_OPER, + KC_CLEAR_AGAIN, + KC_CRSEL, + KC_EXSEL, /* 0xA4 */ + + /* NOTE: 0xA5-DF are used for internal special purpose */ + +#if 0 + /* NOTE: Following codes(0xB0-DD) are not used. Leave them for reference. */ + KC_KP_00 = 0xB0, + KC_KP_000, + KC_THOUSANDS_SEPARATOR, + KC_DECIMAL_SEPARATOR, + KC_CURRENCY_UNIT, + KC_CURRENCY_SUB_UNIT, + KC_KP_LPAREN, + KC_KP_RPAREN, + KC_KP_LCBRACKET, /* { */ + KC_KP_RCBRACKET, /* } */ + KC_KP_TAB, + KC_KP_BSPACE, + KC_KP_A, + KC_KP_B, + KC_KP_C, + KC_KP_D, + KC_KP_E, /* 0xC0 */ + KC_KP_F, + KC_KP_XOR, + KC_KP_HAT, + KC_KP_PERC, + KC_KP_LT, + KC_KP_GT, + KC_KP_AND, + KC_KP_LAZYAND, + KC_KP_OR, + KC_KP_LAZYOR, + KC_KP_COLON, + KC_KP_HASH, + KC_KP_SPACE, + KC_KP_ATMARK, + KC_KP_EXCLAMATION, + KC_KP_MEM_STORE, /* 0xD0 */ + KC_KP_MEM_RECALL, + KC_KP_MEM_CLEAR, + KC_KP_MEM_ADD, + KC_KP_MEM_SUB, + KC_KP_MEM_MUL, + KC_KP_MEM_DIV, + KC_KP_PLUS_MINUS, + KC_KP_CLEAR, + KC_KP_CLEAR_ENTRY, + KC_KP_BINARY, + KC_KP_OCTAL, + KC_KP_DECIMAL, + KC_KP_HEXADECIMAL, /* 0xDD */ +#endif + + /* Modifiers */ + KC_LCTRL = 0xE0, + KC_LSHIFT, + KC_LALT, + KC_LGUI, + KC_RCTRL, + KC_RSHIFT, + KC_RALT, + KC_RGUI, + + /* NOTE: 0xE8-FF are used for internal special purpose */ +}; + +/* Special keycodes */ +/* NOTE: 0xA5-DF and 0xE8-FF are used for internal special purpose */ +enum internal_special_keycodes { + /* System Control */ + KC_SYSTEM_POWER = 0xA5, + KC_SYSTEM_SLEEP, + KC_SYSTEM_WAKE, /* 0xA7 */ + /* 0xA8-AF */ + + /* Consumer Page */ + KC_AUDIO_MUTE = 0xB0, + KC_AUDIO_VOL_UP, + KC_AUDIO_VOL_DOWN, + KC_MEDIA_NEXT_TRACK, + KC_MEDIA_PREV_TRACK, + KC_MEDIA_STOP, + KC_MEDIA_PLAY_PAUSE, + KC_MEDIA_SELECT, + KC_MAIL, + KC_CALCULATOR, + KC_MY_COMPUTER, + KC_WWW_SEARCH, + KC_WWW_HOME, + KC_WWW_BACK, + KC_WWW_FORWARD, + KC_WWW_STOP, + KC_WWW_REFRESH, /* 0xC0 */ + KC_WWW_FAVORITES, /* 0xC1 */ + /* 0xC2-DF vacant for future use */ + + /* 0xE0-E7 for Modifiers. DO NOT USE. */ + + /* Layer Switching */ + KC_FN0 = 0xE8, + KC_FN1, + KC_FN2, + KC_FN3, + KC_FN4, + KC_FN5, + KC_FN6, + KC_FN7, /* 0xEF */ + + /* Mousekey */ + KC_MS_UP = 0xF0, + KC_MS_DOWN, + KC_MS_LEFT, + KC_MS_RIGHT, + KC_MS_BTN1, + KC_MS_BTN2, + KC_MS_BTN3, + KC_MS_BTN4, + KC_MS_BTN5, + /* Mousekey wheel */ + KC_MS_WH_UP, + KC_MS_WH_DOWN, + KC_MS_WH_LEFT, + KC_MS_WH_RIGHT, /* 0xFC */ + /* 0xFD-FF vacant for future use */ +}; + +#endif /* KEYCODE_H */ -- cgit v1.2.3-24-g4f1b