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

* Update code to support keyboard_init functions

* Get Minor tweaks
pull/5152/head
Drashna Jaelre 6 years ago committed by MechMerlin
parent c8577a9a73
commit cbb7e91851

@ -6,4 +6,5 @@ SRC += ../drashna/keymap.c
ifneq (,$(findstring ergodox_ez,$(KEYBOARD))) ifneq (,$(findstring ergodox_ez,$(KEYBOARD)))
RGBLIGHT_ENABLE = no RGBLIGHT_ENABLE = no
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
TAP_DANCE_ENABLE = no
endif endif

@ -55,7 +55,7 @@
// and when this option isn't enabled, z rapidly followed by x // and when this option isn't enabled, z rapidly followed by x
// actually sends Ctrl-x. That's bad.) // actually sends Ctrl-x. That's bad.)
#define IGNORE_MOD_TAP_INTERRUPT #define IGNORE_MOD_TAP_INTERRUPT
// #define PERMISSIVE_HOLD #undef PERMISSIVE_HOLD
//#define TAPPING_FORCE_HOLD //#define TAPPING_FORCE_HOLD
//#define RETRO_TAPPING //#define RETRO_TAPPING

@ -122,11 +122,17 @@ void matrix_init_user(void) {
get_unicode_input_mode(); get_unicode_input_mode();
#endif //UNICODE_ENABLE #endif //UNICODE_ENABLE
matrix_init_keymap(); 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)) __attribute__ ((weak))
void shutdown_keymap(void) {} 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 // Runs state check and changes underglow color and animation
uint32_t default_layer_state_set_user(uint32_t state) { uint32_t default_layer_state_set_user(uint32_t state) {
state = default_layer_state_set_keymap(state); state = default_layer_state_set_keymap(state);
#if 0
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
state = default_layer_state_set_rgb(state); state = default_layer_state_set_rgb(state);
#endif // RGBLIGHT_ENABLE #endif // RGBLIGHT_ENABLE
#endif
return state; return state;
} }

@ -243,24 +243,24 @@ 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 #ifdef RGBLIGHT_ENABLE
// if (userspace_config.rgb_layer_change) { if (userspace_config.rgb_layer_change) {
// rgblight_enable_noeeprom(); rgblight_enable_noeeprom();
// switch (biton32(eeconfig_read_default_layer())) { switch (biton32(eeconfig_read_default_layer())) {
// case _COLEMAK: case _COLEMAK:
// rgblight_sethsv_noeeprom_magenta(); break; rgblight_sethsv_noeeprom_magenta(); break;
// case _DVORAK: case _DVORAK:
// rgblight_sethsv_noeeprom_springgreen(); break; rgblight_sethsv_noeeprom_springgreen(); break;
// case _WORKMAN: case _WORKMAN:
// rgblight_sethsv_noeeprom_goldenrod(); break; rgblight_sethsv_noeeprom_goldenrod(); break;
// default: default:
// rgblight_sethsv_noeeprom_cyan(); break; rgblight_sethsv_noeeprom_cyan(); break;
// } }
// rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
// } }
// #endif #endif
} }
void matrix_scan_rgb(void) { void matrix_scan_rgb(void) {
@ -336,6 +336,7 @@ uint32_t layer_state_set_rgb(uint32_t state) {
return state; return state;
} }
#if 0
uint32_t default_layer_state_set_rgb(uint32_t state) { uint32_t default_layer_state_set_rgb(uint32_t state) {
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
if (userspace_config.rgb_layer_change) { if (userspace_config.rgb_layer_change) {
@ -371,3 +372,4 @@ uint32_t default_layer_state_set_rgb(uint32_t state) {
#endif // RGBLIGHT_ENABLE #endif // RGBLIGHT_ENABLE
return state; return state;
} }
#endif

@ -13,7 +13,7 @@ typedef struct {
bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record); bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record);
void scan_rgblight_fadeout(void); void scan_rgblight_fadeout(void);
void matrix_init_rgb(void); void keyboard_post_init_rgb(void);
void matrix_scan_rgb(void); void matrix_scan_rgb(void);
uint32_t layer_state_set_rgb(uint32_t state); uint32_t layer_state_set_rgb(uint32_t state);
uint32_t default_layer_state_set_rgb(uint32_t state); uint32_t default_layer_state_set_rgb(uint32_t state);

Loading…
Cancel
Save