2 Copyright 2016-19 Jun Wako <wakojun@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef UNIMAP_COMMON_H
18 #define UNIMAP_COMMON_H
21 #include <avr/pgmspace.h>
25 /* ADB Keyboard unified layout
26 * ,---. .---------------. ,---------------. ,---------------. ,-----------. ,---.
27 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|
28 * `---' `---------------' `---------------' `---------------' `-----------' `---'
29 * ,-----------------------------------------------------------. ,-----------. ,---------------. ,---.
30 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *| |VUp|
31 * |-----------------------------------------------------------| |-----------| |---------------| |---|
32 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -| |VDn|
33 * |-----------------------------------------------------------| `-----------' |---------------| |---|
34 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +| |Mut|
35 * |-----------------------------------------------------------| ,---. |---------------| `---'
36 * |Shif|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
37 * |-----------------------------------------------------------| ,-----------. |-----------|Ent| ,---.
38 * |Ctrl |Opt |Gui | Space |Gui* |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| | |Ply|
39 * `-----------------------------------------------------------' `-----------' `---------------' `---'
40 * NOTE: Not-extended ADB keyboards have no discrimination between left and right modifiers.
41 * Use left ones for mapping. Right modifier always sends same code as left one.
42 * Apple Extended Keyboard can discriminate the modifiers except for Command(GUI) key.
45 K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, K73, \
46 K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E, K2A, K49,K4A,K4B, K53,K54,K55,K56, K02, \
47 K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K31, K4C,K4D,K4E, K5F,K60,K61,K57, K01, \
48 K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K32,K28, K5C,K5D,K5E,K66, K03, \
49 K79,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K7D, K52, K59,K5A,K5B,K58, \
50 K78,K7A,K7B, K2C, K7E,K7C, K50,K51,K4F, K62,K63, K68 \
52 K68, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, K73, \
53 K29, K3A, K3B, K3C, K3D, K3E, K3F, K40, K41, K42, K43, K44, K45, K46, K47, K48, K01, K02, K03, \
54 K35, K1E, K1F, K20, K21, K22, K23, K24, K25, K26, K27, K2D, K2E, JYEN,K2A, K49, K4A, K4B, K53, K54, K55, K56, \
55 K2B, K14, K1A, K08, K15, K17, K1C, K18, K0C, K12, K13, K2F, K30, K31, K4C, K4D, K4E, K5F, K60, K61, K57, \
56 K39, K04, K16, K07, K09, K0A, K0B, K0D, K0E, K0F, K33, K34, K32, K28, K5C, K5D, K5E, K66, \
57 K79, K64, K1D, K1B, K06, K19, K05, K11, K10, K36, K37, K38, RO, K7D, K52, K59, K5A, K5B, K58, \
58 K78, K7B, K7A, MHEN, K2C, HENK,KANA,K7E, RGUI,APP, K7C, K50, K51, K4F, K62, K63, PEQL \
62 // http://lxr.free-electrons.com/source/drivers/macintosh/adbhid.c
63 // http://opensource.apple.com//source/IOHIDFamily/IOHIDFamily-701.20.10/IOHIDFamily/Cosmo_USB2ADB.c
64 // http://m0115.web.fc2.com/m0115.jpg
65 const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
66 // Position(unimap) ADB scan code(matrix)
67 // ---------------------------------------------
81 UNIMAP_NONUS_BSLASH, // 0x0A
102 UNIMAP_MINUS, // 0x1B
105 UNIMAP_RBRACKET, // 0x1E
110 UNIMAP_LBRACKET, // 0x21
113 UNIMAP_ENTER, // 0x24
116 UNIMAP_QUOTE, // 0x27
120 UNIMAP_SCOLON, // 0x29
121 UNIMAP_BSLASH, // 0x2A
122 UNIMAP_COMMA, // 0x2B
123 UNIMAP_SLASH, // 0x2C
130 UNIMAP_SPACE, // 0x31
131 UNIMAP_GRAVE, // 0x32
132 UNIMAP_BSPACE, // 0x33
133 UNIMAP_KP_ENTER, // 0x34
134 UNIMAP_ESCAPE, // 0x35
135 UNIMAP_LCTRL, // 0x36
139 UNIMAP_LSHIFT, // 0x38
140 UNIMAP_CAPSLOCK, // 0x39
143 UNIMAP_RIGHT, // 0x3C
146 UNIMAP_F23, // 0x3F FN?
150 UNIMAP_KP_DOT, // 0x41
151 UNIMAP_F13, // 0x42 Mic(Adjustable keyboard)
152 UNIMAP_KP_MINUS, // 0x43 ADB keypad asterisk(top right)
154 UNIMAP_KP_COMMA, // 0x45 ADB keypad plus
156 UNIMAP_NUMLOCK, // 0x47
159 UNIMAP_VOLUME_UP, // 0x48 Vol Up(Adjustable keyboard)
160 UNIMAP_VOLUME_DOWN, // 0x49 Vol Down(Adjustable keyboard)
161 UNIMAP_VOLUME_MUTE, // 0x4A Vol Mute(Adjustable keyboard)
162 UNIMAP_KP_ASTERISK, // 0x4B ADB keypad slash(between equal and asterisk)
163 UNIMAP_KP_ENTER, // 0x4C
165 UNIMAP_KP_PLUS, // 0x4E ADB keypad minus
170 UNIMAP_KP_SLASH, // 0x51 ADB keypad equal(next to clear/numlock)
186 UNIMAP_KP_COMMA, // 0x5F
200 UNIMAP_PSCREEN, // 0x69
202 UNIMAP_SCROLLLOCK, // 0x6B
205 UNIMAP_APPLICATION, // 0x6E compose
210 UNIMAP_PAUSE, // 0x71
211 UNIMAP_INSERT, // 0x72
214 UNIMAP_DELETE, // 0x75
220 UNIMAP_PGDOWN, // 0x79
222 UNIMAP_RSHIFT, // 0x7B
224 UNIMAP_RCTRL, // 0x7D
226 UNIMAP_F24, // 0x7F power key