aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/planck/keymaps/zach/Makefile29
-rw-r--r--keyboards/planck/keymaps/zach/config.h94
-rw-r--r--keyboards/planck/keymaps/zach/keymap.c48
-rw-r--r--keyboards/planck/keymaps/zach/zach_common_functions.c447
-rw-r--r--keyboards/preonic/keymaps/zach/Makefile29
-rw-r--r--keyboards/preonic/keymaps/zach/config.h95
-rw-r--r--keyboards/preonic/keymaps/zach/keymap.c54
-rw-r--r--keyboards/preonic/keymaps/zach/zach_common_functions.c447
-rw-r--r--quantum/audio/song_list.h12
-rw-r--r--quantum/process_keycode/process_unicode.c80
-rw-r--r--tmk_core/common/eeconfig.h1
11 files changed, 1336 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/zach/Makefile b/keyboards/planck/keymaps/zach/Makefile
new file mode 100644
index 000000000..977f1a901
--- /dev/null
+++ b/keyboards/planck/keymaps/zach/Makefile
@@ -0,0 +1,29 @@
1# Zach Planck Makefile
2# Max .hex size is about 28636 bytes
3
4# Build Options
5# change to "no" to disable the options, or define them in the Makefile in
6# the appropriate keymap folder that will get included automatically
7#
8TAP_DANCE_ENABLE = yes # Enable TapDance functionality
9BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
10MOUSEKEY_ENABLE = no # Mouse keys(+4700)
11EXTRAKEY_ENABLE = no # Audio control and System control(+450)
12CONSOLE_ENABLE = no # Console for debug(+400)
13COMMAND_ENABLE = no # Commands for debug and configuration
14NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
15USB_6KRO_ENABLE = no # 6key Rollover
16BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
17MIDI_ENABLE = no # MIDI controls
18AUDIO_ENABLE = no # Audio output on port C6
19#VARIABLE_TRACE = no # Debug changes to variable values
20UNICODE_ENABLE = yes # Unicode
21UNICODEMAP_ENABLE = yes # Enable extended unicode
22BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
23RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
24# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
25SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
26
27ifndef QUANTUM_DIR
28 include ../../../../Makefile
29endif
diff --git a/keyboards/planck/keymaps/zach/config.h b/keyboards/planck/keymaps/zach/config.h
new file mode 100644
index 000000000..7deb9ebfe
--- /dev/null
+++ b/keyboards/planck/keymaps/zach/config.h
@@ -0,0 +1,94 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include "config_common.h"
22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x6060
26#define MANUFACTURER Ortholinear Keyboards
27#define PRODUCT The Planck Keyboard
28#define DESCRIPTION A compact ortholinear keyboard
29
30/* key matrix size */
31#define MATRIX_ROWS 4
32#define MATRIX_COLS 12
33
34/* Planck PCB default pin-out */
35#define MATRIX_ROW_PINS { D0, D5, B5, B6 }
36#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }
37#define UNUSED_PINS
38
39#define BACKLIGHT_PIN B7
40
41/* COL2ROW or ROW2COL */
42#define DIODE_DIRECTION COL2ROW
43
44/* define if matrix has ghost */
45//#define MATRIX_HAS_GHOST
46
47//#define BACKLIGHT_BREATHING // LED breathing
48/* number of backlight levels */
49#define BACKLIGHT_LEVELS 5
50
51/* Set 0 if debouncing isn't needed */
52#define DEBOUNCING_DELAY 5
53
54/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
55//#define LOCKING_SUPPORT_ENABLE
56#undef LOCKING_SUPPORT_ENABLE
57/* Locking resynchronize hack */
58//#define LOCKING_RESYNC_ENABLE
59#undef LOCKING_RESYNC_ENABLE
60
61/* key combination for command */
62#define IS_COMMAND() ( \
63 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
64)
65
66/*
67 * Feature disable options
68 * These options are also useful to firmware size reduction.
69 */
70
71/* disable debug print */
72//#define NO_DEBUG
73/* disable print */
74//#define NO_PRINT
75#undef NO_PRINT
76
77/* disable action features */
78//#define NO_ACTION_LAYER
79#define NO_ACTION_TAPPING
80#define NO_ACTION_ONESHOT
81#define NO_ACTION_MACRO
82#define NO_ACTION_FUNCTION
83#define PREVENT_STUCK_MODIFIERS
84//#define DYNAMIC_MACRO_ENABLE // Enable if you need to use the macro functionality
85//#define SPACE_CADET // Parenthesis on L/R shift
86
87#ifdef SUBPROJECT_rev3
88 #include "rev3/config.h"
89#endif
90#ifdef SUBPROJECT_rev4
91 #include "rev4/config.h"
92#endif
93
94#endif
diff --git a/keyboards/planck/keymaps/zach/keymap.c b/keyboards/planck/keymaps/zach/keymap.c
new file mode 100644
index 000000000..710477df5
--- /dev/null
+++ b/keyboards/planck/keymaps/zach/keymap.c
@@ -0,0 +1,48 @@
1// Zach Nielsen Custom Planck Keyboard layout
2#include "planck.h"
3#define PLANCK_YES // This is the Planck
4#include "zach_common_functions.c"
5
6const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7[_COLEMAK] = { /* Base Layer */
8 {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, KC_BSPC},
9 {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT},
10 {SHFT_CAP,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
11 {CTRLB, TD(SUP), KC_LALT, KC_LCTL, TD(LOW), KC_SPC, KC_SPC, TD(RAI), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
12},
13
14[_SWCOLE] = { /* Software Colemak */
15 {_______, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, KC_QUOT, _______},
16 {_______, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, _______},
17 {_______, CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, CM_COMM, CM_DOT, CM_SLSH, _______},
18 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
19},
20
21[_RAISE] = { /* RAISE - Numpad and Unicode symbols */
22 {KC_GRV, SUPA2, FACE, DISFACE, SHRUG, PLUMIN, IBANG, KC_7, KC_8, KC_9, KC_COLN, _______},
23 {KC_DEL, DEGREE, MICRO, WOMEGA, OMEGA, PENGY, KC_ENT, KC_4, KC_5, KC_6, KC_SLSH, KC_ASTR},
24 {_______, KC_COLN, TFLIP, LAROW, RAROW, DUCK, KC_SPC, KC_1, KC_2, KC_3, KC_MINS, KC_PLUS},
25 {_______, KC_PIPE, TPUT, _______, _______, KC_TAB, KC_TAB, _______, KC_0, KC_0, KC_DOT, KC_EQL}
26},
27
28[_LOWER] = { /* LOWER - Symbols, Paging, CtrAltDel */
29 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_QUES, KC_DQT, KC_DEL},
30 {KC_DEL, KC_LBRC, KC_RBRC, KC_MINS, KC_UNDS, KC_HOME, KC_END, KC_LPRN, KC_RPRN, KC_SLSH, KC_SCLN, KC_PGUP},
31 {CPYPST, XXXXXXX, C(KC_X), KC_LABK, KC_RABK, XXXXXXX, XXXXXXX, KC_LCBR, KC_RCBR, KC_BSLS, KC_COLN, KC_PGDN},
32 {_______, _______, _______, _______, _______, KC_TAB, KC_TAB, _______, _______, _______, _______, _______}
33},
34
35[_ADJUST] = { /* ADJUST - Macros, Layer Switching, Function Keys */
36 {UNIWIN, XXXXXXX, XXXXXXX, PENGY, DUCK, KC_INS, KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX},
37 {UNILIN, XXXXXXX, XXXXXXX, RANDIG, RANDIG, SWCOLE, COLEMAK, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX},
38 {_______, CADKEY, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX},
39 {_______, _______, _______, _______, _______, RESET, RESET, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}
40},
41
42[_UNICODES] = { /* UNICODES - Extra layer for unicode stuff */
43 {_______, TFLIP, XXXXXXX, XXXXXXX, IBANG, roman7, XXXXXXX, XXXXXXX, ROMAN7, XXXXXXX, XXXXXXX, _______},
44 {KC_DEL, TPUT, FACE, DISFACE, SHRUG, roman4, roman5, roman6, ROMAN4, ROMAN5, ROMAN6, _______},
45 {XXXXXXX, XXXXXXX, XXXXXXX, LAROW, RAROW, roman1, roman2, roman3, ROMAN1, ROMAN2, ROMAN3, XXXXXXX},
46 {_______, _______, _______, _______, _______, KC_SPC, KC_SPC, _______, _______, _______, _______, _______}
47}
48};
diff --git a/keyboards/planck/keymaps/zach/zach_common_functions.c b/keyboards/planck/keymaps/zach/zach_common_functions.c
new file mode 100644
index 000000000..b77f2b241
--- /dev/null
+++ b/keyboards/planck/keymaps/zach/zach_common_functions.c
@@ -0,0 +1,447 @@
1#ifndef ZACH_COMMON_FUNCTIONS
2#define ZACH_COMMON_FUNCTIONS
3#include "eeconfig.h"
4#include "action_layer.h"
5#include "keymap_colemak.h"
6extern keymap_config_t keymap_config;
7
8// Fillers to make layering more clear
9#define _______ KC_TRNS
10#define XXXXXXX KC_NO
11#define C(n) RCTL(n)
12#define CADKEY RCTL(RALT(KC_DEL))
13
14void tap(uint16_t keycode){
15 register_code(keycode);
16 unregister_code(keycode);
17};
18
19void persistant_default_layer_set(uint16_t default_layer){
20 eeconfig_update_default_layer(default_layer);
21 default_layer_set(default_layer);
22};
23
24// Automatic number generation of important keywords
25enum my_keycodes{
26 // Layer numbers
27 _COLEMAK = 0,
28 _SWCOLE,
29 _RAISE,
30 _LOWER,
31 _ADJUST,
32 _UNICODES,
33 // These use process_record_user()
34 COLEMAK = SAFE_RANGE,
35 SWCOLE,
36 LOWER,
37 RAISE,
38 SHFT_CAP,
39 CTRLB,
40 CPYPST,
41 FACE,
42 UNIWIN,
43 UNILIN,
44 DISFACE,
45 TFLIP,
46 TPUT,
47 SHRUG,
48 RANDIG,
49 // Tap_Dance nums
50 RAI = 0,
51 LOW,
52 SUP
53};
54
55#ifdef AUDIO_ENABLE
56#include "audio.h"
57float tone_startup[][2] = SONG(STARTUP_SOUND);
58float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
59float tone_colemak[][2] = SONG(COLEMAK_SOUND);
60float tone_swcole[][2] = SONG(QWERTY_SOUND);
61float tone_capslock_on[][2] = SONG(CAPS_LOCK_ON_SOUND);
62float tone_capslock_off[][2] = SONG(CAPS_LOCK_OFF_SOUND);
63float tone_ctrl_mod[][2] = SONG(COIN_SOUND);
64float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND);
65float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND);
66float uniwin[][2] = SONG(UNICODE_WINDOWS);
67float unilin[][2] = SONG(UNICODE_LINUX);
68#endif
69
70#ifdef TAP_DANCE_ENABLE
71#define TAPPING_TERM 200
72
73void dance_raise_press(qk_tap_dance_state_t *state, void *user_data){// Called on each tap
74 switch(state->count){ // Only turn the layer on once
75 case 1:
76 layer_off(_UNICODES);
77 layer_on(_RAISE);
78 update_tri_layer(_LOWER, _RAISE, _ADJUST);
79 break;
80 }
81};
82void dance_raise_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on release
83 switch(state->count){
84 case 1: // Normal action. Turn off layers
85 layer_off(_RAISE);
86 update_tri_layer(_LOWER, _RAISE, _ADJUST);
87 layer_off(_UNICODES);
88 break;
89 }
90};
91/////////////////////////////////////////////////////////////////////
92void dance_lower_press(qk_tap_dance_state_t *state, void *user_data){// Called on tap
93 switch(state->count){
94 case 1: // Turn on lower
95 layer_off(_UNICODES);
96 layer_on(_LOWER);
97 update_tri_layer(_LOWER, _RAISE, _ADJUST);
98 break;
99 }
100};
101void dance_lower_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on release
102 switch(state->count){
103 case 1: // Normal action. Turn off layers
104 layer_off(_LOWER);
105 update_tri_layer(_LOWER, _RAISE, _ADJUST);
106 layer_off(_UNICODES);
107 break;
108 case 2: // Turn on _UNICODES layer
109 layer_off(_LOWER);
110 update_tri_layer(_LOWER, _RAISE, _ADJUST);
111 layer_on(_UNICODES);
112 #ifdef AUDIO_ENABLE
113 PLAY_NOTE_ARRAY(tone_ctrl_mod, false, 0);
114 #endif
115 break;
116 }
117};
118/////////////////////////////////////////////////////////////////////
119void dance_super_press(qk_tap_dance_state_t *state, void *user_data){ // Called on down
120 if(state->count == 1){
121 register_code(KC_LGUI);
122 }
123}
124void dance_super_done(qk_tap_dance_state_t *state, void *user_data){ // Called on timeout
125 switch(state->count){
126 case 2:
127 register_code(KC_LGUI);
128 tap(KC_L);
129 unregister_code(KC_LGUI);
130 break;
131 }
132}
133void dance_super_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on up
134 unregister_code(KC_LGUI);
135}
136
137qk_tap_dance_action_t tap_dance_actions[] = {
138 [RAI] = ACTION_TAP_DANCE_FN_ADVANCED(dance_raise_press, NULL, dance_raise_lift),
139 [LOW] = ACTION_TAP_DANCE_FN_ADVANCED(dance_lower_press, NULL, dance_lower_lift),
140 [SUP] = ACTION_TAP_DANCE_FN_ADVANCED(dance_super_press, dance_super_done, dance_super_lift)
141};
142#endif
143
144#ifdef UNICODE_ENABLE
145// Unicode shortcuts
146#define IBANG UC(0x203D)
147#define RAROW UC(0x2192)
148#define LAROW UC(0x2190)
149#define DEGREE UC(0x00B0)
150#define OMEGA UC(0x03A9)
151#define WOMEGA UC(0x03C9)
152#define MICRO UC(0x00B5)
153#define PLUMIN UC(0x00B1)
154#define SUPA2 UC(0x00B2)
155#define ROMAN1 UC(0x2160)
156#define ROMAN2 UC(0x2161)
157#define ROMAN3 UC(0x2162)
158#define ROMAN4 UC(0x2163)
159#define ROMAN5 UC(0x2164)
160#define ROMAN6 UC(0x2165)
161#define ROMAN7 UC(0x2166)
162#define roman1 UC(0x2170)
163#define roman2 UC(0x2171)
164#define roman3 UC(0x2172)
165#define roman4 UC(0x2173)
166#define roman5 UC(0x2174)
167#define roman6 UC(0x2175)
168#define roman7 UC(0x2176)
169
170#ifdef UNICODEMAP_ENABLE // For Unicode characters larger than 0x8000. Send with X(<unicode>)
171enum Ext_Unicode{
172 PENGUIN = 0,
173 BOAR,
174 MONKEY,
175 DRAGON,
176 CHICK,
177 TUMBLER
178};
179const uint32_t PROGMEM unicode_map[] = {
180 [PENGUIN] = 0x1F427,
181 [BOAR] = 0x1F417,
182 [MONKEY] = 0x1F412,
183 [DRAGON] = 0x1F409,
184 [CHICK] = 0x1F425,
185 [TUMBLER] = 0x1F943
186};
187#define PENGY X(PENGUIN)
188#define BOARY X(BOAR)
189#define MNKY X(MONKEY)
190#define DRGN X(DRAGON)
191#define DUCK X(CHICK)
192#define TMBL X(TUMBLER)
193#endif
194
195#endif
196
197static uint16_t key_timer;
198static uint8_t caps_status = 0;
199bool process_record_user(uint16_t keycode, keyrecord_t *record) {
200 switch (keycode) {
201 case COLEMAK:
202 if(record->event.pressed){
203 persistant_default_layer_set(1UL<<_COLEMAK);
204 #ifdef AUDIO_ENABLE
205 PLAY_NOTE_ARRAY(tone_colemak, false, 0);
206 #endif
207 }
208 return false;
209 break;
210 case SWCOLE:
211 if(record->event.pressed){
212 persistant_default_layer_set(1UL<<_SWCOLE);
213 #ifdef AUDIO_ENABLE
214 PLAY_NOTE_ARRAY(tone_swcole, false, 0);
215 #endif
216 }
217 return false;
218 break;
219 case RAISE:
220 if(record->event.pressed){
221 layer_on(_RAISE);
222 update_tri_layer(_LOWER, _RAISE, _ADJUST);
223 } else {
224 layer_off(_RAISE);
225 update_tri_layer(_LOWER, _RAISE, _ADJUST);
226 }
227 return false;
228 break;
229 case LOWER:
230 if(record->event.pressed){
231 layer_on(_LOWER);
232 update_tri_layer(_LOWER, _RAISE, _ADJUST);
233 } else {
234 layer_off(_LOWER);
235 update_tri_layer(_LOWER, _RAISE, _ADJUST);
236 }
237 return false;
238 break;
239 case SHFT_CAP:
240 if(record->event.pressed){
241 key_timer = timer_read(); // if the key is being pressed, we start the timer.
242 register_code(KC_LSHIFT);
243 } else { // this means the key was just released (tap or "held down")
244 if(timer_elapsed(key_timer) < 152){ // Time in ms, the threshold we pick for counting something as a tap.
245 tap(KC_CAPS);
246 if(caps_status == 0){
247 caps_status = 1;
248 #ifdef AUDIO_ENABLE
249 PLAY_NOTE_ARRAY(tone_capslock_on, false, 0);
250 #endif
251 } else {
252 caps_status = 0;
253 #ifdef AUDIO_ENABLE
254 PLAY_NOTE_ARRAY(tone_capslock_off, false, 0);
255 #endif
256 }
257 }
258 unregister_code(KC_LSHIFT);
259 }
260 return false;
261 break;
262 case CTRLB: // Control-B on tap (bold)
263 if(record->event.pressed){
264 key_timer = timer_read(); // if the key is being pressed, we start the timer.
265 register_code(KC_LCTL);
266 } else { // this means the key was just released (tap or "held down")
267 if (timer_elapsed(key_timer) < 152) { // Time in ms, the threshold we pick for counting something as a tap.
268 tap(KC_B);
269 #ifdef AUDIO_ENABLE
270 PLAY_NOTE_ARRAY(tone_ctrl_mod, false, 0);
271 #endif
272 #ifdef BACKLIGHT_BREATHING
273 breathing_speed_set(2);
274 breathing_pulse();
275 #endif
276 }
277 unregister_code(KC_LCTL);
278 }
279 return false;
280 break;
281 case CPYPST: // One key copy/paste
282 if(record->event.pressed){
283 key_timer = timer_read();
284 } else {
285 if (timer_elapsed(key_timer) > 152) { // Hold, copy
286 register_code(KC_LCTL);
287 tap(KC_C);
288 unregister_code(KC_LCTL);
289 #ifdef AUDIO_ENABLE
290 PLAY_NOTE_ARRAY(tone_copy, false, 0);
291 #endif
292 } else { // Tap, paste
293 register_code(KC_LCTL);
294 tap(KC_V);
295 unregister_code(KC_LCTL);
296 #ifdef AUDIO_ENABLE
297 PLAY_NOTE_ARRAY(tone_paste, false, 0);
298 #endif
299 }
300 }
301 return false;
302 break;
303 #ifdef UNICODE_ENABLE
304 case UNIWIN:
305 if(record->event.pressed){
306 set_unicode_input_mode(UC_WIN);
307 #ifdef AUDIO_ENABLE
308 PLAY_NOTE_ARRAY(uniwin, false, 0);
309 #endif
310 }
311 return false;
312 break;
313 case UNILIN:
314 if(record->event.pressed){
315 set_unicode_input_mode(UC_LNX);
316 #ifdef AUDIO_ENABLE
317 PLAY_NOTE_ARRAY(unilin, false, 0);
318 #endif
319 }
320 return false;
321 break;
322 case DISFACE: // ಠ_ಠ
323 if(record->event.pressed){
324 process_unicode((0x0CA0|QK_UNICODE), record); // Eye
325 register_code(KC_RSFT);
326 tap(KC_MINS);
327 unregister_code(KC_RSFT);
328 process_unicode((0x0CA0|QK_UNICODE), record); // Eye
329 }
330 return false;
331 break;
332 case TFLIP: // (╯°□°)╯ ︵ ┻━┻
333 if(record->event.pressed){
334 register_code(KC_RSFT);
335 tap(KC_9);
336 unregister_code(KC_RSFT);
337 process_unicode((0x256F|QK_UNICODE), record); // Arm
338 process_unicode((0x00B0|QK_UNICODE), record); // Eye
339 process_unicode((0x25A1|QK_UNICODE), record); // Mouth
340 process_unicode((0x00B0|QK_UNICODE), record); // Eye
341 register_code(KC_RSFT);
342 tap(KC_0);
343 unregister_code(KC_RSFT);
344 process_unicode((0x256F|QK_UNICODE), record); // Arm
345 tap(KC_SPC);
346 process_unicode((0x0361|QK_UNICODE), record); // Flippy
347 tap(KC_SPC);
348 process_unicode((0x253B|QK_UNICODE), record); // Table
349 process_unicode((0x2501|QK_UNICODE), record); // Table
350 process_unicode((0x253B|QK_UNICODE), record); // Table
351 }
352 return false;
353 break;
354 case TPUT: // ┬──┬ ノ( ゜-゜ノ)
355 if(record->event.pressed){
356 process_unicode((0x252C|QK_UNICODE), record); // Table
357 process_unicode((0x2500|QK_UNICODE), record); // Table
358 process_unicode((0x2500|QK_UNICODE), record); // Table
359 process_unicode((0x252C|QK_UNICODE), record); // Table
360 tap(KC_SPC);
361 process_unicode((0x30CE|QK_UNICODE), record); // Arm
362 register_code(KC_RSFT);
363 tap(KC_9);
364 unregister_code(KC_RSFT);
365 tap(KC_SPC);
366 process_unicode((0x309C|QK_UNICODE), record); // Eye
367 tap(KC_MINS);
368 process_unicode((0x309C|QK_UNICODE), record); // Eye
369 process_unicode((0x30CE|QK_UNICODE), record); // Arm
370 register_code(KC_RSFT);
371 tap(KC_0);
372 unregister_code(KC_RSFT);
373 }
374 return false;
375 break;
376 case SHRUG: // ¯\_(ツ)_/¯
377 if(record->event.pressed){
378 process_unicode((0x00AF|QK_UNICODE), record); // Hand
379 tap(KC_BSLS); // Arm
380 register_code(KC_RSFT);
381 tap(KC_UNDS); // Arm
382 tap(KC_LPRN); // Head
383 unregister_code(KC_RSFT);
384 process_unicode((0x30C4|QK_UNICODE), record); // Face
385 register_code(KC_RSFT);
386 tap(KC_RPRN); // Head
387 tap(KC_UNDS); // Arm
388 unregister_code(KC_RSFT);
389 tap(KC_SLSH); // Arm
390 process_unicode((0x00AF|QK_UNICODE), record); // Hand
391 }
392 return false;
393 break;
394 #endif
395 case FACE: // (o_O)
396 if(record->event.pressed){
397 register_code(KC_RSFT);
398 tap(KC_LPRN);
399 unregister_code(KC_RSFT);
400 tap(KC_O);
401 register_code(KC_RSFT);
402 tap(KC_UNDS);
403 tap(KC_O);
404 tap(KC_RPRN);
405 unregister_code(KC_RSFT);
406 }
407 return false;
408 break;
409 case RANDIG:
410 if (record->event.pressed) {
411 tap_random_base64();
412 }
413 return false;
414 break;
415 }
416 return true;
417};
418
419void matrix_init_user(void){ // Run once at startup
420 #ifdef AUDIO_ENABLE
421 _delay_ms(50); // gets rid of tick
422 PLAY_NOTE_ARRAY(tone_startup, false, 0);
423 #endif
424}
425
426#ifdef AUDIO_ENABLE
427void play_goodbye_tone(void){
428 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
429 _delay_ms(150);
430}
431
432void shutdown_user(){
433 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
434 _delay_ms(150);
435 stop_all_notes();
436}
437
438void music_on_user(void){ // Run when the music layer is turned on
439 PLAY_NOTE_ARRAY(tone_startup, false, 0);
440}
441
442void music_off_user(void){ // Run when music is turned off
443 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
444}
445#endif
446
447#endif
diff --git a/keyboards/preonic/keymaps/zach/Makefile b/keyboards/preonic/keymaps/zach/Makefile
new file mode 100644
index 000000000..f0a84abac
--- /dev/null
+++ b/keyboards/preonic/keymaps/zach/Makefile
@@ -0,0 +1,29 @@
1# Zach Preonic Makefile
2# Max .hex size is about 28636 bytes
3
4# Build Options
5# change to "no" to disable the options, or define them in the Makefile in
6# the appropriate keymap folder that will get included automatically
7#
8TAP_DANCE_ENABLE = yes # Enable TapDance functionality
9BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
10MOUSEKEY_ENABLE = no # Mouse keys(+4700)
11EXTRAKEY_ENABLE = no # Audio control and System control(+450)
12CONSOLE_ENABLE = no # Console for debug(+400)
13COMMAND_ENABLE = no # Commands for debug and configuration
14NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
15USB_6KRO_ENABLE = no # 6key Rollover
16BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
17MIDI_ENABLE = no # MIDI controls
18AUDIO_ENABLE = yes # Audio output on port C6
19#VARIABLE_TRACE = no # Debug changes to variable values
20UNICODE_ENABLE = yes # Unicode
21UNICODEMAP_ENABLE = no # Enable extended unicode
22BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
23RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
24# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
25SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
26
27ifndef QUANTUM_DIR
28 include ../../../../Makefile
29endif
diff --git a/keyboards/preonic/keymaps/zach/config.h b/keyboards/preonic/keymaps/zach/config.h
new file mode 100644
index 000000000..59959524f
--- /dev/null
+++ b/keyboards/preonic/keymaps/zach/config.h
@@ -0,0 +1,95 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include "config_common.h"
22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x6061
26#define DEVICE_VER 0x0001
27#define MANUFACTURER Ortholinear Keyboards
28#define PRODUCT The Preonic Keyboard
29#define DESCRIPTION A compact ortholinear keyboard
30
31/* key matrix size */
32#define MATRIX_ROWS 5
33#define MATRIX_COLS 12
34
35/* Planck PCB default pin-out */
36#define MATRIX_ROW_PINS { D2, D5, B5, B6, D3 }
37#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }
38#define UNUSED_PINS
39
40#define BACKLIGHT_PIN B7
41
42/* COL2ROW or ROW2COL */
43#define DIODE_DIRECTION COL2ROW
44
45/* define if matrix has ghost */
46//#define MATRIX_HAS_GHOST
47
48
49#define BACKLIGHT_BREATHING // LED breathing
50/* number of backlight levels */
51#define BACKLIGHT_LEVELS 5
52
53/* Set 0 if debouncing isn't needed */
54#define DEBOUNCING_DELAY 5
55
56/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
57//#define LOCKING_SUPPORT_ENABLE
58/* Locking resynchronize hack */
59//#define LOCKING_RESYNC_ENABLE
60
61/* key combination for command */
62#define IS_COMMAND() ( \
63 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
64)
65
66/* ws2812 RGB LED */
67//#define RGB_DI_PIN D1
68//#define RGBLIGHT_TIMER
69//#define RGBLED_NUM 28 // Number of LEDs
70//#define RGBLIGHT_HUE_STEP 10
71//#define RGBLIGHT_SAT_STEP 17
72//#define RGBLIGHT_VAL_STEP 17
73
74/*
75 * Feature disable options
76 * These options are also useful to firmware size reduction.
77 */
78
79/* disable debug print */
80//#define NO_DEBUG
81/* disable print */
82//#define NO_PRINT
83
84/* disable action features */
85//#define NO_ACTION_LAYER
86#define NO_ACTION_TAPPING
87#define NO_ACTION_ONESHOT
88#define NO_ACTION_MACRO
89#define NO_ACTION_FUNCTION
90#define PREVENT_STUCK_MODIFIERS
91//#define DYNAMIC_MACRO_ENABLE // Enable if you need to use the macro functionality
92//#define SPACE_CADET // Parenthesis on L/R shift
93
94
95#endif
diff --git a/keyboards/preonic/keymaps/zach/keymap.c b/keyboards/preonic/keymaps/zach/keymap.c
new file mode 100644
index 000000000..6ce37840b
--- /dev/null
+++ b/keyboards/preonic/keymaps/zach/keymap.c
@@ -0,0 +1,54 @@
1// Zach Nielsen Custom Preonic Keyboard layout
2#include "preonic.h"
3#define PREONIC_YES // This is the Preonic
4#include "zach_common_functions.c"
5
6const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7[_COLEMAK] = { /* Base Layer */
8 {KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
9 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, KC_ENT},
10 {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT},
11 {SHFT_CAP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
12 {CTRLB, TD(SUP), KC_LALT, KC_LCTL, TD(LOW), KC_SPC, KC_SPC, TD(RAI), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
13},
14
15[_SWCOLE] = { /* Software Colemak */
16 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
17 {_______, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, KC_QUOT, _______},
18 {_______, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, _______},
19 {_______, CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, CM_COMM, CM_DOT, CM_SLSH, _______},
20 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
21},
22
23[_RAISE] = { /* RAISE - Numpad and Unicode symbols */
24 {KC_TILD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
25 {KC_GRV, SUPA2, FACE, DISFACE, SHRUG, PLUMIN, IBANG, KC_7, KC_8, KC_9, KC_COLN, _______},
26 {KC_DEL, DEGREE, MICRO, WOMEGA, OMEGA, XXXXXXX, KC_ENT, KC_4, KC_5, KC_6, KC_SLSH, KC_ASTR},
27 {_______, KC_COLN, TFLIP, LAROW, RAROW, XXXXXXX, KC_SPC, KC_1, KC_2, KC_3, KC_MINS, KC_PLUS},
28 {_______, KC_PIPE, TPUT, _______, _______, KC_TAB, KC_TAB, _______, KC_0, KC_0, KC_DOT, KC_EQL}
29},
30
31[_LOWER] = { /* LOWER - Symbols, Paging, CtrAltDel */
32 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_QUES, KC_DQT, KC_DEL},
33 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_QUES, KC_DQT, KC_DEL},
34 {KC_DEL, KC_LBRC, KC_RBRC, KC_MINS, KC_UNDS, KC_HOME, KC_END, KC_LPRN, KC_RPRN, KC_SLSH, KC_SCLN, KC_PGUP},
35 {CPYPST, XXXXXXX, C(KC_X), KC_LABK, KC_RABK, XXXXXXX, XXXXXXX, KC_LCBR, KC_RCBR, KC_BSLS, KC_COLN, KC_PGDN},
36 {_______, _______, _______, _______, _______, KC_TAB, KC_TAB, _______, _______, _______, _______, _______}
37},
38
39[_ADJUST] = { /* ADJUST - Macros, Layer Switching, Function Keys */
40 {UNIWIN, XXXXXXX, XXXXXXX, RANDIG, RANDIG, KC_INS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, AU_TOG, MU_TOG},
41 {UNILIN, SUPA2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX},
42 {XXXXXXX, DEGREE, IBANG, LAROW, RAROW, SWCOLE, COLEMAK, KC_F5, KC_F6, KC_F7, KC_F8, BL_INC},
43 {_______, CADKEY, MICRO, WOMEGA, OMEGA, XXXXXXX, XXXXXXX, KC_F9, KC_F10, KC_F11, KC_F12, BL_DEC},
44 {_______, _______, _______, _______, _______, RESET, RESET, _______, XXXXXXX, MUV_DE, MUV_IN, BL_TOGG}
45},
46
47[_UNICODES] = { /* UNICODES - Extra layer for unicode stuff */
48 {_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______},
49 {_______, TFLIP, XXXXXXX, XXXXXXX, IBANG, roman7, XXXXXXX, XXXXXXX, ROMAN7, XXXXXXX, XXXXXXX, _______},
50 {KC_DEL, TPUT, FACE, DISFACE, SHRUG, roman4, roman5, roman6, ROMAN4, ROMAN5, ROMAN6, _______},
51 {XXXXXXX, XXXXXXX, XXXXXXX, LAROW, RAROW, roman1, roman2, roman3, ROMAN1, ROMAN2, ROMAN3, XXXXXXX},
52 {_______, _______, _______, _______, _______, KC_SPC, KC_SPC, _______, _______, _______, _______, _______}
53}
54};
diff --git a/keyboards/preonic/keymaps/zach/zach_common_functions.c b/keyboards/preonic/keymaps/zach/zach_common_functions.c
new file mode 100644
index 000000000..b77f2b241
--- /dev/null
+++ b/keyboards/preonic/keymaps/zach/zach_common_functions.c
@@ -0,0 +1,447 @@
1#ifndef ZACH_COMMON_FUNCTIONS
2#define ZACH_COMMON_FUNCTIONS
3#include "eeconfig.h"
4#include "action_layer.h"
5#include "keymap_colemak.h"
6extern keymap_config_t keymap_config;
7
8// Fillers to make layering more clear
9#define _______ KC_TRNS
10#define XXXXXXX KC_NO
11#define C(n) RCTL(n)
12#define CADKEY RCTL(RALT(KC_DEL))
13
14void tap(uint16_t keycode){
15 register_code(keycode);
16 unregister_code(keycode);
17};
18
19void persistant_default_layer_set(uint16_t default_layer){
20 eeconfig_update_default_layer(default_layer);
21 default_layer_set(default_layer);
22};
23
24// Automatic number generation of important keywords
25enum my_keycodes{
26 // Layer numbers
27 _COLEMAK = 0,
28 _SWCOLE,
29 _RAISE,
30 _LOWER,
31 _ADJUST,
32 _UNICODES,
33 // These use process_record_user()
34 COLEMAK = SAFE_RANGE,
35 SWCOLE,
36 LOWER,
37 RAISE,
38 SHFT_CAP,
39 CTRLB,
40 CPYPST,
41 FACE,
42 UNIWIN,
43 UNILIN,
44 DISFACE,
45 TFLIP,
46 TPUT,
47 SHRUG,
48 RANDIG,
49 // Tap_Dance nums
50 RAI = 0,
51 LOW,
52 SUP
53};
54
55#ifdef AUDIO_ENABLE
56#include "audio.h"
57float tone_startup[][2] = SONG(STARTUP_SOUND);
58float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
59float tone_colemak[][2] = SONG(COLEMAK_SOUND);
60float tone_swcole[][2] = SONG(QWERTY_SOUND);
61float tone_capslock_on[][2] = SONG(CAPS_LOCK_ON_SOUND);
62float tone_capslock_off[][2] = SONG(CAPS_LOCK_OFF_SOUND);
63float tone_ctrl_mod[][2] = SONG(COIN_SOUND);
64float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND);
65float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND);
66float uniwin[][2] = SONG(UNICODE_WINDOWS);
67float unilin[][2] = SONG(UNICODE_LINUX);
68#endif
69
70#ifdef TAP_DANCE_ENABLE
71#define TAPPING_TERM 200
72
73void dance_raise_press(qk_tap_dance_state_t *state, void *user_data){// Called on each tap
74 switch(state->count){ // Only turn the layer on once
75 case 1:
76 layer_off(_UNICODES);
77 layer_on(_RAISE);
78 update_tri_layer(_LOWER, _RAISE, _ADJUST);
79 break;
80 }
81};
82void dance_raise_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on release
83 switch(state->count){
84 case 1: // Normal action. Turn off layers
85 layer_off(_RAISE);
86 update_tri_layer(_LOWER, _RAISE, _ADJUST);
87 layer_off(_UNICODES);
88 break;
89 }
90};
91/////////////////////////////////////////////////////////////////////
92void dance_lower_press(qk_tap_dance_state_t *state, void *user_data){// Called on tap
93 switch(state->count){
94 case 1: // Turn on lower
95 layer_off(_UNICODES);
96 layer_on(_LOWER);
97 update_tri_layer(_LOWER, _RAISE, _ADJUST);
98 break;
99 }
100};
101void dance_lower_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on release
102 switch(state->count){
103 case 1: // Normal action. Turn off layers
104 layer_off(_LOWER);
105 update_tri_layer(_LOWER, _RAISE, _ADJUST);
106 layer_off(_UNICODES);
107 break;
108 case 2: // Turn on _UNICODES layer
109 layer_off(_LOWER);
110 update_tri_layer(_LOWER, _RAISE, _ADJUST);
111 layer_on(_UNICODES);
112 #ifdef AUDIO_ENABLE
113 PLAY_NOTE_ARRAY(tone_ctrl_mod, false, 0);
114 #endif
115 break;
116 }
117};
118/////////////////////////////////////////////////////////////////////
119void dance_super_press(qk_tap_dance_state_t *state, void *user_data){ // Called on down
120 if(state->count == 1){
121 register_code(KC_LGUI);
122 }
123}
124void dance_super_done(qk_tap_dance_state_t *state, void *user_data){ // Called on timeout
125 switch(state->count){
126 case 2:
127 register_code(KC_LGUI);
128 tap(KC_L);
129 unregister_code(KC_LGUI);
130 break;
131 }
132}
133void dance_super_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on up
134 unregister_code(KC_LGUI);
135}
136
137qk_tap_dance_action_t tap_dance_actions[] = {
138 [RAI] = ACTION_TAP_DANCE_FN_ADVANCED(dance_raise_press, NULL, dance_raise_lift),
139 [LOW] = ACTION_TAP_DANCE_FN_ADVANCED(dance_lower_press, NULL, dance_lower_lift),
140 [SUP] = ACTION_TAP_DANCE_FN_ADVANCED(dance_super_press, dance_super_done, dance_super_lift)
141};
142#endif
143
144#ifdef UNICODE_ENABLE
145// Unicode shortcuts
146#define IBANG UC(0x203D)
147#define RAROW UC(0x2192)
148#define LAROW UC(0x2190)
149#define DEGREE UC(0x00B0)
150#define OMEGA UC(0x03A9)
151#define WOMEGA UC(0x03C9)
152#define MICRO UC(0x00B5)
153#define PLUMIN UC(0x00B1)
154#define SUPA2 UC(0x00B2)
155#define ROMAN1 UC(0x2160)
156#define ROMAN2 UC(0x2161)
157#define ROMAN3 UC(0x2162)
158#define ROMAN4 UC(0x2163)
159#define ROMAN5 UC(0x2164)
160#define ROMAN6 UC(0x2165)
161#define ROMAN7 UC(0x2166)
162#define roman1 UC(0x2170)
163#define roman2 UC(0x2171)
164#define roman3 UC(0x2172)
165#define roman4 UC(0x2173)
166#define roman5 UC(0x2174)
167#define roman6 UC(0x2175)
168#define roman7 UC(0x2176)
169
170#ifdef UNICODEMAP_ENABLE // For Unicode characters larger than 0x8000. Send with X(<unicode>)
171enum Ext_Unicode{
172 PENGUIN = 0,
173 BOAR,
174 MONKEY,
175 DRAGON,
176 CHICK,
177 TUMBLER
178};
179const uint32_t PROGMEM unicode_map[] = {
180 [PENGUIN] = 0x1F427,
181 [BOAR] = 0x1F417,
182 [MONKEY] = 0x1F412,
183 [DRAGON] = 0x1F409,
184 [CHICK] = 0x1F425,
185 [TUMBLER] = 0x1F943
186};
187#define PENGY X(PENGUIN)
188#define BOARY X(BOAR)
189#define MNKY X(MONKEY)
190#define DRGN X(DRAGON)
191#define DUCK X(CHICK)
192#define TMBL X(TUMBLER)
193#endif
194
195#endif
196
197static uint16_t key_timer;
198static uint8_t caps_status = 0;
199bool process_record_user(uint16_t keycode, keyrecord_t *record) {
200 switch (keycode) {
201 case COLEMAK:
202 if(record->event.pressed){
203 persistant_default_layer_set(1UL<<_COLEMAK);
204 #ifdef AUDIO_ENABLE
205 PLAY_NOTE_ARRAY(tone_colemak, false, 0);
206 #endif
207 }
208 return false;
209 break;
210 case SWCOLE:
211 if(record->event.pressed){
212 persistant_default_layer_set(1UL<<_SWCOLE);
213 #ifdef AUDIO_ENABLE
214 PLAY_NOTE_ARRAY(tone_swcole, false, 0);
215 #endif
216 }
217 return false;
218 break;
219 case RAISE:
220 if(record->event.pressed){
221 layer_on(_RAISE);
222 update_tri_layer(_LOWER, _RAISE, _ADJUST);
223 } else {
224 layer_off(_RAISE);
225 update_tri_layer(_LOWER, _RAISE, _ADJUST);
226 }
227 return false;
228 break;
229 case LOWER:
230 if(record->event.pressed){
231 layer_on(_LOWER);
232 update_tri_layer(_LOWER, _RAISE, _ADJUST);
233 } else {
234 layer_off(_LOWER);
235 update_tri_layer(_LOWER, _RAISE, _ADJUST);
236 }
237 return false;
238 break;
239 case SHFT_CAP:
240 if(record->event.pressed){
241 key_timer = timer_read(); // if the key is being pressed, we start the timer.
242 register_code(KC_LSHIFT);
243 } else { // this means the key was just released (tap or "held down")
244 if(timer_elapsed(key_timer) < 152){ // Time in ms, the threshold we pick for counting something as a tap.
245 tap(KC_CAPS);
246 if(caps_status == 0){
247 caps_status = 1;
248 #ifdef AUDIO_ENABLE
249 PLAY_NOTE_ARRAY(tone_capslock_on, false, 0);
250 #endif
251 } else {
252 caps_status = 0;
253 #ifdef AUDIO_ENABLE
254 PLAY_NOTE_ARRAY(tone_capslock_off, false, 0);
255 #endif
256 }
257 }
258 unregister_code(KC_LSHIFT);
259 }
260 return false;
261 break;
262 case CTRLB: // Control-B on tap (bold)
263 if(record->event.pressed){
264 key_timer = timer_read(); // if the key is being pressed, we start the timer.
265 register_code(KC_LCTL);
266 } else { // this means the key was just released (tap or "held down")
267 if (timer_elapsed(key_timer) < 152) { // Time in ms, the threshold we pick for counting something as a tap.
268 tap(KC_B);
269 #ifdef AUDIO_ENABLE
270 PLAY_NOTE_ARRAY(tone_ctrl_mod, false, 0);
271 #endif
272 #ifdef BACKLIGHT_BREATHING
273 breathing_speed_set(2);
274 breathing_pulse();
275 #endif
276 }
277 unregister_code(KC_LCTL);
278 }
279 return false;
280 break;
281 case CPYPST: // One key copy/paste
282 if(record->event.pressed){
283 key_timer = timer_read();
284 } else {
285 if (timer_elapsed(key_timer) > 152) { // Hold, copy
286 register_code(KC_LCTL);
287 tap(KC_C);
288 unregister_code(KC_LCTL);
289 #ifdef AUDIO_ENABLE
290 PLAY_NOTE_ARRAY(tone_copy, false, 0);
291 #endif
292 } else { // Tap, paste
293 register_code(KC_LCTL);
294 tap(KC_V);
295 unregister_code(KC_LCTL);
296 #ifdef AUDIO_ENABLE
297 PLAY_NOTE_ARRAY(tone_paste, false, 0);
298 #endif
299 }
300 }
301 return false;
302 break;
303 #ifdef UNICODE_ENABLE
304 case UNIWIN:
305 if(record->event.pressed){
306 set_unicode_input_mode(UC_WIN);
307 #ifdef AUDIO_ENABLE
308 PLAY_NOTE_ARRAY(uniwin, false, 0);
309 #endif
310 }
311 return false;
312 break;
313 case UNILIN:
314 if(record->event.pressed){
315 set_unicode_input_mode(UC_LNX);
316 #ifdef AUDIO_ENABLE
317 PLAY_NOTE_ARRAY(unilin, false, 0);
318 #endif
319 }
320 return false;
321 break;
322 case DISFACE: // ಠ_ಠ
323 if(record->event.pressed){
324 process_unicode((0x0CA0|QK_UNICODE), record); // Eye
325 register_code(KC_RSFT);
326 tap(KC_MINS);
327 unregister_code(KC_RSFT);
328 process_unicode((0x0CA0|QK_UNICODE), record); // Eye
329 }
330 return false;
331 break;
332 case TFLIP: // (╯°□°)╯ ︵ ┻━┻
333 if(record->event.pressed){
334 register_code(KC_RSFT);
335 tap(KC_9);
336 unregister_code(KC_RSFT);
337 process_unicode((0x256F|QK_UNICODE), record); // Arm
338 process_unicode((0x00B0|QK_UNICODE), record); // Eye
339 process_unicode((0x25A1|QK_UNICODE), record); // Mouth
340 process_unicode((0x00B0|QK_UNICODE), record); // Eye
341 register_code(KC_RSFT);
342 tap(KC_0);
343 unregister_code(KC_RSFT);
344 process_unicode((0x256F|QK_UNICODE), record); // Arm
345 tap(KC_SPC);
346 process_unicode((0x0361|QK_UNICODE), record); // Flippy
347 tap(KC_SPC);
348 process_unicode((0x253B|QK_UNICODE), record); // Table
349 process_unicode((0x2501|QK_UNICODE), record); // Table
350 process_unicode((0x253B|QK_UNICODE), record); // Table
351 }
352 return false;
353 break;
354 case TPUT: // ┬──┬ ノ( ゜-゜ノ)
355 if(record->event.pressed){
356 process_unicode((0x252C|QK_UNICODE), record); // Table
357 process_unicode((0x2500|QK_UNICODE), record); // Table
358 process_unicode((0x2500|QK_UNICODE), record); // Table
359 process_unicode((0x252C|QK_UNICODE), record); // Table
360 tap(KC_SPC);
361 process_unicode((0x30CE|QK_UNICODE), record); // Arm
362 register_code(KC_RSFT);
363 tap(KC_9);
364 unregister_code(KC_RSFT);
365 tap(KC_SPC);
366 process_unicode((0x309C|QK_UNICODE), record); // Eye
367 tap(KC_MINS);
368 process_unicode((0x309C|QK_UNICODE), record); // Eye
369 process_unicode((0x30CE|QK_UNICODE), record); // Arm
370 register_code(KC_RSFT);
371 tap(KC_0);
372 unregister_code(KC_RSFT);
373 }
374 return false;
375 break;
376 case SHRUG: // ¯\_(ツ)_/¯
377 if(record->event.pressed){
378 process_unicode((0x00AF|QK_UNICODE), record); // Hand
379 tap(KC_BSLS); // Arm
380 register_code(KC_RSFT);
381 tap(KC_UNDS); // Arm
382 tap(KC_LPRN); // Head
383 unregister_code(KC_RSFT);
384 process_unicode((0x30C4|QK_UNICODE), record); // Face
385 register_code(KC_RSFT);
386 tap(KC_RPRN); // Head
387 tap(KC_UNDS); // Arm
388 unregister_code(KC_RSFT);
389 tap(KC_SLSH); // Arm
390 process_unicode((0x00AF|QK_UNICODE), record); // Hand
391 }
392 return false;
393 break;
394 #endif
395 case FACE: // (o_O)
396 if(record->event.pressed){
397 register_code(KC_RSFT);
398 tap(KC_LPRN);
399 unregister_code(KC_RSFT);
400 tap(KC_O);
401 register_code(KC_RSFT);
402 tap(KC_UNDS);
403 tap(KC_O);
404 tap(KC_RPRN);
405 unregister_code(KC_RSFT);
406 }
407 return false;
408 break;
409 case RANDIG:
410 if (record->event.pressed) {
411 tap_random_base64();
412 }
413 return false;
414 break;
415 }
416 return true;
417};
418
419void matrix_init_user(void){ // Run once at startup
420 #ifdef AUDIO_ENABLE
421 _delay_ms(50); // gets rid of tick
422 PLAY_NOTE_ARRAY(tone_startup, false, 0);
423 #endif
424}
425
426#ifdef AUDIO_ENABLE
427void play_goodbye_tone(void){
428 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
429 _delay_ms(150);
430}
431
432void shutdown_user(){
433 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
434 _delay_ms(150);
435 stop_all_notes();
436}
437
438void music_on_user(void){ // Run when the music layer is turned on
439 PLAY_NOTE_ARRAY(tone_startup, false, 0);
440}
441
442void music_off_user(void){ // Run when music is turned off
443 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
444}
445#endif
446
447#endif
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h
index 3bf20333d..db2d1a94c 100644
--- a/quantum/audio/song_list.h
+++ b/quantum/audio/song_list.h
@@ -18,6 +18,10 @@
18#ifndef SONG_LIST_H 18#ifndef SONG_LIST_H
19#define SONG_LIST_H 19#define SONG_LIST_H
20 20
21#define COIN_SOUND \
22 E__NOTE(_A5 ),\
23 HD_NOTE(_E6 ),
24
21#define ODE_TO_JOY \ 25#define ODE_TO_JOY \
22 Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \ 26 Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \
23 Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \ 27 Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \
@@ -137,6 +141,14 @@
137 E__NOTE(_E5), \ 141 E__NOTE(_E5), \
138 E__NOTE(_D5), 142 E__NOTE(_D5),
139 143
144#define UNICODE_WINDOWS \
145 E__NOTE(_B5), \
146 S__NOTE(_E6),
147
148#define UNICODE_LINUX \
149 E__NOTE(_E6), \
150 S__NOTE(_B5),
151
140#define COIN_SOUND \ 152#define COIN_SOUND \
141 E__NOTE(_A5 ), \ 153 E__NOTE(_A5 ), \
142 HD_NOTE(_E6 ), 154 HD_NOTE(_E6 ),
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c
index 26571ea03..cecfaeee9 100644
--- a/quantum/process_keycode/process_unicode.c
+++ b/quantum/process_keycode/process_unicode.c
@@ -16,8 +16,88 @@
16#include "process_unicode.h" 16#include "process_unicode.h"
17#include "action_util.h" 17#include "action_util.h"
18 18
19static uint8_t input_mode;
20static uint8_t first_flag = 0;
21
22__attribute__((weak))
23uint16_t hex_to_keycode(uint8_t hex)
24{
25 if (hex == 0x0) {
26 return KC_0;
27 } else if (hex < 0xA) {
28 return KC_1 + (hex - 0x1);
29 } else {
30 return KC_A + (hex - 0xA);
31 }
32}
33
34void set_unicode_input_mode(uint8_t os_target)
35{
36 input_mode = os_target;
37 eeprom_update_byte(EECONFIG_UNICODEMODE, os_target);
38}
39
40uint8_t get_unicode_input_mode(void) {
41 return input_mode;
42}
43
44__attribute__((weak))
45void unicode_input_start (void) {
46 switch(input_mode) {
47 case UC_OSX:
48 register_code(KC_LALT);
49 break;
50 case UC_LNX:
51 register_code(KC_LCTL);
52 register_code(KC_LSFT);
53 register_code(KC_U);
54 unregister_code(KC_U);
55 unregister_code(KC_LSFT);
56 unregister_code(KC_LCTL);
57 break;
58 case UC_WIN:
59 register_code(KC_LALT);
60 register_code(KC_PPLS);
61 unregister_code(KC_PPLS);
62 break;
63 case UC_WINC:
64 register_code(KC_RALT);
65 unregister_code(KC_RALT);
66 register_code(KC_U);
67 unregister_code(KC_U);
68 }
69 wait_ms(UNICODE_TYPE_DELAY);
70}
71
72__attribute__((weak))
73void unicode_input_finish (void) {
74 switch(input_mode) {
75 case UC_OSX:
76 case UC_WIN:
77 unregister_code(KC_LALT);
78 break;
79 case UC_LNX:
80 register_code(KC_SPC);
81 unregister_code(KC_SPC);
82 break;
83 }
84}
85
86void register_hex(uint16_t hex) {
87 for(int i = 3; i >= 0; i--) {
88 uint8_t digit = ((hex >> (i*4)) & 0xF);
89 register_code(hex_to_keycode(digit));
90 unregister_code(hex_to_keycode(digit));
91 }
92}
93
94
19bool process_unicode(uint16_t keycode, keyrecord_t *record) { 95bool process_unicode(uint16_t keycode, keyrecord_t *record) {
20 if (keycode > QK_UNICODE && record->event.pressed) { 96 if (keycode > QK_UNICODE && record->event.pressed) {
97 if (first_flag == 0) {
98 set_unicode_input_mode(eeprom_read_byte(EECONFIG_UNICODEMODE));
99 first_flag = 1;
100 }
21 uint16_t unicode = keycode & 0x7FFF; 101 uint16_t unicode = keycode & 0x7FFF;
22 unicode_input_start(); 102 unicode_input_start();
23 register_hex(unicode); 103 register_hex(unicode);
diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h
index d8caa346f..280dc7ab6 100644
--- a/tmk_core/common/eeconfig.h
+++ b/tmk_core/common/eeconfig.h
@@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
33#define EECONFIG_BACKLIGHT (uint8_t *)6 33#define EECONFIG_BACKLIGHT (uint8_t *)6
34#define EECONFIG_AUDIO (uint8_t *)7 34#define EECONFIG_AUDIO (uint8_t *)7
35#define EECONFIG_RGBLIGHT (uint32_t *)8 35#define EECONFIG_RGBLIGHT (uint32_t *)8
36#define EECONFIG_UNICODEMODE (uint8_t *)12
36 37
37 38
38/* debug bit */ 39/* debug bit */