diff options
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/rgblight.c | 11 | ||||
-rw-r--r-- | quantum/rgblight.h | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 76bb6eb8c..bba50037e 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -551,9 +551,9 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { rgblight_set(); } -void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) { +int rgblight_setrgb_at_noupdate(uint8_t r, uint8_t g, uint8_t b, uint8_t index) { if (!rgblight_config.enable || index >= RGBLED_NUM) { - return; + return -1; } led[index].r = r; @@ -562,6 +562,13 @@ void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) { #ifdef RGBW led[index].w = 0; #endif + return 0; +} + + +void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) { + if (rgblight_setrgb_at_noupdate(r, g, b, index)) + return; rgblight_set(); } diff --git a/quantum/rgblight.h b/quantum/rgblight.h index c3a9e94b7..436d4d8bd 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -291,6 +291,7 @@ void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds); void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds); /* direct operation */ +int rgblight_setrgb_at_noupdate(uint8_t r, uint8_t g, uint8_t b, uint8_t index); void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index); void rgblight_sethsv_at(uint8_t hue, uint8_t sat, uint8_t val, uint8_t index); void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end); |