[Keymap] layer indicator lights (#10004)
* move caps lock indicator position * use num lock and scroll lock as layer indicators
This commit is contained in:
parent
869b648088
commit
2ddcd81020
2 changed files with 44 additions and 5 deletions
|
@ -1,5 +1,8 @@
|
||||||
#include "stanrc85.h"
|
#include "stanrc85.h"
|
||||||
|
|
||||||
|
static uint8_t middle = 0;
|
||||||
|
static uint8_t bottom = 0;
|
||||||
|
|
||||||
const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
||||||
{3, 2, HSV_RED},
|
{3, 2, HSV_RED},
|
||||||
{10, 2, HSV_RED}
|
{10, 2, HSV_RED}
|
||||||
|
@ -38,10 +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(1, layer_state_cmp(state, 1));
|
||||||
rgblight_set_layer_state(2, layer_state_cmp(state, 2));
|
rgblight_set_layer_state(2, layer_state_cmp(state, 2));
|
||||||
rgblight_set_layer_state(3, layer_state_cmp(state, 3));
|
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;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool led_update_user(led_t led_state) {
|
bool led_update_user(led_t led_state) {
|
||||||
rgblight_set_layer_state(0, led_state.caps_lock);
|
//rgblight_set_layer_state(0, led_state.caps_lock);
|
||||||
return true;
|
writePin(INDICATOR_PIN_0, !led_state.caps_lock);
|
||||||
|
writePin(INDICATOR_PIN_1, !middle);
|
||||||
|
writePin(INDICATOR_PIN_2, !bottom);
|
||||||
|
return false;
|
||||||
}
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
#include "stanrc85.h"
|
#include "stanrc85.h"
|
||||||
|
|
||||||
|
static uint8_t middle = 0;
|
||||||
|
static uint8_t bottom = 0;
|
||||||
|
|
||||||
const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
||||||
{2, 2, HSV_RED},
|
{2, 2, HSV_RED},
|
||||||
{6, 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(1, layer_state_cmp(state, 1));
|
||||||
rgblight_set_layer_state(2, layer_state_cmp(state, 2));
|
rgblight_set_layer_state(2, layer_state_cmp(state, 2));
|
||||||
rgblight_set_layer_state(3, layer_state_cmp(state, 3));
|
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;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool led_update_user(led_t led_state) {
|
bool led_update_user(led_t led_state) {
|
||||||
//rgblight_set_layer_state(0, led_state.caps_lock);
|
//rgblight_set_layer_state(0, led_state.caps_lock);
|
||||||
writePin(C7, led_state.caps_lock);
|
writePin(C7, led_state.caps_lock);
|
||||||
writePin(C6, led_state.num_lock);
|
writePin(C6, middle);
|
||||||
writePin(B6, led_state.scroll_lock);
|
writePin(B6, bottom);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
Loading…
Reference in a new issue