From afacd42368e0dc7627a695508f15598b38429c63 Mon Sep 17 00:00:00 2001 From: yiancar Date: Wed, 9 May 2018 04:23:21 +0100 Subject: Add effect speed support for RGB Matrix *No EEPROM yet* (#2922) * Added Modular keyboards L,R and NUM Created code modules for the 3 modules of the modular keyboard. Original idea by MechboardsUK. Uses i2c implementation similar to lets split * Remove modular from master This is to fix incorrect branching * Add effect speed support for RGB Matrix *No eeprom yet* Keycodes RGB_SPI and RGB_SPD have been added to increase and decrease effect speed. Speed is not saved in EEPROM yet as per Jack's request. * Update rgb_matrix.c * RGB Matrix speed fix rgblight.h * More fixes for rgb speed. Speed functions declared but not used in rgblight * More travis fixes.. * Another one for travis.. --- quantum/rgb_matrix.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'quantum/rgb_matrix.c') diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 6cb0478f7..558e28dec 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c @@ -69,6 +69,7 @@ void eeconfig_update_rgb_matrix_default(void) { rgb_matrix_config.hue = 0; rgb_matrix_config.sat = 255; rgb_matrix_config.val = 255; + rgb_matrix_config.speed = 0; eeconfig_update_rgb_matrix(rgb_matrix_config.raw); } void eeconfig_debug_rgb_matrix(void) { @@ -78,6 +79,7 @@ void eeconfig_debug_rgb_matrix(void) { dprintf("rgb_matrix_config.hue = %d\n", rgb_matrix_config.hue); dprintf("rgb_matrix_config.sat = %d\n", rgb_matrix_config.sat); dprintf("rgb_matrix_config.val = %d\n", rgb_matrix_config.val); + dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed); } // Last led hit @@ -343,7 +345,7 @@ void rgb_matrix_raindrops(bool initialize) { } void rgb_matrix_cycle_all(void) { - uint8_t offset = g_tick & 0xFF; + uint8_t offset = ( g_tick << rgb_matrix_config.speed ) & 0xFF; rgb_led led; @@ -364,7 +366,7 @@ void rgb_matrix_cycle_all(void) { } void rgb_matrix_cycle_left_right(void) { - uint8_t offset = g_tick & 0xFF; + uint8_t offset = ( g_tick << rgb_matrix_config.speed ) & 0xFF; HSV hsv = { .h = 0, .s = 255, .v = rgb_matrix_config.val }; RGB rgb; Point point; @@ -388,7 +390,7 @@ void rgb_matrix_cycle_left_right(void) { } void rgb_matrix_cycle_up_down(void) { - uint8_t offset = g_tick & 0xFF; + uint8_t offset = ( g_tick << rgb_matrix_config.speed ) & 0xFF; HSV hsv = { .h = 0, .s = 255, .v = rgb_matrix_config.val }; RGB rgb; Point point; @@ -863,6 +865,16 @@ void rgblight_decrease_val(void) { eeconfig_update_rgb_matrix(rgb_matrix_config.raw); } +void rgblight_increase_speed(void) { + rgb_matrix_config.speed = increment( rgb_matrix_config.speed, 1, 0, 3 ); + eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this +} + +void rgblight_decrease_speed(void) { + rgb_matrix_config.speed = decrement( rgb_matrix_config.speed, 1, 0, 3 ); + eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this +} + void rgblight_mode(uint8_t mode) { rgb_matrix_config.mode = mode; eeconfig_update_rgb_matrix(rgb_matrix_config.raw); -- cgit v1.2.3-24-g4f1b