From: tmk Date: Mon, 23 Apr 2018 07:48:02 +0000 (+0900) Subject: xt_usb: Clean keymap and change scancode matrix X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=1cb7a2450315548178763d365fc8adc055b19aae;p=max%2Ftmk_keyboard.git xt_usb: Clean keymap and change scancode matrix --- diff --git a/converter/xt_usb/Makefile b/converter/xt_usb/Makefile index 0cbf3b56..1ce90900 100644 --- a/converter/xt_usb/Makefile +++ b/converter/xt_usb/Makefile @@ -18,7 +18,7 @@ SRC = protocol/xt_interrupt.c \ ifdef KEYMAP SRC := keymap_$(KEYMAP).c $(SRC) else - SRC := keymap_plain.c $(SRC) + SRC := keymap.c $(SRC) endif CONFIG_H = config.h diff --git a/converter/xt_usb/keymap.c b/converter/xt_usb/keymap.c new file mode 100644 index 00000000..6e5698dd --- /dev/null +++ b/converter/xt_usb/keymap.c @@ -0,0 +1,59 @@ +#include "keymap_common.h" + + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* IBM XT keyboard layout + * ,-------. ,--------------------------------------------------------------------------. + * | F1| F2| |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS |NumLck |ScrLck | + * |-------| |--------------------------------------------------------------------------| + * | F3| F4| | Tab | Q| W| E| R| T| Y| U| I| O| P| [| ] | | 7| 8| 9| -| + * |-------| |------------------------------------------------------|Ent|---------------| + * | F5| F6| | Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| | 4| 5| 6| | + * |-------| |----------------------------------------------------------------------| | + * | F7| F8| |Shif| \| Z| X| C| V| B| N| M| ,| .| /|Shift|PrS| 1| 2| 3| +| + * |-------| |----------------------------------------------------------------------| | + * | F9|F10| | Alt | Space |CapsLck| 0 | . | | + * `-------' `--------------------------------------------------------------------------' + */ + KEYMAP_XT( \ + F1, F2, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK, SLCK, + F3, F4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS, + F5, F6, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, P4, P5, P6, + F7, F8, LSFT,BSLS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,PSCR,P1, P2, P3, PPLS, + F9, F10, LALT, SPC, CAPS, P0, PDOT + ), + + /* Extended keyboard layout + * ,-----------------------------------------------. + * |F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24| + * ,---. |-----------------------------------------------| ,-----------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut| + * `---' `-----------------------------------------------' `-----------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| + * |-----------------------------------------------------------| `-----------' |---------------| + * |CapsL | A| S| D| F| G| H| J| K| L| ;| '| #|Entr| | 4| 5| 6|KP,| + * |-----------------------------------------------------------| ,---. |---------------| + * |Shft| <| Z| X| C| V| B| N| M| ,| .| /| RO|Shift | |Up | | 1| 2| 3|KP=| + * |-----------------------------------------------------------| ,-----------. |---------------| + * |Ctl|Gui|Alt|MHEN| Space |HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .|Ent| + * `-----------------------------------------------------------' `-----------' `---------------' + */ + /* Try this if your keyboad has exotic keys. + KEYMAP( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, + CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PENT, + LCTL,LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PEQL + ), + */ +}; + +const action_t PROGMEM fn_actions[] = { +}; + diff --git a/converter/xt_usb/keymap_common.h b/converter/xt_usb/keymap_common.h index 5146d1ec..e6b8875c 100644 --- a/converter/xt_usb/keymap_common.h +++ b/converter/xt_usb/keymap_common.h @@ -28,137 +28,117 @@ along with this program. If not, see . #include "keymap.h" -/* All keys */ -#define KEYMAP_ALL( \ - K00, K02,K03,K04,K05,K06,K07,K08,K09,K0A,K0B,K0C,K0D, K0E,K0F,K0G, \ - K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K1A,K1B,K1C,K1D, K1E,K1F,K1G, K1H,K1I,K1J,K1K, \ - K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K2E,K2F,K2G, K2H,K2I,K2J, \ - K30,K31,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B, K3D, K3H,K3I,K3J,K3K, \ - K40,K41,K42,K43,K44,K45,K46,K47,K48,K49,K4A, K4D, K4F, K4H,K4I,K4J, \ - K50,K51,K52, K55, K5A,K5B,K5C,K5D, K5E,K5F,K5G, K5H, K5J,K5K, \ - \ - K60, K61, K62, /* System Power, Sleep, Wake */ \ - K70, K71, K72, /* Mute, Volume Up, Volume Down */ \ - K80, K81, K82, K83, K84, /* Next, Previous, Stop, Pause, Media Select */ \ - K90, K91, K92, /* Mail, Calculator, My Computer */ \ - KA0, KA1, KA2, KA3, /* WWW Search, Home, Back, Forward */ \ - KB0, KB1, KB2 /* WWW Stop, Refresh, Favorites */ \ +/* IBM XT keyobard layout + * ,-------. ,--------------------------------------------------------------------------. + * | F1| F2| |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS |NumLck |ScrLck | + * |-------| |--------------------------------------------------------------------------| + * | F3| F4| | Tab | Q| W| E| R| T| Y| U| I| O| P| [| ] | | 7| 8| 9| -| + * |-------| |------------------------------------------------------|Ent|---------------| + * | F5| F6| | Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| | 4| 5| 6| | + * |-------| |----------------------------------------------------------------------| | + * | F7| F8| |Shif| \| Z| X| C| V| B| N| M| ,| .| /|Shift|PrS| 1| 2| 3| +| + * |-------| |----------------------------------------------------------------------| | + * | F9|F10| | Alt | Space |CapsLck| 0 | . | | + * `-------' `--------------------------------------------------------------------------' + * Scan code set 1 + * ,-------. ,--------------------------------------------------------------------------. + * | 3B| 3C| | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E | 45 | 46 | + * |-------| |--------------------------------------------------------------------------| + * | 3D| 3E| | 0F | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B | | 47| 48| 49| 4A| + * |-------| |------------------------------------------------------| 1C|---------------| + * | 3F| 40| | 1D | 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| | 4B| 4C| 4D| | + * |-------| |----------------------------------------------------------------------| | + * | 41| 42| | 2A | 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 35| 36 |*37| 4F| 50| 51| 4E| + * |-------| |----------------------------------------------------------------------| | + * | 43| 44| | 38 | 39 | 3A | 52 | 53 | | + * `-------' `--------------------------------------------------------------------------' + */ +#define KEYMAP_XT( \ + K3B,K3C, K01,K02,K03,K04,K05,K06,K07,K08,K09,K0A,K0B,K0C,K0D,K0E, K45, K46, \ + K3D,K3E, K0F,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K1A,K1B, K47,K48,K49,K4A, \ + K3F,K40, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K1C,K4B,K4C,K4D, \ + K41,K42, K2A,K2B,K2C,K2D,K2E,K2F,K30,K31,K32,K33,K34,K35,K36,K54,K4F,K50,K51,K4E, \ + K43,K44, K38, K39, K3A, K52, K53 \ ) { \ - { KC_NO, KC_##K00, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16 }, \ - { KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K20 }, \ - { KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28 }, \ - { KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K3D, KC_##K50, KC_##K31, KC_##K32 }, \ - { KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A }, \ - { KC_##K3B, KC_##K10, KC_##K40, KC_##K2D, KC_##K41, KC_##K42, KC_##K43, KC_##K44 }, \ - { KC_##K45, KC_##K46, KC_##K47, KC_##K48, KC_##K49, KC_##K4A, KC_##K4D, KC_##K1J }, \ - { KC_##K52, KC_##K55, KC_##K30, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06 }, \ - { KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K1H, KC_##K0F, KC_##K2H }, \ - { KC_##K2I, KC_##K2J, KC_##K1K, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K4H }, \ - { KC_##K4I, KC_##K4J, KC_##K5H, KC_##K5J, KC_##K5K, KC_##K5D, KC_##K1I, KC_##K0C }, \ - { KC_##K0D, KC_##K5A, KC_##K80, KC_##K51, KC_##K5B, KC_##K5C, KC_##K60, KC_##K61 }, \ - { KC_##K70, KC_##K91, KC_##K83, KC_##K62, KC_##K82, KC_##KA0, KC_##KB2, KC_##KB1 }, \ - { KC_##KB0, KC_##KA3, KC_##KA2, KC_##K92, KC_##K90, KC_##K84, KC_##K81, KC_##K1F }, \ - { KC_##K4F, KC_##K1G, KC_##K72, KC_##K5E, KC_##K71, KC_##K5G, KC_##KA1, KC_##K2F }, \ - { KC_##K5F, KC_##K2G, KC_##K1E, KC_##K2E, KC_##K0E, KC_##K0G, KC_NO , KC_NO } \ + { KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ + { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ + { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ + { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_NO }, \ + { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \ + { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \ + { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \ + { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \ } -/* US layout */ +/* Extended keyboard layout + * ,-----------------------------------------------. + * |F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24| + * ,---. |-----------------------------------------------| ,-----------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut| + * `---' `-----------------------------------------------' `-----------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| + * |-----------------------------------------------------------| `-----------' |---------------| + * |CapsL | A| S| D| F| G| H| J| K| L| ;| '| #|Entr| | 4| 5| 6|KP,| + * |-----------------------------------------------------------| ,---. |---------------| + * |Shft| <| Z| X| C| V| B| N| M| ,| .| /| RO|Shift | |Up | | 1| 2| 3|Ent| + * |-----------------------------------------------------------| ,-----------. |---------------| + * |Ctl|Gui|Alt|MHEN| Space |HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .|KP=| + * `-----------------------------------------------------------' `-----------' `---------------' + * ,-----------------------------------------------. + * | 64| 65| 66| 67| 68| 69| 6A| 6B| 6C| 6D| 6E| 76| + * ,---. |-----------------------------------------------| ,-----------. ,-----------. + * | 01| | 3B| 3C| 3D| 3E| 3F| 40| 41| 42| 43| 44| 57| 58| |*37| 46|*45| |e5E|e5F|e63| + * `---' `-----------------------------------------------' `-----------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | 29| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 7D| 0E| |e52|e47|e49| | 45|e35| 37| 4A| + * |-----------------------------------------------------------| |-----------| |---------------| + * | 0F | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| 2B | |e53|e4F|e51| | 47| 48| 49| 4E| + * |-----------------------------------------------------------| `-----------' |---------------| + * | 3A | 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| 00| 1C | | 4B| 4C| 4D| 7E| + * |-----------------------------------------------------------| ,---. |---------------| + * | 2A | 56| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 35| 73| 36 | |e48| | 4F| 50| 51|e1C| + * |-----------------------------------------------------------| ,-----------. |---------------| + * | 1D|e5B| 38| 7B | 39 | 79 | 70 |e38|e5C|e5D|e1D| |e4B|e50|e4D| | 52| 53| 59| + * `-----------------------------------------------------------' `-----------' `---------------' + * e: E0-escaped codes + * *: special handling codes + */ #define KEYMAP( \ - K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ - K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ - K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ - K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ - K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ - K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \ -) \ -KEYMAP_ALL( \ - K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ - K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ - K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ - K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ - K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ - K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \ - \ - SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \ - AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \ - MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \ - MAIL, CALCULATOR, MY_COMPUTER, \ - WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \ - WWW_STOP, WWW_REFRESH, WWW_FAVORITES \ -) - -/* ISO layout */ -#define KEYMAP_ISO( \ - K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ - K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ - K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \ - K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D,K5A, K6B,K73,K74,K79, \ - K12,K61,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ - K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \ -) \ -KEYMAP_ALL( \ - K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ - K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ - K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ - K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ - K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ - K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \ - \ - SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \ - AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \ - MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \ - MAIL, CALCULATOR, MY_COMPUTER, \ - WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \ - WWW_STOP, WWW_REFRESH, WWW_FAVORITES \ -) - -/* JIS layout */ -#define KEYMAP_JIS( \ - K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ - K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K6A,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ - K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \ - K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D, K5A, K6B,K73,K74,K79, \ - K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,K51, K59, KF5, K69,K72,K7A, \ - K14,K9F,K11, K67,K29,K64,K13, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \ -) \ -KEYMAP_ALL( \ - K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ - K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ - K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ - K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ - K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ - K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \ - \ - SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \ - AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \ - MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \ - MAIL, CALCULATOR, MY_COMPUTER, \ - WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \ - WWW_STOP, WWW_REFRESH, WWW_FAVORITES \ -) - -/* XT layout */ -#define KEYMAP_XT( \ - K05,K06, K76, K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45, K4E,K55,K66, K77,K7E, \ - K04,K0C, K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, K5A, K6C,K75,K7D,K7B, \ - K03,K0B, K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K0E, K6B,K73,K74,K79,\ - K83,K0A, K12,K5D,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,K59, K7C, K69,K72,K7A, \ - K01,K09, K11, K29, K58, K70, K71\ -) \ -KEYMAP_ALL( \ - K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,F11,F12, PSCR,K7E,BRK, \ - K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, INS,HOME,PGUP, K77,PSLS,K7C,K7B, \ - K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, DEL,END,PGDN, K6C,K75,K7D, \ - K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ - K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, UP, K69,K72,K7A, \ - K14,LGUI,K11, K29, RALT,RGUI,APP,RCTL, LEFT,DOWN,RGHT, K70,K71,PENT, \ - \ - SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \ - AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \ - MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \ - MAIL, CALCULATOR, MY_COMPUTER, \ - WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \ - WWW_STOP, WWW_REFRESH, WWW_FAVORITES \ -) + K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D,K6E,K76, \ + K01, K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K57,K58, K54,K46,K55, K5D,K5E,K5F, \ + K29,K02,K03,K04,K05,K06,K07,K08,K09,K0A,K0B,K0C,K0D,K7D,K0E, K71,K74,K77, K45,K7F,K37,K4A, \ + K0F,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K1A,K1B, K2B, K72,K75,K78, K47,K48,K49,K4E, \ + K3A,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28, K00,K1C, K4B,K4C,K4D,K7E, \ + K2A,K56,K2C,K2D,K2E,K2F,K30,K31,K32,K33,K34,K35, K73,K36, K60, K4F,K50,K51,K6F, \ + K1D,K5A,K38,K7B, K39, K79,K70,K7C,K5B,K5C,K7A, K61,K62,K63, K52,K53,K59 \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ + { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ + { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ + { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \ + { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \ + { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \ + { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \ + { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ + { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \ + { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \ + { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \ + { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ + { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_##K7F } \ +} #endif diff --git a/converter/xt_usb/keymap_jis.c b/converter/xt_usb/keymap_jis.c deleted file mode 100644 index b430b907..00000000 --- a/converter/xt_usb/keymap_jis.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * JIS layout Japanese keyboard - */ -#include "keymap_common.h" - -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: JIS LAYOUT - * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------. - * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak| - * `---' `---------------' `---------------' `---------------' `-----------' `-----------' - * ,-----------------------------------------------------------. ,-----------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| JY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| - * |-----------------------------------------------------------| |-----------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Ret | |Del|End|PgD| | 7| 8| 9| | - * |------------------------------------------------------` | `-----------' |-----------| +| - * |CapsLo| A| S| D| F| G| H| J| K| L| ;| :| \| | | 4| 5| 6| | - * |-----------------------------------------------------------| ,---. |---------------| - * |Shift | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3| | - * |-----------------------------------------------------------| ,-----------. |-----------|Ent| - * |Ctrl |Gui |Alt |MHEN| Space |HENK|KANA|Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| | - * `-----------------------------------------------------------' `-----------' `---------------' - */ - KEYMAP_JIS( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, DEL, END, PGDN, P7, P8, P9, - CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS, ENT, P4, P5, P6, PPLS, - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, RSFT, UP, P1, P2, P3, - LCTL,LGUI,LALT, MHEN,SPC, HENK,KANA, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT - ), -}; - -const action_t PROGMEM fn_actions[] = { -}; diff --git a/converter/xt_usb/matrix.c b/converter/xt_usb/matrix.c index b556c0cc..473151cb 100644 --- a/converter/xt_usb/matrix.c +++ b/converter/xt_usb/matrix.c @@ -33,10 +33,6 @@ static uint8_t matrix[MATRIX_ROWS]; #define ROW(code) (code>>3) #define COL(code) (code&0x07) -// matrix positions for exceptional keys -#define PRINT_SCREEN (0x7C) -#define PAUSE (0x7D) - void matrix_init(void) { @@ -49,78 +45,54 @@ void matrix_init(void) return; } -static uint8_t move_codes(uint8_t code) { +// convert E0-escaped codes into unused area +static uint8_t move_e0code(uint8_t code) { switch(code) { - case 0x10: - code += 0x5E; - break; - case 0x19: - code += 0x41; - break; - case 0x1C: - case 0x1D: - code += 0x38; - break; - case 0x20: - case 0x21: - case 0x22: - case 0x24: - code += 0x40; - break; - case 0x2E: - case 0x30: - case 0x32: - code += 0x44; - break; - case 0x35: - case 0x38: - code += 0x21; - break; - case 0x47: - case 0x48: - case 0x49: - case 0x4B: - case 0x4D: - case 0x4F: - case 0x50: - case 0x51: - case 0x52: - case 0x53: - code += 0x28; - break; + // Original IBM XT keyboard has these keys + case 0x37: return 0x54; // Print Screen + case 0x46: return 0x55; // Ctrl + Pause + case 0x1C: return 0x6F; // Keypad Enter + case 0x35: return 0x7F; // Keypad / + + // Any XT keyobard with these keys? + // http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf + // https://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc + case 0x5B: return 0x5A; // Left GUI + case 0x5C: return 0x5B; // Right GUI + case 0x5D: return 0x5C; // Application + case 0x5E: return 0x5D; // Power(not used) + case 0x5F: return 0x5E; // Sleep(not used) + case 0x63: return 0x5F; // Wake (not used) + case 0x48: return 0x60; // Up + case 0x4B: return 0x61; // Left + case 0x50: return 0x62; // Down + case 0x4D: return 0x63; // Right + case 0x52: return 0x71; // Insert + case 0x53: return 0x72; // Delete + case 0x47: return 0x74; // Home + case 0x4F: return 0x75; // End + case 0x49: return 0x77; // Home + case 0x51: return 0x78; // End + case 0x1D: return 0x7A; // Right Ctrl + case 0x38: return 0x7C; // Right Alt } return code; } uint8_t matrix_scan(void) { - - // scan code reading states static enum { INIT, E0, - E0_2A, - E0_2A_E0, - E0_B7, - E0_B7_E0, - - // print screen + // Pause: E1 1D 45, E1 9D C5 E1, E1_1D, - E1_1D_45, - E1_1D_45_E1, - E1_1D_45_E1_9D, - // pause + E1_9D, } state = INIT; - - // 'pseudo break code' hack - if (matrix_is_on(ROW(PAUSE), COL(PAUSE))) { - matrix_break(PAUSE); - } - uint8_t code = xt_host_recv(); - if (code) xprintf("%02X ", code); + if (!code) return 0; + xprintf("%02X ", code); switch (state) { case INIT: switch (code) { @@ -130,85 +102,64 @@ uint8_t matrix_scan(void) case 0xE1: state = E1; break; - default: // normal key make - if (code < 0x80 && code != 0x00) { + default: + if (code < 0x80) matrix_make(code); - } else if (code > 0x80 && code < 0xFF && code != 0x00) { - matrix_break(code - 0x80); - } - state = INIT; + else + matrix_break(code & 0x7F); + break; } break; - case E0: // E0-Prefixed - switch (code) { //move these codes to unused places on the matrix + case E0: + switch (code) { case 0x2A: - state = E0_2A; - break; - case 0xB7: - state = E0_B7; + case 0xAA: + case 0x36: + case 0xB6: + //ignore fake shift + state = INIT; break; default: - if (code < 0x80 && code != 0x00) { - matrix_make(move_codes(code)); - } else if (code > 0x80 && code < 0xFF && code != 0x00) { - matrix_break(move_codes(code - 0x80)); - } + if (code < 0x80) + matrix_make(move_e0code(code)); + else + matrix_break(move_e0code(code & 0x7F)); state = INIT; + break; } break; - case E0_2A: - if(code == 0xE0) - state = E0_2A_E0; - else - state = INIT; - break; - case E0_2A_E0: - if(code == 0x37) - matrix_make(PRINT_SCREEN); - else - state = INIT; - break; - case E0_B7: - if(code == 0xE0) - state = E0_B7; - else - state = INIT; - break; - case E0_B7_E0: - if(code == 0xAA) - matrix_break(PRINT_SCREEN); - else - state = INIT; - break; case E1: - if (code == 0x1D) - state = E1_1D; - else - state = INIT; + switch (code) { + case 0x1D: + state = E1_1D; + break; + case 0x9D: + state = E1_9D; + break; + default: + state = INIT; + break; + } break; case E1_1D: - if(code == 0x45) - state = E1_1D_45; - else - state = INIT; - break; - case E1_1D_45: - if(code == 0xE1) - state = E1_1D_45_E1; - else - state = INIT; - break; - case E1_1D_45_E1: - if(code == 0x9D) - state = E1_1D_45_E1_9D; - else - state = INIT; + switch (code) { + case 0x45: + matrix_make(0x55); + break; + default: + state = INIT; + break; + } break; - case E1_1D_45_E1_9D: - if(code == 0xC5) - matrix_make(PAUSE); - else - state = INIT; + case E1_9D: + switch (code) { + case 0x45: + matrix_break(0x55); + break; + default: + state = INIT; + break; + } break; default: state = INIT; @@ -242,3 +193,71 @@ void matrix_clear(void) { for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; } + +/* +XT Scancodes +============ +- http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf +- https://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc + +01-53: Normal codes used in original XT keyboard +54-7F: Not used in original XT keyboard + + 0 1 2 3 4 5 6 7 8 9 A B C D E F + 50 - - - - * * x x x x * * * * * * + 60 * * * * x x x x x x x x x x x * + 70 x * * x * * x * * x * x * x x * + +-: codes existed in original XT keyboard +*: E0-escaped codes converted into unused code area(internal use in TMK) +x: Non-espcaped codes(not used in real keyboards probably, for CodeSet2-CodeSet1 translation purpose) + +Usage in TMK: + + 00 reserved* + 54 PrintScr* + 55 Pause* + 56 Euro2 + 57 F11 + 58 F12 + 59 Keypad = + 5A LGUI* + 5B RGUI* + 5C APP* + 5D reserved* + 5E reserved* + 5F reserved* + 60 cursor* + 61 cursor* + 62 cursor* + 63 cursor* + 64 F13 + 65 F14 + 66 F15 + 67 F16 + 68 F17 + 69 F18 + 6A F19 + 6B F20 + 6C F21 + 6D F22 + 6E F23 + 6F Keypad Enter* + 70 KANA + 71 nav* + 72 nav* + 73 RO + 74 nav* + 75 nav* + 76 F24 + 77 nav* + 78 nav* + 79 HENKAN + 7A RCTL* + 7B MUHENKAN + 7C RALT* + 7D JPY + 7E Keypad , + 7F Keypad / * + +*/