2dd5b2218de38a8e39fe59376e52e3bebefa2fe7
[tmk_keyboard.git] / tmk_core / common / unimap.h
1 /*
2 Copyright 2016 Jun Wako <wakojun@gmail.com>
3 */
4 #ifndef _UNIMAP_H_
5 #define _UNIMAP_H_
6
7 #include <stdint.h>
8 #include <stdbool.h>
9 #include "action.h"
10 #include "action_code.h"
11 #include "actionmap.h"
12
13
14 // Universal map table: 8x16=128key
15 #define UNIMAP_ROWS 8
16 #define UNIMAP_COLS 16
17
18 /* Universal 128-key keyboard layout(8x16)
19 ,-----------------------------------------------.
20 |F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|
21 ,---. |-----------------------------------------------| ,-----------. ,-----------.
22 |Esc| |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|
23 `---' `-----------------------------------------------' `-----------' `-----------'
24 ,-----------------------------------------------------------. ,-----------. ,---------------.
25 | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -|
26 |-----------------------------------------------------------| |-----------| |---------------|
27 |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +|
28 |-----------------------------------------------------------| `-----------' |---------------|
29 |CapsL | A| S| D| F| G| H| J| K| L| ;| '| #|Entr| | 4| 5| 6|KP,|
30 |-----------------------------------------------------------| ,---. |---------------|
31 |Shft| <| Z| X| C| V| B| N| M| ,| .| /| RO|Shift | |Up | | 1| 2| 3|KP=|
32 |-----------------------------------------------------------| ,-----------. |---------------|
33 |Ctl|Gui|Alt|MHEN| Space |HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent|
34 `-----------------------------------------------------------' `-----------' `---------------'
35 App: Windows Menu key
36 Gui: Windows key, Mac ⌘ key or Meta key
37 VDn Vup Mut: Volume control
38 < #: ISO keys(in UK legend)
39 KP=: Keypad = for Mac
40 KP,: Brazilian Keypad Comma
41 JPY: Japanese Yen(¥)
42 RO: Japanese ろ(Ro) or Brazilian /(Slash)
43 MHEN: Japanese 無変換(Non Conversion) or Korean Hanja
44 HENK: Japanese 変換(Conversion) or Korean Hangul/English
45 KANA: Japanese かな(Hiragana/Katakana)
46 https://en.wikipedia.org/wiki/Keyboard_layout#Japanese
47 https://en.wikipedia.org/wiki/Keyboard_layout#Hangul_.28for_Korean.29
48 */
49 #define UNIMAP( \
50 K68,K69,K6A,K6B,K6C,K6D,K6E,K6F,K70,K71,K72,K73, \
51 K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, K01,K02,K03, \
52 K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K74,K2A, K49,K4A,K4B, K53,K54,K55,K56, \
53 K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K31, K4C,K4D,K4E, K5F,K60,K61,K57, \
54 K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K32,K28, K5C,K5D,K5E,K66, \
55 K79,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K75,K7D, K52, K59,K5A,K5B,K67, \
56 K78,K7B,K7A,K77, K2C, K76,K00,K7E,K7F,K65,K7C, K50,K51,K4F, K62, K63,K58 \
57 ) { \
58 { AC_##K00, AC_##K01, AC_##K02, AC_##K03, AC_##K04, AC_##K05, AC_##K06, AC_##K07, /* 00-07 */ \
59 AC_##K08, AC_##K09, AC_##K0A, AC_##K0B, AC_##K0C, AC_##K0D, AC_##K0E, AC_##K0F }, /* 08-0F */ \
60 { AC_##K10, AC_##K11, AC_##K12, AC_##K13, AC_##K14, AC_##K15, AC_##K16, AC_##K17, /* 10-17 */ \
61 AC_##K18, AC_##K19, AC_##K1A, AC_##K1B, AC_##K1C, AC_##K1D, AC_##K1E, AC_##K1F }, /* 18-1F */ \
62 { AC_##K20, AC_##K21, AC_##K22, AC_##K23, AC_##K24, AC_##K25, AC_##K26, AC_##K27, /* 20-27 */ \
63 AC_##K28, AC_##K29, AC_##K2A, AC_##K2B, AC_##K2C, AC_##K2D, AC_##K2E, AC_##K2F }, /* 28-2F */ \
64 { AC_##K30, AC_##K31, AC_##K32, AC_##K33, AC_##K34, AC_##K35, AC_##K36, AC_##K37, /* 30-37 */ \
65 AC_##K38, AC_##K39, AC_##K3A, AC_##K3B, AC_##K3C, AC_##K3D, AC_##K3E, AC_##K3F }, /* 38-3F */ \
66 { AC_##K40, AC_##K41, AC_##K42, AC_##K43, AC_##K44, AC_##K45, AC_##K46, AC_##K47, /* 40-47 */ \
67 AC_##K48, AC_##K49, AC_##K4A, AC_##K4B, AC_##K4C, AC_##K4D, AC_##K4E, AC_##K4F }, /* 48-4F */ \
68 { AC_##K50, AC_##K51, AC_##K52, AC_##K53, AC_##K54, AC_##K55, AC_##K56, AC_##K57, /* 50-57 */ \
69 AC_##K58, AC_##K59, AC_##K5A, AC_##K5B, AC_##K5C, AC_##K5D, AC_##K5E, AC_##K5F }, /* 58-5F */ \
70 { AC_##K60, AC_##K61, AC_##K62, AC_##K63, AC_##K64, AC_##K65, AC_##K66, AC_##K67, /* 60-67 */ \
71 AC_##K68, AC_##K69, AC_##K6A, AC_##K6B, AC_##K6C, AC_##K6D, AC_##K6E, AC_##K6F }, /* 68-6F */ \
72 { AC_##K70, AC_##K71, AC_##K72, AC_##K73, AC_##K74, AC_##K75, AC_##K76, AC_##K77, /* 70-77 */ \
73 AC_##K78, AC_##K79, AC_##K7A, AC_##K7B, AC_##K7C, AC_##K7D, AC_##K7E, AC_##K7F } /* 78-7F */ \
74 }
75
76 // Universal map position codes
77 enum unimap_position_codes {
78 // logical name position(row << 4 | col)
79 // ------------------------------------------------
80 UNIMAP_KANA, // 0x00
81 UNIMAP_VOLUME_DOWN, // 0x01
82 UNIMAP_VOLUME_UP, // 0x02
83 UNIMAP_VOLUME_MUTE, // 0x03
84 UNIMAP_A, // 0x04
85 UNIMAP_B, // 0x05
86 UNIMAP_C, // 0x06
87 UNIMAP_D, // 0x07
88 UNIMAP_E, // 0x08
89 UNIMAP_F, // 0x09
90 UNIMAP_G, // 0x0A
91 UNIMAP_H, // 0x0B
92 UNIMAP_I, // 0x0C
93 UNIMAP_J, // 0x0D
94 UNIMAP_K, // 0x0E
95 UNIMAP_L, // 0x0F
96 UNIMAP_M, // 0x10
97 UNIMAP_N, // 0x11
98 UNIMAP_O, // 0x12
99 UNIMAP_P, // 0x13
100 UNIMAP_Q, // 0x14
101 UNIMAP_R, // 0x15
102 UNIMAP_S, // 0x16
103 UNIMAP_T, // 0x17
104 UNIMAP_U, // 0x18
105 UNIMAP_V, // 0x19
106 UNIMAP_W, // 0x1A
107 UNIMAP_X, // 0x1B
108 UNIMAP_Y, // 0x1C
109 UNIMAP_Z, // 0x1D
110 UNIMAP_1, // 0x1E
111 UNIMAP_2, // 0x1F
112 UNIMAP_3, // 0x20
113 UNIMAP_4, // 0x21
114 UNIMAP_5, // 0x22
115 UNIMAP_6, // 0x23
116 UNIMAP_7, // 0x24
117 UNIMAP_8, // 0x25
118 UNIMAP_9, // 0x26
119 UNIMAP_0, // 0x27
120 UNIMAP_ENTER, // 0x28
121 UNIMAP_ESCAPE, // 0x29
122 UNIMAP_BSPACE, // 0x2A
123 UNIMAP_TAB, // 0x2B
124 UNIMAP_SPACE, // 0x2C
125 UNIMAP_MINUS, // 0x2D
126 UNIMAP_EQUAL, // 0x2E
127 UNIMAP_LBRACKET, // 0x2F
128 UNIMAP_RBRACKET, // 0x30
129 UNIMAP_BSLASH, // 0x31
130 UNIMAP_NONUS_HASH, // 0x32 ISO UK hasu
131 UNIMAP_SCOLON, // 0x33
132 UNIMAP_QUOTE, // 0x34
133 UNIMAP_GRAVE, // 0x35
134 UNIMAP_COMMA, // 0x36
135 UNIMAP_DOT, // 0x37
136 UNIMAP_SLASH, // 0x38
137 UNIMAP_CAPSLOCK, // 0x39
138 UNIMAP_F1, // 0x3A
139 UNIMAP_F2, // 0x3B
140 UNIMAP_F3, // 0x3C
141 UNIMAP_F4, // 0x3D
142 UNIMAP_F5, // 0x3E
143 UNIMAP_F6, // 0x3F
144 UNIMAP_F7, // 0x40
145 UNIMAP_F8, // 0x41
146 UNIMAP_F9, // 0x42
147 UNIMAP_F10, // 0x43
148 UNIMAP_F11, // 0x44
149 UNIMAP_F12, // 0x45
150 UNIMAP_PSCREEN, // 0x46
151 UNIMAP_SCROLLLOCK, // 0x47
152 UNIMAP_PAUSE, // 0x48
153 UNIMAP_INSERT, // 0x49
154 UNIMAP_HOME, // 0x4A
155 UNIMAP_PGUP, // 0x4B
156 UNIMAP_DELETE, // 0x4C
157 UNIMAP_END, // 0x4D
158 UNIMAP_PGDOWN, // 0x4E
159 UNIMAP_RIGHT, // 0x4F
160 UNIMAP_LEFT, // 0x50
161 UNIMAP_DOWN, // 0x51
162 UNIMAP_UP, // 0x52
163 UNIMAP_NUMLOCK, // 0x53
164 UNIMAP_KP_SLASH, // 0x54
165 UNIMAP_KP_ASTERISK, // 0x55
166 UNIMAP_KP_MINUS, // 0x56
167 UNIMAP_KP_PLUS, // 0x57
168 UNIMAP_KP_ENTER, // 0x58
169 UNIMAP_KP_1, // 0x59
170 UNIMAP_KP_2, // 0x5A
171 UNIMAP_KP_3, // 0x5B
172 UNIMAP_KP_4, // 0x5C
173 UNIMAP_KP_5, // 0x5D
174 UNIMAP_KP_6, // 0x5E
175 UNIMAP_KP_7, // 0x5F
176 UNIMAP_KP_8, // 0x60
177 UNIMAP_KP_9, // 0x61
178 UNIMAP_KP_0, // 0x62
179 UNIMAP_KP_DOT, // 0x63
180 UNIMAP_NONUS_BSLASH, // 0x64 ISO UK backslash
181 UNIMAP_APPLICATION, // 0x65
182 UNIMAP_KP_COMMA, // 0x66
183 UNIMAP_KP_EQUAL, // 0x67
184 UNIMAP_F13, // 0x68
185 UNIMAP_F14, // 0x69
186 UNIMAP_F15, // 0x6A
187 UNIMAP_F16, // 0x6B
188 UNIMAP_F17, // 0x6C
189 UNIMAP_F18, // 0x6D
190 UNIMAP_F19, // 0x6E
191 UNIMAP_F20, // 0x6F
192 UNIMAP_F21, // 0x70
193 UNIMAP_F22, // 0x71
194 UNIMAP_F23, // 0x72
195 UNIMAP_F24, // 0x73
196 UNIMAP_JYEN, // 0x74
197 UNIMAP_RO, // 0x75
198 UNIMAP_HENK, // 0x76
199 UNIMAP_MHEN, // 0x77
200 UNIMAP_LCTRL, // 0x78
201 UNIMAP_LSHIFT, // 0x79
202 UNIMAP_LALT, // 0x7A
203 UNIMAP_LGUI, // 0x7B
204 UNIMAP_RCTRL, // 0x7C
205 UNIMAP_RSHIFT, // 0x7D
206 UNIMAP_RALT, // 0x7E
207 UNIMAP_RGUI, // 0x7F
208 UNIMAP_NO, // 0x80
209 };
210
211 /*
212 * Short names
213 */
214 #define UNIMAP_LCTL UNIMAP_LCTRL
215 #define UNIMAP_RCTL UNIMAP_RCTRL
216 #define UNIMAP_LSFT UNIMAP_LSHIFT
217 #define UNIMAP_RSFT UNIMAP_RSHIFT
218 #define UNIMAP_ESC UNIMAP_ESCAPE
219 #define UNIMAP_BSPC UNIMAP_BSPACE
220 #define UNIMAP_ENT UNIMAP_ENTER
221 #define UNIMAP_DEL UNIMAP_DELETE
222 #define UNIMAP_INS UNIMAP_INSERT
223 #define UNIMAP_CAPS UNIMAP_CAPSLOCK
224 #define UNIMAP_CLCK UNIMAP_CAPSLOCK
225 #define UNIMAP_RGHT UNIMAP_RIGHT
226 #define UNIMAP_PGDN UNIMAP_PGDOWN
227 #define UNIMAP_PSCR UNIMAP_PSCREEN
228 #define UNIMAP_SLCK UNIMAP_SCROLLLOCK
229 #define UNIMAP_PAUS UNIMAP_PAUSE
230 #define UNIMAP_BRK UNIMAP_PAUSE
231 #define UNIMAP_NLCK UNIMAP_NUMLOCK
232 #define UNIMAP_SPC UNIMAP_SPACE
233 #define UNIMAP_MINS UNIMAP_MINUS
234 #define UNIMAP_EQL UNIMAP_EQUAL
235 #define UNIMAP_GRV UNIMAP_GRAVE
236 #define UNIMAP_RBRC UNIMAP_RBRACKET
237 #define UNIMAP_LBRC UNIMAP_LBRACKET
238 #define UNIMAP_COMM UNIMAP_COMMA
239 #define UNIMAP_BSLS UNIMAP_BSLASH
240 #define UNIMAP_SLSH UNIMAP_SLASH
241 #define UNIMAP_SCLN UNIMAP_SCOLON
242 #define UNIMAP_QUOT UNIMAP_QUOTE
243 #define UNIMAP_APP UNIMAP_APPLICATION
244 #define UNIMAP_NUHS UNIMAP_NONUS_HASH
245 #define UNIMAP_NUBS UNIMAP_NONUS_BSLASH
246 /* Japanese specific */
247 #define UNIMAP_ZKHK UNIMAP_GRAVE
248 /* Keypad */
249 #define UNIMAP_P1 UNIMAP_KP_1
250 #define UNIMAP_P2 UNIMAP_KP_2
251 #define UNIMAP_P3 UNIMAP_KP_3
252 #define UNIMAP_P4 UNIMAP_KP_4
253 #define UNIMAP_P5 UNIMAP_KP_5
254 #define UNIMAP_P6 UNIMAP_KP_6
255 #define UNIMAP_P7 UNIMAP_KP_7
256 #define UNIMAP_P8 UNIMAP_KP_8
257 #define UNIMAP_P9 UNIMAP_KP_9
258 #define UNIMAP_P0 UNIMAP_KP_0
259 #define UNIMAP_PDOT UNIMAP_KP_DOT
260 #define UNIMAP_PCMM UNIMAP_KP_COMMA
261 #define UNIMAP_PSLS UNIMAP_KP_SLASH
262 #define UNIMAP_PAST UNIMAP_KP_ASTERISK
263 #define UNIMAP_PMNS UNIMAP_KP_MINUS
264 #define UNIMAP_PPLS UNIMAP_KP_PLUS
265 #define UNIMAP_PEQL UNIMAP_KP_EQUAL
266 #define UNIMAP_PENT UNIMAP_KP_ENTER
267 /* Consumer Page */
268 #define UNIMAP_MUTE UNIMAP_VOLUME_MUTE
269 #define UNIMAP_VOLU UNIMAP_VOLUME_UP
270 #define UNIMAP_VOLD UNIMAP_VOLUME_DOWN
271
272 #endif
Imprint / Impressum