From a29ca1e7f1a5addfde163b158399684505453fc9 Mon Sep 17 00:00:00 2001 From: Vlad K Date: Mon, 1 Nov 2021 15:04:37 -0700 Subject: Add support for ISSI drivers on both sides of a split keyboard (#13842) * Gets RGB working on a split keyboard with IS31FL3733. Currently needs small tweak to re-enable WS2812 * Added helper function * Trying to integrate the function * Moved functionality into a macro * Swapped conditional for a macro everywhere * Tidying up * More code cleanup * Documentation updates * Fixed formatting via linter * Switching to a function from a macro * Fixed compile error * Fixing WS2812 behavior. UNTESTED. * Updated documentation about the driver addresses. * Fixed code for WS2812 * Trying to add in LED_MATRIX support * Updated effects for LED matrix * Updated third-party effect defines. * Ran format-c on modified files * Apply suggestions from code review Co-authored-by: Ryan * Move to static inline. Avoids issues with gcc v8+ * Move helper function for LED_matrix to static inline to avoid issues with gcc v8+ Co-authored-by: Vlad Kvitnevskiy Co-authored-by: Ryan --- quantum/rgb_matrix/rgb_matrix.h | 45 ++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'quantum/rgb_matrix/rgb_matrix.h') diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index f53e011c1b..112dfaaae5 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h @@ -48,14 +48,33 @@ #endif #if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL -# define RGB_MATRIX_USE_LIMITS(min, max) \ - uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \ - uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ - if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; +# if defined(RGB_MATRIX_SPLIT) +# define RGB_MATRIX_USE_LIMITS(min, max) \ + uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \ + uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ + if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; \ + uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \ + if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \ + if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0]; +# else +# define RGB_MATRIX_USE_LIMITS(min, max) \ + uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \ + uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ + if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; +# endif #else -# define RGB_MATRIX_USE_LIMITS(min, max) \ - uint8_t min = 0; \ - uint8_t max = DRIVER_LED_TOTAL; +# if defined(RGB_MATRIX_SPLIT) +# define RGB_MATRIX_USE_LIMITS(min, max) \ + uint8_t min = 0; \ + uint8_t max = DRIVER_LED_TOTAL; \ + const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \ + if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \ + if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0]; +# else +# define RGB_MATRIX_USE_LIMITS(min, max) \ + uint8_t min = 0; \ + uint8_t max = DRIVER_LED_TOTAL; +# endif #endif #define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \ @@ -214,6 +233,18 @@ typedef struct { void (*flush)(void); } rgb_matrix_driver_t; +static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) { +#if defined(RGB_MATRIX_SPLIT) + if (is_keyboard_left()) { + uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; + return led_idx < k_rgb_matrix_split[0]; + } else + return led_idx < DRIVER_LED_TOTAL; +#else + return led_idx < DRIVER_LED_TOTAL; +#endif +} + extern const rgb_matrix_driver_t rgb_matrix_driver; extern rgb_config_t rgb_matrix_config; -- cgit v1.2.3 From f4ea262c17ecd53b18180a19c33a9ba5da70ec9d Mon Sep 17 00:00:00 2001 From: lalalademaxiya1 <66767061+lalalademaxiya1@users.noreply.github.com> Date: Tue, 2 Nov 2021 06:43:53 +0800 Subject: Add a new led driver for Keychron's keyboards. (#14872) * Add a new led driver for Keychron's keyboards. * Update ckled2001.c/ckled2001.h. * Update ckled2001.c/ckled2001.h. * Update ckled2001.c/ckled2001.h. * Update ckled2001.c * Add a new led driver * Update ckled2001.c * Update ckled2001.c * Update ckled2001.c * Update ckled2001.c * Delete ckled2001.c * Create ckled2001.c * Update ckled2001.c * Update chibios-contrib Co-authored-by: keychron-dev <85598583+keychron-dev@users.noreply.github.com> Co-authored-by: lokher --- quantum/rgb_matrix/rgb_matrix.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'quantum/rgb_matrix/rgb_matrix.h') diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index 112dfaaae5..af5ca9e791 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h @@ -33,6 +33,8 @@ # include "is31fl3737.h" #elif defined(IS31FL3741) # include "is31fl3741.h" +#elif defined(CKLED2001) +# include "ckled2001.h" #elif defined(AW20216) # include "aw20216.h" #elif defined(WS2812) -- cgit v1.2.3 From 160b0558f55f1357e1a48175c949e98d32630e6b Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 15 Nov 2021 10:41:04 -0800 Subject: Require explicit enabling of RGB Matrix modes (#15018) --- quantum/rgb_matrix/rgb_matrix.h | 1 - 1 file changed, 1 deletion(-) (limited to 'quantum/rgb_matrix/rgb_matrix.h') diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index af5ca9e791..a804d99abc 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h @@ -23,7 +23,6 @@ #include "rgb_matrix_types.h" #include "color.h" #include "quantum.h" -#include "rgb_matrix_legacy_enables.h" #ifdef IS31FL3731 # include "is31fl3731.h" -- cgit v1.2.3