diff options
| author | stanrc85 <47038504+stanrc85@users.noreply.github.com> | 2020-08-17 04:33:57 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-17 01:33:57 -0700 |
| commit | 2ddcd810201903836404724d27b8d5a628930a22 (patch) | |
| tree | 07240efe3b600cd14e2853d4bc23a31233f38f7d /users | |
| parent | 869b648088d3dc97a86e8db445b537ec7eed23fb (diff) | |
| download | qmk_firmware-2ddcd810201903836404724d27b8d5a628930a22.tar.gz qmk_firmware-2ddcd810201903836404724d27b8d5a628930a22.zip | |
[Keymap] layer indicator lights (#10004)
* move caps lock indicator position
* use num lock and scroll lock as layer indicators
Diffstat (limited to 'users')
| -rw-r--r-- | users/stanrc85/rgblight_layers.c | 25 | ||||
| -rw-r--r-- | users/stanrc85/rgblight_layers_osa.c | 24 |
2 files changed, 44 insertions, 5 deletions
diff --git a/users/stanrc85/rgblight_layers.c b/users/stanrc85/rgblight_layers.c index 0363e358b..780555e7b 100644 --- a/users/stanrc85/rgblight_layers.c +++ b/users/stanrc85/rgblight_layers.c | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | #include "stanrc85.h" | 1 | #include "stanrc85.h" |
| 2 | 2 | ||
| 3 | static uint8_t middle = 0; | ||
| 4 | static uint8_t bottom = 0; | ||
| 5 | |||
| 3 | const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( | 6 | const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( |
| 4 | {3, 2, HSV_RED}, | 7 | {3, 2, HSV_RED}, |
| 5 | {10, 2, HSV_RED} | 8 | {10, 2, HSV_RED} |
| @@ -38,10 +41,28 @@ layer_state_t layer_state_set_user(layer_state_t state) { | |||
| 38 | rgblight_set_layer_state(1, layer_state_cmp(state, 1)); | 41 | rgblight_set_layer_state(1, layer_state_cmp(state, 1)); |
| 39 | rgblight_set_layer_state(2, layer_state_cmp(state, 2)); | 42 | rgblight_set_layer_state(2, layer_state_cmp(state, 2)); |
| 40 | rgblight_set_layer_state(3, layer_state_cmp(state, 3)); | 43 | rgblight_set_layer_state(3, layer_state_cmp(state, 3)); |
| 44 | middle = bottom = 0; | ||
| 45 | switch (get_highest_layer(state)) { | ||
| 46 | case _FN1_60: | ||
| 47 | middle = 1; | ||
| 48 | break; | ||
| 49 | case _FN2_60: | ||
| 50 | bottom = 1; | ||
| 51 | break; | ||
| 52 | case _DEFAULT: | ||
| 53 | middle = 1; | ||
| 54 | bottom = 1; | ||
| 55 | break; | ||
| 56 | default: // for any other layers, or the default layer | ||
| 57 | break; | ||
| 58 | } | ||
| 41 | return state; | 59 | return state; |
| 42 | } | 60 | } |
| 43 | 61 | ||
| 44 | bool led_update_user(led_t led_state) { | 62 | bool led_update_user(led_t led_state) { |
| 45 | rgblight_set_layer_state(0, led_state.caps_lock); | 63 | //rgblight_set_layer_state(0, led_state.caps_lock); |
| 46 | return true; | 64 | writePin(INDICATOR_PIN_0, !led_state.caps_lock); |
| 65 | writePin(INDICATOR_PIN_1, !middle); | ||
| 66 | writePin(INDICATOR_PIN_2, !bottom); | ||
| 67 | return false; | ||
| 47 | } \ No newline at end of file | 68 | } \ No newline at end of file |
diff --git a/users/stanrc85/rgblight_layers_osa.c b/users/stanrc85/rgblight_layers_osa.c index 8bd7137e4..59366fa34 100644 --- a/users/stanrc85/rgblight_layers_osa.c +++ b/users/stanrc85/rgblight_layers_osa.c | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | #include "stanrc85.h" | 1 | #include "stanrc85.h" |
| 2 | 2 | ||
| 3 | static uint8_t middle = 0; | ||
| 4 | static uint8_t bottom = 0; | ||
| 5 | |||
| 3 | const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( | 6 | const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( |
| 4 | {2, 2, HSV_RED}, | 7 | {2, 2, HSV_RED}, |
| 5 | {6, 2, HSV_RED} | 8 | {6, 2, HSV_RED} |
| @@ -38,13 +41,28 @@ layer_state_t layer_state_set_user(layer_state_t state) { | |||
| 38 | rgblight_set_layer_state(1, layer_state_cmp(state, 1)); | 41 | rgblight_set_layer_state(1, layer_state_cmp(state, 1)); |
| 39 | rgblight_set_layer_state(2, layer_state_cmp(state, 2)); | 42 | rgblight_set_layer_state(2, layer_state_cmp(state, 2)); |
| 40 | rgblight_set_layer_state(3, layer_state_cmp(state, 3)); | 43 | rgblight_set_layer_state(3, layer_state_cmp(state, 3)); |
| 44 | middle = bottom = 0; | ||
| 45 | switch (get_highest_layer(state)) { | ||
| 46 | case _FN1_60: | ||
| 47 | middle = 1; | ||
| 48 | break; | ||
| 49 | case _FN2_60: | ||
| 50 | bottom = 1; | ||
| 51 | break; | ||
| 52 | case _DEFAULT: | ||
| 53 | middle = 1; | ||
| 54 | bottom = 1; | ||
| 55 | break; | ||
| 56 | default: // for any other layers, or the default layer | ||
| 57 | break; | ||
| 58 | } | ||
| 41 | return state; | 59 | return state; |
| 42 | } | 60 | } |
| 43 | 61 | ||
| 44 | bool led_update_user(led_t led_state) { | 62 | bool led_update_user(led_t led_state) { |
| 45 | //rgblight_set_layer_state(0, led_state.caps_lock); | 63 | //rgblight_set_layer_state(0, led_state.caps_lock); |
| 46 | writePin(C7, led_state.caps_lock); | 64 | writePin(C7, led_state.caps_lock); |
| 47 | writePin(C6, led_state.num_lock); | 65 | writePin(C6, middle); |
| 48 | writePin(B6, led_state.scroll_lock); | 66 | writePin(B6, bottom); |
| 49 | return false; | 67 | return false; |
| 50 | } \ No newline at end of file | 68 | } |
