From e1cbcdebfad92c3152001ec610c721500959e447 Mon Sep 17 00:00:00 2001 From: Takeshi Nishio Date: Sun, 28 May 2023 18:37:03 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=82=B3=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c b/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c index 1981b17a1439..6f064fa4858d 100644 --- a/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c +++ b/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c @@ -391,7 +391,6 @@ void dynamic_macro_play_user(int8_t direction) { // RGB Light settings //------------------------------------------------------------------------------ -// --- Both side --- // Indicator LED settings #define ONBOARD_LED_INDICATOR_INDEX 0 // where to start indicator #define ONBOARD_LED_INDICATOR_COUNT 2 // how many leds used for indicator From 479fbb940f2fc82f14d1f566ff2b6ce1c6796a8b Mon Sep 17 00:00:00 2001 From: Takeshi Nishio Date: Sun, 28 May 2023 18:39:54 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=B8=E3=82=B1?= =?UTF-8?q?=E3=83=BC=E3=82=BFLED=E3=82=92=E3=82=A2=E3=83=B3=E3=83=80?= =?UTF-8?q?=E3=83=BC=E3=82=B0=E3=83=AD=E3=83=BC=E3=81=AE=E6=98=8E=E3=82=8B?= =?UTF-8?q?=E3=81=95=E3=81=A8=E5=88=A5=E3=80=85=E3=81=AB=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- keyboards/sandy/dn0030/config.h | 1 - keyboards/sandy/dn0030/dn0030.c | 4 +- .../sandy/dn0030/keymaps/jpskenn/keymap.c | 324 +++++++++++++++++- keyboards/sandy/dn0030/keymaps/via/keymap.c | 307 ++++++++++++++++- 4 files changed, 601 insertions(+), 35 deletions(-) diff --git a/keyboards/sandy/dn0030/config.h b/keyboards/sandy/dn0030/config.h index 057c492cf036..c4dd6118e4cd 100644 --- a/keyboards/sandy/dn0030/config.h +++ b/keyboards/sandy/dn0030/config.h @@ -71,7 +71,6 @@ along with this program. If not, see . /*== Lighting Layers ==*/ #define RGBLIGHT_LAYERS #define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF // Overriding RGB Lighting on/off status - #define RGBLIGHT_LAYERS_RETAIN_VAL // set layer brightness to RGB Light's value (as returned by rgblight_get_val()) #define RGBLIGHT_LAYER_BLINK // Enable Blink function #define RGBLIGHT_MAX_LAYERS 11 // Default 8. #endif diff --git a/keyboards/sandy/dn0030/dn0030.c b/keyboards/sandy/dn0030/dn0030.c index 600eefc00711..7fd0e2693abe 100644 --- a/keyboards/sandy/dn0030/dn0030.c +++ b/keyboards/sandy/dn0030/dn0030.c @@ -17,7 +17,6 @@ along with this program. If not, see . #include "dn0030.h" - #ifdef ENCODER_ENABLE //------------------------------------------------------------------------------ // Rotary Encoder with VIA @@ -65,5 +64,8 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { // Keyboard Initialization //------------------------------------------------------------------------------ void keyboard_post_init_kb(void) { + // set effect range, range = after LED indicator(from 0 to 1) + rgblight_set_effect_range(2, 16); + keyboard_post_init_user(); } diff --git a/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c b/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c index 6f064fa4858d..450b842601ed 100644 --- a/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c +++ b/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c @@ -23,13 +23,17 @@ bool is_dm_rec2 = false; // list of lighting layers const rgblight_segment_t* const PROGMEM my_rgb_layers[]; +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_low[]; +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_middle[]; +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_high[]; +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_max[]; // data to store EEPROM typedef union { uint32_t raw; struct { // Layer indicator state - int8_t indicator_state :3; // Two state: 0 off, 1 on + int8_t indicator_state :4; }; } user_config_t; @@ -346,13 +350,30 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case IND_TOG: // Toggle LED indicator status if (record->event.pressed) { switch (user_config.indicator_state) { - case 0: // off --> on + case 0: // off --> on(Brightness High) user_config.indicator_state++; rgblight_layers = my_rgb_layers; break; - case 1: // on --> off + case 1: // change brightness from High to Slightly + user_config.indicator_state++; + rgblight_layers = my_rgb_layers_dimmer_low; + break; + case 2: // change brightness from Slightly to Middle + user_config.indicator_state++; + rgblight_layers = my_rgb_layers_dimmer_middle; + break; + case 3: // change brightness from Middle to Low + user_config.indicator_state++; + rgblight_layers = my_rgb_layers_dimmer_high; + break; + case 4: // change brightness from Low to Darkest + user_config.indicator_state++; + rgblight_layers = my_rgb_layers_dimmer_max; + break; + case 5: // Darkest --> off user_config.indicator_state = 0; rgblight_layers = NULL; + rgblight_sethsv_range(HSV_BLACK, 0, 2); break; } eeconfig_update_user(user_config.raw); // Write the new status to EEPROM @@ -395,52 +416,58 @@ void dynamic_macro_play_user(int8_t direction) { #define ONBOARD_LED_INDICATOR_INDEX 0 // where to start indicator #define ONBOARD_LED_INDICATOR_COUNT 2 // how many leds used for indicator #define ONBOARD_LED_INDICATOR_CHANGE_COUNT 1 // how meny leds to change for temporally layer +#define ONBOARD_LED_INDICATOR_DIMMER_MIN 104 // dimmer level minimum(=default), default, high brightness +#define ONBOARD_LED_INDICATOR_DIMMER_LOW 136 // dimmer level low, slightly bright +#define ONBOARD_LED_INDICATOR_DIMMER_MIDDLE 168 // dimmer level middle, moderate +#define ONBOARD_LED_INDICATOR_DIMMER_HIGH 200 // dimmer level high, darker +#define ONBOARD_LED_INDICATOR_DIMMER_MAX 232 // dimmer level max, darkest +// ---------- Brightness: High --------- // for Default layer (= Base layer) const rgblight_segment_t PROGMEM my_base1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_base2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_base3_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); // for locking status const rgblight_segment_t PROGMEM my_caps_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA} + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_scroll_lock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED} + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); // for temporal layer const rgblight_segment_t PROGMEM my_lower1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_lower2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CHARTREUSE} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CHARTREUSE - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_raise_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_adjust_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_blink1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_ORANGE} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_ORANGE - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_blink2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_PINK} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_PINK - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); // Define the array of layers. Later layers take precedence @@ -458,6 +485,258 @@ const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( my_blink2_layer ); +// ---------- Brightness: Slightly Bright --------- +// for Default layer (= Base layer) +const rgblight_segment_t PROGMEM my_base1_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_base2_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_base3_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +// for locking status +const rgblight_segment_t PROGMEM my_caps_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_scroll_lock_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +// for temporal layer +const rgblight_segment_t PROGMEM my_lower1_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_lower2_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CHARTREUSE - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_raise_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_adjust_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_blink1_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_ORANGE - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_blink2_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_PINK - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +// Define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_low[] = RGBLIGHT_LAYERS_LIST( + my_base1_layer_dimmer_low, + my_base2_layer_dimmer_low, + my_base3_layer_dimmer_low, + my_caps_layer_dimmer_low, + my_scroll_lock_layer_dimmer_low, + my_lower1_layer_dimmer_low, + my_lower2_layer_dimmer_low, + my_raise_layer_dimmer_low, + my_adjust_layer_dimmer_low, + my_blink1_layer_dimmer_low, + my_blink2_layer_dimmer_low +); + +// ---------- Brightness: Middle --------- +// for Default layer (= Base layer) +const rgblight_segment_t PROGMEM my_base1_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_base2_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_base3_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +// for locking status +const rgblight_segment_t PROGMEM my_caps_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_scroll_lock_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +// for temporal layer +const rgblight_segment_t PROGMEM my_lower1_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_lower2_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CHARTREUSE - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_raise_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_adjust_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_blink1_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_ORANGE - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_blink2_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_PINK - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +// Define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_middle[] = RGBLIGHT_LAYERS_LIST( + my_base1_layer_dimmer_middle, + my_base2_layer_dimmer_middle, + my_base3_layer_dimmer_middle, + my_caps_layer_dimmer_middle, + my_scroll_lock_layer_dimmer_middle, + my_lower1_layer_dimmer_middle, + my_lower2_layer_dimmer_middle, + my_raise_layer_dimmer_middle, + my_adjust_layer_dimmer_middle, + my_blink1_layer_dimmer_middle, + my_blink2_layer_dimmer_middle +); + +// ---------- Brightness: Low --------- +// for Default layer (= Base layer) +const rgblight_segment_t PROGMEM my_base1_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_base2_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_base3_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +// for locking status +const rgblight_segment_t PROGMEM my_caps_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_scroll_lock_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +// for temporal layer +const rgblight_segment_t PROGMEM my_lower1_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_lower2_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CHARTREUSE - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_raise_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_adjust_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_blink1_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_ORANGE - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_blink2_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_PINK - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +// Define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_high[] = RGBLIGHT_LAYERS_LIST( + my_base1_layer_dimmer_high, + my_base2_layer_dimmer_high, + my_base3_layer_dimmer_high, + my_caps_layer_dimmer_high, + my_scroll_lock_layer_dimmer_high, + my_lower1_layer_dimmer_high, + my_lower2_layer_dimmer_high, + my_raise_layer_dimmer_high, + my_adjust_layer_dimmer_high, + my_blink1_layer_dimmer_high, + my_blink2_layer_dimmer_high +); + +// ---------- Brightness: Darkest --------- +// for Default layer (= Base layer) +const rgblight_segment_t PROGMEM my_base1_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_base2_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_base3_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +// for locking status +const rgblight_segment_t PROGMEM my_caps_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_scroll_lock_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +// for temporal layer +const rgblight_segment_t PROGMEM my_lower1_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_lower2_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CHARTREUSE - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_raise_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_adjust_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_blink1_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_ORANGE - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_blink2_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_PINK - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +// Define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_max[] = RGBLIGHT_LAYERS_LIST( + my_base1_layer_dimmer_max, + my_base2_layer_dimmer_max, + my_base3_layer_dimmer_max, + my_caps_layer_dimmer_max, + my_scroll_lock_layer_dimmer_max, + my_lower1_layer_dimmer_max, + my_lower2_layer_dimmer_max, + my_raise_layer_dimmer_max, + my_adjust_layer_dimmer_max, + my_blink1_layer_dimmer_max, + my_blink2_layer_dimmer_max +); + // Enabling and disabling lighting layers layer_state_t layer_state_set_user(layer_state_t state) { // Set the layer status @@ -506,10 +785,23 @@ void keyboard_post_init_user(void) { switch (user_config.indicator_state) { case 0: // off rgblight_layers = NULL; + rgblight_sethsv_range(HSV_BLACK, 0, 2); break; - case 1: // on + case 1: // Brightness: High rgblight_layers = my_rgb_layers; break; + case 2: // Brightness: Slightly + rgblight_layers = my_rgb_layers_dimmer_low; + break; + case 3: // Brightness: Middle + rgblight_layers = my_rgb_layers_dimmer_middle; + break; + case 4: // Brightness: Low + rgblight_layers = my_rgb_layers_dimmer_high; + break; + case 5: // Brightness: Darkest + rgblight_layers = my_rgb_layers_dimmer_max; + break; } // prevent RGB light overrides layer indicator. @@ -522,6 +814,6 @@ void keyboard_post_init_user(void) { void eeconfig_init_user(void) { // write user configuration to EEPROM user_config.raw = 0; - user_config.indicator_state = 1; // Layer indicator LED state: 1 = on + user_config.indicator_state = 1; // Layer indicator LED state: 0 = on(brightness = high) eeconfig_update_user(user_config.raw); // Write default value to EEPROM now } diff --git a/keyboards/sandy/dn0030/keymaps/via/keymap.c b/keyboards/sandy/dn0030/keymaps/via/keymap.c index 4f53df3b9c10..ff63543c9c4a 100644 --- a/keyboards/sandy/dn0030/keymaps/via/keymap.c +++ b/keyboards/sandy/dn0030/keymaps/via/keymap.c @@ -16,15 +16,19 @@ #include QMK_KEYBOARD_H #include "version.h" -// List of lighting layers +// list of lighting layers const rgblight_segment_t* const PROGMEM my_rgb_layers[]; +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_low[]; +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_middle[]; +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_high[]; +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_max[]; // Data to store EEPROM typedef union { uint32_t raw; struct { // Layer indicator state - int8_t indicator_state :3; // Two state: 0 off, 1 on + int8_t indicator_state :4; // Two state: 0 off, 1 on }; } user_config_t; @@ -253,13 +257,30 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case IND_TOG: // Toggle LED indicator status if (record->event.pressed) { switch (user_config.indicator_state) { - case 0: // off --> on + case 0: // off --> on(Brightness High) user_config.indicator_state++; rgblight_layers = my_rgb_layers; break; - case 1: // on --> off + case 1: // change brightness from High to Slightly + user_config.indicator_state++; + rgblight_layers = my_rgb_layers_dimmer_low; + break; + case 2: // change brightness from Slightly to Middle + user_config.indicator_state++; + rgblight_layers = my_rgb_layers_dimmer_middle; + break; + case 3: // change brightness from Middle to Low + user_config.indicator_state++; + rgblight_layers = my_rgb_layers_dimmer_high; + break; + case 4: // change brightness from Low to Darkest + user_config.indicator_state++; + rgblight_layers = my_rgb_layers_dimmer_max; + break; + case 5: // Darkest --> off user_config.indicator_state = 0; rgblight_layers = NULL; + rgblight_sethsv_range(HSV_BLACK, 0, 2); break; } eeconfig_update_user(user_config.raw); // Write the new status to EEPROM @@ -279,49 +300,56 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // Indicator LED settings #define ONBOARD_LED_INDICATOR_INDEX 0 // Where to start indicator. #define ONBOARD_LED_INDICATOR_COUNT 2 // How many LEDs used for indicator. -#define ONBOARD_LED_INDICATOR_TEMPORALLY_CHANGE_COUNT 1 // How many LEDs to change for temporally layer. +#define ONBOARD_LED_INDICATOR_CHANGE_COUNT 1 // How many LEDs to change for temporally layer. +#define ONBOARD_LED_INDICATOR_DIMMER_MIN 104 // dimmer level minimum(=default), default, high brightness +#define ONBOARD_LED_INDICATOR_DIMMER_LOW 136 // dimmer level low, slightly bright +#define ONBOARD_LED_INDICATOR_DIMMER_MIDDLE 168 // dimmer level middle, moderate +#define ONBOARD_LED_INDICATOR_DIMMER_HIGH 200 // dimmer level high, darker +#define ONBOARD_LED_INDICATOR_DIMMER_MAX 232 // dimmer level max, darkest + +// ---------- Brightness: High --------- // for Default layer (= Base layer) const rgblight_segment_t PROGMEM my_base1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_base2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_base3_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); // for locking status const rgblight_segment_t PROGMEM my_caps_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA} + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_scroll_lock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED} + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); // for temporal layer const rgblight_segment_t PROGMEM my_lower1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_TEMPORALLY_CHANGE_COUNT, HSV_GREEN} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_lower2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_TEMPORALLY_CHANGE_COUNT, HSV_PINK} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_PINK - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_raise1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_TEMPORALLY_CHANGE_COUNT, HSV_CYAN} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_raise2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_TEMPORALLY_CHANGE_COUNT, HSV_ORANGE} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_ORANGE - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); const rgblight_segment_t PROGMEM my_adjust_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_TEMPORALLY_CHANGE_COUNT, HSV_RED} + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MIN} ); // Define the array of layers. Later layers take precedence @@ -338,6 +366,238 @@ const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( my_adjust_layer ); +// ---------- Brightness: Slightly Bright --------- +// for Default layer (= Base layer) +const rgblight_segment_t PROGMEM my_base1_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_base2_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_base3_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +// for locking status +const rgblight_segment_t PROGMEM my_caps_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_scroll_lock_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +// for temporal layer +const rgblight_segment_t PROGMEM my_lower1_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_lower2_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_PINK - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_raise1_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_raise2_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_ORANGE - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +const rgblight_segment_t PROGMEM my_adjust_layer_dimmer_low[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_LOW} +); + +// Define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_low[] = RGBLIGHT_LAYERS_LIST( + my_base1_layer_dimmer_low, + my_base2_layer_dimmer_low, + my_base3_layer_dimmer_low, + my_caps_layer_dimmer_low, + my_scroll_lock_layer_dimmer_low, + my_lower1_layer_dimmer_low, + my_lower2_layer_dimmer_low, + my_raise1_layer_dimmer_low, + my_raise2_layer_dimmer_low, + my_adjust_layer_dimmer_low +); + +// ---------- Brightness: Middle --------- +// for Default layer (= Base layer) +const rgblight_segment_t PROGMEM my_base1_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_base2_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_base3_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +// for locking status +const rgblight_segment_t PROGMEM my_caps_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_scroll_lock_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +// for temporal layer +const rgblight_segment_t PROGMEM my_lower1_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_lower2_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_PINK - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_raise1_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_raise2_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_ORANGE - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +const rgblight_segment_t PROGMEM my_adjust_layer_dimmer_middle[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MIDDLE} +); + +// Define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_middle[] = RGBLIGHT_LAYERS_LIST( + my_base1_layer_dimmer_middle, + my_base2_layer_dimmer_middle, + my_base3_layer_dimmer_middle, + my_caps_layer_dimmer_middle, + my_scroll_lock_layer_dimmer_middle, + my_lower1_layer_dimmer_middle, + my_lower2_layer_dimmer_middle, + my_raise1_layer_dimmer_middle, + my_raise2_layer_dimmer_middle, + my_adjust_layer_dimmer_middle +); + +// ---------- Brightness: Low --------- +// for Default layer (= Base layer) +const rgblight_segment_t PROGMEM my_base1_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_base2_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_base3_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +// for locking status +const rgblight_segment_t PROGMEM my_caps_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_scroll_lock_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +// for temporal layer +const rgblight_segment_t PROGMEM my_lower1_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_lower2_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_PINK - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_raise1_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_raise2_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_ORANGE - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +const rgblight_segment_t PROGMEM my_adjust_layer_dimmer_high[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_HIGH} +); + +// Define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_high[] = RGBLIGHT_LAYERS_LIST( + my_base1_layer_dimmer_high, + my_base2_layer_dimmer_high, + my_base3_layer_dimmer_high, + my_caps_layer_dimmer_high, + my_scroll_lock_layer_dimmer_high, + my_lower1_layer_dimmer_high, + my_lower2_layer_dimmer_high, + my_raise1_layer_dimmer_high, + my_raise2_layer_dimmer_high, + my_adjust_layer_dimmer_high +); + +// ---------- Brightness: Darkest --------- +// for Default layer (= Base layer) +const rgblight_segment_t PROGMEM my_base1_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_WHITE - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_base2_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_BLUE - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_base3_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_COUNT, HSV_YELLOW - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +// for locking status +const rgblight_segment_t PROGMEM my_caps_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_MAGENTA - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_scroll_lock_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX + 1 , 1, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +// for temporal layer +const rgblight_segment_t PROGMEM my_lower1_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_GREEN - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_lower2_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_PINK - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_raise1_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_CYAN - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_raise2_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_ORANGE - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +const rgblight_segment_t PROGMEM my_adjust_layer_dimmer_max[] = RGBLIGHT_LAYER_SEGMENTS( + {ONBOARD_LED_INDICATOR_INDEX , ONBOARD_LED_INDICATOR_CHANGE_COUNT, HSV_RED - ONBOARD_LED_INDICATOR_DIMMER_MAX} +); + +// Define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers_dimmer_max[] = RGBLIGHT_LAYERS_LIST( + my_base1_layer_dimmer_max, + my_base2_layer_dimmer_max, + my_base3_layer_dimmer_max, + my_caps_layer_dimmer_max, + my_scroll_lock_layer_dimmer_max, + my_lower1_layer_dimmer_max, + my_lower2_layer_dimmer_max, + my_raise1_layer_dimmer_max, + my_raise2_layer_dimmer_max, + my_adjust_layer_dimmer_max +); + // Enabling and disabling lighting layers layer_state_t layer_state_set_user(layer_state_t state) { rgblight_set_layer_state(5, layer_state_cmp(state, _LOWER1)); @@ -377,10 +637,23 @@ void keyboard_post_init_user(void) { switch (user_config.indicator_state) { case 0: // off rgblight_layers = NULL; + rgblight_sethsv_range(HSV_BLACK, 0, 2); break; - case 1: // on + case 1: // Brightness: High rgblight_layers = my_rgb_layers; break; + case 2: // Brightness: Slightly + rgblight_layers = my_rgb_layers_dimmer_low; + break; + case 3: // Brightness: Middle + rgblight_layers = my_rgb_layers_dimmer_middle; + break; + case 4: // Brightness: Low + rgblight_layers = my_rgb_layers_dimmer_high; + break; + case 5: // Brightness: Darkest + rgblight_layers = my_rgb_layers_dimmer_max; + break; } // prevent RGB light overrides layer indicator. @@ -393,6 +666,6 @@ void keyboard_post_init_user(void) { void eeconfig_init_user(void) { // write user configuration to EEPROM user_config.raw = 0; - user_config.indicator_state = 1; // Layer indicator LED state: 1 = on + user_config.indicator_state = 1; // Layer indicator LED state: 1 = on ( brightness: High) eeconfig_update_user(user_config.raw); // Write default value to EEPROM now } From 1cc2cb8e108582d0e52b723b843c726136aa3bc9 Mon Sep 17 00:00:00 2001 From: Takeshi Nishio Date: Mon, 5 Jun 2023 07:29:40 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=AB=AF=E3=82=B7?= =?UTF-8?q?=E3=83=95=E3=83=88=E3=82=AD=E3=83=BC=E3=81=A8=E3=81=AF=E8=A8=A3?= =?UTF-8?q?=E5=88=A5=E3=81=97=E3=81=9F=E3=81=8C=E3=80=81=E3=82=B9=E3=82=A4?= =?UTF-8?q?=E3=83=83=E3=83=81=E3=82=92=E9=85=8D=E7=BD=AE=E6=99=82=E3=81=AB?= =?UTF-8?q?=E7=84=A1=E5=8F=8D=E5=BF=9C=E3=81=A7=E3=81=AF=E5=9B=B0=E6=83=91?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=9F=E3=82=81=E3=80=81=E3=81=A8=E3=82=8A?= =?UTF-8?q?=E3=81=82=E3=81=88=E3=81=9A=E3=82=B7=E3=83=95=E3=83=88=E3=82=92?= =?UTF-8?q?=E5=89=B2=E3=82=8A=E5=BD=93=E3=81=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c b/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c index 450b842601ed..046ea7f3c2d2 100644 --- a/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c +++ b/keyboards/sandy/dn0030/keymaps/jpskenn/keymap.c @@ -100,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // |--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--------------| CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_SCLN, KC_QUOT, KC_H, KC_J, KC_K, KC_L, KC_MINS, KC_ENT, // |--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--------------| - XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, DM_PLY1, XXXXXXX, DM_PLY2, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, XXXXXXX, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, DM_PLY1, XXXXXXX, DM_PLY2, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, // |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| XXXXXXX, XXXXXXX, KC_LOPT, GUI_LANG2, SP_SFT, SP_LOW1, KC_BTN1, BS_SFT, SP_RAI1, GUI_LANG1, KC_ROPT, XXXXXXX, XXXXXXX, // |---------+---------+-----------+-----------+---------------+---------+---------+---------+---------------+-----------+-----------+---------+---------| @@ -119,7 +119,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // |--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--------------| CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_SCLN, KC_QUOT, KC_H, KC_J, KC_K, KC_L, KC_MINS, KC_ENT, // |--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--------------| - XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, DM_PLY1, XXXXXXX, DM_PLY2, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, XXXXXXX, + _______, KC_Z, KC_X, KC_C, KC_V, KC_B, DM_PLY1, XXXXXXX, DM_PLY2, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, // |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| XXXXXXX, XXXXXXX, KC_LWIN, ALT_LANG2, SP_SFT, SP_LOW1, KC_BTN1, BS_SFT, SP_RAI1, ALT_LANG1, KC_APP, XXXXXXX, XXXXXXX, // |---------+---------+-----------+-----------+---------------+---------+---------+---------+---------------+-----------+-----------+---------+---------| @@ -176,7 +176,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // |--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--------------| CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_SCLN, KC_QUOT, KC_H, KC_J, KC_K, KC_L, KC_MINS, KC_ENT, // |--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--------------| - XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, DM_PLY1, _______, DM_PLY2, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, XXXXXXX, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, DM_PLY1, _______, DM_PLY2, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, // |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| XXXXXXX, XXXXXXX, KC_LOPT, GUI_LANG2, SP_SFT, _______, KC_BTN1, KC_BTN2, SP_RAI1, GUI_LANG1, KC_ROPT, XXXXXXX, XXXXXXX, // |---------+---------+-----------+-----------+---------------+---------+---------+---------+---------------+-----------+-----------+---------+---------| @@ -271,7 +271,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // |--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--------------| KC_CAPS, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, RGB_TOG, RGB_MOD, VERSION, // |--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--------------| - _______, _______, _______, _______, _______, _______, DM_REC1, _______, DM_REC2, NUMERIC, _______, _______, _______, _______, _______, + KC_CAPS, _______, _______, _______, _______, _______, DM_REC1, _______, DM_REC2, NUMERIC, _______, _______, _______, _______, _______, // |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, // |---------+---------+-----------+-----------+---------------+---------+---------+---------+---------------+-----------+-----------+---------+---------|