summaryrefslogtreecommitdiff
path: root/quantum/rgblight.c
diff options
context:
space:
mode:
authorDamien <Dbroqua@users.noreply.github.com>2017-01-07 08:45:19 -0600
committerGitHub <noreply@github.com>2017-01-07 08:45:19 -0600
commit0fb82c15a5c9a69e17cff8dcd04c652d21381958 (patch)
treedd7a441ad7d086bb7cb4b093bd8d0cbd4d39d69d /quantum/rgblight.c
parentdb48b28eeb5ebe5252cc04495d5eb326fa62dc26 (diff)
parente7df488a92da56cf160ac64c8cc7302ab717e145 (diff)
Merge pull request #15 from jackhumbert/master
Merge from qmk
Diffstat (limited to 'quantum/rgblight.c')
-rw-r--r--quantum/rgblight.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 625971e0fe..52a09817a1 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) {
rgblight_set();
}
+__attribute__ ((weak))
void rgblight_set(void) {
if (rgblight_config.enable) {
#ifdef RGBW
@@ -449,6 +450,9 @@ void rgblight_task(void) {
} else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) {
// mode = 21 to 23, knight mode
rgblight_effect_knight(rgblight_config.mode - 21);
+ } else {
+ // mode = 24, christmas mode
+ rgblight_effect_christmas();
}
}
}
@@ -594,4 +598,22 @@ void rgblight_effect_knight(uint8_t interval) {
}
}
+
+void rgblight_effect_christmas(void) {
+ static uint16_t current_offset = 0;
+ static uint16_t last_timer = 0;
+ uint16_t hue;
+ uint8_t i;
+ if (timer_elapsed(last_timer) < 1000) {
+ return;
+ }
+ last_timer = timer_read();
+ current_offset = (current_offset + 1) % 2;
+ for (i = 0; i < RGBLED_NUM; i++) {
+ hue = 0 + ((RGBLED_NUM * (i + current_offset)) % 2) * 80;
+ sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
+ }
+ rgblight_set();
+}
+
#endif