aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-10-16 15:49:45 -0400
committerGitHub <noreply@github.com>2016-10-16 15:49:45 -0400
commit52d7f7d2770a35adf0b0b0c803e05ae8719f539f (patch)
treefc9c02090ef86489ba99c2c1618f1da1c334c28a
parent5e2b843538365b130a73054bbeff6009cb8d818c (diff)
parent932705706edc22774d89fb94ebad9ffe690a270c (diff)
downloadqmk_firmware-52d7f7d2770a35adf0b0b0c803e05ae8719f539f.tar.gz
qmk_firmware-52d7f7d2770a35adf0b0b0c803e05ae8719f539f.zip
Merge pull request #815 from priyadi/unicode_map
Allow unicode up to 0xFFFFF using separate mapping table
-rw-r--r--build_keyboard.mk5
-rw-r--r--keyboards/planck/keymaps/priyadi/Makefile26
-rw-r--r--keyboards/planck/keymaps/priyadi/keymap.c417
-rw-r--r--keyboards/planck/keymaps/priyadi/readme.md1
-rw-r--r--quantum/keymap.h7
-rw-r--r--quantum/process_keycode/process_unicode.c26
-rw-r--r--quantum/process_keycode/process_unicode.h4
-rw-r--r--quantum/quantum.c3
-rw-r--r--readme.md6
9 files changed, 495 insertions, 0 deletions
diff --git a/build_keyboard.mk b/build_keyboard.mk
index 03a69b146..282adcb11 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -153,6 +153,11 @@ ifeq ($(strip $(UCIS_ENABLE)), yes)
153 UNICODE_ENABLE = yes 153 UNICODE_ENABLE = yes
154endif 154endif
155 155
156ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
157 OPT_DEFS += -DUNICODEMAP_ENABLE
158 UNICODE_ENABLE = yes
159endif
160
156ifeq ($(strip $(UNICODE_ENABLE)), yes) 161ifeq ($(strip $(UNICODE_ENABLE)), yes)
157 OPT_DEFS += -DUNICODE_ENABLE 162 OPT_DEFS += -DUNICODE_ENABLE
158 SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c 163 SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
diff --git a/keyboards/planck/keymaps/priyadi/Makefile b/keyboards/planck/keymaps/priyadi/Makefile
new file mode 100644
index 000000000..aa211d2f0
--- /dev/null
+++ b/keyboards/planck/keymaps/priyadi/Makefile
@@ -0,0 +1,26 @@
1
2
3# Build Options
4# change to "no" to disable the options, or define them in the Makefile in
5# the appropriate keymap folder that will get included automatically
6#
7BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
8MOUSEKEY_ENABLE = no # Mouse keys(+4700)
9EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
10CONSOLE_ENABLE = no # Console for debug(+400)
11COMMAND_ENABLE = yes # Commands for debug and configuration
12NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
13BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
14MIDI_ENABLE = no # MIDI controls
15AUDIO_ENABLE = yes # Audio output on port C6
16UNICODE_ENABLE = no # Unicode
17UNICODEMAP_ENABLE = yes # Unicode map
18BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
19RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
20
21# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
22SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
23
24ifndef QUANTUM_DIR
25 include ../../../../Makefile
26endif
diff --git a/keyboards/planck/keymaps/priyadi/keymap.c b/keyboards/planck/keymaps/priyadi/keymap.c
new file mode 100644
index 000000000..dd8652d34
--- /dev/null
+++ b/keyboards/planck/keymaps/priyadi/keymap.c
@@ -0,0 +1,417 @@
1// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
2// this is the style you want to emulate.
3
4#include "planck.h"
5#include "action_layer.h"
6#ifdef AUDIO_ENABLE
7 #include "audio.h"
8#endif
9#include "eeconfig.h"
10#include "process_unicode.h"
11
12extern keymap_config_t keymap_config;
13
14// Each layer gets a name for readability, which is then used in the keymap matrix below.
15// The underscores don't mean anything - you can have a layer called STUFF or any other name.
16// Layer names don't all need to be of the same length, obviously, and you can also skip them
17// entirely and just use numbers.
18#define _QWERTY 0
19#define _COLEMAK 1
20#define _WORKMAN 2
21#define _PUNC 9
22#define _NUM 10
23#define _FUNC 11
24#define _EMOJI 12
25#define _ADJUST 16
26
27enum planck_keycodes {
28 // layouts
29 QWERTY = SAFE_RANGE,
30 COLEMAK,
31 WORKMAN,
32
33 // layer switchers
34 PUNC,
35 NUM,
36 FUNC,
37 EMOJI,
38
39 // os switchers
40 LINUX,
41 WIN,
42 OSX,
43};
44
45// Fillers to make layering clearer
46#define _______ KC_TRNS
47#define XXXXXXX KC_NO
48
49// unicode map
50enum unicode_name {
51 GRIN, // grinning face 😊
52 TJOY, // tears of joy 😂
53 SMILE, // grining face with smiling eyes 😁
54 HEART, // heart ❤
55 EYERT, // smiling face with heart shaped eyes 😍
56 CRY, // crying face 😭
57 SMEYE, // smiling face with smiling eyes 😊
58 UNAMU, // unamused 😒
59 KISS, // kiss 😘
60 HART2, // two hearts 💕
61 WEARY, // weary 😩
62 OKHND, // ok hand sign 👌
63 PENSV, // pensive 😔
64 SMIRK, // smirk 😏
65 RECYC, // recycle ♻
66 WINK, // wink 😉
67 THMUP, // thumb up 👍
68 THMDN, // thumb down 👎
69 PRAY, // pray 🙏
70 PHEW, // relieved 😌
71 MUSIC, // musical notes
72 FLUSH, // flushed 😳
73 CELEB, // celebration 🙌
74 CRY2, // crying face 😢
75 COOL, // smile with sunglasses 😎
76 NOEVS, // see no evil
77 NOEVH, // hear no evil
78 NOEVK, // speak no evil
79 POO, // pile of poo
80 EYES, // eyes
81 VIC, // victory hand
82 BHART, // broken heart
83 SLEEP, // sleeping face
84 SMIL2, // smiling face with open mouth & sweat
85 HUNRD, // 100
86 CONFU, // confused
87 TONGU, // face with tongue & winking eye
88 DISAP, // disappointed
89 YUMMY, // face savoring delicious food
90 CLAP, // hand clapping
91 FEAR, // face screaming in fear
92 HORNS, // smiling face with horns
93 HALO, // smiling face with halo
94 BYE, // waving hand
95 SUN, // sun
96 MOON, // moon
97 SKULL, // skull
98};
99
100const uint32_t PROGMEM unicode_map[] = {
101 [GRIN] = 0x1F600,
102 [TJOY] = 0x1F602,
103 [SMILE] = 0x1F601,
104 [HEART] = 0x2764,
105 [EYERT] = 0x1f60d,
106 [CRY] = 0x1f62d,
107 [SMEYE] = 0x1F60A,
108 [UNAMU] = 0x1F612,
109 [KISS] = 0x1F618,
110 [HART2] = 0x1F495,
111 [WEARY] = 0x1F629,
112 [OKHND] = 0x1F44C,
113 [PENSV] = 0x1F614,
114 [SMIRK] = 0x1F60F,
115 [RECYC] = 0x267B,
116 [WINK] = 0x1F609,
117 [THMUP] = 0x1F44D,
118 [THMDN] = 0x1F44E,
119 [PRAY] = 0x1F64F,
120 [PHEW] = 0x1F60C,
121 [MUSIC] = 0x1F3B6,
122 [FLUSH] = 0x1F633,
123 [CELEB] = 0x1F64C,
124 [CRY2] = 0x1F622,
125 [COOL] = 0x1F60E,
126 [NOEVS] = 0x1F648,
127 [NOEVH] = 0x1F649,
128 [NOEVK] = 0x1F64A,
129 [POO] = 0x1F4A9,
130 [EYES] = 0x1F440,
131 [VIC] = 0x270C,
132 [BHART] = 0x1F494,
133 [SLEEP] = 0x1F634,
134 [SMIL2] = 0x1F605,
135 [HUNRD] = 0x1F4AF,
136 [CONFU] = 0x1F615,
137 [TONGU] = 0x1F61C,
138 [DISAP] = 0x1F61E,
139 [YUMMY] = 0x1F60B,
140 [CLAP] = 0x1F44F,
141 [FEAR] = 0x1F631,
142 [HORNS] = 0x1F608,
143 [HALO] = 0x1F607,
144 [BYE] = 0x1F44B,
145 [SUN] = 0x2600,
146 [MOON] = 0x1F314,
147 [SKULL] = 0x1F480,
148};
149
150// keymaps
151
152const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
153
154/* Qwerty
155 * ,-----------------------------------------------------------------------------------.
156 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
157 * |------+------+------+------+------+-------------+------+------+------+------+------|
158 * | Esc | A | S | D | F | G | H | J | K | L | ; |Enter |
159 * |------+------+------+------+------+------|------+------+------+------+------+------|
160 * | Shift| Z | X | C | V | B | N | M | , | . | / |Shift |
161 * |------+------+------+------+------+------+------+------+------+------+------+------|
162 * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
163 * `-----------------------------------------------------------------------------------'
164 */
165[_QWERTY] = {
166 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
167 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT },
168 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
169 {KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL}
170},
171
172/* Colemak
173 * ,-----------------------------------------------------------------------------------.
174 * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
175 * |------+------+------+------+------+-------------+------+------+------+------+------|
176 * | Esc | A | R | S | T | D | H | N | E | I | O |Enter |
177 * |------+------+------+------+------+------|------+------+------+------+------+------|
178 * | Shift| Z | X | C | V | B | K | M | , | . | / |Shift |
179 * |------+------+------+------+------+------+------+------+------+------+------+------|
180 * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
181 * `-----------------------------------------------------------------------------------'
182 */
183[_COLEMAK] = {
184 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
185 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT },
186 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
187 {KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL}
188},
189
190/* Workman
191 * ,-----------------------------------------------------------------------------------.
192 * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
193 * |------+------+------+------+------+-------------+------+------+------+------+------|
194 * | Esc | A | R | S | T | D | H | N | E | I | O |Enter |
195 * |------+------+------+------+------+------|------+------+------+------+------+------|
196 * | Shift| Z | X | C | V | B | K | M | , | . | / |Shift |
197 * |------+------+------+------+------+------+------+------+------+------+------+------|
198 * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
199 * `-----------------------------------------------------------------------------------'
200 */
201[_WORKMAN] = {
202 {KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSPC},
203 {KC_ESC, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_ENT },
204 {KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
205 {KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL}
206},
207
208/* Punc
209 * ,-----------------------------------------------------------------------------------.
210 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
211 * |------+------+------+------+------+-------------+------+------+------+------+------|
212 * | ` | | | | | | | | _ | + | { | } | " |
213 * |------+------+------+------+------+------|------+------+------+------+------+------|
214 * | | | | | | | \ | - | = | [ | ] | ' |
215 * |------+------+------+------+------+------+------+------+------+------+------+------|
216 * | | | | | | | | | < | > | |
217 * `-----------------------------------------------------------------------------------'
218 */
219[_PUNC] = {
220 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
221 {KC_GRV, _______, _______, _______, _______, _______, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_DQUO},
222 {_______, _______, _______, _______, _______, _______, KC_BSLS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_QUOT},
223 {_______, _______, _______, _______, _______, KC_SPC, KC_SPC, _______, _______, KC_LABK, KC_RABK, _______}
224},
225
226/* Num
227 * ,-----------------------------------------------------------------------------------.
228 * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
229 * |------+------+------+------+------+-------------+------+------+------+------+------|
230 * | Esc | @ | A | B | C | [ | ] | 4 | 5 | 6 | : |Enter |
231 * |------+------+------+------+------+------|------+------+------+------+------+------|
232 * | | | D | E | F | & | # | 1 | 2 | 3 | | |
233 * |------+------+------+------+------+------+------+------+------+------+------+------|
234 * | | | x | | | | 0 | , | . | | |
235 * `-----------------------------------------------------------------------------------'
236 */
237[_NUM] = {
238 {_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
239 { KC_ESC, KC_AT, S(KC_A), S(KC_B), S(KC_C), KC_LBRC, KC_RBRC, KC_4, KC_5, KC_6, KC_COLN, KC_BSLS},
240 {_______, _______, S(KC_D), S(KC_E), S(KC_F), KC_AMPR, KC_HASH, KC_1, KC_2, KC_3, _______, _______},
241 {_______, _______, KC_X, _______, _______, KC_SPC, KC_SPC, KC_0, KC_COMM,KC_KP_DOT,_______, _______}
242},
243
244/* Func
245 * ,-----------------------------------------------------------------------------------.
246 * | | F1 | F2 | F3 | F4 | | | PgUp | Up | PgDn | PgUp | Bksp |
247 * |------+------+------+------+------+-------------+------+------+------+------+------|
248 * | | F5 | F6 | F7 | F8 | | | Left | Down | Right| PgDn | |
249 * |------+------+------+------+------+------|------+------+------+------+------+------|
250 * | | F9 | F10 | F11 | F12 | | | | Home | End | | |
251 * |------+------+------+------+------+------+------+------+------+------+------+------|
252 * | | | | | | | | | | |Print |
253 * `-----------------------------------------------------------------------------------'
254 */
255[_FUNC] = {
256 {_______, KC_F1, KC_F2, KC_F3, KC_F4, _______, _______, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_BSPC},
257 {_______, KC_F5, KC_F6, KC_F7, KC_F8, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______},
258 {_______, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, KC_HOME, KC_END, _______, _______},
259 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,_______,KC_PSCREEN}
260},
261
262/* Emoji
263 * ,-----------------------------------------------------------------------------------.
264 * | | | | | | | | | | | | |
265 * |------+------+------+------+------+-------------+------+------+------+------+------|
266 * | | | | | | | | | | | | |
267 * |------+------+------+------+------+------+------+------+------+------+------+------|
268 * | | | | | | | | | | | | |
269 * |------+------+------+------+------+------+------+------+------+------+------+------|
270 * | | | | | | | | | | | | |
271 * `-----------------------------------------------------------------------------------'
272 */
273[_EMOJI] = {
274 {X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW)},
275 {X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART), X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS)},
276 {X(THMDN),X(SLEEP), X(CLAP), X(CRY), X(VIC),X(BHART), X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH)},
277 { X(POO), X(EYES),X(HUNRD),X(TONGU),X(SKULL),X(HORNS), X(HALO), X(FEAR), _______,X(YUMMY),X(DISAP),X(NOEVK)}
278},
279
280/* Adjust
281 * ,-----------------------------------------------------------------------------------.
282 * | | |Linux | Win | OSX | | |Qwerty|Colemk|Workmm| | |
283 * |------+------+------+------+------+-------------+------+------+------+------+------|
284 * | | | | | | | | | | | | |
285 * |------+------+------+------+------+------|------+------+------+------+------+------|
286 * | | | | | | | | | | | | |
287 * |------+------+------+------+------+------+------+------+------+------+------+------|
288 * | | | | | | | | | | | |
289 * `-----------------------------------------------------------------------------------'
290 */
291[_ADJUST] = {
292 {_______, _______, LINUX, WIN, OSX, _______, _______, QWERTY, COLEMAK, WORKMAN, _______, _______},
293 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
294 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
295 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
296}
297
298
299};
300
301#ifdef AUDIO_ENABLE
302float tone_startup[][2] = SONG(STARTUP_SOUND);
303float tone_qwerty[][2] = SONG(QWERTY_SOUND);
304float tone_colemak[][2] = SONG(COLEMAK_SOUND);
305float tone_workman[][2] = SONG(DVORAK_SOUND);
306float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
307#endif
308
309void persistant_default_layer_set(uint16_t default_layer) {
310 eeconfig_update_default_layer(default_layer);
311 default_layer_set(default_layer);
312}
313
314bool process_record_user(uint16_t keycode, keyrecord_t *record) {
315 switch (keycode) {
316 case QWERTY:
317 if (record->event.pressed) {
318 #ifdef AUDIO_ENABLE
319 PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
320 #endif
321 persistant_default_layer_set(1UL<<_QWERTY);
322 }
323 return false;
324 break;
325 case COLEMAK:
326 if (record->event.pressed) {
327 #ifdef AUDIO_ENABLE
328 PLAY_NOTE_ARRAY(tone_colemak, false, 0);
329 #endif
330 persistant_default_layer_set(1UL<<_COLEMAK);
331 }
332 return false;
333 break;
334 case WORKMAN:
335 if (record->event.pressed) {
336 #ifdef AUDIO_ENABLE
337 PLAY_NOTE_ARRAY(tone_workman, false, 0);
338 #endif
339 persistant_default_layer_set(1UL<<_WORKMAN);
340 }
341 return false;
342 break;
343 case PUNC:
344 if (record->event.pressed) {
345 layer_on(_PUNC);
346 update_tri_layer(_PUNC, _EMOJI, _ADJUST);
347 } else {
348 layer_off(_PUNC);
349 update_tri_layer(_PUNC, _EMOJI, _ADJUST);
350 }
351 return false;
352 break;
353 case EMOJI:
354 if (record->event.pressed) {
355 layer_on(_EMOJI);
356 update_tri_layer(_PUNC, _EMOJI, _ADJUST);
357 } else {
358 layer_off(_EMOJI);
359 update_tri_layer(_PUNC, _EMOJI, _ADJUST);
360 }
361 return false;
362 break;
363 case NUM:
364 if (record->event.pressed) {
365 layer_on(_NUM);
366 } else {
367 layer_off(_NUM);
368 }
369 return false;
370 break;
371 case FUNC:
372 if (record->event.pressed) {
373 layer_on(_FUNC);
374 } else {
375 layer_off(_FUNC);
376 }
377 return false;
378 break;
379 case LINUX:
380 set_unicode_input_mode(UC_LNX);
381 return false;
382 break;
383 case WIN:
384 set_unicode_input_mode(UC_WIN);
385 return false;
386 break;
387 case OSX:
388 set_unicode_input_mode(UC_OSX);
389 return false;
390 break;
391 }
392 return true;
393}
394
395void matrix_init_user(void) {
396 #ifdef AUDIO_ENABLE
397 startup_user();
398 #endif
399 set_unicode_input_mode(UC_LNX);
400}
401
402#ifdef AUDIO_ENABLE
403
404void startup_user()
405{
406 _delay_ms(20); // gets rid of tick
407 PLAY_NOTE_ARRAY(tone_startup, false, 0);
408}
409
410void shutdown_user()
411{
412 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
413 _delay_ms(150);
414 stop_all_notes();
415}
416
417#endif \ No newline at end of file
diff --git a/keyboards/planck/keymaps/priyadi/readme.md b/keyboards/planck/keymaps/priyadi/readme.md
new file mode 100644
index 000000000..de2f25e53
--- /dev/null
+++ b/keyboards/planck/keymaps/priyadi/readme.md
@@ -0,0 +1 @@
# Priyadi's Planck Layout \ No newline at end of file
diff --git a/quantum/keymap.h b/quantum/keymap.h
index 85c090972..a01bbfbd1 100644
--- a/quantum/keymap.h
+++ b/quantum/keymap.h
@@ -84,6 +84,10 @@ enum quantum_keycodes {
84 QK_MOD_TAP_MAX = 0x6FFF, 84 QK_MOD_TAP_MAX = 0x6FFF,
85 QK_TAP_DANCE = 0x7100, 85 QK_TAP_DANCE = 0x7100,
86 QK_TAP_DANCE_MAX = 0x71FF, 86 QK_TAP_DANCE_MAX = 0x71FF,
87#ifdef UNICODEMAP_ENABLE
88 QK_UNICODE_MAP = 0x7800,
89 QK_UNICODE_MAP_MAX = 0x7FFF,
90#endif
87#ifdef UNICODE_ENABLE 91#ifdef UNICODE_ENABLE
88 QK_UNICODE = 0x8000, 92 QK_UNICODE = 0x8000,
89 QK_UNICODE_MAX = 0xFFFF, 93 QK_UNICODE_MAX = 0xFFFF,
@@ -339,5 +343,8 @@ enum quantum_keycodes {
339 #define UC(n) UNICODE(n) 343 #define UC(n) UNICODE(n)
340#endif 344#endif
341 345
346#ifdef UNICODEMAP_ENABLE
347 #define X(n) (n | QK_UNICODE_MAP)
348#endif
342 349
343#endif 350#endif
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c
index 6a30afe29..37dd471ff 100644
--- a/quantum/process_keycode/process_unicode.c
+++ b/quantum/process_keycode/process_unicode.c
@@ -78,6 +78,32 @@ bool process_unicode(uint16_t keycode, keyrecord_t *record) {
78 return true; 78 return true;
79} 79}
80 80
81#ifdef UNICODEMAP_ENABLE
82__attribute__((weak))
83const uint32_t PROGMEM unicode_map[] = {
84};
85
86// 5 digit max because of linux limitation
87void register_hex32(uint32_t hex) {
88 for(int i = 4; i >= 0; i--) {
89 uint8_t digit = ((hex >> (i*4)) & 0xF);
90 register_code(hex_to_keycode(digit));
91 unregister_code(hex_to_keycode(digit));
92 }
93}
94
95bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
96 if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) {
97 const uint32_t* map = unicode_map;
98 uint16_t index = keycode & 0x7FF;
99 unicode_input_start();
100 register_hex32(pgm_read_dword_far(&map[index]));
101 unicode_input_finish();
102 }
103 return true;
104}
105#endif
106
81#ifdef UCIS_ENABLE 107#ifdef UCIS_ENABLE
82qk_ucis_state_t qk_ucis_state; 108qk_ucis_state_t qk_ucis_state;
83 109
diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h
index 27f8072ee..a6c7e4584 100644
--- a/quantum/process_keycode/process_unicode.h
+++ b/quantum/process_keycode/process_unicode.h
@@ -20,6 +20,10 @@ void register_hex(uint16_t hex);
20 20
21bool process_unicode(uint16_t keycode, keyrecord_t *record); 21bool process_unicode(uint16_t keycode, keyrecord_t *record);
22 22
23#ifdef UNICODEMAP_ENABLE
24bool process_unicode_map(uint16_t keycode, keyrecord_t *record);
25#endif
26
23#ifdef UCIS_ENABLE 27#ifdef UCIS_ENABLE
24#ifndef UCIS_MAX_SYMBOL_LENGTH 28#ifndef UCIS_MAX_SYMBOL_LENGTH
25#define UCIS_MAX_SYMBOL_LENGTH 32 29#define UCIS_MAX_SYMBOL_LENGTH 32
diff --git a/quantum/quantum.c b/quantum/quantum.c
index a16bd5443..098312e6e 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -129,6 +129,9 @@ bool process_record_quantum(keyrecord_t *record) {
129 #ifdef UCIS_ENABLE 129 #ifdef UCIS_ENABLE
130 process_ucis(keycode, record) && 130 process_ucis(keycode, record) &&
131 #endif 131 #endif
132 #ifdef UNICODEMAP_ENABLE
133 process_unicode_map(keycode, record) &&
134 #endif
132 true)) { 135 true)) {
133 return false; 136 return false;
134 } 137 }
diff --git a/readme.md b/readme.md
index 80f0a3ab2..62d479ff1 100644
--- a/readme.md
+++ b/readme.md
@@ -323,6 +323,12 @@ This enables MIDI sending and receiving with your keyboard. To enter MIDI send m
323 323
324This allows you to send unicode symbols via `UC(<unicode>)` in your keymap. Only codes up to 0x7FFF are currently supported. 324This allows you to send unicode symbols via `UC(<unicode>)` in your keymap. Only codes up to 0x7FFF are currently supported.
325 325
326`UNICODEMAP_ENABLE`
327
328This allows sending unicode symbols using `X(<unicode>)` in your keymap. Codes
329up to 0xFFFFF are supported, including emojis. But you need to maintain a
330separate mapping table in your keymap file.
331
326`BLUETOOTH_ENABLE` 332`BLUETOOTH_ENABLE`
327 333
328This allows you to interface with a Bluefruit EZ-key to send keycodes wirelessly. It uses the D2 and D3 pins. 334This allows you to interface with a Bluefruit EZ-key to send keycodes wirelessly. It uses the D2 and D3 pins.