summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/quantum.c7
-rw-r--r--quantum/quantum_keycodes.h2
-rw-r--r--quantum/rgblight.c38
-rw-r--r--quantum/rgblight.h4
4 files changed, 46 insertions, 5 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index f9b3e2197d..cfa3df7418 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -442,7 +442,12 @@ bool process_record_quantum(keyrecord_t *record) {
}
}
return false;
- #endif
+ case RGB_MODE_RGBTEST:
+ if (record->event.pressed) {
+ rgblight_mode(35);
+ }
+ return false;
+ #endif // defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
#ifdef PROTOCOL_LUFA
case OUT_AUTO:
if (record->event.pressed) {
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 405741eb15..f2cdb8a3bf 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -423,6 +423,7 @@ enum quantum_keycodes {
RGB_MODE_KNIGHT,
RGB_MODE_XMAS,
RGB_MODE_GRADIENT,
+ RGB_MODE_RGBTEST,
// Left shift, open paren
KC_LSPO,
@@ -586,6 +587,7 @@ enum quantum_keycodes {
#define RGB_M_K RGB_MODE_KNIGHT
#define RGB_M_X RGB_MODE_XMAS
#define RGB_M_G RGB_MODE_GRADIENT
+#define RGB_M_T RGB_MODE_RGBTEST
// L-ayer, T-ap - 256 keycode max, 16 layer max
#define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8))
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index db66e735bb..8b2a3cd9f8 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -42,6 +42,8 @@ __attribute__ ((weak))
const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31};
__attribute__ ((weak))
const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
+__attribute__ ((weak))
+const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024};
rgblight_config_t rgblight_config;
@@ -238,14 +240,15 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
#ifdef RGBLIGHT_ANIMATIONS
rgblight_timer_disable();
#endif
- } else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 24) {
+ } else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) ||
+ rgblight_config.mode == 35 ) {
// MODE 2-5, breathing
// MODE 6-8, rainbow mood
// MODE 9-14, rainbow swirl
// MODE 15-20, snake
// MODE 21-23, knight
// MODE 24, xmas
- // MODE 25-34, static rainbow
+ // MODE 35 RGB test
#ifdef RGBLIGHT_ANIMATIONS
rgblight_timer_enable();
@@ -579,6 +582,9 @@ void rgblight_task(void) {
} else if (rgblight_config.mode == 24) {
// mode = 24, christmas mode
rgblight_effect_christmas();
+ } else if (rgblight_config.mode == 35) {
+ // mode = 35, RGB test
+ rgblight_effect_rgbtest();
}
}
}
@@ -734,4 +740,30 @@ void rgblight_effect_christmas(void) {
rgblight_set();
}
-#endif
+void rgblight_effect_rgbtest(void) {
+ static uint8_t pos = 0;
+ static uint16_t last_timer = 0;
+ static uint8_t maxval = 0;
+ uint8_t g; uint8_t r; uint8_t b;
+
+ if (timer_elapsed(last_timer) < pgm_read_word(&RGBLED_RGBTEST_INTERVALS[0])) {
+ return;
+ }
+
+ if( maxval == 0 ) {
+ LED_TYPE tmp_led;
+ sethsv(0, 255, RGBLIGHT_LIMIT_VAL, &tmp_led);
+ maxval = tmp_led.r;
+ }
+ last_timer = timer_read();
+ g = r = b = 0;
+ switch( pos ) {
+ case 0: r = maxval; break;
+ case 1: g = maxval; break;
+ case 2: b = maxval; break;
+ }
+ rgblight_setrgb(r, g, b);
+ pos = (pos + 1) % 3;
+}
+
+#endif /* RGBLIGHT_ANIMATIONS */
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index 569424506b..e9c192a4ed 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -17,7 +17,7 @@
#define RGBLIGHT_H
#ifdef RGBLIGHT_ANIMATIONS
- #define RGBLIGHT_MODES 34
+ #define RGBLIGHT_MODES 35
#else
#define RGBLIGHT_MODES 1
#endif
@@ -83,6 +83,7 @@ extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM;
extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM;
extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM;
extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM;
+extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM;
typedef union {
uint32_t raw;
@@ -160,5 +161,6 @@ void rgblight_effect_rainbow_swirl(uint8_t interval);
void rgblight_effect_snake(uint8_t interval);
void rgblight_effect_knight(uint8_t interval);
void rgblight_effect_christmas(void);
+void rgblight_effect_rgbtest(void);
#endif