Last active
November 10, 2020 18:24
-
-
Save loadedsith/99d79b19cf392396cd62e804e3c4cd6a to your computer and use it in GitHub Desktop.
Backlight responds to layers
This file contains hidden or 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
bool has_layer_changed = true; | |
void matrix_scan_user(void) { | |
uint8_t layer = biton32(layer_state); | |
static uint8_t old_layer = 0; | |
if (old_layer != layer) { | |
has_layer_changed = true; | |
old_layer = layer; | |
} | |
if (has_layer_changed) { | |
has_layer_changed = false; | |
switch (layer) { | |
case _LOWER: | |
backlight_set(1); | |
break; | |
case _QWERTY: | |
backlight_set(2); | |
break; | |
case _RAISE: | |
backlight_set(3); | |
break; | |
case _ADJUST: | |
backlight_set(4); | |
break; | |
} | |
} | |
}; |
I believe this is ancient code. QMK's lighting support has gotten a lot better.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
where does one specify what corresponds to the
backlight_set
1..4
?i've got working it working for underglow with rgb layers, where the number is a array index to the specified layer color configuration. but can't seem to find any information for the backlight scenario.
Example:
so the
rgblight_segment_t`.
1
parameter to rgblight_set_layer_statecorresponds to the
mg_func_layertrying to understand the same relationship here :)