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:
parent
febaf9dec4
commit
62ba66d618
48 changed files with 222 additions and 442 deletions
|
@ -1,11 +1,9 @@
|
|||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
|
||||
extern led_config_t g_led_config;
|
||||
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 };
|
||||
|
@ -24,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);
|
||||
|
@ -18,4 +16,5 @@ bool rgb_matrix_breathing(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BREATHING
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#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 led_config_t g_led_config;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_cycle_all(effect_params_t* params) {
|
||||
bool 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 };
|
||||
|
@ -18,4 +15,5 @@ bool rgb_matrix_cycle_all(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#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 led_config_t g_led_config;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_cycle_left_right(effect_params_t* params) {
|
||||
bool 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 };
|
||||
|
@ -19,4 +16,5 @@ bool rgb_matrix_cycle_left_right(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#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 led_config_t g_led_config;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_cycle_up_down(effect_params_t* params) {
|
||||
bool 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 };
|
||||
|
@ -19,4 +16,5 @@ bool rgb_matrix_cycle_up_down(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
#pragma once
|
||||
#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
|
||||
|
||||
extern uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
|
||||
|
||||
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;
|
||||
|
@ -19,7 +18,7 @@ bool rgb_matrix_digital_rain(effect_params_t* params) {
|
|||
|
||||
if (params->init) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
// top row, pixels have just fallen and we're
|
||||
// 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
|
||||
rgb_frame_buffer[col][row]--;
|
||||
rgb_frame_buffer[row][col]--;
|
||||
}
|
||||
// set the pixel colour
|
||||
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
|
||||
if (led_count > 0) {
|
||||
if (rgb_frame_buffer[col][row] > 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));
|
||||
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 * 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);
|
||||
}
|
||||
}
|
||||
|
@ -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 col = 0; col < MATRIX_COLS; col++) {
|
||||
// if ths is on the bottom row and bright allow decay
|
||||
if (row == MATRIX_ROWS - 1 && rgb_frame_buffer[col][row] == max_intensity) {
|
||||
rgb_frame_buffer[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 (rgb_frame_buffer[col][row - 1] == max_intensity) {
|
||||
if (rgb_frame_buffer[row - 1][col] == max_intensity) {
|
||||
// allow old bright pixel to decay
|
||||
rgb_frame_buffer[col][row - 1]--;
|
||||
rgb_frame_buffer[row - 1][col]--;
|
||||
// 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;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN)
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#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 led_config_t g_led_config;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_dual_beacon(effect_params_t* params) {
|
||||
bool 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 };
|
||||
|
@ -21,4 +18,5 @@ bool rgb_matrix_dual_beacon(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#pragma once
|
||||
#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;
|
||||
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 };
|
||||
|
@ -19,4 +17,6 @@ bool rgb_matrix_gradient_up_down(effect_params_t* params) {
|
|||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern led_config_t g_led_config;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -28,4 +25,5 @@ bool rgb_matrix_jellybean_raindrops(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#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 led_config_t g_led_config;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
|
||||
bool 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 };
|
||||
|
@ -21,4 +18,5 @@ bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#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 led_config_t g_led_config;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) {
|
||||
bool 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 };
|
||||
|
@ -19,4 +16,5 @@ bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#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 led_config_t g_led_config;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) {
|
||||
bool PINWHEELS(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#pragma once
|
||||
#ifndef DISABLE_RGB_MATRIX_RAINDROPS
|
||||
#include "rgb_matrix_types.h"
|
||||
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern led_config_t g_led_config;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
RGB_MATRIX_EFFECT(RAINDROPS)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void raindrops_set_color(int i, effect_params_t* params) {
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -39,4 +35,5 @@ bool rgb_matrix_raindrops(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINDROPS
|
||||
|
|
23
quantum/rgb_matrix_animations/rgb_matrix_effects.inc
Normal file
23
quantum/rgb_matrix_animations/rgb_matrix_effects.inc
Normal 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"
|
|
@ -1,9 +1,7 @@
|
|||
#pragma once
|
||||
RGB_MATRIX_EFFECT(SOLID_COLOR)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern led_config_t g_led_config;
|
||||
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 };
|
||||
|
@ -14,3 +12,5 @@ bool rgb_matrix_solid_color(effect_params_t* params) {
|
|||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
#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 led_config_t g_led_config;
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern last_hit_t g_last_hit_tracker;
|
||||
|
||||
bool rgb_matrix_solid_reactive(effect_params_t* params) {
|
||||
bool 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 };
|
||||
|
@ -32,5 +29,6 @@ bool rgb_matrix_solid_reactive(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#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,10 +1,15 @@
|
|||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
|
||||
|
||||
extern led_config_t g_led_config;
|
||||
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
|
||||
|
||||
#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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#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,10 +1,15 @@
|
|||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
|
||||
|
||||
extern led_config_t g_led_config;
|
||||
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
|
||||
|
||||
#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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#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,12 +1,10 @@
|
|||
#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 led_config_t g_led_config;
|
||||
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) {
|
||||
bool 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 };
|
||||
|
@ -31,5 +29,6 @@ bool rgb_matrix_solid_reactive_simple(effect_params_t* params) {
|
|||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
|
||||
|
||||
extern led_config_t g_led_config;
|
||||
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
|
||||
|
||||
#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) {
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#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,10 +1,15 @@
|
|||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH)
|
||||
|
||||
extern led_config_t g_led_config;
|
||||
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
|
||||
|
||||
#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) {
|
||||
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;
|
||||
}
|
||||
|
||||
bool rgb_matrix_solid_multisplash(effect_params_t* params) {
|
||||
bool SOLID_MULTISPLASH(effect_params_t* 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);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) && !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
#pragma once
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
#if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||
|
||||
extern led_config_t g_led_config;
|
||||
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
|
||||
|
||||
#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) {
|
||||
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;
|
||||
}
|
||||
|
||||
bool rgb_matrix_multisplash(effect_params_t* params) {
|
||||
bool MULTISPLASH(effect_params_t* 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);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#pragma once
|
||||
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
|
||||
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
|
||||
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;
|
||||
|
@ -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
|
||||
uint8_t led_min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter;
|
||||
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);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue