1
0
Fork 0

Format code according to conventions (#16322)

This commit is contained in:
QMK Bot 2022-02-12 10:29:31 -08:00 committed by GitHub
parent afcdd7079c
commit 63646e8906
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
345 changed files with 4916 additions and 3229 deletions

View file

@ -22,5 +22,5 @@ bool ALPHAS_MODS(effect_params_t* params) {
return rgb_matrix_check_finished_leds(led_max);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_ALPHAS_MODS
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_ALPHAS_MODS

View file

@ -16,5 +16,5 @@ bool BREATHING(effect_params_t* params) {
return rgb_matrix_check_finished_leds(led_max);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_BREATHING
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_BREATHING

View file

@ -7,7 +7,9 @@ static HSV BAND_PINWHEEL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time)
return hsv;
}
bool BAND_PINWHEEL_SAT(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_SAT_math); }
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 // ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT

View file

@ -7,7 +7,9 @@ static HSV BAND_PINWHEEL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time)
return hsv;
}
bool BAND_PINWHEEL_VAL(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_VAL_math); }
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 // ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL

View file

@ -8,7 +8,9 @@ static HSV BAND_SAT_math(HSV hsv, uint8_t i, uint8_t time) {
return hsv;
}
bool BAND_SAT(effect_params_t* params) { return effect_runner_i(params, &BAND_SAT_math); }
bool BAND_SAT(effect_params_t* params) {
return effect_runner_i(params, &BAND_SAT_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_BAND_SAT
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_BAND_SAT

View file

@ -7,7 +7,9 @@ static HSV BAND_SPIRAL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, u
return hsv;
}
bool BAND_SPIRAL_SAT(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_SAT_math); }
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 // ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT

View file

@ -7,7 +7,9 @@ static HSV BAND_SPIRAL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, u
return hsv;
}
bool BAND_SPIRAL_VAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_VAL_math); }
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 // ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL

View file

@ -8,7 +8,9 @@ static HSV BAND_VAL_math(HSV hsv, uint8_t i, uint8_t time) {
return hsv;
}
bool BAND_VAL(effect_params_t* params) { return effect_runner_i(params, &BAND_VAL_math); }
bool BAND_VAL(effect_params_t* params) {
return effect_runner_i(params, &BAND_VAL_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_BAND_VAL
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_BAND_VAL

View file

@ -7,7 +7,9 @@ static HSV CYCLE_ALL_math(HSV hsv, uint8_t i, uint8_t time) {
return hsv;
}
bool CYCLE_ALL(effect_params_t* params) { return effect_runner_i(params, &CYCLE_ALL_math); }
bool CYCLE_ALL(effect_params_t* params) {
return effect_runner_i(params, &CYCLE_ALL_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_ALL
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_ALL

View file

@ -7,7 +7,9 @@ static HSV CYCLE_LEFT_RIGHT_math(HSV hsv, uint8_t i, uint8_t time) {
return hsv;
}
bool CYCLE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); }
bool CYCLE_LEFT_RIGHT(effect_params_t* params) {
return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT

View file

@ -7,7 +7,9 @@ static HSV CYCLE_OUT_IN_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint
return hsv;
}
bool CYCLE_OUT_IN(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); }
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 // ENABLE_RGB_MATRIX_CYCLE_OUT_IN
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_OUT_IN

View file

@ -9,7 +9,9 @@ static HSV CYCLE_OUT_IN_DUAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time)
return hsv;
}
bool CYCLE_OUT_IN_DUAL(effect_params_t* params) { return effect_runner_dx_dy(params, &CYCLE_OUT_IN_DUAL_math); }
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 // ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL

View file

@ -7,7 +7,9 @@ static HSV CYCLE_PINWHEEL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
return hsv;
}
bool CYCLE_PINWHEEL(effect_params_t* params) { return effect_runner_dx_dy(params, &CYCLE_PINWHEEL_math); }
bool CYCLE_PINWHEEL(effect_params_t* params) {
return effect_runner_dx_dy(params, &CYCLE_PINWHEEL_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_PINWHEEL

View file

@ -7,7 +7,9 @@ static HSV CYCLE_SPIRAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint
return hsv;
}
bool CYCLE_SPIRAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_SPIRAL_math); }
bool CYCLE_SPIRAL(effect_params_t* params) {
return effect_runner_dx_dy_dist(params, &CYCLE_SPIRAL_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_SPIRAL
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_SPIRAL

View file

@ -7,7 +7,9 @@ static HSV CYCLE_UP_DOWN_math(HSV hsv, uint8_t i, uint8_t time) {
return hsv;
}
bool CYCLE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &CYCLE_UP_DOWN_math); }
bool CYCLE_UP_DOWN(effect_params_t* params) {
return effect_runner_i(params, &CYCLE_UP_DOWN_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_CYCLE_UP_DOWN

View file

@ -71,5 +71,5 @@ bool DIGITAL_RAIN(effect_params_t* params) {
return false;
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(ENABLE_RGB_MATRIX_DIGITAL_RAIN)
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(ENABLE_RGB_MATRIX_DIGITAL_RAIN)

View file

@ -7,7 +7,9 @@ static HSV DUAL_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t
return hsv;
}
bool DUAL_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); }
bool DUAL_BEACON(effect_params_t* params) {
return effect_runner_sin_cos_i(params, &DUAL_BEACON_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_DUAL_BEACON
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_DUAL_BEACON

View file

@ -18,5 +18,5 @@ bool GRADIENT_LEFT_RIGHT(effect_params_t* params) {
return rgb_matrix_check_finished_leds(led_max);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT

View file

@ -18,5 +18,5 @@ bool GRADIENT_UP_DOWN(effect_params_t* params) {
return rgb_matrix_check_finished_leds(led_max);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN

View file

@ -18,5 +18,5 @@ bool HUE_BREATHING(effect_params_t* params) {
return rgb_matrix_check_finished_leds(led_max);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_HUE_BREATHING
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_HUE_BREATHING

View file

@ -11,7 +11,9 @@ static HSV HUE_PENDULUM_math(HSV hsv, uint8_t i, uint8_t time) {
return hsv;
}
bool HUE_PENDULUM(effect_params_t* params) { return effect_runner_i(params, &HUE_PENDULUM_math); }
bool HUE_PENDULUM(effect_params_t* params) {
return effect_runner_i(params, &HUE_PENDULUM_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_HUE_PENDULUM
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_HUE_PENDULUM

View file

@ -11,7 +11,9 @@ static HSV HUE_WAVE_math(HSV hsv, uint8_t i, uint8_t time) {
return hsv;
}
bool HUE_WAVE(effect_params_t* params) { return effect_runner_i(params, &HUE_WAVE_math); }
bool HUE_WAVE(effect_params_t* params) {
return effect_runner_i(params, &HUE_WAVE_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_HUE_WAVE
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // DISABLE_RGB_HUE_WAVE

View file

@ -25,5 +25,5 @@ bool JELLYBEAN_RAINDROPS(effect_params_t* params) {
return rgb_matrix_check_finished_leds(led_max);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS

View file

@ -14,7 +14,9 @@ static bool PIXEL_FLOW(effect_params_t* params) {
return false;
}
inline uint32_t interval(void) { return 3000 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); }
inline uint32_t interval(void) {
return 3000 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16);
}
if (params->init) {
// Clear LEDs and fill the state array
@ -45,5 +47,5 @@ static bool PIXEL_FLOW(effect_params_t* params) {
return rgb_matrix_check_finished_leds(led_max);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_PIXEL_FLOW
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_PIXEL_FLOW

View file

@ -29,7 +29,9 @@ static bool PIXEL_FRACTAL(effect_params_t* params) {
return false;
}
inline uint32_t interval(void) { return 3000 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); }
inline uint32_t interval(void) {
return 3000 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16);
}
if (params->init) {
rgb_matrix_set_color_all(0, 0, 0);
@ -37,7 +39,7 @@ static bool PIXEL_FRACTAL(effect_params_t* params) {
RGB rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.hsv);
for (uint8_t h = 0; h < MATRIX_ROWS; ++h) {
for (uint8_t l = 0; l < MID_COL - 1; ++l) { // Light and move left columns outwards
for (uint8_t l = 0; l < MID_COL - 1; ++l) { // Light and move left columns outwards
if (led[h][l]) {
rgb_matrix_set_color(g_led_config.matrix_co[h][l], rgb.r, rgb.g, rgb.b);
} else {
@ -46,7 +48,7 @@ static bool PIXEL_FRACTAL(effect_params_t* params) {
led[h][l] = led[h][l + 1];
}
for (uint8_t r = MATRIX_COLS - 1; r > MID_COL; --r) { // Light and move right columns outwards
for (uint8_t r = MATRIX_COLS - 1; r > MID_COL; --r) { // Light and move right columns outwards
if (led[h][r]) {
rgb_matrix_set_color(g_led_config.matrix_co[h][r], rgb.r, rgb.g, rgb.b);
} else {
@ -74,5 +76,5 @@ static bool PIXEL_FRACTAL(effect_params_t* params) {
wait_timer = g_rgb_timer + interval();
return false;
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_PIXEL_FRACTAL
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_PIXEL_FRACTAL

View file

@ -24,7 +24,9 @@ static bool PIXEL_RAIN(effect_params_t* params) {
return false;
}
inline uint32_t interval(void) { return 500 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); }
inline uint32_t interval(void) {
return 500 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16);
}
bool rain_pixel(uint8_t i, effect_params_t * params, bool off) {
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) {
@ -44,5 +46,5 @@ static bool PIXEL_RAIN(effect_params_t* params) {
return rain_pixel(mod8(random8(), DRIVER_LED_TOTAL), params, random8() & 2);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_PIXEL_RAIN
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_PIXEL_RAIN

View file

@ -7,7 +7,9 @@ static HSV RAINBOW_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8
return hsv;
}
bool RAINBOW_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &RAINBOW_BEACON_math); }
bool RAINBOW_BEACON(effect_params_t* params) {
return effect_runner_sin_cos_i(params, &RAINBOW_BEACON_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_RAINBOW_BEACON
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_RAINBOW_BEACON

View file

@ -7,7 +7,9 @@ static HSV RAINBOW_MOVING_CHEVRON_math(HSV hsv, uint8_t i, uint8_t time) {
return hsv;
}
bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) { return effect_runner_i(params, &RAINBOW_MOVING_CHEVRON_math); }
bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) {
return effect_runner_i(params, &RAINBOW_MOVING_CHEVRON_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON

View file

@ -7,7 +7,9 @@ static HSV RAINBOW_PINWHEELS_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, ui
return hsv;
}
bool RAINBOW_PINWHEELS(effect_params_t* params) { return effect_runner_sin_cos_i(params, &RAINBOW_PINWHEELS_math); }
bool RAINBOW_PINWHEELS(effect_params_t* params) {
return effect_runner_sin_cos_i(params, &RAINBOW_PINWHEELS_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS

View file

@ -35,5 +35,5 @@ bool RAINDROPS(effect_params_t* params) {
return rgb_matrix_check_finished_leds(led_max);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_RAINDROPS
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // ENABLE_RGB_MATRIX_RAINDROPS

View file

@ -26,4 +26,4 @@ bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {
return rgb_matrix_check_finished_leds(led_max);
}
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -26,4 +26,4 @@ bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, react
return rgb_matrix_check_finished_leds(led_max);
}
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -12,4 +12,4 @@ bool SOLID_COLOR(effect_params_t* params) {
return rgb_matrix_check_finished_leds(led_max);
}
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS

View file

@ -8,8 +8,10 @@ static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) {
return hsv;
}
bool SOLID_REACTIVE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_math); }
bool SOLID_REACTIVE(effect_params_t* params) {
return effect_runner_reactive(params, &SOLID_REACTIVE_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# endif // ENABLE_RGB_MATRIX_SOLID_REACTIVE
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# endif // ENABLE_RGB_MATRIX_SOLID_REACTIVE
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -24,13 +24,17 @@ static HSV SOLID_REACTIVE_CROSS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t di
}
# ifdef ENABLE_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); }
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
# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); }
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(ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -22,13 +22,17 @@ static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t di
}
# ifdef ENABLE_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); }
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
# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); }
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(ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -8,8 +8,10 @@ static HSV SOLID_REACTIVE_SIMPLE_math(HSV hsv, uint16_t offset) {
return hsv;
}
bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); }
bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) {
return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# endif // ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# endif // ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -19,13 +19,17 @@ static HSV SOLID_REACTIVE_WIDE_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dis
}
# ifdef ENABLE_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); }
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
# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); }
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(ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -19,13 +19,17 @@ HSV SOLID_SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t ti
}
# ifdef ENABLE_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); }
bool SOLID_SPLASH(effect_params_t* params) {
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math);
}
# endif
# ifdef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); }
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(ENABLE_RGB_MATRIX_SPLASH) && !defined(ENABLE_RGB_MATRIX_MULTISPLASH)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# endif // !defined(ENABLE_RGB_MATRIX_SPLASH) && !defined(ENABLE_RGB_MATRIX_MULTISPLASH)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -20,13 +20,17 @@ HSV SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
}
# ifdef ENABLE_RGB_MATRIX_SPLASH
bool SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SPLASH_math); }
bool SPLASH(effect_params_t* params) {
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SPLASH_math);
}
# endif
# ifdef ENABLE_RGB_MATRIX_MULTISPLASH
bool MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SPLASH_math); }
bool MULTISPLASH(effect_params_t* params) {
return effect_runner_reactive_splash(0, params, &SPLASH_math);
}
# endif
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# endif // !defined(ENABLE_RGB_MATRIX_SPLASH) || !defined(ENABLE_RGB_MATRIX_MULTISPLASH)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# endif // !defined(ENABLE_RGB_MATRIX_SPLASH) || !defined(ENABLE_RGB_MATRIX_MULTISPLASH)
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED

View file

@ -82,5 +82,5 @@ bool TYPING_HEATMAP(effect_params_t* params) {
return led_max < sizeof(g_rgb_frame_buffer);
}
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)

View file

@ -31,7 +31,9 @@ const led_point_t k_rgb_matrix_center = {112, 32};
const led_point_t k_rgb_matrix_center = RGB_MATRIX_CENTER;
#endif
__attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv); }
__attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) {
return hsv_to_rgb(hsv);
}
// Generic effect runners
#include "rgb_matrix_runners.inc"
@ -109,14 +111,14 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv
#endif
// globals
rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
uint32_t g_rgb_timer;
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}};
#endif // RGB_MATRIX_FRAMEBUFFER_EFFECTS
#endif // RGB_MATRIX_FRAMEBUFFER_EFFECTS
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
last_hit_t g_last_hit_tracker;
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
// internals
static bool suspend_state = false;
@ -126,13 +128,13 @@ static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false};
static rgb_task_states rgb_task_state = SYNCING;
#if RGB_DISABLE_TIMEOUT > 0
static uint32_t rgb_anykey_timer;
#endif // RGB_DISABLE_TIMEOUT > 0
#endif // RGB_DISABLE_TIMEOUT > 0
// double buffers
static uint32_t rgb_timer_buffer;
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
static last_hit_t last_hit_buffer;
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
// split rgb matrix
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
@ -141,7 +143,9 @@ const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT;
EECONFIG_DEBOUNCE_HELPER(rgb_matrix, EECONFIG_RGB_MATRIX, rgb_matrix_config);
void eeconfig_update_rgb_matrix(void) { eeconfig_flush_rgb_matrix(true); }
void eeconfig_update_rgb_matrix(void) {
eeconfig_flush_rgb_matrix(true);
}
void eeconfig_update_rgb_matrix_default(void) {
dprintf("eeconfig_update_rgb_matrix_default\n");
@ -168,13 +172,15 @@ void rgb_matrix_reload_from_eeprom(void) {
rgb_matrix_disable_noeeprom();
/* Reset back to what we have in eeprom */
eeconfig_init_rgb_matrix();
eeconfig_debug_rgb_matrix(); // display current eeprom values
eeconfig_debug_rgb_matrix(); // display current eeprom values
if (rgb_matrix_config.enable) {
rgb_matrix_mode_noeeprom(rgb_matrix_config.mode);
}
}
__attribute__((weak)) uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; }
__attribute__((weak)) uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) {
return 0;
}
uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) {
uint8_t led_count = rgb_matrix_map_row_column_to_led_kb(row, column, led_i);
@ -186,13 +192,18 @@ uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l
return led_count;
}
void rgb_matrix_update_pwm_buffers(void) { rgb_matrix_driver.flush(); }
void rgb_matrix_update_pwm_buffers(void) {
rgb_matrix_driver.flush();
}
void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color(index, red, green, blue); }
void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
rgb_matrix_driver.set_color(index, red, green, blue);
}
void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) rgb_matrix_set_color(i, red, green, blue);
for (uint8_t 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
@ -204,7 +215,7 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) {
#endif
#if RGB_DISABLE_TIMEOUT > 0
rgb_anykey_timer = 0;
#endif // RGB_DISABLE_TIMEOUT > 0
#endif // RGB_DISABLE_TIMEOUT > 0
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
uint8_t led[LED_HITS_TO_REMEMBER];
@ -214,7 +225,7 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) {
if (!pressed)
# elif defined(RGB_MATRIX_KEYPRESSES)
if (pressed)
# endif // defined(RGB_MATRIX_KEYRELEASES)
# endif // defined(RGB_MATRIX_KEYRELEASES)
{
led_count = rgb_matrix_map_row_column_to_led(row, col, led);
}
@ -222,7 +233,7 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) {
if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) {
memcpy(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count);
memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count);
memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit
memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit
memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count);
last_hit_buffer.count = LED_HITS_TO_REMEMBER - led_count;
}
@ -235,13 +246,13 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) {
last_hit_buffer.tick[index] = 0;
last_hit_buffer.count++;
}
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
if (rgb_matrix_config.mode == RGB_MATRIX_TYPING_HEATMAP) {
process_rgb_matrix_typing_heatmap(row, col);
}
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
}
void rgb_matrix_test(void) {
@ -280,7 +291,7 @@ static bool rgb_matrix_none(effect_params_t *params) {
static void rgb_task_timers(void) {
#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
uint32_t deltaTime = sync_timer_elapsed32(rgb_timer_buffer);
#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
rgb_timer_buffer = sync_timer_read32();
// Update double buffer timers
@ -288,7 +299,7 @@ static void rgb_task_timers(void) {
if (rgb_anykey_timer + deltaTime <= UINT32_MAX) {
rgb_anykey_timer += deltaTime;
}
#endif // RGB_DISABLE_TIMEOUT > 0
#endif // RGB_DISABLE_TIMEOUT > 0
// Update double buffer last hit timers
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
@ -300,7 +311,7 @@ static void rgb_task_timers(void) {
}
last_hit_buffer.tick[i] += deltaTime;
}
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
}
static void rgb_task_sync(void) {
@ -317,7 +328,7 @@ static void rgb_task_start(void) {
g_rgb_timer = rgb_timer_buffer;
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
g_last_hit_tracker = last_hit_buffer;
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
// next task
rgb_task_state = RENDERING;
@ -403,7 +414,7 @@ void rgb_matrix_task(void) {
bool suspend_backlight = suspend_state ||
#if RGB_DISABLE_TIMEOUT > 0
(rgb_anykey_timer > (uint32_t)RGB_DISABLE_TIMEOUT) ||
#endif // RGB_DISABLE_TIMEOUT > 0
#endif // RGB_DISABLE_TIMEOUT > 0
false;
uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode;
@ -472,7 +483,7 @@ void rgb_matrix_init(void) {
for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) {
last_hit_buffer.tick[i] = UINT16_MAX;
}
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
if (!eeconfig_is_enabled()) {
dprintf("rgb_matrix_init_drivers eeconfig is not enabled.\n");
@ -485,20 +496,22 @@ void rgb_matrix_init(void) {
dprintf("rgb_matrix_init_drivers rgb_matrix_config.mode = 0. Write default values to EEPROM.\n");
eeconfig_update_rgb_matrix_default();
}
eeconfig_debug_rgb_matrix(); // display current eeprom values
eeconfig_debug_rgb_matrix(); // display current eeprom values
}
void rgb_matrix_set_suspend_state(bool state) {
#ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
if (state && !suspend_state) { // only run if turning off, and only once
rgb_task_render(0); // turn off all LEDs when suspending
rgb_task_flush(0); // and actually flash led state to LEDs
if (state && !suspend_state) { // only run if turning off, and only once
rgb_task_render(0); // turn off all LEDs when suspending
rgb_task_flush(0); // and actually flash led state to LEDs
}
suspend_state = state;
#endif
}
bool rgb_matrix_get_suspend_state(void) { return suspend_state; }
bool rgb_matrix_get_suspend_state(void) {
return suspend_state;
}
void rgb_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
rgb_matrix_config.enable ^= 1;
@ -506,8 +519,12 @@ void rgb_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
eeconfig_flag_rgb_matrix(write_to_eeprom);
dprintf("rgb matrix toggle [%s]: rgb_matrix_config.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.enable);
}
void rgb_matrix_toggle_noeeprom(void) { rgb_matrix_toggle_eeprom_helper(false); }
void rgb_matrix_toggle(void) { rgb_matrix_toggle_eeprom_helper(true); }
void rgb_matrix_toggle_noeeprom(void) {
rgb_matrix_toggle_eeprom_helper(false);
}
void rgb_matrix_toggle(void) {
rgb_matrix_toggle_eeprom_helper(true);
}
void rgb_matrix_enable(void) {
rgb_matrix_enable_noeeprom();
@ -529,7 +546,9 @@ void rgb_matrix_disable_noeeprom(void) {
rgb_matrix_config.enable = 0;
}
uint8_t rgb_matrix_is_enabled(void) { return rgb_matrix_config.enable; }
uint8_t rgb_matrix_is_enabled(void) {
return rgb_matrix_config.enable;
}
void rgb_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
if (!rgb_matrix_config.enable) {
@ -546,24 +565,38 @@ void rgb_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
eeconfig_flag_rgb_matrix(write_to_eeprom);
dprintf("rgb matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.mode);
}
void rgb_matrix_mode_noeeprom(uint8_t mode) { rgb_matrix_mode_eeprom_helper(mode, false); }
void rgb_matrix_mode(uint8_t mode) { rgb_matrix_mode_eeprom_helper(mode, true); }
void rgb_matrix_mode_noeeprom(uint8_t mode) {
rgb_matrix_mode_eeprom_helper(mode, false);
}
void rgb_matrix_mode(uint8_t mode) {
rgb_matrix_mode_eeprom_helper(mode, true);
}
uint8_t rgb_matrix_get_mode(void) { return rgb_matrix_config.mode; }
uint8_t rgb_matrix_get_mode(void) {
return rgb_matrix_config.mode;
}
void rgb_matrix_step_helper(bool write_to_eeprom) {
uint8_t mode = rgb_matrix_config.mode + 1;
rgb_matrix_mode_eeprom_helper((mode < RGB_MATRIX_EFFECT_MAX) ? mode : 1, write_to_eeprom);
}
void rgb_matrix_step_noeeprom(void) { rgb_matrix_step_helper(false); }
void rgb_matrix_step(void) { rgb_matrix_step_helper(true); }
void rgb_matrix_step_noeeprom(void) {
rgb_matrix_step_helper(false);
}
void rgb_matrix_step(void) {
rgb_matrix_step_helper(true);
}
void rgb_matrix_step_reverse_helper(bool write_to_eeprom) {
uint8_t mode = rgb_matrix_config.mode - 1;
rgb_matrix_mode_eeprom_helper((mode < 1) ? RGB_MATRIX_EFFECT_MAX - 1 : mode, write_to_eeprom);
}
void rgb_matrix_step_reverse_noeeprom(void) { rgb_matrix_step_reverse_helper(false); }
void rgb_matrix_step_reverse(void) { rgb_matrix_step_reverse_helper(true); }
void rgb_matrix_step_reverse_noeeprom(void) {
rgb_matrix_step_reverse_helper(false);
}
void rgb_matrix_step_reverse(void) {
rgb_matrix_step_reverse_helper(true);
}
void rgb_matrix_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) {
if (!rgb_matrix_config.enable) {
@ -575,56 +608,126 @@ void rgb_matrix_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, boo
eeconfig_flag_rgb_matrix(write_to_eeprom);
dprintf("rgb matrix set hsv [%s]: %u,%u,%u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
}
void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { rgb_matrix_sethsv_eeprom_helper(hue, sat, val, false); }
void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { rgb_matrix_sethsv_eeprom_helper(hue, sat, val, true); }
void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
rgb_matrix_sethsv_eeprom_helper(hue, sat, val, false);
}
void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
rgb_matrix_sethsv_eeprom_helper(hue, sat, val, true);
}
HSV rgb_matrix_get_hsv(void) { return rgb_matrix_config.hsv; }
uint8_t rgb_matrix_get_hue(void) { return rgb_matrix_config.hsv.h; }
uint8_t rgb_matrix_get_sat(void) { return rgb_matrix_config.hsv.s; }
uint8_t rgb_matrix_get_val(void) { return rgb_matrix_config.hsv.v; }
HSV rgb_matrix_get_hsv(void) {
return rgb_matrix_config.hsv;
}
uint8_t rgb_matrix_get_hue(void) {
return rgb_matrix_config.hsv.h;
}
uint8_t rgb_matrix_get_sat(void) {
return rgb_matrix_config.hsv.s;
}
uint8_t rgb_matrix_get_val(void) {
return rgb_matrix_config.hsv.v;
}
void rgb_matrix_increase_hue_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h + RGB_MATRIX_HUE_STEP, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, write_to_eeprom); }
void rgb_matrix_increase_hue_noeeprom(void) { rgb_matrix_increase_hue_helper(false); }
void rgb_matrix_increase_hue(void) { rgb_matrix_increase_hue_helper(true); }
void rgb_matrix_increase_hue_helper(bool write_to_eeprom) {
rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h + RGB_MATRIX_HUE_STEP, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, write_to_eeprom);
}
void rgb_matrix_increase_hue_noeeprom(void) {
rgb_matrix_increase_hue_helper(false);
}
void rgb_matrix_increase_hue(void) {
rgb_matrix_increase_hue_helper(true);
}
void rgb_matrix_decrease_hue_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h - RGB_MATRIX_HUE_STEP, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, write_to_eeprom); }
void rgb_matrix_decrease_hue_noeeprom(void) { rgb_matrix_decrease_hue_helper(false); }
void rgb_matrix_decrease_hue(void) { rgb_matrix_decrease_hue_helper(true); }
void rgb_matrix_decrease_hue_helper(bool write_to_eeprom) {
rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h - RGB_MATRIX_HUE_STEP, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, write_to_eeprom);
}
void rgb_matrix_decrease_hue_noeeprom(void) {
rgb_matrix_decrease_hue_helper(false);
}
void rgb_matrix_decrease_hue(void) {
rgb_matrix_decrease_hue_helper(true);
}
void rgb_matrix_increase_sat_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, qadd8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP), rgb_matrix_config.hsv.v, write_to_eeprom); }
void rgb_matrix_increase_sat_noeeprom(void) { rgb_matrix_increase_sat_helper(false); }
void rgb_matrix_increase_sat(void) { rgb_matrix_increase_sat_helper(true); }
void rgb_matrix_increase_sat_helper(bool write_to_eeprom) {
rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, qadd8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP), rgb_matrix_config.hsv.v, write_to_eeprom);
}
void rgb_matrix_increase_sat_noeeprom(void) {
rgb_matrix_increase_sat_helper(false);
}
void rgb_matrix_increase_sat(void) {
rgb_matrix_increase_sat_helper(true);
}
void rgb_matrix_decrease_sat_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, qsub8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP), rgb_matrix_config.hsv.v, write_to_eeprom); }
void rgb_matrix_decrease_sat_noeeprom(void) { rgb_matrix_decrease_sat_helper(false); }
void rgb_matrix_decrease_sat(void) { rgb_matrix_decrease_sat_helper(true); }
void rgb_matrix_decrease_sat_helper(bool write_to_eeprom) {
rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, qsub8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP), rgb_matrix_config.hsv.v, write_to_eeprom);
}
void rgb_matrix_decrease_sat_noeeprom(void) {
rgb_matrix_decrease_sat_helper(false);
}
void rgb_matrix_decrease_sat(void) {
rgb_matrix_decrease_sat_helper(true);
}
void rgb_matrix_increase_val_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qadd8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom); }
void rgb_matrix_increase_val_noeeprom(void) { rgb_matrix_increase_val_helper(false); }
void rgb_matrix_increase_val(void) { rgb_matrix_increase_val_helper(true); }
void rgb_matrix_increase_val_helper(bool write_to_eeprom) {
rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qadd8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom);
}
void rgb_matrix_increase_val_noeeprom(void) {
rgb_matrix_increase_val_helper(false);
}
void rgb_matrix_increase_val(void) {
rgb_matrix_increase_val_helper(true);
}
void rgb_matrix_decrease_val_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qsub8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom); }
void rgb_matrix_decrease_val_noeeprom(void) { rgb_matrix_decrease_val_helper(false); }
void rgb_matrix_decrease_val(void) { rgb_matrix_decrease_val_helper(true); }
void rgb_matrix_decrease_val_helper(bool write_to_eeprom) {
rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qsub8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom);
}
void rgb_matrix_decrease_val_noeeprom(void) {
rgb_matrix_decrease_val_helper(false);
}
void rgb_matrix_decrease_val(void) {
rgb_matrix_decrease_val_helper(true);
}
void rgb_matrix_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) {
rgb_matrix_config.speed = speed;
eeconfig_flag_rgb_matrix(write_to_eeprom);
dprintf("rgb matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.speed);
}
void rgb_matrix_set_speed_noeeprom(uint8_t speed) { rgb_matrix_set_speed_eeprom_helper(speed, false); }
void rgb_matrix_set_speed(uint8_t speed) { rgb_matrix_set_speed_eeprom_helper(speed, true); }
void rgb_matrix_set_speed_noeeprom(uint8_t speed) {
rgb_matrix_set_speed_eeprom_helper(speed, false);
}
void rgb_matrix_set_speed(uint8_t speed) {
rgb_matrix_set_speed_eeprom_helper(speed, true);
}
uint8_t rgb_matrix_get_speed(void) { return rgb_matrix_config.speed; }
uint8_t rgb_matrix_get_speed(void) {
return rgb_matrix_config.speed;
}
void rgb_matrix_increase_speed_helper(bool write_to_eeprom) { rgb_matrix_set_speed_eeprom_helper(qadd8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP), write_to_eeprom); }
void rgb_matrix_increase_speed_noeeprom(void) { rgb_matrix_increase_speed_helper(false); }
void rgb_matrix_increase_speed(void) { rgb_matrix_increase_speed_helper(true); }
void rgb_matrix_increase_speed_helper(bool write_to_eeprom) {
rgb_matrix_set_speed_eeprom_helper(qadd8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP), write_to_eeprom);
}
void rgb_matrix_increase_speed_noeeprom(void) {
rgb_matrix_increase_speed_helper(false);
}
void rgb_matrix_increase_speed(void) {
rgb_matrix_increase_speed_helper(true);
}
void rgb_matrix_decrease_speed_helper(bool write_to_eeprom) { rgb_matrix_set_speed_eeprom_helper(qsub8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP), write_to_eeprom); }
void rgb_matrix_decrease_speed_noeeprom(void) { rgb_matrix_decrease_speed_helper(false); }
void rgb_matrix_decrease_speed(void) { rgb_matrix_decrease_speed_helper(true); }
void rgb_matrix_decrease_speed_helper(bool write_to_eeprom) {
rgb_matrix_set_speed_eeprom_helper(qsub8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP), write_to_eeprom);
}
void rgb_matrix_decrease_speed_noeeprom(void) {
rgb_matrix_decrease_speed_helper(false);
}
void rgb_matrix_decrease_speed(void) {
rgb_matrix_decrease_speed_helper(true);
}
led_flags_t rgb_matrix_get_flags(void) { return rgb_matrix_config.flags; }
led_flags_t rgb_matrix_get_flags(void) {
return rgb_matrix_config.flags;
}
void rgb_matrix_set_flags(led_flags_t flags) { rgb_matrix_config.flags = flags; }
void rgb_matrix_set_flags(led_flags_t flags) {
rgb_matrix_config.flags = flags;
}

View file

@ -37,7 +37,7 @@
// Last led hit
#ifndef LED_HITS_TO_REMEMBER
# define LED_HITS_TO_REMEMBER 8
#endif // LED_HITS_TO_REMEMBER
#endif // LED_HITS_TO_REMEMBER
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
typedef struct PACKED {
@ -47,7 +47,7 @@ typedef struct PACKED {
uint8_t index[LED_HITS_TO_REMEMBER];
uint16_t tick[LED_HITS_TO_REMEMBER];
} last_hit_t;
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
typedef enum rgb_task_states { STARTING, RENDERING, FLUSHING, SYNCING } rgb_task_states;
@ -88,7 +88,7 @@ typedef union {
uint8_t enable : 2;
uint8_t mode : 6;
HSV hsv;
uint8_t speed; // EECONFIG needs to be increased to support this
uint8_t speed; // EECONFIG needs to be increased to support this
led_flags_t flags;
};
} rgb_config_t;