Skip to content

Instantly share code, notes, and snippets.

@ponpoko1968
Last active Nov 26, 2017
Embed
What would you like to do?
Layerが切り替わったら背面LEDの色も変える
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