aboutsummaryrefslogtreecommitdiff
path: root/users/drashna
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-05-02 08:39:46 -0700
committerJack Humbert <jack.humb@gmail.com>2018-05-02 11:39:46 -0400
commite5540dd055b16eaebb28e25e0cb9b314e397e854 (patch)
tree798a05c6335c11ad55231337883003ea248b4df9 /users/drashna
parent9b8fc6f1c0129ee119965a2a4d025b0f5c9c613b (diff)
downloadqmk_firmware-e5540dd055b16eaebb28e25e0cb9b314e397e854.tar.gz
qmk_firmware-e5540dd055b16eaebb28e25e0cb9b314e397e854.zip
Update to drashna keymaps and userspace (#2876)
* Fix Unicode sample * Add irony mark * Remove unpretty keymaps * Add QMK DFU and Conditional Music Mode * Unicode fixes * Unicode fixes * Make layer indication more modular * Finish removing Faux Click * Cleanup of UserSpace and addition of 'update_tri_layer_state' function * Add modifier status indicators to Orthodox * Remove tri layer function * Minor tweaks * Remove the Orthodox's Indicator's reliance on layer_state_set * Add custom EEPROM settings * Make EEPROM config more efficient * Viterbi Config * Add Iris Keyboard layout and Userspace cleanup * Iris keyboard tweaks * Use Grave Escape on Iris * Update Readmes
Diffstat (limited to 'users/drashna')
-rw-r--r--users/drashna/config.h8
-rw-r--r--users/drashna/drashna.c318
-rw-r--r--users/drashna/drashna.h125
-rw-r--r--users/drashna/drashna_unicode.h71
-rw-r--r--users/drashna/readme.md28
5 files changed, 314 insertions, 236 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index e48f72355..0a59ad026 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -58,10 +58,16 @@
58 58
59// Disable action_get_macro and fn_actions, since we don't use these 59// Disable action_get_macro and fn_actions, since we don't use these
60// and it saves on space in the firmware. 60// and it saves on space in the firmware.
61#ifndef NO_DEBUG
62#define NO_DEBUG
63#endif // !NO_DEBUG
64#ifndef NO_PRINT
65#define NO_PRINT
66#endif // !NO_PRINT
61#define NO_ACTION_MACRO 67#define NO_ACTION_MACRO
62#define NO_ACTION_FUNCTION 68#define NO_ACTION_FUNCTION
63 69
64 70#define DISABLE_LEADER
65 71
66#endif // !USERSPACE_CONFIG_H 72#endif // !USERSPACE_CONFIG_H
67 73
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index d9d412b08..86c16b826 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -33,35 +33,52 @@ PROGMEM const char secret[][64] = {
33#endif 33#endif
34 34
35 35
36#ifdef FAUXCLICKY_ENABLE
37float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25);
38float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125);
39#else // FAUXCLICKY_ENABLE
40float fauxclicky_pressed[][2] = SONG(S__NOTE(_A6)); // change to your tastes
41float fauxclicky_released[][2] = SONG(S__NOTE(_A6)); // change to your tastes
42#endif // FAUXCLICKY_ENABLE
43
44float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND); 36float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND);
45float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); 37float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND);
46 38
47 39
48bool faux_click_enabled = false;
49bool is_overwatch = false;
50static uint16_t copy_paste_timer; 40static uint16_t copy_paste_timer;
51#ifdef RGBLIGHT_ENABLE 41#ifdef RGBLIGHT_ENABLE
52bool rgb_layer_change = true; 42bool rgb_layer_change = true;
53#endif 43#endif
54 44
45userspace_config_t userspace_config;
46
47// Helper Functions
48void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
49
50#ifdef RGBLIGHT_ENABLE
51void rgblight_sethsv_default_helper(uint8_t index) {
52 uint8_t default_layer = eeconfig_read_default_layer();
53 if (default_layer & (1UL << _COLEMAK)) {
54 rgblight_sethsv_at(300, 255, 255, index);
55 rgblight_sethsv_at(300, 255, 255, index);
56 }
57 else if (default_layer & (1UL << _DVORAK)) {
58 rgblight_sethsv_at(120, 255, 255, index);
59 rgblight_sethsv_at(120, 255, 255, index);
60 }
61 else if (default_layer & (1UL << _WORKMAN)) {
62 rgblight_sethsv_at(43, 255, 255, index);
63 rgblight_sethsv_at(43, 255, 255, index);
64 }
65 else {
66 rgblight_sethsv_at(180, 255, 255, index);
67 rgblight_sethsv_at(180, 255, 255, index);
68 }
69}
70#endif // RGBLIGHT_ENABLE
71
72
73// ========================================= TAP DANCE =========================================
55#ifdef TAP_DANCE_ENABLE 74#ifdef TAP_DANCE_ENABLE
56//define diablo macro timer variables 75//define diablo macro timer variables
57static uint16_t diablo_timer[4]; 76static uint16_t diablo_timer[4];
58static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 }; 77static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
59static uint8_t diablo_key_time[4]; 78static uint8_t diablo_key_time[4];
60 79
61bool check_dtimer(uint8_t dtimer) { 80// has the correct number of seconds elapsed (as defined by diablo_times)
62 // has the correct number of seconds elapsed (as defined by diablo_times) 81bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; };
63 return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
64};
65 82
66// Cycle through the times for the macro, starting at 0, for disabled. 83// Cycle through the times for the macro, starting at 0, for disabled.
67// Max of six values, so don't exceed 84// Max of six values, so don't exceed
@@ -69,25 +86,16 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_
69 if (state->count >= 7) { 86 if (state->count >= 7) {
70 diablo_key_time[diablo_key] = diablo_times[0]; 87 diablo_key_time[diablo_key] = diablo_times[0];
71 reset_tap_dance(state); 88 reset_tap_dance(state);
72 } 89 } else {
73 else {
74 diablo_key_time[diablo_key] = diablo_times[state->count - 1]; 90 diablo_key_time[diablo_key] = diablo_times[state->count - 1];
75 } 91 }
76} 92}
77 93
78// Would rather have one function for all of this, but no idea how to do that... 94// Would rather have one function for all of this, but no idea how to do that...
79void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { 95void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 0); }
80 diablo_tapdance_master(state, user_data, 0); 96void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 1); }
81} 97void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 2); }
82void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { 98void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 3); }
83 diablo_tapdance_master(state, user_data, 1);
84}
85void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
86 diablo_tapdance_master(state, user_data, 2);
87}
88void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
89 diablo_tapdance_master(state, user_data, 3);
90}
91 99
92//Tap Dance Definitions 100//Tap Dance Definitions
93qk_tap_dance_action_t tap_dance_actions[] = { 101qk_tap_dance_action_t tap_dance_actions[] = {
@@ -96,7 +104,6 @@ qk_tap_dance_action_t tap_dance_actions[] = {
96 [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2), 104 [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
97 [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3), 105 [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
98 [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4), 106 [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
99
100}; 107};
101 108
102// Sends the key press to system, but only if on the Diablo layer 109// Sends the key press to system, but only if on the Diablo layer
@@ -104,17 +111,13 @@ void send_diablo_keystroke(uint8_t diablo_key) {
104 if (biton32(layer_state) == _DIABLO) { 111 if (biton32(layer_state) == _DIABLO) {
105 switch (diablo_key) { 112 switch (diablo_key) {
106 case 0: 113 case 0:
107 SEND_STRING("1"); 114 tap(KC_1); break;
108 break;
109 case 1: 115 case 1:
110 SEND_STRING("2"); 116 tap(KC_2); break;
111 break;
112 case 2: 117 case 2:
113 SEND_STRING("3"); 118 tap(KC_3); break;
114 break;
115 case 3: 119 case 3:
116 SEND_STRING("4"); 120 tap(KC_4); break;
117 break;
118 } 121 }
119 } 122 }
120} 123}
@@ -123,7 +126,6 @@ void send_diablo_keystroke(uint8_t diablo_key) {
123// Runs the "send string" command if enough time has passed, and resets the timer. 126// Runs the "send string" command if enough time has passed, and resets the timer.
124void run_diablo_macro_check(void) { 127void run_diablo_macro_check(void) {
125 uint8_t dtime; 128 uint8_t dtime;
126
127 for (dtime = 0; dtime < 4; dtime++) { 129 for (dtime = 0; dtime < 4; dtime++) {
128 if (check_dtimer(dtime) && diablo_key_time[dtime]) { 130 if (check_dtimer(dtime) && diablo_key_time[dtime]) {
129 diablo_timer[dtime] = timer_read(); 131 diablo_timer[dtime] = timer_read();
@@ -131,7 +133,6 @@ void run_diablo_macro_check(void) {
131 } 133 }
132 } 134 }
133} 135}
134
135#endif // TAP_DANCE_ENABLE 136#endif // TAP_DANCE_ENABLE
136 137
137 138
@@ -162,31 +163,32 @@ void led_set_keymap(uint8_t usb_led) {}
162// Call user matrix init, set default RGB colors and then 163// Call user matrix init, set default RGB colors and then
163// call the keymap's init function 164// call the keymap's init function
164void matrix_init_user(void) { 165void matrix_init_user(void) {
165#ifdef RGBLIGHT_ENABLE
166 uint8_t default_layer = eeconfig_read_default_layer(); 166 uint8_t default_layer = eeconfig_read_default_layer();
167 167
168#ifdef RGBLIGHT_ENABLE
168 rgblight_enable(); 169 rgblight_enable();
170#endif // RGBLIGHT_ENABLE
169 171
170 if (true) { 172 if (default_layer & (1UL << _COLEMAK)) {
171 if (default_layer & (1UL << _COLEMAK)) { 173#ifdef RGBLIGHT_ENABLE
172 rgblight_sethsv_magenta(); 174 rgblight_sethsv_magenta();
173 }
174 else if (default_layer & (1UL << _DVORAK)) {
175 rgblight_sethsv_green();
176 }
177 else if (default_layer & (1UL << _WORKMAN)) {
178 rgblight_sethsv_goldenrod();
179 }
180 else {
181 rgblight_sethsv_teal();
182 }
183 }
184 else
185 {
186 rgblight_setrgb_red();
187 rgblight_mode(5);
188 }
189#endif // RGBLIGHT_ENABLE 175#endif // RGBLIGHT_ENABLE
176 } else if (default_layer & (1UL << _DVORAK)) {
177#ifdef RGBLIGHT_ENABLE
178 rgblight_sethsv_green();
179#endif // RGBLIGHT_ENABLE
180 } else if (default_layer & (1UL << _WORKMAN)) {
181#ifdef RGBLIGHT_ENABLE
182 rgblight_sethsv_goldenrod();
183#endif // RGBLIGHT_ENABLE
184 } else {
185#ifdef RGBLIGHT_ENABLE
186 rgblight_sethsv_teal();
187#endif // RGBLIGHT_ENABLE
188 }
189
190 userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE);
191 clicky_enable = userspace_config.clicky_enable;
190 192
191#if ( defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) ) 193#if ( defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) )
192 set_unicode_input_mode(UC_WINC); 194 set_unicode_input_mode(UC_WINC);
@@ -197,23 +199,21 @@ void matrix_init_user(void) {
197// No global matrix scan code, so just run keymap's matrix 199// No global matrix scan code, so just run keymap's matrix
198// scan function 200// scan function
199void matrix_scan_user(void) { 201void matrix_scan_user(void) {
202
200#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. 203#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
201 run_diablo_macro_check(); 204 run_diablo_macro_check();
202#endif // TAP_DANCE_ENABLE 205#endif // TAP_DANCE_ENABLE
206
203 matrix_scan_keymap(); 207 matrix_scan_keymap();
204} 208}
205 209
206void tap(uint16_t keycode){
207 register_code(keycode);
208 unregister_code(keycode);
209};
210 210
211// This block is for all of the gaming macros, as they were all doing 211// This block is for all of the gaming macros, as they were all doing
212// the same thing, but with differring text sent. 212// the same thing, but with differring text sent.
213bool send_game_macro(const char *str, keyrecord_t *record, bool override) { 213bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
214 if (!record->event.pressed || override) { 214 if (!record->event.pressed || override) {
215 clear_keyboard(); 215 clear_keyboard();
216 tap(is_overwatch ? KC_BSPC : KC_ENTER); 216 tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER);
217 wait_ms(50); 217 wait_ms(50);
218 send_string(str); 218 send_string(str);
219 wait_ms(50); 219 wait_ms(50);
@@ -261,39 +261,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
261 break; 261 break;
262 262
263 263
264 case LOWER:
265 if (record->event.pressed) {
266 layer_on(_LOWER);
267 update_tri_layer(_LOWER, _RAISE, _ADJUST);
268 }
269 else {
270 layer_off(_LOWER);
271 update_tri_layer(_LOWER, _RAISE, _ADJUST);
272 }
273 return false;
274 break;
275 case RAISE:
276 if (record->event.pressed) {
277 layer_on(_RAISE);
278 update_tri_layer(_LOWER, _RAISE, _ADJUST);
279 }
280 else {
281 layer_off(_RAISE);
282 update_tri_layer(_LOWER, _RAISE, _ADJUST);
283 }
284 return false;
285 break;
286 case ADJUST:
287 if (record->event.pressed) {
288 layer_on(_ADJUST);
289 }
290 else {
291 layer_off(_ADJUST);
292 }
293 return false;
294 break;
295
296
297 case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader 264 case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
298 if (!record->event.pressed) { 265 if (!record->event.pressed) {
299 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP 266 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
@@ -349,11 +316,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
349// These are a serious of gaming macros. 316// These are a serious of gaming macros.
350// Only enables for the viterbi, basically, 317// Only enables for the viterbi, basically,
351// to save on firmware space, since it's limited. 318// to save on firmware space, since it's limited.
352#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) 319#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_iris_rev2))
353 case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros 320 case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros
354 if (record->event.pressed) { is_overwatch = !is_overwatch; } 321 if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); }
355#ifdef RGBLIGHT_ENABLE 322#ifdef RGBLIGHT_ENABLE
356 is_overwatch ? rgblight_mode(17) : rgblight_mode(18); 323 userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
357#endif //RGBLIGHT_ENABLE 324#endif //RGBLIGHT_ENABLE
358 return false; break; 325 return false; break;
359 case KC_SALT: 326 case KC_SALT:
@@ -435,7 +402,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
435 } 402 }
436 return false; 403 return false;
437 break; 404 break;
438 405 case CLICKY_TOGGLE:
406 userspace_config.clicky_enable = clicky_enable;
407 eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
408 break;
439#ifdef UNICODE_ENABLE 409#ifdef UNICODE_ENABLE
440 case UC_FLIP: // (╯°□°)╯ ︵ ┻━┻ 410 case UC_FLIP: // (╯°□°)╯ ︵ ┻━┻
441 if (record->event.pressed) { 411 if (record->event.pressed) {
@@ -466,81 +436,135 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
466} 436}
467 437
468 438
439
469// Runs state check and changes underglow color and animation 440// Runs state check and changes underglow color and animation
470// on layer change, no matter where the change was initiated 441// on layer change, no matter where the change was initiated
471// Then runs keymap's layer change check 442// Then runs keymap's layer change check
472uint32_t layer_state_set_user(uint32_t state) { 443uint32_t layer_state_set_user(uint32_t state) {
473#ifdef RGBLIGHT_ENABLE
474 uint8_t default_layer = eeconfig_read_default_layer(); 444 uint8_t default_layer = eeconfig_read_default_layer();
445 state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
475 446
476 if (rgb_layer_change) { 447 switch (biton32(state)) {
477 switch (biton32(state)) { 448 case _NAV:
478 case _NAV: 449#ifdef RGBLIGHT_ENABLE
450 if (rgb_layer_change) {
479 rgblight_sethsv_blue(); 451 rgblight_sethsv_blue();
480 rgblight_mode(1); 452 rgblight_mode(1);
481 break; 453 }
482 case _SYMB: 454#endif // RGBLIGHT_ENABLE
455 break;
456 case _SYMB:
457#ifdef RGBLIGHT_ENABLE
458 if (rgb_layer_change) {
483 rgblight_sethsv_blue(); 459 rgblight_sethsv_blue();
484 rgblight_mode(2); 460 rgblight_mode(2);
485 break; 461 }
486 case _MOUS: 462#endif // RGBLIGHT_ENABLE
463 break;
464 case _MOUS:
465#ifdef RGBLIGHT_ENABLE
466 if (rgb_layer_change) {
487 rgblight_sethsv_yellow(); 467 rgblight_sethsv_yellow();
488 rgblight_mode(1); 468 rgblight_mode(1);
489 break; 469 }
490 case _MACROS: 470#endif // RGBLIGHT_ENABLE
471 break;
472 case _MACROS:
473#ifdef RGBLIGHT_ENABLE
474 if (rgb_layer_change) {
491 rgblight_sethsv_orange(); 475 rgblight_sethsv_orange();
492 is_overwatch ? rgblight_mode(17) : rgblight_mode(18); 476 userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
493 break; 477 }
494 case _MEDIA: 478#endif // RGBLIGHT_ENABLE
479 break;
480 case _MEDIA:
481#ifdef RGBLIGHT_ENABLE
482 if (rgb_layer_change) {
495 rgblight_sethsv_chartreuse(); 483 rgblight_sethsv_chartreuse();
496 rgblight_mode(22); 484 rgblight_mode(22);
497 break; 485 }
498 case _GAMEPAD: 486#endif // RGBLIGHT_ENABLE
487 break;
488 case _GAMEPAD:
489#ifdef RGBLIGHT_ENABLE
490 if (rgb_layer_change) {
499 rgblight_sethsv_orange(); 491 rgblight_sethsv_orange();
500 rgblight_mode(17); 492 rgblight_mode(17);
501 break; 493 }
502 case _DIABLO: 494#endif // RGBLIGHT_ENABLE
495 break;
496 case _DIABLO:
497#ifdef RGBLIGHT_ENABLE
498 if (rgb_layer_change) {
503 rgblight_sethsv_red(); 499 rgblight_sethsv_red();
504 rgblight_mode(5); 500 rgblight_mode(5);
505 break; 501 }
506 case _RAISE: 502#endif // RGBLIGHT_ENABLE
503 break;
504 case _RAISE:
505#ifdef RGBLIGHT_ENABLE
506 if (rgb_layer_change) {
507 rgblight_sethsv_yellow(); 507 rgblight_sethsv_yellow();
508 rgblight_mode(5); 508 rgblight_mode(5);
509 break; 509 }
510 case _LOWER: 510#endif // RGBLIGHT_ENABLE
511 break;
512 case _LOWER:
513#ifdef RGBLIGHT_ENABLE
514 if (rgb_layer_change) {
511 rgblight_sethsv_orange(); 515 rgblight_sethsv_orange();
512 rgblight_mode(5); 516 rgblight_mode(5);
513 break; 517 }
514 case _ADJUST: 518#endif // RGBLIGHT_ENABLE
519 break;
520 case _ADJUST:
521#ifdef RGBLIGHT_ENABLE
522 if (rgb_layer_change) {
515 rgblight_sethsv_red(); 523 rgblight_sethsv_red();
516 rgblight_mode(23); 524 rgblight_mode(23);
517 break; 525 }
518 case _COVECUBE: 526#endif // RGBLIGHT_ENABLE
527 break;
528 case _COVECUBE:
529#ifdef RGBLIGHT_ENABLE
530 if (rgb_layer_change) {
519 rgblight_sethsv_green(); 531 rgblight_sethsv_green();
520 rgblight_mode(2); 532 rgblight_mode(2);
521 break;
522 default: // for any other layers, or the default layer
523 if (default_layer & (1UL << _COLEMAK)) {
524 rgblight_sethsv_magenta();
525 }
526 else if (default_layer & (1UL << _DVORAK)) {
527 rgblight_sethsv_green();
528 }
529 else if (default_layer & (1UL << _WORKMAN)) {
530 rgblight_sethsv_goldenrod();
531 }
532 else {
533 rgblight_sethsv_teal();
534 }
535 if (biton32(state) == _MODS) { // If the non-OSM layer is enabled, then breathe
536 rgblight_mode(2);
537 } else { // otherwise, stay solid
538 rgblight_mode(1);
539 }
540 break;
541 } 533 }
542 }
543#endif // RGBLIGHT_ENABLE 534#endif // RGBLIGHT_ENABLE
535 break;
536 default: // for any other layers, or the default layer
537 if (default_layer & (1UL << _COLEMAK)) {
538#ifdef RGBLIGHT_ENABLE
539 if (rgb_layer_change) { rgblight_sethsv_magenta(); }
540#endif // RGBLIGHT_ENABLE
541 }
542 else if (default_layer & (1UL << _DVORAK)) {
543#ifdef RGBLIGHT_ENABLE
544 if (rgb_layer_change) { rgblight_sethsv_green(); }
545#endif // RGBLIGHT_ENABLE
546 }
547 else if (default_layer & (1UL << _WORKMAN)) {
548#ifdef RGBLIGHT_ENABLE
549 if (rgb_layer_change) { rgblight_sethsv_goldenrod(); }
550#endif // RGBLIGHT_ENABLE
551 }
552 else {
553#ifdef RGBLIGHT_ENABLE
554 if (rgb_layer_change) { rgblight_sethsv_teal(); }
555#endif // RGBLIGHT_ENABLE
556 }
557 if (biton32(state) == _MODS) { // If the non-OSM layer is enabled, then breathe
558#ifdef RGBLIGHT_ENABLE
559 if (rgb_layer_change) { rgblight_mode(2); }
560#endif // RGBLIGHT_ENABLE
561 } else { // otherwise, stay solid
562#ifdef RGBLIGHT_ENABLE
563 if (rgb_layer_change) { rgblight_mode(1); }
564#endif // RGBLIGHT_ENABLE
565 }
566 break;
567 }
544 return layer_state_set_keymap (state); 568 return layer_state_set_keymap (state);
545} 569}
546 570
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 746c7e20a..5ef25333b 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -49,8 +49,22 @@ enum userspace_layers {
49// RGB color codes are no longer located here anymore. Instead, you will want to 49// RGB color codes are no longer located here anymore. Instead, you will want to
50// head to https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h 50// head to https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h
51 51
52extern bool is_overwatch;
53extern bool rgb_layer_change; 52extern bool rgb_layer_change;
53extern bool clicky_enable;
54
55#ifdef RGBLIGHT_ENABLE
56void rgblight_sethsv_default_helper(uint8_t index);
57#endif // RGBLIGHT_ENABLE
58
59#define EECONFIG_USERSPACE (uint8_t *)20
60
61typedef union {
62 uint32_t raw;
63 struct {
64 bool clicky_enable :1;
65 bool is_overwatch :1;
66 };
67} userspace_config_t;
54 68
55enum userspace_custom_keycodes { 69enum userspace_custom_keycodes {
56 EPRM = SAFE_RANGE, // can always be here 70 EPRM = SAFE_RANGE, // can always be here
@@ -59,9 +73,6 @@ enum userspace_custom_keycodes {
59 KC_COLEMAK, 73 KC_COLEMAK,
60 KC_DVORAK, 74 KC_DVORAK,
61 KC_WORKMAN, 75 KC_WORKMAN,
62 LOWER,
63 RAISE,
64 ADJUST,
65 KC_DIABLO_CLEAR, 76 KC_DIABLO_CLEAR,
66 KC_OVERWATCH, 77 KC_OVERWATCH,
67 KC_SALT, 78 KC_SALT,
@@ -90,6 +101,11 @@ enum userspace_custom_keycodes {
90 NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes 101 NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
91}; 102};
92 103
104#define LOWER MO(_LOWER)
105#define RAISE MO(_RAISE)
106#define ADJUST MO(_ADJUST)
107
108
93#define KC_SEC1 KC_SECRET_1 109#define KC_SEC1 KC_SECRET_1
94#define KC_SEC2 KC_SECRET_2 110#define KC_SEC2 KC_SECRET_2
95#define KC_SEC3 KC_SECRET_3 111#define KC_SEC3 KC_SECRET_3
@@ -102,6 +118,20 @@ enum userspace_custom_keycodes {
102#define WORKMAN KC_WORKMAN 118#define WORKMAN KC_WORKMAN
103#define KC_RST KC_RESET 119#define KC_RST KC_RESET
104 120
121
122#ifdef SWAP_HANDS_ENABLE
123#define KC_C1R3 SH_TT
124#else // SWAP_HANDS_ENABLE
125#define KC_C1R3 KC_BSPC
126#endif // SWAP_HANDS_ENABLE
127
128// OSM keycodes, to keep things clean and easy to change
129#define KC_MLSF OSM(MOD_LSFT)
130#define KC_MRSF OSM(MOD_RSFT)
131
132#define MG_NKRO MAGIC_TOGGLE_NKRO
133
134
105#ifdef TAP_DANCE_ENABLE 135#ifdef TAP_DANCE_ENABLE
106enum { 136enum {
107 TD_D3_1 = 0, 137 TD_D3_1 = 0,
@@ -111,72 +141,6 @@ enum {
111}; 141};
112#endif // TAP_DANCE_ENABLE 142#endif // TAP_DANCE_ENABLE
113 143
114#ifdef UNICODEMAP_ENABLE
115
116/* use X(n) to call the */
117
118
119enum unicode_name {
120 THINK, // thinking face 🤔
121 GRIN, // grinning face 😊
122 SMRK, // smirk 😏
123 WEARY, // good shit 😩
124 UNAMU, // unamused 😒
125
126 SNEK, // snke 🐍
127 PENGUIN, // 🐧
128 DRAGON, // 🐉
129 MONKEY, // 🐒
130 CHICK, // 🐥
131
132 OKOK, // 👌
133 EFFU, // 🖕
134 INUP, // 👆
135 THUP, // 👍
136 THDN, // 👎
137
138 BBB, // dat B 🅱
139 POO, // poop 💩
140 HUNDR, // 100 💯
141 EGGPL, // EGGPLANT 🍆
142 WATER, // wet 💦
143 TUMBLER, // 🥃
144
145 LIT, // fire 🔥
146 IRONY, // ‽
147 DEGREE, // °
148};
149
150
151const uint32_t PROGMEM unicode_map[] = {
152 [THINK] = 0x1F914,
153 [GRIN] = 0x1F600,
154 [BBB] = 0x1F171,
155 [POO] = 0x1F4A9,
156 [HUNDR] = 0x1F4AF,
157 [SMRK] = 0x1F60F,
158 [WEARY] = 0x1F629,
159 [EGGPL] = 0x1F346,
160 [WATER] = 0x1F4A6,
161 [LIT] = 0x1F525,
162 [UNAMU] = 0x1F612,
163 [SNEK] = 0x1F40D,
164 [PENGUIN] = 0x1F427,
165 [BOAR] = 0x1F417,
166 [MONKEY] = 0x1F412,
167 [CHICK] = 0x1F425,
168 [DRAGON] = 0x1F409,
169 [OKOK] = 0x1F44C,
170 [EFFU] = 0x1F595,
171 [INUP] = 0x1F446,
172 [THDN] = 0x1F44E,
173 [THUP] = 0x1F44D,
174 [TUMBLER] = 0x1F943,
175 [IRONY] = 0x0203D,
176 [DEGREE] = 0x000B0,
177 };
178
179#endif //UNICODEMAP_ENABLE
180 144
181// Custom Keycodes for Diablo 3 layer 145// Custom Keycodes for Diablo 3 layer
182// But since TD() doesn't work when tap dance is disabled 146// But since TD() doesn't work when tap dance is disabled
@@ -193,22 +157,6 @@ const uint32_t PROGMEM unicode_map[] = {
193#define KC_D3_4 KC_4 157#define KC_D3_4 KC_4
194#endif // TAP_DANCE_ENABLE 158#endif // TAP_DANCE_ENABLE
195 159
196// OSM keycodes, to keep things clean and easy to change
197#define KC_MLSF OSM(MOD_LSFT)
198#define KC_MRSF OSM(MOD_RSFT)
199
200
201
202// If we're still using the official Faux Clicky feature, substitute codes
203// so that we don't have any unused/blank keys.
204#ifdef FAUXCLICKY_ENABLE
205#define AUD_ON FC_ON
206#define AUD_OFF FC_OFF
207#else // FAUXCLICKY_ENABLE
208#define AUD_ON AU_ON
209#define AUD_OFF AU_OFF
210#endif // FAUXCLICKY_ENABLE
211
212 160
213 161
214// Since our quirky block definitions are basically a list of comma separated 162// Since our quirky block definitions are basically a list of comma separated
@@ -286,7 +234,8 @@ const uint32_t PROGMEM unicode_map[] = {
286#define _________________NORMAN_R2_________________ KC_J, KC_N, KC_I, KC_O, KC_U 234#define _________________NORMAN_R2_________________ KC_J, KC_N, KC_I, KC_O, KC_U
287#define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) 235#define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
288 236
289 237#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5
238#define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0
290 239
291// Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN), 240// Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN),
292// this allows us to quickly modify the bottom row for all of the layouts 241// this allows us to quickly modify the bottom row for all of the layouts
@@ -301,4 +250,4 @@ const uint32_t PROGMEM unicode_map[] = {
301 KC_SPACE,KC_BSPC, KC_END, KC_PGDN, KC_DEL, KC_ENTER 250 KC_SPACE,KC_BSPC, KC_END, KC_PGDN, KC_DEL, KC_ENTER
302 251
303 252
304#endif 253#endif // !USERSPACE
diff --git a/users/drashna/drashna_unicode.h b/users/drashna/drashna_unicode.h
new file mode 100644
index 000000000..3d1bc03f9
--- /dev/null
+++ b/users/drashna/drashna_unicode.h
@@ -0,0 +1,71 @@
1#ifndef UNICODE_USERSPACE_H
2#define UNICODE_USERSPACE_H
3
4
5
6/* use X(n) to call the */
7
8enum unicode_name {
9 THINK, // thinking face 🤔
10 GRIN, // grinning face 😊
11 SMRK, // smirk 😏
12 WEARY, // good shit 😩
13 UNAMU, // unamused 😒
14
15 SNEK, // snke 🐍
16 PENGUIN, // 🐧
17 DRAGON, // 🐉
18 MONKEY, // 🐒
19 CHICK, // 🐥
20 BOAR, // 🐗
21
22 OKOK, // 👌
23 EFFU, // 🖕
24 INUP, // 👆
25 THUP, // 👍
26 THDN, // 👎
27
28 BBB, // dat B 🅱
29 POO, // poop 💩
30 HUNDR, // 100 💯
31 EGGPL, // EGGPLANT 🍆
32 WATER, // wet 💦
33 TUMBLER, // 🥃
34
35 LIT, // fire 🔥
36 BANG, // ‽
37 IRONY, // ⸮
38 DEGREE // °
39};
40
41
42const uint32_t PROGMEM unicode_map[] = {
43 [THINK] = 0x1F914,
44 [GRIN] = 0x1F600,
45 [BBB] = 0x1F171,
46 [POO] = 0x1F4A9,
47 [HUNDR] = 0x1F4AF,
48 [SMRK] = 0x1F60F,
49 [WEARY] = 0x1F629,
50 [EGGPL] = 0x1F346,
51 [WATER] = 0x1F4A6,
52 [LIT] = 0x1F525,
53 [UNAMU] = 0x1F612,
54 [SNEK] = 0x1F40D,
55 [PENGUIN] = 0x1F427,
56 [BOAR] = 0x1F417,
57 [MONKEY] = 0x1F412,
58 [CHICK] = 0x1F425,
59 [DRAGON] = 0x1F409,
60 [OKOK] = 0x1F44C,
61 [EFFU] = 0x1F595,
62 [INUP] = 0x1F446,
63 [THDN] = 0x1F44E,
64 [THUP] = 0x1F44D,
65 [TUMBLER] = 0x1F943,
66 [BANG] = 0x0203D,
67 [IRONY] = 0x02E2E,
68 [DEGREE] = 0x000B0
69 };
70
71 #endif
diff --git a/users/drashna/readme.md b/users/drashna/readme.md
index c4e305e15..79758e7e5 100644
--- a/users/drashna/readme.md
+++ b/users/drashna/readme.md
@@ -146,3 +146,31 @@ endif
146``` 146```
147 147
148Then, if you run `make keyboard:name NO_SECRETS=yes`, it will default to the test strings in your `<name>.c` file, rather than reading from your file. 148Then, if you run `make keyboard:name NO_SECRETS=yes`, it will default to the test strings in your `<name>.c` file, rather than reading from your file.
149
150
151Userspace EEPROM config
152-----------------------
153
154This adds EEPROM support fo the userspace, so that certain values are configurable in such a way that persists when power is lost. Namely, just the clicky feature and the Overwatch macro option ("is_overwatch"). This is done by reading and saving the structure from EEPROM.
155
156To implement this, first you need to specify the location:
157
158```c
159#define EECONFIG_USERSPACE (uint8_t *)20
160```
161This tells us where in the EEPROM that the data structure is located, and this specifies that it's a byte (8 bits). However, to maximize it's usage, we want to specify a data structure here, so that we can use multiple settings. To do that:
162
163```c
164typedef union {
165 uint32_t raw;
166 struct {
167 bool clicky_enable :1;
168 bool is_overwatch :1;
169 };
170} userspace_config_t;
171```
172Then, in your C file, you want to add: `userspace_config_t userspace_config;`, and in your `matrix_init_*` function, you want to add `userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE);`
173
174From there, you'd want to use the data structure (such as `userspace_config.is_overwatch`) when you want to check this value.
175
176And if you want to update it, update directly and then use `eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);` to write the value back to the EEPROM.