diff options
Diffstat (limited to 'quantum/led_matrix')
23 files changed, 305 insertions, 126 deletions
diff --git a/quantum/led_matrix/animations/alpha_mods_anim.h b/quantum/led_matrix/animations/alpha_mods_anim.h index 4d017894a1..01acb3f933 100644 --- a/quantum/led_matrix/animations/alpha_mods_anim.h +++ b/quantum/led_matrix/animations/alpha_mods_anim.h @@ -20,5 +20,5 @@ bool ALPHAS_MODS(effect_params_t* params) { return led_matrix_check_finished_leds(led_max); } -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_ALPHAS_MODS +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_ALPHAS_MODS diff --git a/quantum/led_matrix/animations/band_anim.h b/quantum/led_matrix/animations/band_anim.h index 293be4f67a..d9491849ea 100644 --- a/quantum/led_matrix/animations/band_anim.h +++ b/quantum/led_matrix/animations/band_anim.h @@ -7,7 +7,9 @@ static uint8_t BAND_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(v < 0 ? 0 : v, val); } -bool BAND(effect_params_t* params) { return effect_runner_i(params, &BAND_math); } +bool BAND(effect_params_t* params) { + return effect_runner_i(params, &BAND_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_BAND +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_BAND diff --git a/quantum/led_matrix/animations/band_pinwheel_anim.h b/quantum/led_matrix/animations/band_pinwheel_anim.h index f47a3869ce..482d183eb6 100644 --- a/quantum/led_matrix/animations/band_pinwheel_anim.h +++ b/quantum/led_matrix/animations/band_pinwheel_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(BAND_PINWHEEL) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t BAND_PINWHEEL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t time) { return scale8(val - time - atan2_8(dy, dx) * 3, val); } +static uint8_t BAND_PINWHEEL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t time) { + return scale8(val - time - atan2_8(dy, dx) * 3, val); +} -bool BAND_PINWHEEL(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_math); } +bool BAND_PINWHEEL(effect_params_t* params) { + return effect_runner_dx_dy(params, &BAND_PINWHEEL_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_BAND_PINWHEEL +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_BAND_PINWHEEL diff --git a/quantum/led_matrix/animations/band_spiral_anim.h b/quantum/led_matrix/animations/band_spiral_anim.h index a4bd382181..ef93d19270 100644 --- a/quantum/led_matrix/animations/band_spiral_anim.h +++ b/quantum/led_matrix/animations/band_spiral_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(BAND_SPIRAL) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t BAND_SPIRAL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { return scale8(val + dist - time - atan2_8(dy, dx), val); } +static uint8_t BAND_SPIRAL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { + return scale8(val + dist - time - atan2_8(dy, dx), val); +} -bool BAND_SPIRAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_math); } +bool BAND_SPIRAL(effect_params_t* params) { + return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_BAND_SPIRAL +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_BAND_SPIRAL diff --git a/quantum/led_matrix/animations/breathing_anim.h b/quantum/led_matrix/animations/breathing_anim.h index 899925f516..0bd4cb0cc3 100644 --- a/quantum/led_matrix/animations/breathing_anim.h +++ b/quantum/led_matrix/animations/breathing_anim.h @@ -15,5 +15,5 @@ bool BREATHING(effect_params_t* params) { return led_matrix_check_finished_leds(led_max); } -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_BREATHING +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_BREATHING diff --git a/quantum/led_matrix/animations/cycle_left_right_anim.h b/quantum/led_matrix/animations/cycle_left_right_anim.h index 1a8999b831..0a339e6d62 100644 --- a/quantum/led_matrix/animations/cycle_left_right_anim.h +++ b/quantum/led_matrix/animations/cycle_left_right_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t CYCLE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(g_led_config.point[i].x - time, val); } +static uint8_t CYCLE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { + return scale8(g_led_config.point[i].x - time, val); +} -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 // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT diff --git a/quantum/led_matrix/animations/cycle_out_in_anim.h b/quantum/led_matrix/animations/cycle_out_in_anim.h index 77d3a14b6f..8311d97fe8 100644 --- a/quantum/led_matrix/animations/cycle_out_in_anim.h +++ b/quantum/led_matrix/animations/cycle_out_in_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(CYCLE_OUT_IN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t CYCLE_OUT_IN_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { return scale8(3 * dist / 2 + time, val); } +static uint8_t CYCLE_OUT_IN_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { + return scale8(3 * dist / 2 + time, val); +} -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 // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_CYCLE_OUT_IN +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_CYCLE_OUT_IN diff --git a/quantum/led_matrix/animations/cycle_up_down_anim.h b/quantum/led_matrix/animations/cycle_up_down_anim.h index b25947199c..7e2d71a0f1 100644 --- a/quantum/led_matrix/animations/cycle_up_down_anim.h +++ b/quantum/led_matrix/animations/cycle_up_down_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(CYCLE_UP_DOWN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t CYCLE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(g_led_config.point[i].y - time, val); } +static uint8_t CYCLE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { + return scale8(g_led_config.point[i].y - time, val); +} -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 // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_CYCLE_UP_DOWN +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_CYCLE_UP_DOWN diff --git a/quantum/led_matrix/animations/dual_beacon_anim.h b/quantum/led_matrix/animations/dual_beacon_anim.h index 81735e323c..1dfb5ffe52 100644 --- a/quantum/led_matrix/animations/dual_beacon_anim.h +++ b/quantum/led_matrix/animations/dual_beacon_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(DUAL_BEACON) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t DUAL_BEACON_math(uint8_t val, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { return scale8(((g_led_config.point[i].y - k_led_matrix_center.y) * cos + (g_led_config.point[i].x - k_led_matrix_center.x) * sin) / 128, val); } +static uint8_t DUAL_BEACON_math(uint8_t val, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { + return scale8(((g_led_config.point[i].y - k_led_matrix_center.y) * cos + (g_led_config.point[i].x - k_led_matrix_center.x) * sin) / 128, val); +} -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 // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_DUAL_BEACON +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_DUAL_BEACON diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive.h b/quantum/led_matrix/animations/runners/effect_runner_reactive.h index be3090aa53..8468458744 100644 --- a/quantum/led_matrix/animations/runners/effect_runner_reactive.h +++ b/quantum/led_matrix/animations/runners/effect_runner_reactive.h @@ -25,4 +25,4 @@ bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { return led_matrix_check_finished_leds(led_max); } -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h index f6ffc825a1..aec4a6ffda 100644 --- a/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h +++ b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h @@ -23,4 +23,4 @@ bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, react return led_matrix_check_finished_leds(led_max); } -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/solid_anim.h b/quantum/led_matrix/animations/solid_anim.h index c728dbcc98..895542e152 100644 --- a/quantum/led_matrix/animations/solid_anim.h +++ b/quantum/led_matrix/animations/solid_anim.h @@ -12,4 +12,4 @@ bool SOLID(effect_params_t* params) { return led_matrix_check_finished_leds(led_max); } -#endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/solid_reactive_cross.h b/quantum/led_matrix/animations/solid_reactive_cross.h index a149e9a929..55a2556996 100644 --- a/quantum/led_matrix/animations/solid_reactive_cross.h +++ b/quantum/led_matrix/animations/solid_reactive_cross.h @@ -23,13 +23,17 @@ static uint8_t SOLID_REACTIVE_CROSS_math(uint8_t val, int16_t dx, int16_t dy, ui } # ifdef ENABLE_LED_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_LED_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 // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/solid_reactive_nexus.h b/quantum/led_matrix/animations/solid_reactive_nexus.h index 5a86e48c6c..b1ec54e3b1 100644 --- a/quantum/led_matrix/animations/solid_reactive_nexus.h +++ b/quantum/led_matrix/animations/solid_reactive_nexus.h @@ -20,13 +20,17 @@ static uint8_t SOLID_REACTIVE_NEXUS_math(uint8_t val, int16_t dx, int16_t dy, ui } # ifdef ENABLE_LED_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_LED_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 // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/solid_reactive_simple_anim.h b/quantum/led_matrix/animations/solid_reactive_simple_anim.h index 14f5e90730..3b289c78dd 100644 --- a/quantum/led_matrix/animations/solid_reactive_simple_anim.h +++ b/quantum/led_matrix/animations/solid_reactive_simple_anim.h @@ -3,10 +3,14 @@ LED_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t SOLID_REACTIVE_SIMPLE_math(uint8_t val, uint16_t offset) { return scale8(255 - offset, val); } +static uint8_t SOLID_REACTIVE_SIMPLE_math(uint8_t val, uint16_t offset) { + return scale8(255 - offset, val); +} -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 // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/solid_reactive_wide.h b/quantum/led_matrix/animations/solid_reactive_wide.h index 9f039c45d4..dda54eab2c 100644 --- a/quantum/led_matrix/animations/solid_reactive_wide.h +++ b/quantum/led_matrix/animations/solid_reactive_wide.h @@ -18,13 +18,17 @@ static uint8_t SOLID_REACTIVE_WIDE_math(uint8_t val, int16_t dx, int16_t dy, uin } # ifdef ENABLE_LED_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_LED_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 // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/solid_splash_anim.h b/quantum/led_matrix/animations/solid_splash_anim.h index 17b692a09a..b8b6e8ea5e 100644 --- a/quantum/led_matrix/animations/solid_splash_anim.h +++ b/quantum/led_matrix/animations/solid_splash_anim.h @@ -18,13 +18,17 @@ uint8_t SOLID_SPLASH_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uin } # ifdef ENABLE_LED_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_LED_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 // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // defined(ENABLE_LED_MATRIX_SPLASH) || defined(ENABLE_LED_MATRIX_MULTISPLASH) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // defined(ENABLE_LED_MATRIX_SPLASH) || defined(ENABLE_LED_MATRIX_MULTISPLASH) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/wave_left_right_anim.h b/quantum/led_matrix/animations/wave_left_right_anim.h index 76487f8515..8dedd64738 100644 --- a/quantum/led_matrix/animations/wave_left_right_anim.h +++ b/quantum/led_matrix/animations/wave_left_right_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(WAVE_LEFT_RIGHT) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t WAVE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(sin8(g_led_config.point[i].x - time), val); } +static uint8_t WAVE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { + return scale8(sin8(g_led_config.point[i].x - time), val); +} -bool WAVE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &WAVE_LEFT_RIGHT_math); } +bool WAVE_LEFT_RIGHT(effect_params_t* params) { + return effect_runner_i(params, &WAVE_LEFT_RIGHT_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT diff --git a/quantum/led_matrix/animations/wave_up_down_anim.h b/quantum/led_matrix/animations/wave_up_down_anim.h index 94710f5c6e..4564f3e493 100644 --- a/quantum/led_matrix/animations/wave_up_down_anim.h +++ b/quantum/led_matrix/animations/wave_up_down_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(WAVE_UP_DOWN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t WAVE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(sin8(g_led_config.point[i].y - time), val); } +static uint8_t WAVE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { + return scale8(sin8(g_led_config.point[i].y - time), val); +} -bool WAVE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &WAVE_UP_DOWN_math); } +bool WAVE_UP_DOWN(effect_params_t* params) { + return effect_runner_i(params, &WAVE_UP_DOWN_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_WAVE_UP_DOWN +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_WAVE_UP_DOWN diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c index be1494e884..38ed79bed0 100644 --- a/quantum/led_matrix/led_matrix.c +++ b/quantum/led_matrix/led_matrix.c @@ -88,14 +88,14 @@ const led_point_t k_led_matrix_center = LED_MATRIX_CENTER; #endif // globals -led_eeconfig_t led_matrix_eeconfig; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr +led_eeconfig_t led_matrix_eeconfig; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr uint32_t g_led_timer; #ifdef LED_MATRIX_FRAMEBUFFER_EFFECTS uint8_t g_led_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}}; -#endif // LED_MATRIX_FRAMEBUFFER_EFFECTS +#endif // LED_MATRIX_FRAMEBUFFER_EFFECTS #ifdef LED_MATRIX_KEYREACTIVE_ENABLED last_hit_t g_last_hit_tracker; -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED // internals static bool suspend_state = false; @@ -105,13 +105,13 @@ static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false}; static led_task_states led_task_state = SYNCING; #if LED_DISABLE_TIMEOUT > 0 static uint32_t led_anykey_timer; -#endif // LED_DISABLE_TIMEOUT > 0 +#endif // LED_DISABLE_TIMEOUT > 0 // double buffers static uint32_t led_timer_buffer; #ifdef LED_MATRIX_KEYREACTIVE_ENABLED static last_hit_t last_hit_buffer; -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED // split led matrix #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) @@ -120,7 +120,9 @@ const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT; EECONFIG_DEBOUNCE_HELPER(led_matrix, EECONFIG_LED_MATRIX, led_matrix_eeconfig); -void eeconfig_update_led_matrix(void) { eeconfig_flush_led_matrix(true); } +void eeconfig_update_led_matrix(void) { + eeconfig_flush_led_matrix(true); +} void eeconfig_update_led_matrix_default(void) { dprintf("eeconfig_update_led_matrix_default\n"); @@ -141,7 +143,9 @@ void eeconfig_debug_led_matrix(void) { dprintf("led_matrix_eeconfig.flags = %d\n", led_matrix_eeconfig.flags); } -__attribute__((weak)) uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; } +__attribute__((weak)) uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { + return 0; +} uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) { uint8_t led_count = led_matrix_map_row_column_to_led_kb(row, column, led_i); @@ -153,7 +157,9 @@ uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l return led_count; } -void led_matrix_update_pwm_buffers(void) { led_matrix_driver.flush(); } +void led_matrix_update_pwm_buffers(void) { + led_matrix_driver.flush(); +} void led_matrix_set_value(int index, uint8_t value) { #ifdef USE_CIE1931_CURVE @@ -164,7 +170,8 @@ void led_matrix_set_value(int index, uint8_t value) { void led_matrix_set_value_all(uint8_t value) { #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) led_matrix_set_value(i, value); + for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) + led_matrix_set_value(i, value); #else # ifdef USE_CIE1931_CURVE led_matrix_driver.set_value_all(pgm_read_byte(&CIE1931_CURVE[value])); @@ -180,7 +187,7 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { #endif #if LED_DISABLE_TIMEOUT > 0 led_anykey_timer = 0; -#endif // LED_DISABLE_TIMEOUT > 0 +#endif // LED_DISABLE_TIMEOUT > 0 #ifdef LED_MATRIX_KEYREACTIVE_ENABLED uint8_t led[LED_HITS_TO_REMEMBER]; @@ -190,7 +197,7 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { if (!pressed) # elif defined(LED_MATRIX_KEYPRESSES) if (pressed) -# endif // defined(LED_MATRIX_KEYRELEASES) +# endif // defined(LED_MATRIX_KEYRELEASES) { led_count = led_matrix_map_row_column_to_led(row, col, led); } @@ -198,7 +205,7 @@ void process_led_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; } @@ -211,13 +218,13 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { last_hit_buffer.tick[index] = 0; last_hit_buffer.count++; } -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED #if defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_LED_MATRIX_TYPING_HEATMAP) if (led_matrix_eeconfig.mode == LED_MATRIX_TYPING_HEATMAP) { process_led_matrix_typing_heatmap(row, col); } -#endif // defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_LED_MATRIX_TYPING_HEATMAP) +#endif // defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_LED_MATRIX_TYPING_HEATMAP) } static bool led_matrix_none(effect_params_t *params) { @@ -232,7 +239,7 @@ static bool led_matrix_none(effect_params_t *params) { static void led_task_timers(void) { #if defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_DISABLE_TIMEOUT > 0 uint32_t deltaTime = sync_timer_elapsed32(led_timer_buffer); -#endif // defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_DISABLE_TIMEOUT > 0 +#endif // defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_DISABLE_TIMEOUT > 0 led_timer_buffer = sync_timer_read32(); // Update double buffer timers @@ -244,7 +251,7 @@ static void led_task_timers(void) { led_anykey_timer += deltaTime; } } -#endif // LED_DISABLE_TIMEOUT > 0 +#endif // LED_DISABLE_TIMEOUT > 0 // Update double buffer last hit timers #ifdef LED_MATRIX_KEYREACTIVE_ENABLED @@ -256,7 +263,7 @@ static void led_task_timers(void) { } last_hit_buffer.tick[i] += deltaTime; } -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED } static void led_task_sync(void) { @@ -273,7 +280,7 @@ static void led_task_start(void) { g_led_timer = led_timer_buffer; #ifdef LED_MATRIX_KEYREACTIVE_ENABLED g_last_hit_tracker = last_hit_buffer; -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED // next task led_task_state = RENDERING; @@ -352,7 +359,7 @@ void led_matrix_task(void) { bool suspend_backlight = suspend_state || #if LED_DISABLE_TIMEOUT > 0 (led_anykey_timer > (uint32_t)LED_DISABLE_TIMEOUT) || -#endif // LED_DISABLE_TIMEOUT > 0 +#endif // LED_DISABLE_TIMEOUT > 0 false; uint8_t effect = suspend_backlight || !led_matrix_eeconfig.enable ? 0 : led_matrix_eeconfig.mode; @@ -421,7 +428,7 @@ void led_matrix_init(void) { for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) { last_hit_buffer.tick[i] = UINT16_MAX; } -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED if (!eeconfig_is_enabled()) { dprintf("led_matrix_init_drivers eeconfig is not enabled.\n"); @@ -434,20 +441,22 @@ void led_matrix_init(void) { dprintf("led_matrix_init_drivers led_matrix_eeconfig.mode = 0. Write default values to EEPROM.\n"); eeconfig_update_led_matrix_default(); } - eeconfig_debug_led_matrix(); // display current eeprom values + eeconfig_debug_led_matrix(); // display current eeprom values } void led_matrix_set_suspend_state(bool state) { #ifdef LED_DISABLE_WHEN_USB_SUSPENDED - if (state && !suspend_state && is_keyboard_master()) { // only run if turning off, and only once - led_task_render(0); // turn off all LEDs when suspending - led_task_flush(0); // and actually flash led state to LEDs + if (state && !suspend_state && is_keyboard_master()) { // only run if turning off, and only once + led_task_render(0); // turn off all LEDs when suspending + led_task_flush(0); // and actually flash led state to LEDs } suspend_state = state; #endif } -bool led_matrix_get_suspend_state(void) { return suspend_state; } +bool led_matrix_get_suspend_state(void) { + return suspend_state; +} void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) { led_matrix_eeconfig.enable ^= 1; @@ -455,8 +464,12 @@ void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) { eeconfig_flag_led_matrix(write_to_eeprom); dprintf("led matrix toggle [%s]: led_matrix_eeconfig.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.enable); } -void led_matrix_toggle_noeeprom(void) { led_matrix_toggle_eeprom_helper(false); } -void led_matrix_toggle(void) { led_matrix_toggle_eeprom_helper(true); } +void led_matrix_toggle_noeeprom(void) { + led_matrix_toggle_eeprom_helper(false); +} +void led_matrix_toggle(void) { + led_matrix_toggle_eeprom_helper(true); +} void led_matrix_enable(void) { led_matrix_enable_noeeprom(); @@ -478,7 +491,9 @@ void led_matrix_disable_noeeprom(void) { led_matrix_eeconfig.enable = 0; } -uint8_t led_matrix_is_enabled(void) { return led_matrix_eeconfig.enable; } +uint8_t led_matrix_is_enabled(void) { + return led_matrix_eeconfig.enable; +} void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { if (!led_matrix_eeconfig.enable) { @@ -495,24 +510,38 @@ void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { eeconfig_flag_led_matrix(write_to_eeprom); dprintf("led matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.mode); } -void led_matrix_mode_noeeprom(uint8_t mode) { led_matrix_mode_eeprom_helper(mode, false); } -void led_matrix_mode(uint8_t mode) { led_matrix_mode_eeprom_helper(mode, true); } +void led_matrix_mode_noeeprom(uint8_t mode) { + led_matrix_mode_eeprom_helper(mode, false); +} +void led_matrix_mode(uint8_t mode) { + led_matrix_mode_eeprom_helper(mode, true); +} -uint8_t led_matrix_get_mode(void) { return led_matrix_eeconfig.mode; } +uint8_t led_matrix_get_mode(void) { + return led_matrix_eeconfig.mode; +} void led_matrix_step_helper(bool write_to_eeprom) { uint8_t mode = led_matrix_eeconfig.mode + 1; led_matrix_mode_eeprom_helper((mode < LED_MATRIX_EFFECT_MAX) ? mode : 1, write_to_eeprom); } -void led_matrix_step_noeeprom(void) { led_matrix_step_helper(false); } -void led_matrix_step(void) { led_matrix_step_helper(true); } +void led_matrix_step_noeeprom(void) { + led_matrix_step_helper(false); +} +void led_matrix_step(void) { + led_matrix_step_helper(true); +} void led_matrix_step_reverse_helper(bool write_to_eeprom) { uint8_t mode = led_matrix_eeconfig.mode - 1; led_matrix_mode_eeprom_helper((mode < 1) ? LED_MATRIX_EFFECT_MAX - 1 : mode, write_to_eeprom); } -void led_matrix_step_reverse_noeeprom(void) { led_matrix_step_reverse_helper(false); } -void led_matrix_step_reverse(void) { led_matrix_step_reverse_helper(true); } +void led_matrix_step_reverse_noeeprom(void) { + led_matrix_step_reverse_helper(false); +} +void led_matrix_step_reverse(void) { + led_matrix_step_reverse_helper(true); +} void led_matrix_set_val_eeprom_helper(uint8_t val, bool write_to_eeprom) { if (!led_matrix_eeconfig.enable) { @@ -522,37 +551,77 @@ void led_matrix_set_val_eeprom_helper(uint8_t val, bool write_to_eeprom) { eeconfig_flag_led_matrix(write_to_eeprom); dprintf("led matrix set val [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.val); } -void led_matrix_set_val_noeeprom(uint8_t val) { led_matrix_set_val_eeprom_helper(val, false); } -void led_matrix_set_val(uint8_t val) { led_matrix_set_val_eeprom_helper(val, true); } +void led_matrix_set_val_noeeprom(uint8_t val) { + led_matrix_set_val_eeprom_helper(val, false); +} +void led_matrix_set_val(uint8_t val) { + led_matrix_set_val_eeprom_helper(val, true); +} -uint8_t led_matrix_get_val(void) { return led_matrix_eeconfig.val; } +uint8_t led_matrix_get_val(void) { + return led_matrix_eeconfig.val; +} -void led_matrix_increase_val_helper(bool write_to_eeprom) { led_matrix_set_val_eeprom_helper(qadd8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); } -void led_matrix_increase_val_noeeprom(void) { led_matrix_increase_val_helper(false); } -void led_matrix_increase_val(void) { led_matrix_increase_val_helper(true); } +void led_matrix_increase_val_helper(bool write_to_eeprom) { + led_matrix_set_val_eeprom_helper(qadd8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); +} +void led_matrix_increase_val_noeeprom(void) { + led_matrix_increase_val_helper(false); +} +void led_matrix_increase_val(void) { + led_matrix_increase_val_helper(true); +} -void led_matrix_decrease_val_helper(bool write_to_eeprom) { led_matrix_set_val_eeprom_helper(qsub8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); } -void led_matrix_decrease_val_noeeprom(void) { led_matrix_decrease_val_helper(false); } -void led_matrix_decrease_val(void) { led_matrix_decrease_val_helper(true); } +void led_matrix_decrease_val_helper(bool write_to_eeprom) { + led_matrix_set_val_eeprom_helper(qsub8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); +} +void led_matrix_decrease_val_noeeprom(void) { + led_matrix_decrease_val_helper(false); +} +void led_matrix_decrease_val(void) { + led_matrix_decrease_val_helper(true); +} void led_matrix_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) { led_matrix_eeconfig.speed = speed; eeconfig_flag_led_matrix(write_to_eeprom); dprintf("led matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.speed); } -void led_matrix_set_speed_noeeprom(uint8_t speed) { led_matrix_set_speed_eeprom_helper(speed, false); } -void led_matrix_set_speed(uint8_t speed) { led_matrix_set_speed_eeprom_helper(speed, true); } +void led_matrix_set_speed_noeeprom(uint8_t speed) { + led_matrix_set_speed_eeprom_helper(speed, false); +} +void led_matrix_set_speed(uint8_t speed) { + led_matrix_set_speed_eeprom_helper(speed, true); +} -uint8_t led_matrix_get_speed(void) { return led_matrix_eeconfig.speed; } +uint8_t led_matrix_get_speed(void) { + return led_matrix_eeconfig.speed; +} -void led_matrix_increase_speed_helper(bool write_to_eeprom) { led_matrix_set_speed_eeprom_helper(qadd8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); } -void led_matrix_increase_speed_noeeprom(void) { led_matrix_increase_speed_helper(false); } -void led_matrix_increase_speed(void) { led_matrix_increase_speed_helper(true); } +void led_matrix_increase_speed_helper(bool write_to_eeprom) { + led_matrix_set_speed_eeprom_helper(qadd8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); +} +void led_matrix_increase_speed_noeeprom(void) { + led_matrix_increase_speed_helper(false); +} +void led_matrix_increase_speed(void) { + led_matrix_increase_speed_helper(true); +} -void led_matrix_decrease_speed_helper(bool write_to_eeprom) { led_matrix_set_speed_eeprom_helper(qsub8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); } -void led_matrix_decrease_speed_noeeprom(void) { led_matrix_decrease_speed_helper(false); } -void led_matrix_decrease_speed(void) { led_matrix_decrease_speed_helper(true); } +void led_matrix_decrease_speed_helper(bool write_to_eeprom) { + led_matrix_set_speed_eeprom_helper(qsub8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); +} +void led_matrix_decrease_speed_noeeprom(void) { + led_matrix_decrease_speed_helper(false); +} +void led_matrix_decrease_speed(void) { + led_matrix_decrease_speed_helper(true); +} -led_flags_t led_matrix_get_flags(void) { return led_matrix_eeconfig.flags; } +led_flags_t led_matrix_get_flags(void) { + return led_matrix_eeconfig.flags; +} -void led_matrix_set_flags(led_flags_t flags) { led_matrix_eeconfig.flags = flags; } +void led_matrix_set_flags(led_flags_t flags) { + led_matrix_eeconfig.flags = flags; +} diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h index e42be64661..d21f36e295 100644 --- a/quantum/led_matrix/led_matrix.h +++ b/quantum/led_matrix/led_matrix.h @@ -2,6 +2,7 @@ * Copyright 2017 Jack Humbert * Copyright 2018 Yiancar * Copyright 2019 Clueboard + * Copyright 2021 Leo Deng * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +27,11 @@ #ifdef IS31FL3731 # include "is31fl3731-simple.h" +#elif defined(IS31FLCOMMON) +# include "is31flcommon.h" +#endif +#ifdef IS31FL3733 +# include "is31fl3733-simple.h" #endif #ifndef LED_MATRIX_LED_FLUSH_LIMIT diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c index 2157619a0b..847ca1c310 100644 --- a/quantum/led_matrix/led_matrix_drivers.c +++ b/quantum/led_matrix/led_matrix_drivers.c @@ -25,7 +25,7 @@ * in their own files. */ -#if defined(IS31FL3731) || defined(IS31FL3733) +#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FLCOMMON) # include "i2c_master.h" static void init(void) { @@ -66,6 +66,18 @@ static void init(void) { # endif # endif # endif + +# elif defined(IS31FLCOMMON) + IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); +# if defined(LED_DRIVER_ADDR_2) + IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); +# if defined(LED_DRIVER_ADDR_3) + IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); +# if defined(LED_DRIVER_ADDR_4) + IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); +# endif +# endif +# endif # endif for (int index = 0; index < DRIVER_LED_TOTAL; index++) { @@ -73,6 +85,8 @@ static void init(void) { IS31FL3731_set_led_control_register(index, true); # elif defined(IS31FL3733) IS31FL3733_set_led_control_register(index, true); +# elif defined(IS31FLCOMMON) + IS31FL_simple_set_scaling_buffer(index, true); # endif } @@ -100,6 +114,21 @@ static void init(void) { # endif # endif # endif + +# elif defined(IS31FLCOMMON) +# ifdef ISSI_MANUAL_SCALING + IS31FL_set_manual_scaling_buffer(); +# endif + IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); +# if defined(LED_DRIVER_ADDR_2) + IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); +# if defined(LED_DRIVER_ADDR_3) + IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); +# if defined(LED_DRIVER_ADDR_4) + IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); +# endif +# endif +# endif # endif } @@ -144,5 +173,26 @@ const led_matrix_driver_t led_matrix_driver = { .set_value = IS31FL3733_set_value, .set_value_all = IS31FL3733_set_value_all, }; + +# elif defined(IS31FLCOMMON) +static void flush(void) { + IS31FL_common_update_pwm_register(DRIVER_ADDR_1, 0); +# if defined(LED_DRIVER_ADDR_2) + IS31FL_common_update_pwm_register(DRIVER_ADDR_2, 1); +# if defined(LED_DRIVER_ADDR_3) + IS31FL_common_update_pwm_register(DRIVER_ADDR_3, 2); +# if defined(LED_DRIVER_ADDR_4) + IS31FL_common_update_pwm_register(DRIVER_ADDR_4, 3); +# endif +# endif +# endif +} + +const led_matrix_driver_t led_matrix_driver = { + .init = init, + .flush = flush, + .set_value = IS31FL_simple_set_brightness, + .set_value_all = IS31FL_simple_set_brigntness_all, +}; # endif #endif diff --git a/quantum/led_matrix/led_matrix_types.h b/quantum/led_matrix/led_matrix_types.h index 61cdbd9b8e..3dc533100f 100644 --- a/quantum/led_matrix/led_matrix_types.h +++ b/quantum/led_matrix/led_matrix_types.h @@ -36,7 +36,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 LED_MATRIX_KEYREACTIVE_ENABLED typedef struct PACKED { @@ -46,7 +46,7 @@ typedef struct PACKED { uint8_t index[LED_HITS_TO_REMEMBER]; uint16_t tick[LED_HITS_TO_REMEMBER]; } last_hit_t; -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED typedef enum led_task_states { STARTING, RENDERING, FLUSHING, SYNCING } led_task_states; @@ -87,7 +87,7 @@ typedef union { uint8_t mode : 6; uint16_t reserved; uint8_t val; - 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; }; } led_eeconfig_t; |