Skip to content

Commit

Permalink
Update Drashna user space code to support keyboard_init functions (qm…
Browse files Browse the repository at this point in the history
…k#5138)

* Update code to support keyboard_init functions

* Get Minor tweaks
  • Loading branch information
drashna authored and mechmerlin committed Feb 17, 2019
1 parent c8577a9 commit cbb7e91
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 23 deletions.
1 change: 1 addition & 0 deletions layouts/community/ergodox/drashna_glow/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion users/drashna/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 11 additions & 3 deletions users/drashna/drashna.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down Expand Up @@ -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;
}

Expand Down
38 changes: 20 additions & 18 deletions users/drashna/rgb_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -371,3 +372,4 @@ uint32_t default_layer_state_set_rgb(uint32_t state) {
#endif // RGBLIGHT_ENABLE
return state;
}
#endif
2 changes: 1 addition & 1 deletion users/drashna/rgb_stuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cbb7e91

Please sign in to comment.