aboutsummaryrefslogtreecommitdiff
path: root/quantum/rgb_matrix.c
diff options
context:
space:
mode:
authoryiancar <yiangosyiangou@cytanet.com.cy>2018-05-09 04:23:21 +0100
committerJack Humbert <jack.humb@gmail.com>2018-05-08 23:23:21 -0400
commitafacd42368e0dc7627a695508f15598b38429c63 (patch)
tree8228c3f9974282e0f8f506bcce5489616ce3e684 /quantum/rgb_matrix.c
parent23df5fb89a05ead778b25fe1e586e47df6209c6d (diff)
downloadqmk_firmware-afacd42368e0dc7627a695508f15598b38429c63.tar.gz
qmk_firmware-afacd42368e0dc7627a695508f15598b38429c63.zip
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..
Diffstat (limited to 'quantum/rgb_matrix.c')
-rw-r--r--quantum/rgb_matrix.c18
1 files changed, 15 insertions, 3 deletions
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) {
69 rgb_matrix_config.hue = 0; 69 rgb_matrix_config.hue = 0;
70 rgb_matrix_config.sat = 255; 70 rgb_matrix_config.sat = 255;
71 rgb_matrix_config.val = 255; 71 rgb_matrix_config.val = 255;
72 rgb_matrix_config.speed = 0;
72 eeconfig_update_rgb_matrix(rgb_matrix_config.raw); 73 eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
73} 74}
74void eeconfig_debug_rgb_matrix(void) { 75void eeconfig_debug_rgb_matrix(void) {
@@ -78,6 +79,7 @@ void eeconfig_debug_rgb_matrix(void) {
78 dprintf("rgb_matrix_config.hue = %d\n", rgb_matrix_config.hue); 79 dprintf("rgb_matrix_config.hue = %d\n", rgb_matrix_config.hue);
79 dprintf("rgb_matrix_config.sat = %d\n", rgb_matrix_config.sat); 80 dprintf("rgb_matrix_config.sat = %d\n", rgb_matrix_config.sat);
80 dprintf("rgb_matrix_config.val = %d\n", rgb_matrix_config.val); 81 dprintf("rgb_matrix_config.val = %d\n", rgb_matrix_config.val);
82 dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed);
81} 83}
82 84
83// Last led hit 85// Last led hit
@@ -343,7 +345,7 @@ void rgb_matrix_raindrops(bool initialize) {
343} 345}
344 346
345void rgb_matrix_cycle_all(void) { 347void rgb_matrix_cycle_all(void) {
346 uint8_t offset = g_tick & 0xFF; 348 uint8_t offset = ( g_tick << rgb_matrix_config.speed ) & 0xFF;
347 349
348 rgb_led led; 350 rgb_led led;
349 351
@@ -364,7 +366,7 @@ void rgb_matrix_cycle_all(void) {
364} 366}
365 367
366void rgb_matrix_cycle_left_right(void) { 368void rgb_matrix_cycle_left_right(void) {
367 uint8_t offset = g_tick & 0xFF; 369 uint8_t offset = ( g_tick << rgb_matrix_config.speed ) & 0xFF;
368 HSV hsv = { .h = 0, .s = 255, .v = rgb_matrix_config.val }; 370 HSV hsv = { .h = 0, .s = 255, .v = rgb_matrix_config.val };
369 RGB rgb; 371 RGB rgb;
370 Point point; 372 Point point;
@@ -388,7 +390,7 @@ void rgb_matrix_cycle_left_right(void) {
388} 390}
389 391
390void rgb_matrix_cycle_up_down(void) { 392void rgb_matrix_cycle_up_down(void) {
391 uint8_t offset = g_tick & 0xFF; 393 uint8_t offset = ( g_tick << rgb_matrix_config.speed ) & 0xFF;
392 HSV hsv = { .h = 0, .s = 255, .v = rgb_matrix_config.val }; 394 HSV hsv = { .h = 0, .s = 255, .v = rgb_matrix_config.val };
393 RGB rgb; 395 RGB rgb;
394 Point point; 396 Point point;
@@ -863,6 +865,16 @@ void rgblight_decrease_val(void) {
863 eeconfig_update_rgb_matrix(rgb_matrix_config.raw); 865 eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
864} 866}
865 867
868void rgblight_increase_speed(void) {
869 rgb_matrix_config.speed = increment( rgb_matrix_config.speed, 1, 0, 3 );
870 eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this
871}
872
873void rgblight_decrease_speed(void) {
874 rgb_matrix_config.speed = decrement( rgb_matrix_config.speed, 1, 0, 3 );
875 eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this
876}
877
866void rgblight_mode(uint8_t mode) { 878void rgblight_mode(uint8_t mode) {
867 rgb_matrix_config.mode = mode; 879 rgb_matrix_config.mode = mode;
868 eeconfig_update_rgb_matrix(rgb_matrix_config.raw); 880 eeconfig_update_rgb_matrix(rgb_matrix_config.raw);