diff options
Diffstat (limited to 'quantum/rgblight.c')
| -rw-r--r-- | quantum/rgblight.c | 26 |
1 files changed, 25 insertions, 1 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 | ||
| 778 | void 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 */ |
