Merge pull request #32 from zsa/per_key_matrix_effects_part_1
Update to RGB Matrix LED structure
This commit is contained in:
@@ -109,7 +109,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define DRIVER_COUNT 2
|
||||
#define DRIVER_1_LED_TOTAL 24
|
||||
#define DRIVER_2_LED_TOTAL 24
|
||||
#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL
|
||||
#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
|
||||
|
||||
// #define RGBLIGHT_COLOR_LAYER_0 0x00, 0x00, 0xFF
|
||||
/* #define RGBLIGHT_COLOR_LAYER_1 0x00, 0x00, 0xFF */
|
||||
|
||||
@@ -269,68 +269,39 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
|
||||
};
|
||||
|
||||
|
||||
const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
|
||||
led_config_t g_led_config = { {
|
||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
|
||||
{ 28, 33, 38, 43, 47, NO_LED },
|
||||
{ 27, 32, 37, 42, 46, NO_LED },
|
||||
{ 26, 31, 36, 41, 45, NO_LED },
|
||||
{ 25, 30, 35, 40, 44, NO_LED },
|
||||
{ 24, 29, 34, 39, NO_LED, NO_LED },
|
||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
|
||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
|
||||
{ 0, 5, 10, 15, NO_LED, NO_LED },
|
||||
{ 1, 6, 11, 16, 20, NO_LED },
|
||||
{ 2, 7, 12, 17, 21, NO_LED },
|
||||
{ 3, 8, 13, 18, 22, NO_LED },
|
||||
{ 4, 9, 14, 19, 23, NO_LED },
|
||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }
|
||||
}, {
|
||||
{ 137, 0 }, { 154, 0 }, { 172, 0 }, { 189, 0 }, { 206, 0 }, { 137, 12 },
|
||||
{ 154, 12 }, { 172, 12 }, { 189, 12 }, { 206, 12 }, { 137, 25 }, { 154, 25 },
|
||||
{ 172, 25 }, { 189, 25 }, { 206, 25 }, { 137, 38 }, { 154, 38 }, { 172, 38 },
|
||||
{ 189, 38 }, { 206, 38 }, { 154, 51 }, { 172, 51 }, { 189, 51 }, { 206, 51 },
|
||||
{ 86, 0 }, { 68, 0 }, { 51, 0 }, { 34, 0 }, { 17, 0 }, { 86, 12 },
|
||||
{ 68, 12 }, { 51, 12 }, { 34, 12 }, { 17, 12 }, { 86, 25 }, { 68, 25 },
|
||||
{ 51, 25 }, { 34, 25 }, { 17, 25 }, { 86, 38 }, { 68, 38 }, { 51, 38 },
|
||||
{ 34, 38 }, { 17, 38 }, { 68, 51 }, { 51, 51 }, { 34, 51 }, { 17, 51 }
|
||||
}, {
|
||||
4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4,
|
||||
4, 4, 1, 1, 1, 1,
|
||||
4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4,
|
||||
4, 4, 1, 1, 1, 1
|
||||
} };
|
||||
|
||||
/*{row | col << 4}
|
||||
| {x=0..224, y=0..64}
|
||||
| | modifier
|
||||
| | | */
|
||||
{{ 8|(0<<4)}, {17.2* 8, 12.8*0}, 0}, // LED 1 on right > Key 6
|
||||
{{ 9|(0<<4)}, {17.2* 9, 12.8*0}, 0}, // LED 2 > Key 7
|
||||
{{10|(0<<4)}, {17.2*10, 12.8*0}, 0}, // LED 3 > Key 8
|
||||
{{11|(0<<4)}, {17.2*11, 12.8*0}, 0}, // LED 4 > Key 9
|
||||
{{12|(0<<4)}, {17.2*12, 12.8*0}, 0}, // LED 5 > Key 0
|
||||
|
||||
{{ 8|(1<<4)}, {17.2* 8, 12.8*1}, 0}, // LED 6
|
||||
{{ 9|(1<<4)}, {17.2* 9, 12.8*1}, 0}, // LED 7
|
||||
{{10|(1<<4)}, {17.2*10, 12.8*1}, 0}, // LED 8
|
||||
{{11|(1<<4)}, {17.2*11, 12.8*1}, 0}, // LED 9
|
||||
{{12|(1<<4)}, {17.2*12, 12.8*1}, 0}, // LED 10
|
||||
|
||||
{{ 8|(2<<4)}, {17.2* 8, 12.8*2}, 0}, // LED 11
|
||||
{{ 9|(2<<4)}, {17.2* 9, 12.8*2}, 0}, // LED 12
|
||||
{{10|(2<<4)}, {17.2*10, 12.8*2}, 0}, // LED 13
|
||||
{{11|(2<<4)}, {17.2*11, 12.8*2}, 0}, // LED 14
|
||||
{{12|(2<<4)}, {17.2*12, 12.8*2}, 0}, // LED 15
|
||||
|
||||
{{ 8|(3<<4)}, {17.2* 8, 12.8*3}, 0}, // LED 16
|
||||
{{ 9|(3<<4)}, {17.2* 9, 12.8*3}, 0}, // LED 17
|
||||
{{10|(3<<4)}, {17.2*10, 12.8*3}, 0}, // LED 18
|
||||
{{11|(3<<4)}, {17.2*11, 12.8*3}, 0}, // LED 19
|
||||
{{12|(3<<4)}, {17.2*12, 12.8*3}, 0}, // LED 20
|
||||
|
||||
{{ 9|(4<<4)}, {17.2* 9, 12.8*4}, 1}, // LED 21
|
||||
{{10|(4<<4)}, {17.2*10, 12.8*4}, 1}, // LED 22
|
||||
{{11|(4<<4)}, {17.2*11, 12.8*4}, 1}, // LED 23
|
||||
{{12|(4<<4)}, {17.2*12, 12.8*4}, 1}, // LED 24
|
||||
|
||||
{{ 5|(0<<4)}, {17.2* 5, 12.8*0}, 0}, // LED 1 on left > Key 5
|
||||
{{ 4|(0<<4)}, {17.2* 4, 12.8*0}, 0}, // LED 2 > Key 4
|
||||
{{ 3|(0<<4)}, {17.2* 3, 12.8*0}, 0}, // LED 3 > Key 3
|
||||
{{ 2|(0<<4)}, {17.2* 2, 12.8*0}, 0}, // LED 4 > Key 2
|
||||
{{ 1|(0<<4)}, {17.2* 1, 12.8*0}, 0}, // LED 5 > Key 1
|
||||
|
||||
{{ 5|(1<<4)}, {17.2* 5, 12.8*1}, 0}, // LED 6
|
||||
{{ 4|(1<<4)}, {17.2* 4, 12.8*1}, 0}, // LED 7
|
||||
{{ 3|(1<<4)}, {17.2* 3, 12.8*1}, 0}, // LED 8
|
||||
{{ 2|(1<<4)}, {17.2* 2, 12.8*1}, 0}, // LED 9
|
||||
{{ 1|(1<<4)}, {17.2* 1, 12.8*1}, 0}, // LED 10
|
||||
|
||||
{{ 5|(2<<4)}, {17.2* 5, 12.8*2}, 0}, // LED 11
|
||||
{{ 4|(2<<4)}, {17.2* 4, 12.8*2}, 0}, // LED 12
|
||||
{{ 3|(2<<4)}, {17.2* 3, 12.8*2}, 0}, // LED 13
|
||||
{{ 2|(2<<4)}, {17.2* 2, 12.8*2}, 0}, // LED 14
|
||||
{{ 1|(2<<4)}, {17.2* 1, 12.8*2}, 0}, // LED 15
|
||||
|
||||
{{ 5|(3<<4)}, {17.2* 5, 12.8*3}, 0}, // LED 16
|
||||
{{ 4|(3<<4)}, {17.2* 4, 12.8*3}, 0}, // LED 17
|
||||
{{ 3|(3<<4)}, {17.2* 3, 12.8*3}, 0}, // LED 18
|
||||
{{ 2|(3<<4)}, {17.2* 2, 12.8*3}, 0}, // LED 19
|
||||
{{ 1|(3<<4)}, {17.2* 1, 12.8*3}, 0}, // LED 20
|
||||
|
||||
{{ 4|(4<<4)}, {17.2* 4, 12.8*4}, 1}, // LED 21
|
||||
{{ 3|(4<<4)}, {17.2* 3, 12.8*4}, 1}, // LED 22
|
||||
{{ 2|(4<<4)}, {17.2* 2, 12.8*4}, 1}, // LED 23
|
||||
{{ 1|(4<<4)}, {17.2* 1, 12.8*4}, 1}, // LED 24 > Key Hack
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -2,3 +2,5 @@ RGBLIGHT_ENABLE = no
|
||||
RGB_MATRIX_ENABLE = yes # enable later
|
||||
|
||||
SRC += ../default/keymap.c
|
||||
|
||||
LINK_TIME_OPTIMIZATION_ENABLE = yes
|
||||
@@ -1,6 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#define RGB_MATRIX_KEYPRESSES
|
||||
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
||||
|
||||
#define DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
#define DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
#define DISABLE_RGB_MATRIX_SPLASH
|
||||
#define DISABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
|
||||
@@ -2,3 +2,6 @@ RGBLIGHT_ENABLE = no
|
||||
RGB_MATRIX_ENABLE = yes # enable later
|
||||
|
||||
SRC += ../default/keymap.c
|
||||
|
||||
LINK_TIME_OPTIMIZATION_ENABLE = yes
|
||||
COMMAND_ENABLE = no
|
||||
|
||||
@@ -139,3 +139,4 @@
|
||||
#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL
|
||||
|
||||
#define RGB_MATRIX_KEYPRESSES
|
||||
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
||||
|
||||
@@ -79,63 +79,27 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
|
||||
|
||||
};
|
||||
|
||||
const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
|
||||
led_config_t g_led_config = { {
|
||||
{ 0, 1, 2, 3, 4, 5 },
|
||||
{ 12, 13, 14, 15, 16, 17 },
|
||||
{ 24, 25, 26, 27, 28, 29 },
|
||||
{ 36, 37, 38, 45, 46, NO_LED },
|
||||
{ 6, 7, 8, 9, 10, 11 },
|
||||
{ 18, 19, 20, 21, 22, 23 },
|
||||
{ 30, 31, 32, 33, 34, 35 },
|
||||
{ 42, 43, 44, 39, 40, 41 }
|
||||
}, {
|
||||
{ 0, 0 }, { 20, 0 }, { 40, 0 }, { 61, 0 }, { 81, 0 }, { 101, 0 }, { 122, 0 }, { 142, 0 }, { 162, 0 }, { 183, 0 }, { 203, 0 }, { 223, 0 },
|
||||
{ 0, 21 }, { 20, 21 }, { 40, 21 }, { 61, 21 }, { 81, 21 }, { 101, 21 }, { 122, 21 }, { 142, 21 }, { 162, 21 }, { 183, 21 }, { 203, 21 }, { 223, 21 },
|
||||
{ 0, 42 }, { 20, 42 }, { 40, 42 }, { 61, 42 }, { 81, 42 }, { 101, 42 }, { 122, 42 }, { 142, 42 }, { 162, 42 }, { 183, 42 }, { 203, 42 }, { 223, 42 },
|
||||
{ 0, 63 }, { 20, 63 }, { 40, 63 }, { 61, 63 }, { 81, 63 }, { 111, 63 }, { 142, 63 }, { 162, 63 }, { 183, 63 }, { 203, 63 }, { 223, 63 }
|
||||
}, {
|
||||
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
|
||||
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
|
||||
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
|
||||
1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1
|
||||
} };
|
||||
|
||||
/*{row | col << 4}
|
||||
| {x=0..224, y=0..64}
|
||||
| | modifier
|
||||
| | | */
|
||||
{{0|(0<<4)}, {20.36*0, 21.33*0}, 1},
|
||||
{{0|(1<<4)}, {20.36*1, 21.33*0}, 0},
|
||||
{{0|(2<<4)}, {20.36*2, 21.33*0}, 0},
|
||||
{{0|(3<<4)}, {20.36*3, 21.33*0}, 0},
|
||||
{{0|(4<<4)}, {20.36*4, 21.33*0}, 0},
|
||||
{{0|(5<<4)}, {20.36*5, 21.33*0}, 0},
|
||||
{{4|(0<<4)}, {20.36*6, 21.33*0}, 0},
|
||||
{{4|(1<<4)}, {20.36*7, 21.33*0}, 0},
|
||||
{{4|(2<<4)}, {20.36*8, 21.33*0}, 0},
|
||||
{{4|(3<<4)}, {20.36*9, 21.33*0}, 0},
|
||||
{{4|(4<<4)}, {20.36*10,21.33*0}, 0},
|
||||
{{4|(5<<4)}, {20.36*11,21.33*0}, 1},
|
||||
|
||||
{{1|(0<<4)}, {20.36*0, 21.33*1}, 1},
|
||||
{{1|(1<<4)}, {20.36*1, 21.33*1}, 0},
|
||||
{{1|(2<<4)}, {20.36*2, 21.33*1}, 0},
|
||||
{{1|(3<<4)}, {20.36*3, 21.33*1}, 0},
|
||||
{{1|(4<<4)}, {20.36*4, 21.33*1}, 0},
|
||||
{{1|(5<<4)}, {20.36*5, 21.33*1}, 0},
|
||||
{{5|(0<<4)}, {20.36*6, 21.33*1}, 0},
|
||||
{{5|(1<<4)}, {20.36*7, 21.33*1}, 0},
|
||||
{{5|(2<<4)}, {20.36*8, 21.33*1}, 0},
|
||||
{{5|(3<<4)}, {20.36*9, 21.33*1}, 0},
|
||||
{{5|(4<<4)}, {20.36*10,21.33*1}, 0},
|
||||
{{5|(5<<4)}, {20.36*11,21.33*1}, 1},
|
||||
|
||||
{{2|(0<<4)}, {20.36*0, 21.33*2}, 1},
|
||||
{{2|(1<<4)}, {20.36*1, 21.33*2}, 0},
|
||||
{{2|(2<<4)}, {20.36*2, 21.33*2}, 0},
|
||||
{{2|(3<<4)}, {20.36*3, 21.33*2}, 0},
|
||||
{{2|(4<<4)}, {20.36*4, 21.33*2}, 0},
|
||||
{{2|(5<<4)}, {20.36*5, 21.33*2}, 0},
|
||||
{{6|(0<<4)}, {20.36*6, 21.33*2}, 0},
|
||||
{{6|(1<<4)}, {20.36*7, 21.33*2}, 0},
|
||||
{{6|(2<<4)}, {20.36*8, 21.33*2}, 0},
|
||||
{{6|(3<<4)}, {20.36*9, 21.33*2}, 0},
|
||||
{{6|(4<<4)}, {20.36*10,21.33*2}, 0},
|
||||
{{6|(5<<4)}, {20.36*11,21.33*2}, 1},
|
||||
|
||||
{{3|(0<<4)}, {20.36*0, 21.33*3}, 1},
|
||||
{{3|(1<<4)}, {20.36*1, 21.33*3}, 1},
|
||||
{{3|(2<<4)}, {20.36*2, 21.33*3}, 1},
|
||||
{{7|(3<<4)}, {20.36*3, 21.33*3}, 1},
|
||||
{{7|(4<<4)}, {20.36*4, 21.33*3}, 1},
|
||||
{{7|(5<<4)}, {20.36*5.5,21.33*3}, 0},
|
||||
{{7|(0<<4)}, {20.36*7, 21.33*3}, 1},
|
||||
{{7|(1<<4)}, {20.36*8, 21.33*3}, 1},
|
||||
{{7|(2<<4)}, {20.36*9, 21.33*3}, 1},
|
||||
{{3|(3<<4)}, {20.36*10,21.33*3}, 1},
|
||||
{{3|(4<<4)}, {20.36*11,21.33*3}, 1}
|
||||
};
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
matrix_init_user();
|
||||
|
||||
@@ -255,5 +255,30 @@ LIB8STATIC uint8_t cos8( uint8_t theta)
|
||||
return sin8( theta + 64);
|
||||
}
|
||||
|
||||
/// Fast 16-bit approximation of atan2(x).
|
||||
/// @returns atan2, value between 0 and 255
|
||||
LIB8STATIC uint8_t atan2_8(int16_t dy, int16_t dx)
|
||||
{
|
||||
if (dy == 0)
|
||||
{
|
||||
if (dx >= 0)
|
||||
return 0;
|
||||
else
|
||||
return 128;
|
||||
}
|
||||
|
||||
int16_t abs_y = dy > 0 ? dy : -dy;
|
||||
int8_t a;
|
||||
|
||||
if (dx >= 0)
|
||||
a = 32 - (32 * (dx - abs_y) / (dx + abs_y));
|
||||
else
|
||||
a = 96 - (32 * (dx + abs_y) / (abs_y - dx));
|
||||
|
||||
if (dy < 0)
|
||||
return -a; // negate if in quad III or IV
|
||||
return a;
|
||||
}
|
||||
|
||||
///@}
|
||||
#endif
|
||||
|
||||
@@ -27,9 +27,13 @@ RGB hsv_to_rgb( HSV hsv )
|
||||
|
||||
if ( hsv.s == 0 )
|
||||
{
|
||||
#ifdef USE_CIE1931_CURVE
|
||||
rgb.r = rgb.g = rgb.b = pgm_read_byte( &CIE1931_CURVE[hsv.v] );
|
||||
#else
|
||||
rgb.r = hsv.v;
|
||||
rgb.g = hsv.v;
|
||||
rgb.b = hsv.v;
|
||||
#endif
|
||||
return rgb;
|
||||
}
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
#ifdef HAPTIC_ENABLE
|
||||
process_haptic(keycode, record) &&
|
||||
#endif //HAPTIC_ENABLE
|
||||
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
|
||||
#if defined(RGB_MATRIX_ENABLE)
|
||||
process_rgb_matrix(keycode, record) &&
|
||||
#endif
|
||||
process_record_kb(keycode, record) &&
|
||||
|
||||
@@ -26,40 +26,37 @@
|
||||
|
||||
#include "lib/lib8tion/lib8tion.h"
|
||||
|
||||
#include "rgb_matrix_animations/solid_color_anim.h"
|
||||
#include "rgb_matrix_animations/alpha_mods_anim.h"
|
||||
#include "rgb_matrix_animations/dual_beacon_anim.h"
|
||||
#include "rgb_matrix_animations/gradient_up_down_anim.h"
|
||||
#include "rgb_matrix_animations/raindrops_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_all_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_left_right_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_up_down_anim.h"
|
||||
#include "rgb_matrix_animations/rainbow_beacon_anim.h"
|
||||
#include "rgb_matrix_animations/rainbow_pinwheels_anim.h"
|
||||
#include "rgb_matrix_animations/rainbow_moving_chevron_anim.h"
|
||||
#include "rgb_matrix_animations/jellybean_raindrops_anim.h"
|
||||
#include "rgb_matrix_animations/digital_rain_anim.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_simple_anim.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_anim.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_wide.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_cross.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_nexus.h"
|
||||
#include "rgb_matrix_animations/splash_anim.h"
|
||||
#include "rgb_matrix_animations/solid_splash_anim.h"
|
||||
#include "rgb_matrix_animations/breathing_anim.h"
|
||||
#ifndef RGB_MATRIX_CENTER
|
||||
const point_t k_rgb_matrix_center = { 112, 32 };
|
||||
#else
|
||||
const point_t k_rgb_matrix_center = RGB_MATRIX_CENTER;
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER)
|
||||
// Generic effect runners
|
||||
#include "rgb_matrix_runners/effect_runner_dx_dy_dist.h"
|
||||
#include "rgb_matrix_runners/effect_runner_dx_dy.h"
|
||||
#include "rgb_matrix_runners/effect_runner_i.h"
|
||||
#include "rgb_matrix_runners/effect_runner_sin_cos_i.h"
|
||||
#include "rgb_matrix_runners/effect_runner_reactive.h"
|
||||
#include "rgb_matrix_runners/effect_runner_reactive_splash.h"
|
||||
|
||||
// ------------------------------------------
|
||||
// -----Begin rgb effect includes macros-----
|
||||
#define RGB_MATRIX_EFFECT(name)
|
||||
#define RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#define RGB_MATRIX_EFFECT(name, ...)
|
||||
|
||||
#include "rgb_matrix_animations/rgb_matrix_effects.inc"
|
||||
#ifdef RGB_MATRIX_CUSTOM_KB
|
||||
#include "rgb_matrix_kb.inc"
|
||||
#endif
|
||||
#ifdef RGB_MATRIX_CUSTOM_USER
|
||||
#include "rgb_matrix_user.inc"
|
||||
#endif
|
||||
#undef RGB_MATRIX_EFFECT
|
||||
|
||||
#undef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif
|
||||
#undef RGB_MATRIX_EFFECT
|
||||
// -----End rgb effect includes macros-------
|
||||
// ------------------------------------------
|
||||
|
||||
#ifndef RGB_DISABLE_AFTER_TIMEOUT
|
||||
#define RGB_DISABLE_AFTER_TIMEOUT 0
|
||||
@@ -110,6 +107,10 @@ rgb_config_t rgb_matrix_config;
|
||||
rgb_counters_t g_rgb_counters;
|
||||
static uint32_t rgb_counters_buffer;
|
||||
|
||||
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
||||
uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}};
|
||||
#endif
|
||||
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
last_hit_t g_last_hit_tracker;
|
||||
static last_hit_t last_hit_buffer;
|
||||
@@ -150,15 +151,12 @@ uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t
|
||||
}
|
||||
|
||||
uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) {
|
||||
// TODO: This is kinda expensive, fix this soonish
|
||||
uint8_t led_count = rgb_matrix_map_row_column_to_led_kb(row, column, led_i);
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL && led_count < LED_HITS_TO_REMEMBER; i++) {
|
||||
matrix_co_t matrix_co = g_rgb_leds[i].matrix_co;
|
||||
if (row == matrix_co.row && column == matrix_co.col) {
|
||||
led_i[led_count] = i;
|
||||
uint8_t led_index = g_led_config.matrix_co[row][column];
|
||||
if (led_index != NO_LED) {
|
||||
led_i[led_count] = led_index;
|
||||
led_count++;
|
||||
}
|
||||
}
|
||||
return led_count;
|
||||
}
|
||||
|
||||
@@ -167,28 +165,11 @@ void rgb_matrix_update_pwm_buffers(void) {
|
||||
}
|
||||
|
||||
void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) {
|
||||
#ifdef RGB_MATRIX_EXTRA_TOG
|
||||
const bool is_key = g_rgb_leds[index].matrix_co.raw != 0xff;
|
||||
if (
|
||||
(rgb_matrix_config.enable == RGB_ZONE_KEYS && !is_key) ||
|
||||
(rgb_matrix_config.enable == RGB_ZONE_UNDER && is_key)
|
||||
) {
|
||||
rgb_matrix_driver.set_color(index, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
rgb_matrix_driver.set_color(index, red, green, blue);
|
||||
}
|
||||
|
||||
void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) {
|
||||
#ifdef RGB_MATRIX_EXTRA_TOG
|
||||
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
rgb_matrix_set_color(i, red, green, blue);
|
||||
}
|
||||
#else
|
||||
rgb_matrix_driver.set_color_all(red, green, blue);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
|
||||
@@ -218,13 +199,20 @@ bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
for(uint8_t i = 0; i < led_count; i++) {
|
||||
uint8_t index = last_hit_buffer.count;
|
||||
last_hit_buffer.x[index] = g_rgb_leds[led[i]].point.x;
|
||||
last_hit_buffer.y[index] = g_rgb_leds[led[i]].point.y;
|
||||
last_hit_buffer.x[index] = g_led_config.point[led[i]].x;
|
||||
last_hit_buffer.y[index] = g_led_config.point[led[i]].y;
|
||||
last_hit_buffer.index[index] = led[i];
|
||||
last_hit_buffer.tick[index] = 0;
|
||||
last_hit_buffer.count++;
|
||||
}
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
|
||||
if (rgb_matrix_config.mode == RGB_MATRIX_TYPING_HEATMAP) {
|
||||
process_rgb_matrix_typing_heatmap(record);
|
||||
}
|
||||
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -267,7 +255,7 @@ static bool rgb_matrix_none(effect_params_t* params) {
|
||||
|
||||
static uint8_t rgb_last_enable = UINT8_MAX;
|
||||
static uint8_t rgb_last_effect = UINT8_MAX;
|
||||
static effect_params_t rgb_effect_params = { 0, 0 };
|
||||
static effect_params_t rgb_effect_params = { 0, 0xFF };
|
||||
static rgb_task_states rgb_task_state = SYNCING;
|
||||
|
||||
static void rgb_task_timers(void) {
|
||||
@@ -326,136 +314,14 @@ static void rgb_task_render(uint8_t effect) {
|
||||
rendering = rgb_matrix_none(&rgb_effect_params);
|
||||
break;
|
||||
|
||||
case RGB_MATRIX_SOLID_COLOR:
|
||||
rendering = rgb_matrix_solid_color(&rgb_effect_params); // Max 1ms Avg 0ms
|
||||
// ---------------------------------------------
|
||||
// -----Begin rgb effect switch case macros-----
|
||||
#define RGB_MATRIX_EFFECT(name, ...) \
|
||||
case RGB_MATRIX_##name: \
|
||||
rendering = name(&rgb_effect_params); \
|
||||
break;
|
||||
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
case RGB_MATRIX_ALPHAS_MODS:
|
||||
rendering = rgb_matrix_alphas_mods(&rgb_effect_params); // Max 2ms Avg 1ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
case RGB_MATRIX_GRADIENT_UP_DOWN:
|
||||
rendering = rgb_matrix_gradient_up_down(&rgb_effect_params); // Max 4ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
#ifndef DISABLE_RGB_MATRIX_BREATHING
|
||||
case RGB_MATRIX_BREATHING:
|
||||
rendering = rgb_matrix_breathing(&rgb_effect_params); // Max 1ms Avg 0ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_BREATHING
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||
case RGB_MATRIX_CYCLE_ALL:
|
||||
rendering = rgb_matrix_cycle_all(&rgb_effect_params); // Max 4ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
case RGB_MATRIX_CYCLE_LEFT_RIGHT:
|
||||
rendering = rgb_matrix_cycle_left_right(&rgb_effect_params); // Max 4ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
case RGB_MATRIX_CYCLE_UP_DOWN:
|
||||
rendering = rgb_matrix_cycle_up_down(&rgb_effect_params); // Max 4ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
case RGB_MATRIX_RAINBOW_MOVING_CHEVRON:
|
||||
rendering = rgb_matrix_rainbow_moving_chevron(&rgb_effect_params); // Max 4ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||
case RGB_MATRIX_DUAL_BEACON:
|
||||
rendering = rgb_matrix_dual_beacon(&rgb_effect_params); // Max 4ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
case RGB_MATRIX_RAINBOW_BEACON:
|
||||
rendering = rgb_matrix_rainbow_beacon(&rgb_effect_params); // Max 4ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
case RGB_MATRIX_RAINBOW_PINWHEELS:
|
||||
rendering = rgb_matrix_rainbow_pinwheels(&rgb_effect_params); // Max 4ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINDROPS
|
||||
case RGB_MATRIX_RAINDROPS:
|
||||
rendering = rgb_matrix_raindrops(&rgb_effect_params); // Max 1ms Avg 0ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_RAINDROPS
|
||||
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
case RGB_MATRIX_JELLYBEAN_RAINDROPS:
|
||||
rendering = rgb_matrix_jellybean_raindrops(&rgb_effect_params); // Max 1ms Avg 0ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
#ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
case RGB_MATRIX_DIGITAL_RAIN:
|
||||
rendering = rgb_matrix_digital_rain(&rgb_effect_params); // Max 9ms Avg 8ms | this is expensive, fix it
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
case RGB_MATRIX_SOLID_REACTIVE_SIMPLE:
|
||||
rendering = rgb_matrix_solid_reactive_simple(&rgb_effect_params);// Max 4ms Avg 3ms
|
||||
break;
|
||||
#endif
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
case RGB_MATRIX_SOLID_REACTIVE:
|
||||
rendering = rgb_matrix_solid_reactive(&rgb_effect_params); // Max 4ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
case RGB_MATRIX_SOLID_REACTIVE_WIDE:
|
||||
rendering = rgb_matrix_solid_reactive_wide(&rgb_effect_params); // Max ?? ms Avg ?? ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
case RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE:
|
||||
rendering = rgb_matrix_solid_reactive_multiwide(&rgb_effect_params); // Max ?? ms Avg ?? ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
case RGB_MATRIX_SOLID_REACTIVE_CROSS:
|
||||
rendering = rgb_matrix_solid_reactive_cross(&rgb_effect_params); // Max ?? ms Avg ?? ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
case RGB_MATRIX_SOLID_REACTIVE_MULTICROSS:
|
||||
rendering = rgb_matrix_solid_reactive_multicross(&rgb_effect_params); // Max ?? ms Avg ?? ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
case RGB_MATRIX_SOLID_REACTIVE_NEXUS:
|
||||
rendering = rgb_matrix_solid_reactive_nexus(&rgb_effect_params); // Max ?? ms Avg ?? ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
case RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS:
|
||||
rendering = rgb_matrix_solid_reactive_multinexus(&rgb_effect_params); // Max ?? ms Avg ?? ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
#ifndef DISABLE_RGB_MATRIX_SPLASH
|
||||
case RGB_MATRIX_SPLASH:
|
||||
rendering = rgb_matrix_splash(&rgb_effect_params); // Max 5ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_SPLASH
|
||||
#ifndef DISABLE_RGB_MATRIX_MULTISPLASH
|
||||
case RGB_MATRIX_MULTISPLASH:
|
||||
rendering = rgb_matrix_multisplash(&rgb_effect_params); // Max 10ms Avg 5ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_MULTISPLASH
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
case RGB_MATRIX_SOLID_SPLASH:
|
||||
rendering = rgb_matrix_solid_splash(&rgb_effect_params); // Max 5ms Avg 3ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
case RGB_MATRIX_SOLID_MULTISPLASH:
|
||||
rendering = rgb_matrix_solid_multisplash(&rgb_effect_params); // Max 10ms Avg 5ms
|
||||
break;
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#include "rgb_matrix_animations/rgb_matrix_effects.inc"
|
||||
#undef RGB_MATRIX_EFFECT
|
||||
|
||||
#if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER)
|
||||
#define RGB_MATRIX_EFFECT(name, ...) \
|
||||
@@ -470,6 +336,8 @@ static void rgb_task_render(uint8_t effect) {
|
||||
#endif
|
||||
#undef RGB_MATRIX_EFFECT
|
||||
#endif
|
||||
// -----End rgb effect switch case macros-------
|
||||
// ---------------------------------------------
|
||||
|
||||
// Factory default magic value
|
||||
case UINT8_MAX: {
|
||||
@@ -580,33 +448,30 @@ void rgb_matrix_set_suspend_state(bool state) {
|
||||
}
|
||||
|
||||
void rgb_matrix_toggle(void) {
|
||||
#ifdef RGB_MATRIX_EXTRA_TOG
|
||||
rgb_matrix_config.enable++;
|
||||
#else
|
||||
rgb_matrix_config.enable ^= 1;
|
||||
if (rgb_matrix_config.enable > 1) { rgb_matrix_config.enable = 0; } // make sure that if we are treating this as a bool, that it is only 1 or 0.
|
||||
#endif
|
||||
if (!rgb_matrix_config.enable) {
|
||||
rgb_task_state = STARTING;
|
||||
}
|
||||
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
|
||||
}
|
||||
|
||||
void rgb_matrix_enable(void) {
|
||||
rgb_matrix_config.enable = 1;
|
||||
rgb_matrix_enable_noeeprom();
|
||||
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
|
||||
}
|
||||
|
||||
void rgb_matrix_enable_noeeprom(void) {
|
||||
if (!rgb_matrix_config.enable)
|
||||
rgb_task_state = STARTING;
|
||||
rgb_matrix_config.enable = 1;
|
||||
}
|
||||
|
||||
void rgb_matrix_disable(void) {
|
||||
rgb_matrix_config.enable = 0;
|
||||
rgb_matrix_disable_noeeprom();
|
||||
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
|
||||
}
|
||||
|
||||
void rgb_matrix_disable_noeeprom(void) {
|
||||
if (rgb_matrix_config.enable)
|
||||
rgb_task_state = STARTING;
|
||||
rgb_matrix_config.enable = 0;
|
||||
}
|
||||
|
||||
@@ -668,6 +533,14 @@ void rgb_matrix_decrease_speed(void) {
|
||||
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this
|
||||
}
|
||||
|
||||
led_flags_t rgb_matrix_get_flags(void) {
|
||||
return rgb_effect_params.flags;
|
||||
}
|
||||
|
||||
void rgb_matrix_set_flags(led_flags_t flags) {
|
||||
rgb_effect_params.flags = flags;
|
||||
}
|
||||
|
||||
void rgb_matrix_mode(uint8_t mode) {
|
||||
rgb_matrix_config.mode = mode;
|
||||
rgb_task_state = STARTING;
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
uint8_t max = DRIVER_LED_TOTAL;
|
||||
#endif
|
||||
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
#define RGB_MATRIX_TEST_LED_FLAGS() if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) continue
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -64,84 +64,12 @@ typedef struct
|
||||
|
||||
enum rgb_matrix_effects {
|
||||
RGB_MATRIX_NONE = 0,
|
||||
RGB_MATRIX_SOLID_COLOR = 1,
|
||||
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
RGB_MATRIX_ALPHAS_MODS,
|
||||
#endif // DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
RGB_MATRIX_GRADIENT_UP_DOWN,
|
||||
#endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
#ifndef DISABLE_RGB_MATRIX_BREATHING
|
||||
RGB_MATRIX_BREATHING,
|
||||
#endif // DISABLE_RGB_MATRIX_BREATHING
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||
RGB_MATRIX_CYCLE_ALL,
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
RGB_MATRIX_CYCLE_LEFT_RIGHT,
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
RGB_MATRIX_CYCLE_UP_DOWN,
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
RGB_MATRIX_RAINBOW_MOVING_CHEVRON,
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||
RGB_MATRIX_DUAL_BEACON,
|
||||
#endif // DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
RGB_MATRIX_RAINBOW_BEACON,
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
RGB_MATRIX_RAINBOW_PINWHEELS,
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINDROPS
|
||||
RGB_MATRIX_RAINDROPS,
|
||||
#endif // DISABLE_RGB_MATRIX_RAINDROPS
|
||||
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
RGB_MATRIX_JELLYBEAN_RAINDROPS,
|
||||
#endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
#ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
RGB_MATRIX_DIGITAL_RAIN,
|
||||
#endif // DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
RGB_MATRIX_SOLID_REACTIVE_SIMPLE,
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
RGB_MATRIX_SOLID_REACTIVE,
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
RGB_MATRIX_SOLID_REACTIVE_WIDE,
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE,
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
RGB_MATRIX_SOLID_REACTIVE_CROSS,
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
RGB_MATRIX_SOLID_REACTIVE_MULTICROSS,
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
RGB_MATRIX_SOLID_REACTIVE_NEXUS,
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS,
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
#ifndef DISABLE_RGB_MATRIX_SPLASH
|
||||
RGB_MATRIX_SPLASH,
|
||||
#endif // DISABLE_RGB_MATRIX_SPLASH
|
||||
#ifndef DISABLE_RGB_MATRIX_MULTISPLASH
|
||||
RGB_MATRIX_MULTISPLASH,
|
||||
#endif // DISABLE_RGB_MATRIX_MULTISPLASH
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
RGB_MATRIX_SOLID_SPLASH,
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
RGB_MATRIX_SOLID_MULTISPLASH,
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
// --------------------------------------
|
||||
// -----Begin rgb effect enum macros-----
|
||||
#define RGB_MATRIX_EFFECT(name, ...) RGB_MATRIX_##name,
|
||||
#include "rgb_matrix_animations/rgb_matrix_effects.inc"
|
||||
#undef RGB_MATRIX_EFFECT
|
||||
|
||||
#if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER)
|
||||
#define RGB_MATRIX_EFFECT(name, ...) RGB_MATRIX_CUSTOM_##name,
|
||||
@@ -153,6 +81,8 @@ enum rgb_matrix_effects {
|
||||
#endif
|
||||
#undef RGB_MATRIX_EFFECT
|
||||
#endif
|
||||
// --------------------------------------
|
||||
// -----End rgb effect enum macros-------
|
||||
|
||||
RGB_MATRIX_EFFECT_MAX
|
||||
};
|
||||
@@ -209,6 +139,8 @@ void rgb_matrix_increase_val(void);
|
||||
void rgb_matrix_decrease_val(void);
|
||||
void rgb_matrix_increase_speed(void);
|
||||
void rgb_matrix_decrease_speed(void);
|
||||
led_flags_t rgb_matrix_get_flags(void);
|
||||
void rgb_matrix_set_flags(led_flags_t flags);
|
||||
void rgb_matrix_mode(uint8_t mode);
|
||||
void rgb_matrix_mode_noeeprom(uint8_t mode);
|
||||
uint8_t rgb_matrix_get_mode(void);
|
||||
@@ -250,4 +182,16 @@ typedef struct {
|
||||
|
||||
extern const rgb_matrix_driver_t rgb_matrix_driver;
|
||||
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
extern bool g_suspend_state;
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern led_config_t g_led_config;
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
extern last_hit_t g_last_hit_tracker;
|
||||
#endif
|
||||
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
||||
extern uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
RGB_MATRIX_EFFECT(ALPHAS_MODS)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
// alphas = color1, mods = color2
|
||||
bool rgb_matrix_alphas_mods(effect_params_t* params) {
|
||||
bool ALPHAS_MODS(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
@@ -14,7 +12,8 @@ bool rgb_matrix_alphas_mods(effect_params_t* params) {
|
||||
RGB rgb2 = hsv_to_rgb(hsv);
|
||||
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
if (g_rgb_leds[i].modifier) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
|
||||
rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b);
|
||||
} else {
|
||||
rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b);
|
||||
@@ -23,4 +22,5 @@ bool rgb_matrix_alphas_mods(effect_params_t* params) {
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_BREATHING
|
||||
RGB_MATRIX_EFFECT(BREATHING)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_breathing(effect_params_t* params) {
|
||||
bool BREATHING(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 8);
|
||||
@@ -12,9 +10,11 @@ bool rgb_matrix_breathing(effect_params_t* params) {
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, val };
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BREATHING
|
||||
|
||||
14
quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h
Normal file
14
quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
|
||||
RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void BAND_PINWHEEL_SAT_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
hsv->s = rgb_matrix_config.sat - time - atan2_8(dy, dx) * 3;
|
||||
}
|
||||
|
||||
bool BAND_PINWHEEL_SAT(effect_params_t* params) {
|
||||
return effect_runner_dx_dy(params, &BAND_PINWHEEL_SAT_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
|
||||
14
quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h
Normal file
14
quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
|
||||
RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void BAND_PINWHEEL_VAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
hsv->v = rgb_matrix_config.val - time - atan2_8(dy, dx) * 3;
|
||||
}
|
||||
|
||||
bool BAND_PINWHEEL_VAL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy(params, &BAND_PINWHEEL_VAL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
|
||||
15
quantum/rgb_matrix_animations/colorband_sat_anim.h
Normal file
15
quantum/rgb_matrix_animations/colorband_sat_anim.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef DISABLE_RGB_MATRIX_BAND_SAT
|
||||
RGB_MATRIX_EFFECT(BAND_SAT)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void BAND_SAT_math(HSV* hsv, uint8_t i, uint8_t time) {
|
||||
int16_t s = rgb_matrix_config.sat - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
|
||||
hsv->s = s < 0 ? 0 : s;
|
||||
}
|
||||
|
||||
bool BAND_SAT(effect_params_t* params) {
|
||||
return effect_runner_i(params, &BAND_SAT_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_SAT
|
||||
14
quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h
Normal file
14
quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
|
||||
RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void BAND_SPIRAL_SAT_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv->s = rgb_matrix_config.sat + dist - time - atan2_8(dy, dx);
|
||||
}
|
||||
|
||||
bool BAND_SPIRAL_SAT(effect_params_t* params) {
|
||||
return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_SAT_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
|
||||
14
quantum/rgb_matrix_animations/colorband_spiral_val_anim.h
Normal file
14
quantum/rgb_matrix_animations/colorband_spiral_val_anim.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
|
||||
RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void BAND_SPIRAL_VAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv->v = rgb_matrix_config.val + dist - time - atan2_8(dy, dx);
|
||||
}
|
||||
|
||||
bool BAND_SPIRAL_VAL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_VAL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
|
||||
15
quantum/rgb_matrix_animations/colorband_val_anim.h
Normal file
15
quantum/rgb_matrix_animations/colorband_val_anim.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef DISABLE_RGB_MATRIX_BAND_VAL
|
||||
RGB_MATRIX_EFFECT(BAND_VAL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void BAND_VAL_math(HSV* hsv, uint8_t i, uint8_t time) {
|
||||
int16_t v = rgb_matrix_config.val - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
|
||||
hsv->v = v < 0 ? 0 : v;
|
||||
}
|
||||
|
||||
bool BAND_VAL(effect_params_t* params) {
|
||||
return effect_runner_i(params, &BAND_VAL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_VAL
|
||||
@@ -1,21 +1,15 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||
RGB_MATRIX_EFFECT(CYCLE_ALL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_cycle_all(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
hsv.h = time;
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
static void CYCLE_ALL_math(HSV* hsv, uint8_t i, uint8_t time)
|
||||
{
|
||||
hsv->h = time;
|
||||
}
|
||||
|
||||
bool CYCLE_ALL(effect_params_t* params) {
|
||||
return effect_runner_i(params, &CYCLE_ALL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_cycle_left_right(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
hsv.h = point.x - time;
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
static void CYCLE_LEFT_RIGHT_math(HSV* hsv, uint8_t i, uint8_t time) {
|
||||
hsv->h = g_led_config.point[i].x - time;
|
||||
}
|
||||
|
||||
bool CYCLE_LEFT_RIGHT(effect_params_t* params) {
|
||||
return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
|
||||
14
quantum/rgb_matrix_animations/cycle_out_in_anim.h
Normal file
14
quantum/rgb_matrix_animations/cycle_out_in_anim.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN
|
||||
RGB_MATRIX_EFFECT(CYCLE_OUT_IN)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void CYCLE_OUT_IN_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv->h = 3 * dist / 2 + time;
|
||||
}
|
||||
|
||||
bool CYCLE_OUT_IN(effect_params_t* params) {
|
||||
return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_OUT_IN
|
||||
16
quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h
Normal file
16
quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
||||
RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void CYCLE_OUT_IN_DUAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
dx = (k_rgb_matrix_center.x / 2) - abs8(dx);
|
||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||
hsv->h = 3 * dist + time;
|
||||
}
|
||||
|
||||
bool CYCLE_OUT_IN_DUAL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy(params, &CYCLE_OUT_IN_DUAL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
||||
14
quantum/rgb_matrix_animations/cycle_pinwheel_anim.h
Normal file
14
quantum/rgb_matrix_animations/cycle_pinwheel_anim.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
|
||||
RGB_MATRIX_EFFECT(CYCLE_PINWHEEL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void CYCLE_PINWHEEL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
hsv->h = atan2_8(dy, dx) + time;
|
||||
}
|
||||
|
||||
bool CYCLE_PINWHEEL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy(params, &CYCLE_PINWHEEL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
|
||||
14
quantum/rgb_matrix_animations/cycle_spiral_anim.h
Normal file
14
quantum/rgb_matrix_animations/cycle_spiral_anim.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL
|
||||
RGB_MATRIX_EFFECT(CYCLE_SPIRAL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void CYCLE_SPIRAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv->h = dist - time - atan2_8(dy, dx);
|
||||
}
|
||||
|
||||
bool CYCLE_SPIRAL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy_dist(params, &CYCLE_SPIRAL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_SPIRAL
|
||||
@@ -1,22 +1,14 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
RGB_MATRIX_EFFECT(CYCLE_UP_DOWN)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_cycle_up_down(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
hsv.h = point.y - time;
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
static void CYCLE_UP_DOWN_math(HSV* hsv, uint8_t i, uint8_t time) {
|
||||
hsv->h = g_led_config.point[i].y - time;
|
||||
}
|
||||
|
||||
bool CYCLE_UP_DOWN(effect_params_t* params) {
|
||||
return effect_runner_i(params, &CYCLE_UP_DOWN_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
|
||||
@@ -1,36 +1,37 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN)
|
||||
RGB_MATRIX_EFFECT(DIGITAL_RAIN)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
#ifndef RGB_DIGITAL_RAIN_DROPS
|
||||
// lower the number for denser effect/wider keyboard
|
||||
#define RGB_DIGITAL_RAIN_DROPS 24
|
||||
#endif
|
||||
|
||||
bool rgb_matrix_digital_rain(effect_params_t* params) {
|
||||
bool DIGITAL_RAIN(effect_params_t* params) {
|
||||
// algorithm ported from https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain
|
||||
const uint8_t drop_ticks = 28;
|
||||
const uint8_t pure_green_intensity = 0xd0;
|
||||
const uint8_t max_brightness_boost = 0xc0;
|
||||
const uint8_t max_intensity = 0xff;
|
||||
|
||||
static uint8_t map[MATRIX_COLS][MATRIX_ROWS] = {{0}};
|
||||
static uint8_t drop = 0;
|
||||
|
||||
if (params->init) {
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
memset(map, 0, sizeof map);
|
||||
memset(rgb_frame_buffer, 0, sizeof(rgb_frame_buffer));
|
||||
drop = 0;
|
||||
}
|
||||
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) {
|
||||
// top row, pixels have just fallen and we're
|
||||
// making a new rain drop in this column
|
||||
map[col][row] = max_intensity;
|
||||
rgb_frame_buffer[row][col] = max_intensity;
|
||||
}
|
||||
else if (map[col][row] > 0 && map[col][row] < max_intensity) {
|
||||
else if (rgb_frame_buffer[row][col] > 0 && rgb_frame_buffer[row][col] < max_intensity) {
|
||||
// neither fully bright nor dark, decay it
|
||||
map[col][row]--;
|
||||
rgb_frame_buffer[row][col]--;
|
||||
}
|
||||
// set the pixel colour
|
||||
uint8_t led[LED_HITS_TO_REMEMBER];
|
||||
@@ -38,32 +39,33 @@ bool rgb_matrix_digital_rain(effect_params_t* params) {
|
||||
|
||||
// TODO: multiple leds are supported mapped to the same row/column
|
||||
if (led_count > 0) {
|
||||
if (map[col][row] > pure_green_intensity) {
|
||||
const uint8_t boost = (uint8_t) ((uint16_t) max_brightness_boost * (map[col][row] - pure_green_intensity) / (max_intensity - pure_green_intensity));
|
||||
if (rgb_frame_buffer[row][col] > pure_green_intensity) {
|
||||
const uint8_t boost = (uint8_t) ((uint16_t) max_brightness_boost * (rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity));
|
||||
rgb_matrix_set_color(led[0], boost, max_intensity, boost);
|
||||
}
|
||||
else {
|
||||
const uint8_t green = (uint8_t) ((uint16_t) max_intensity * map[col][row] / pure_green_intensity);
|
||||
const uint8_t green = (uint8_t) ((uint16_t) max_intensity * rgb_frame_buffer[row][col] / pure_green_intensity);
|
||||
rgb_matrix_set_color(led[0], 0, green, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (++drop > drop_ticks) {
|
||||
// reset drop timer
|
||||
drop = 0;
|
||||
for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) {
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
// if ths is on the bottom row and bright allow decay
|
||||
if (row == MATRIX_ROWS - 1 && map[col][row] == max_intensity) {
|
||||
map[col][row]--;
|
||||
if (row == MATRIX_ROWS - 1 && rgb_frame_buffer[row][col] == max_intensity) {
|
||||
rgb_frame_buffer[row][col]--;
|
||||
}
|
||||
// check if the pixel above is bright
|
||||
if (map[col][row - 1] == max_intensity) {
|
||||
if (rgb_frame_buffer[row - 1][col] == max_intensity) {
|
||||
// allow old bright pixel to decay
|
||||
map[col][row - 1]--;
|
||||
rgb_frame_buffer[row - 1][col]--;
|
||||
// make this pixel bright
|
||||
map[col][row] = max_intensity;
|
||||
rgb_frame_buffer[row][col] = max_intensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,4 +73,5 @@ bool rgb_matrix_digital_rain(effect_params_t* params) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN)
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||
RGB_MATRIX_EFFECT(DUAL_BEACON)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_dual_beacon(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||
int8_t cos_value = cos8(time) - 128;
|
||||
int8_t sin_value = sin8(time) - 128;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
static void DUAL_BEACON_math(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||
hsv->h = ((g_led_config.point[i].y - k_rgb_matrix_center.y) * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * sin) / 128 + rgb_matrix_config.hue;
|
||||
}
|
||||
|
||||
bool DUAL_BEACON(effect_params_t* params) {
|
||||
return effect_runner_sin_cos_i(params, &DUAL_BEACON_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_gradient_up_down(effect_params_t* params) {
|
||||
bool GRADIENT_UP_DOWN(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint8_t scale = scale8(64, rgb_matrix_config.speed);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
// The y range will be 0..64, map this to 0..4
|
||||
// Relies on hue being 8-bit and wrapping
|
||||
hsv.h = rgb_matrix_config.hue + scale * (point.y >> 4);
|
||||
hsv.h = rgb_matrix_config.hue + scale * (g_led_config.point[i].y >> 4);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
static void jellybean_raindrops_set_color(int i) {
|
||||
static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
|
||||
HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val };
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
|
||||
bool rgb_matrix_jellybean_raindrops(effect_params_t* params) {
|
||||
bool JELLYBEAN_RAINDROPS(effect_params_t* params) {
|
||||
if (!params->init) {
|
||||
// Change one LED every tick, make sure speed is not 0
|
||||
if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
|
||||
jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL);
|
||||
jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
for (int i = led_min; i < led_max; i++) {
|
||||
jellybean_raindrops_set_color(i);
|
||||
jellybean_raindrops_set_color(i, params);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
RGB_MATRIX_EFFECT(RAINBOW_BEACON)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||
int16_t cos_value = 2 * (cos8(time) - 128);
|
||||
int16_t sin_value = 2 * (sin8(time) - 128);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
static void RAINBOW_BEACON_math(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||
hsv->h = ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 2 * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * 2 * sin) / 128 + rgb_matrix_config.hue;
|
||||
}
|
||||
|
||||
bool RAINBOW_BEACON(effect_params_t* params) {
|
||||
return effect_runner_sin_cos_i(params, &RAINBOW_BEACON_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
hsv.h = abs8(point.y - 32) + (point.x - time) + rgb_matrix_config.hue;
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
static void RAINBOW_MOVING_CHEVRON_math(HSV* hsv, uint8_t i, uint8_t time) {
|
||||
hsv->h = abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time) + rgb_matrix_config.hue;
|
||||
}
|
||||
|
||||
bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) {
|
||||
return effect_runner_i(params, &RAINBOW_MOVING_CHEVRON_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
RGB_MATRIX_EFFECT(PINWHEELS)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||
int16_t cos_value = 3 * (cos8(time) - 128);
|
||||
int16_t sin_value = 3 * (sin8(time) - 128);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
hsv.h = ((point.y - 32) * cos_value + (56 - abs8(point.x - 112)) * sin_value) / 128 + rgb_matrix_config.hue;
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
static void PINWHEELS_math(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||
hsv->h = ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 3 * cos + (56 - abs8(g_led_config.point[i].x - k_rgb_matrix_center.x)) * 3 * sin) / 128 + rgb_matrix_config.hue;
|
||||
}
|
||||
|
||||
bool PINWHEELS(effect_params_t* params) {
|
||||
return effect_runner_sin_cos_i(params, &PINWHEELS_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINDROPS
|
||||
#include "rgb_matrix_types.h"
|
||||
RGB_MATRIX_EFFECT(RAINDROPS)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
static void raindrops_set_color(int i) {
|
||||
static void raindrops_set_color(int i, effect_params_t* params) {
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
|
||||
HSV hsv = { 0 , rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
|
||||
// Take the shortest path between hues
|
||||
@@ -21,20 +19,21 @@ static void raindrops_set_color(int i) {
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
|
||||
bool rgb_matrix_raindrops(effect_params_t* params) {
|
||||
bool RAINDROPS(effect_params_t* params) {
|
||||
if (!params->init) {
|
||||
// Change one LED every tick, make sure speed is not 0
|
||||
if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
|
||||
raindrops_set_color(rand() % DRIVER_LED_TOTAL);
|
||||
raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
for (int i = led_min; i < led_max; i++) {
|
||||
raindrops_set_color(i);
|
||||
raindrops_set_color(i, params);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINDROPS
|
||||
|
||||
33
quantum/rgb_matrix_animations/rgb_matrix_effects.inc
Normal file
33
quantum/rgb_matrix_animations/rgb_matrix_effects.inc
Normal file
@@ -0,0 +1,33 @@
|
||||
// Add your new core rgb matrix effect here, order determins enum order, requires "rgb_matrix_animations/ directory
|
||||
#include "rgb_matrix_animations/solid_color_anim.h"
|
||||
#include "rgb_matrix_animations/alpha_mods_anim.h"
|
||||
#include "rgb_matrix_animations/gradient_up_down_anim.h"
|
||||
#include "rgb_matrix_animations/breathing_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_sat_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_val_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_pinwheel_sat_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_pinwheel_val_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_spiral_sat_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_spiral_val_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_all_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_left_right_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_up_down_anim.h"
|
||||
#include "rgb_matrix_animations/rainbow_moving_chevron_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_out_in_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_out_in_dual_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_pinwheel_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_spiral_anim.h"
|
||||
#include "rgb_matrix_animations/dual_beacon_anim.h"
|
||||
#include "rgb_matrix_animations/rainbow_beacon_anim.h"
|
||||
#include "rgb_matrix_animations/rainbow_pinwheels_anim.h"
|
||||
#include "rgb_matrix_animations/raindrops_anim.h"
|
||||
#include "rgb_matrix_animations/jellybean_raindrops_anim.h"
|
||||
#include "rgb_matrix_animations/typing_heatmap_anim.h"
|
||||
#include "rgb_matrix_animations/digital_rain_anim.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_simple_anim.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_anim.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_wide.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_cross.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_nexus.h"
|
||||
#include "rgb_matrix_animations/splash_anim.h"
|
||||
#include "rgb_matrix_animations/solid_splash_anim.h"
|
||||
@@ -1,14 +1,16 @@
|
||||
#pragma once
|
||||
RGB_MATRIX_EFFECT(SOLID_COLOR)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_solid_color(effect_params_t* params) {
|
||||
bool SOLID_COLOR(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
@@ -1,34 +1,16 @@
|
||||
#pragma once
|
||||
#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
RGB_MATRIX_EFFECT(SOLID_REACTIVE)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern last_hit_t g_last_hit_tracker;
|
||||
|
||||
bool rgb_matrix_solid_reactive(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, 255, rgb_matrix_config.val };
|
||||
// Max tick based on speed scale ensures results from scale16by8 with rgb_matrix_config.speed are no greater than 255
|
||||
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
||||
// Relies on hue being 8-bit and wrapping
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
uint16_t tick = max_tick;
|
||||
// Reverse search to find most recent key hit
|
||||
for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) {
|
||||
if (g_last_hit_tracker.index[j] == i && g_last_hit_tracker.tick[j] < tick) {
|
||||
tick = g_last_hit_tracker.tick[j];
|
||||
break;
|
||||
}
|
||||
static void SOLID_REACTIVE_math(HSV* hsv, uint16_t offset) {
|
||||
hsv->h = rgb_matrix_config.hue + qsub8(130, offset);
|
||||
}
|
||||
|
||||
uint16_t offset = scale16by8(tick, rgb_matrix_config.speed);
|
||||
hsv.h = rgb_matrix_config.hue + qsub8(130, offset);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
bool SOLID_REACTIVE(effect_params_t* params) {
|
||||
return effect_runner_reactive(params, &SOLID_REACTIVE_math);
|
||||
}
|
||||
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
@@ -1,50 +1,40 @@
|
||||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
|
||||
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern last_hit_t g_last_hit_tracker;
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
RGB_MATRIX_EFFECT(SOLID_REACTIVE_CROSS)
|
||||
#endif
|
||||
|
||||
static bool rgb_matrix_solid_reactive_multicross_range(uint8_t start, effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS)
|
||||
#endif
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
||||
uint8_t count = g_last_hit_tracker.count;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
hsv.v = 0;
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
for (uint8_t j = start; j < count; j++) {
|
||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||
int16_t dist2 = 16;
|
||||
uint8_t dist3;
|
||||
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) + dist;
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void SOLID_REACTIVE_CROSS_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
uint16_t effect = tick + dist;
|
||||
dx = dx < 0 ? dx * -1 : dx;
|
||||
dy = dy < 0 ? dy * -1 : dy;
|
||||
dx = dx * dist2 > 255 ? 255 : dx * dist2;
|
||||
dy = dy * dist2 > 255 ? 255 : dy * dist2;
|
||||
dist3 = dx > dy ? dy : dx;
|
||||
effect += dist3;
|
||||
dx = dx * 16 > 255 ? 255 : dx * 16;
|
||||
dy = dy * 16 > 255 ? 255 : dy * 16;
|
||||
effect += dx > dy ? dy : dx;
|
||||
if (effect > 255)
|
||||
effect = 255;
|
||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
||||
}
|
||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
hsv->v = qadd8(hsv->v, 255 - effect);
|
||||
}
|
||||
|
||||
bool rgb_matrix_solid_reactive_multicross(effect_params_t* params) {
|
||||
return rgb_matrix_solid_reactive_multicross_range(0, params);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
bool SOLID_REACTIVE_CROSS(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool rgb_matrix_solid_reactive_cross(effect_params_t* params) {
|
||||
return rgb_matrix_solid_reactive_multicross_range(qsub8(g_last_hit_tracker.count, 1), params);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
@@ -1,48 +1,40 @@
|
||||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
|
||||
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern last_hit_t g_last_hit_tracker;
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
RGB_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS)
|
||||
#endif
|
||||
|
||||
static bool rgb_matrix_solid_reactive_multinexus_range(uint8_t start, effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS)
|
||||
#endif
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
||||
uint8_t count = g_last_hit_tracker.count;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
hsv.v = 0;
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
for (uint8_t j = start; j < count; j++) {
|
||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||
int16_t dist2 = 8;
|
||||
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist;
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void SOLID_REACTIVE_NEXUS_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
uint16_t effect = tick - dist;
|
||||
if (effect > 255)
|
||||
effect = 255;
|
||||
if (dist > 72)
|
||||
effect = 255;
|
||||
if ((dx > dist2 || dx < -dist2) && (dy > dist2 || dy < -dist2))
|
||||
if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8))
|
||||
effect = 255;
|
||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
||||
hsv.h = rgb_matrix_config.hue + dy / 4;
|
||||
}
|
||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
hsv->v = qadd8(hsv->v, 255 - effect);
|
||||
hsv->h = rgb_matrix_config.hue + dy / 4;
|
||||
}
|
||||
|
||||
bool rgb_matrix_solid_reactive_multinexus(effect_params_t* params) {
|
||||
return rgb_matrix_solid_reactive_multinexus_range(0, params);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
bool SOLID_REACTIVE_NEXUS(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool rgb_matrix_solid_reactive_nexus(effect_params_t* params) {
|
||||
return rgb_matrix_solid_reactive_multinexus_range(qsub8(g_last_hit_tracker.count, 1), params);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
@@ -1,33 +1,16 @@
|
||||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern last_hit_t g_last_hit_tracker;
|
||||
|
||||
bool rgb_matrix_solid_reactive_simple(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
||||
// Max tick based on speed scale ensures results from scale16by8 with rgb_matrix_config.speed are no greater than 255
|
||||
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
uint16_t tick = max_tick;
|
||||
// Reverse search to find most recent key hit
|
||||
for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) {
|
||||
if (g_last_hit_tracker.index[j] == i && g_last_hit_tracker.tick[j] < tick) {
|
||||
tick = g_last_hit_tracker.tick[j];
|
||||
break;
|
||||
}
|
||||
static void SOLID_REACTIVE_SIMPLE_math(HSV* hsv, uint16_t offset) {
|
||||
hsv->v = scale8(255 - offset, rgb_matrix_config.val);
|
||||
}
|
||||
|
||||
uint16_t offset = scale16by8(tick, rgb_matrix_config.speed);
|
||||
hsv.v = scale8(255 - offset, rgb_matrix_config.val);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) {
|
||||
return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
@@ -1,42 +1,35 @@
|
||||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
|
||||
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern last_hit_t g_last_hit_tracker;
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
RGB_MATRIX_EFFECT(SOLID_REACTIVE_WIDE)
|
||||
#endif
|
||||
|
||||
static bool rgb_matrix_solid_reactive_multiwide_range(uint8_t start, effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE)
|
||||
#endif
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
||||
uint8_t count = g_last_hit_tracker.count;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
hsv.v = 0;
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
for (uint8_t j = start; j < count; j++) {
|
||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) + dist * 5;
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void SOLID_REACTIVE_WIDE_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
uint16_t effect = tick + dist * 5;
|
||||
if (effect > 255)
|
||||
effect = 255;
|
||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
||||
}
|
||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
hsv->v = qadd8(hsv->v, 255 - effect);
|
||||
}
|
||||
|
||||
bool rgb_matrix_solid_reactive_multiwide(effect_params_t* params) {
|
||||
return rgb_matrix_solid_reactive_multiwide_range(0, params);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
bool SOLID_REACTIVE_WIDE(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool rgb_matrix_solid_reactive_wide(effect_params_t* params) {
|
||||
return rgb_matrix_solid_reactive_multiwide_range(qsub8(g_last_hit_tracker.count, 1), params);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
@@ -1,42 +1,35 @@
|
||||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH)
|
||||
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern last_hit_t g_last_hit_tracker;
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
RGB_MATRIX_EFFECT(SOLID_SPLASH)
|
||||
#endif
|
||||
|
||||
static bool rgb_matrix_solid_multisplash_range(uint8_t start, effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
RGB_MATRIX_EFFECT(SOLID_MULTISPLASH)
|
||||
#endif
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
||||
uint8_t count = g_last_hit_tracker.count;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
hsv.v = 0;
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
for (uint8_t j = start; j < count; j++) {
|
||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist;
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
void SOLID_SPLASH_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
uint16_t effect = tick - dist;
|
||||
if (effect > 255)
|
||||
effect = 255;
|
||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
||||
}
|
||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
hsv->v = qadd8(hsv->v, 255 - effect);
|
||||
}
|
||||
|
||||
bool rgb_matrix_solid_multisplash(effect_params_t* params) {
|
||||
return rgb_matrix_solid_multisplash_range(0, params);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
bool SOLID_SPLASH(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool rgb_matrix_solid_splash(effect_params_t* params) {
|
||||
return rgb_matrix_solid_multisplash_range(qsub8(g_last_hit_tracker.count, 1), params);
|
||||
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
bool SOLID_MULTISPLASH(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) && !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
@@ -1,44 +1,36 @@
|
||||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern last_hit_t g_last_hit_tracker;
|
||||
#ifndef DISABLE_RGB_MATRIX_SPLASH
|
||||
RGB_MATRIX_EFFECT(SPLASH)
|
||||
#endif
|
||||
|
||||
static bool rgb_matrix_multisplash_range(uint8_t start, effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
#ifndef DISABLE_RGB_MATRIX_MULTISPLASH
|
||||
RGB_MATRIX_EFFECT(MULTISPLASH)
|
||||
#endif
|
||||
|
||||
HSV hsv = { 0, rgb_matrix_config.sat, 0 };
|
||||
uint8_t count = g_last_hit_tracker.count;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
hsv.h = rgb_matrix_config.hue;
|
||||
hsv.v = 0;
|
||||
point_t point = g_rgb_leds[i].point;
|
||||
for (uint8_t j = start; j < count; j++) {
|
||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist;
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
void SPLASH_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
uint16_t effect = tick - dist;
|
||||
if (effect > 255)
|
||||
effect = 255;
|
||||
hsv.h += effect;
|
||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
||||
}
|
||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
hsv->h += effect;
|
||||
hsv->v = qadd8(hsv->v, 255 - effect);
|
||||
}
|
||||
|
||||
bool rgb_matrix_multisplash(effect_params_t* params) {
|
||||
return rgb_matrix_multisplash_range(0, params);
|
||||
#ifndef DISABLE_RGB_MATRIX_SPLASH
|
||||
bool SPLASH(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SPLASH_math);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool rgb_matrix_splash(effect_params_t* params) {
|
||||
return rgb_matrix_multisplash_range(qsub8(g_last_hit_tracker.count, 1), params);
|
||||
#ifndef DISABLE_RGB_MATRIX_MULTISPLASH
|
||||
bool MULTISPLASH(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(0, params, &SPLASH_math);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
74
quantum/rgb_matrix_animations/typing_heatmap_anim.h
Normal file
74
quantum/rgb_matrix_animations/typing_heatmap_anim.h
Normal file
@@ -0,0 +1,74 @@
|
||||
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
|
||||
RGB_MATRIX_EFFECT(TYPING_HEATMAP)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
void process_rgb_matrix_typing_heatmap(keyrecord_t *record) {
|
||||
uint8_t row = record->event.key.row;
|
||||
uint8_t col = record->event.key.col;
|
||||
uint8_t m_row = row - 1;
|
||||
uint8_t p_row = row + 1;
|
||||
uint8_t m_col = col - 1;
|
||||
uint8_t p_col = col + 1;
|
||||
|
||||
if (m_col < col)
|
||||
rgb_frame_buffer[row][m_col] = qadd8(rgb_frame_buffer[row][m_col], 16);
|
||||
rgb_frame_buffer[row][col] = qadd8(rgb_frame_buffer[row][col], 32);
|
||||
if (p_col < MATRIX_COLS)
|
||||
rgb_frame_buffer[row][p_col] = qadd8(rgb_frame_buffer[row][p_col], 16);
|
||||
|
||||
if (p_row < MATRIX_ROWS) {
|
||||
if (m_col < col)
|
||||
rgb_frame_buffer[p_row][m_col] = qadd8(rgb_frame_buffer[p_row][m_col], 13);
|
||||
rgb_frame_buffer[p_row][col] = qadd8(rgb_frame_buffer[p_row][col], 16);
|
||||
if (p_col < MATRIX_COLS)
|
||||
rgb_frame_buffer[p_row][p_col] = qadd8(rgb_frame_buffer[p_row][p_col], 13);
|
||||
}
|
||||
|
||||
if (m_row < row) {
|
||||
if (m_col < col)
|
||||
rgb_frame_buffer[m_row][m_col] = qadd8(rgb_frame_buffer[m_row][m_col], 13);
|
||||
rgb_frame_buffer[m_row][col] = qadd8(rgb_frame_buffer[m_row][col], 16);
|
||||
if (p_col < MATRIX_COLS)
|
||||
rgb_frame_buffer[m_row][p_col] = qadd8(rgb_frame_buffer[m_row][p_col], 13);
|
||||
}
|
||||
}
|
||||
|
||||
bool TYPING_HEATMAP(effect_params_t* params) {
|
||||
// Modified version of RGB_MATRIX_USE_LIMITS to work off of matrix row / col size
|
||||
uint8_t led_min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter;
|
||||
uint8_t led_max = led_min + RGB_MATRIX_LED_PROCESS_LIMIT;
|
||||
if (led_max > sizeof(rgb_frame_buffer))
|
||||
led_max = sizeof(rgb_frame_buffer);
|
||||
|
||||
if (params->init) {
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
memset(rgb_frame_buffer, 0, sizeof rgb_frame_buffer);
|
||||
}
|
||||
|
||||
// Render heatmap & decrease
|
||||
for (int i = led_min; i < led_max; i++) {
|
||||
uint8_t row = i % MATRIX_ROWS;
|
||||
uint8_t col = i / MATRIX_ROWS;
|
||||
uint8_t val = rgb_frame_buffer[row][col];
|
||||
|
||||
// set the pixel colour
|
||||
uint8_t led[LED_HITS_TO_REMEMBER];
|
||||
uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led);
|
||||
for (uint8_t j = 0; j < led_count; ++j)
|
||||
{
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[led[j]], params->flags))
|
||||
continue;
|
||||
|
||||
HSV hsv = { 170 - qsub8(val, 85), rgb_matrix_config.sat, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.val) };
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
|
||||
rgb_frame_buffer[row][col] = qsub8(val, 1);
|
||||
}
|
||||
|
||||
return led_max < sizeof(rgb_frame_buffer);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
|
||||
19
quantum/rgb_matrix_runners/effect_runner_dx_dy.h
Normal file
19
quantum/rgb_matrix_runners/effect_runner_dx_dy.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
typedef void (*dx_dy_f)(HSV* hsv, int16_t dx, int16_t dy, uint8_t time);
|
||||
|
||||
bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
|
||||
int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
|
||||
effect_func(&hsv, dx, dy, time);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
20
quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h
Normal file
20
quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
typedef void (*dx_dy_dist_f)(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time);
|
||||
|
||||
bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
|
||||
int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
|
||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||
effect_func(&hsv, dx, dy, dist, time);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
17
quantum/rgb_matrix_runners/effect_runner_i.h
Normal file
17
quantum/rgb_matrix_runners/effect_runner_i.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
typedef void (*i_f)(HSV* hsv, uint8_t i, uint8_t time);
|
||||
|
||||
bool effect_runner_i(effect_params_t* params, i_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
effect_func(&hsv, i, time);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
31
quantum/rgb_matrix_runners/effect_runner_reactive.h
Normal file
31
quantum/rgb_matrix_runners/effect_runner_reactive.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
typedef void (*reactive_f)(HSV* hsv, uint16_t offset);
|
||||
|
||||
bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
uint16_t tick = max_tick;
|
||||
// Reverse search to find most recent key hit
|
||||
for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) {
|
||||
if (g_last_hit_tracker.index[j] == i && g_last_hit_tracker.tick[j] < tick) {
|
||||
tick = g_last_hit_tracker.tick[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t offset = scale16by8(tick, rgb_matrix_config.speed);
|
||||
effect_func(&hsv, offset);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
30
quantum/rgb_matrix_runners/effect_runner_reactive_splash.h
Normal file
30
quantum/rgb_matrix_runners/effect_runner_reactive_splash.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
typedef void (*reactive_splash_f)(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick);
|
||||
|
||||
bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, reactive_splash_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { 0, rgb_matrix_config.sat, 0 };
|
||||
uint8_t count = g_last_hit_tracker.count;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
hsv.h = rgb_matrix_config.hue;
|
||||
hsv.v = 0;
|
||||
for (uint8_t j = start; j < count; j++) {
|
||||
int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j];
|
||||
int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j];
|
||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||
uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed);
|
||||
effect_func(&hsv, dx, dy, dist, tick);
|
||||
}
|
||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
19
quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h
Normal file
19
quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
typedef void (*sin_cos_i_f)(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time);
|
||||
|
||||
bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||
int8_t cos_value = cos8(time) - 128;
|
||||
int8_t sin_value = sin8(time) - 128;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
effect_func(&hsv, cos_value, sin_value, i, time);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
@@ -59,26 +59,22 @@ typedef struct PACKED {
|
||||
uint8_t y;
|
||||
} point_t;
|
||||
|
||||
typedef union {
|
||||
uint8_t raw;
|
||||
struct {
|
||||
uint8_t row:4; // 16 max
|
||||
uint8_t col:4; // 16 max
|
||||
};
|
||||
} matrix_co_t;
|
||||
#define HAS_FLAGS(bits, flags) ((bits & flags) == flags)
|
||||
#define HAS_ANY_FLAGS(bits, flags) ((bits & flags) != 0x00)
|
||||
|
||||
#define LED_FLAG_ALL 0xFF
|
||||
#define LED_FLAG_NONE 0x00
|
||||
#define LED_FLAG_MODIFIER 0x01
|
||||
#define LED_FLAG_UNDERGLOW 0x02
|
||||
#define LED_FLAG_KEYLIGHT 0x04
|
||||
|
||||
#define NO_LED 255
|
||||
|
||||
typedef struct PACKED {
|
||||
matrix_co_t matrix_co;
|
||||
point_t point;
|
||||
uint8_t modifier:1;
|
||||
} rgb_led;
|
||||
|
||||
typedef enum {
|
||||
RGB_ZONE_OFF = 0,
|
||||
RGB_ZONE_ALL,
|
||||
RGB_ZONE_KEYS,
|
||||
RGB_ZONE_UNDER,
|
||||
} rgb_zone_t;
|
||||
uint8_t matrix_co[MATRIX_ROWS][MATRIX_COLS];
|
||||
point_t point[DRIVER_LED_TOTAL];
|
||||
uint8_t flags[DRIVER_LED_TOTAL];
|
||||
} led_config_t;
|
||||
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
|
||||
@@ -27,8 +27,6 @@ led_instruction_t led_instructions[] = { { .end = 1 } };
|
||||
static void led_matrix_massdrop_config_override(int i);
|
||||
#endif // USE_MASSDROP_CONFIGURATOR
|
||||
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
|
||||
void SERCOM1_0_Handler( void )
|
||||
{
|
||||
@@ -438,14 +436,14 @@ static void led_matrix_massdrop_config_override(int i)
|
||||
float bo = 0;
|
||||
|
||||
float po = (led_animation_orientation)
|
||||
? (float)g_rgb_leds[i].point.y / 64.f * 100
|
||||
: (float)g_rgb_leds[i].point.x / 224.f * 100;
|
||||
? (float)g_led_config.point[i].y / 64.f * 100
|
||||
: (float)g_led_config.point[i].x / 224.f * 100;
|
||||
|
||||
uint8_t highest_active_layer = biton32(layer_state);
|
||||
|
||||
if (led_lighting_mode == LED_MODE_KEYS_ONLY && g_rgb_leds[i].matrix_co.raw == 0xff) {
|
||||
if (led_lighting_mode == LED_MODE_KEYS_ONLY && HAS_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) {
|
||||
//Do not act on this LED
|
||||
} else if (led_lighting_mode == LED_MODE_NON_KEYS_ONLY && g_rgb_leds[i].matrix_co.raw != 0xff) {
|
||||
} else if (led_lighting_mode == LED_MODE_NON_KEYS_ONLY && !HAS_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) {
|
||||
//Do not act on this LED
|
||||
} else if (led_lighting_mode == LED_MODE_INDICATORS_ONLY) {
|
||||
//Do not act on this LED (Only show indicators)
|
||||
|
||||
Reference in New Issue
Block a user