diff options
author | Jack Humbert <jack.humb@gmail.com> | 2016-05-18 23:47:16 -0400 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2016-05-18 23:47:16 -0400 |
commit | b732b79b49b098dba8e14493c745075f336747d8 (patch) | |
tree | 069f529df73ba8bfbcf7003f5ddd3987ecaadc57 | |
parent | bf545061f2a71b054ccdca6f6261bb7c2ffa4957 (diff) | |
download | qmk_firmware-b732b79b49b098dba8e14493c745075f336747d8.tar.gz qmk_firmware-b732b79b49b098dba8e14493c745075f336747d8.zip |
adapts unicode to quantum.c (#333)
* Unicode
to have unicode input you need to:
- set your OS input method to UNICODE if needed
- enable unicode in your makefile
- copy the action_function from
keyboard/planck/keymaps/unicode/unicode.c to your keymap.c
set the target OS method in your keymap.c: void matrix_init_user() {
set_unicode_mode(UC_OSX); } you can then switch when you want with:
set_unicode_mode(UC_OSX); set_unicode_mode(UC_LNX);
set_unicode_mode(UC_WIN);
put some unicode codes in your keymap like so: UC(0x0061)
I did change the bit mask in quantum/keymap_common.c and .h
I’m afraid we will need uint32 to get a total support for all unicode
tables or relocate the handler as @mbarkhau did.
* rearranges keycode values, hooks-up unicode
* removes extra lalt ref
* adds unicode shortcuts and example
-rw-r--r-- | keyboard/planck/keymaps/unicode/keymap.c | 326 | ||||
-rw-r--r-- | keyboard/planck/keymaps/unicode/makefile.mk | 1 | ||||
-rw-r--r-- | quantum/keymap_common.c | 26 | ||||
-rw-r--r-- | quantum/keymap_common.h | 76 | ||||
-rw-r--r-- | quantum/keymap_unicode.c | 61 | ||||
-rw-r--r-- | quantum/quantum.c | 79 | ||||
-rw-r--r-- | quantum/quantum.h | 44 | ||||
-rw-r--r-- | quantum/quantum.mk | 4 | ||||
-rw-r--r-- | quantum/unicode.h | 128 | ||||
-rw-r--r-- | tmk_core/common.mk | 4 |
10 files changed, 609 insertions, 140 deletions
diff --git a/keyboard/planck/keymaps/unicode/keymap.c b/keyboard/planck/keymaps/unicode/keymap.c new file mode 100644 index 000000000..d73e7e09d --- /dev/null +++ b/keyboard/planck/keymaps/unicode/keymap.c | |||
@@ -0,0 +1,326 @@ | |||
1 | /* | ||
2 | Copyright | ||
3 | 2015 Jack Humbert <jack.humb@gmail.com> | ||
4 | 2016 Francois Marlier <fmarlier@gmail.com> | ||
5 | |||
6 | This program is free software: you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation, either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | |||
19 | For more info on how this works per OS, see here | ||
20 | https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input | ||
21 | */ | ||
22 | |||
23 | |||
24 | #include "planck.h" | ||
25 | #include "action_layer.h" | ||
26 | #ifdef AUDIO_ENABLE | ||
27 | #include "audio.h" | ||
28 | #endif | ||
29 | #include "eeconfig.h" | ||
30 | |||
31 | extern keymap_config_t keymap_config; | ||
32 | |||
33 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
34 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
35 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
36 | // entirely and just use numbers. | ||
37 | #define _QWERTY 0 | ||
38 | #define _COLEMAK 1 | ||
39 | #define _DVORAK 2 | ||
40 | #define _LOWER 3 | ||
41 | #define _RAISE 4 | ||
42 | #define _PLOVER 5 | ||
43 | #define _ADJUST 16 | ||
44 | |||
45 | // Macro name shortcuts | ||
46 | #define QWERTY M(_QWERTY) | ||
47 | #define COLEMAK M(_COLEMAK) | ||
48 | #define DVORAK M(_DVORAK) | ||
49 | #define LOWER M(_LOWER) | ||
50 | #define RAISE M(_RAISE) | ||
51 | #define M_BL 5 | ||
52 | #define PLOVER M(12) | ||
53 | #define EXT_PLV M(13) | ||
54 | #define TOG_OUT M(14) | ||
55 | |||
56 | // Fillers to make layering more clear | ||
57 | #define _______ KC_TRNS | ||
58 | #define XXXXXXX KC_NO | ||
59 | |||
60 | |||
61 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
62 | |||
63 | /* Qwerty | ||
64 | * ,-----------------------------------------------------------------------------------. | ||
65 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | | ||
66 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
67 | * | Esc | A | S | D | F | G | H | J | K | L | ; | " | | ||
68 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
69 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
70 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
71 | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | ||
72 | * `-----------------------------------------------------------------------------------' | ||
73 | */ | ||
74 | [_QWERTY] = { | ||
75 | {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, | ||
76 | {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, | ||
77 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, | ||
78 | {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | ||
79 | }, | ||
80 | |||
81 | /* Colemak | ||
82 | * ,-----------------------------------------------------------------------------------. | ||
83 | * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | | ||
84 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
85 | * | Esc | A | R | S | T | D | H | N | E | I | O | " | | ||
86 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
87 | * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | | ||
88 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
89 | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | ||
90 | * `-----------------------------------------------------------------------------------' | ||
91 | */ | ||
92 | [_COLEMAK] = { | ||
93 | {KC_TAB, UC_q, UC_w, UC_f, UC_p, UC_g, UC_j, UC_l, UC_u, UC_y, UC_SCLN, UC_BSPC}, | ||
94 | {KC_ESC, UC_a, UC_r, UC_s, UC_t, UC_d, UC_h, UC_n, UC_e, UC_i, UC_o, UC_QUOT}, | ||
95 | {KC_LSFT, UC_z, UC_x, UC_c, UC_v, UC_b, UC_k, UC_m, UC_COMM, UC_DOT, UC_SLSH, KC_ENT}, | ||
96 | {KC_TRNS, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | ||
97 | }, | ||
98 | |||
99 | /* Dvorak | ||
100 | * ,-----------------------------------------------------------------------------------. | ||
101 | * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | | ||
102 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
103 | * | Esc | A | O | E | U | I | D | H | T | N | S | / | | ||
104 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
105 | * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | | ||
106 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
107 | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | ||
108 | * `-----------------------------------------------------------------------------------' | ||
109 | */ | ||
110 | [_DVORAK] = { | ||
111 | {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, | ||
112 | {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, | ||
113 | {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, | ||
114 | {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | ||
115 | }, | ||
116 | |||
117 | /* Lower | ||
118 | * ,-----------------------------------------------------------------------------------. | ||
119 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
120 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
121 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | ||
122 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
123 | * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter | | ||
124 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
125 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
126 | * `-----------------------------------------------------------------------------------' | ||
127 | */ | ||
128 | [_LOWER] = { | ||
129 | {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, | ||
130 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, | ||
131 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, | ||
132 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} | ||
133 | }, | ||
134 | |||
135 | /* Raise | ||
136 | * ,-----------------------------------------------------------------------------------. | ||
137 | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | | ||
138 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
139 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | | ||
140 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
141 | * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter | | ||
142 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
143 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
144 | * `-----------------------------------------------------------------------------------' | ||
145 | */ | ||
146 | [_RAISE] = { | ||
147 | {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, | ||
148 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, | ||
149 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, | ||
150 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} | ||
151 | }, | ||
152 | |||
153 | /* Plover layer (http://opensteno.org) | ||
154 | * ,-----------------------------------------------------------------------------------. | ||
155 | * | # | # | # | # | # | # | # | # | # | # | # | # | | ||
156 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
157 | * | | S | T | P | H | * | * | F | P | L | T | D | | ||
158 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
159 | * |TogOut| S | K | W | R | * | * | R | B | G | S | Z | | ||
160 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
161 | * | Exit | | | A | O | | E | U | | | | | ||
162 | * `-----------------------------------------------------------------------------------' | ||
163 | */ | ||
164 | |||
165 | [_PLOVER] = { | ||
166 | {KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 }, | ||
167 | {XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC}, | ||
168 | {TOG_OUT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, | ||
169 | {EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX} | ||
170 | }, | ||
171 | |||
172 | /* Adjust (Lower + Raise) | ||
173 | * ,-----------------------------------------------------------------------------------. | ||
174 | * | | Reset| | | | | | | | | | Del | | ||
175 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
176 | * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | | ||
177 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
178 | * | |Voice-|Voice+|Mus on|Musoff| | | | | | | | | ||
179 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
180 | * | | | | | | | | | | | | | ||
181 | * `-----------------------------------------------------------------------------------' | ||
182 | */ | ||
183 | [_ADJUST] = { | ||
184 | {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, | ||
185 | {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______}, | ||
186 | {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, | ||
187 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||
188 | } | ||
189 | |||
190 | |||
191 | }; | ||
192 | |||
193 | const uint16_t PROGMEM fn_actions[] = { | ||
194 | |||
195 | }; | ||
196 | |||
197 | #ifdef AUDIO_ENABLE | ||
198 | float tone_startup[][2] = { | ||
199 | {440.0*pow(2.0,(31)/12.0), 12}, | ||
200 | {440.0*pow(2.0,(28)/12.0), 8}, | ||
201 | {440.0*pow(2.0,(19)/12.0), 8}, | ||
202 | {440.0*pow(2.0,(24)/12.0), 8}, | ||
203 | {440.0*pow(2.0,(28)/12.0), 20} | ||
204 | }; | ||
205 | |||
206 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
207 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
208 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
209 | float tone_plover[][2] = SONG(PLOVER_SOUND); | ||
210 | float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); | ||
211 | |||
212 | float goodbye[][2] = SONG(GOODBYE_SOUND); | ||
213 | #endif | ||
214 | |||
215 | |||
216 | void persistant_default_layer_set(uint16_t default_layer) { | ||
217 | eeconfig_update_default_layer(default_layer); | ||
218 | default_layer_set(default_layer); | ||
219 | } | ||
220 | |||
221 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
222 | { | ||
223 | switch(id) { | ||
224 | case _QWERTY: | ||
225 | if (record->event.pressed) { | ||
226 | #ifdef AUDIO_ENABLE | ||
227 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
228 | #endif | ||
229 | persistant_default_layer_set(1UL<<_QWERTY); | ||
230 | } | ||
231 | break; | ||
232 | case _COLEMAK: | ||
233 | if (record->event.pressed) { | ||
234 | #ifdef AUDIO_ENABLE | ||
235 | PLAY_NOTE_ARRAY(tone_colemak, false, 0); | ||
236 | #endif | ||
237 | persistant_default_layer_set(1UL<<_COLEMAK); | ||
238 | } | ||
239 | break; | ||
240 | case _DVORAK: | ||
241 | if (record->event.pressed) { | ||
242 | #ifdef AUDIO_ENABLE | ||
243 | PLAY_NOTE_ARRAY(tone_dvorak, false, 0); | ||
244 | #endif | ||
245 | persistant_default_layer_set(1UL<<_DVORAK); | ||
246 | } | ||
247 | break; | ||
248 | case _LOWER: | ||
249 | if (record->event.pressed) { | ||
250 | layer_on(_LOWER); | ||
251 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
252 | } else { | ||
253 | layer_off(_LOWER); | ||
254 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
255 | } | ||
256 | break; | ||
257 | case _RAISE: | ||
258 | if (record->event.pressed) { | ||
259 | layer_on(_RAISE); | ||
260 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
261 | } else { | ||
262 | layer_off(_RAISE); | ||
263 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
264 | } | ||
265 | break; | ||
266 | case M_BL: | ||
267 | if (record->event.pressed) { | ||
268 | register_code(KC_RSFT); | ||
269 | #ifdef BACKLIGHT_ENABLE | ||
270 | backlight_step(); | ||
271 | #endif | ||
272 | } else { | ||
273 | unregister_code(KC_RSFT); | ||
274 | } | ||
275 | break; | ||
276 | case 12: | ||
277 | if (record->event.pressed) { | ||
278 | #ifdef AUDIO_ENABLE | ||
279 | stop_all_notes(); | ||
280 | PLAY_NOTE_ARRAY(tone_plover, false, 0); | ||
281 | #endif | ||
282 | layer_off(_RAISE); | ||
283 | layer_off(_LOWER); | ||
284 | layer_off(_ADJUST); | ||
285 | layer_on(_PLOVER); | ||
286 | if (!eeconfig_is_enabled()) { | ||
287 | eeconfig_init(); | ||
288 | } | ||
289 | keymap_config.raw = eeconfig_read_keymap(); | ||
290 | keymap_config.nkro = 1; | ||
291 | eeconfig_update_keymap(keymap_config.raw); | ||
292 | } | ||
293 | break; | ||
294 | case 13: | ||
295 | if (record->event.pressed) { | ||
296 | #ifdef AUDIO_ENABLE | ||
297 | PLAY_NOTE_ARRAY(tone_plover_gb, false, 0); | ||
298 | #endif | ||
299 | layer_off(_PLOVER); | ||
300 | } | ||
301 | break; | ||
302 | case 14: | ||
303 | if (record->event.pressed) { | ||
304 | return MACRO( D(E), D(R), D(F), D(V), D(O), D(L), U(E), U(R), U(F), U(V), U(O), U(L), END ); | ||
305 | } | ||
306 | break; | ||
307 | } | ||
308 | return MACRO_NONE; | ||
309 | }; | ||
310 | |||
311 | void matrix_init_user(void) { | ||
312 | #ifdef AUDIO_ENABLE | ||
313 | _delay_ms(20); // stops the tick | ||
314 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
315 | #endif | ||
316 | } | ||
317 | |||
318 | #ifdef AUDIO_ENABLE | ||
319 | void play_goodbye_tone() | ||
320 | { | ||
321 | PLAY_NOTE_ARRAY(goodbye, false, 0); | ||
322 | _delay_ms(150); | ||
323 | } | ||
324 | #endif | ||
325 | |||
326 | |||
diff --git a/keyboard/planck/keymaps/unicode/makefile.mk b/keyboard/planck/keymaps/unicode/makefile.mk new file mode 100644 index 000000000..9b27b08be --- /dev/null +++ b/keyboard/planck/keymaps/unicode/makefile.mk | |||
@@ -0,0 +1 @@ | |||
UNICODE_ENABLE = yes # Unicode | |||
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 2aae13e67..1d9ab2e05 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c | |||
@@ -31,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
31 | #include "keymap_midi.h" | 31 | #include "keymap_midi.h" |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | |||
35 | extern keymap_config_t keymap_config; | 34 | extern keymap_config_t keymap_config; |
36 | 35 | ||
37 | #include <stdio.h> | 36 | #include <stdio.h> |
@@ -154,20 +153,22 @@ static action_t keycode_to_action(uint16_t keycode) | |||
154 | case KC_TRNS: | 153 | case KC_TRNS: |
155 | action.code = ACTION_TRANSPARENT; | 154 | action.code = ACTION_TRANSPARENT; |
156 | break; | 155 | break; |
157 | case 0x0100 ... 0x1FFF: ; | 156 | case LCTL(0) ... 0x1FFF: ; |
158 | // Has a modifier | 157 | // Has a modifier |
159 | // Split it up | 158 | // Split it up |
160 | action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key | 159 | action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key |
161 | break; | 160 | break; |
162 | case 0x2000 ... 0x2FFF: | 161 | case FUNC(0) ... FUNC(0xFFF): ; |
163 | // Is a shortcut for function layer, pull last 12bits | 162 | // Is a shortcut for function layer, pull last 12bits |
164 | // This means we have 4,096 FN macros at our disposal | 163 | // This means we have 4,096 FN macros at our disposal |
165 | return keymap_func_to_action(keycode & 0xFFF); | 164 | return keymap_func_to_action(keycode & 0xFFF); |
166 | break; | 165 | break; |
167 | case 0x3000 ... 0x3FFF: ; | 166 | case M(0) ... M(0xFF): |
168 | // When the code starts with 3, it's an action macro. | ||
169 | action.code = ACTION_MACRO(keycode & 0xFF); | 167 | action.code = ACTION_MACRO(keycode & 0xFF); |
170 | break; | 168 | break; |
169 | case LT(0, 0) ... LT(0xFF, 0xF): | ||
170 | action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); | ||
171 | break; | ||
171 | #ifdef BACKLIGHT_ENABLE | 172 | #ifdef BACKLIGHT_ENABLE |
172 | case BL_0 ... BL_15: | 173 | case BL_0 ... BL_15: |
173 | action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F); | 174 | action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F); |
@@ -201,7 +202,7 @@ static action_t keycode_to_action(uint16_t keycode) | |||
201 | print("\nDEBUG: enabled.\n"); | 202 | print("\nDEBUG: enabled.\n"); |
202 | debug_enable = true; | 203 | debug_enable = true; |
203 | break; | 204 | break; |
204 | case 0x5002 ... 0x50FF: | 205 | case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_UNSWAP_ALT_GUI: |
205 | // MAGIC actions (BOOTMAGIC without the boot) | 206 | // MAGIC actions (BOOTMAGIC without the boot) |
206 | if (!eeconfig_is_enabled()) { | 207 | if (!eeconfig_is_enabled()) { |
207 | eeconfig_init(); | 208 | eeconfig_init(); |
@@ -251,7 +252,7 @@ static action_t keycode_to_action(uint16_t keycode) | |||
251 | } | 252 | } |
252 | eeconfig_update_keymap(keymap_config.raw); | 253 | eeconfig_update_keymap(keymap_config.raw); |
253 | break; | 254 | break; |
254 | case 0x5100 ... 0x56FF: ; | 255 | case TO(0, 1) ... OSM(0xFF): ; |
255 | // Layer movement shortcuts | 256 | // Layer movement shortcuts |
256 | // See .h to see constraints/usage | 257 | // See .h to see constraints/usage |
257 | int type = (keycode >> 0x8) & 0xF; | 258 | int type = (keycode >> 0x8) & 0xF; |
@@ -282,18 +283,9 @@ static action_t keycode_to_action(uint16_t keycode) | |||
282 | action.code = ACTION_MODS_ONESHOT(mod); | 283 | action.code = ACTION_MODS_ONESHOT(mod); |
283 | } | 284 | } |
284 | break; | 285 | break; |
285 | case 0x7000 ... 0x7FFF: | 286 | case MT(0, 0) ... MT(0xF, 0xFF): |
286 | action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); | 287 | action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); |
287 | break; | 288 | break; |
288 | case 0x8000 ... 0x8FFF: | ||
289 | action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); | ||
290 | break; | ||
291 | #ifdef UNICODE_ENABLE | ||
292 | case 0x8000000 ... 0x8FFFFFF: | ||
293 | uint16_t unicode = keycode & ~(0x8000); | ||
294 | action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8); | ||
295 | break; | ||
296 | #endif | ||
297 | default: | 289 | default: |
298 | action.code = ACTION_NO; | 290 | action.code = ACTION_NO; |
299 | break; | 291 | break; |
diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h index 1cbe8c61c..91d5c09c1 100644 --- a/quantum/keymap_common.h +++ b/quantum/keymap_common.h | |||
@@ -163,38 +163,13 @@ extern const uint16_t fn_actions[]; | |||
163 | 163 | ||
164 | #define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) | 164 | #define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) |
165 | 165 | ||
166 | // These affect the backlight (if your keyboard has one). | 166 | // 0x3100+ is free |
167 | // We don't need to comment them out if your keyboard doesn't have a backlight, | 167 | |
168 | // since they don't take up any space. | 168 | // L-ayer, T-ap - 256 keycode max, 16 layer max |
169 | #define BL_ON 0x4009 | 169 | #define LT(layer, kc) (kc | 0x4000 | ((layer & 0xF) << 8)) |
170 | #define BL_OFF 0x4000 | ||
171 | #define BL_0 0x4000 | ||
172 | #define BL_1 0x4001 | ||
173 | #define BL_2 0x4002 | ||
174 | #define BL_3 0x4003 | ||
175 | #define BL_4 0x4004 | ||
176 | #define BL_5 0x4005 | ||
177 | #define BL_6 0x4006 | ||
178 | #define BL_7 0x4007 | ||
179 | #define BL_8 0x4008 | ||
180 | #define BL_9 0x4009 | ||
181 | #define BL_10 0x400A | ||
182 | #define BL_11 0x400B | ||
183 | #define BL_12 0x400C | ||
184 | #define BL_13 0x400D | ||
185 | #define BL_14 0x400E | ||
186 | #define BL_15 0x400F | ||
187 | #define BL_DEC 0x4010 | ||
188 | #define BL_INC 0x4011 | ||
189 | #define BL_TOGG 0x4012 | ||
190 | #define BL_STEP 0x4013 | ||
191 | 170 | ||
192 | #define RESET 0x5000 | 171 | #define RESET 0x5000 |
193 | #define DEBUG 0x5001 | 172 | #define DEBUG 0x5001 |
194 | #define KC_LEAD 0x5014 | ||
195 | |||
196 | |||
197 | |||
198 | 173 | ||
199 | // MAGIC keycodes | 174 | // MAGIC keycodes |
200 | #define MAGIC_SWAP_CONTROL_CAPSLOCK 0x5002 | 175 | #define MAGIC_SWAP_CONTROL_CAPSLOCK 0x5002 |
@@ -239,6 +214,32 @@ extern const uint16_t fn_actions[]; | |||
239 | #define MI_ON 0x5028 | 214 | #define MI_ON 0x5028 |
240 | #define MI_OFF 0x5029 | 215 | #define MI_OFF 0x5029 |
241 | 216 | ||
217 | // These affect the backlight (if your keyboard has one). | ||
218 | // We don't need to comment them out if your keyboard doesn't have a backlight, | ||
219 | // since they don't take up any space. | ||
220 | #define BL_ON 0x5079 | ||
221 | #define BL_OFF 0x5070 | ||
222 | #define BL_0 0x5070 | ||
223 | #define BL_1 0x5071 | ||
224 | #define BL_2 0x5072 | ||
225 | #define BL_3 0x5073 | ||
226 | #define BL_4 0x5074 | ||
227 | #define BL_5 0x5075 | ||
228 | #define BL_6 0x5076 | ||
229 | #define BL_7 0x5077 | ||
230 | #define BL_8 0x5078 | ||
231 | #define BL_9 0x5079 | ||
232 | #define BL_10 0x507A | ||
233 | #define BL_11 0x507B | ||
234 | #define BL_12 0x507C | ||
235 | #define BL_13 0x507D | ||
236 | #define BL_14 0x507E | ||
237 | #define BL_15 0x507F | ||
238 | #define BL_DEC 0x5080 | ||
239 | #define BL_INC 0x5081 | ||
240 | #define BL_TOGG 0x5082 | ||
241 | #define BL_STEP 0x5083 | ||
242 | |||
242 | // GOTO layer - 16 layers max | 243 | // GOTO layer - 16 layers max |
243 | // when: | 244 | // when: |
244 | // ON_PRESS = 1 | 245 | // ON_PRESS = 1 |
@@ -261,6 +262,8 @@ extern const uint16_t fn_actions[]; | |||
261 | // One-shot mod | 262 | // One-shot mod |
262 | #define OSM(layer) (layer | 0x5600) | 263 | #define OSM(layer) (layer | 0x5600) |
263 | 264 | ||
265 | // chording is currently at 0x57xx | ||
266 | |||
264 | // M-od, T-ap - 256 keycode max | 267 | // M-od, T-ap - 256 keycode max |
265 | #define MT(mod, kc) (kc | 0x7000 | ((mod & 0xF) << 8)) | 268 | #define MT(mod, kc) (kc | 0x7000 | ((mod & 0xF) << 8)) |
266 | #define CTL_T(kc) MT(0x1, kc) | 269 | #define CTL_T(kc) MT(0x1, kc) |
@@ -276,14 +279,13 @@ extern const uint16_t fn_actions[]; | |||
276 | #define KC_HYPR HYPR(KC_NO) | 279 | #define KC_HYPR HYPR(KC_NO) |
277 | #define KC_MEH MEH(KC_NO) | 280 | #define KC_MEH MEH(KC_NO) |
278 | 281 | ||
279 | // L-ayer, T-ap - 256 keycode max, 16 layer max | 282 | #ifdef UNICODE_ENABLE |
280 | #define LT(layer, kc) (kc | 0x8000 | ((layer & 0xF) << 8)) | 283 | // For sending unicode codes. |
281 | 284 | // You may not send codes over 7FFF -- this supports most of UTF8. | |
282 | // For sending unicode codes. | 285 | // To have a key that sends out Œ, go UC(0x0152) |
283 | // You may not send codes over 1FFF -- this supports most of UTF8. | 286 | #define UNICODE(n) (n | 0x8000) |
284 | // To have a key that sends out Œ, go UC(0x0152) | 287 | #define UC(n) UNICODE(n) |
285 | #define UNICODE(n) (n | 0x8000) | 288 | #endif |
286 | #define UC(n) UNICODE(n) | ||
287 | 289 | ||
288 | // For tri-layer | 290 | // For tri-layer |
289 | void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); | 291 | void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); |
diff --git a/quantum/keymap_unicode.c b/quantum/keymap_unicode.c deleted file mode 100644 index a44965e61..000000000 --- a/quantum/keymap_unicode.c +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | /* | ||
2 | Copyright 2015 Jack Humbert <jack.humb@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 | |||
18 | #include "keymap_common.h" | ||
19 | |||
20 | uint16_t hextokeycode(int hex) { | ||
21 | if (hex == 0x0) { | ||
22 | return KC_0; | ||
23 | } else if (hex < 0xA) { | ||
24 | return KC_1 + (hex - 0x1); | ||
25 | } else { | ||
26 | return KC_A + (hex - 0xA); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
31 | { | ||
32 | |||
33 | // For more info on how this works per OS, see here: https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input | ||
34 | |||
35 | if (record->event.pressed) { | ||
36 | uint16_t unicode = (opt << 8) | id; | ||
37 | register_code(KC_LALT); | ||
38 | |||
39 | register_code(hextokeycode((unicode & 0xF000) >> 12)); | ||
40 | unregister_code(hextokeycode((unicode & 0xF000) >> 12)); | ||
41 | register_code(hextokeycode((unicode & 0x0F00) >> 8)); | ||
42 | unregister_code(hextokeycode((unicode & 0x0F00) >> 8)); | ||
43 | register_code(hextokeycode((unicode & 0x00F0) >> 4)); | ||
44 | unregister_code(hextokeycode((unicode & 0x00F0) >> 4)); | ||
45 | register_code(hextokeycode((unicode & 0x000F))); | ||
46 | unregister_code(hextokeycode((unicode & 0x000F))); | ||
47 | |||
48 | /* Test 'a' */ | ||
49 | // register_code(hextokeycode(0x0)); | ||
50 | // unregister_code(hextokeycode(0x0)); | ||
51 | // register_code(hextokeycode(0x0)); | ||
52 | // unregister_code(hextokeycode(0x0)); | ||
53 | // register_code(hextokeycode(0x6)); | ||
54 | // unregister_code(hextokeycode(0x6)); | ||
55 | // register_code(hextokeycode(0x1)); | ||
56 | // unregister_code(hextokeycode(0x1)); | ||
57 | |||
58 | unregister_code(KC_LALT); | ||
59 | } | ||
60 | return; | ||
61 | } \ No newline at end of file | ||
diff --git a/quantum/quantum.c b/quantum/quantum.c index e4d7b9185..1e91ac04a 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
@@ -23,6 +23,18 @@ int offset = 7; | |||
23 | 23 | ||
24 | #ifdef AUDIO_ENABLE | 24 | #ifdef AUDIO_ENABLE |
25 | bool music_activated = false; | 25 | bool music_activated = false; |
26 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
27 | |||
28 | // music sequencer | ||
29 | static bool music_sequence_recording = false; | ||
30 | static bool music_sequence_playing = false; | ||
31 | static float music_sequence[16] = {0}; | ||
32 | static uint8_t music_sequence_count = 0; | ||
33 | static uint8_t music_sequence_position = 0; | ||
34 | |||
35 | static uint16_t music_sequence_timer = 0; | ||
36 | static uint16_t music_sequence_interval = 100; | ||
37 | |||
26 | #endif | 38 | #endif |
27 | 39 | ||
28 | #ifdef MIDI_ENABLE | 40 | #ifdef MIDI_ENABLE |
@@ -44,6 +56,10 @@ uint8_t chord_keys[CHORDING_MAX] = {0}; | |||
44 | uint8_t chord_key_count = 0; | 56 | uint8_t chord_key_count = 0; |
45 | uint8_t chord_key_down = 0; | 57 | uint8_t chord_key_down = 0; |
46 | 58 | ||
59 | #ifdef UNICODE_ENABLE | ||
60 | static uint8_t input_mode; | ||
61 | #endif | ||
62 | |||
47 | bool keys_chord(uint8_t keys[]) { | 63 | bool keys_chord(uint8_t keys[]) { |
48 | uint8_t keys_size = sizeof(keys)/sizeof(keys[0]); | 64 | uint8_t keys_size = sizeof(keys)/sizeof(keys[0]); |
49 | bool pass = true; | 65 | bool pass = true; |
@@ -66,14 +82,25 @@ bool keys_chord(uint8_t keys[]) { | |||
66 | return (pass && (in == keys_size)); | 82 | return (pass && (in == keys_size)); |
67 | } | 83 | } |
68 | 84 | ||
69 | static bool music_sequence_recording = false; | 85 | #ifdef UNICODE_ENABLE |
70 | static bool music_sequence_playing = false; | 86 | |
71 | static float music_sequence[16] = {0}; | 87 | uint16_t hex_to_keycode(uint8_t hex) |
72 | static uint8_t music_sequence_count = 0; | 88 | { |
73 | static uint8_t music_sequence_position = 0; | 89 | if (hex == 0x0) { |
90 | return KC_0; | ||
91 | } else if (hex < 0xA) { | ||
92 | return KC_1 + (hex - 0x1); | ||
93 | } else { | ||
94 | return KC_A + (hex - 0xA); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | void set_unicode_mode(uint8_t os_target) | ||
99 | { | ||
100 | input_mode = os_target; | ||
101 | } | ||
74 | 102 | ||
75 | static uint16_t music_sequence_timer = 0; | 103 | #endif |
76 | static uint16_t music_sequence_interval = 100; | ||
77 | 104 | ||
78 | bool process_record_quantum(keyrecord_t *record) { | 105 | bool process_record_quantum(keyrecord_t *record) { |
79 | 106 | ||
@@ -347,6 +374,44 @@ bool process_record_quantum(keyrecord_t *record) { | |||
347 | 374 | ||
348 | #endif | 375 | #endif |
349 | 376 | ||
377 | #ifdef UNICODE_ENABLE | ||
378 | |||
379 | if (keycode > UNICODE(0) && record->event.pressed) { | ||
380 | uint16_t unicode = keycode & 0x7FFF; | ||
381 | switch(input_mode) { | ||
382 | case UC_OSX: | ||
383 | register_code(KC_LALT); | ||
384 | break; | ||
385 | case UC_LNX: | ||
386 | register_code(KC_LCTL); | ||
387 | register_code(KC_LSFT); | ||
388 | register_code(KC_U); | ||
389 | unregister_code(KC_U); | ||
390 | break; | ||
391 | case UC_WIN: | ||
392 | register_code(KC_LALT); | ||
393 | register_code(KC_PPLS); | ||
394 | unregister_code(KC_PPLS); | ||
395 | break; | ||
396 | } | ||
397 | for(int i = 3; i >= 0; i--) { | ||
398 | uint8_t digit = ((unicode >> (i*4)) & 0xF); | ||
399 | register_code(hex_to_keycode(digit)); | ||
400 | unregister_code(hex_to_keycode(digit)); | ||
401 | } | ||
402 | switch(input_mode) { | ||
403 | case UC_OSX: | ||
404 | case UC_WIN: | ||
405 | unregister_code(KC_LALT); | ||
406 | break; | ||
407 | case UC_LNX: | ||
408 | unregister_code(KC_LCTL); | ||
409 | unregister_code(KC_LSFT); | ||
410 | break; | ||
411 | } | ||
412 | } | ||
413 | |||
414 | #endif | ||
350 | 415 | ||
351 | return process_action_kb(record); | 416 | return process_action_kb(record); |
352 | } | 417 | } |
diff --git a/quantum/quantum.h b/quantum/quantum.h index f4d8f09d4..d4da77289 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
@@ -13,9 +13,12 @@ | |||
13 | #include "audio.h" | 13 | #include "audio.h" |
14 | #endif | 14 | #endif |
15 | #ifdef MIDI_ENABLE | 15 | #ifdef MIDI_ENABLE |
16 | // #include <keymap_midi.h> | ||
17 | #include <lufa.h> | 16 | #include <lufa.h> |
18 | #endif | 17 | #endif |
18 | #ifdef UNICODE_ENABLE | ||
19 | #include "unicode.h" | ||
20 | #endif | ||
21 | |||
19 | #include "action_layer.h" | 22 | #include "action_layer.h" |
20 | #include "eeconfig.h" | 23 | #include "eeconfig.h" |
21 | #include <stddef.h> | 24 | #include <stddef.h> |
@@ -27,24 +30,37 @@ extern uint32_t default_layer_state; | |||
27 | extern uint32_t layer_state; | 30 | extern uint32_t layer_state; |
28 | #endif | 31 | #endif |
29 | 32 | ||
30 | bool music_activated; | 33 | #ifdef AUDIO_ENABLE |
34 | bool music_activated; | ||
35 | #endif | ||
31 | 36 | ||
32 | void matrix_init_kb(void); | 37 | #ifdef UNICODE_ENABLE |
33 | void matrix_scan_kb(void); | 38 | #define UC_OSX 0 |
34 | bool process_action_kb(keyrecord_t *record); | 39 | #define UC_LNX 1 |
40 | #define UC_WIN 2 | ||
41 | #define UC_BSD 3 | ||
35 | 42 | ||
36 | void leader_start(void); | 43 | void set_unicode_input_mode(uint8_t os_target); |
37 | void leader_end(void); | 44 | #endif |
45 | |||
46 | #ifndef DISABLE_LEADER | ||
47 | void leader_start(void); | ||
48 | void leader_end(void); | ||
49 | |||
50 | #ifndef LEADER_TIMEOUT | ||
51 | #define LEADER_TIMEOUT 200 | ||
52 | #endif | ||
53 | #define SEQ_ONE_KEY(key) if (leader_sequence[0] == (key) && leader_sequence[1] == 0 && leader_sequence[2] == 0) | ||
54 | #define SEQ_TWO_KEYS(key1, key2) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == 0) | ||
55 | #define SEQ_THREE_KEYS(key1, key2, key3) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3)) | ||
38 | 56 | ||
39 | #ifndef LEADER_TIMEOUT | 57 | #define LEADER_EXTERNS() extern bool leading; extern uint16_t leader_time; extern uint16_t leader_sequence[3]; extern uint8_t leader_sequence_size |
40 | #define LEADER_TIMEOUT 200 | 58 | #define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT) |
41 | #endif | 59 | #endif |
42 | #define SEQ_ONE_KEY(key) if (leader_sequence[0] == (key) && leader_sequence[1] == 0 && leader_sequence[2] == 0) | ||
43 | #define SEQ_TWO_KEYS(key1, key2) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == 0) | ||
44 | #define SEQ_THREE_KEYS(key1, key2, key3) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3)) | ||
45 | 60 | ||
46 | #define LEADER_EXTERNS() extern bool leading; extern uint16_t leader_time; extern uint16_t leader_sequence[3]; extern uint8_t leader_sequence_size | 61 | void matrix_init_kb(void); |
47 | #define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT) | 62 | void matrix_scan_kb(void); |
63 | bool process_action_kb(keyrecord_t *record); | ||
48 | 64 | ||
49 | bool is_music_on(void); | 65 | bool is_music_on(void); |
50 | void music_toggle(void); | 66 | void music_toggle(void); |
diff --git a/quantum/quantum.mk b/quantum/quantum.mk index e7ccfd659..c099d6793 100644 --- a/quantum/quantum.mk +++ b/quantum/quantum.mk | |||
@@ -34,10 +34,6 @@ ifeq ($(strip $(AUDIO_ENABLE)), yes) | |||
34 | SRC += $(QUANTUM_DIR)/audio/luts.c | 34 | SRC += $(QUANTUM_DIR)/audio/luts.c |
35 | endif | 35 | endif |
36 | 36 | ||
37 | ifeq ($(strip $(UNICODE_ENABLE)), yes) | ||
38 | SRC += $(QUANTUM_DIR)/keymap_unicode.c | ||
39 | endif | ||
40 | |||
41 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | 37 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) |
42 | SRC += $(QUANTUM_DIR)/light_ws2812.c | 38 | SRC += $(QUANTUM_DIR)/light_ws2812.c |
43 | SRC += $(QUANTUM_DIR)/rgblight.c | 39 | SRC += $(QUANTUM_DIR)/rgblight.c |
diff --git a/quantum/unicode.h b/quantum/unicode.h new file mode 100644 index 000000000..756ec8bc3 --- /dev/null +++ b/quantum/unicode.h | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | Copyright 2016 Jack Humbert <jack.humb@gmail.com> | ||
3 | This program is free software: you can redistribute it and/or modify | ||
4 | it under the terms of the GNU General Public License as published by | ||
5 | the Free Software Foundation, either version 2 of the License, or | ||
6 | (at your option) any later version. | ||
7 | This program is distributed in the hope that it will be useful, | ||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | GNU General Public License for more details. | ||
11 | You should have received a copy of the GNU General Public License | ||
12 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
13 | */ | ||
14 | |||
15 | #ifndef UNICODE_H | ||
16 | #define UNICODE_H | ||
17 | |||
18 | #include "quantum.h" | ||
19 | #include <math.h> | ||
20 | |||
21 | #define UC_BSPC UC(0x0008) | ||
22 | |||
23 | #define UC_SPC UC(0x0020) | ||
24 | |||
25 | #define UC_EXLM UC(0x0021) | ||
26 | #define UC_DQUT UC(0x0022) | ||
27 | #define UC_HASH UC(0x0023) | ||
28 | #define UC_DLR UC(0x0024) | ||
29 | #define UC_PERC UC(0x0025) | ||
30 | #define UC_AMPR UC(0x0026) | ||
31 | #define UC_QUOT UC(0x0027) | ||
32 | #define UC_LPRN UC(0x0028) | ||
33 | #define UC_RPRN UC(0x0029) | ||
34 | #define UC_ASTR UC(0x002A) | ||
35 | #define UC_PLUS UC(0x002B) | ||
36 | #define UC_COMM UC(0x002C) | ||
37 | #define UC_DASH UC(0x002D) | ||
38 | #define UC_DOT UC(0x002E) | ||
39 | #define UC_SLSH UC(0x002F) | ||
40 | |||
41 | #define UC_0 UC(0x0030) | ||
42 | #define UC_1 UC(0x0031) | ||
43 | #define UC_2 UC(0x0032) | ||
44 | #define UC_3 UC(0x0033) | ||
45 | #define UC_4 UC(0x0034) | ||
46 | #define UC_5 UC(0x0035) | ||
47 | #define UC_6 UC(0x0036) | ||
48 | #define UC_7 UC(0x0037) | ||
49 | #define UC_8 UC(0x0038) | ||
50 | #define UC_9 UC(0x0039) | ||
51 | |||
52 | #define UC_COLN UC(0x003A) | ||
53 | #define UC_SCLN UC(0x003B) | ||
54 | #define UC_LT UC(0x003C) | ||
55 | #define UC_EQL UC(0x003D) | ||
56 | #define UC_GT UC(0x003E) | ||
57 | #define UC_QUES UC(0x003F) | ||
58 | #define UC_AT UC(0x0040) | ||
59 | |||
60 | #define UC_A UC(0x0041) | ||
61 | #define UC_B UC(0x0042) | ||
62 | #define UC_C UC(0x0043) | ||
63 | #define UC_D UC(0x0044) | ||
64 | #define UC_E UC(0x0045) | ||
65 | #define UC_F UC(0x0046) | ||
66 | #define UC_G UC(0x0047) | ||
67 | #define UC_H UC(0x0048) | ||
68 | #define UC_I UC(0x0049) | ||
69 | #define UC_J UC(0x004A) | ||
70 | #define UC_K UC(0x004B) | ||
71 | #define UC_L UC(0x004C) | ||
72 | #define UC_M UC(0x004D) | ||
73 | #define UC_N UC(0x004E) | ||
74 | #define UC_O UC(0x004F) | ||
75 | #define UC_P UC(0x0050) | ||
76 | #define UC_Q UC(0x0051) | ||
77 | #define UC_R UC(0x0052) | ||
78 | #define UC_S UC(0x0053) | ||
79 | #define UC_T UC(0x0054) | ||
80 | #define UC_U UC(0x0055) | ||
81 | #define UC_V UC(0x0056) | ||
82 | #define UC_W UC(0x0057) | ||
83 | #define UC_X UC(0x0058) | ||
84 | #define UC_Y UC(0x0059) | ||
85 | #define UC_Z UC(0x005A) | ||
86 | |||
87 | #define UC_LBRC UC(0x005B) | ||
88 | #define UC_BSLS UC(0x005C) | ||
89 | #define UC_RBRC UC(0x005D) | ||
90 | #define UC_CIRM UC(0x005E) | ||
91 | #define UC_UNDR UC(0x005F) | ||
92 | |||
93 | #define UC_GRV UC(0x0060) | ||
94 | |||
95 | #define UC_a UC(0x0061) | ||
96 | #define UC_b UC(0x0062) | ||
97 | #define UC_c UC(0x0063) | ||
98 | #define UC_d UC(0x0064) | ||
99 | #define UC_e UC(0x0065) | ||
100 | #define UC_f UC(0x0066) | ||
101 | #define UC_g UC(0x0067) | ||
102 | #define UC_h UC(0x0068) | ||
103 | #define UC_i UC(0x0069) | ||
104 | #define UC_j UC(0x006A) | ||
105 | #define UC_k UC(0x006B) | ||
106 | #define UC_l UC(0x006C) | ||
107 | #define UC_m UC(0x006D) | ||
108 | #define UC_n UC(0x006E) | ||
109 | #define UC_o UC(0x006F) | ||
110 | #define UC_p UC(0x0070) | ||
111 | #define UC_q UC(0x0071) | ||
112 | #define UC_r UC(0x0072) | ||
113 | #define UC_s UC(0x0073) | ||
114 | #define UC_t UC(0x0074) | ||
115 | #define UC_u UC(0x0075) | ||
116 | #define UC_v UC(0x0076) | ||
117 | #define UC_w UC(0x0077) | ||
118 | #define UC_x UC(0x0078) | ||
119 | #define UC_y UC(0x0079) | ||
120 | #define UC_z UC(0x007A) | ||
121 | |||
122 | #define UC_LCBR UC(0x007B) | ||
123 | #define UC_PIPE UC(0x007C) | ||
124 | #define UC_RCBR UC(0x007D) | ||
125 | #define UC_TILD UC(0x007E) | ||
126 | #define UC_DEL UC(0x007F) | ||
127 | |||
128 | #endif \ No newline at end of file | ||
diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 9cb2eb8ec..b5d7e39dd 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk | |||
@@ -60,6 +60,10 @@ ifeq ($(strip $(AUDIO_ENABLE)), yes) | |||
60 | OPT_DEFS += -DAUDIO_ENABLE | 60 | OPT_DEFS += -DAUDIO_ENABLE |
61 | endif | 61 | endif |
62 | 62 | ||
63 | ifeq ($(strip $(UNICODE_ENABLE)), yes) | ||
64 | OPT_DEFS += -DUNICODE_ENABLE | ||
65 | endif | ||
66 | |||
63 | ifeq ($(strip $(USB_6KRO_ENABLE)), yes) | 67 | ifeq ($(strip $(USB_6KRO_ENABLE)), yes) |
64 | OPT_DEFS += -DUSB_6KRO_ENABLE | 68 | OPT_DEFS += -DUSB_6KRO_ENABLE |
65 | endif | 69 | endif |