diff options
author | Drashna Jaelre <drashna@live.com> | 2019-08-21 17:19:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-21 17:19:07 -0700 |
commit | 94efa18c28c8c0e08526c9665a8f0d6a4e7d3e96 (patch) | |
tree | f45a54ddfa7a8ec4539c78bbadeb1d3960727f2e /keyboards/planck/ez/ez.c | |
parent | 1c5b0cbbeb049b1ce3fb2da6a81fbf83dd9a3ea7 (diff) | |
download | qmk_firmware-94efa18c28c8c0e08526c9665a8f0d6a4e7d3e96.tar.gz |
[Keyboard] Updates to ZSA boards (#6513)
* Update Layer functions to use layer_state_t in ZSA Boards
* Update Music Mask for ZSA boards
Fixes an issue with the board getting stuck on Adjust layer when activating music mode
* Add Support for SMART LED Toggle to Planck EZ
* Add support for SMART LED toggle in Ergodox EZ
* Ifdef swiss cheeze for Oryx Configurator
* Documentation and updates
* Add Oryx Keymap
* Add option to configure the layers for the Layer Indicator
* Update keymap with better examples
* Make sure eeprom is initialized before reading from it
* Force flush of LED matrix when suspending board
This fixes an issue where the LEDs don't fully clear sometimes when the host system goes to sleep
* Enable RGB Sleeping by default
* Add clarification about planck ez led layer config
Diffstat (limited to 'keyboards/planck/ez/ez.c')
-rw-r--r-- | keyboards/planck/ez/ez.c | 94 |
1 files changed, 86 insertions, 8 deletions
diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c index 8734042a4..8369ce50c 100644 --- a/keyboards/planck/ez/ez.c +++ b/keyboards/planck/ez/ez.c @@ -16,8 +16,8 @@ #include "ez.h" #include "ch.h" #include "hal.h" - keyboard_config_t keyboard_config; +keyboard_config_t keyboard_config; #ifdef RGB_MATRIX_ENABLE const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { @@ -106,6 +106,7 @@ led_config_t g_led_config = { { } }; void suspend_power_down_kb(void) { + rgb_matrix_set_color_all(0, 0, 0); rgb_matrix_set_suspend_state(true); suspend_power_down_user(); } @@ -207,33 +208,65 @@ void led_initialize_hardware(void) { } void keyboard_pre_init_kb(void) { + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } // read kb settings from eeprom keyboard_config.raw = eeconfig_read_kb(); - - // initialize settings for front LEDs +#if defined(RGB_MATRIX_ENABLE) && defined(ORYX_CONFIGURATOR) + if (keyboard_config.rgb_matrix_enable) { + rgb_matrix_set_flags(LED_FLAG_ALL); + } else { + rgb_matrix_set_flags(LED_FLAG_NONE); + } +#endif led_initialize_hardware(); + keyboard_pre_init_user(); +} + +#if defined(RGB_MATRIX_ENABLE) && defined(ORYX_CONFIGURATOR) +void keyboard_post_init_kb(void) { + rgb_matrix_enable_noeeprom(); + keyboard_post_init_user(); } +#endif void eeconfig_init_kb(void) { // EEPROM is getting reset! keyboard_config.raw = 0; + keyboard_config.rgb_matrix_enable = true; keyboard_config.led_level = 4; eeconfig_update_kb(keyboard_config.raw); eeconfig_init_user(); } + +#ifdef ORYX_CONFIGURATOR + +#ifndef PLANCK_EZ_USER_LEDS + +#ifndef PLANCK_EZ_LED_LOWER +# define PLANCK_EZ_LED_LOWER 3 +#endif +#ifndef PLANCK_EZ_LED_RAISE +# define PLANCK_EZ_LED_RAISE 4 +#endif +#ifndef PLANCK_EZ_LED_ADJUST +# define PLANCK_EZ_LED_ADJUST 6 +#endif + layer_state_t layer_state_set_kb(layer_state_t state) { planck_ez_left_led_off(); planck_ez_right_led_off(); state = layer_state_set_user(state); uint8_t layer = biton32(state); switch (layer) { - case 3: + case PLANCK_EZ_LED_LOWER: planck_ez_left_led_on(); break; - case 4: + case PLANCK_EZ_LED_RAISE: planck_ez_right_led_on(); break; - case 6: + case PLANCK_EZ_LED_ADJUST: planck_ez_right_led_on(); planck_ez_left_led_on(); break; @@ -242,7 +275,7 @@ layer_state_t layer_state_set_kb(layer_state_t state) { } return state; } - +#endif bool process_record_kb(uint16_t keycode, keyrecord_t *record) { switch (keycode) { @@ -258,6 +291,51 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { layer_state_set_kb(layer_state); } break; +#ifdef RGB_MATRIX_ENABLE + case TOGGLE_LAYER_COLOR: + if (record->event.pressed) { + keyboard_config.disable_layer_led ^= 1; + if (keyboard_config.disable_layer_led) + rgb_matrix_set_color_all(0, 0, 0); + eeconfig_update_kb(keyboard_config.raw); + } + break; + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + keyboard_config.rgb_matrix_enable = false; + rgb_matrix_set_color_all(0, 0, 0); + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + keyboard_config.rgb_matrix_enable = true; + } + break; + } + eeconfig_update_kb(keyboard_config.raw); + } + return false; +#endif } - return true; + return process_record_user(keycode, record); } +#endif + +#ifdef AUDIO_ENABLE +bool music_mask_kb(uint16_t keycode) { + switch (keycode) { + case QK_LAYER_TAP ... QK_ONE_SHOT_LAYER_MAX: + case QK_LAYER_TAP_TOGGLE ... QK_LAYER_MOD_MAX: + case QK_MOD_TAP ... QK_MOD_TAP_MAX: + case AU_ON ... MUV_DE: + case RESET: + case EEP_RST: + return false; + default: + return music_mask_user(keycode); + } +} +#endif |