Skip to content

Instantly share code, notes, and snippets.

@loadedsith loadedsith/keymap.c

Last active Jan 25, 2020
Embed
What would you like to do?
Backlight responds to layers
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;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.