1
0
Fork 0

Cleanup/rgb matrix (#5811)

* clean up rgb matrix extern usage

Moved rgb matrix boiler plate into macros

Rebased onto typing heatmap pr

* Fixing the reversed frame buffer access in digital rain

* Fixing digital rain & typing heatmap if keyreactive effects are not enabled

* Apply suggestions from code review

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Adding parenthesizes to DRIVER_LED_TOTAL where necessary

* Updated docs

* added notes about parentheses
This commit is contained in:
XScorpion2 2019-05-10 18:55:02 -05:00 committed by MechMerlin
parent febaf9dec4
commit 62ba66d618
48 changed files with 222 additions and 442 deletions

View file

@ -30,9 +30,11 @@ Configure the hardware via your `config.h`:
#define DRIVER_COUNT 2 #define DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 25 #define DRIVER_1_LED_TOTAL 25
#define DRIVER_2_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)
``` ```
!> Note the parentheses, this is so when `DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)` will give very different results than `rand() % DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL`.
Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations. Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations.
Define these arrays listing all the LEDs in your `<keyboard>.c`: Define these arrays listing all the LEDs in your `<keyboard>.c`:

View file

@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
#define _LAYER0 0 #define _LAYER0 0
#define _LAYER1 1 #define _LAYER1 1
#define _LAYER2 2 #define _LAYER2 2
@ -32,7 +31,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
extern led_config_t g_led_config;
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) { for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {

View file

@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
#define _LAYER0 0 #define _LAYER0 0
#define _LAYER1 1 #define _LAYER1 1
#define _LAYER2 2 #define _LAYER2 2
@ -53,7 +52,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
extern led_config_t g_led_config;
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) { for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {

View file

@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
#define _LAYER0 0 #define _LAYER0 0
#define _LAYER1 1 #define _LAYER1 1
#define _LAYER2 2 #define _LAYER2 2
@ -38,7 +37,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
}; };
extern led_config_t g_led_config;
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) { for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {

View file

@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
#define _LAYER0 0 #define _LAYER0 0
#define _LAYER1 1 #define _LAYER1 1
#define _LAYER2 2 #define _LAYER2 2

View file

@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
#define _LAYER0 0 #define _LAYER0 0
#define _LAYER1 1 #define _LAYER1 1
#define _LAYER2 2 #define _LAYER2 2
@ -39,7 +38,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
extern led_config_t g_led_config;
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) { for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {

View file

@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
#define _LAYER0 0 #define _LAYER0 0
#define _LAYER1 1 #define _LAYER1 1
#define _LAYER2 2 #define _LAYER2 2
@ -39,7 +38,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS), KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS),
}; };
extern led_config_t g_led_config;
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) { for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {

View file

@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
#define _LAYER0 0 #define _LAYER0 0
#define _LAYER1 1 #define _LAYER1 1
#define _LAYER2 2 #define _LAYER2 2
@ -38,7 +37,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
}; };
extern led_config_t g_led_config;
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) { for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {

View file

@ -1,6 +1,5 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
enum dz60rgb_layers { enum dz60rgb_layers {
_QWERTY, _QWERTY,
@ -26,7 +25,6 @@ enum dz60rgb_keycodes {
#define _V_V_V_ KC_TRNS #define _V_V_V_ KC_TRNS
#define LT_CAPS LT(_NAV, KC_CAPS) #define LT_CAPS LT(_NAV, KC_CAPS)
#define LT_DEL LT(_RGB, KC_DEL) #define LT_DEL LT(_RGB, KC_DEL)
extern rgb_config_t rgb_matrix_config;
extern bool autoshift_enabled; extern bool autoshift_enabled;
#define MT_SLSH RSFT_T(KC_SLSH) #define MT_SLSH RSFT_T(KC_SLSH)
#define MT_APP RALT_T(KC_APP) #define MT_APP RALT_T(KC_APP)

View file

@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
#define _LAYER0 0 #define _LAYER0 0
#define _LAYER1 1 #define _LAYER1 1
#define _LAYER2 2 #define _LAYER2 2
@ -50,8 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
extern led_config_t g_led_config; void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) {
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) { for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
rgb_matrix_set_color( i, red, green, blue ); rgb_matrix_set_color( i, red, green, blue );

View file

@ -26,4 +26,4 @@
#define DRIVER_COUNT 2 #define DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 35 #define DRIVER_1_LED_TOTAL 35
#define DRIVER_2_LED_TOTAL 33 #define DRIVER_2_LED_TOTAL 33
#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)

View file

@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
#define _LAYER0 0 #define _LAYER0 0
#define _LAYER1 1 #define _LAYER1 1
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

View file

@ -107,7 +107,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DRIVER_COUNT 2 #define DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 24 #define DRIVER_1_LED_TOTAL 24
#define DRIVER_2_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_0 0x00, 0x00, 0xFF
/* #define RGBLIGHT_COLOR_LAYER_1 0x00, 0x00, 0xFF */ /* #define RGBLIGHT_COLOR_LAYER_1 0x00, 0x00, 0xFF */

View file

@ -134,4 +134,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DRIVER_2_LED_TOTAL 32 #define DRIVER_2_LED_TOTAL 32
#endif #endif
#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)

View file

@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
extern bool g_suspend_state;
enum ctrl_layers { enum ctrl_layers {
_QWERTY, _QWERTY,
@ -31,7 +30,6 @@ enum ctrl_keycodes {
#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode #define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
#define LT_CAPS LT(_NAV, KC_CAPS) #define LT_CAPS LT(_NAV, KC_CAPS)
#define _V_V_V_ KC_TRNS #define _V_V_V_ KC_TRNS
extern rgb_config_t rgb_matrix_config;
extern bool autoshift_enabled; extern bool autoshift_enabled;

View file

@ -224,10 +224,6 @@ bool music_mask_user(uint16_t keycode) {
} }
} }
#ifdef RGB_MATRIX_ENABLE
extern led_config_t g_led_config;
#endif
void rgb_matrix_indicators_user(void) { void rgb_matrix_indicators_user(void) {
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
switch (biton32(layer_state)) { switch (biton32(layer_state)) {

View file

@ -39,7 +39,7 @@
#define DRIVER_COUNT 2 #define DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 25 #define DRIVER_1_LED_TOTAL 25
#define DRIVER_2_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)
#endif #endif

View file

@ -92,7 +92,6 @@ static void render_logo(void) {
oled_write_P(sol_logo, false); oled_write_P(sol_logo, false);
} }
extern rgb_config_t rgb_matrix_config;
static void render_status(void) { static void render_status(void) {
// Render to mode icon // Render to mode icon

View file

@ -24,10 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define UC(x) KC_NO # define UC(x) KC_NO
#endif #endif
#ifdef RGB_MATRIX_ENABLE
extern bool g_suspend_state;
extern rgb_config_t rgb_matrix_config;
#endif
extern userspace_config_t userspace_config; extern userspace_config_t userspace_config;
enum more_custom_keycodes { enum more_custom_keycodes {
@ -403,7 +399,6 @@ void suspend_wakeup_init_keymap(void) {
rgb_matrix_set_suspend_state(false); rgb_matrix_set_suspend_state(false);
} }
extern led_config_t g_led_config;
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) { for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {

View file

@ -17,10 +17,6 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include "drashna.h" #include "drashna.h"
#ifdef RGB_MATRIX_ENABLE
extern bool g_suspend_state;
extern rgb_config_t rgb_matrix_config;
#endif
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
extern rgblight_config_t rgblight_config; extern rgblight_config_t rgblight_config;
#endif #endif
@ -184,7 +180,6 @@ void suspend_wakeup_init_keymap(void) {
rgb_matrix_set_suspend_state(false); rgb_matrix_set_suspend_state(false);
} }
extern led_config_t g_led_config;
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) { void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) { for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {

View file

@ -258,7 +258,7 @@ bool process_record_quantum(keyrecord_t *record) {
#ifdef HAPTIC_ENABLE #ifdef HAPTIC_ENABLE
process_haptic(keycode, record) && process_haptic(keycode, record) &&
#endif //HAPTIC_ENABLE #endif //HAPTIC_ENABLE
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_KEYREACTIVE_ENABLED) #if defined(RGB_MATRIX_ENABLE)
process_rgb_matrix(keycode, record) && process_rgb_matrix(keycode, record) &&
#endif #endif
process_record_kb(keycode, record) && process_record_kb(keycode, record) &&

View file

@ -26,41 +26,23 @@
#include "lib/lib8tion/lib8tion.h" #include "lib/lib8tion/lib8tion.h"
#include "rgb_matrix_animations/solid_color_anim.h" // ------------------------------------------
#include "rgb_matrix_animations/alpha_mods_anim.h" // -----Begin rgb effect includes macros-----
#include "rgb_matrix_animations/dual_beacon_anim.h" #define RGB_MATRIX_EFFECT(name)
#include "rgb_matrix_animations/gradient_up_down_anim.h" #define RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#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/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"
#include "rgb_matrix_animations/breathing_anim.h"
#if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER) #include "rgb_matrix_animations/rgb_matrix_effects.inc"
#define RGB_MATRIX_CUSTOM_EFFECT_IMPLS #ifdef RGB_MATRIX_CUSTOM_KB
#define RGB_MATRIX_EFFECT(name, ...)
#ifdef RGB_MATRIX_CUSTOM_KB
#include "rgb_matrix_kb.inc" #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 #endif
#ifdef RGB_MATRIX_CUSTOM_USER
#include "rgb_matrix_user.inc"
#endif
#undef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#undef RGB_MATRIX_EFFECT
// -----End rgb effect includes macros-------
// ------------------------------------------
#ifndef RGB_DISABLE_AFTER_TIMEOUT #ifndef RGB_DISABLE_AFTER_TIMEOUT
#define RGB_DISABLE_AFTER_TIMEOUT 0 #define RGB_DISABLE_AFTER_TIMEOUT 0
@ -106,7 +88,6 @@
bool g_suspend_state = false; bool g_suspend_state = false;
extern led_config_t g_led_config;
rgb_config_t rgb_matrix_config; rgb_config_t rgb_matrix_config;
rgb_counters_t g_rgb_counters; rgb_counters_t g_rgb_counters;
@ -319,145 +300,14 @@ static void rgb_task_render(uint8_t effect) {
rendering = rgb_matrix_none(&rgb_effect_params); rendering = rgb_matrix_none(&rgb_effect_params);
break; 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; break;
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS #include "rgb_matrix_animations/rgb_matrix_effects.inc"
case RGB_MATRIX_ALPHAS_MODS: #undef RGB_MATRIX_EFFECT
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
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
#ifndef DISABLE_RGB_MATRIX_TYPING_HEATMAP
case RGB_MATRIX_TYPING_HEATMAP:
rendering = rgb_matrix_typing_heatmap(&rgb_effect_params); // Max 4ms Avg 3ms
break;
#endif // DISABLE_RGB_MATRIX_TYPING_HEATMAP
#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
#endif // RGB_MATRIX_FRAMEBUFFER_EFFECTS
#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
#if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER) #if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER)
#define RGB_MATRIX_EFFECT(name, ...) \ #define RGB_MATRIX_EFFECT(name, ...) \
@ -472,6 +322,8 @@ static void rgb_task_render(uint8_t effect) {
#endif #endif
#undef RGB_MATRIX_EFFECT #undef RGB_MATRIX_EFFECT
#endif #endif
// -----End rgb effect switch case macros-------
// ---------------------------------------------
// Factory default magic value // Factory default magic value
case UINT8_MAX: { case UINT8_MAX: {

View file

@ -64,89 +64,12 @@ typedef struct
enum rgb_matrix_effects { enum rgb_matrix_effects {
RGB_MATRIX_NONE = 0, RGB_MATRIX_NONE = 0,
RGB_MATRIX_SOLID_COLOR = 1,
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS // --------------------------------------
RGB_MATRIX_ALPHAS_MODS, // -----Begin rgb effect enum macros-----
#endif // DISABLE_RGB_MATRIX_ALPHAS_MODS #define RGB_MATRIX_EFFECT(name, ...) RGB_MATRIX_##name,
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN #include "rgb_matrix_animations/rgb_matrix_effects.inc"
RGB_MATRIX_GRADIENT_UP_DOWN, #undef RGB_MATRIX_EFFECT
#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
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
#ifndef DISABLE_RGB_MATRIX_TYPING_HEATMAP
RGB_MATRIX_TYPING_HEATMAP,
#endif // DISABLE_RGB_MATRIX_TYPING_HEATMAP
#ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
RGB_MATRIX_DIGITAL_RAIN,
#endif // DISABLE_RGB_MATRIX_DIGITAL_RAIN
#endif // RGB_MATRIX_FRAMEBUFFER_EFFECTS
#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
#if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER) #if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER)
#define RGB_MATRIX_EFFECT(name, ...) RGB_MATRIX_CUSTOM_##name, #define RGB_MATRIX_EFFECT(name, ...) RGB_MATRIX_CUSTOM_##name,
@ -158,6 +81,8 @@ enum rgb_matrix_effects {
#endif #endif
#undef RGB_MATRIX_EFFECT #undef RGB_MATRIX_EFFECT
#endif #endif
// --------------------------------------
// -----End rgb effect enum macros-------
RGB_MATRIX_EFFECT_MAX RGB_MATRIX_EFFECT_MAX
}; };
@ -257,4 +182,16 @@ typedef struct {
extern const rgb_matrix_driver_t rgb_matrix_driver; 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 #endif

View file

@ -1,11 +1,9 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS #ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
RGB_MATRIX_EFFECT(ALPHAS_MODS)
extern led_config_t g_led_config; #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern rgb_config_t rgb_matrix_config;
// alphas = color1, mods = color2 // 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); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
@ -24,4 +22,5 @@ bool rgb_matrix_alphas_mods(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_ALPHAS_MODS #endif // DISABLE_RGB_MATRIX_ALPHAS_MODS

View file

@ -1,10 +1,8 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_BREATHING #ifndef DISABLE_RGB_MATRIX_BREATHING
RGB_MATRIX_EFFECT(BREATHING)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern rgb_counters_t g_rgb_counters; bool BREATHING(effect_params_t* params) {
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_breathing(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 8); uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 8);
@ -18,4 +16,5 @@ bool rgb_matrix_breathing(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_BREATHING #endif // DISABLE_RGB_MATRIX_BREATHING

View file

@ -1,11 +1,8 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL #ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
RGB_MATRIX_EFFECT(CYCLE_ALL)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern rgb_counters_t g_rgb_counters; bool CYCLE_ALL(effect_params_t* params) {
extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_cycle_all(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val }; HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
@ -18,4 +15,5 @@ bool rgb_matrix_cycle_all(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_CYCLE_ALL #endif // DISABLE_RGB_MATRIX_CYCLE_ALL

View file

@ -1,11 +1,8 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT #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; bool CYCLE_LEFT_RIGHT(effect_params_t* params) {
extern led_config_t g_led_config;
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); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val }; HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
@ -19,4 +16,5 @@ bool rgb_matrix_cycle_left_right(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT #endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT

View file

@ -1,11 +1,8 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN #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; bool CYCLE_UP_DOWN(effect_params_t* params) {
extern led_config_t g_led_config;
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); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val }; HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
@ -19,4 +16,5 @@ bool rgb_matrix_cycle_up_down(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN #endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN

View file

@ -1,14 +1,13 @@
#pragma once
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(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 #ifndef RGB_DIGITAL_RAIN_DROPS
// lower the number for denser effect/wider keyboard // lower the number for denser effect/wider keyboard
#define RGB_DIGITAL_RAIN_DROPS 24 #define RGB_DIGITAL_RAIN_DROPS 24
#endif #endif
extern uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS]; bool DIGITAL_RAIN(effect_params_t* params) {
bool rgb_matrix_digital_rain(effect_params_t* params) {
// algorithm ported from https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain // algorithm ported from https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain
const uint8_t drop_ticks = 28; const uint8_t drop_ticks = 28;
const uint8_t pure_green_intensity = 0xd0; const uint8_t pure_green_intensity = 0xd0;
@ -19,7 +18,7 @@ bool rgb_matrix_digital_rain(effect_params_t* params) {
if (params->init) { if (params->init) {
rgb_matrix_set_color_all(0, 0, 0); rgb_matrix_set_color_all(0, 0, 0);
memset(rgb_frame_buffer, 0, sizeof rgb_frame_buffer); memset(rgb_frame_buffer, 0, sizeof(rgb_frame_buffer));
drop = 0; drop = 0;
} }
@ -28,11 +27,11 @@ bool rgb_matrix_digital_rain(effect_params_t* params) {
if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) { if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) {
// top row, pixels have just fallen and we're // top row, pixels have just fallen and we're
// making a new rain drop in this column // making a new rain drop in this column
rgb_frame_buffer[col][row] = max_intensity; rgb_frame_buffer[row][col] = max_intensity;
} }
else if (rgb_frame_buffer[col][row] > 0 && rgb_frame_buffer[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 // neither fully bright nor dark, decay it
rgb_frame_buffer[col][row]--; rgb_frame_buffer[row][col]--;
} }
// set the pixel colour // set the pixel colour
uint8_t led[LED_HITS_TO_REMEMBER]; uint8_t led[LED_HITS_TO_REMEMBER];
@ -40,12 +39,12 @@ bool rgb_matrix_digital_rain(effect_params_t* params) {
// TODO: multiple leds are supported mapped to the same row/column // TODO: multiple leds are supported mapped to the same row/column
if (led_count > 0) { if (led_count > 0) {
if (rgb_frame_buffer[col][row] > 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[col][row] - pure_green_intensity) / (max_intensity - 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); rgb_matrix_set_color(led[0], boost, max_intensity, boost);
} }
else { else {
const uint8_t green = (uint8_t) ((uint16_t) max_intensity * rgb_frame_buffer[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); rgb_matrix_set_color(led[0], 0, green, 0);
} }
} }
@ -58,15 +57,15 @@ bool rgb_matrix_digital_rain(effect_params_t* params) {
for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) { for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) {
for (uint8_t col = 0; col < MATRIX_COLS; col++) { for (uint8_t col = 0; col < MATRIX_COLS; col++) {
// if ths is on the bottom row and bright allow decay // if ths is on the bottom row and bright allow decay
if (row == MATRIX_ROWS - 1 && rgb_frame_buffer[col][row] == max_intensity) { if (row == MATRIX_ROWS - 1 && rgb_frame_buffer[row][col] == max_intensity) {
rgb_frame_buffer[col][row]--; rgb_frame_buffer[row][col]--;
} }
// check if the pixel above is bright // check if the pixel above is bright
if (rgb_frame_buffer[col][row - 1] == max_intensity) { if (rgb_frame_buffer[row - 1][col] == max_intensity) {
// allow old bright pixel to decay // allow old bright pixel to decay
rgb_frame_buffer[col][row - 1]--; rgb_frame_buffer[row - 1][col]--;
// make this pixel bright // make this pixel bright
rgb_frame_buffer[col][row] = max_intensity; rgb_frame_buffer[row][col] = max_intensity;
} }
} }
} }
@ -74,4 +73,5 @@ bool rgb_matrix_digital_rain(effect_params_t* params) {
return false; return false;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN) #endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN)

View file

@ -1,11 +1,8 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON #ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
RGB_MATRIX_EFFECT(DUAL_BEACON)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern rgb_counters_t g_rgb_counters; bool DUAL_BEACON(effect_params_t* params) {
extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_dual_beacon(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val }; HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
@ -21,4 +18,5 @@ bool rgb_matrix_dual_beacon(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_DUAL_BEACON #endif // DISABLE_RGB_MATRIX_DUAL_BEACON

View file

@ -1,10 +1,8 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN #ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern led_config_t g_led_config; bool GRADIENT_UP_DOWN(effect_params_t* params) {
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_gradient_up_down(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val }; HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
@ -19,4 +17,6 @@ bool rgb_matrix_gradient_up_down(effect_params_t* params) {
} }
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN #endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN

View file

@ -1,9 +1,6 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS #ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
extern rgb_counters_t g_rgb_counters; #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
static void jellybean_raindrops_set_color(int i, effect_params_t* params) { static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
@ -12,7 +9,7 @@ static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); 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) { if (!params->init) {
// Change one LED every tick, make sure speed is not 0 // 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) { if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
@ -28,4 +25,5 @@ bool rgb_matrix_jellybean_raindrops(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS #endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS

View file

@ -1,11 +1,8 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON #ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
RGB_MATRIX_EFFECT(RAINBOW_BEACON)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern rgb_counters_t g_rgb_counters; bool RAINBOW_BEACON(effect_params_t* params) {
extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val }; HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
@ -21,4 +18,5 @@ bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON #endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON

View file

@ -1,11 +1,8 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON #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; bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) {
extern led_config_t g_led_config;
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); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val }; HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
@ -19,4 +16,5 @@ bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON #endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON

View file

@ -1,11 +1,8 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS #ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
RGB_MATRIX_EFFECT(PINWHEELS)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern rgb_counters_t g_rgb_counters; bool PINWHEELS(effect_params_t* params) {
extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val }; HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
@ -21,4 +18,5 @@ bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS #endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS

View file

@ -1,10 +1,6 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_RAINDROPS #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 led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
static void raindrops_set_color(int i, effect_params_t* params) { static void raindrops_set_color(int i, effect_params_t* params) {
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
@ -23,7 +19,7 @@ static void raindrops_set_color(int i, effect_params_t* params) {
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); 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) { if (!params->init) {
// Change one LED every tick, make sure speed is not 0 // 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) { if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
@ -39,4 +35,5 @@ bool rgb_matrix_raindrops(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_RAINDROPS #endif // DISABLE_RGB_MATRIX_RAINDROPS

View file

@ -0,0 +1,23 @@
// 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/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/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"

View file

@ -1,9 +1,7 @@
#pragma once RGB_MATRIX_EFFECT(SOLID_COLOR)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern led_config_t g_led_config; bool SOLID_COLOR(effect_params_t* params) {
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_solid_color(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val }; HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
@ -14,3 +12,5 @@ bool rgb_matrix_solid_color(effect_params_t* params) {
} }
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS

View file

@ -1,12 +1,9 @@
#pragma once #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
RGB_MATRIX_EFFECT(SOLID_REACTIVE)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern led_config_t g_led_config; bool SOLID_REACTIVE(effect_params_t* params) {
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); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { rgb_matrix_config.hue, 255, rgb_matrix_config.val }; HSV hsv = { rgb_matrix_config.hue, 255, rgb_matrix_config.val };
@ -32,5 +29,6 @@ bool rgb_matrix_solid_reactive(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) #endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -1,10 +1,15 @@
#pragma once
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
extern led_config_t g_led_config; #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
extern rgb_config_t rgb_matrix_config; RGB_MATRIX_EFFECT(SOLID_REACTIVE_CROSS)
extern last_hit_t g_last_hit_tracker; #endif
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS)
#endif
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
static bool rgb_matrix_solid_reactive_multicross_range(uint8_t start, effect_params_t* params) { static bool rgb_matrix_solid_reactive_multicross_range(uint8_t start, effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
@ -38,13 +43,14 @@ static bool rgb_matrix_solid_reactive_multicross_range(uint8_t start, effect_par
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
bool rgb_matrix_solid_reactive_multicross(effect_params_t* params) { bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) {
return rgb_matrix_solid_reactive_multicross_range(0, params); return rgb_matrix_solid_reactive_multicross_range(0, params);
} }
bool rgb_matrix_solid_reactive_cross(effect_params_t* params) { bool SOLID_REACTIVE_CROSS(effect_params_t* params) {
return rgb_matrix_solid_reactive_multicross_range(qsub8(g_last_hit_tracker.count, 1), params); return rgb_matrix_solid_reactive_multicross_range(qsub8(g_last_hit_tracker.count, 1), params);
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) #endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED #endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -1,10 +1,15 @@
#pragma once
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
extern led_config_t g_led_config; #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
extern rgb_config_t rgb_matrix_config; RGB_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS)
extern last_hit_t g_last_hit_tracker; #endif
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS)
#endif
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
static bool rgb_matrix_solid_reactive_multinexus_range(uint8_t start, effect_params_t* params) { static bool rgb_matrix_solid_reactive_multinexus_range(uint8_t start, effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
@ -36,13 +41,14 @@ static bool rgb_matrix_solid_reactive_multinexus_range(uint8_t start, effect_par
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
bool rgb_matrix_solid_reactive_multinexus(effect_params_t* params) { bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) {
return rgb_matrix_solid_reactive_multinexus_range(0, params); return rgb_matrix_solid_reactive_multinexus_range(0, params);
} }
bool rgb_matrix_solid_reactive_nexus(effect_params_t* params) { bool SOLID_REACTIVE_NEXUS(effect_params_t* params) {
return rgb_matrix_solid_reactive_multinexus_range(qsub8(g_last_hit_tracker.count, 1), params); return rgb_matrix_solid_reactive_multinexus_range(qsub8(g_last_hit_tracker.count, 1), params);
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) #endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED #endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -1,12 +1,10 @@
#pragma once #pragma once
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern led_config_t g_led_config; bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) {
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); RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 }; HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
@ -31,5 +29,6 @@ bool rgb_matrix_solid_reactive_simple(effect_params_t* params) {
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE #endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED #endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -1,10 +1,15 @@
#pragma once
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) #if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
extern led_config_t g_led_config; #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
extern rgb_config_t rgb_matrix_config; RGB_MATRIX_EFFECT(SOLID_REACTIVE_WIDE)
extern last_hit_t g_last_hit_tracker; #endif
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE)
#endif
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
static bool rgb_matrix_solid_reactive_multiwide_range(uint8_t start, effect_params_t* params) { static bool rgb_matrix_solid_reactive_multiwide_range(uint8_t start, effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
@ -30,13 +35,14 @@ static bool rgb_matrix_solid_reactive_multiwide_range(uint8_t start, effect_para
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
bool rgb_matrix_solid_reactive_multiwide(effect_params_t* params) { bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) {
return rgb_matrix_solid_reactive_multiwide_range(0, params); return rgb_matrix_solid_reactive_multiwide_range(0, params);
} }
bool rgb_matrix_solid_reactive_wide(effect_params_t* params) { bool SOLID_REACTIVE_WIDE(effect_params_t* params) {
return rgb_matrix_solid_reactive_multiwide_range(qsub8(g_last_hit_tracker.count, 1), params); return rgb_matrix_solid_reactive_multiwide_range(qsub8(g_last_hit_tracker.count, 1), params);
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) #endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED #endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -1,10 +1,15 @@
#pragma once
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH) #if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH)
extern led_config_t g_led_config; #ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
extern rgb_config_t rgb_matrix_config; RGB_MATRIX_EFFECT(SOLID_SPLASH)
extern last_hit_t g_last_hit_tracker; #endif
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
RGB_MATRIX_EFFECT(SOLID_MULTISPLASH)
#endif
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
static bool rgb_matrix_solid_multisplash_range(uint8_t start, effect_params_t* params) { static bool rgb_matrix_solid_multisplash_range(uint8_t start, effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
@ -30,13 +35,14 @@ static bool rgb_matrix_solid_multisplash_range(uint8_t start, effect_params_t* p
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
bool rgb_matrix_solid_multisplash(effect_params_t* params) { bool SOLID_MULTISPLASH(effect_params_t* params) {
return rgb_matrix_solid_multisplash_range(0, params); return rgb_matrix_solid_multisplash_range(0, params);
} }
bool rgb_matrix_solid_splash(effect_params_t* params) { bool SOLID_SPLASH(effect_params_t* params) {
return rgb_matrix_solid_multisplash_range(qsub8(g_last_hit_tracker.count, 1), params); return rgb_matrix_solid_multisplash_range(qsub8(g_last_hit_tracker.count, 1), params);
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) && !defined(DISABLE_RGB_MATRIX_MULTISPLASH) #endif // !defined(DISABLE_RGB_MATRIX_SPLASH) && !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED #endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -1,10 +1,16 @@
#pragma once
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH) #if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
extern led_config_t g_led_config; #ifndef DISABLE_RGB_MATRIX_SPLASH
extern rgb_config_t rgb_matrix_config; RGB_MATRIX_EFFECT(SPLASH)
extern last_hit_t g_last_hit_tracker; #endif
#ifndef DISABLE_RGB_MATRIX_MULTISPLASH
RGB_MATRIX_EFFECT(MULTISPLASH)
#endif
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
static bool rgb_matrix_multisplash_range(uint8_t start, effect_params_t* params) { static bool rgb_matrix_multisplash_range(uint8_t start, effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max); RGB_MATRIX_USE_LIMITS(led_min, led_max);
@ -32,13 +38,14 @@ static bool rgb_matrix_multisplash_range(uint8_t start, effect_params_t* params)
return led_max < DRIVER_LED_TOTAL; return led_max < DRIVER_LED_TOTAL;
} }
bool rgb_matrix_multisplash(effect_params_t* params) { bool MULTISPLASH(effect_params_t* params) {
return rgb_matrix_multisplash_range(0, params); return rgb_matrix_multisplash_range(0, params);
} }
bool rgb_matrix_splash(effect_params_t* params) { bool SPLASH(effect_params_t* params) {
return rgb_matrix_multisplash_range(qsub8(g_last_hit_tracker.count, 1), params); return rgb_matrix_multisplash_range(qsub8(g_last_hit_tracker.count, 1), params);
} }
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH) #endif // !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED #endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -1,8 +1,6 @@
#pragma once
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
RGB_MATRIX_EFFECT(TYPING_HEATMAP)
extern rgb_config_t rgb_matrix_config; #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
extern uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
void process_rgb_matrix_typing_heatmap(keyrecord_t *record) { void process_rgb_matrix_typing_heatmap(keyrecord_t *record) {
uint8_t row = record->event.key.row; uint8_t row = record->event.key.row;
@ -35,7 +33,7 @@ void process_rgb_matrix_typing_heatmap(keyrecord_t *record) {
} }
} }
bool rgb_matrix_typing_heatmap(effect_params_t* params) { bool TYPING_HEATMAP(effect_params_t* params) {
// Modified version of RGB_MATRIX_USE_LIMITS to work off of matrix row / col size // 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_min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter;
uint8_t led_max = led_min + RGB_MATRIX_LED_PROCESS_LIMIT; uint8_t led_max = led_min + RGB_MATRIX_LED_PROCESS_LIMIT;
@ -72,4 +70,5 @@ bool rgb_matrix_typing_heatmap(effect_params_t* params) {
return led_max < sizeof(rgb_frame_buffer); 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) #endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)

View file

@ -27,8 +27,6 @@ led_instruction_t led_instructions[] = { { .end = 1 } };
static void led_matrix_massdrop_config_override(int i); static void led_matrix_massdrop_config_override(int i);
#endif // USE_MASSDROP_CONFIGURATOR #endif // USE_MASSDROP_CONFIGURATOR
extern rgb_config_t rgb_matrix_config;
extern rgb_counters_t g_rgb_counters;
void SERCOM1_0_Handler( void ) void SERCOM1_0_Handler( void )
{ {
@ -431,7 +429,6 @@ static void led_run_pattern(led_setup_t *f, float* ro, float* go, float* bo, flo
} }
} }
extern led_config_t g_led_config;
static void led_matrix_massdrop_config_override(int i) static void led_matrix_massdrop_config_override(int i)
{ {
float ro = 0; float ro = 0;

View file

@ -5,8 +5,6 @@
#if defined(RGBLIGHT_ENABLE) #if defined(RGBLIGHT_ENABLE)
extern rgblight_config_t rgblight_config; extern rgblight_config_t rgblight_config;
bool has_initialized; bool has_initialized;
#elif defined(RGB_MATRIX_ENABLE)
extern rgb_config_t rgb_matrix_config;
#endif #endif
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE