aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--quantum/rgblight.c26
-rw-r--r--quantum/rgblight.h3
2 files changed, 27 insertions, 2 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index aa70cbd9e..4919ae4ab 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -247,7 +247,7 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
247 rgblight_timer_disable(); 247 rgblight_timer_disable();
248 #endif 248 #endif
249 } else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) || 249 } else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) ||
250 rgblight_config.mode == 35 ) { 250 rgblight_config.mode == 35 || rgblight_config.mode == 36) {
251 // MODE 2-5, breathing 251 // MODE 2-5, breathing
252 // MODE 6-8, rainbow mood 252 // MODE 6-8, rainbow mood
253 // MODE 9-14, rainbow swirl 253 // MODE 9-14, rainbow swirl
@@ -255,6 +255,7 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
255 // MODE 21-23, knight 255 // MODE 21-23, knight
256 // MODE 24, xmas 256 // MODE 24, xmas
257 // MODE 35 RGB test 257 // MODE 35 RGB test
258 // MODE 36, alterating
258 259
259 #ifdef RGBLIGHT_ANIMATIONS 260 #ifdef RGBLIGHT_ANIMATIONS
260 rgblight_timer_enable(); 261 rgblight_timer_enable();
@@ -591,6 +592,8 @@ void rgblight_task(void) {
591 } else if (rgblight_config.mode == 35) { 592 } else if (rgblight_config.mode == 35) {
592 // mode = 35, RGB test 593 // mode = 35, RGB test
593 rgblight_effect_rgbtest(); 594 rgblight_effect_rgbtest();
595 } else if (rgblight_config.mode == 36){
596 rgblight_effect_alternating();
594 } 597 }
595 } 598 }
596} 599}
@@ -772,4 +775,25 @@ void rgblight_effect_rgbtest(void) {
772 pos = (pos + 1) % 3; 775 pos = (pos + 1) % 3;
773} 776}
774 777
778void rgblight_effect_alternating(void){
779 static uint16_t last_timer = 0;
780 static uint16_t pos = 0;
781 if (timer_elapsed(last_timer) < 500) {
782 return;
783 }
784 last_timer = timer_read();
785
786 for(int i = 0; i<RGBLED_NUM; i++){
787 if(i<RGBLED_NUM/2 && pos){
788 rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, i);
789 }else if (i>=RGBLED_NUM/2 && !pos){
790 rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, i);
791 }else{
792 rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, 0, i);
793 }
794 }
795 rgblight_set();
796 pos = (pos + 1) % 2;
797}
798
775#endif /* RGBLIGHT_ANIMATIONS */ 799#endif /* RGBLIGHT_ANIMATIONS */
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index 0f7b5ffb5..ba010dfae 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -17,7 +17,7 @@
17#define RGBLIGHT_H 17#define RGBLIGHT_H
18 18
19#ifdef RGBLIGHT_ANIMATIONS 19#ifdef RGBLIGHT_ANIMATIONS
20 #define RGBLIGHT_MODES 35 20 #define RGBLIGHT_MODES 36
21#else 21#else
22 #define RGBLIGHT_MODES 1 22 #define RGBLIGHT_MODES 1
23#endif 23#endif
@@ -166,5 +166,6 @@ void rgblight_effect_snake(uint8_t interval);
166void rgblight_effect_knight(uint8_t interval); 166void rgblight_effect_knight(uint8_t interval);
167void rgblight_effect_christmas(void); 167void rgblight_effect_christmas(void);
168void rgblight_effect_rgbtest(void); 168void rgblight_effect_rgbtest(void);
169void rgblight_effect_alternating(void);
169 170
170#endif 171#endif