From cbb7e91851fea0174a5e950c22c35a4384eac8e7 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sat, 16 Feb 2019 18:28:04 -0800 Subject: [PATCH] Update Drashna user space code to support keyboard_init functions (#5138) * Update code to support keyboard_init functions * Get Minor tweaks --- .../community/ergodox/drashna_glow/rules.mk | 1 + users/drashna/config.h | 2 +- users/drashna/drashna.c | 14 +++++-- users/drashna/rgb_stuff.c | 38 ++++++++++--------- users/drashna/rgb_stuff.h | 2 +- 5 files changed, 34 insertions(+), 23 deletions(-) diff --git a/layouts/community/ergodox/drashna_glow/rules.mk b/layouts/community/ergodox/drashna_glow/rules.mk index e152fa01f0d..5cb47dae4e3 100644 --- a/layouts/community/ergodox/drashna_glow/rules.mk +++ b/layouts/community/ergodox/drashna_glow/rules.mk @@ -6,4 +6,5 @@ SRC += ../drashna/keymap.c ifneq (,$(findstring ergodox_ez,$(KEYBOARD))) RGBLIGHT_ENABLE = no RGB_MATRIX_ENABLE = yes + TAP_DANCE_ENABLE = no endif diff --git a/users/drashna/config.h b/users/drashna/config.h index 20e58fd0bb5..2e125d1e4ef 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -55,7 +55,7 @@ // and when this option isn't enabled, z rapidly followed by x // actually sends Ctrl-x. That's bad.) #define IGNORE_MOD_TAP_INTERRUPT -// #define PERMISSIVE_HOLD +#undef PERMISSIVE_HOLD //#define TAPPING_FORCE_HOLD //#define RETRO_TAPPING diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 22282483798..8019f26676f 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -122,11 +122,17 @@ void matrix_init_user(void) { get_unicode_input_mode(); #endif //UNICODE_ENABLE matrix_init_keymap(); - #ifdef RGBLIGHT_ENABLE - matrix_init_rgb(); - #endif //RGBLIGHT_ENABLE } +__attribute__((weak)) +void keyboard_post_init_keymap(void){ } + +void keyboard_post_init_user(void){ +#ifdef RGBLIGHT_ENABLE + keyboard_post_init_rgb(); +#endif + keyboard_post_init_keymap(); +} __attribute__ ((weak)) void shutdown_keymap(void) {} @@ -208,9 +214,11 @@ uint32_t default_layer_state_set_keymap (uint32_t state) { // Runs state check and changes underglow color and animation uint32_t default_layer_state_set_user(uint32_t state) { state = default_layer_state_set_keymap(state); +#if 0 #ifdef RGBLIGHT_ENABLE state = default_layer_state_set_rgb(state); #endif // RGBLIGHT_ENABLE +#endif return state; } diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index 37076ce9904..7eaa7e94918 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -243,25 +243,25 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { - void matrix_init_rgb(void) { +void keyboard_post_init_rgb(void) { -// #ifdef RGBLIGHT_ENABLE -// if (userspace_config.rgb_layer_change) { -// rgblight_enable_noeeprom(); -// switch (biton32(eeconfig_read_default_layer())) { -// case _COLEMAK: -// rgblight_sethsv_noeeprom_magenta(); break; -// case _DVORAK: -// rgblight_sethsv_noeeprom_springgreen(); break; -// case _WORKMAN: -// rgblight_sethsv_noeeprom_goldenrod(); break; -// default: -// rgblight_sethsv_noeeprom_cyan(); break; -// } -// rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); -// } -// #endif - } +#ifdef RGBLIGHT_ENABLE + if (userspace_config.rgb_layer_change) { + rgblight_enable_noeeprom(); + switch (biton32(eeconfig_read_default_layer())) { + case _COLEMAK: + rgblight_sethsv_noeeprom_magenta(); break; + case _DVORAK: + rgblight_sethsv_noeeprom_springgreen(); break; + case _WORKMAN: + rgblight_sethsv_noeeprom_goldenrod(); break; + default: + rgblight_sethsv_noeeprom_cyan(); break; + } + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + } +#endif +} void matrix_scan_rgb(void) { #ifdef RGBLIGHT_TWINKLE @@ -336,6 +336,7 @@ uint32_t layer_state_set_rgb(uint32_t state) { return state; } +#if 0 uint32_t default_layer_state_set_rgb(uint32_t state) { #ifdef RGBLIGHT_ENABLE if (userspace_config.rgb_layer_change) { @@ -371,3 +372,4 @@ uint32_t default_layer_state_set_rgb(uint32_t state) { #endif // RGBLIGHT_ENABLE return state; } +#endif diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h index 065bda9f9eb..886f20ffcca 100644 --- a/users/drashna/rgb_stuff.h +++ b/users/drashna/rgb_stuff.h @@ -13,7 +13,7 @@ typedef struct { bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record); void scan_rgblight_fadeout(void); -void matrix_init_rgb(void); +void keyboard_post_init_rgb(void); void matrix_scan_rgb(void); uint32_t layer_state_set_rgb(uint32_t state); uint32_t default_layer_state_set_rgb(uint32_t state);