From 5692841264ace83794599642d0b2023fca36a7aa Mon Sep 17 00:00:00 2001 From: stanrc85 <47038504+stanrc85@users.noreply.github.com> Date: Sat, 25 Jul 2020 06:10:00 -0400 Subject: [PATCH] Keymap for OSAv2 (#9773) * Add OSAv2 keymap * OSAv2 configs and rules * OSAv2 lighting layers * OSAv2 lighting layers * Fix colors after copy/paste * Use LED indicators instead of RGB --- users/stanrc85/config.h | 1 - users/stanrc85/rgblight_layers_osa.c | 50 ++++++++++++++++++++++++++++ users/stanrc85/rules.mk | 6 ++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 users/stanrc85/rgblight_layers_osa.c diff --git a/users/stanrc85/config.h b/users/stanrc85/config.h index fba488e1c3f3..71b915e488a0 100644 --- a/users/stanrc85/config.h +++ b/users/stanrc85/config.h @@ -5,6 +5,5 @@ #ifdef RGBLIGHT_ENABLE #define RGBLIGHT_LAYERS - #define RGBLIGHT_LIMIT_VAL 175 #define RGBLIGHT_SLEEP #endif diff --git a/users/stanrc85/rgblight_layers_osa.c b/users/stanrc85/rgblight_layers_osa.c new file mode 100644 index 000000000000..8bd7137e4314 --- /dev/null +++ b/users/stanrc85/rgblight_layers_osa.c @@ -0,0 +1,50 @@ +#include "stanrc85.h" + +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {2, 2, HSV_RED}, + {6, 2, HSV_RED} +); + +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {2, 2, HSV_GREEN}, + {6, 2, HSV_GREEN} +); + +const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {2, 2, HSV_BLUE}, + {6, 2, HSV_BLUE} +); + +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {2, 2, HSV_WHITE}, + {6, 2, HSV_WHITE} +); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_capslock_layer, + my_layer1_layer, + my_layer2_layer, + my_layer3_layer +); + +void keyboard_post_init_user(void) { + // Enable the LED layers + rgblight_layers = my_rgb_layers; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + // Both layers will light up if both kb layers are active + 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)); + 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); + return false; +} \ No newline at end of file diff --git a/users/stanrc85/rules.mk b/users/stanrc85/rules.mk index 5fa3737a2530..5c572c0af384 100644 --- a/users/stanrc85/rules.mk +++ b/users/stanrc85/rules.mk @@ -31,4 +31,10 @@ ifeq ($(strip $(KEYBOARD)), projectkb/alice/rev2) VIA_ENABLE = yes LTO_ENABLE = no VELOCIKEY_ENABLE=yes +endif +ifeq ($(strip $(KEYBOARD)), tkc/osav2) + SRC += rgblight_layers_osa.c + VIA_ENABLE = yes + LTO_ENABLE = no + VELOCIKEY_ENABLE=yes endif \ No newline at end of file