aboutsummaryrefslogtreecommitdiffstats
path: root/users/xulkal/custom_rgb.c
blob: f68a7c56c08bfc3516b199b4cb6c0ac8bbe3f2a9 (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
#include "custom_rgb.h"

#ifdef RGB_MATRIX_ENABLE
void rgb_matrix_increase_flags(void)
{
    switch (rgb_matrix_get_flags()) {
        case LED_FLAG_ALL: {
                rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
                rgb_matrix_set_color_all(0, 0, 0);
            }
            break;
        case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
                rgb_matrix_set_flags(LED_FLAG_NONE);
                rgb_matrix_disable_noeeprom();
            }
            break;
        case LED_FLAG_UNDERGLOW: {
                rgb_matrix_set_flags(LED_FLAG_ALL);
                rgb_matrix_set_color_all(0, 0, 0);
            }
            break;
        default: {
                rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
                rgb_matrix_enable_noeeprom();
            }
            break;
    }
}

void rgb_matrix_decrease_flags(void)
{
    switch (rgb_matrix_get_flags()) {
        case LED_FLAG_ALL: {
                rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
                rgb_matrix_set_color_all(0, 0, 0);
            }
            break;
        case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
                rgb_matrix_set_flags(LED_FLAG_ALL);
                rgb_matrix_set_color_all(0, 0, 0);
            }
            break;
        case LED_FLAG_UNDERGLOW: {
                rgb_matrix_set_flags(LED_FLAG_NONE);
                rgb_matrix_disable_noeeprom();
            }
            break;
        default: {
                rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
                rgb_matrix_enable_noeeprom();
            }
            break;
    }
}
#endif

void rgb_reset(void) {
#if defined(RGB_MATRIX_ENABLE)
    eeconfig_update_rgb_matrix_default();
#elif defined(RGBLIGHT_ENABLE)
    eeconfig_update_rgblight_default();
    rgblight_enable();
#endif
}