From 007fe8a9f0be08d08e9d2a93d9eb226fb23d3f97 Mon Sep 17 00:00:00 2001 From: stanrc85 Date: Tue, 11 Aug 2020 08:22:38 -0400 Subject: [PATCH 1/2] move caps lock indicator position --- users/stanrc85/rgblight_layers.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/users/stanrc85/rgblight_layers.c b/users/stanrc85/rgblight_layers.c index 0363e358b09c..9ac7cfaad1b8 100644 --- a/users/stanrc85/rgblight_layers.c +++ b/users/stanrc85/rgblight_layers.c @@ -42,6 +42,9 @@ layer_state_t layer_state_set_user(layer_state_t state) { } bool led_update_user(led_t led_state) { - rgblight_set_layer_state(0, led_state.caps_lock); - return true; + //rgblight_set_layer_state(0, led_state.caps_lock); + writePin(INDICATOR_PIN_0, !led_state.caps_lock); + writePin(INDICATOR_PIN_1, !led_state.num_lock); + writePin(INDICATOR_PIN_2, !led_state.scroll_lock); + return false; } \ No newline at end of file From 2f9d582bb199fbad675445a56ad548f74a6cb8e6 Mon Sep 17 00:00:00 2001 From: stanrc85 Date: Tue, 11 Aug 2020 08:45:53 -0400 Subject: [PATCH 2/2] use num lock and scroll lock as layer indicators --- users/stanrc85/rgblight_layers.c | 22 ++++++++++++++++++++-- users/stanrc85/rgblight_layers_osa.c | 24 +++++++++++++++++++++--- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/users/stanrc85/rgblight_layers.c b/users/stanrc85/rgblight_layers.c index 9ac7cfaad1b8..780555e7b58f 100644 --- a/users/stanrc85/rgblight_layers.c +++ b/users/stanrc85/rgblight_layers.c @@ -1,5 +1,8 @@ #include "stanrc85.h" +static uint8_t middle = 0; +static uint8_t bottom = 0; + const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( {3, 2, HSV_RED}, {10, 2, HSV_RED} @@ -38,13 +41,28 @@ layer_state_t layer_state_set_user(layer_state_t state) { rgblight_set_layer_state(1, layer_state_cmp(state, 1)); rgblight_set_layer_state(2, layer_state_cmp(state, 2)); rgblight_set_layer_state(3, layer_state_cmp(state, 3)); + middle = bottom = 0; + switch (get_highest_layer(state)) { + case _FN1_60: + middle = 1; + break; + case _FN2_60: + bottom = 1; + break; + case _DEFAULT: + middle = 1; + bottom = 1; + break; + default: // for any other layers, or the default layer + break; + } return state; } bool led_update_user(led_t led_state) { //rgblight_set_layer_state(0, led_state.caps_lock); writePin(INDICATOR_PIN_0, !led_state.caps_lock); - writePin(INDICATOR_PIN_1, !led_state.num_lock); - writePin(INDICATOR_PIN_2, !led_state.scroll_lock); + writePin(INDICATOR_PIN_1, !middle); + writePin(INDICATOR_PIN_2, !bottom); return false; } \ No newline at end of file diff --git a/users/stanrc85/rgblight_layers_osa.c b/users/stanrc85/rgblight_layers_osa.c index 8bd7137e4314..59366fa34a95 100644 --- a/users/stanrc85/rgblight_layers_osa.c +++ b/users/stanrc85/rgblight_layers_osa.c @@ -1,5 +1,8 @@ #include "stanrc85.h" +static uint8_t middle = 0; +static uint8_t bottom = 0; + const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( {2, 2, HSV_RED}, {6, 2, HSV_RED} @@ -38,13 +41,28 @@ layer_state_t layer_state_set_user(layer_state_t state) { rgblight_set_layer_state(1, layer_state_cmp(state, 1)); rgblight_set_layer_state(2, layer_state_cmp(state, 2)); rgblight_set_layer_state(3, layer_state_cmp(state, 3)); + middle = bottom = 0; + switch (get_highest_layer(state)) { + case _FN1_60: + middle = 1; + break; + case _FN2_60: + bottom = 1; + break; + case _DEFAULT: + middle = 1; + bottom = 1; + break; + default: // for any other layers, or the default layer + break; + } return state; } bool led_update_user(led_t led_state) { //rgblight_set_layer_state(0, led_state.caps_lock); writePin(C7, led_state.caps_lock); - writePin(C6, led_state.num_lock); - writePin(B6, led_state.scroll_lock); + writePin(C6, middle); + writePin(B6, bottom); return false; -} \ No newline at end of file +}