From 3024a46dd9297fa96da53c8ab96b960b7ef1918a Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 16 Jun 2022 12:32:42 -0700 Subject: [PATCH] Added RGBLight configs --- betalupi_ergodox.c | 6 ++ config.h | 3 + keymaps/default/keymap.c | 163 +++++++++++++++++++++++++++------------ 3 files changed, 122 insertions(+), 50 deletions(-) diff --git a/betalupi_ergodox.c b/betalupi_ergodox.c index 21f3b43..367f383 100644 --- a/betalupi_ergodox.c +++ b/betalupi_ergodox.c @@ -238,6 +238,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { led_config_t g_led_config = { { + // Key matrix to LED index { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, { 28, 33, 38, 43, 47, NO_LED }, { 27, 32, 37, 42, 46, NO_LED }, @@ -253,6 +254,7 @@ led_config_t g_led_config = { { { 4, 9, 14, 19, 23, NO_LED }, { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED } }, { + // LED index to physical position { 137, 0 }, { 154, 0 }, { 172, 0 }, { 189, 0 }, { 206, 0 }, { 137, 12 }, { 154, 12 }, { 172, 12 }, { 189, 12 }, { 206, 12 }, { 137, 25 }, { 154, 25 }, { 172, 25 }, { 189, 25 }, { 206, 25 }, { 137, 38 }, { 154, 38 }, { 172, 38 }, @@ -262,6 +264,7 @@ led_config_t g_led_config = { { { 51, 25 }, { 34, 25 }, { 17, 25 }, { 86, 38 }, { 68, 38 }, { 51, 38 }, { 34, 38 }, { 17, 38 }, { 68, 51 }, { 51, 51 }, { 34, 51 }, { 17, 51 } }, { + // LED index to flag 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, @@ -276,14 +279,17 @@ led_config_t g_led_config = { { void keyboard_post_init_kb(void) { // Start with matrix enabled + // (We enable RGB effects and layer colors seperately) #ifdef RGB_MATRIX_ENABLE rgb_matrix_enable_noeeprom(); #endif // Start with backlight disabled #ifdef RGBLIGHT_ENABLE + #ifdef RGBLIGHT_OFF_AT_START rgblight_disable_noeeprom(); #endif + #endif keyboard_post_init_user(); } diff --git a/config.h b/config.h index f06a287..ec1463a 100644 --- a/config.h +++ b/config.h @@ -81,6 +81,9 @@ // Max brightness #define RGBLIGHT_LIMIT_VAL 200 +//#define RGBLIGHT_OFF_AT_START +//#define RGBLIGHT_NO_EEPROM + // Prevents RGB keycodes from affecting underglow. // This allows us to control RGBMatrix and RGBLight seperately. #define RGBLIGHT_DISABLE_KEYCODES diff --git a/keymaps/default/keymap.c b/keymaps/default/keymap.c index 959493b..cf1682b 100644 --- a/keymaps/default/keymap.c +++ b/keymaps/default/keymap.c @@ -221,65 +221,128 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; // Custom RGBLIGHT macros - case LIGHT_TOG: - if (record->event.pressed) { - rgblight_toggle_noeeprom(); - } - break; - case LIGHT_MOD: - if (record->event.pressed) { - rgblight_step_noeeprom(); - } - break; + #ifdef RGBLIGHT_NO_EEPROM + case LIGHT_TOG: + if (record->event.pressed) { + rgblight_toggle_noeeprom(); + } + break; - case LIGHT_HUI: - if (record->event.pressed) { - rgblight_increase_hue_noeeprom(); - } - break; + case LIGHT_MOD: + if (record->event.pressed) { + rgblight_step_noeeprom(); + } + break; - case LIGHT_HUD: - if (record->event.pressed) { - rgblight_decrease_hue_noeeprom(); - } - break; + case LIGHT_HUI: + if (record->event.pressed) { + rgblight_increase_hue_noeeprom(); + } + break; - case LIGHT_SAI: - if (record->event.pressed) { - rgblight_increase_sat_noeeprom(); - } - break; + case LIGHT_HUD: + if (record->event.pressed) { + rgblight_decrease_hue_noeeprom(); + } + break; - case LIGHT_SAD: - if (record->event.pressed) { - rgblight_decrease_sat_noeeprom(); - } - break; + case LIGHT_SAI: + if (record->event.pressed) { + rgblight_increase_sat_noeeprom(); + } + break; - case LIGHT_VAI: - if (record->event.pressed) { - rgblight_increase_val_noeeprom(); - } - break; + case LIGHT_SAD: + if (record->event.pressed) { + rgblight_decrease_sat_noeeprom(); + } + break; - case LIGHT_VAD: - if (record->event.pressed) { - rgblight_decrease_val_noeeprom(); - } - break; + case LIGHT_VAI: + if (record->event.pressed) { + rgblight_increase_val_noeeprom(); + } + break; - case LIGHT_SPI: - if (record->event.pressed) { - rgblight_increase_speed_noeeprom(); - } - break; + case LIGHT_VAD: + if (record->event.pressed) { + rgblight_decrease_val_noeeprom(); + } + break; - case LIGHT_SPD: - if (record->event.pressed) { - rgblight_decrease_speed_noeeprom(); - } - break; + case LIGHT_SPI: + if (record->event.pressed) { + rgblight_increase_speed_noeeprom(); + } + break; + + case LIGHT_SPD: + if (record->event.pressed) { + rgblight_decrease_speed_noeeprom(); + } + break; + #else + case LIGHT_TOG: + if (record->event.pressed) { + rgblight_toggle(); + } + break; + + case LIGHT_MOD: + if (record->event.pressed) { + rgblight_step(); + } + break; + + case LIGHT_HUI: + if (record->event.pressed) { + rgblight_increase_hue(); + } + break; + + case LIGHT_HUD: + if (record->event.pressed) { + rgblight_decrease_hue(); + } + break; + + case LIGHT_SAI: + if (record->event.pressed) { + rgblight_increase_sat(); + } + break; + + case LIGHT_SAD: + if (record->event.pressed) { + rgblight_decrease_sat(); + } + break; + + case LIGHT_VAI: + if (record->event.pressed) { + rgblight_increase_val(); + } + break; + + case LIGHT_VAD: + if (record->event.pressed) { + rgblight_decrease_val(); + } + break; + + case LIGHT_SPI: + if (record->event.pressed) { + rgblight_increase_speed(); + } + break; + + case LIGHT_SPD: + if (record->event.pressed) { + rgblight_decrease_speed(); + } + break; + #endif } return true; }