1
0
Fork 0
forked from forks/qmk_firmware

Update Drashna user space code to support keyboard_init functions (#5138)

* Update code to support keyboard_init functions

* Get Minor tweaks
This commit is contained in:
Drashna Jaelre 2019-02-16 18:28:04 -08:00 committed by MechMerlin
parent c8577a9a73
commit cbb7e91851
5 changed files with 34 additions and 23 deletions

View file

@ -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

View file

@ -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

View file

@ -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;
}

View file

@ -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

View file

@ -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);