diff options
Diffstat (limited to 'quantum/rgblight/rgblight.c')
| -rw-r--r-- | quantum/rgblight/rgblight.c | 38 | 
1 files changed, 20 insertions, 18 deletions
| diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index 530cb04688..b0f2dfdc1d 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -145,6 +145,15 @@ __attribute__((weak)) RGB rgblight_hsv_to_rgb(HSV hsv) {      return hsv_to_rgb(hsv);  } +void setrgb(uint8_t r, uint8_t g, uint8_t b, rgb_led_t *led1) { +    led1->r = r; +    led1->g = g; +    led1->b = b; +#ifdef WS2812_RGBW +    led1->w = 0; +#endif +} +  void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, rgb_led_t *led1) {      HSV hsv = {hue, sat, val};      RGB rgb = rgblight_hsv_to_rgb(hsv); @@ -155,15 +164,6 @@ void sethsv(uint8_t hue, uint8_t sat, uint8_t val, rgb_led_t *led1) {      sethsv_raw(hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val, led1);  } -void setrgb(uint8_t r, uint8_t g, uint8_t b, rgb_led_t *led1) { -    led1->r = r; -    led1->g = g; -    led1->b = b; -#ifdef RGBW -    led1->w = 0; -#endif -} -  void rgblight_check_config(void) {      /* Add some out of bound checks for RGB light config */ @@ -243,6 +243,8 @@ void rgblight_init(void) {      rgblight_timer_init(); // setup the timer +    rgblight_driver.init(); +      if (rgblight_config.enable) {          rgblight_mode_noeeprom(rgblight_config.mode);      } @@ -650,7 +652,7 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {          led[i].r = r;          led[i].g = g;          led[i].b = b; -#ifdef RGBW +#ifdef WS2812_RGBW          led[i].w = 0;  #endif      } @@ -665,7 +667,7 @@ void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) {      led[index].r = r;      led[index].g = g;      led[index].b = b; -#ifdef RGBW +#ifdef WS2812_RGBW      led[index].w = 0;  #endif      rgblight_set(); @@ -702,7 +704,7 @@ void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8          led[i].r = r;          led[i].g = g;          led[i].b = b; -#ifdef RGBW +#ifdef WS2812_RGBW          led[i].w = 0;  #endif      } @@ -903,7 +905,7 @@ void rgblight_set(void) {              led[i].r = 0;              led[i].g = 0;              led[i].b = 0; -#ifdef RGBW +#ifdef WS2812_RGBW              led[i].w = 0;  #endif          } @@ -931,7 +933,7 @@ void rgblight_set(void) {      start_led = led + rgblight_ranges.clipping_start_pos;  #endif -#ifdef RGBW +#ifdef WS2812_RGBW      for (uint8_t i = 0; i < num_leds; i++) {          convert_rgb_to_rgbw(&start_led[i]);      } @@ -1261,7 +1263,7 @@ void rgblight_effect_snake(animation_status_t *anim) {          ledp->r         = 0;          ledp->g         = 0;          ledp->b         = 0; -#    ifdef RGBW +#    ifdef WS2812_RGBW          ledp->w = 0;  #    endif          for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) { @@ -1321,7 +1323,7 @@ void rgblight_effect_knight(animation_status_t *anim) {          led[i].r = 0;          led[i].g = 0;          led[i].b = 0; -#    ifdef RGBW +#    ifdef WS2812_RGBW          led[i].w = 0;  #    endif      } @@ -1335,7 +1337,7 @@ void rgblight_effect_knight(animation_status_t *anim) {              led[cur].r = 0;              led[cur].g = 0;              led[cur].b = 0; -#    ifdef RGBW +#    ifdef WS2812_RGBW              led[cur].w = 0;  #    endif          } @@ -1566,4 +1568,4 @@ uint8_t rgblight_velocikey_match_speed(uint8_t minValue, uint8_t maxValue) {      return MAX(minValue, maxValue - (maxValue - minValue) * ((float)typing_speed / TYPING_SPEED_MAX_VALUE));  } -#endif
\ No newline at end of file +#endif | 
