diff options
-rw-r--r-- | docs/feature_rgblight.md | 1 | ||||
-rw-r--r-- | docs/keycodes.md | 1 | ||||
-rw-r--r-- | quantum/quantum.c | 7 | ||||
-rw-r--r-- | quantum/quantum_keycodes.h | 2 | ||||
-rw-r--r-- | quantum/rgblight.c | 38 | ||||
-rw-r--r-- | quantum/rgblight.h | 4 |
6 files changed, 48 insertions, 5 deletions
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md index 5369d2fb7..e0918d11b 100644 --- a/docs/feature_rgblight.md +++ b/docs/feature_rgblight.md | |||
@@ -146,6 +146,7 @@ These control the RGB Lighting functionality. | |||
146 | |`RGB_MODE_KNIGHT` |`RGB_M_K` |"Knight Rider" animation mode | | 146 | |`RGB_MODE_KNIGHT` |`RGB_M_K` |"Knight Rider" animation mode | |
147 | |`RGB_MODE_XMAS` |`RGB_M_X` |Christmas animation mode | | 147 | |`RGB_MODE_XMAS` |`RGB_M_X` |Christmas animation mode | |
148 | |`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode | | 148 | |`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode | |
149 | |`RGB_MODE_RGBTEST `|`RGB_M_T` |Red,Green,Blue test animation mode | | ||
149 | 150 | ||
150 | note: for backwards compatibility, `RGB_SMOD` is an alias for `RGB_MOD`. | 151 | note: for backwards compatibility, `RGB_SMOD` is an alias for `RGB_MOD`. |
151 | 152 | ||
diff --git a/docs/keycodes.md b/docs/keycodes.md index 9a5f6e2b3..ca81d02b6 100644 --- a/docs/keycodes.md +++ b/docs/keycodes.md | |||
@@ -283,6 +283,7 @@ This is a reference only. Each group of keys links to the page documenting their | |||
283 | |`RGB_MODE_KNIGHT` |`RGB_M_K` |"Knight Rider" animation mode | | 283 | |`RGB_MODE_KNIGHT` |`RGB_M_K` |"Knight Rider" animation mode | |
284 | |`RGB_MODE_XMAS` |`RGB_M_X` |Christmas animation mode | | 284 | |`RGB_MODE_XMAS` |`RGB_M_X` |Christmas animation mode | |
285 | |`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode | | 285 | |`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode | |
286 | |`RGB_MODE_RGBTEST` |`RGB_M_T` |Red,Green,Blue test animation mode | | ||
286 | 287 | ||
287 | ## [RGB Matrix Lighting](feature_rgb_matrix.md) | 288 | ## [RGB Matrix Lighting](feature_rgb_matrix.md) |
288 | 289 | ||
diff --git a/quantum/quantum.c b/quantum/quantum.c index f9b3e2197..cfa3df741 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
@@ -442,7 +442,12 @@ bool process_record_quantum(keyrecord_t *record) { | |||
442 | } | 442 | } |
443 | } | 443 | } |
444 | return false; | 444 | return false; |
445 | #endif | 445 | case RGB_MODE_RGBTEST: |
446 | if (record->event.pressed) { | ||
447 | rgblight_mode(35); | ||
448 | } | ||
449 | return false; | ||
450 | #endif // defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | ||
446 | #ifdef PROTOCOL_LUFA | 451 | #ifdef PROTOCOL_LUFA |
447 | case OUT_AUTO: | 452 | case OUT_AUTO: |
448 | if (record->event.pressed) { | 453 | if (record->event.pressed) { |
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 405741eb1..f2cdb8a3b 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h | |||
@@ -423,6 +423,7 @@ enum quantum_keycodes { | |||
423 | RGB_MODE_KNIGHT, | 423 | RGB_MODE_KNIGHT, |
424 | RGB_MODE_XMAS, | 424 | RGB_MODE_XMAS, |
425 | RGB_MODE_GRADIENT, | 425 | RGB_MODE_GRADIENT, |
426 | RGB_MODE_RGBTEST, | ||
426 | 427 | ||
427 | // Left shift, open paren | 428 | // Left shift, open paren |
428 | KC_LSPO, | 429 | KC_LSPO, |
@@ -586,6 +587,7 @@ enum quantum_keycodes { | |||
586 | #define RGB_M_K RGB_MODE_KNIGHT | 587 | #define RGB_M_K RGB_MODE_KNIGHT |
587 | #define RGB_M_X RGB_MODE_XMAS | 588 | #define RGB_M_X RGB_MODE_XMAS |
588 | #define RGB_M_G RGB_MODE_GRADIENT | 589 | #define RGB_M_G RGB_MODE_GRADIENT |
590 | #define RGB_M_T RGB_MODE_RGBTEST | ||
589 | 591 | ||
590 | // L-ayer, T-ap - 256 keycode max, 16 layer max | 592 | // L-ayer, T-ap - 256 keycode max, 16 layer max |
591 | #define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8)) | 593 | #define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8)) |
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index db66e735b..8b2a3cd9f 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
@@ -42,6 +42,8 @@ __attribute__ ((weak)) | |||
42 | const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31}; | 42 | const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31}; |
43 | __attribute__ ((weak)) | 43 | __attribute__ ((weak)) |
44 | const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90}; | 44 | const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90}; |
45 | __attribute__ ((weak)) | ||
46 | const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024}; | ||
45 | 47 | ||
46 | rgblight_config_t rgblight_config; | 48 | rgblight_config_t rgblight_config; |
47 | 49 | ||
@@ -238,14 +240,15 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { | |||
238 | #ifdef RGBLIGHT_ANIMATIONS | 240 | #ifdef RGBLIGHT_ANIMATIONS |
239 | rgblight_timer_disable(); | 241 | rgblight_timer_disable(); |
240 | #endif | 242 | #endif |
241 | } else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 24) { | 243 | } else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) || |
244 | rgblight_config.mode == 35 ) { | ||
242 | // MODE 2-5, breathing | 245 | // MODE 2-5, breathing |
243 | // MODE 6-8, rainbow mood | 246 | // MODE 6-8, rainbow mood |
244 | // MODE 9-14, rainbow swirl | 247 | // MODE 9-14, rainbow swirl |
245 | // MODE 15-20, snake | 248 | // MODE 15-20, snake |
246 | // MODE 21-23, knight | 249 | // MODE 21-23, knight |
247 | // MODE 24, xmas | 250 | // MODE 24, xmas |
248 | // MODE 25-34, static rainbow | 251 | // MODE 35 RGB test |
249 | 252 | ||
250 | #ifdef RGBLIGHT_ANIMATIONS | 253 | #ifdef RGBLIGHT_ANIMATIONS |
251 | rgblight_timer_enable(); | 254 | rgblight_timer_enable(); |
@@ -579,6 +582,9 @@ void rgblight_task(void) { | |||
579 | } else if (rgblight_config.mode == 24) { | 582 | } else if (rgblight_config.mode == 24) { |
580 | // mode = 24, christmas mode | 583 | // mode = 24, christmas mode |
581 | rgblight_effect_christmas(); | 584 | rgblight_effect_christmas(); |
585 | } else if (rgblight_config.mode == 35) { | ||
586 | // mode = 35, RGB test | ||
587 | rgblight_effect_rgbtest(); | ||
582 | } | 588 | } |
583 | } | 589 | } |
584 | } | 590 | } |
@@ -734,4 +740,30 @@ void rgblight_effect_christmas(void) { | |||
734 | rgblight_set(); | 740 | rgblight_set(); |
735 | } | 741 | } |
736 | 742 | ||
737 | #endif | 743 | void rgblight_effect_rgbtest(void) { |
744 | static uint8_t pos = 0; | ||
745 | static uint16_t last_timer = 0; | ||
746 | static uint8_t maxval = 0; | ||
747 | uint8_t g; uint8_t r; uint8_t b; | ||
748 | |||
749 | if (timer_elapsed(last_timer) < pgm_read_word(&RGBLED_RGBTEST_INTERVALS[0])) { | ||
750 | return; | ||
751 | } | ||
752 | |||
753 | if( maxval == 0 ) { | ||
754 | LED_TYPE tmp_led; | ||
755 | sethsv(0, 255, RGBLIGHT_LIMIT_VAL, &tmp_led); | ||
756 | maxval = tmp_led.r; | ||
757 | } | ||
758 | last_timer = timer_read(); | ||
759 | g = r = b = 0; | ||
760 | switch( pos ) { | ||
761 | case 0: r = maxval; break; | ||
762 | case 1: g = maxval; break; | ||
763 | case 2: b = maxval; break; | ||
764 | } | ||
765 | rgblight_setrgb(r, g, b); | ||
766 | pos = (pos + 1) % 3; | ||
767 | } | ||
768 | |||
769 | #endif /* RGBLIGHT_ANIMATIONS */ | ||
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 569424506..e9c192a4e 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 34 | 20 | #define RGBLIGHT_MODES 35 |
21 | #else | 21 | #else |
22 | #define RGBLIGHT_MODES 1 | 22 | #define RGBLIGHT_MODES 1 |
23 | #endif | 23 | #endif |
@@ -83,6 +83,7 @@ extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM; | |||
83 | extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM; | 83 | extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM; |
84 | extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM; | 84 | extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM; |
85 | extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM; | 85 | extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM; |
86 | extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM; | ||
86 | 87 | ||
87 | typedef union { | 88 | typedef union { |
88 | uint32_t raw; | 89 | uint32_t raw; |
@@ -160,5 +161,6 @@ void rgblight_effect_rainbow_swirl(uint8_t interval); | |||
160 | void rgblight_effect_snake(uint8_t interval); | 161 | void rgblight_effect_snake(uint8_t interval); |
161 | void rgblight_effect_knight(uint8_t interval); | 162 | void rgblight_effect_knight(uint8_t interval); |
162 | void rgblight_effect_christmas(void); | 163 | void rgblight_effect_christmas(void); |
164 | void rgblight_effect_rgbtest(void); | ||
163 | 165 | ||
164 | #endif | 166 | #endif |