From 00d3061e02fa5fedaa6e6cebd310d4e716ffffee Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 6 Jan 2020 01:49:49 -0800 Subject: [PATCH] [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 --- keyboards/c39/keymaps/drashna/config.h | 2 + keyboards/c39/keymaps/drashna/rules.mk | 2 + .../keebio/iris/keymaps/drashna/config.h | 14 +- keyboards/kyria/keymaps/drashna/config.h | 1 + keyboards/kyria/keymaps/drashna/keymap.c | 52 +++--- keyboards/kyria/keymaps/drashna/rules.mk | 2 +- layouts/community/ergodox/drashna/config.h | 15 +- layouts/community/ergodox/drashna/keymap.c | 41 +++-- layouts/community/ergodox/drashna/rules.mk | 21 ++- .../community/ergodox/drashna_glow/config.h | 9 - .../community/ergodox/drashna_glow/keymap.c | 2 - .../community/ergodox/drashna_glow/rules.mk | 13 -- layouts/community/ortho_4x12/drashna/keymap.c | 13 +- layouts/community/ortho_4x12/drashna/rules.mk | 20 +- layouts/community/ortho_5x12/drashna/rules.mk | 1 - users/drashna/drashna.c | 6 +- users/drashna/process_records.c | 8 +- users/drashna/rgb_stuff.c | 173 +++++++++++++++++- users/drashna/rules.mk | 6 +- 19 files changed, 278 insertions(+), 123 deletions(-) delete mode 100644 layouts/community/ergodox/drashna_glow/config.h delete mode 100644 layouts/community/ergodox/drashna_glow/keymap.c delete mode 100644 layouts/community/ergodox/drashna_glow/rules.mk diff --git a/keyboards/c39/keymaps/drashna/config.h b/keyboards/c39/keymaps/drashna/config.h index 5d53fe54bb9..789b7cc1400 100644 --- a/keyboards/c39/keymaps/drashna/config.h +++ b/keyboards/c39/keymaps/drashna/config.h @@ -10,3 +10,5 @@ #define RGB_DI_PIN B10 #define RGBLED_NUM 15 + +#define SOLENOID_PIN B11 diff --git a/keyboards/c39/keymaps/drashna/rules.mk b/keyboards/c39/keymaps/drashna/rules.mk index d216f6abe6e..6ebd15a1803 100644 --- a/keyboards/c39/keymaps/drashna/rules.mk +++ b/keyboards/c39/keymaps/drashna/rules.mk @@ -18,3 +18,5 @@ AUDIO_ENABLE = yes # Audio output on port C6 RGBLIGHT_ENABLE = yes # RGB Enable / Disable RGBLIGHT_STARTUP_ANIMATION = yes + +HAPTIC_ENABLE = SOLENOID diff --git a/keyboards/keebio/iris/keymaps/drashna/config.h b/keyboards/keebio/iris/keymaps/drashna/config.h index 25678bd67d1..49381b60a54 100644 --- a/keyboards/keebio/iris/keymaps/drashna/config.h +++ b/keyboards/keebio/iris/keymaps/drashna/config.h @@ -46,11 +46,13 @@ along with this program. If not, see . #ifdef AUDIO_ENABLE # define C6_AUDIO # ifdef RGBLIGHT_ENABLE -# define NO_MUSIC_MODE +# ifndef __arm__ +# define NO_MUSIC_MODE +# endif # endif // RGBLIGHT_ENABLE #endif // AUDIO_ENABLE -#ifndef KEYBOARD_keebio_iris_rev3 +#if defined(KEYBOARD_keebio_iris_rev1) || defined(KEYBOARD_keebio_iris_rev2) # define QMK_ESC_OUTPUT F6 // usually COL # define QMK_ESC_INPUT D7 // usually ROW # define QMK_LED B0 @@ -58,10 +60,12 @@ along with this program. If not, see . #endif #undef PRODUCT -#ifdef KEYBOARD_keebio_iris_rev2 -# define PRODUCT Drashna Hacked Iris Rev .2 +#if defined(KEYBOARD_keebio_iris_rev2) +# define PRODUCT Drashna Hacked Iris Rev 2 #elif defined(KEYBOARD_keebio_iris_rev3) -# define PRODUCT Drashna Hacked Iris Rev .3 +# define PRODUCT Drashna Hacked Iris Rev 3 +#elif defined(KEYBOARD_keebio_iris_rev4) +# define PRODUCT Drashna Hacked Iris Rev 4 #endif #define SHFT_LED1 6 diff --git a/keyboards/kyria/keymaps/drashna/config.h b/keyboards/kyria/keymaps/drashna/config.h index 83d6283f56d..e566b16d5c3 100644 --- a/keyboards/kyria/keymaps/drashna/config.h +++ b/keyboards/kyria/keymaps/drashna/config.h @@ -31,6 +31,7 @@ # define RGBLIGHT_HUE_STEP 8 # define RGBLIGHT_SAT_STEP 8 # define RGBLIGHT_VAL_STEP 8 +# define RGBLIGHT_SPLIT #endif // If you are using an Elite C rev3 on the slave side, uncomment the lines below: diff --git a/keyboards/kyria/keymaps/drashna/keymap.c b/keyboards/kyria/keymaps/drashna/keymap.c index bdb00e5967c..5604f1a6920 100644 --- a/keyboards/kyria/keymaps/drashna/keymap.c +++ b/keyboards/kyria/keymaps/drashna/keymap.c @@ -52,7 +52,7 @@ void add_keylog(uint16_t keycode); LAYOUT_wrapper( \ KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ - OS_LSFT, CTL_T(K21), K22, K23, K24, K25, KC_NO, KC_NO, KC_NO, KC_NO, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ + OS_LSFT, CTL_T(K21), K22, K23, K24, K25, KC_NO, KC_NO, MEH(KC_MINS), KC_NO, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ KC_MUTE, OS_LALT, KC_GRV, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI, UC(0x03A8), UC(0x2E2E) \ ) /* Re-pass though to allow templates to be used */ @@ -191,30 +191,14 @@ void render_keylogger_status(void) { void render_default_layer_state(void) { oled_write_P(PSTR("Layout: "), false); switch (get_highest_layer(default_layer_state)) { - case _QWERTY: - oled_write_ln_P(PSTR("Qwerty "), false); - break; - case _COLEMAK: - oled_write_ln_P(PSTR("Colemak"), false); - break; - case _DVORAK: - oled_write_ln_P(PSTR("Dvorak"), false); - break; - case _WORKMAN: - oled_write_ln_P(PSTR("Workman"), false); - break; - case _NORMAN: - oled_write_ln_P(PSTR("Norman"), false); - break; - case _MALTRON: - oled_write_ln_P(PSTR("Maltron"), false); - break; - case _EUCALYN: - oled_write_ln_P(PSTR("Eucalyn"), false); - break; - case _CARPLAX: - oled_write_ln_P(PSTR("Carplax"), false); - break; + case _QWERTY: oled_write_ln_P(PSTR("Qwerty"), false); break; + case _COLEMAK: oled_write_ln_P(PSTR("Colemak"), false); break; + case _DVORAK: oled_write_ln_P(PSTR("Dvorak"), false); break; + case _WORKMAN: oled_write_ln_P(PSTR("Workman"), false); break; + case _NORMAN: oled_write_ln_P(PSTR("Norman"), false); break; + case _MALTRON: oled_write_ln_P(PSTR("Maltron"), false); break; + case _EUCALYN: oled_write_ln_P(PSTR("Eucalyn"), false); break; + case _CARPLAX: oled_write_ln_P(PSTR("Carplax"), false); break; } } @@ -230,11 +214,11 @@ void render_layer_state(void) { void render_keylock_status(uint8_t led_usb_state) { oled_write_P(PSTR("Lock: "), false); - oled_write_P(PSTR("NUM"), led_usb_state & (1 << USB_LED_NUM_LOCK)); + oled_write_P(PSTR("NUML"), led_usb_state & (1 << USB_LED_NUM_LOCK)); oled_write_P(PSTR(" "), false); oled_write_P(PSTR("CAPS"), led_usb_state & (1 << USB_LED_CAPS_LOCK)); oled_write_P(PSTR(" "), false); - oled_write_ln_P(PSTR("SCL"), led_usb_state & (1 << USB_LED_SCROLL_LOCK)); + oled_write_ln_P(PSTR("SCLK"), led_usb_state & (1 << USB_LED_SCROLL_LOCK)); } void render_mod_status(uint8_t modifiers) { @@ -255,15 +239,21 @@ void render_bootmagic_status(void) { {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, }; oled_write_P(PSTR("Boot "), false); - oled_write_P(logo[0][0], !keymap_config.swap_lctl_lgui); - oled_write_P(logo[1][0], keymap_config.swap_lctl_lgui); + if (keymap_config.swap_lctl_lgui) { + oled_write_P(logo[1][0], false); + } else { + oled_write_P(logo[0][0], false); + } oled_write_P(PSTR(" "), false); oled_write_P(PSTR("NKRO"), keymap_config.nkro); oled_write_P(PSTR(" "), false); oled_write_ln_P(PSTR("GUI"), !keymap_config.no_gui); oled_write_P(PSTR("Magic "), false); - oled_write_P(logo[0][1], !keymap_config.swap_lctl_lgui); - oled_write_P(logo[1][1], keymap_config.swap_lctl_lgui); + if (keymap_config.swap_lctl_lgui) { + oled_write_P(logo[1][1], false); + } else { + oled_write_P(logo[0][1], false); + } oled_write_P(PSTR(" "), false); oled_write_P(PSTR("GRV"), keymap_config.swap_grave_esc); oled_write_P(PSTR(" "), false); diff --git a/keyboards/kyria/keymaps/drashna/rules.mk b/keyboards/kyria/keymaps/drashna/rules.mk index c1a37f5c597..e835340bbfe 100644 --- a/keyboards/kyria/keymaps/drashna/rules.mk +++ b/keyboards/kyria/keymaps/drashna/rules.mk @@ -1,7 +1,7 @@ OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays ENCODER_ENABLE = yes # ENables the use of one or more encoders RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -RGBLIGHT_STARTUP_ANIMATION = yes +RGBLIGHT_STARTUP_ANIMATION = no BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration MOUSEKEY_ENABLE = no # Mouse keys diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h index 0091ebcde83..ce25b0646bf 100644 --- a/layouts/community/ergodox/drashna/config.h +++ b/layouts/community/ergodox/drashna/config.h @@ -6,10 +6,13 @@ # define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 # define RGBLIGHT_EFFECT_SNAKE_LENGTH 3 +# ifdef RGB_MATRIX_ENABLE +# define RGBLIGHT_DISABLE_KEYCODES +# endif #endif // RGBLIGHT_ENABLE #undef PRODUCT -#define PRODUCT DrashnaDox - Hacked ErgoDox EZ Shine +#define PRODUCT DrashnaDox - Hacked ErgoDox EZ Hybrid Monstrosity #undef DEBOUNCE #define DEBOUNCE 30 @@ -17,3 +20,13 @@ #define TAPPING_TERM_PER_KEY #define ERGODOX_LED_30 + +#ifdef RGB_MATRIX_ENABLE +# undef RGB_MATRIX_LED_PROCESS_LIMIT +# undef RGB_MATRIX_LED_FLUSH_LIMIT +# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) +# define RGBLIGHT_LIMIT_VAL 175 +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS (RGBLIGHT_LIMIT_VAL + 25) +# undef RGBLIGHT_SLEEP +# endif +#endif diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 8308bfdaa19..69066a47cc4 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -280,7 +280,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_ADJUST] = LAYOUT_ergodox_pretty_wrapper( - KC_MAKE, _______, _______, _______, _______, _______, _______, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, + KC_MAKE, _______, _______, _______, _______, _______, UC_MOD, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, VRSN, _________________ADJUST_L1_________________, _______, _______, _______, _______, _______, _______, _______, EEP_RST, _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, RGB_IDL, _______, _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, TG(_MODS), @@ -382,31 +382,32 @@ void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); } void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } void rgb_matrix_indicators_user(void) { - if (userspace_config.rgb_layer_change && -# ifdef RGB_DISABLE_WHEN_USB_SUSPENDED - !g_suspend_state && -# endif + if (g_suspend_state || !rgb_matrix_config.enable) return; + + if (layer_state_is(_GAMEPAD)) { + rgb_matrix_set_color(32, 0x00, 0xFF, 0x00); // Q + rgb_matrix_set_color(31, 0x00, 0xFF, 0xFF); // W + rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); // E + rgb_matrix_set_color(29, 0xFF, 0x80, 0x00); // R + rgb_matrix_set_color(37, 0x00, 0xFF, 0xFF); // A + rgb_matrix_set_color(36, 0x00, 0xFF, 0xFF); // S + rgb_matrix_set_color(35, 0x00, 0xFF, 0xFF); // D + rgb_matrix_set_color(34, 0x7A, 0x00, 0xFF); // F + + rgb_matrix_set_color(userspace_config.swapped_numbers ? 27 : 26, 0xFF, 0xFF, 0xFF); // 1 + rgb_matrix_set_color(userspace_config.swapped_numbers ? 26 : 27, 0x00, 0xFF, 0x00); // 2 + rgb_matrix_set_color(25, 0x7A, 0x00, 0xFF); // 3 + } + # if defined(RGBLIGHT_ENABLE) - (!rgblight_config.enable && rgb_matrix_config.enable) + if (!userspace_config.rgb_layer_change) # else - rgb_matrix_config.enable + if (userspace_config.rgb_layer_change) # endif - ) { + { switch (get_highest_layer(layer_state)) { case _GAMEPAD: rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); - rgb_matrix_set_color(32, 0x00, 0xFF, 0x00); // Q - rgb_matrix_set_color(31, 0x00, 0xFF, 0xFF); // W - rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); // E - rgb_matrix_set_color(29, 0xFF, 0x80, 0x00); // R - rgb_matrix_set_color(37, 0x00, 0xFF, 0xFF); // A - rgb_matrix_set_color(36, 0x00, 0xFF, 0xFF); // S - rgb_matrix_set_color(35, 0x00, 0xFF, 0xFF); // D - rgb_matrix_set_color(34, 0x7A, 0x00, 0xFF); // F - - rgb_matrix_set_color(userspace_config.swapped_numbers ? 27 : 26, 0xFF, 0xFF, 0xFF); // 1 - rgb_matrix_set_color(userspace_config.swapped_numbers ? 26 : 27, 0x00, 0xFF, 0x00); // 2 - rgb_matrix_set_color(25, 0x7A, 0x00, 0xFF); // 3 break; case _DIABLO: rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER); diff --git a/layouts/community/ergodox/drashna/rules.mk b/layouts/community/ergodox/drashna/rules.mk index 3aee59df6cb..78a3d15840a 100644 --- a/layouts/community/ergodox/drashna/rules.mk +++ b/layouts/community/ergodox/drashna/rules.mk @@ -1,19 +1,20 @@ -TAP_DANCE_ENABLE = yes +BOOTMAGIC_ENABLE = lite +TAP_DANCE_ENABLE = no SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend COMMAND_ENABLE = no # Commands for debug and configuration -SPACE_CADET_ENABLE = no -ifeq ($(strip $(KEYBOARD)), ergodox_ez) - RGBLIGHT_ENABLE = yes - RGB_MATRIX_ENABLE = no -endif CONSOLE_ENABLE = no -BOOTMAGIC_ENABLE = yes +SPACE_CADET_ENABLE = no + +ifeq ($(strip $(KEYBOARD)), ergodox_ez) + RGBLIGHT_ENABLE = yes + RGB_MATRIX_ENABLE = yes + RGBLIGHT_TWINKLE = no + INDICATOR_LIGHTS = no + RGBLIGHT_STARTUP_ANIMATION = no +endif UNICODE_ENABLE = yes UNICDOEMAP_ENABLE = no -RGBLIGHT_TWINKLE = no -INDICATOR_LIGHTS = no -RGBLIGHT_STARTUP_ANIMATION = yes DEBOUNCE_TYPE = eager_pr diff --git a/layouts/community/ergodox/drashna_glow/config.h b/layouts/community/ergodox/drashna_glow/config.h deleted file mode 100644 index 6431cb4ff8d..00000000000 --- a/layouts/community/ergodox/drashna_glow/config.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "../drashna/config.h" - -#undef PRODUCT -#define PRODUCT DrashnaDox - Hacked ErgoDox EZ Glow - -#undef RGB_MATRIX_LED_PROCESS_LIMIT -#undef RGB_MATRIX_LED_FLUSH_LIMIT diff --git a/layouts/community/ergodox/drashna_glow/keymap.c b/layouts/community/ergodox/drashna_glow/keymap.c deleted file mode 100644 index 7d4bdbec50e..00000000000 --- a/layouts/community/ergodox/drashna_glow/keymap.c +++ /dev/null @@ -1,2 +0,0 @@ -/* placeholder file */ -#include QMK_KEYBOARD_H diff --git a/layouts/community/ergodox/drashna_glow/rules.mk b/layouts/community/ergodox/drashna_glow/rules.mk deleted file mode 100644 index 45addc7c224..00000000000 --- a/layouts/community/ergodox/drashna_glow/rules.mk +++ /dev/null @@ -1,13 +0,0 @@ -USER_NAME := drashna - -CORRECTED_LAYOUT := $(LAYOUTS_REPO)/$(LAYOUT)/drashna - -SRC += $(CORRECTED_LAYOUT)/keymap.c - --include $(CORRECTED_LAYOUT)/rules.mk - -ifeq ($(strip $(KEYBOARD)), ergodox_ez) - RGBLIGHT_ENABLE = no - RGB_MATRIX_ENABLE = yes -# TAP_DANCE_ENABLE = no -endif diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index c3899cd036c..d2957d8fdca 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -224,16 +224,14 @@ void rgb_matrix_indicators_user(void) { is_ez = true; # endif - if (userspace_config.rgb_layer_change && -# ifdef RGB_DISABLE_WHEN_USB_SUSPENDED - !g_suspend_state && -# endif + if (g_suspend_state || !rgb_matrix_config.enable) return; + # if defined(RGBLIGHT_ENABLE) - (!rgblight_config.enable && rgb_matrix_config.enable) + if (!userspace_config.rgb_layer_change) # else - rgb_matrix_config.enable + if (userspace_config.rgb_layer_change) # endif - ) { + { switch (get_highest_layer(layer_state)) { case _GAMEPAD: rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); @@ -297,6 +295,7 @@ void rgb_matrix_indicators_user(void) { rgb_matrix_set_color(is_ez ? 41 : 42, 0xD9, 0xA5, 0x21); break; } + if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { if (!layer_state_cmp(layer_state, _ADJUST)) { rgb_matrix_set_color(24, 0x00, 0xFF, 0x00); diff --git a/layouts/community/ortho_4x12/drashna/rules.mk b/layouts/community/ortho_4x12/drashna/rules.mk index 38d0d451767..e4fe905341a 100644 --- a/layouts/community/ortho_4x12/drashna/rules.mk +++ b/layouts/community/ortho_4x12/drashna/rules.mk @@ -2,7 +2,6 @@ BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = no # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) TAP_DANCE_ENABLE = no -AUDIO_ENABLE = yes SPACE_CADET_ENABLE = no NKRO_ENABLE = yes @@ -11,20 +10,22 @@ ifneq ($(strip $(KEYBOARD)), planck/rev6) COMMAND_ENABLE = no ifeq ($(strip $(LAYOUT_HAS_RGB)), yes) RGBLIGHT_ENABLE = yes - endif - INDICATOR_LIGHTS = yes - RGBLIGHT_TWINKLE = yes - RGBLIGHT_STARTUP_ANIMATION = yes + INDICATOR_LIGHTS = yes + RGBLIGHT_TWINKLE = yes + RGBLIGHT_STARTUP_ANIMATION = yes + endif else CONSOLE_ENABLE = yes COMMAND_ENABLE = yes - RGBLIGHT_ENABLE = no - RGB_MATRIX_ENABLE = WS2812 + RGBLIGHT_ENABLE = yes + RGB_MATRIX_ENABLE = no + AUDIO_ENABLE = yes endif ifeq ($(strip $(KEYBOARD)), planck/light) RGB_MATRIX_ENABLE = yes - RGBLIGHT_ENABLE = no - RGBLIGHT_STARTUP_ANIMATION = no + RGBLIGHT_ENABLE = yes + RGBLIGHT_STARTUP_ANIMATION = yes + AUDIO_ENABLE = yes # HAPTIC_ENABLE += SOLENOID endif ifeq ($(strip $(KEYBOARD)), planck/ez) @@ -37,4 +38,5 @@ ifeq ($(strip $(KEYBOARD)), planck/ez) RGBLIGHT_STARTUP_ANIMATION = yes CONSOLE_ENABLE = yes COMMAND_ENABLE = yes + AUDIO_ENABLE = yes endif diff --git a/layouts/community/ortho_5x12/drashna/rules.mk b/layouts/community/ortho_5x12/drashna/rules.mk index cae4b27bab2..b5d55a681d8 100644 --- a/layouts/community/ortho_5x12/drashna/rules.mk +++ b/layouts/community/ortho_5x12/drashna/rules.mk @@ -4,7 +4,6 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = no # Commands for debug and configuration TAP_DANCE_ENABLE = no -AUDIO_ENABLE = yes NKRO_ENABLE = yes ifeq ($(strip $(KEYBOARD)), fractal) diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 71779a6215f..1a4ee9b4146 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -121,9 +121,13 @@ void shutdown_user(void) { rgblight_setrgb_red(); #endif // RGBLIGHT_ENABLE #ifdef RGB_MATRIX_ENABLE +# ifdef __AVR__ rgb_matrix_set_color_all(0xFF, 0x00, 0x00); rgb_matrix_update_pwm_buffers(); - +# else + rgb_matrix_sethsv_noeeprom(0, 255, 255); + rgb_matrix_mode_noeeprom(1); +# endif #endif // RGB_MATRIX_ENABLE shutdown_keymap(); } diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index 2f79ad11cc1..af3ee9cf054 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) { copy_paste_timer = timer_read(); } else { if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy - register_code(KC_LCTL); - tap_code(KC_C); - unregister_code(KC_LCTL); + tap_code16(LCTL(KC_C)); } else { // Tap, paste - register_code(KC_LCTL); - tap_code(KC_V); - unregister_code(KC_LCTL); + tap_code16(LCTL(KC_V)); } } break; diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index 52ec61c22dc..e7247f754fa 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) { /* Handler for fading/twinkling effect */ void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive bool litup = false; + for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) { if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 10) { rgblight_fadeout *light = &lights[light_index]; @@ -179,6 +180,7 @@ void start_rgb_light(void) { uint8_t indices_count = 0; uint8_t min_life = 0xFF; uint8_t min_life_index = -1; + for (uint8_t index = 0; index < RGBLED_NUM; ++index) { if (rgblight_twinkle_is_led_used(index)) { continue; @@ -248,7 +250,14 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); eeconfig_update_user(userspace_config.raw); if (userspace_config.rgb_layer_change) { +# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) + rgblight_enable_noeeprom(); +# endif layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) +# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) + } else { + rgblight_disable_noeeprom(); +# endif } } #endif // RGBLIGHT_ENABLE @@ -265,28 +274,182 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { } #endif break; +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) + case RGB_TOG: + // Split keyboards need to trigger on key-up for edge-case issue +# ifndef SPLIT_KEYBOARD + if (record->event.pressed) { +# else + if (!record->event.pressed) { +# endif +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_toggle(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_toggle(); +# endif + } + return false; + break; case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions if (record->event.pressed) { - bool is_eeprom_updated = false; -#ifdef RGBLIGHT_ENABLE + bool is_eeprom_updated; +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) // This disables layer indication, as it's assumed that if you're changing this ... you want that disabled if (userspace_config.rgb_layer_change) { userspace_config.rgb_layer_change = false; dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); is_eeprom_updated = true; } -#endif -#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) +# endif +# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) if (userspace_config.rgb_matrix_idle_anim) { userspace_config.rgb_matrix_idle_anim = false; dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim); is_eeprom_updated = true; } -#endif +# endif if (is_eeprom_updated) { eeconfig_update_user(userspace_config.raw); } } + +# if defined(RGBLIGHT_DISABLE_KEYCODES) || defined(RGB_MATRIX_DISABLE_KEYCODES) + if (keycode == RGB_MODE_FORWARD && record->event.pressed) { + uint8_t shifted = get_mods() & (MOD_MASK_SHIFT); + if (shifted) { +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_step_reverse(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_step_reverse(); +# endif + } else { +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_step(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_step(); +# endif + } + } else if (keycode == RGB_MODE_REVERSE && record->event.pressed) { + uint8_t shifted = get_mods() & (MOD_MASK_SHIFT); + if (shifted) { +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_step(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_step(); +# endif + } else { +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_step_reverse(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_step_reverse(); +# endif + } + } else if (keycode == RGB_HUI) { +# ifndef SPLIT_KEYBOARD + if (record->event.pressed) { +# else + if (!record->event.pressed) { +# endif +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_increase_hue(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_increase_hue(); +# endif + } + } else if (keycode == RGB_HUD) { +# ifndef SPLIT_KEYBOARD + if (record->event.pressed) { +# else + if (!record->event.pressed) { +# endif +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_decrease_hue(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_decrease_hue(); +# endif + } + } else if (keycode == RGB_SAI) { +# ifndef SPLIT_KEYBOARD + if (record->event.pressed) { +# else + if (!record->event.pressed) { +# endif +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_increase_sat(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_increase_sat(); +# endif + } + } else if (keycode == RGB_SAD) { +# ifndef SPLIT_KEYBOARD + if (record->event.pressed) { +# else + if (!record->event.pressed) { +# endif +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_decrease_sat(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_decrease_sat(); +# endif + } + } else if (keycode == RGB_VAI) { +# ifndef SPLIT_KEYBOARD + if (record->event.pressed) { +# else + if (!record->event.pressed) { +# endif +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_increase_val(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_increase_val(); +# endif + } + } else if (keycode == RGB_VAD) { +# ifndef SPLIT_KEYBOARD + if (record->event.pressed) { +# else + if (!record->event.pressed) { +# endif +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_decrease_val(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_decrease_val(); +# endif + } + } else if (keycode == RGB_SPI) { + if (record->event.pressed) { +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_increase_speed(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_increase_speed(); +# endif + } + } else if (keycode == RGB_SPD) { + if (record->event.pressed) { +# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) + rgblight_decrease_speed(); +# endif +# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) + rgb_matrix_decrease_speed(); +# endif + } + } + return false; +# endif +#endif + break; } return true; diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 882857fc868..4d55da803f9 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -1,7 +1,9 @@ SRC += drashna.c \ process_records.c -LTO_ENABLE = yes +ifneq ($(PLATFORM),CHIBIOS) + LTO_ENABLE = yes +endif SPACE_CADET_ENABLE = no ifneq ($(strip $(NO_SECRETS)), yes) @@ -58,4 +60,4 @@ endif # this should be handled per keyboard, but until that happens ... ifeq ($(strip $(PROTOCOL)), VUSB) NKRO_ENABLE = no -endif \ No newline at end of file +endif