diff options
Diffstat (limited to 'quantum/rgblight.c')
| -rw-r--r-- | quantum/rgblight.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 625971e0f..52a09817a 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
| @@ -370,6 +370,7 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { | |||
| 370 | rgblight_set(); | 370 | rgblight_set(); |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | __attribute__ ((weak)) | ||
| 373 | void rgblight_set(void) { | 374 | void rgblight_set(void) { |
| 374 | if (rgblight_config.enable) { | 375 | if (rgblight_config.enable) { |
| 375 | #ifdef RGBW | 376 | #ifdef RGBW |
| @@ -449,6 +450,9 @@ void rgblight_task(void) { | |||
| 449 | } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) { | 450 | } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) { |
| 450 | // mode = 21 to 23, knight mode | 451 | // mode = 21 to 23, knight mode |
| 451 | rgblight_effect_knight(rgblight_config.mode - 21); | 452 | rgblight_effect_knight(rgblight_config.mode - 21); |
| 453 | } else { | ||
| 454 | // mode = 24, christmas mode | ||
| 455 | rgblight_effect_christmas(); | ||
| 452 | } | 456 | } |
| 453 | } | 457 | } |
| 454 | } | 458 | } |
| @@ -594,4 +598,22 @@ void rgblight_effect_knight(uint8_t interval) { | |||
| 594 | } | 598 | } |
| 595 | } | 599 | } |
| 596 | 600 | ||
| 601 | |||
| 602 | void rgblight_effect_christmas(void) { | ||
| 603 | static uint16_t current_offset = 0; | ||
| 604 | static uint16_t last_timer = 0; | ||
| 605 | uint16_t hue; | ||
| 606 | uint8_t i; | ||
| 607 | if (timer_elapsed(last_timer) < 1000) { | ||
| 608 | return; | ||
| 609 | } | ||
| 610 | last_timer = timer_read(); | ||
| 611 | current_offset = (current_offset + 1) % 2; | ||
| 612 | for (i = 0; i < RGBLED_NUM; i++) { | ||
| 613 | hue = 0 + ((RGBLED_NUM * (i + current_offset)) % 2) * 80; | ||
| 614 | sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); | ||
| 615 | } | ||
| 616 | rgblight_set(); | ||
| 617 | } | ||
| 618 | |||
| 597 | #endif | 619 | #endif |
