]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - keyboard/hhkb/unimap_trans.h
hhkb: Fix startup of rn42 #407
[max/tmk_keyboard.git] / keyboard / hhkb / unimap_trans.h
1 /*
2 Copyright 2016 Jun Wako <wakojun@gmail.com>
3
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.
8
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.
13
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/>.
16 */
17 #ifndef UNIMAP_TRANS_H
18 #define UNIMAP_TRANS_H
19
20 #include <stdint.h>
21 #include <stdbool.h>
22 #include "keycode.h"
23 #include "action.h"
24 #include "action_code.h"
25 #include "action_layer.h"
26 #include "action_macro.h"
27 #include "action_util.h"
28 #include "report.h"
29 #include "host.h"
30 #include "print.h"
31 #include "debug.h"
32 #include "unimap.h"
33
34
35 #define UNIMAP_HHKB( \
36     K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K74,K2A, \
37     K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30,    K31, \
38     K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,        K28, \
39     K79,    K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38,    K7D,K7C, \
40         K7A,K7B,            K2C,                K7F,K7E          \
41 ) UNIMAP( \
42             NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO,                                     \
43     NO,     NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO,       NO, NO, NO,       NO, NO, NO, \
44     K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K74,K2A,  NO, NO, NO,   NO, NO, NO, NO, \
45     K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30,    K31,  NO, NO, NO,   NO, NO, NO, NO, \
46     K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,    NO, K28,                NO, NO, NO, NO, \
47     K79,NO, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38,    NO, K7D,      NO,       NO, NO, NO, NO, \
48     NO, K7B,K7A,NO,         K2C,        NO, NO, K7E,K7F,NO, K7C,  NO, NO, NO,   NO,     NO, NO  \
49 )
50
51 #define UNIMAP_JP( \
52     K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K74,K2A,  \
53     K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30,          \
54     K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,K32,    K28,  \
55     K79,    K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38,K75,K52,K7D, \
56     K78,K29,K7B,K7A,K77,    K2C,    K76,K00,K7E,K7C,K50,K51,K4F  \
57 ) UNIMAP( \
58             NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO,                                     \
59     K29,    NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO,       NO, NO, NO,       NO, NO, NO, \
60     K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K74,K2A,  NO, NO, NO,   NO, NO, NO, NO, \
61     K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30,    NO,   NO, NO, NO,   NO, NO, NO, NO, \
62     K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,    K32,K28,                NO, NO, NO, NO, \
63     K79,NO, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38,    K75,K7D,      K52,      NO, NO, NO, NO, \
64     K78,K7B,K7A,K77,        K2C,        K76,K00,K7E,NO, NO, K7C,  K50,K51,K4F,  NO,     NO, NO  \
65 )
66
67
68 /* Mapping to Universal keyboard layout
69  *
70  * Universal keyboard layout
71  *         ,-----------------------------------------------.
72  *         |F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|
73  * ,---.   |-----------------------------------------------|     ,-----------.     ,-----------.
74  * |Esc|   |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|     |PrS|ScL|Pau|     |VDn|VUp|Mut|
75  * `---'   `-----------------------------------------------'     `-----------'     `-----------'
76  * ,-----------------------------------------------------------. ,-----------. ,---------------.
77  * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|JPY|Bsp| |Ins|Hom|PgU| |NmL|  /|  *|  -|
78  * |-----------------------------------------------------------| |-----------| |---------------|
79  * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \  | |Del|End|PgD| |  7|  8|  9|  +|
80  * |-----------------------------------------------------------| `-----------' |---------------|
81  * |CapsL |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|  #|Retn|               |  4|  5|  6|KP,|
82  * |-----------------------------------------------------------|     ,---.     |---------------|
83  * |Shft|  <|  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /| RO|Shift |     |Up |     |  1|  2|  3|KP=|
84  * |-----------------------------------------------------------| ,-----------. |---------------|
85  * |Ctl|Gui|Alt|MHEN|     Space      |HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| |  0    |  .|Ent|
86  * `-----------------------------------------------------------' `-----------' `---------------'
87  */
88
89 #ifndef HHKB_JP
90 /* HHKB
91  * ,-----------------------------------------------------------.
92  * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|JPY|BS |
93  * |-----------------------------------------------------------|
94  * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|   \ |
95  * |-----------------------------------------------------------|
96  * |CapsL |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Enter   |
97  * |-----------------------------------------------------------|
98  * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Shift |Ctl|
99  * `-----------------------------------------------------------'
100  *       |Gui|Alt  |         Space         |Alt  |Gui|
101  *       `-------------------------------------------'
102  *
103  * Matrix - row:8 x col:8
104  * ,-----------------------------------------------------------.
105  * |31 |30 |00 |10 |11 |20 |21 |40 |41 |60 |61 |70 |71 |50 |51 |
106  * |-----------------------------------------------------------|
107  * |32   |01 |02 |13 |12 |23 |22 |42 |43 |62 |63 |73 |72 |52   |
108  * |-----------------------------------------------------------|
109  * |33    |04 |03 |14 |15 |24 |25 |45 |44 |65 |64 |74 |     53 |
110  * |-----------------------------------------------------------|
111  * |34      |05 |06 |07 |16 |17 |26 |46 |66 |76 |75 |55    |54 |
112  * `-----------------------------------------------------------'
113  *       |35 |36   |          37           |57   |56 |
114  *       `-------------------------------------------'
115  */
116
117 const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
118     { UNIMAP_2, UNIMAP_Q, UNIMAP_W, UNIMAP_S, UNIMAP_A, UNIMAP_Z, UNIMAP_X, UNIMAP_C, },
119     { UNIMAP_3, UNIMAP_4, UNIMAP_R, UNIMAP_E, UNIMAP_D, UNIMAP_F, UNIMAP_V, UNIMAP_B, },
120     { UNIMAP_5, UNIMAP_6, UNIMAP_Y, UNIMAP_T, UNIMAP_G, UNIMAP_H, UNIMAP_N, UNIMAP_NO, },
121     { UNIMAP_1, UNIMAP_GRAVE, UNIMAP_TAB, UNIMAP_CAPSLOCK, UNIMAP_LSHIFT, UNIMAP_LALT, UNIMAP_LGUI, UNIMAP_SPACE, },
122     { UNIMAP_7, UNIMAP_8, UNIMAP_U, UNIMAP_I, UNIMAP_K, UNIMAP_J, UNIMAP_M, UNIMAP_NO, },
123     { UNIMAP_JYEN, UNIMAP_BSPACE, UNIMAP_BSLASH, UNIMAP_ENTER, UNIMAP_RCTRL, UNIMAP_RSHIFT, UNIMAP_RALT, UNIMAP_RGUI, },
124     { UNIMAP_9, UNIMAP_0, UNIMAP_O, UNIMAP_P, UNIMAP_SCOLON, UNIMAP_L, UNIMAP_COMMA, UNIMAP_NO, },
125     { UNIMAP_MINUS, UNIMAP_EQUAL, UNIMAP_RBRACKET, UNIMAP_LBRACKET, UNIMAP_QUOTE, UNIMAP_SLASH, UNIMAP_DOT, UNIMAP_NO, },
126 };
127
128 #else
129 /* HHKB JP
130  * ,-----------------------------------------------------------.
131  * |`  |1  |2  |3  |4  |5  |6  |7  |8  |9  |0  |-  |=  |JPY|BS |
132  * |-----------------------------------------------------------|
133  * |Tab  |Q  |W  |E  |R  |T  |Y  |U  |I  |O  |P  |[  |]  |     |
134  * |------------------------------------------------------`    |
135  * |CapsL |A  |S  |D  |F  |G  |H  |J  |K  |L  |;  |'  |#  |Entr|
136  * |-----------------------------------------------------------|
137  * |Shift  |Z  |X  |C  |V  |B  |N  |M  |,  |.  |/  |RO |Up |Shi|
138  * |-----------------------------------------------------------|
139  * |Ctl||Esc|Gui|Alt|MHE|         |HEN|KAN|Alt|Ctl||Lef|Dow|Rig|
140  * `-----------------------------------------------------------'
141  *
142  * Matrix -  row:16 x col:8
143  * ,-----------------------------------------------------------.
144  * |02 |32 |62 |22 |12 |52 |72 |A2 |92 |82 |B2 |E2 |F2 |D2 |C2 |
145  * |-----------------------------------------------------------|
146  * |03   |63 |23 |13 |53 |73 |A3 |93 |83 |B3 |E3 |F3 |D3 |     |
147  * |------------------------------------------------------`    |
148  * |06    |66 |26 |16 |56 |76 |A6 |96 |86 |B6 |E6 |F6 |D6 | C6 |
149  * |-----------------------------------------------------------|
150  * |05     |65 |25 |15 |55 |75 |A5 |95 |85 |B5 |E5 |F5 |D5 |C5 |
151  * |-----------------------------------------------------------|
152  * |04 ||34 |64 |24 |14 |     74  |94 |84 |B4 |E4 ||F4 |D4 |C4 |
153  * `-----------------------------------------------------------'
154  */
155 const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
156     { UNIMAP_NO, UNIMAP_NO, UNIMAP_GRAVE, UNIMAP_TAB, UNIMAP_LCTRL, UNIMAP_LSHIFT, UNIMAP_CAPSLOCK, UNIMAP_NO, },
157     { UNIMAP_NO, UNIMAP_NO, UNIMAP_4, UNIMAP_E, UNIMAP_MHEN, UNIMAP_C, UNIMAP_D, UNIMAP_NO, },
158     { UNIMAP_NO, UNIMAP_NO, UNIMAP_3, UNIMAP_W, UNIMAP_LALT, UNIMAP_X, UNIMAP_S, UNIMAP_NO, },
159     { UNIMAP_NO, UNIMAP_NO, UNIMAP_1, UNIMAP_NO, UNIMAP_ESCAPE, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, },
160     { UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, },
161     { UNIMAP_NO, UNIMAP_NO, UNIMAP_5, UNIMAP_R, UNIMAP_NO, UNIMAP_V, UNIMAP_F, UNIMAP_NO, },
162     { UNIMAP_NO, UNIMAP_NO, UNIMAP_2, UNIMAP_Q, UNIMAP_LGUI, UNIMAP_Z, UNIMAP_A, UNIMAP_NO, },
163     { UNIMAP_NO, UNIMAP_NO, UNIMAP_6, UNIMAP_T, UNIMAP_SPACE, UNIMAP_B, UNIMAP_G, UNIMAP_NO, },
164     { UNIMAP_NO, UNIMAP_NO, UNIMAP_9, UNIMAP_I, UNIMAP_KANA, UNIMAP_COMMA, UNIMAP_K, UNIMAP_NO, },
165     { UNIMAP_NO, UNIMAP_NO, UNIMAP_8, UNIMAP_U, UNIMAP_HENK, UNIMAP_M, UNIMAP_J, UNIMAP_NO, },
166     { UNIMAP_NO, UNIMAP_NO, UNIMAP_7, UNIMAP_Y, UNIMAP_NO, UNIMAP_N, UNIMAP_H, UNIMAP_NO, },
167     { UNIMAP_NO, UNIMAP_NO, UNIMAP_0, UNIMAP_O, UNIMAP_RALT, UNIMAP_DOT, UNIMAP_L, UNIMAP_NO, },
168     { UNIMAP_NO, UNIMAP_NO, UNIMAP_BSPACE, UNIMAP_NO, UNIMAP_RIGHT, UNIMAP_RSHIFT, UNIMAP_ENTER, UNIMAP_NO, },
169     { UNIMAP_NO, UNIMAP_NO, UNIMAP_JYEN, UNIMAP_RBRACKET, UNIMAP_DOWN, UNIMAP_UP, UNIMAP_NONUS_HASH, UNIMAP_NO, },
170     { UNIMAP_NO, UNIMAP_NO, UNIMAP_MINUS, UNIMAP_P, UNIMAP_RCTRL, UNIMAP_SLASH, UNIMAP_SCOLON, UNIMAP_NO, },
171     { UNIMAP_NO, UNIMAP_NO, UNIMAP_EQUAL, UNIMAP_LBRACKET, UNIMAP_LEFT, UNIMAP_RO, UNIMAP_QUOTE, UNIMAP_NO, },
172 };
173 #endif
174
175 #endif