1
0
Fork 0

Add rgblight mode 35 (R,G,B test mode) (#3114)

* add rgblight mode 35 (RGB cyclic mode) into quantum/rgblight.c

* Update docs, add rgblight mode 35(RGB cyclic)

* rename RGBCYCLIC to RGBTEST
This commit is contained in:
Takeshi ISHII 2018-06-05 00:10:39 +09:00 committed by Drashna Jaelre
parent cb91320d6d
commit 5229734647
6 changed files with 48 additions and 5 deletions

View file

@ -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 */