Skip to content

Commit

Permalink
[Keymap] Cleanup of Drashna code (qmk#7800)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
drashna authored and noroadsleft committed Jan 6, 2020
1 parent b3b115b commit 00d3061
Show file tree
Hide file tree
Showing 19 changed files with 276 additions and 121 deletions.
2 changes: 2 additions & 0 deletions keyboards/c39/keymaps/drashna/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@

#define RGB_DI_PIN B10
#define RGBLED_NUM 15

#define SOLENOID_PIN B11
2 changes: 2 additions & 0 deletions keyboards/c39/keymaps/drashna/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 9 additions & 5 deletions keyboards/keebio/iris/keymaps/drashna/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,26 @@ along with this program. If not, see <http:https://www.gnu.org/licenses/>.
#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
# define QMK_SPEAKER C6
#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
Expand Down
1 change: 1 addition & 0 deletions keyboards/kyria/keymaps/drashna/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
52 changes: 21 additions & 31 deletions keyboards/kyria/keymaps/drashna/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}
}

Expand All @@ -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) {
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion keyboards/kyria/keymaps/drashna/rules.mk
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 14 additions & 1 deletion layouts/community/ergodox/drashna/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,27 @@

# 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

#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
41 changes: 21 additions & 20 deletions layouts/community/ergodox/drashna/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand Down
17 changes: 9 additions & 8 deletions layouts/community/ergodox/drashna/rules.mk
Original file line number Diff line number Diff line change
@@ -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
CONSOLE_ENABLE = no
SPACE_CADET_ENABLE = no

ifeq ($(strip $(KEYBOARD)), ergodox_ez)
RGBLIGHT_ENABLE = yes
RGB_MATRIX_ENABLE = no
RGBLIGHT_ENABLE = yes
RGB_MATRIX_ENABLE = yes
RGBLIGHT_TWINKLE = no
INDICATOR_LIGHTS = no
RGBLIGHT_STARTUP_ANIMATION = no
endif
CONSOLE_ENABLE = no
BOOTMAGIC_ENABLE = yes

UNICODE_ENABLE = yes
UNICDOEMAP_ENABLE = no

RGBLIGHT_TWINKLE = no
INDICATOR_LIGHTS = no
RGBLIGHT_STARTUP_ANIMATION = yes

DEBOUNCE_TYPE = eager_pr
9 changes: 0 additions & 9 deletions layouts/community/ergodox/drashna_glow/config.h

This file was deleted.

2 changes: 0 additions & 2 deletions layouts/community/ergodox/drashna_glow/keymap.c

This file was deleted.

13 changes: 0 additions & 13 deletions layouts/community/ergodox/drashna_glow/rules.mk

This file was deleted.

13 changes: 6 additions & 7 deletions layouts/community/ortho_4x12/drashna/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
20 changes: 11 additions & 9 deletions layouts/community/ortho_4x12/drashna/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand All @@ -37,4 +38,5 @@ ifeq ($(strip $(KEYBOARD)), planck/ez)
RGBLIGHT_STARTUP_ANIMATION = yes
CONSOLE_ENABLE = yes
COMMAND_ENABLE = yes
AUDIO_ENABLE = yes
endif
1 change: 0 additions & 1 deletion layouts/community/ortho_5x12/drashna/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion users/drashna/drashna.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Loading

0 comments on commit 00d3061

Please sign in to comment.