forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Keymap] Userspace update Rgb layers code (qmk#8659)
* enable rgblight layers * rgblight layers code * switch to new rgblight layers * testing led positions * fix caps typo * lights and colors working * rules updated for different rgb use * Extra spaces removed
- Loading branch information
Showing
3 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "stanrc85.h" | ||
|
||
const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
{3, 2, HSV_RED}, | ||
{10, 2, HSV_RED} | ||
); | ||
|
||
const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
{3, 1, HSV_GREEN}, | ||
{11, 1, HSV_GREEN} | ||
); | ||
|
||
const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
{3, 1, HSV_BLUE}, | ||
{11, 1, HSV_BLUE} | ||
); | ||
|
||
const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
{3, 1, HSV_WHITE}, | ||
{11, 1, 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); | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters