Last active
November 26, 2017 05:16
-
-
Save ponpoko1968/57266f9334bb214e71fef0dd2f9cdeda to your computer and use it in GitHub Desktop.
Layerが切り替わったら背面LEDの色も変える
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
uint32_t layer_state_set_user(uint32_t state) { | |
uint8_t layer = biton32(state); | |
ergodox_board_led_off(); | |
ergodox_right_led_1_off(); | |
ergodox_right_led_2_off(); | |
ergodox_right_led_3_off(); | |
switch (layer) { | |
case 0: | |
#ifdef RGBLIGHT_COLOR_LAYER_0 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); | |
#endif | |
#ifdef RGBLIGHT_ENABLE | |
rgblight_enable(); | |
rgblight_mode(1); | |
rgblight_setrgb(0x00,0x00,0x00); | |
#endif | |
break; | |
case 1: | |
ergodox_right_led_1_on(); | |
#ifdef RGBLIGHT_COLOR_LAYER_1 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1); | |
#endif | |
#ifdef RGBLIGHT_ENABLE | |
rgblight_enable(); | |
rgblight_mode(1); | |
rgblight_setrgb(0xff,0x00,0x00); | |
#endif | |
break; | |
case 2: | |
ergodox_right_led_2_on(); | |
#ifdef RGBLIGHT_COLOR_LAYER_2 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2); | |
#endif | |
#ifdef RGBLIGHT_ENABLE | |
rgblight_enable(); | |
rgblight_mode(1); | |
rgblight_setrgb(0x00,0xff,0x00); | |
#endif | |
break; | |
..... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment