diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2016-12-23 10:29:19 -0500 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2016-12-23 10:29:19 -0500 |
| commit | cae269b08b642b07ee06dec7120a784a3c3d7aab (patch) | |
| tree | 9075edc6468e2c7e07e2008103db4423472ca93f | |
| parent | 9675e1357fb82bf0fcd5c34ff7d5cfedbacc9274 (diff) | |
| download | qmk_firmware-cae269b08b642b07ee06dec7120a784a3c3d7aab.tar.gz qmk_firmware-cae269b08b642b07ee06dec7120a784a3c3d7aab.zip | |
Christmas RGB light mode
| -rw-r--r-- | quantum/rgblight.c | 21 | ||||
| -rw-r--r-- | quantum/rgblight.h | 3 |
2 files changed, 23 insertions, 1 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 625971e0f..6e335a483 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
| @@ -449,6 +449,9 @@ void rgblight_task(void) { | |||
| 449 | } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) { | 449 | } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) { |
| 450 | // mode = 21 to 23, knight mode | 450 | // mode = 21 to 23, knight mode |
| 451 | rgblight_effect_knight(rgblight_config.mode - 21); | 451 | rgblight_effect_knight(rgblight_config.mode - 21); |
| 452 | } else { | ||
| 453 | // mode = 24, christmas mode | ||
| 454 | rgblight_effect_christmas(); | ||
| 452 | } | 455 | } |
| 453 | } | 456 | } |
| 454 | } | 457 | } |
| @@ -594,4 +597,22 @@ void rgblight_effect_knight(uint8_t interval) { | |||
| 594 | } | 597 | } |
| 595 | } | 598 | } |
| 596 | 599 | ||
| 600 | |||
| 601 | void rgblight_effect_christmas(void) { | ||
| 602 | static uint16_t current_offset = 0; | ||
| 603 | static uint16_t last_timer = 0; | ||
| 604 | uint16_t hue; | ||
| 605 | uint8_t i; | ||
| 606 | if (timer_elapsed(last_timer) < 1000) { | ||
| 607 | return; | ||
| 608 | } | ||
| 609 | last_timer = timer_read(); | ||
| 610 | current_offset = (current_offset + 1) % 2; | ||
| 611 | for (i = 0; i < RGBLED_NUM; i++) { | ||
| 612 | hue = 0 + ((RGBLED_NUM * (i + current_offset)) % 2) * 80; | ||
| 613 | sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); | ||
| 614 | } | ||
| 615 | rgblight_set(); | ||
| 616 | } | ||
| 617 | |||
| 597 | #endif | 618 | #endif |
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index aa1d026e0..ceb624692 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define RGBLIGHT_H | 2 | #define RGBLIGHT_H |
| 3 | 3 | ||
| 4 | #ifdef RGBLIGHT_ANIMATIONS | 4 | #ifdef RGBLIGHT_ANIMATIONS |
| 5 | #define RGBLIGHT_MODES 23 | 5 | #define RGBLIGHT_MODES 24 |
| 6 | #else | 6 | #else |
| 7 | #define RGBLIGHT_MODES 1 | 7 | #define RGBLIGHT_MODES 1 |
| 8 | #endif | 8 | #endif |
| @@ -98,5 +98,6 @@ void rgblight_effect_rainbow_mood(uint8_t interval); | |||
| 98 | void rgblight_effect_rainbow_swirl(uint8_t interval); | 98 | void rgblight_effect_rainbow_swirl(uint8_t interval); |
| 99 | void rgblight_effect_snake(uint8_t interval); | 99 | void rgblight_effect_snake(uint8_t interval); |
| 100 | void rgblight_effect_knight(uint8_t interval); | 100 | void rgblight_effect_knight(uint8_t interval); |
| 101 | void rgblight_effect_christmas(void); | ||
| 101 | 102 | ||
| 102 | #endif | 103 | #endif |
