Update コード整形

This commit is contained in:
Takeshi Nishio 2020-11-28 08:43:06 +09:00
parent 4b13ea7f16
commit c98483d9a0

View File

@ -20,6 +20,7 @@
extern rgblight_config_t rgblight_config; extern rgblight_config_t rgblight_config;
#endif #endif
// static int8_t my_counter = 0;
// Defines names for use in layer keycodes and the keymap // Defines names for use in layer keycodes and the keymap
@ -381,6 +382,8 @@ const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
void keyboard_post_init_user(void) { void keyboard_post_init_user(void) {
// Enable the LED layers // Enable the LED layers
rgblight_layers = my_rgb_layers; rgblight_layers = my_rgb_layers;
// Set LED effect range
// rgblight_set_effect_range(6, 8);
} }
// Enabling and disabling lighting layers // Enabling and disabling lighting layers
@ -433,11 +436,49 @@ void encoder_update_user(uint8_t index, bool clockwise) {
} }
} }
if (index == 1) { /* Second encoder, Left side */ if (index == 1) { /* Second encoder, Left side */
switch(biton32(layer_state)) {
case _LOWER:
if (clockwise) { if (clockwise) {
tap_code(KC_VOLD); rgblight_decrease_val(); // RGB LED Brightness Down
// ++my_counter;
// if (my_counter > 3) {
// my_counter = 0;
// }
} else { } else {
tap_code(KC_VOLU); rgblight_increase_val(); // RGB LED Brightness Up
// --my_counter;
// if (my_counter < 0) {
// my_counter = 3;
// }
} }
break;
default:
if (clockwise) {
tap_code(KC_VOLD); // Volume Down
} else {
tap_code(KC_VOLU); // Volume Up
}
break;
}
// switch (my_counter) {
// case 0:
// rgblight_sethsv_range(0,0,0, 0, 3);
// break;
// case 1:
// rgblight_sethsv_range(HSV_GREEN, 0, 3);
// break;
// case 2:
// rgblight_sethsv_range(HSV_YELLOW, 0, 3);
// break;
// case 3:
// rgblight_sethsv_range(HSV_RED, 0, 3);
// break;
// default:
// break;
// }
} }
} }