Formatting
parent
85b356d4a1
commit
c746af211f
|
@ -45,15 +45,15 @@
|
|||
|
||||
|
||||
enum custom_keycodes {
|
||||
RGB_SLD = EZ_SAFE_RANGE,
|
||||
HSV_136_138_245,
|
||||
HSV_24_210_255,
|
||||
HSV_0_0_255,
|
||||
ST_MACRO_0,
|
||||
ST_MACRO_1,
|
||||
RU_LAYER,
|
||||
EN_LAYER,
|
||||
RU_SYMBOL,
|
||||
RGB_SLD = EZ_SAFE_RANGE,
|
||||
HSV_136_138_245,
|
||||
HSV_24_210_255,
|
||||
HSV_0_0_255,
|
||||
ST_MACRO_0,
|
||||
ST_MACRO_1,
|
||||
RU_LAYER,
|
||||
EN_LAYER,
|
||||
RU_SYMBOL,
|
||||
};
|
||||
|
||||
enum tap_dance_codes {
|
||||
|
@ -178,198 +178,217 @@ extern bool g_suspend_state;
|
|||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
rgb_matrix_enable();
|
||||
rgb_matrix_enable();
|
||||
}
|
||||
|
||||
const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = {
|
||||
[1] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
[1] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
|
||||
[2] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {32,176,255}, {85,203,158}, {85,203,158}, {85,203,158}, {0,0,0}, {85,203,158}, {85,203,158}, {85,203,158}, {85,203,158}, {32,176,255}, {32,176,255}, {85,203,158}, {85,203,158}, {85,203,158}, {32,176,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
[2] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {32,176,255}, {85,203,158}, {85,203,158}, {85,203,158}, {0,0,0}, {85,203,158}, {85,203,158}, {85,203,158}, {85,203,158}, {32,176,255}, {32,176,255}, {85,203,158}, {85,203,158}, {85,203,158}, {32,176,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
|
||||
[3] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {85,203,158}, {134,255,213}, {0,0,0}, {134,255,213}, {134,255,213}, {85,203,158}, {243,222,234}, {10,225,255}, {134,255,213}, {85,203,158}, {85,203,158}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {134,255,213}, {243,222,234}, {134,255,213}, {134,255,213}, {10,225,255}, {243,222,234}, {243,222,234}, {243,222,234}, {243,222,234}, {10,225,255}, {134,255,213}, {243,222,234}, {134,255,213}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
[3] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {85,203,158}, {134,255,213}, {0,0,0}, {134,255,213}, {134,255,213}, {85,203,158}, {243,222,234}, {10,225,255}, {134,255,213}, {85,203,158}, {85,203,158}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {134,255,213}, {243,222,234}, {134,255,213}, {134,255,213}, {10,225,255}, {243,222,234}, {243,222,234}, {243,222,234}, {243,222,234}, {10,225,255}, {134,255,213}, {243,222,234}, {134,255,213}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
|
||||
[4] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {32,176,255}, {32,176,255}, {0,0,0}, {85,203,158}, {85,203,158}, {85,203,158}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
[4] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {32,176,255}, {32,176,255}, {0,0,0}, {85,203,158}, {85,203,158}, {85,203,158}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
|
||||
[5] = { {134,255,213}, {134,255,213}, {134,255,213}, {134,255,213}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {134,255,213}, {134,255,213}, {134,255,213}, {134,255,213}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
[5] = { {134,255,213}, {134,255,213}, {134,255,213}, {134,255,213}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {134,255,213}, {134,255,213}, {134,255,213}, {134,255,213}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
|
||||
[6] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {243,222,234}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
[6] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {243,222,234}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
|
||||
[7] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {0,0,0}, {14,255,255}, {0,0,0}, {85,203,158}, {85,203,158}, {85,203,158}, {0,0,0}, {0,0,0}, {134,255,213}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {134,255,213}, {134,255,213}, {0,0,0}, {85,203,158}, {0,0,0}, {134,255,213}, {134,255,213}, {85,203,158}, {85,203,158}, {85,203,158}, {0,0,0}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
[7] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {0,0,0}, {14,255,255}, {0,0,0}, {85,203,158}, {85,203,158}, {85,203,158}, {0,0,0}, {0,0,0}, {134,255,213}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {134,255,213}, {134,255,213}, {0,0,0}, {85,203,158}, {0,0,0}, {134,255,213}, {134,255,213}, {85,203,158}, {85,203,158}, {85,203,158}, {0,0,0}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
|
||||
[9] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,165}, {0,0,165}, {0,0,165}, {0,0,165}, {0,0,165}, {153,255,153}, {153,255,153}, {153,255,153}, {153,255,153}, {153,255,153}, {0,255,145}, {0,255,145}, {0,255,145}, {0,255,145}, {0,255,145}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,165}, {0,0,165}, {0,0,165}, {0,0,165}, {0,0,165}, {153,255,153}, {153,255,153}, {153,255,153}, {153,255,153}, {153,255,153}, {0,255,145}, {0,255,145}, {0,255,145}, {0,255,145}, {0,255,145}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
[9] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,165}, {0,0,165}, {0,0,165}, {0,0,165}, {0,0,165}, {153,255,153}, {153,255,153}, {153,255,153}, {153,255,153}, {153,255,153}, {0,255,145}, {0,255,145}, {0,255,145}, {0,255,145}, {0,255,145}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,165}, {0,0,165}, {0,0,165}, {0,0,165}, {0,0,165}, {153,255,153}, {153,255,153}, {153,255,153}, {153,255,153}, {153,255,153}, {0,255,145}, {0,255,145}, {0,255,145}, {0,255,145}, {0,255,145}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
[10] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {85,203,158}, {85,203,158}, {134,255,213}, {0,0,0}, {134,255,213}, {134,255,213}, {85,203,158}, {243,222,234}, {10,225,255}, {134,255,213}, {85,203,158}, {85,203,158}, {243,222,234}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {134,255,213}, {243,222,234}, {134,255,213}, {134,255,213}, {10,225,255}, {243,222,234}, {243,222,234}, {243,222,234}, {243,222,234}, {10,225,255}, {134,255,213}, {243,222,234}, {134,255,213}, {134,255,213}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} },
|
||||
|
||||
};
|
||||
|
||||
void set_layer_color(int layer) {
|
||||
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
HSV hsv = {
|
||||
.h = pgm_read_byte(&ledmap[layer][i][0]),
|
||||
.s = pgm_read_byte(&ledmap[layer][i][1]),
|
||||
.v = pgm_read_byte(&ledmap[layer][i][2]),
|
||||
};
|
||||
if (!hsv.h && !hsv.s && !hsv.v) {
|
||||
rgb_matrix_set_color( i, 0, 0, 0 );
|
||||
} else {
|
||||
RGB rgb = hsv_to_rgb( hsv );
|
||||
float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
|
||||
rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b );
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
HSV hsv = {
|
||||
.h = pgm_read_byte(&ledmap[layer][i][0]),
|
||||
.s = pgm_read_byte(&ledmap[layer][i][1]),
|
||||
.v = pgm_read_byte(&ledmap[layer][i][2]),
|
||||
};
|
||||
if (!hsv.h && !hsv.s && !hsv.v) {
|
||||
rgb_matrix_set_color( i, 0, 0, 0 );
|
||||
} else {
|
||||
RGB rgb = hsv_to_rgb( hsv );
|
||||
float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
|
||||
rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_matrix_indicators_user(void) {
|
||||
if (g_suspend_state || keyboard_config.disable_layer_led) { return; }
|
||||
switch (biton32(layer_state)) {
|
||||
case 1:
|
||||
set_layer_color(1);
|
||||
break;
|
||||
case 2:
|
||||
set_layer_color(2);
|
||||
break;
|
||||
case 3:
|
||||
set_layer_color(3);
|
||||
break;
|
||||
case 4:
|
||||
set_layer_color(4);
|
||||
break;
|
||||
case 5:
|
||||
set_layer_color(5);
|
||||
break;
|
||||
case 6:
|
||||
set_layer_color(6);
|
||||
break;
|
||||
case 7:
|
||||
set_layer_color(7);
|
||||
break;
|
||||
case 9:
|
||||
set_layer_color(9);
|
||||
break;
|
||||
case 10:
|
||||
set_layer_color(10);
|
||||
break;
|
||||
default:
|
||||
if (rgb_matrix_get_flags() == LED_FLAG_NONE)
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
break;
|
||||
}
|
||||
if (g_suspend_state || keyboard_config.disable_layer_led) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (biton32(layer_state)) {
|
||||
case 1:
|
||||
set_layer_color(1);
|
||||
break;
|
||||
case 2:
|
||||
set_layer_color(2);
|
||||
break;
|
||||
case 3:
|
||||
set_layer_color(3);
|
||||
break;
|
||||
case 4:
|
||||
set_layer_color(4);
|
||||
break;
|
||||
case 5:
|
||||
set_layer_color(5);
|
||||
break;
|
||||
case 6:
|
||||
set_layer_color(6);
|
||||
break;
|
||||
case 7:
|
||||
set_layer_color(7);
|
||||
break;
|
||||
case 9:
|
||||
set_layer_color(9);
|
||||
break;
|
||||
case 10:
|
||||
set_layer_color(10);
|
||||
break;
|
||||
default:
|
||||
if (rgb_matrix_get_flags() == LED_FLAG_NONE) {
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case ST_MACRO_0:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LCTL(SS_LGUI(SS_LSFT(SS_TAP(X_R)))));
|
||||
switch (keycode) {
|
||||
case ST_MACRO_0:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LCTL(SS_LGUI(SS_LSFT(SS_TAP(X_R)))));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
case ST_MACRO_1:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LGUI(SS_TAP(X_P)) SS_DELAY(100) SS_TAP(X_Y) SS_DELAY(100) SS_TAP(X_ENTER));
|
||||
case ST_MACRO_1:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LGUI(SS_TAP(X_P)) SS_DELAY(100) SS_TAP(X_Y) SS_DELAY(100) SS_TAP(X_ENTER));
|
||||
|
||||
}
|
||||
break;
|
||||
case RU_LAYER:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_9)))));
|
||||
layer_move(9);
|
||||
}
|
||||
break;
|
||||
case EN_LAYER:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0)))));
|
||||
layer_move(0);
|
||||
}
|
||||
break;
|
||||
case RU_SYMBOL:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0)))));
|
||||
layer_move(10);
|
||||
} else {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_9)))));
|
||||
layer_move(9);
|
||||
}
|
||||
break;
|
||||
case RGB_SLD:
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(1);
|
||||
}
|
||||
return false;
|
||||
case HSV_136_138_245:
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(1);
|
||||
rgblight_sethsv(136,138,245);
|
||||
}
|
||||
return false;
|
||||
case HSV_24_210_255:
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(1);
|
||||
rgblight_sethsv(24,210,255);
|
||||
}
|
||||
return false;
|
||||
case HSV_0_0_255:
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(1);
|
||||
rgblight_sethsv(0,0,255);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case RU_LAYER:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_9)))));
|
||||
layer_move(9);
|
||||
}
|
||||
break;
|
||||
|
||||
case EN_LAYER:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0)))));
|
||||
layer_move(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case RU_SYMBOL:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_0)))));
|
||||
layer_move(10);
|
||||
} else {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT(SS_LCTL(SS_TAP(X_9)))));
|
||||
layer_move(9);
|
||||
}
|
||||
break;
|
||||
|
||||
case RGB_SLD:
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(1);
|
||||
}
|
||||
return false;
|
||||
|
||||
case HSV_136_138_245:
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(1);
|
||||
rgblight_sethsv(136,138,245);
|
||||
}
|
||||
return false;
|
||||
|
||||
case HSV_24_210_255:
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(1);
|
||||
rgblight_sethsv(24,210,255);
|
||||
}
|
||||
return false;
|
||||
|
||||
case HSV_0_0_255:
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(1);
|
||||
rgblight_sethsv(0,0,255);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t layer_state_set_user(uint32_t state) {
|
||||
|
||||
uint8_t layer = biton32(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 1:
|
||||
ergodox_right_led_1_on();
|
||||
break;
|
||||
case 2:
|
||||
ergodox_right_led_2_on();
|
||||
break;
|
||||
case 3:
|
||||
ergodox_right_led_3_on();
|
||||
break;
|
||||
case 4:
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_2_on();
|
||||
break;
|
||||
case 5:
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_3_on();
|
||||
break;
|
||||
case 6:
|
||||
ergodox_right_led_2_on();
|
||||
ergodox_right_led_3_on();
|
||||
break;
|
||||
case 7:
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_2_on();
|
||||
ergodox_right_led_3_on();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
ergodox_right_led_3_off();
|
||||
switch (layer) {
|
||||
case 1:
|
||||
ergodox_right_led_1_on();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ergodox_right_led_2_on();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ergodox_right_led_3_on();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_2_on();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_3_on();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
ergodox_right_led_2_on();
|
||||
ergodox_right_led_3_on();
|
||||
break;
|
||||
|
||||
case 7:
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_2_on();
|
||||
ergodox_right_led_3_on();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
bool is_press_action;
|
||||
uint8_t step;
|
||||
bool is_press_action;
|
||||
uint8_t step;
|
||||
} tap;
|
||||
|
||||
enum {
|
||||
SINGLE_TAP = 1,
|
||||
SINGLE_HOLD,
|
||||
DOUBLE_TAP,
|
||||
DOUBLE_HOLD,
|
||||
DOUBLE_SINGLE_TAP,
|
||||
MORE_TAPS
|
||||
SINGLE_TAP = 1,
|
||||
SINGLE_HOLD,
|
||||
DOUBLE_TAP,
|
||||
DOUBLE_HOLD,
|
||||
DOUBLE_SINGLE_TAP,
|
||||
MORE_TAPS
|
||||
};
|
||||
|
||||
static tap dance_state[1];
|
||||
|
@ -377,15 +396,22 @@ static tap dance_state[1];
|
|||
uint8_t dance_step(qk_tap_dance_state_t *state);
|
||||
|
||||
uint8_t dance_step(qk_tap_dance_state_t *state) {
|
||||
if (state->count == 1) {
|
||||
if (state->interrupted || !state->pressed) return SINGLE_TAP;
|
||||
else return SINGLE_HOLD;
|
||||
} else if (state->count == 2) {
|
||||
if (state->interrupted) return DOUBLE_SINGLE_TAP;
|
||||
else if (state->pressed) return DOUBLE_HOLD;
|
||||
else return DOUBLE_TAP;
|
||||
}
|
||||
return MORE_TAPS;
|
||||
if (state->count == 1) {
|
||||
if (state->interrupted || !state->pressed) {
|
||||
return SINGLE_TAP;
|
||||
} else {
|
||||
return SINGLE_HOLD;
|
||||
}
|
||||
} else if (state->count == 2) {
|
||||
if (state->interrupted) {
|
||||
return DOUBLE_SINGLE_TAP;
|
||||
} else if (state->pressed) {
|
||||
return DOUBLE_HOLD;
|
||||
} else {
|
||||
return DOUBLE_TAP;
|
||||
}
|
||||
}
|
||||
return MORE_TAPS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -394,35 +420,48 @@ void dance_0_finished(qk_tap_dance_state_t *state, void *user_data);
|
|||
void dance_0_reset(qk_tap_dance_state_t *state, void *user_data);
|
||||
|
||||
void on_dance_0(qk_tap_dance_state_t *state, void *user_data) {
|
||||
if(state->count == 3) {
|
||||
tap_code16(LGUI(KC_L));
|
||||
tap_code16(LGUI(KC_L));
|
||||
tap_code16(LGUI(KC_L));
|
||||
}
|
||||
if(state->count > 3) {
|
||||
tap_code16(LGUI(KC_L));
|
||||
}
|
||||
if(state->count == 3) {
|
||||
tap_code16(LGUI(KC_L));
|
||||
tap_code16(LGUI(KC_L));
|
||||
tap_code16(LGUI(KC_L));
|
||||
}
|
||||
if(state->count > 3) {
|
||||
tap_code16(LGUI(KC_L));
|
||||
}
|
||||
}
|
||||
|
||||
void dance_0_finished(qk_tap_dance_state_t *state, void *user_data) {
|
||||
dance_state[0].step = dance_step(state);
|
||||
switch (dance_state[0].step) {
|
||||
case SINGLE_TAP: register_code16(LGUI(KC_L)); break;
|
||||
case DOUBLE_TAP: register_code16(LGUI(KC_K)); break;
|
||||
case DOUBLE_SINGLE_TAP: tap_code16(LGUI(KC_L)); register_code16(LGUI(KC_L));
|
||||
}
|
||||
dance_state[0].step = dance_step(state);
|
||||
switch (dance_state[0].step) {
|
||||
case SINGLE_TAP:
|
||||
register_code16(LGUI(KC_L));
|
||||
break;
|
||||
case DOUBLE_TAP:
|
||||
register_code16(LGUI(KC_K));
|
||||
break;
|
||||
case DOUBLE_SINGLE_TAP:
|
||||
tap_code16(LGUI(KC_L));
|
||||
register_code16(LGUI(KC_L));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void dance_0_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
wait_ms(10);
|
||||
switch (dance_state[0].step) {
|
||||
case SINGLE_TAP: unregister_code16(LGUI(KC_L)); break;
|
||||
case DOUBLE_TAP: unregister_code16(LGUI(KC_K)); break;
|
||||
case DOUBLE_SINGLE_TAP: unregister_code16(LGUI(KC_L)); break;
|
||||
}
|
||||
dance_state[0].step = 0;
|
||||
wait_ms(10);
|
||||
switch (dance_state[0].step) {
|
||||
case SINGLE_TAP:
|
||||
unregister_code16(LGUI(KC_L));
|
||||
break;
|
||||
case DOUBLE_TAP:
|
||||
unregister_code16(LGUI(KC_K));
|
||||
break;
|
||||
case DOUBLE_SINGLE_TAP:
|
||||
unregister_code16(LGUI(KC_L));
|
||||
break;
|
||||
}
|
||||
dance_state[0].step = 0;
|
||||
}
|
||||
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
[DANCE_0] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_0, dance_0_finished, dance_0_reset),
|
||||
[DANCE_0] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_0, dance_0_finished, dance_0_reset),
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue