|
|
@ -245,17 +245,12 @@ void rgblight_mode(uint8_t mode) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rgblight_toggle(void) {
|
|
|
|
void rgblight_toggle(void) {
|
|
|
|
rgblight_config.enable ^= 1;
|
|
|
|
xprintf("rgblight toggle: rgblight_config.enable = %u\n", !rgblight_config.enable);
|
|
|
|
eeconfig_update_rgblight(rgblight_config.raw);
|
|
|
|
|
|
|
|
xprintf("rgblight toggle: rgblight_config.enable = %u\n", rgblight_config.enable);
|
|
|
|
|
|
|
|
if (rgblight_config.enable) {
|
|
|
|
if (rgblight_config.enable) {
|
|
|
|
rgblight_mode(rgblight_config.mode);
|
|
|
|
rgblight_disable();
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
#ifdef RGBLIGHT_ANIMATIONS
|
|
|
|
else {
|
|
|
|
rgblight_timer_disable();
|
|
|
|
rgblight_enable();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
_delay_ms(50);
|
|
|
|
|
|
|
|
rgblight_set();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -266,6 +261,17 @@ void rgblight_enable(void) {
|
|
|
|
rgblight_mode(rgblight_config.mode);
|
|
|
|
rgblight_mode(rgblight_config.mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void rgblight_disable(void) {
|
|
|
|
|
|
|
|
rgblight_config.enable = 0;
|
|
|
|
|
|
|
|
eeconfig_update_rgblight(rgblight_config.raw);
|
|
|
|
|
|
|
|
xprintf("rgblight disable: rgblight_config.enable = %u\n", rgblight_config.enable);
|
|
|
|
|
|
|
|
#ifdef RGBLIGHT_ANIMATIONS
|
|
|
|
|
|
|
|
rgblight_timer_disable();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
_delay_ms(50);
|
|
|
|
|
|
|
|
rgblight_set();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void rgblight_increase_hue(void) {
|
|
|
|
void rgblight_increase_hue(void) {
|
|
|
|
uint16_t hue;
|
|
|
|
uint16_t hue;
|
|
|
@ -365,7 +371,8 @@ void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
|
|
|
|
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
|
|
|
|
// dprintf("rgblight set rgb: %u,%u,%u\n", r,g,b);
|
|
|
|
if (!rgblight_config.enable) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
|
|
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
|
|
|
led[i].r = r;
|
|
|
|
led[i].r = r;
|
|
|
|
led[i].g = g;
|
|
|
|
led[i].g = g;
|
|
|
@ -374,6 +381,23 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
|
|
|
|
rgblight_set();
|
|
|
|
rgblight_set();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) {
|
|
|
|
|
|
|
|
if (!rgblight_config.enable || index >= RGBLED_NUM) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
led[index].r = r;
|
|
|
|
|
|
|
|
led[index].g = g;
|
|
|
|
|
|
|
|
led[index].b = b;
|
|
|
|
|
|
|
|
rgblight_set();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index) {
|
|
|
|
|
|
|
|
if (!rgblight_config.enable) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LED_TYPE tmp_led;
|
|
|
|
|
|
|
|
sethsv(hue, sat, val, &tmp_led);
|
|
|
|
|
|
|
|
rgblight_setrgb_at(tmp_led.r, tmp_led.g, tmp_led.b, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
|
|
|
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
|
|
|
void rgblight_set(void) {
|
|
|
|
void rgblight_set(void) {
|
|
|
|
if (rgblight_config.enable) {
|
|
|
|
if (rgblight_config.enable) {
|
|
|
|