aboutsummaryrefslogtreecommitdiff
path: root/users/drashna
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2020-01-06 01:49:49 -0800
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2020-01-06 01:49:48 -0800
commit00d3061e02fa5fedaa6e6cebd310d4e716ffffee (patch)
treef799486433da3995d7db6c44f4a32d2a86be4ef8 /users/drashna
parentb3b115bcc4466b0320a6725c8e994a9ef4186328 (diff)
downloadqmk_firmware-00d3061e02fa5fedaa6e6cebd310d4e716ffffee.tar.gz
qmk_firmware-00d3061e02fa5fedaa6e6cebd310d4e716ffffee.zip
[Keymap] Cleanup of Drashna code (#7800)
* ifdef rgb stuff like a madman for RGB Coexistance * Re-enable RGB Light on Planck * fix RGB Coexistance issue * Tweak feature settings for Ergodox EZ Glow * Their powers combine, and I am Captain RGB This one is for noroadsleft and yan. * Limit brightness when both RGB features are enabled * Change shutdown method * Add RGB Coexistience stuff to keymap * disable RGBLIGHT_SLEEP until a solution can be found * Disable Unicode on the kyria * Fix up Iris rev defines * Fix up community layouts to compile properly * Cleanup rgb stuff * Merge ergodox keymaps * Update CCCV macro to use tap_code16 * Enable Solenoid on C39 Because josh couldn't * Enable RGB Light, not Matrix on rev6 keymap * Only enable LTO on non-ARM boards * Clean up Bootmagic OLED display * Enable RGBLIGHT_SPLIT on kyria Not that it does anything * Add hotkey for discord
Diffstat (limited to 'users/drashna')
-rw-r--r--users/drashna/drashna.c6
-rw-r--r--users/drashna/process_records.c8
-rw-r--r--users/drashna/rgb_stuff.c173
-rw-r--r--users/drashna/rules.mk6
4 files changed, 179 insertions, 14 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 71779a621..1a4ee9b41 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -121,9 +121,13 @@ void shutdown_user(void) {
121 rgblight_setrgb_red(); 121 rgblight_setrgb_red();
122#endif // RGBLIGHT_ENABLE 122#endif // RGBLIGHT_ENABLE
123#ifdef RGB_MATRIX_ENABLE 123#ifdef RGB_MATRIX_ENABLE
124# ifdef __AVR__
124 rgb_matrix_set_color_all(0xFF, 0x00, 0x00); 125 rgb_matrix_set_color_all(0xFF, 0x00, 0x00);
125 rgb_matrix_update_pwm_buffers(); 126 rgb_matrix_update_pwm_buffers();
126 127# else
128 rgb_matrix_sethsv_noeeprom(0, 255, 255);
129 rgb_matrix_mode_noeeprom(1);
130# endif
127#endif // RGB_MATRIX_ENABLE 131#endif // RGB_MATRIX_ENABLE
128 shutdown_keymap(); 132 shutdown_keymap();
129} 133}
diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c
index 2f79ad11c..af3ee9cf0 100644
--- a/users/drashna/process_records.c
+++ b/users/drashna/process_records.c
@@ -80,13 +80,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
80 copy_paste_timer = timer_read(); 80 copy_paste_timer = timer_read();
81 } else { 81 } else {
82 if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy 82 if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
83 register_code(KC_LCTL); 83 tap_code16(LCTL(KC_C));
84 tap_code(KC_C);
85 unregister_code(KC_LCTL);
86 } else { // Tap, paste 84 } else { // Tap, paste
87 register_code(KC_LCTL); 85 tap_code16(LCTL(KC_V));
88 tap_code(KC_V);
89 unregister_code(KC_LCTL);
90 } 86 }
91 } 87 }
92 break; 88 break;
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index 52ec61c22..e7247f754 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -147,6 +147,7 @@ bool rgblight_twinkle_is_led_used(uint8_t index) {
147/* Handler for fading/twinkling effect */ 147/* Handler for fading/twinkling effect */
148void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive 148void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive
149 bool litup = false; 149 bool litup = false;
150
150 for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) { 151 for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) {
151 if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 10) { 152 if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 10) {
152 rgblight_fadeout *light = &lights[light_index]; 153 rgblight_fadeout *light = &lights[light_index];
@@ -179,6 +180,7 @@ void start_rgb_light(void) {
179 uint8_t indices_count = 0; 180 uint8_t indices_count = 0;
180 uint8_t min_life = 0xFF; 181 uint8_t min_life = 0xFF;
181 uint8_t min_life_index = -1; 182 uint8_t min_life_index = -1;
183
182 for (uint8_t index = 0; index < RGBLED_NUM; ++index) { 184 for (uint8_t index = 0; index < RGBLED_NUM; ++index) {
183 if (rgblight_twinkle_is_led_used(index)) { 185 if (rgblight_twinkle_is_led_used(index)) {
184 continue; 186 continue;
@@ -248,7 +250,14 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
248 dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); 250 dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
249 eeconfig_update_user(userspace_config.raw); 251 eeconfig_update_user(userspace_config.raw);
250 if (userspace_config.rgb_layer_change) { 252 if (userspace_config.rgb_layer_change) {
253# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
254 rgblight_enable_noeeprom();
255# endif
251 layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) 256 layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
257# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
258 } else {
259 rgblight_disable_noeeprom();
260# endif
252 } 261 }
253 } 262 }
254#endif // RGBLIGHT_ENABLE 263#endif // RGBLIGHT_ENABLE
@@ -265,28 +274,182 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
265 } 274 }
266#endif 275#endif
267 break; 276 break;
277#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
278 case RGB_TOG:
279 // Split keyboards need to trigger on key-up for edge-case issue
280# ifndef SPLIT_KEYBOARD
281 if (record->event.pressed) {
282# else
283 if (!record->event.pressed) {
284# endif
285# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
286 rgblight_toggle();
287# endif
288# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
289 rgb_matrix_toggle();
290# endif
291 }
292 return false;
293 break;
268 case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions 294 case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
269 if (record->event.pressed) { 295 if (record->event.pressed) {
270 bool is_eeprom_updated = false; 296 bool is_eeprom_updated;
271#ifdef RGBLIGHT_ENABLE 297# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
272 // This disables layer indication, as it's assumed that if you're changing this ... you want that disabled 298 // This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
273 if (userspace_config.rgb_layer_change) { 299 if (userspace_config.rgb_layer_change) {
274 userspace_config.rgb_layer_change = false; 300 userspace_config.rgb_layer_change = false;
275 dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); 301 dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
276 is_eeprom_updated = true; 302 is_eeprom_updated = true;
277 } 303 }
278#endif 304# endif
279#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) 305# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
280 if (userspace_config.rgb_matrix_idle_anim) { 306 if (userspace_config.rgb_matrix_idle_anim) {
281 userspace_config.rgb_matrix_idle_anim = false; 307 userspace_config.rgb_matrix_idle_anim = false;
282 dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim); 308 dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim);
283 is_eeprom_updated = true; 309 is_eeprom_updated = true;
284 } 310 }
285#endif 311# endif
286 if (is_eeprom_updated) { 312 if (is_eeprom_updated) {
287 eeconfig_update_user(userspace_config.raw); 313 eeconfig_update_user(userspace_config.raw);
288 } 314 }
289 } 315 }
316
317# if defined(RGBLIGHT_DISABLE_KEYCODES) || defined(RGB_MATRIX_DISABLE_KEYCODES)
318 if (keycode == RGB_MODE_FORWARD && record->event.pressed) {
319 uint8_t shifted = get_mods() & (MOD_MASK_SHIFT);
320 if (shifted) {
321# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
322 rgblight_step_reverse();
323# endif
324# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
325 rgb_matrix_step_reverse();
326# endif
327 } else {
328# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
329 rgblight_step();
330# endif
331# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
332 rgb_matrix_step();
333# endif
334 }
335 } else if (keycode == RGB_MODE_REVERSE && record->event.pressed) {
336 uint8_t shifted = get_mods() & (MOD_MASK_SHIFT);
337 if (shifted) {
338# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
339 rgblight_step();
340# endif
341# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
342 rgb_matrix_step();
343# endif
344 } else {
345# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
346 rgblight_step_reverse();
347# endif
348# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
349 rgb_matrix_step_reverse();
350# endif
351 }
352 } else if (keycode == RGB_HUI) {
353# ifndef SPLIT_KEYBOARD
354 if (record->event.pressed) {
355# else
356 if (!record->event.pressed) {
357# endif
358# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
359 rgblight_increase_hue();
360# endif
361# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
362 rgb_matrix_increase_hue();
363# endif
364 }
365 } else if (keycode == RGB_HUD) {
366# ifndef SPLIT_KEYBOARD
367 if (record->event.pressed) {
368# else
369 if (!record->event.pressed) {
370# endif
371# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
372 rgblight_decrease_hue();
373# endif
374# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
375 rgb_matrix_decrease_hue();
376# endif
377 }
378 } else if (keycode == RGB_SAI) {
379# ifndef SPLIT_KEYBOARD
380 if (record->event.pressed) {
381# else
382 if (!record->event.pressed) {
383# endif
384# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
385 rgblight_increase_sat();
386# endif
387# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
388 rgb_matrix_increase_sat();
389# endif
390 }
391 } else if (keycode == RGB_SAD) {
392# ifndef SPLIT_KEYBOARD
393 if (record->event.pressed) {
394# else
395 if (!record->event.pressed) {
396# endif
397# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
398 rgblight_decrease_sat();
399# endif
400# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
401 rgb_matrix_decrease_sat();
402# endif
403 }
404 } else if (keycode == RGB_VAI) {
405# ifndef SPLIT_KEYBOARD
406 if (record->event.pressed) {
407# else
408 if (!record->event.pressed) {
409# endif
410# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
411 rgblight_increase_val();
412# endif
413# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
414 rgb_matrix_increase_val();
415# endif
416 }
417 } else if (keycode == RGB_VAD) {
418# ifndef SPLIT_KEYBOARD
419 if (record->event.pressed) {
420# else
421 if (!record->event.pressed) {
422# endif
423# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
424 rgblight_decrease_val();
425# endif
426# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
427 rgb_matrix_decrease_val();
428# endif
429 }
430 } else if (keycode == RGB_SPI) {
431 if (record->event.pressed) {
432# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
433 rgblight_increase_speed();
434# endif
435# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
436 rgb_matrix_increase_speed();
437# endif
438 }
439 } else if (keycode == RGB_SPD) {
440 if (record->event.pressed) {
441# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
442 rgblight_decrease_speed();
443# endif
444# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
445 rgb_matrix_decrease_speed();
446# endif
447 }
448 }
449 return false;
450# endif
451#endif
452
290 break; 453 break;
291 } 454 }
292 return true; 455 return true;
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index 882857fc8..4d55da803 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -1,7 +1,9 @@
1SRC += drashna.c \ 1SRC += drashna.c \
2 process_records.c 2 process_records.c
3 3
4LTO_ENABLE = yes 4ifneq ($(PLATFORM),CHIBIOS)
5 LTO_ENABLE = yes
6endif
5SPACE_CADET_ENABLE = no 7SPACE_CADET_ENABLE = no
6 8
7ifneq ($(strip $(NO_SECRETS)), yes) 9ifneq ($(strip $(NO_SECRETS)), yes)
@@ -58,4 +60,4 @@ endif
58# this should be handled per keyboard, but until that happens ... 60# this should be handled per keyboard, but until that happens ...
59ifeq ($(strip $(PROTOCOL)), VUSB) 61ifeq ($(strip $(PROTOCOL)), VUSB)
60 NKRO_ENABLE = no 62 NKRO_ENABLE = no
61endif \ No newline at end of file 63endif