Skip to content

Instantly share code, notes, and snippets.

@burakcan
Created February 22, 2018 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burakcan/077dab8f6df5fda729d11217d8a33805 to your computer and use it in GitHub Desktop.
Save burakcan/077dab8f6df5fda729d11217d8a33805 to your computer and use it in GitHub Desktop.
static uint8_t old_layer = 255;
void matrix_scan_user(void) {
#ifdef RGBLIGHT_ENABLE
uint8_t new_layer = biton32(layer_state);
if (old_layer != new_layer) {
switch (new_layer) {
case _QWERTY:
rgblight_mode(13);
break;
case _LOWER:
rgblight_mode(1);
rgblight_setrgb(0x00, 0xA0, 0xFF);
break;
case _RAISE:
rgblight_mode(1);
rgblight_setrgb(0xFF, 0x20, 0x00);
break;
case _ADJUST:
rgblight_mode(22);
rgblight_sethsv(0, 255, 255);
break;
}
old_layer = new_layer;
}
#endif //RGBLIGHT_ENABLE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment