aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2014-05-21 02:43:19 +0900
committertmk <nobody@nowhere>2014-05-21 02:43:19 +0900
commited8cf12d25d5052cf583b162ec70b0be93270c1e (patch)
tree3f30977b3fe8ee298edc14d78bbdcb62d7a49fa2
parentabe5edcaa7c6391cb313a672910d7beb9b7d8fa2 (diff)
downloadqmk_firmware-ed8cf12d25d5052cf583b162ec70b0be93270c1e.tar.gz
qmk_firmware-ed8cf12d25d5052cf583b162ec70b0be93270c1e.zip
Add ISO keymap(issue #35) and use new keymap API
-rw-r--r--converter/adb_usb/Makefile8
-rw-r--r--converter/adb_usb/Makefile.pjrc8
-rw-r--r--converter/adb_usb/README.md38
-rw-r--r--converter/adb_usb/keymap_ansi.c16
-rw-r--r--converter/adb_usb/keymap_common.c30
-rw-r--r--converter/adb_usb/keymap_common.h (renamed from converter/adb_usb/keymap.c)230
-rw-r--r--converter/adb_usb/keymap_hasu.c58
-rw-r--r--converter/adb_usb/keymap_iso.c16
8 files changed, 276 insertions, 128 deletions
diff --git a/converter/adb_usb/Makefile b/converter/adb_usb/Makefile
index 211416742..73cae8ab3 100644
--- a/converter/adb_usb/Makefile
+++ b/converter/adb_usb/Makefile
@@ -48,11 +48,17 @@ TOP_DIR = ../..
48TARGET_DIR = . 48TARGET_DIR = .
49 49
50# project specific files 50# project specific files
51SRC = keymap.c \ 51SRC = keymap_common.c \
52 matrix.c \ 52 matrix.c \
53 led.c \ 53 led.c \
54 adb.c 54 adb.c
55 55
56ifdef KEYMAP
57 SRC := keymap_$(KEYMAP).c $(SRC)
58else
59 SRC := keymap_ansi.c $(SRC)
60endif
61
56CONFIG_H = config.h 62CONFIG_H = config.h
57 63
58 64
diff --git a/converter/adb_usb/Makefile.pjrc b/converter/adb_usb/Makefile.pjrc
index c3a5d8f55..2eb41b34b 100644
--- a/converter/adb_usb/Makefile.pjrc
+++ b/converter/adb_usb/Makefile.pjrc
@@ -8,11 +8,17 @@ TOP_DIR = ../..
8TARGET_DIR = . 8TARGET_DIR = .
9 9
10# keyboard dependent files 10# keyboard dependent files
11SRC = keymap.c \ 11SRC = keymap_common.c \
12 matrix.c \ 12 matrix.c \
13 led.c \ 13 led.c \
14 adb.c 14 adb.c
15 15
16ifdef KEYMAP
17 SRC := keymap_$(KEYMAP).c $(SRC)
18else
19 SRC := keymap_ansi.c $(SRC)
20endif
21
16CONFIG_H = config.h 22CONFIG_H = config.h
17 23
18 24
diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md
index d9efbfab2..defc477e2 100644
--- a/converter/adb_usb/README.md
+++ b/converter/adb_usb/README.md
@@ -7,17 +7,29 @@ But binary size is about 10KB or more it doesn't fit into 8K flash like ATMega8U
7Discuss: http://geekhack.org/showwiki.php?title=Island:14290 7Discuss: http://geekhack.org/showwiki.php?title=Island:14290
8 8
9 9
10Build 10Wiring
11----- 11------
120. Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data). By default Data line uses port D0. 120. Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data). By default Data line uses port PD0.
13 This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable. 13 This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable.
14 The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended. 14 The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended.
151. Define following macros for ADB connection in config.h if you use other than port D0. 151. Define following macros for ADB connection in config.h if you use other than port PD0.
16 ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT 16 ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT
172. make 172. make
183. program Teensy 183. program Teensy
19 19
20 20
21Build
22-----
23Just make
24
25 $ make clean
26 $ make
27
28If your keyboard is ISO layout
29
30 $ make KEYMAP=iso
31
32
21LOCKING CAPSLOCK 33LOCKING CAPSLOCK
22---------------- 34----------------
23Many of old ADB keyboards have mechanical push-lock switch for Capslock key and this converter supports the locking Capslock key by default. See README in top directory for more detail about this feature. 35Many of old ADB keyboards have mechanical push-lock switch for Capslock key and this converter supports the locking Capslock key by default. See README in top directory for more detail about this feature.
@@ -48,7 +60,7 @@ effort at this time.
48 * |-----------------------------------------------------------| ,---. |---------------| 60 * |-----------------------------------------------------------| ,---. |---------------|
49 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | 61 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
50 * |-----------------------------------------------------------| ,-----------. |-----------|Ent| 62 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
51 * |Ctrl |Gui |Alt | Space | | | | |Lef|Dow|Rig| | 0| .| | 63 * |Ctrl |Alt |Gui | Space |Gui |Alt |Ctrl | |Lef|Dow|Rig| | 0| .| |
52 * `-----------------------------------------------------------' `-----------' `---------------' 64 * `-----------------------------------------------------------' `-----------' `---------------'
53 */ 65 */
54 KEYMAP( 66 KEYMAP(
@@ -68,11 +80,17 @@ To get help press `h` holding Magic key. Magic key is `Power key`.
68 80
69Notes 81Notes
70----- 82-----
71Many ADB keyboards has no discrimination between right modifier and left one, 83Not-extended ADB keyboards have no discrimination between right modifier and left one,
72you will always see left control even if you press right control key. 84you will always see left control even if you press right control key.
73Apple Extended Keyboard and Apple Extended Keyboard II are the examples. 85Apple Extended Keyboard and Apple Extended Keyboard II can discriminate both side
74Though ADB protocol itself has the ability of distinction between right and left. 86modifiers except for GUI key(Windows/Command).
75And most ADB keyboard has no NKRO functionality, though ADB protocol itself has that. 87
76See protocol/adb.c for more info. 88And most ADB keyboard has no diodes in its matrix so they are not NKRO,
89though ADB protocol itself supports it. See protocol/adb.c for more info.
90
91If keyobard has ISO layout you need to use ISO keymap with `make KEYMAP=iso`. With ANSI
92keymap you will suffer from swapped keys problem.
93
94https://github.com/tmk/tmk_keyboard/issues/35
77 95
78EOF 96EOF
diff --git a/converter/adb_usb/keymap_ansi.c b/converter/adb_usb/keymap_ansi.c
new file mode 100644
index 000000000..0d0bae99b
--- /dev/null
+++ b/converter/adb_usb/keymap_ansi.c
@@ -0,0 +1,16 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 KEYMAP_EXT_ANSI(
6 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, PWR,
7 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
8 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS,
9 LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
10 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
11 LCTL,LALT,LGUI, SPC, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
12 ),
13};
14
15const uint16_t PROGMEM fn_actions[] = {
16};
diff --git a/converter/adb_usb/keymap_common.c b/converter/adb_usb/keymap_common.c
new file mode 100644
index 000000000..241d2e33b
--- /dev/null
+++ b/converter/adb_usb/keymap_common.c
@@ -0,0 +1,30 @@
1/*
2Copyright 2011,2012,2013 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#include "keymap_common.h"
18
19
20/* translates key to keycode */
21uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
22{
23 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
24}
25
26/* translates Fn keycode to action */
27action_t keymap_fn_to_action(uint8_t keycode)
28{
29 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
30}
diff --git a/converter/adb_usb/keymap.c b/converter/adb_usb/keymap_common.h
index d53c9c750..bdca38e12 100644
--- a/converter/adb_usb/keymap.c
+++ b/converter/adb_usb/keymap_common.h
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com> 2Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
3 3
4This program is free software: you can redistribute it and/or modify 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 5it under the terms of the GNU General Public License as published by
@@ -14,111 +14,113 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#ifndef KEYMAP_COMMON_H
18#define KEYMAP_COMMON_H
17 19
18/*
19 * Keymap for ADB keyboard
20 */
21#include <stdint.h> 20#include <stdint.h>
22#include <stdbool.h> 21#include <stdbool.h>
23#include <avr/pgmspace.h> 22#include <avr/pgmspace.h>
24#include "keycode.h" 23#include "keycode.h"
24#include "action.h"
25#include "action_macro.h"
26#include "report.h"
25#include "print.h" 27#include "print.h"
26#include "debug.h" 28#include "debug.h"
27#include "util.h"
28#include "keymap.h" 29#include "keymap.h"
29 30
30 31
31#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)])) 32extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
33extern const uint16_t fn_actions[];
32 34
33#define KEYMAP_ALL( \ 35
36/* M0115 Apple Extended Keyboard ANSI
37 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
38 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|
39 * `---' `---------------' `---------------' `---------------' `-----------' `---'
40 * ,-----------------------------------------------------------. ,-----------. ,---------------.
41 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
42 * |-----------------------------------------------------------| |-----------| |---------------|
43 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -|
44 * |-----------------------------------------------------------| `-----------' |---------------|
45 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +|
46 * |-----------------------------------------------------------| ,---. |---------------|
47 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
48 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
49 * |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| |
50 * `-----------------------------------------------------------' `-----------' `---------------'
51 */
52#define KEYMAP_EXT_ANSI( \
34 K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ 53 K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \
35 K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ 54 K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \
36 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \ 55 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \
37 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \ 56 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \
38 K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ 57 K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \
39 K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C, \ 58 K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \
40 /* for ISO/JIS keyboard */ \
41 K0A, /* NON-US \ and | 0x64 */ \
42 K34, /* Keypad ENTER 0x58 */ \
43 K40, /* F17 0x6C */ \
44 K44, /* F18? 0x6d */ \
45 K4F, /* F18 0x6d */ \
46 K50, /* F19 0x6e */ \
47 K5A, /* F20 0x6f */ \
48 K5D, /* INTL3(Yen) 0x89 */ \
49 K5E, /* INTL1(Ro) 0x87 */ \
50 K5F, /* Keypad Comma 0x85 */ \
51 K66, /* LANG2(Eisu) 0x91 */ \
52 K68, /* LANG1(Kana) 0x90 */ \
53 K6A, /* F16 0x6B */ \
54 K6E /* Application 0x65 */ \
55) { \ 59) { \
56 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ 60 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
57 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ 61 { KC_##K08, KC_##K09, KC_NUBS, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
58 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ 62 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
59 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \ 63 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
60 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ 64 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
61 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ 65 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
62 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \ 66 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_PENT, KC_##K35, KC_##K36, KC_##K37 }, \
63 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \ 67 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
64 { KC_##K40, KC_##K41, KC_NO, KC_##K43, KC_##K44, KC_##K45, KC_NO, KC_##K47 }, \ 68 { KC_F17, KC_##K41, KC_NO, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \
65 { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_##K4F }, \ 69 { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_F18 }, \
66 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ 70 { KC_F19, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
67 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \ 71 { KC_##K58, KC_##K59, KC_F20, KC_##K5B, KC_##K5C, KC_INT3, KC_INT1, KC_PCMM }, \
68 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \ 72 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_LANG2, KC_##K67 }, \
69 { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_NO, KC_##K6D, KC_##K6E, KC_##K6F }, \ 73 { KC_LANG1, KC_##K69, KC_F16, KC_##K6B, KC_NO, KC_##K6D, KC_APP, KC_##K6F }, \
70 { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ 74 { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
71 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \ 75 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \
72} 76}
73 77
74/* Apple Extended Keyboard US 78/* M0115 Apple Extended Keyboard ISO
75 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---. 79 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
76 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr| 80 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|
77 * `---' `---------------' `---------------' `---------------' `-----------' `---' 81 * `---' `---------------' `---------------' `---------------' `-----------' `---'
78 * ,-----------------------------------------------------------. ,-----------. ,---------------. 82 * ,-----------------------------------------------------------. ,-----------. ,---------------.
79 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *| 83 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
80 * |-----------------------------------------------------------| |-----------| |---------------| 84 * |-----------------------------------------------------------| |-----------| |---------------|
81 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -| 85 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Retur| |Del|End|PgD| | 7| 8| 9| -|
82 * |-----------------------------------------------------------| `-----------' |---------------| 86 * |------------------------------------------------------` | `-----------' |---------------|
83 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +| 87 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #| | | 4| 5| 6| +|
84 * |-----------------------------------------------------------| ,---. |---------------| 88 * |-----------------------------------------------------------| ,---. |---------------|
85 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | 89 * |Shif| \| Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
86 * |-----------------------------------------------------------| ,-----------. |-----------|Ent| 90 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
87 * |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| | 91 * |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| |
88 * `-----------------------------------------------------------' `-----------' `---------------' 92 * `-----------------------------------------------------------' `-----------' `---------------'
89 */ 93 */
90#define KEYMAP_EXTENDED_US( \ 94#define KEYMAP_EXT_ISO( \
91 K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ 95 K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \
92 K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ 96 K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \
93 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \ 97 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K24, K75,K77,K79, K59,K5B,K5C,K4E, \
94 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \ 98 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A, K56,K57,K58,K45, \
95 K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ 99 K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \
96 K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \ 100 K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \
97) KEYMAP_ALL( \ 101) { \
98 K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ 102 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
99 K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ 103 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
100 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \ 104 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
101 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \ 105 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
102 K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ 106 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
103 K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C, \ 107 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
104 /* for ISO/JIS keyboard */ \ 108 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_PENT, KC_##K35, KC_##K36, KC_##K37 }, \
105 NONUS_BSLASH, /* NON-US \ and | 0x64 */ \ 109 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
106 KP_ENTER, /* Keypad ENTER 0x58 */ \ 110 { KC_F17, KC_##K41, KC_NO, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \
107 F17, /* F17 0x6C */ \ 111 { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_F18 }, \
108 F18, /* F18? 0x6d */ \ 112 { KC_F19, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
109 F18, /* F18 0x6d */ \ 113 { KC_##K58, KC_##K59, KC_F20, KC_##K5B, KC_##K5C, KC_INT3, KC_INT1, KC_PCMM }, \
110 F19, /* F19 0x6e */ \ 114 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_LANG2, KC_##K67 }, \
111 F20, /* F20 0x6f */ \ 115 { KC_LANG1, KC_##K69, KC_F16, KC_##K6B, KC_NO, KC_##K6D, KC_APP, KC_##K6F }, \
112 INT3, /* INTL3(Yen) 0x89 */ \ 116 { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
113 INT1, /* INTL1(Ro) 0x87 */ \ 117 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \
114 KP_COMMA, /* Keypad Comma 0x85 */ \ 118}
115 LANG2, /* LANG2(Eisu) 0x91 */ \ 119
116 LANG1, /* LANG1(Kana) 0x90 */ \ 120
117 F16, /* F16 0x6B */ \ 121
118 APPLICATION /* Application 0x65 */ \ 122
119) 123/* M0116 Apple Standard Keyboard ANSI
120
121/* M0116
122* +-------+ 124* +-------+
123* | power | 125* | power |
124* +-------+ 126* +-------+
@@ -134,7 +136,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
134* |cap|opt|comnd| ` | | \ |lef|rig|dwn|up | | 0 | . | | 136* |cap|opt|comnd| ` | | \ |lef|rig|dwn|up | | 0 | . | |
135* +---------------------------------------------------------+ +-------+---+---+ 137* +---------------------------------------------------------+ +-------+---+---+
136*/ 138*/
137#define KEYMAP_M0116( \ 139#define KEYMAP_M0116_ANSI( \
138 K7F, \ 140 K7F, \
139 K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \ 141 K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \
140 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K45, \ 142 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K45, \
@@ -160,55 +162,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
160 { KC_NO , KC_NO, KC_NO , KC_##K7B, KC_NO, KC_NO, KC_NO, KC_##K7F } \ 162 { KC_NO , KC_NO, KC_NO , KC_##K7B, KC_NO, KC_NO, KC_NO, KC_##K7F } \
161} 163}
162 164
165#endif
163 166
164// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
165static const uint8_t PROGMEM fn_layer[] = {
166 0, // Fn0
167 0, // Fn1
168 0, // Fn2
169 0, // Fn3
170 0, // Fn4
171 0, // Fn5
172 0, // Fn6
173 0 // Fn7
174};
175
176// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
177// See layer.c for details.
178static const uint8_t PROGMEM fn_keycode[] = {
179 KC_NO, // Fn0
180 KC_NO, // Fn1
181 KC_NO, // Fn2
182 KC_NO, // Fn3
183 KC_NO, // Fn4
184 KC_NO, // Fn5
185 KC_NO, // Fn6
186 KC_NO // Fn7
187};
188
189static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
190 KEYMAP_EXTENDED_US(
191 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, PWR,
192 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
193 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS,
194 LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
195 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
196 LCTL,LGUI,LALT, SPC, RGUI,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
197 ),
198};
199
200
201uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
202{
203 return KEYCODE(layer, row, col);
204}
205
206uint8_t keymap_fn_layer(uint8_t index)
207{
208 return pgm_read_byte(&fn_layer[index]);
209}
210 167
211uint8_t keymap_fn_keycode(uint8_t index) 168/*
212{ 169ADB ANSI/ISO Keymapping Note
213 return pgm_read_byte(&fn_keycode[index]); 170============================
214} 171ANSI
172,----------- ----------.
173| *a| 1| 2 =|Backspa|
174|----------- ----------|
175|Tab | Q| | ]| *c|
176|----------- ----------|
177|CapsLo| A| '|Return |
178|----------- ----------|
179|Shift | Shift |
180`----------- ----------'
181
182ISO
183,----------- ----------.
184| *a| 1| 2 =|Backspa|
185|----------- ----------|
186|Tab | Q| | ]|Retur|
187|----------- -----` |
188|CapsLo| A| '| *c| |
189|----------- ----------|
190|Shif| *b| Shift |
191`----------- ----------'
192
193ADB Keyboard scan code:
194 ADB scan code USB usage
195 ------------- ---------
196Key ANSI ISO ANSI ISO
197---------------------------------------------
198*a 0x32 0x0A 0x35 0x35
199*b ---- 0x32 ---- 0x64
200*c 0x2A 0x2A 0x31 0x31(or 0x32)
201
202
203TMK ADB-USB mapping:
204ADB USB(ANSI) USB(ISO)
205---------------------------------
2060x32 0x35 0x64
2070x0A ---- 0x35
2080x2A 0x31 0x31(or 0x32)
209
210Note that mappings of ADB code 0x32 are diffrent between ANSI and ISO keyboard.
211https://github.com/tmk/tmk_keyboard/issues/35
212 */
diff --git a/converter/adb_usb/keymap_hasu.c b/converter/adb_usb/keymap_hasu.c
new file mode 100644
index 000000000..f2e59b3e9
--- /dev/null
+++ b/converter/adb_usb/keymap_hasu.c
@@ -0,0 +1,58 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 /* Default Layer: plain keymap
6 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
7 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | |
8 * `---' `---------------' `---------------' `---------------' `-----------' `---'
9 * ,-----------------------------------------------------------. ,-----------. ,---------------.
10 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
11 * |-----------------------------------------------------------| |-----------| |---------------|
12 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Fn0| |Del|End|PgD| | 7| 8| 9| -|
13 * |-----------------------------------------------------------| `-----------' |---------------|
14 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +|
15 * |-----------------------------------------------------------| ,---. |---------------|
16 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
17 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
18 * |Ctrl |Gui |Alt | Space |Alt |Gui |Ctrl | |Lef|Dow|Rig| | 0| .| |
19 * `-----------------------------------------------------------' `-----------' `---------------'
20 */
21 KEYMAP_EXT_ANSI(
22 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO,
23 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST,
24 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,FN0, DEL, END, PGDN, P7, P8, P9, PMNS,
25 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
26 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
27 LCTL,LGUI,LALT, SPC, RGUI,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
28 ),
29
30 /* Default Layer: plain keymap
31 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
32 * |` | |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | |
33 * `---' `---------------' `---------------' `---------------' `-----------' `---'
34 * ,-----------------------------------------------------------. ,-----------. ,---------------.
35 * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Delete | |Ins|Hom|PgU| |NmL|Mb1|Mb2|Mb3|
36 * |-----------------------------------------------------------| |-----------| |---------------|
37 * |Tab | Q| W| E| R| T| Y| U|PrS|ScL|Pau|Up |Ins| Fn0| |Del|End|PgD| |MwD|McU|MwU|MwD|
38 * |-----------------------------------------------------------| `-----------' |---------------|
39 * |CapsLo|VoD|VoU|Mut| F| G| H| J|Hom|PgU|Lef|Rig|Return | |McL|McD|McR|MwU|
40 * |-----------------------------------------------------------| ,---. |---------------|
41 * |Shift | Z| X| C| V| B| N| M|End|PgD|Dow|Shift | |PgU| |MwL|McD|MwR| |
42 * |-----------------------------------------------------------| ,-----------. |-----------|Mb3|
43 * |Ctrl |Gui |Alt | Space |Alt |Gui |Ctrl | |Hom|PgD|End| | Mb1|Mb2| |
44 * `-----------------------------------------------------------' `-----------' `---------------'
45 */
46 KEYMAP_EXT_ANSI(
47 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO,
48 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,BTN1,BTN2,BTN3,
49 TAB, Q, W, E, R, T, Y, U, PSCR,SLCK,PAUS,UP, INS, FN0, DEL, END, PGDN, WH_D,MS_U,WH_U,WH_D,
50 CAPS,VOLD,VOLU,MUTE,F, G, H, J, HOME,PGUP,LEFT,RGHT, ENT, MS_L,MS_D,MS_R,WH_U,
51 LSFT,Z, X, C, V, B, N, M, END, PGDN,DOWN, RSFT, PGUP, WH_L,MS_D,WH_R,
52 LCTL,LGUI,LALT, SPC, RGUI,RCTL, HOME,PGDN,END, BTN1, BTN2,BTN3
53 ),
54};
55
56const uint16_t PROGMEM fn_actions[] = {
57 [0] = ACTION_LAYER_TAP_KEY(1, KC_BSLS),
58};
diff --git a/converter/adb_usb/keymap_iso.c b/converter/adb_usb/keymap_iso.c
new file mode 100644
index 000000000..451d3d2c3
--- /dev/null
+++ b/converter/adb_usb/keymap_iso.c
@@ -0,0 +1,16 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 KEYMAP_EXT_ISO(
6 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, PWR,
7 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
8 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, DEL, END, PGDN, P7, P8, P9, PMNS,
9 LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, PPLS,
10 LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
11 LCTL,LALT,LGUI, SPC, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
12 ),
13};
14
15const uint16_t PROGMEM fn_actions[] = {
16};