blob: d097c8cd7b02761a06ebe473829e7b5ade9804a3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#include "mattly.h"
__attribute__ ((weak))
layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}
static uint16_t current_state = 0;
void set_lights_default(void) {
#ifdef RGBLIGHT_ENABLE
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
rgblight_sethsv_noeeprom(HSV_CAPS);
} else {
if (current_state == _BASE_MAC) {
rgblight_sethsv_noeeprom(HSV_MAC);
} else if (current_state == _OVER_WIN) {
rgblight_sethsv_noeeprom(HSV_WIN);
}
}
#endif
}
void layer_state_set_rgb(layer_state_t state) {
#ifdef RGBLIGHT_ENABLE
switch (get_highest_layer(state)) {
case _SYMBOL:
rgblight_sethsv_noeeprom(HSV_SYMBOL);
break;
case _NAVNUM:
case _NAVNUM_WIN:
rgblight_sethsv_noeeprom(HSV_NAVNUM);
break;
case _FUNCT:
case _FUNCT_WIN:
rgblight_sethsv_noeeprom(HSV_FUNCT);
break;
default:
set_lights_default();
}
#endif
}
layer_state_t layer_state_set_user (layer_state_t state) {
state = update_tri_layer_state(state, _SYMBOL, _NAVNUM, _FUNCT);
state = update_tri_layer_state(state, _OVER_WIN, _NAVNUM, _NAVNUM_WIN);
state = update_tri_layer_state(state, _OVER_WIN, _FUNCT, _FUNCT_WIN);
current_state = get_highest_layer(state);
layer_state_set_rgb(state);
return layer_state_set_keymap (state);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_CAPS:
#ifdef RGBLIGHT_ENABLE
set_lights_default();
#endif
return true;
case RESET:
#ifdef RGBLIGHT_ENABLE
rgblight_sethsv_noeeprom(HSV_RESET);
#endif
return true;
default:
return true;
}
}
void keyboard_post_init_user(void) {
#ifdef RGBLIGHT_ENABLE
rgblight_enable_noeeprom();
set_lights_default();
#endif
}
|