Merge branch 'layerfix'
commit
3c822b511e
@ -0,0 +1,448 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
|
||||||
|
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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_ACCEL2)
|
||||||
|
#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_MOUSEKEY_ACCEL(code) (KC_MS_ACCEL0 <= (code) && (code) <= KC_MS_ACCEL2)
|
||||||
|
|
||||||
|
#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<<MOD_INDEX(code))
|
||||||
|
#define MOD_INDEX(code) ((code) & 0x07)
|
||||||
|
#define FN_BIT(code) (1<<FN_INDEX(code))
|
||||||
|
#define FN_INDEX(code) ((code) - KC_FN0)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Short names for ease of definition of keymap
|
||||||
|
*/
|
||||||
|
#define KC_LCTL KC_LCTRL
|
||||||
|
#define KC_RCTL KC_RCTRL
|
||||||
|
#define KC_LSFT KC_LSHIFT
|
||||||
|
#define KC_RSFT KC_RSHIFT
|
||||||
|
#define KC_ESC KC_ESCAPE
|
||||||
|
#define KC_BSPC KC_BSPACE
|
||||||
|
#define KC_ENT KC_ENTER
|
||||||
|
#define KC_DEL KC_DELETE
|
||||||
|
#define KC_INS KC_INSERT
|
||||||
|
#define KC_CAPS KC_CAPSLOCK
|
||||||
|
#define KC_RGHT KC_RIGHT
|
||||||
|
#define KC_PGDN KC_PGDOWN
|
||||||
|
#define KC_PSCR KC_PSCREEN
|
||||||
|
#define KC_SLCK KC_SCKLOCK
|
||||||
|
#define KC_PAUS KC_PAUSE
|
||||||
|
#define KC_BRK KC_PAUSE
|
||||||
|
#define KC_NLCK KC_NUMLOCK
|
||||||
|
#define KC_SPC KC_SPACE
|
||||||
|
#define KC_MINS KC_MINUS
|
||||||
|
#define KC_EQL KC_EQUAL
|
||||||
|
#define KC_GRV KC_GRAVE
|
||||||
|
#define KC_RBRC KC_RBRACKET
|
||||||
|
#define KC_LBRC KC_LBRACKET
|
||||||
|
#define KC_COMM KC_COMMA
|
||||||
|
#define KC_BSLS KC_BSLASH
|
||||||
|
#define KC_SLSH KC_SLASH
|
||||||
|
#define KC_SCLN KC_SCOLON
|
||||||
|
#define KC_QUOT KC_QUOTE
|
||||||
|
#define KC_APP KC_APPLICATION
|
||||||
|
#define KC_NUHS KC_NONUS_HASH
|
||||||
|
#define KC_NUBS KC_NONUS_BSLASH
|
||||||
|
#define KC_ERAS KC_ALT_ERASE,
|
||||||
|
#define KC_CLR KC_CLEAR
|
||||||
|
/* Japanese specific */
|
||||||
|
#define KC_ZKHK KC_GRAVE
|
||||||
|
#define KC_RO KC_INT1
|
||||||
|
#define KC_KANA KC_INT2
|
||||||
|
#define KC_JYEN KC_INT3
|
||||||
|
#define KC_HENK KC_INT4
|
||||||
|
#define KC_MHEN KC_INT5
|
||||||
|
/* Keypad */
|
||||||
|
#define KC_P1 KC_KP_1
|
||||||
|
#define KC_P2 KC_KP_2
|
||||||
|
#define KC_P3 KC_KP_3
|
||||||
|
#define KC_P4 KC_KP_4
|
||||||
|
#define KC_P5 KC_KP_5
|
||||||
|
#define KC_P6 KC_KP_6
|
||||||
|
#define KC_P7 KC_KP_7
|
||||||
|
#define KC_P8 KC_KP_8
|
||||||
|
#define KC_P9 KC_KP_9
|
||||||
|
#define KC_P0 KC_KP_0
|
||||||
|
#define KC_PDOT KC_KP_DOT
|
||||||
|
#define KC_PCMM KC_KP_COMMA
|
||||||
|
#define KC_PSLS KC_KP_SLASH
|
||||||
|
#define KC_PAST KC_KP_ASTERISK
|
||||||
|
#define KC_PMNS KC_KP_MINUS
|
||||||
|
#define KC_PPLS KC_KP_PLUS
|
||||||
|
#define KC_PEQL KC_KP_EQUAL
|
||||||
|
#define KC_PENT KC_KP_ENTER
|
||||||
|
/* Mousekey */
|
||||||
|
#define KC_MS_U KC_MS_UP
|
||||||
|
#define KC_MS_D KC_MS_DOWN
|
||||||
|
#define KC_MS_L KC_MS_LEFT
|
||||||
|
#define KC_MS_R KC_MS_RIGHT
|
||||||
|
#define KC_BTN1 KC_MS_BTN1
|
||||||
|
#define KC_BTN2 KC_MS_BTN2
|
||||||
|
#define KC_BTN3 KC_MS_BTN3
|
||||||
|
#define KC_BTN4 KC_MS_BTN4
|
||||||
|
#define KC_BTN5 KC_MS_BTN5
|
||||||
|
#define KC_WH_U KC_MS_WH_UP
|
||||||
|
#define KC_WH_D KC_MS_WH_DOWN
|
||||||
|
#define KC_WH_L KC_MS_WH_LEFT
|
||||||
|
#define KC_WH_R KC_MS_WH_RIGHT
|
||||||
|
#define KC_ACL0 KC_MS_ACCEL0
|
||||||
|
#define KC_ACL1 KC_MS_ACCEL1
|
||||||
|
#define KC_ACL2 KC_MS_ACCEL2
|
||||||
|
/* Sytem Control */
|
||||||
|
#define KC_PWR KC_SYSTEM_POWER
|
||||||
|
#define KC_SLEP KC_SYSTEM_SLEEP
|
||||||
|
#define KC_WAKE KC_SYSTEM_WAKE
|
||||||
|
/* Consumer Page */
|
||||||
|
#define KC_MUTE KC_AUDIO_MUTE
|
||||||
|
#define KC_VOLU KC_AUDIO_VOL_UP
|
||||||
|
#define KC_VOLD KC_AUDIO_VOL_DOWN
|
||||||
|
#define KC_MNXT KC_MEDIA_NEXT_TRACK
|
||||||
|
#define KC_MPRV KC_MEDIA_PREV_TRACK
|
||||||
|
#define KC_MSTP KC_MEDIA_STOP
|
||||||
|
#define KC_MPLY KC_MEDIA_PLAY_PAUSE
|
||||||
|
#define KC_MSEL KC_MEDIA_SELECT
|
||||||
|
#define KC_MAIL KC_MAIL
|
||||||
|
#define KC_CALC KC_CALCULATOR
|
||||||
|
#define KC_MYCM KC_MY_COMPUTER
|
||||||
|
#define KC_WSCH KC_WWW_SEARCH
|
||||||
|
#define KC_WHOM KC_WWW_HOME
|
||||||
|
#define KC_WBAK KC_WWW_BACK
|
||||||
|
#define KC_WFWD KC_WWW_FORWARD
|
||||||
|
#define KC_WSTP KC_WWW_STOP
|
||||||
|
#define KC_WREF KC_WWW_REFRESH
|
||||||
|
#define KC_WFAV KC_WWW_FAVORITES
|
||||||
|
|
||||||
|
|
||||||
|
/* USB HID Keyboard/Keypad Usage(0x07) */
|
||||||
|
enum hid_keyboard_keypad_usage {
|
||||||
|
KC_NO = 0x00,
|
||||||
|
KC_ROLL_OVER,
|
||||||
|
KC_POST_FAIL,
|
||||||
|
KC_UNDEFINED,
|
||||||
|
KC_A,
|
||||||
|
KC_B,
|
||||||
|
KC_C,
|
||||||
|
KC_D,
|
||||||
|
KC_E,
|
||||||
|
KC_F,
|
||||||
|
KC_G,
|
||||||
|
KC_H,
|
||||||
|
KC_I,
|
||||||
|
KC_J,
|
||||||
|
KC_K,
|
||||||
|
KC_L,
|
||||||
|
KC_M, /* 0x10 */
|
||||||
|
KC_N,
|
||||||
|
KC_O,
|
||||||
|
KC_P,
|
||||||
|
KC_Q,
|
||||||
|
KC_R,
|
||||||
|
KC_S,
|
||||||
|
KC_T,
|
||||||
|
KC_U,
|
||||||
|
KC_V,
|
||||||
|
KC_W,
|
||||||
|
KC_X,
|
||||||
|
KC_Y,
|
||||||
|
KC_Z,
|
||||||
|
KC_1,
|
||||||
|
KC_2,
|
||||||
|
KC_3, /* 0x20 */
|
||||||
|
KC_4,
|
||||||
|
KC_5,
|
||||||
|
KC_6,
|
||||||
|
KC_7,
|
||||||
|
KC_8,
|
||||||
|
KC_9,
|
||||||
|
KC_0,
|
||||||
|
KC_ENTER,
|
||||||
|
KC_ESCAPE,
|
||||||
|
KC_BSPACE,
|
||||||
|
KC_TAB,
|
||||||
|
KC_SPACE,
|
||||||
|
KC_MINUS,
|
||||||
|
KC_EQUAL,
|
||||||
|
KC_LBRACKET,
|
||||||
|
KC_RBRACKET, /* 0x30 */
|
||||||
|
KC_BSLASH, /* \ (and |) */
|
||||||
|
KC_NONUS_HASH, /* Non-US # and ~ */
|
||||||
|
KC_SCOLON, /* ; (and :) */
|
||||||
|
KC_QUOTE, /* ' and " */
|
||||||
|
KC_GRAVE, /* Grave accent and tilde */
|
||||||
|
KC_COMMA, /* , and < */
|
||||||
|
KC_DOT, /* . and > */
|
||||||
|
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, /* 0xF8 */
|
||||||
|
/* Mousekey wheel */
|
||||||
|
KC_MS_WH_UP,
|
||||||
|
KC_MS_WH_DOWN,
|
||||||
|
KC_MS_WH_LEFT,
|
||||||
|
KC_MS_WH_RIGHT, /* 0xFC */
|
||||||
|
/* Mousekey accel */
|
||||||
|
KC_MS_ACCEL0,
|
||||||
|
KC_MS_ACCEL1,
|
||||||
|
KC_MS_ACCEL2 /* 0xFF */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* KEYCODE_H */
|
@ -1,207 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "keymap.h"
|
|
||||||
#include "host.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "timer.h"
|
|
||||||
#include "usb_keycodes.h"
|
|
||||||
#include "layer.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Parameters:
|
|
||||||
* SWITCH_DELAY |=======|
|
|
||||||
* SEND_FN_TERM |================|
|
|
||||||
*
|
|
||||||
* Fn key processing cases:
|
|
||||||
* 1. release Fn after SEND_FN_TERM.
|
|
||||||
* Layer sw ___________|~~~~~~~~~~~|___
|
|
||||||
* Fn press ___|~~~~~~~~~~~~~~~~~~~|___
|
|
||||||
* Fn send ___________________________
|
|
||||||
*
|
|
||||||
* 2. release Fn during SEND_FN_TERM.(not layer used)
|
|
||||||
* Layer sw ___________|~~~~~~|________
|
|
||||||
* Fn press ___|~~~~~~~~~~~~~~|________
|
|
||||||
* Fn key send __________________|~|______
|
|
||||||
* other key press ___________________________
|
|
||||||
* other key send ___________________________
|
|
||||||
*
|
|
||||||
* 3. release Fn during SEND_FN_TERM.(layer used)
|
|
||||||
* Layer sw ___________|~~~~~~|________
|
|
||||||
* Fn press ___|~~~~~~~~~~~~~~|________
|
|
||||||
* Fn key send ___________________________
|
|
||||||
* Fn send ___________________________
|
|
||||||
* other key press _____________|~~|__________
|
|
||||||
* other key send _____________|~~|__________
|
|
||||||
*
|
|
||||||
* 4. press other key during SWITCH_DELAY.
|
|
||||||
* Layer sw ___________________________
|
|
||||||
* Fn key press ___|~~~~~~~~~|_____________
|
|
||||||
* Fn key send ______|~~~~~~|_____________
|
|
||||||
* other key press ______|~~~|________________
|
|
||||||
* other key send _______|~~|________________
|
|
||||||
*
|
|
||||||
* 5. press Fn while press other key.
|
|
||||||
* Layer sw ___________________________
|
|
||||||
* Fn key press ___|~~~~~~~~~|_____________
|
|
||||||
* Fn key send ___|~~~~~~~~~|_____________
|
|
||||||
* other key press ~~~~~~~|___________________
|
|
||||||
* other key send ~~~~~~~|___________________
|
|
||||||
*
|
|
||||||
* 6. press Fn twice quickly and keep holding down.(repeat)
|
|
||||||
* Layer sw ___________________________
|
|
||||||
* Fn key press ___|~|____|~~~~~~~~~~~~~~~~
|
|
||||||
* Fn key send _____|~|__|~~~~~~~~~~~~~~~~
|
|
||||||
*/
|
|
||||||
|
|
||||||
// LAYER_SWITCH_DELAY: prevent from moving to new layer
|
|
||||||
#ifndef LAYER_SWITCH_DELAY
|
|
||||||
# define LAYER_SWITCH_DELAY 150
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// LAYER_SEND_FN_TERM: send keycode if release key in this term
|
|
||||||
#ifndef LAYER_SEND_FN_TERM
|
|
||||||
# define LAYER_SEND_FN_TERM 500
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t default_layer = 0;
|
|
||||||
uint8_t current_layer = 0;
|
|
||||||
|
|
||||||
static bool layer_used = false;
|
|
||||||
static uint8_t new_layer(uint8_t fn_bits);
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t layer_get_keycode(uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
uint8_t code = keymap_get_keycode(current_layer, row, col);
|
|
||||||
// normal key or mouse key
|
|
||||||
if ((IS_KEY(code) || IS_MOUSEKEY(code))) {
|
|
||||||
layer_used = true;
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
// bit substract b from a
|
|
||||||
#define BIT_SUBST(a, b) (a&(a^b))
|
|
||||||
void layer_switching(uint8_t fn_bits)
|
|
||||||
{
|
|
||||||
// layer switching
|
|
||||||
static uint8_t last_fn = 0;
|
|
||||||
static uint8_t last_mods = 0;
|
|
||||||
static uint16_t last_timer = 0;
|
|
||||||
static uint8_t sent_fn = 0;
|
|
||||||
|
|
||||||
if (fn_bits == last_fn) { // Fn state is not changed
|
|
||||||
if (fn_bits == 0) {
|
|
||||||
// do nothing
|
|
||||||
} else {
|
|
||||||
if (!keymap_fn_keycode(BIT_SUBST(fn_bits, sent_fn)) ||
|
|
||||||
timer_elapsed(last_timer) > LAYER_SWITCH_DELAY) {
|
|
||||||
uint8_t _layer_to_switch = new_layer(BIT_SUBST(fn_bits, sent_fn));
|
|
||||||
if (current_layer != _layer_to_switch) { // not switch layer yet
|
|
||||||
debug("Fn case: 1,2,3(LAYER_SWITCH_DELAY passed)\n");
|
|
||||||
debug("Switch Layer: "); debug_hex(current_layer);
|
|
||||||
current_layer = _layer_to_switch;
|
|
||||||
layer_used = false;
|
|
||||||
debug(" -> "); debug_hex(current_layer); debug("\n");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (host_has_anykey()) { // other keys is pressed
|
|
||||||
uint8_t _fn_to_send = BIT_SUBST(fn_bits, sent_fn);
|
|
||||||
if (_fn_to_send) {
|
|
||||||
debug("Fn case: 4(press other key during SWITCH_DELAY.)\n");
|
|
||||||
// send only Fn key first
|
|
||||||
uint8_t tmp_mods = keyboard_report->mods;
|
|
||||||
host_add_code(keymap_fn_keycode(_fn_to_send));
|
|
||||||
host_set_mods(last_mods);
|
|
||||||
host_send_keyboard_report();
|
|
||||||
host_set_mods(tmp_mods);
|
|
||||||
host_del_code(keymap_fn_keycode(_fn_to_send));
|
|
||||||
sent_fn |= _fn_to_send;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// add Fn keys to send
|
|
||||||
//host_add_code(keymap_fn_keycode(fn_bits&sent_fn)); // TODO: do all Fn keys
|
|
||||||
}
|
|
||||||
} else { // Fn state is changed(edge)
|
|
||||||
uint8_t fn_changed = 0;
|
|
||||||
|
|
||||||
debug("fn_bits: "); debug_bin(fn_bits); debug("\n");
|
|
||||||
debug("sent_fn: "); debug_bin(sent_fn); debug("\n");
|
|
||||||
debug("last_fn: "); debug_bin(last_fn); debug("\n");
|
|
||||||
debug("last_mods: "); debug_hex(last_mods); debug("\n");
|
|
||||||
debug("last_timer: "); debug_hex16(last_timer); debug("\n");
|
|
||||||
debug("timer_count: "); debug_hex16(timer_count); debug("\n");
|
|
||||||
|
|
||||||
// pressed Fn
|
|
||||||
if ((fn_changed = BIT_SUBST(fn_bits, last_fn))) {
|
|
||||||
debug("fn_changed: "); debug_bin(fn_changed); debug("\n");
|
|
||||||
if (host_has_anykey()) {
|
|
||||||
debug("Fn case: 5(pressed Fn with other key)\n");
|
|
||||||
sent_fn |= fn_changed;
|
|
||||||
} else if (fn_changed & sent_fn) { // pressed same Fn in a row
|
|
||||||
if (timer_elapsed(last_timer) > LAYER_SEND_FN_TERM) {
|
|
||||||
debug("Fn case: 6(not repeat)\n");
|
|
||||||
// time passed: not repeate
|
|
||||||
sent_fn &= ~fn_changed;
|
|
||||||
} else {
|
|
||||||
debug("Fn case: 6(repeat)\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// released Fn
|
|
||||||
if ((fn_changed = BIT_SUBST(last_fn, fn_bits))) {
|
|
||||||
debug("fn_changed: "); debug_bin(fn_changed); debug("\n");
|
|
||||||
if (timer_elapsed(last_timer) < LAYER_SEND_FN_TERM) {
|
|
||||||
if (!layer_used && BIT_SUBST(fn_changed, sent_fn)) {
|
|
||||||
debug("Fn case: 2(send Fn one shot: released Fn during LAYER_SEND_FN_TERM)\n");
|
|
||||||
// send only Fn key first
|
|
||||||
uint8_t tmp_mods = keyboard_report->mods;
|
|
||||||
host_add_code(keymap_fn_keycode(fn_changed));
|
|
||||||
host_set_mods(last_mods);
|
|
||||||
host_send_keyboard_report();
|
|
||||||
host_set_mods(tmp_mods);
|
|
||||||
host_del_code(keymap_fn_keycode(fn_changed));
|
|
||||||
sent_fn |= fn_changed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
debug("Switch Layer(released Fn): "); debug_hex(current_layer);
|
|
||||||
current_layer = new_layer(BIT_SUBST(fn_bits, sent_fn));
|
|
||||||
debug(" -> "); debug_hex(current_layer); debug("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
layer_used = false;
|
|
||||||
last_fn = fn_bits;
|
|
||||||
last_mods = keyboard_report->mods;
|
|
||||||
last_timer = timer_read();
|
|
||||||
}
|
|
||||||
// send Fn keys
|
|
||||||
for (uint8_t i = 0; i < 8; i++) {
|
|
||||||
if ((sent_fn & fn_bits) & (1<<i)) {
|
|
||||||
host_add_code(keymap_fn_keycode(1<<i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
static uint8_t new_layer(uint8_t fn_bits)
|
|
||||||
{
|
|
||||||
return (fn_bits ? keymap_fn_layer(fn_bits) : default_layer);
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LAYER_H
|
|
||||||
#define LAYER_H 1
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
extern uint8_t default_layer;
|
|
||||||
extern uint8_t current_layer;
|
|
||||||
|
|
||||||
/* return keycode for switch */
|
|
||||||
uint8_t layer_get_keycode(uint8_t row, uint8_t col);
|
|
||||||
|
|
||||||
/* process layer switching */
|
|
||||||
void layer_switching(uint8_t fn_bits);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,424 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Key codes: HID Keyboard/Keypad Page(0x07)
|
|
||||||
* http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
|
|
||||||
*/
|
|
||||||
#ifndef USB_KEYCODES_H
|
|
||||||
#define USB_KEYCODES_H
|
|
||||||
|
|
||||||
|
|
||||||
#define IS_ERROR(code) (KB_ROLL_OVER <= (code) && (code) <= KB_UNDEFINED)
|
|
||||||
#define IS_ANY(code) (KB_A <= (code))
|
|
||||||
#define IS_KEY(code) (KB_A <= (code) && (code) <= KB_EXSEL)
|
|
||||||
#define IS_MOD(code) (KB_LCTRL <= (code) && (code) <= KB_RGUI)
|
|
||||||
#define IS_FN(code) (KB_FN0 <= (code) && (code) <= KB_FN7)
|
|
||||||
#define IS_MOUSEKEY(code) (KB_MS_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
|
|
||||||
#define IS_MOUSEKEY_MOVE(code) (KB_MS_UP <= (code) && (code) <= KB_MS_RIGHT)
|
|
||||||
#define IS_MOUSEKEY_BUTTON(code) (KB_MS_BTN1 <= (code) && (code) <= KB_MS_BTN5)
|
|
||||||
#define IS_MOUSEKEY_WHEEL(code) (KB_MS_WH_UP <= (code) && (code) <= KB_MS_WH_RIGHT)
|
|
||||||
|
|
||||||
#define MOD_BIT(code) (1<<((code) & 0x07))
|
|
||||||
#define FN_BIT(code) (1<<((code) - KB_FN0))
|
|
||||||
|
|
||||||
|
|
||||||
/* Short names */
|
|
||||||
#define KB_LCTL KB_LCTRL
|
|
||||||
#define KB_RCTL KB_RCTRL
|
|
||||||
#define KB_LSFT KB_LSHIFT
|
|
||||||
#define KB_RSFT KB_RSHIFT
|
|
||||||
#define KB_ESC KB_ESCAPE
|
|
||||||
#define KB_BSPC KB_BSPACE
|
|
||||||
#define KB_ENT KB_ENTER
|
|
||||||
#define KB_DEL KB_DELETE
|
|
||||||
#define KB_INS KB_INSERT
|
|
||||||
#define KB_CAPS KB_CAPSLOCK
|
|
||||||
#define KB_RGHT KB_RIGHT
|
|
||||||
#define KB_PGDN KB_PGDOWN
|
|
||||||
#define KB_PSCR KB_PSCREEN
|
|
||||||
#define KB_SLCK KB_SCKLOCK
|
|
||||||
#define KB_PAUS KB_PAUSE
|
|
||||||
#define KB_BRK KB_PAUSE
|
|
||||||
#define KB_NLCK KB_NUMLOCK
|
|
||||||
#define KB_SPC KB_SPACE
|
|
||||||
#define KB_MINS KB_MINUS
|
|
||||||
#define KB_EQL KB_EQUAL
|
|
||||||
#define KB_GRV KB_GRAVE
|
|
||||||
#define KB_RBRC KB_RBRACKET
|
|
||||||
#define KB_LBRC KB_LBRACKET
|
|
||||||
#define KB_COMM KB_COMMA
|
|
||||||
#define KB_BSLS KB_BSLASH
|
|
||||||
#define KB_SLSH KB_SLASH
|
|
||||||
#define KB_SCLN KB_SCOLON
|
|
||||||
#define KB_QUOT KB_QUOTE
|
|
||||||
#define KB_APP KB_APPLICATION
|
|
||||||
#define KB_NUHS KB_NONUS_HASH
|
|
||||||
#define KB_NUBS KB_NONUS_BSLASH
|
|
||||||
#define KB_ERAS KB_ALT_ERASE,
|
|
||||||
#define KB_CLR KB_CLEAR
|
|
||||||
/* for Japanese */
|
|
||||||
#define KB_ZKHK KB_GRAVE
|
|
||||||
#define KB_RO KB_INT1
|
|
||||||
#define KB_KANA KB_INT2
|
|
||||||
#define KB_JYEN KB_INT3
|
|
||||||
#define KB_HENK KB_INT4
|
|
||||||
#define KB_MHEN KB_INT5
|
|
||||||
/* Keypad */
|
|
||||||
#define KB_P1 KB_KP_1
|
|
||||||
#define KB_P2 KB_KP_2
|
|
||||||
#define KB_P3 KB_KP_3
|
|
||||||
#define KB_P4 KB_KP_4
|
|
||||||
#define KB_P5 KB_KP_5
|
|
||||||
#define KB_P6 KB_KP_6
|
|
||||||
#define KB_P7 KB_KP_7
|
|
||||||
#define KB_P8 KB_KP_8
|
|
||||||
#define KB_P9 KB_KP_9
|
|
||||||
#define KB_P0 KB_KP_0
|
|
||||||
#define KB_PDOT KB_KP_DOT
|
|
||||||
#define KB_PCMM KB_KP_COMMA
|
|
||||||
#define KB_PSLS KB_KP_SLASH
|
|
||||||
#define KB_PAST KB_KP_ASTERISK
|
|
||||||
#define KB_PMNS KB_KP_MINUS
|
|
||||||
#define KB_PPLS KB_KP_PLUS
|
|
||||||
#define KB_PEQL KB_KP_EQUAL
|
|
||||||
#define KB_PENT KB_KP_ENTER
|
|
||||||
/* Mousekey */
|
|
||||||
#define KB_MS_U KB_MS_UP
|
|
||||||
#define KB_MS_D KB_MS_DOWN
|
|
||||||
#define KB_MS_L KB_MS_LEFT
|
|
||||||
#define KB_MS_R KB_MS_RIGHT
|
|
||||||
#define KB_BTN1 KB_MS_BTN1
|
|
||||||
#define KB_BTN2 KB_MS_BTN2
|
|
||||||
#define KB_BTN3 KB_MS_BTN3
|
|
||||||
#define KB_BTN4 KB_MS_BTN4
|
|
||||||
#define KB_BTN5 KB_MS_BTN5
|
|
||||||
#define KB_WH_U KB_MS_WH_UP
|
|
||||||
#define KB_WH_D KB_MS_WH_DOWN
|
|
||||||
#define KB_WH_L KB_MS_WH_LEFT
|
|
||||||
#define KB_WH_R KB_MS_WH_RIGHT
|
|
||||||
/* Sytem Control & Consumer usage */
|
|
||||||
#define KB_PWR KB_SYSTEM_POWER
|
|
||||||
#define KB_SLEP KB_SYSTEM_SLEEP
|
|
||||||
#define KB_WAKE KB_SYSTEM_WAKE
|
|
||||||
#define KB_MUTE KB_AUDIO_MUTE
|
|
||||||
#define KB_VOLU KB_AUDIO_VOL_UP
|
|
||||||
#define KB_VOLD KB_AUDIO_VOL_DOWN
|
|
||||||
#define KB_MNXT KB_MEDIA_NEXT_TRACK
|
|
||||||
#define KB_MPRV KB_MEDIA_PREV_TRACK
|
|
||||||
#define KB_MSTP KB_MEDIA_STOP
|
|
||||||
#define KB_MPLY KB_MEDIA_PLAY_PAUSE
|
|
||||||
#define KB_MSEL KB_MEDIA_SELECT
|
|
||||||
#define KB_MAIL KB_MAIL
|
|
||||||
#define KB_CALC KB_CALCULATOR
|
|
||||||
#define KB_MYCM KB_MY_COMPUTER
|
|
||||||
#define KB_WSCH KB_WWW_SEARCH
|
|
||||||
#define KB_WHOM KB_WWW_HOME
|
|
||||||
#define KB_WBAK KB_WWW_BACK
|
|
||||||
#define KB_WFWD KB_WWW_FORWARD
|
|
||||||
#define KB_WSTP KB_WWW_STOP
|
|
||||||
#define KB_WREF KB_WWW_REFRESH
|
|
||||||
#define KB_WFAV KB_WWW_FAVORITES
|
|
||||||
|
|
||||||
|
|
||||||
/* Special keycode */
|
|
||||||
enum special_keycodes {
|
|
||||||
/* System Control */
|
|
||||||
KB_SYSTEM_POWER = 0xB0,
|
|
||||||
KB_SYSTEM_SLEEP,
|
|
||||||
KB_SYSTEM_WAKE,
|
|
||||||
|
|
||||||
/* Consumer Page */
|
|
||||||
KB_AUDIO_MUTE,
|
|
||||||
KB_AUDIO_VOL_UP,
|
|
||||||
KB_AUDIO_VOL_DOWN,
|
|
||||||
KB_MEDIA_NEXT_TRACK,
|
|
||||||
KB_MEDIA_PREV_TRACK,
|
|
||||||
KB_MEDIA_STOP,
|
|
||||||
KB_MEDIA_PLAY_PAUSE,
|
|
||||||
KB_MEDIA_SELECT,
|
|
||||||
KB_MAIL,
|
|
||||||
KB_CALCULATOR,
|
|
||||||
KB_MY_COMPUTER,
|
|
||||||
KB_WWW_SEARCH,
|
|
||||||
KB_WWW_HOME,
|
|
||||||
KB_WWW_BACK, /* 0xC0 */
|
|
||||||
KB_WWW_FORWARD,
|
|
||||||
KB_WWW_STOP,
|
|
||||||
KB_WWW_REFRESH,
|
|
||||||
KB_WWW_FAVORITES,
|
|
||||||
|
|
||||||
/* reserve 0xE0-E7 for Modifiers */
|
|
||||||
|
|
||||||
/* Layer Switching */
|
|
||||||
KB_FN0 = 0xE8,
|
|
||||||
KB_FN1,
|
|
||||||
KB_FN2,
|
|
||||||
KB_FN3,
|
|
||||||
KB_FN4,
|
|
||||||
KB_FN5,
|
|
||||||
KB_FN6,
|
|
||||||
KB_FN7,
|
|
||||||
|
|
||||||
/* Mousekey */
|
|
||||||
KB_MS_UP = 0xF0,
|
|
||||||
KB_MS_DOWN,
|
|
||||||
KB_MS_LEFT,
|
|
||||||
KB_MS_RIGHT,
|
|
||||||
KB_MS_BTN1,
|
|
||||||
KB_MS_BTN2,
|
|
||||||
KB_MS_BTN3,
|
|
||||||
KB_MS_BTN4,
|
|
||||||
KB_MS_BTN5,
|
|
||||||
/* Mousekey wheel */
|
|
||||||
KB_MS_WH_UP,
|
|
||||||
KB_MS_WH_DOWN,
|
|
||||||
KB_MS_WH_LEFT,
|
|
||||||
KB_MS_WH_RIGHT,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum keycodes {
|
|
||||||
KB_NO = 0,
|
|
||||||
KB_ROLL_OVER,
|
|
||||||
KB_POST_FAIL,
|
|
||||||
KB_UNDEFINED,
|
|
||||||
KB_A,
|
|
||||||
KB_B,
|
|
||||||
KB_C,
|
|
||||||
KB_D,
|
|
||||||
KB_E,
|
|
||||||
KB_F,
|
|
||||||
KB_G,
|
|
||||||
KB_H,
|
|
||||||
KB_I,
|
|
||||||
KB_J,
|
|
||||||
KB_K,
|
|
||||||
KB_L,
|
|
||||||
KB_M, /* 0x10 */
|
|
||||||
KB_N,
|
|
||||||
KB_O,
|
|
||||||
KB_P,
|
|
||||||
KB_Q,
|
|
||||||
KB_R,
|
|
||||||
KB_S,
|
|
||||||
KB_T,
|
|
||||||
KB_U,
|
|
||||||
KB_V,
|
|
||||||
KB_W,
|
|
||||||
KB_X,
|
|
||||||
KB_Y,
|
|
||||||
KB_Z,
|
|
||||||
KB_1,
|
|
||||||
KB_2,
|
|
||||||
KB_3, /* 0x20 */
|
|
||||||
KB_4,
|
|
||||||
KB_5,
|
|
||||||
KB_6,
|
|
||||||
KB_7,
|
|
||||||
KB_8,
|
|
||||||
KB_9,
|
|
||||||
KB_0,
|
|
||||||
KB_ENTER,
|
|
||||||
KB_ESCAPE,
|
|
||||||
KB_BSPACE,
|
|
||||||
KB_TAB,
|
|
||||||
KB_SPACE,
|
|
||||||
KB_MINUS,
|
|
||||||
KB_EQUAL,
|
|
||||||
KB_LBRACKET,
|
|
||||||
KB_RBRACKET, /* 0x30 */
|
|
||||||
KB_BSLASH, /* \ (and |) */
|
|
||||||
KB_NONUS_HASH, /* Non-US # and ~ */
|
|
||||||
KB_SCOLON, /* ; (and :) */
|
|
||||||
KB_QUOTE, /* ' and " */
|
|
||||||
KB_GRAVE, /* Grave accent and tilde */
|
|
||||||
KB_COMMA, /* , and < */
|
|
||||||
KB_DOT, /* . and > */
|
|
||||||
KB_SLASH, /* / and ? */
|
|
||||||
KB_CAPSLOCK,
|
|
||||||
KB_F1,
|
|
||||||
KB_F2,
|
|
||||||
KB_F3,
|
|
||||||
KB_F4,
|
|
||||||
KB_F5,
|
|
||||||
KB_F6,
|
|
||||||
KB_F7, /* 0x40 */
|
|
||||||
KB_F8,
|
|
||||||
KB_F9,
|
|
||||||
KB_F10,
|
|
||||||
KB_F11,
|
|
||||||
KB_F12,
|
|
||||||
KB_PSCREEN,
|
|
||||||
KB_SCKLOCK,
|
|
||||||
KB_PAUSE,
|
|
||||||
KB_INSERT,
|
|
||||||
KB_HOME,
|
|
||||||
KB_PGUP,
|
|
||||||
KB_DELETE,
|
|
||||||
KB_END,
|
|
||||||
KB_PGDOWN,
|
|
||||||
KB_RIGHT,
|
|
||||||
KB_LEFT, /* 0x50 */
|
|
||||||
KB_DOWN,
|
|
||||||
KB_UP,
|
|
||||||
KB_NUMLOCK,
|
|
||||||
KB_KP_SLASH,
|
|
||||||
KB_KP_ASTERISK,
|
|
||||||
KB_KP_MINUS,
|
|
||||||
KB_KP_PLUS,
|
|
||||||
KB_KP_ENTER,
|
|
||||||
KB_KP_1,
|
|
||||||
KB_KP_2,
|
|
||||||
KB_KP_3,
|
|
||||||
KB_KP_4,
|
|
||||||
KB_KP_5,
|
|
||||||
KB_KP_6,
|
|
||||||
KB_KP_7,
|
|
||||||
KB_KP_8, /* 0x60 */
|
|
||||||
KB_KP_9,
|
|
||||||
KB_KP_0,
|
|
||||||
KB_KP_DOT,
|
|
||||||
KB_NONUS_BSLASH, /* Non-US \ and | */
|
|
||||||
KB_APPLICATION,
|
|
||||||
KB_POWER,
|
|
||||||
KB_KP_EQUAL,
|
|
||||||
KB_F13,
|
|
||||||
KB_F14,
|
|
||||||
KB_F15,
|
|
||||||
KB_F16,
|
|
||||||
KB_F17,
|
|
||||||
KB_F18,
|
|
||||||
KB_F19,
|
|
||||||
KB_F20,
|
|
||||||
KB_F21, /* 0x70 */
|
|
||||||
KB_F22,
|
|
||||||
KB_F23,
|
|
||||||
KB_F24,
|
|
||||||
KB_EXECUTE,
|
|
||||||
KB_HELP,
|
|
||||||
KB_MENU,
|
|
||||||
KB_SELECT,
|
|
||||||
KB_STOP,
|
|
||||||
KB_AGAIN,
|
|
||||||
KB_UNDO,
|
|
||||||
KB_CUT,
|
|
||||||
KB_COPY,
|
|
||||||
KB_PASTE,
|
|
||||||
KB_FIND,
|
|
||||||
KB__MUTE,
|
|
||||||
KB__VOLUP, /* 0x80 */
|
|
||||||
KB__VOLDOWN,
|
|
||||||
KB_LOCKING_CAPS, /* locking Caps Lock */
|
|
||||||
KB_LOCKING_NUM, /* locking Num Lock */
|
|
||||||
KB_LOCKING_SCROLL, /* locking Scroll Lock */
|
|
||||||
KB_KP_COMMA,
|
|
||||||
KB_KP_EQUAL_AS400, /* equal sign on AS/400 */
|
|
||||||
KB_INT1,
|
|
||||||
KB_INT2,
|
|
||||||
KB_INT3,
|
|
||||||
KB_INT4,
|
|
||||||
KB_INT5,
|
|
||||||
KB_INT6,
|
|
||||||
KB_INT7,
|
|
||||||
KB_INT8,
|
|
||||||
KB_INT9,
|
|
||||||
KB_LANG1, /* 0x90 */
|
|
||||||
KB_LANG2,
|
|
||||||
KB_LANG3,
|
|
||||||
KB_LANG4,
|
|
||||||
KB_LANG5,
|
|
||||||
KB_LANG6,
|
|
||||||
KB_LANG7,
|
|
||||||
KB_LANG8,
|
|
||||||
KB_LANG9,
|
|
||||||
KB_ALT_ERASE,
|
|
||||||
KB_SYSREQ,
|
|
||||||
KB_CANCEL,
|
|
||||||
KB_CLEAR,
|
|
||||||
KB_PRIOR,
|
|
||||||
KB_RETURN,
|
|
||||||
KB_SEPARATOR,
|
|
||||||
KB_OUT, /* 0xA0 */
|
|
||||||
KB_OPER,
|
|
||||||
KB_CLEAR_AGAIN,
|
|
||||||
KB_CRSEL,
|
|
||||||
KB_EXSEL,
|
|
||||||
|
|
||||||
/* NOTE: 0xB0-DF are used as special_keycodes */
|
|
||||||
#if 0
|
|
||||||
KB_KP_00 = 0xB0,
|
|
||||||
KB_KP_000,
|
|
||||||
KB_THOUSANDS_SEPARATOR,
|
|
||||||
KB_DECIMAL_SEPARATOR,
|
|
||||||
KB_CURRENCY_UNIT,
|
|
||||||
KB_CURRENCY_SUB_UNIT,
|
|
||||||
KB_KP_LPAREN,
|
|
||||||
KB_KP_RPAREN,
|
|
||||||
KB_KP_LCBRACKET, /* { */
|
|
||||||
KB_KP_RCBRACKET, /* } */
|
|
||||||
KB_KP_TAB,
|
|
||||||
KB_KP_BSPACE,
|
|
||||||
KB_KP_A,
|
|
||||||
KB_KP_B,
|
|
||||||
KB_KP_C,
|
|
||||||
KB_KP_D,
|
|
||||||
KB_KP_E, /* 0xC0 */
|
|
||||||
KB_KP_F,
|
|
||||||
KB_KP_XOR,
|
|
||||||
KB_KP_HAT,
|
|
||||||
KB_KP_PERC,
|
|
||||||
KB_KP_LT,
|
|
||||||
KB_KP_GT,
|
|
||||||
KB_KP_AND,
|
|
||||||
KB_KP_LAZYAND,
|
|
||||||
KB_KP_OR,
|
|
||||||
KB_KP_LAZYOR,
|
|
||||||
KB_KP_COLON,
|
|
||||||
KB_KP_HASH,
|
|
||||||
KB_KP_SPACE,
|
|
||||||
KB_KP_ATMARK,
|
|
||||||
KB_KP_EXCLAMATION,
|
|
||||||
KB_KP_MEM_STORE, /* 0xD0 */
|
|
||||||
KB_KP_MEM_RECALL,
|
|
||||||
KB_KP_MEM_CLEAR,
|
|
||||||
KB_KP_MEM_ADD,
|
|
||||||
KB_KP_MEM_SUB,
|
|
||||||
KB_KP_MEM_MUL,
|
|
||||||
KB_KP_MEM_DIV,
|
|
||||||
KB_KP_PLUS_MINUS,
|
|
||||||
KB_KP_CLEAR,
|
|
||||||
KB_KP_CLEAR_ENTRY,
|
|
||||||
KB_KP_BINARY,
|
|
||||||
KB_KP_OCTAL,
|
|
||||||
KB_KP_DECIMAL,
|
|
||||||
KB_KP_HEXADECIMAL,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Modifiers */
|
|
||||||
KB_LCTRL = 0xE0,
|
|
||||||
KB_LSHIFT,
|
|
||||||
KB_LALT,
|
|
||||||
KB_LGUI,
|
|
||||||
KB_RCTRL,
|
|
||||||
KB_RSHIFT,
|
|
||||||
KB_RALT,
|
|
||||||
KB_RGUI,
|
|
||||||
|
|
||||||
/* NOTE: 0xE8-FF are used as special_keycodes */
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* USB_KEYCODES_H */
|
|
Loading…
Reference in New Issue