From 4f2517ddfbde80769cbd1f682454f3c4b3e1e03d Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Tue, 2 Jan 2024 14:08:43 +0200 Subject: [PATCH 01/19] sn32f24xb rgb: guard for missing SN32_RGB_MATRIX_ROW_PINS --- drivers/led/sn32/rgb_matrix_sn32f24xb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/led/sn32/rgb_matrix_sn32f24xb.c b/drivers/led/sn32/rgb_matrix_sn32f24xb.c index b006feed2f20..1eba73764077 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f24xb.c +++ b/drivers/led/sn32/rgb_matrix_sn32f24xb.c @@ -45,6 +45,10 @@ # define SN32_RGB_MATRIX_COLS MATRIX_COLS #endif +#if !defined(SN32_RGB_MATRIX_ROW_PINS) +# error Missing definition for SN32_RGB_MATRIX_ROW_PINS +#endif + #if !defined(SN32_RGB_MATRIX_COL_PINS) # define SN32_RGB_MATRIX_COL_PINS MATRIX_COL_PINS #endif From c78b92c7c5657a599b74af7713212abab9db34b7 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Tue, 2 Jan 2024 14:50:58 +0200 Subject: [PATCH 02/19] sn32 shared matrix: autodetect if the matrix is shared migrate configs in header --- builddefs/common_features.mk | 1 - drivers/led/sn32/rgb_matrix_sn32f24xb.c | 38 ---------------------- drivers/led/sn32/sn32f24xb.h | 43 ++++++++++++++++++++++++- quantum/matrix.h | 3 ++ 4 files changed, 45 insertions(+), 40 deletions(-) diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index b7333cee938c..584a0b960a6d 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -567,7 +567,6 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) endif ifeq ($(strip $(RGB_MATRIX_DRIVER)), sn32f24xb) - OPT_DEFS += -DSHARED_MATRIX COMMON_VPATH += $(DRIVER_PATH)/led/sn32 SRC += rgb_matrix_sn32f24xb.c endif diff --git a/drivers/led/sn32/rgb_matrix_sn32f24xb.c b/drivers/led/sn32/rgb_matrix_sn32f24xb.c index 1eba73764077..56cee325fc8e 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f24xb.c +++ b/drivers/led/sn32/rgb_matrix_sn32f24xb.c @@ -12,50 +12,12 @@ #define SN32_PWM_OUTPUT_ACTIVE_HIGH PWM_OUTPUT_ACTIVE_HIGH #define SN32_PWM_OUTPUT_ACTIVE_LOW PWM_OUTPUT_ACTIVE_LOW -#if !defined(SN32_PWM_OUTPUT_ACTIVE_LEVEL) -# define SN32_PWM_OUTPUT_ACTIVE_LEVEL SN32_PWM_OUTPUT_ACTIVE_LOW -#endif - #define SN32_RGB_OUTPUT_ACTIVE_HIGH PWM_OUTPUT_ACTIVE_HIGH #define SN32_RGB_OUTPUT_ACTIVE_LOW PWM_OUTPUT_ACTIVE_LOW -#if !defined(SN32_RGB_OUTPUT_ACTIVE_LEVEL) -# define SN32_RGB_OUTPUT_ACTIVE_LEVEL SN32_RGB_OUTPUT_ACTIVE_HIGH -#endif - #define HARDWARE_PWM 0 #define SOFTWARE_PWM 1 -#if !defined(SN32_PWM_CONTROL) -# define SN32_PWM_CONTROL HARDWARE_PWM -#endif - -#if !defined(SN32_PWM_DIRECTION) -# define SN32_PWM_DIRECTION DIODE_DIRECTION -#endif - -#if !defined(SN32_RGB_MATRIX_ROW_CHANNELS) -# define SN32_RGB_MATRIX_ROW_CHANNELS 3 -#endif -#if !defined(SN32_RGB_MATRIX_ROWS) -# define SN32_RGB_MATRIX_ROWS MATRIX_ROWS -#endif - -#if !defined(SN32_RGB_MATRIX_COLS) -# define SN32_RGB_MATRIX_COLS MATRIX_COLS -#endif - -#if !defined(SN32_RGB_MATRIX_ROW_PINS) -# error Missing definition for SN32_RGB_MATRIX_ROW_PINS -#endif - -#if !defined(SN32_RGB_MATRIX_COL_PINS) -# define SN32_RGB_MATRIX_COL_PINS MATRIX_COL_PINS -#endif - -#if !defined(SN32_RGB_MATRIX_ROWS_HW) -# define SN32_RGB_MATRIX_ROWS_HW (SN32_RGB_MATRIX_ROWS * SN32_RGB_MATRIX_ROW_CHANNELS) -#endif /* Default configuration example diff --git a/drivers/led/sn32/sn32f24xb.h b/drivers/led/sn32/sn32f24xb.h index 1b2cb165c0d9..55c3264e77bd 100644 --- a/drivers/led/sn32/sn32f24xb.h +++ b/drivers/led/sn32/sn32f24xb.h @@ -4,7 +4,48 @@ #include #if defined(RGB_MATRIX_SN32F24XB) -# define SN32F24XB_LED_COUNT RGB_MATRIX_LED_COUNT +# define SN32F24XB_LED_COUNT RGB_MATRIX_LED_COUNT +#endif + +#if !defined(SN32_PWM_OUTPUT_ACTIVE_LEVEL) +# define SN32_PWM_OUTPUT_ACTIVE_LEVEL SN32_PWM_OUTPUT_ACTIVE_LOW +#endif + +#if !defined(SN32_RGB_OUTPUT_ACTIVE_LEVEL) +# define SN32_RGB_OUTPUT_ACTIVE_LEVEL SN32_RGB_OUTPUT_ACTIVE_HIGH +#endif + +#if !defined(SN32_PWM_CONTROL) +# define SN32_PWM_CONTROL HARDWARE_PWM +#endif + +#if !defined(SN32_PWM_DIRECTION) +# define SN32_PWM_DIRECTION DIODE_DIRECTION +#endif + +#if !defined(SN32_RGB_MATRIX_ROW_CHANNELS) +# define SN32_RGB_MATRIX_ROW_CHANNELS 3 +#endif + +#if !defined(SN32_RGB_MATRIX_ROWS) +# define SN32_RGB_MATRIX_ROWS MATRIX_ROWS +#endif + +#if !defined(SN32_RGB_MATRIX_COLS) +# define SN32_RGB_MATRIX_COLS MATRIX_COLS +#endif + +#if !defined(SN32_RGB_MATRIX_ROW_PINS) +# error Missing definition for SN32_RGB_MATRIX_ROW_PINS +#endif + +#if !defined(SN32_RGB_MATRIX_COL_PINS) +# define SHARED_MATRIX +# define SN32_RGB_MATRIX_COL_PINS MATRIX_COL_PINS +#endif + +#if !defined(SN32_RGB_MATRIX_ROWS_HW) +# define SN32_RGB_MATRIX_ROWS_HW (SN32_RGB_MATRIX_ROWS * SN32_RGB_MATRIX_ROW_CHANNELS) #endif void sn32f24xb_init(void); diff --git a/quantum/matrix.h b/quantum/matrix.h index f14ebd4c5ec5..51f51dd24c99 100644 --- a/quantum/matrix.h +++ b/quantum/matrix.h @@ -20,6 +20,9 @@ along with this program. If not, see . #include #include #include "gpio.h" +#if defined(RGB_MATRIX_ENABLE) +# include "rgb_matrix_drivers.h" +#endif /* diode directions */ #define COL2ROW 0 From 6be30cf2d94fc9cb256b2ad97308ba2d69cbfb0c Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Tue, 2 Jan 2024 14:28:22 +0200 Subject: [PATCH 03/19] flesports/fl980: simplify declarations --- keyboards/flesports/fl980/config.h | 2 - keyboards/flesports/fl980/info.json | 196 ++++++++++++++-------------- 2 files changed, 98 insertions(+), 100 deletions(-) diff --git a/keyboards/flesports/fl980/config.h b/keyboards/flesports/fl980/config.h index 14d7b23c77ef..9c9589108458 100644 --- a/keyboards/flesports/fl980/config.h +++ b/keyboards/flesports/fl980/config.h @@ -18,8 +18,6 @@ #define SN32_RGB_MATRIX_ROW_PINS { C0,C1,C3, C4,C5,C6, C7,C8,C9, C10,C11,C12, C13,C14,B13, C15,B15,B14 } -#define SN32_RGB_MATRIX_COL_PINS { B9, A8, A9, A10, A11, A12, A13, A14, A15, B0, B1, B2, B3, B4, B5, B6, B7, B8 } - #define RGB_MATRIX_LED_COUNT 98 #define MATRIX_UNSELECT_DRIVE_HIGH #define SN32_PWM_OUTPUT_ACTIVE_LEVEL SN32_PWM_OUTPUT_ACTIVE_HIGH diff --git a/keyboards/flesports/fl980/info.json b/keyboards/flesports/fl980/info.json index 2b9a6e5e8e28..9e31c7473128 100644 --- a/keyboards/flesports/fl980/info.json +++ b/keyboards/flesports/fl980/info.json @@ -76,109 +76,109 @@ }, "driver": "sn32f24xb", "layout": [ - { "matrix":[0, 0], "flags":4, "x":0, "y":0 }, - { "matrix":[0, 1], "flags":4, "x":24, "y":0 }, - { "matrix":[0, 2], "flags":4, "x":36, "y":0 }, - { "matrix":[0, 3], "flags":4, "x":48, "y":0 }, - { "matrix":[0, 4], "flags":4, "x":61, "y":0 }, - { "matrix":[0, 5], "flags":4, "x":79, "y":0 }, - { "matrix":[0, 6], "flags":4, "x":91, "y":0 }, - { "matrix":[0, 7], "flags":4, "x":103, "y":0 }, - { "matrix":[0, 8], "flags":4, "x":115, "y":0 }, - { "matrix":[0, 9], "flags":4, "x":133, "y":0 }, - { "matrix":[0, 10], "flags":4, "x":145, "y":0 }, - { "matrix":[0, 11], "flags":4, "x":157, "y":0 }, - { "matrix":[0, 12], "flags":4, "x":170, "y":0 }, - { "matrix":[0, 14], "flags":4, "x":188, "y":0 }, - { "matrix":[0, 15], "flags":4, "x":200, "y":0 }, - { "matrix":[0, 16], "flags":4, "x":212, "y":0 }, - { "matrix":[0, 17], "flags":4, "x":224, "y":0 }, + { "matrix":[0, 17], "flags":4, "x":0, "y":0 }, + { "matrix":[0, 0], "flags":4, "x":24, "y":0 }, + { "matrix":[0, 1], "flags":4, "x":36, "y":0 }, + { "matrix":[0, 2], "flags":4, "x":48, "y":0 }, + { "matrix":[0, 3], "flags":4, "x":61, "y":0 }, + { "matrix":[0, 4], "flags":4, "x":79, "y":0 }, + { "matrix":[0, 5], "flags":4, "x":91, "y":0 }, + { "matrix":[0, 6], "flags":4, "x":103, "y":0 }, + { "matrix":[0, 7], "flags":4, "x":115, "y":0 }, + { "matrix":[0, 8], "flags":4, "x":133, "y":0 }, + { "matrix":[0, 9], "flags":4, "x":145, "y":0 }, + { "matrix":[0, 10], "flags":4, "x":157, "y":0 }, + { "matrix":[0, 11], "flags":4, "x":170, "y":0 }, + { "matrix":[0, 12], "flags":4, "x":188, "y":0 }, + { "matrix":[0, 14], "flags":4, "x":200, "y":0 }, + { "matrix":[0, 15], "flags":4, "x":212, "y":0 }, + { "matrix":[0, 16], "flags":4, "x":224, "y":0 }, - { "matrix":[1, 0], "flags":4, "x":0, "y":15 }, - { "matrix":[1, 1], "flags":4, "x":12, "y":15 }, - { "matrix":[1, 2], "flags":4, "x":24, "y":15 }, - { "matrix":[1, 3], "flags":4, "x":36, "y":15 }, - { "matrix":[1, 4], "flags":4, "x":48, "y":15 }, - { "matrix":[1, 5], "flags":4, "x":61, "y":15 }, - { "matrix":[1, 6], "flags":4, "x":73, "y":15 }, - { "matrix":[1, 7], "flags":4, "x":85, "y":15 }, - { "matrix":[1, 8], "flags":4, "x":97, "y":15 }, - { "matrix":[1, 9], "flags":4, "x":109, "y":15 }, - { "matrix":[1, 10], "flags":4, "x":121, "y":15 }, - { "matrix":[1, 11], "flags":4, "x":133, "y":15 }, - { "matrix":[1, 12], "flags":4, "x":145, "y":15 }, - { "matrix":[1, 13], "flags":4, "x":163, "y":15 }, - { "matrix":[1, 14], "flags":4, "x":188, "y":15 }, - { "matrix":[1, 15], "flags":4, "x":200, "y":15 }, - { "matrix":[1, 16], "flags":4, "x":212, "y":15 }, - { "matrix":[1, 17], "flags":4, "x":224, "y":15 }, + { "matrix":[1, 17], "flags":4, "x":0, "y":15 }, + { "matrix":[1, 0], "flags":4, "x":12, "y":15 }, + { "matrix":[1, 1], "flags":4, "x":24, "y":15 }, + { "matrix":[1, 2], "flags":4, "x":36, "y":15 }, + { "matrix":[1, 3], "flags":4, "x":48, "y":15 }, + { "matrix":[1, 4], "flags":4, "x":61, "y":15 }, + { "matrix":[1, 5], "flags":4, "x":73, "y":15 }, + { "matrix":[1, 6], "flags":4, "x":85, "y":15 }, + { "matrix":[1, 7], "flags":4, "x":97, "y":15 }, + { "matrix":[1, 8], "flags":4, "x":109, "y":15 }, + { "matrix":[1, 9], "flags":4, "x":121, "y":15 }, + { "matrix":[1, 10], "flags":4, "x":133, "y":15 }, + { "matrix":[1, 11], "flags":4, "x":145, "y":15 }, + { "matrix":[1, 12], "flags":4, "x":163, "y":15 }, + { "matrix":[1, 13], "flags":4, "x":188, "y":15 }, + { "matrix":[1, 14], "flags":4, "x":200, "y":15 }, + { "matrix":[1, 15], "flags":4, "x":212, "y":15 }, + { "matrix":[1, 16], "flags":4, "x":224, "y":15 }, - { "matrix":[2, 0], "flags":4, "x":3, "y":26 }, - { "matrix":[2, 1], "flags":4, "x":18, "y":26 }, - { "matrix":[2, 2], "flags":4, "x":30, "y":26 }, - { "matrix":[2, 3], "flags":4, "x":42, "y":26 }, - { "matrix":[2, 4], "flags":4, "x":54, "y":26 }, - { "matrix":[2, 5], "flags":4, "x":67, "y":26 }, - { "matrix":[2, 6], "flags":4, "x":79, "y":26 }, - { "matrix":[2, 7], "flags":4, "x":91, "y":26 }, - { "matrix":[2, 8], "flags":4, "x":103, "y":26 }, - { "matrix":[2, 9], "flags":4, "x":115, "y":26 }, - { "matrix":[2, 10], "flags":4, "x":127, "y":26 }, - { "matrix":[2, 11], "flags":4, "x":139, "y":26 }, - { "matrix":[2, 12], "flags":4, "x":151, "y":26 }, - { "matrix":[2, 13], "flags":4, "x":166, "y":26 }, - { "matrix":[2, 14], "flags":4, "x":188, "y":26 }, - { "matrix":[2, 15], "flags":4, "x":200, "y":26 }, - { "matrix":[2, 16], "flags":4, "x":212, "y":26 }, - { "matrix":[2, 17], "flags":4, "x":224, "y":32 }, + { "matrix":[2, 17], "flags":4, "x":3, "y":26 }, + { "matrix":[2, 0], "flags":4, "x":18, "y":26 }, + { "matrix":[2, 1], "flags":4, "x":30, "y":26 }, + { "matrix":[2, 2], "flags":4, "x":42, "y":26 }, + { "matrix":[2, 3], "flags":4, "x":54, "y":26 }, + { "matrix":[2, 4], "flags":4, "x":67, "y":26 }, + { "matrix":[2, 5], "flags":4, "x":79, "y":26 }, + { "matrix":[2, 6], "flags":4, "x":91, "y":26 }, + { "matrix":[2, 7], "flags":4, "x":103, "y":26 }, + { "matrix":[2, 8], "flags":4, "x":115, "y":26 }, + { "matrix":[2, 9], "flags":4, "x":127, "y":26 }, + { "matrix":[2, 10], "flags":4, "x":139, "y":26 }, + { "matrix":[2, 11], "flags":4, "x":151, "y":26 }, + { "matrix":[2, 12], "flags":4, "x":166, "y":26 }, + { "matrix":[2, 13], "flags":4, "x":188, "y":26 }, + { "matrix":[2, 14], "flags":4, "x":200, "y":26 }, + { "matrix":[2, 15], "flags":4, "x":212, "y":26 }, + { "matrix":[2, 16], "flags":4, "x":224, "y":32 }, - { "matrix":[3, 0], "flags":4, "x":5, "y":38 }, - { "matrix":[3, 1], "flags":4, "x":21, "y":38 }, - { "matrix":[3, 2], "flags":4, "x":33, "y":38 }, - { "matrix":[3, 3], "flags":4, "x":45, "y":38 }, - { "matrix":[3, 4], "flags":4, "x":58, "y":38 }, - { "matrix":[3, 5], "flags":4, "x":70, "y":38 }, - { "matrix":[3, 6], "flags":4, "x":82, "y":38 }, - { "matrix":[3, 7], "flags":4, "x":94, "y":38 }, - { "matrix":[3, 8], "flags":4, "x":106, "y":38 }, - { "matrix":[3, 9], "flags":4, "x":118, "y":38 }, - { "matrix":[3, 10], "flags":4, "x":130, "y":38 }, - { "matrix":[3, 11], "flags":4, "x":142, "y":38 }, - { "matrix":[3, 13], "flags":4, "x":162, "y":38 }, - { "matrix":[3, 14], "flags":4, "x":188, "y":38 }, - { "matrix":[3, 15], "flags":4, "x":200, "y":38 }, - { "matrix":[3, 16], "flags":4, "x":212, "y":38 }, - { "matrix":[3, 17], "flags":4, "x":224, "y":55 }, + { "matrix":[3, 17], "flags":4, "x":5, "y":38 }, + { "matrix":[3, 0], "flags":4, "x":21, "y":38 }, + { "matrix":[3, 1], "flags":4, "x":33, "y":38 }, + { "matrix":[3, 2], "flags":4, "x":45, "y":38 }, + { "matrix":[3, 3], "flags":4, "x":58, "y":38 }, + { "matrix":[3, 4], "flags":4, "x":70, "y":38 }, + { "matrix":[3, 5], "flags":4, "x":82, "y":38 }, + { "matrix":[3, 6], "flags":4, "x":94, "y":38 }, + { "matrix":[3, 7], "flags":4, "x":106, "y":38 }, + { "matrix":[3, 8], "flags":4, "x":118, "y":38 }, + { "matrix":[3, 9], "flags":4, "x":130, "y":38 }, + { "matrix":[3, 10], "flags":4, "x":142, "y":38 }, + { "matrix":[3, 11], "flags":4, "x":162, "y":38 }, + { "matrix":[3, 13], "flags":4, "x":188, "y":38 }, + { "matrix":[3, 14], "flags":4, "x":200, "y":38 }, + { "matrix":[3, 15], "flags":4, "x":212, "y":38 }, + { "matrix":[3, 16], "flags":4, "x":224, "y":55 }, - { "matrix":[4, 0], "flags":4, "x":8, "y":49 }, - { "matrix":[4, 2], "flags":4, "x":27, "y":49 }, - { "matrix":[4, 3], "flags":4, "x":39, "y":49 }, - { "matrix":[4, 4], "flags":4, "x":51, "y":49 }, - { "matrix":[4, 5], "flags":4, "x":64, "y":49 }, - { "matrix":[4, 6], "flags":4, "x":76, "y":49 }, - { "matrix":[4, 7], "flags":4, "x":88, "y":49 }, - { "matrix":[4, 8], "flags":4, "x":100, "y":49 }, - { "matrix":[4, 9], "flags":4, "x":112, "y":49 }, - { "matrix":[4, 10], "flags":4, "x":124, "y":49 }, - { "matrix":[4, 11], "flags":4, "x":136, "y":49 }, - { "matrix":[4, 13], "flags":4, "x":153, "y":49 }, - { "matrix":[4, 14], "flags":4, "x":188, "y":49 }, - { "matrix":[4, 15], "flags":4, "x":200, "y":49 }, - { "matrix":[4, 16], "flags":4, "x":212, "y":49 }, - { "matrix":[4, 17], "flags":4, "x":212, "y":61 }, + { "matrix":[4, 17], "flags":4, "x":8, "y":49 }, + { "matrix":[4, 0], "flags":4, "x":27, "y":49 }, + { "matrix":[4, 2], "flags":4, "x":39, "y":49 }, + { "matrix":[4, 3], "flags":4, "x":51, "y":49 }, + { "matrix":[4, 4], "flags":4, "x":64, "y":49 }, + { "matrix":[4, 5], "flags":4, "x":76, "y":49 }, + { "matrix":[4, 6], "flags":4, "x":88, "y":49 }, + { "matrix":[4, 7], "flags":4, "x":100, "y":49 }, + { "matrix":[4, 8], "flags":4, "x":112, "y":49 }, + { "matrix":[4, 9], "flags":4, "x":124, "y":49 }, + { "matrix":[4, 10], "flags":4, "x":136, "y":49 }, + { "matrix":[4, 11], "flags":4, "x":153, "y":49 }, + { "matrix":[4, 13], "flags":4, "x":188, "y":49 }, + { "matrix":[4, 14], "flags":4, "x":200, "y":49 }, + { "matrix":[4, 15], "flags":4, "x":212, "y":49 }, + { "matrix":[4, 16], "flags":4, "x":212, "y":61 }, - { "matrix":[5, 0], "flags":4, "x":2, "y":61 }, - { "matrix":[5, 1], "flags":4, "x":17, "y":61 }, - { "matrix":[5, 2], "flags":4, "x":32, "y":61 }, - { "matrix":[5, 6], "flags":4, "x":77, "y":61 }, - { "matrix":[5, 10], "flags":4, "x":121, "y":61 }, - { "matrix":[5, 11], "flags":4, "x":133, "y":61 }, - { "matrix":[5, 12], "flags":4, "x":145, "y":61 }, - { "matrix":[5, 13], "flags":4, "x":173, "y":52 }, - { "matrix":[5, 14], "flags":4, "x":160, "y":64 }, - { "matrix":[5, 15], "flags":4, "x":173, "y":64 }, - { "matrix":[5, 16], "flags":4, "x":185, "y":64 }, - { "matrix":[5, 17], "flags":4, "x":200, "y":61 } + { "matrix":[5, 17], "flags":4, "x":2, "y":61 }, + { "matrix":[5, 0], "flags":4, "x":17, "y":61 }, + { "matrix":[5, 1], "flags":4, "x":32, "y":61 }, + { "matrix":[5, 2], "flags":4, "x":77, "y":61 }, + { "matrix":[5, 6], "flags":4, "x":121, "y":61 }, + { "matrix":[5, 10], "flags":4, "x":133, "y":61 }, + { "matrix":[5, 11], "flags":4, "x":145, "y":61 }, + { "matrix":[5, 12], "flags":4, "x":173, "y":52 }, + { "matrix":[5, 13], "flags":4, "x":160, "y":64 }, + { "matrix":[5, 14], "flags":4, "x":173, "y":64 }, + { "matrix":[5, 15], "flags":4, "x":185, "y":64 }, + { "matrix":[5, 16], "flags":4, "x":200, "y":61 } ], "react_on_keyup": true, "sleep": true From 9c77233813abc9ac4425ae8807060296fb163e59 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Tue, 2 Jan 2024 15:05:14 +0200 Subject: [PATCH 04/19] sn32 rgb driver: decouple key from rgb matrix only use custom scanning if the wiring is shared --- drivers/led/sn32/rgb_matrix_sn32f24xb.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/led/sn32/rgb_matrix_sn32f24xb.c b/drivers/led/sn32/rgb_matrix_sn32f24xb.c index 56cee325fc8e..123109e62b3a 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f24xb.c +++ b/drivers/led/sn32/rgb_matrix_sn32f24xb.c @@ -71,11 +71,13 @@ static uint8_t led_duty_cycle[SN32_RGB_MATRIX_ROWS_HW] = {0}; // track the chann #if (DIODE_DIRECTION == ROW2COL) static matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; #endif +#if defined(SHARED_MATRIX) extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values static matrix_row_t shared_matrix[MATRIX_ROWS]; // scan values static volatile bool matrix_locked = false; // matrix update check static volatile bool matrix_scanned = false; +#endif // SHARED MATRIX static const uint32_t periodticks = RGB_MATRIX_MAXIMUM_BRIGHTNESS; static const uint32_t freq = (RGB_MATRIX_HUE_STEP * RGB_MATRIX_SAT_STEP * RGB_MATRIX_VAL_STEP * RGB_MATRIX_SPD_STEP * RGB_MATRIX_LED_PROCESS_LIMIT); static const pin_t led_row_pins[SN32_RGB_MATRIX_ROWS_HW] = SN32_RGB_MATRIX_ROW_PINS; // We expect a R,B,G order here @@ -87,6 +89,7 @@ bool led_state_buf_update_required = false; static const uint8_t underglow_leds[UNDERGLOW_LEDS] = UNDERGLOW_IDX; #endif +#if defined(SHARED_MATRIX) void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { for (int i = 0; i < TIME_US2I(MATRIX_IO_DELAY); ++i) { __asm__ volatile("" ::: "memory"); @@ -95,6 +98,7 @@ void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { bool matrix_can_read(void) { return matrix_scanned; } +#endif // SHARED_MATRIX /* PWM configuration structure. We use timer CT16B1 with 24 channels. */ static PWMConfig pwmcfg = { @@ -152,6 +156,7 @@ static void shared_matrix_rgb_enable(void) { pwmEnablePeriodicNotification(&PWMD1); } +#if defined(SHARED_MATRIX) static void shared_matrix_scan_keys(matrix_row_t current_matrix[], uint8_t current_key, uint8_t last_key) { // Scan the key matrix row or col, depending on DIODE_DIRECTION static uint8_t first_scanned; @@ -190,6 +195,7 @@ static void shared_matrix_scan_keys(matrix_row_t current_matrix[], uint8_t curre } } } +#endif // SHARED_MATRIX #if (SN32_PWM_DIRECTION == COL2ROW) @@ -217,7 +223,9 @@ static void update_pwm_channels(PWMDriver *pwmp) { current_row++; /* Check if counter has wrapped around, reset before the next pass */ if (current_row == SN32_RGB_MATRIX_ROWS_HW) current_row = 0; +# if defined(SHARED_MATRIX) uint8_t last_key_row = current_key_row; +# endif // SHARED_MATRIX // Advance to the next key matrix row # if (SN32_PWM_CONTROL == HARDWARE_PWM) if (current_row % SN32_RGB_MATRIX_ROW_CHANNELS == 2) current_key_row++; @@ -229,7 +237,9 @@ static void update_pwm_channels(PWMDriver *pwmp) { // Disable LED output before scanning the key matrix if (current_key_row < ROWS_PER_HAND) { shared_matrix_rgb_disable_output(); +# if defined(SHARED_MATRIX) shared_matrix_scan_keys(shared_matrix, current_key_row, last_key_row); +# endif // SHARED_MATRIX } bool enable_pwm_output = false; for (uint8_t current_key_col = 0; current_key_col < SN32_RGB_MATRIX_COLS; current_key_col++) { @@ -329,7 +339,9 @@ static void update_pwm_channels(PWMDriver *pwmp) { // Disable LED output before scanning the key matrix if (current_key_col < MATRIX_COLS) { shared_matrix_rgb_disable_output(); +# if defined(SHARED_MATRIX) shared_matrix_scan_keys(shared_matrix, current_key_col, last_key_col); +# endif // SHARED_MATRIX } for (uint8_t x = 0; x < SN32_RGB_MATRIX_COLS; x++) { @@ -440,10 +452,14 @@ void sn32f24xb_init(void) { } // Determine which PWM channels we need to control rgb_ch_ctrl(&pwmcfg); + +# if defined(SHARED_MATRIX) // initialize matrix state: all keys off for (uint8_t i = 0; i < MATRIX_ROWS; i++) { shared_matrix[i] = 0; } +# endif // SHARED_MATRIX + pwmStart(&PWMD1, &pwmcfg); shared_matrix_rgb_enable(); } @@ -493,6 +509,7 @@ void sn32f24xb_set_color_all(uint8_t r, uint8_t g, uint8_t b) { } } +#if defined(SHARED_MATRIX) bool matrix_scan_custom(matrix_row_t current_matrix[]) { if (!matrix_scanned) return false; // Nothing to process until we have the matrix scanned @@ -502,4 +519,5 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { matrix_scanned = false; return changed; -} \ No newline at end of file +} +#endif // SHARED_MATRIX \ No newline at end of file From d07ea53b8db8484d8a74108decaa12708711c29d Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Tue, 2 Jan 2024 15:17:02 +0200 Subject: [PATCH 05/19] sn32 rgb driver: make sure init state is off depending on configuration --- drivers/led/sn32/rgb_matrix_sn32f24xb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/led/sn32/rgb_matrix_sn32f24xb.c b/drivers/led/sn32/rgb_matrix_sn32f24xb.c index 123109e62b3a..1f6ce5bc6730 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f24xb.c +++ b/drivers/led/sn32/rgb_matrix_sn32f24xb.c @@ -448,7 +448,11 @@ static void rgb_callback(PWMDriver *pwmp) { void sn32f24xb_init(void) { for (uint8_t x = 0; x < SN32_RGB_MATRIX_ROWS_HW; x++) { setPinOutput(led_row_pins[x]); +# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) writePinLow(led_row_pins[x]); +# elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) + writePinHigh(led_row_pins[x]); +# endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL } // Determine which PWM channels we need to control rgb_ch_ctrl(&pwmcfg); From 52d9ee8e7265171f9b6149c2cf2ddf0a075bbba2 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Tue, 2 Jan 2024 16:09:40 +0200 Subject: [PATCH 06/19] sn32 rgb driver: inherit PWM channels from LLD --- drivers/led/sn32/rgb_matrix_sn32f24xb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/led/sn32/rgb_matrix_sn32f24xb.c b/drivers/led/sn32/rgb_matrix_sn32f24xb.c index 1f6ce5bc6730..ef4d29ceccb3 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f24xb.c +++ b/drivers/led/sn32/rgb_matrix_sn32f24xb.c @@ -107,7 +107,7 @@ static PWMConfig pwmcfg = { NULL, /* RGB Callback */ { /* Default all channels to disabled - Channels will be configured during init */ - [0 ... 23] = {PWM_OUTPUT_DISABLED, NULL, 0}, + [0 ... PWM_CHANNELS-1] = {PWM_OUTPUT_DISABLED, NULL, 0}, }, 0 /* HW dependent part.*/ }; @@ -125,8 +125,8 @@ static void rgb_ch_ctrl(PWMConfig *cfg) { channel = (x*16+y)%24 pfpa = 1, when (x*16+y)>23 */ - uint8_t pio_value = ((uint32_t)(PAL_PORT(led_col_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(B0)) - (uint32_t)(PAL_PORT(A0))) * 16 + PAL_PAD(led_col_pins[i]); - uint8_t ch_idx = pio_value % 24; + uint8_t pio_value = ((uint32_t)(PAL_PORT(led_col_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(B0)) - (uint32_t)(PAL_PORT(A0))) * PAL_IOPORTS_WIDTH + PAL_PAD(led_col_pins[i]); + uint8_t ch_idx = pio_value % PWM_CHANNELS; chan_col_order[i] = ch_idx; #elif (SN32_PWM_DIRECTION == ROW2COL) for (uint8_t i = 0; i < SN32_RGB_MATRIX_ROWS_HW; i++) { @@ -139,12 +139,12 @@ static void rgb_ch_ctrl(PWMConfig *cfg) { channel = (x*16+y)%24 pfpa = 1, when (x*16+y)>23 */ - uint8_t pio_value = ((uint32_t)(PAL_PORT(led_row_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(B0)) - (uint32_t)(PAL_PORT(A0))) * 16 + PAL_PAD(led_row_pins[i]); - uint8_t ch_idx = pio_value % 24; + uint8_t pio_value = ((uint32_t)(PAL_PORT(led_row_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(B0)) - (uint32_t)(PAL_PORT(A0))) * PAL_IOPORTS_WIDTH + PAL_PAD(led_row_pins[i]); + uint8_t ch_idx = pio_value % PWM_CHANNELS; chan_row_order[i] = ch_idx; #endif #if (SN32_PWM_CONTROL == HARDWARE_PWM) - cfg->channels[ch_idx].pfpamsk = pio_value > 23; + cfg->channels[ch_idx].pfpamsk = pio_value > (PWM_CHANNELS -1); cfg->channels[ch_idx].mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL; #endif // SN32_PWM_CONTROL } From 6c1a92bc799774ce7ba62d20cd36bbdbd986e46d Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Thu, 20 Jun 2024 14:38:31 +0300 Subject: [PATCH 07/19] sn32 rgb driver: rename `sn32f24xb`-> `sn32f2xx` --- builddefs/common_features.mk | 6 ++--- ...trix_sn32f24xb.c => rgb_matrix_sn32f2xx.c} | 24 +++++++++---------- drivers/led/sn32/{sn32f24xb.h => sn32f2xx.h} | 12 +++++----- keyboards/czc/dwarf/info.json | 2 +- keyboards/designedbygg/berserker/info.json | 2 +- .../designedbygg/ironclad/icl01/info.json | 2 +- .../designedbygg/ironclad/icl03/info.json | 2 +- keyboards/flesports/fl980/info.json | 2 +- keyboards/keychron/k2/rgb/v2/ansi/info.json | 2 +- keyboards/keychron/k2/rgb/v2/iso/info.json | 2 +- keyboards/keychron/k4/rgb/v2/ansi/info.json | 2 +- keyboards/keychron/k8/rgb/info.json | 2 +- keyboards/ozone/tactical/info.json | 2 +- keyboards/redragon/k556/info.json | 2 +- keyboards/redragon/k630/info.json | 2 +- keyboards/royal_kludge/rk61_rgb/info.json | 2 +- keyboards/royal_kludge/rk68_rgb/info.json | 2 +- quantum/rgb_matrix/rgb_matrix_drivers.c | 10 ++++---- quantum/rgb_matrix/rgb_matrix_drivers.h | 4 ++-- 19 files changed, 42 insertions(+), 42 deletions(-) rename drivers/led/sn32/{rgb_matrix_sn32f24xb.c => rgb_matrix_sn32f2xx.c} (97%) rename drivers/led/sn32/{sn32f24xb.h => sn32f2xx.h} (80%) diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 584a0b960a6d..4a70c30bb8cc 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -448,7 +448,7 @@ RGB_MATRIX_DRIVER := snled27351 endif RGB_MATRIX_ENABLE ?= no -VALID_RGB_MATRIX_TYPES := aw20216s is31fl3218 is31fl3236 is31fl3729 is31fl3731 is31fl3733 is31fl3736 is31fl3737 is31fl3741 is31fl3742a is31fl3743a is31fl3745 is31fl3746a snled27351 ws2812 sn32f24xb sled1734x custom +VALID_RGB_MATRIX_TYPES := aw20216s is31fl3218 is31fl3236 is31fl3729 is31fl3731 is31fl3733 is31fl3736 is31fl3737 is31fl3741 is31fl3742a is31fl3743a is31fl3745 is31fl3746a snled27351 ws2812 sn32f2xx sled1734x custom ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),) @@ -566,9 +566,9 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) APA102_DRIVER_REQUIRED := yes endif - ifeq ($(strip $(RGB_MATRIX_DRIVER)), sn32f24xb) + ifeq ($(strip $(RGB_MATRIX_DRIVER)), sn32f2xx) COMMON_VPATH += $(DRIVER_PATH)/led/sn32 - SRC += rgb_matrix_sn32f24xb.c + SRC += rgb_matrix_sn32f2xx.c endif ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes) diff --git a/drivers/led/sn32/rgb_matrix_sn32f24xb.c b/drivers/led/sn32/rgb_matrix_sn32f2xx.c similarity index 97% rename from drivers/led/sn32/rgb_matrix_sn32f24xb.c rename to drivers/led/sn32/rgb_matrix_sn32f2xx.c index ef4d29ceccb3..14c217eb5e18 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f24xb.c +++ b/drivers/led/sn32/rgb_matrix_sn32f2xx.c @@ -1,7 +1,7 @@ #include #include "matrix.h" #include "rgb_matrix.h" -#include "sn32f24xb.h" +#include "sn32f2xx.h" #define ROWS_PER_HAND (MATRIX_ROWS) @@ -82,8 +82,8 @@ static const uint32_t periodticks = RGB_MATRIX_MAXIMUM static const uint32_t freq = (RGB_MATRIX_HUE_STEP * RGB_MATRIX_SAT_STEP * RGB_MATRIX_VAL_STEP * RGB_MATRIX_SPD_STEP * RGB_MATRIX_LED_PROCESS_LIMIT); static const pin_t led_row_pins[SN32_RGB_MATRIX_ROWS_HW] = SN32_RGB_MATRIX_ROW_PINS; // We expect a R,B,G order here static const pin_t led_col_pins[SN32_RGB_MATRIX_COLS] = SN32_RGB_MATRIX_COL_PINS; -static RGB led_state[SN32F24XB_LED_COUNT]; // led state buffer -static RGB led_state_buf[SN32F24XB_LED_COUNT]; // led state buffer +static RGB led_state[SN32F2XX_LED_COUNT]; // led state buffer +static RGB led_state_buf[SN32F2XX_LED_COUNT]; // led state buffer bool led_state_buf_update_required = false; #ifdef UNDERGLOW_RBG // handle underglow with flipped B,G channels static const uint8_t underglow_leds[UNDERGLOW_LEDS] = UNDERGLOW_IDX; @@ -245,7 +245,7 @@ static void update_pwm_channels(PWMDriver *pwmp) { for (uint8_t current_key_col = 0; current_key_col < SN32_RGB_MATRIX_COLS; current_key_col++) { uint8_t led_index = g_led_config.matrix_co[current_key_row][current_key_col]; # if (SN32_PWM_CONTROL == SOFTWARE_PWM) - if (led_index >= SN32F24XB_LED_COUNT) continue; + if (led_index >= SN32F2XX_LED_COUNT) continue; # endif // SN32_PWM_CONTROL // Check if we need to enable RGB output if (led_state[led_index].b > 0) enable_pwm_output |= true; @@ -358,7 +358,7 @@ static void update_pwm_channels(PWMDriver *pwmp) { for (uint8_t current_key_row = 0; current_key_row < MATRIX_ROWS; current_key_row++) { uint8_t led_index = g_led_config.matrix_co[current_key_row][current_key_col]; # if (SN32_PWM_CONTROL == SOFTWARE_PWM) - if (led_index >= SN32F24XB_LED_COUNT) continue; + if (led_index >= SN32F2XX_LED_COUNT) continue; # endif uint8_t led_row_id = (current_key_row * SN32_RGB_MATRIX_ROW_CHANNELS); // Check if we need to enable RGB output @@ -445,7 +445,7 @@ static void rgb_callback(PWMDriver *pwmp) { chSysUnlockFromISR(); } -void sn32f24xb_init(void) { +void sn32f2xx_init(void) { for (uint8_t x = 0; x < SN32_RGB_MATRIX_ROWS_HW; x++) { setPinOutput(led_row_pins[x]); # if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) @@ -468,14 +468,14 @@ void sn32f24xb_init(void) { shared_matrix_rgb_enable(); } -void sn32f24xb_flush(void) { +void sn32f2xx_flush(void) { if (led_state_buf_update_required) { - memcpy(led_state, led_state_buf, sizeof(RGB) * SN32F24XB_LED_COUNT); + memcpy(led_state, led_state_buf, sizeof(RGB) * SN32F2XX_LED_COUNT); led_state_buf_update_required = false; } } -void sn32f24xb_set_color(int index, uint8_t r, uint8_t g, uint8_t b) { +void sn32f2xx_set_color(int index, uint8_t r, uint8_t g, uint8_t b) { #ifdef UNDERGLOW_RBG bool flip_gb = false; for (uint8_t led_id = 0; led_id < UNDERGLOW_LEDS; led_id++) { @@ -507,9 +507,9 @@ void sn32f24xb_set_color(int index, uint8_t r, uint8_t g, uint8_t b) { #endif // UNDERGLOW_RBG } -void sn32f24xb_set_color_all(uint8_t r, uint8_t g, uint8_t b) { - for (int i = 0; i < SN32F24XB_LED_COUNT; i++) { - sn32f24xb_set_color(i, r, g, b); +void sn32f2xx_set_color_all(uint8_t r, uint8_t g, uint8_t b) { + for (int i = 0; i < SN32F2XX_LED_COUNT; i++) { + sn32f2xx_set_color(i, r, g, b); } } diff --git a/drivers/led/sn32/sn32f24xb.h b/drivers/led/sn32/sn32f2xx.h similarity index 80% rename from drivers/led/sn32/sn32f24xb.h rename to drivers/led/sn32/sn32f2xx.h index 55c3264e77bd..92d2d22f7ab9 100644 --- a/drivers/led/sn32/sn32f24xb.h +++ b/drivers/led/sn32/sn32f2xx.h @@ -3,8 +3,8 @@ #include #include -#if defined(RGB_MATRIX_SN32F24XB) -# define SN32F24XB_LED_COUNT RGB_MATRIX_LED_COUNT +#if defined(RGB_MATRIX_SN32F2XX) +# define SN32F2XX_LED_COUNT RGB_MATRIX_LED_COUNT #endif #if !defined(SN32_PWM_OUTPUT_ACTIVE_LEVEL) @@ -48,7 +48,7 @@ # define SN32_RGB_MATRIX_ROWS_HW (SN32_RGB_MATRIX_ROWS * SN32_RGB_MATRIX_ROW_CHANNELS) #endif -void sn32f24xb_init(void); -void sn32f24xb_flush(void); -void sn32f24xb_set_color(int index, uint8_t r, uint8_t g, uint8_t b); -void sn32f24xb_set_color_all(uint8_t r, uint8_t g, uint8_t b); +void sn32f2xx_init(void); +void sn32f2xx_flush(void); +void sn32f2xx_set_color(int index, uint8_t r, uint8_t g, uint8_t b); +void sn32f2xx_set_color_all(uint8_t r, uint8_t g, uint8_t b); diff --git a/keyboards/czc/dwarf/info.json b/keyboards/czc/dwarf/info.json index 2ea2cdd29943..39b91ae95760 100644 --- a/keyboards/czc/dwarf/info.json +++ b/keyboards/czc/dwarf/info.json @@ -173,7 +173,7 @@ "splash" : true, "typing_heatmap" : true, }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ {"matrix": [0, 0],"flags": 1,"x":0, "y":0}, {"matrix": [0, 1],"flags": 1,"x":26, "y":0}, diff --git a/keyboards/designedbygg/berserker/info.json b/keyboards/designedbygg/berserker/info.json index 8c42a7af8bb2..24e0ed51bd79 100644 --- a/keyboards/designedbygg/berserker/info.json +++ b/keyboards/designedbygg/berserker/info.json @@ -184,7 +184,7 @@ "splash" : true, "typing_heatmap" : true, }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ {"matrix": [0, 0],"flags": 1,"x":0, "y":0}, {"matrix": [0, 2],"flags": 1,"x":26, "y":0}, diff --git a/keyboards/designedbygg/ironclad/icl01/info.json b/keyboards/designedbygg/ironclad/icl01/info.json index 02208f106a40..de2d1b0a1182 100644 --- a/keyboards/designedbygg/ironclad/icl01/info.json +++ b/keyboards/designedbygg/ironclad/icl01/info.json @@ -195,7 +195,7 @@ "splash" : true, "typing_heatmap" : true, }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ {"matrix": [0, 0],"flags": 1,"x":0, "y":0}, {"matrix": [0, 2],"flags": 1,"x":21, "y":0}, diff --git a/keyboards/designedbygg/ironclad/icl03/info.json b/keyboards/designedbygg/ironclad/icl03/info.json index 20b0abc1a466..1b068c5467c8 100644 --- a/keyboards/designedbygg/ironclad/icl03/info.json +++ b/keyboards/designedbygg/ironclad/icl03/info.json @@ -211,7 +211,7 @@ "splash" : true, "typing_heatmap" : true }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ {"matrix": [0, 0],"flags": 1,"x":0, "y":0}, {"matrix": [0, 2],"flags": 1,"x":21, "y":0}, diff --git a/keyboards/flesports/fl980/info.json b/keyboards/flesports/fl980/info.json index 9e31c7473128..754e371bc825 100644 --- a/keyboards/flesports/fl980/info.json +++ b/keyboards/flesports/fl980/info.json @@ -74,7 +74,7 @@ "splash" : true, "typing_heatmap" : true, }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ { "matrix":[0, 17], "flags":4, "x":0, "y":0 }, { "matrix":[0, 0], "flags":4, "x":24, "y":0 }, diff --git a/keyboards/keychron/k2/rgb/v2/ansi/info.json b/keyboards/keychron/k2/rgb/v2/ansi/info.json index 230d051ede70..7ed6aebd5af4 100644 --- a/keyboards/keychron/k2/rgb/v2/ansi/info.json +++ b/keyboards/keychron/k2/rgb/v2/ansi/info.json @@ -126,7 +126,7 @@ } }, "rgb_matrix": { - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ { "matrix": [ 0, 0 ], "flags": 4, "x": 0, "y": 0 }, { "matrix": [ 0, 1 ], "flags": 4, "x": 12, "y": 0 }, diff --git a/keyboards/keychron/k2/rgb/v2/iso/info.json b/keyboards/keychron/k2/rgb/v2/iso/info.json index 96aaf3c8cb60..b88294f1b2a0 100644 --- a/keyboards/keychron/k2/rgb/v2/iso/info.json +++ b/keyboards/keychron/k2/rgb/v2/iso/info.json @@ -127,7 +127,7 @@ } }, "rgb_matrix": { - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ { "matrix": [ 0, 0 ], "flags": 4, "x": 7, "y": 0 }, { "matrix": [ 0, 1 ], "flags": 4, "x": 21, "y": 0 }, diff --git a/keyboards/keychron/k4/rgb/v2/ansi/info.json b/keyboards/keychron/k4/rgb/v2/ansi/info.json index b91378ffa913..09ff2fb51bf0 100644 --- a/keyboards/keychron/k4/rgb/v2/ansi/info.json +++ b/keyboards/keychron/k4/rgb/v2/ansi/info.json @@ -139,7 +139,7 @@ }, "rgb_matrix": { - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ { "matrix": [ 0, 0 ], "flags": 4, "x": 0, "y": 0 }, { "matrix": [ 0, 1 ], "flags": 4, "x": 12, "y": 0 }, diff --git a/keyboards/keychron/k8/rgb/info.json b/keyboards/keychron/k8/rgb/info.json index b051f56b8038..0bf82dd9f810 100644 --- a/keyboards/keychron/k8/rgb/info.json +++ b/keyboards/keychron/k8/rgb/info.json @@ -63,7 +63,7 @@ "splash" : true, "typing_heatmap" : true, }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "react_on_keyup": true, "sleep": true }, diff --git a/keyboards/ozone/tactical/info.json b/keyboards/ozone/tactical/info.json index bf2a526e99e6..05960975fe77 100644 --- a/keyboards/ozone/tactical/info.json +++ b/keyboards/ozone/tactical/info.json @@ -117,7 +117,7 @@ "animations": { "cycle_left_right" : true, }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ { "matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, { "matrix": [0, 1], "x": 16, "y": 0, "flags": 4}, diff --git a/keyboards/redragon/k556/info.json b/keyboards/redragon/k556/info.json index 7bb2f0323b26..0c782678e37b 100644 --- a/keyboards/redragon/k556/info.json +++ b/keyboards/redragon/k556/info.json @@ -53,7 +53,7 @@ "splash" : true, "typing_heatmap" : true }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ {"matrix": [0, 0], "flags": 4, "x": 0, "y": 0}, diff --git a/keyboards/redragon/k630/info.json b/keyboards/redragon/k630/info.json index 1fd22f46dd8d..1dd7e7c63dd4 100644 --- a/keyboards/redragon/k630/info.json +++ b/keyboards/redragon/k630/info.json @@ -52,7 +52,7 @@ "splash" : true, "typing_heatmap" : true, }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ { "matrix":[0, 0], "flags":4, "x":0, "y":0 }, { "matrix":[0, 1], "flags":4, "x":16, "y":0 }, diff --git a/keyboards/royal_kludge/rk61_rgb/info.json b/keyboards/royal_kludge/rk61_rgb/info.json index 153533a1be9c..fa22a76d9bd1 100644 --- a/keyboards/royal_kludge/rk61_rgb/info.json +++ b/keyboards/royal_kludge/rk61_rgb/info.json @@ -48,7 +48,7 @@ "splash" : true, "typing_heatmap" : true }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ { "matrix":[0, 0], "flags":4, "x":0, "y":0 }, { "matrix":[0, 1], "flags":4, "x":16, "y":0 }, diff --git a/keyboards/royal_kludge/rk68_rgb/info.json b/keyboards/royal_kludge/rk68_rgb/info.json index aef19360012a..346edb115ba3 100644 --- a/keyboards/royal_kludge/rk68_rgb/info.json +++ b/keyboards/royal_kludge/rk68_rgb/info.json @@ -49,7 +49,7 @@ "splash" : true, "typing_heatmap" : true }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ { "matrix": [0,0], "x": 0, "y": 0, "flags": 4}, { "matrix": [0,1], "x": 14, "y": 0, "flags": 4}, diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 7f3898fe2a89..1e43fdffec02 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c @@ -211,11 +211,11 @@ const rgb_matrix_driver_t rgb_matrix_driver = { .set_color_all = setled_all, }; -#elif defined(RGB_MATRIX_SN32F24XB) +#elif defined(RGB_MATRIX_SN32F2XX) const rgb_matrix_driver_t rgb_matrix_driver = { - .init = sn32f24xb_init, - .flush = sn32f24xb_flush, - .set_color = sn32f24xb_set_color, - .set_color_all = sn32f24xb_set_color_all, + .init = sn32f2xx_init, + .flush = sn32f2xx_flush, + .set_color = sn32f2xx_set_color, + .set_color_all = sn32f2xx_set_color_all, }; #endif diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.h b/quantum/rgb_matrix/rgb_matrix_drivers.h index c739608a43b5..9c96e86c45fc 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.h +++ b/quantum/rgb_matrix/rgb_matrix_drivers.h @@ -35,8 +35,8 @@ # include "snled27351.h" #elif defined(RGB_MATRIX_WS2812) # include "ws2812.h" -#elif defined(RGB_MATRIX_SN32F24XB) -# include "sn32f24xb.h" +#elif defined(RGB_MATRIX_SN32F2XX) +# include "sn32f2xx.h" #elif defined(RGB_MATRIX_SLED1734X) # include "sled1734x.h" #endif From 4a7826ab8ccaeff89df009f1d82be62b476d4133 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Tue, 2 Jan 2024 17:36:35 +0200 Subject: [PATCH 08/19] sn32 rgb driver: Add sn32f260 series support --- drivers/led/sn32/rgb_matrix_sn32f2xx.c | 135 ++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 2 deletions(-) diff --git a/drivers/led/sn32/rgb_matrix_sn32f2xx.c b/drivers/led/sn32/rgb_matrix_sn32f2xx.c index 14c217eb5e18..f162bdd55637 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f2xx.c +++ b/drivers/led/sn32/rgb_matrix_sn32f2xx.c @@ -100,6 +100,13 @@ bool matrix_can_read(void) { } #endif // SHARED_MATRIX +static void rgb_callback(PWMDriver *pwmp); + +#if !defined(SN32F2) +#error Driver is MCU specific to the Sonix SN32F2 family. +#endif // !defined(SN32F2) + +#if defined(SN32F240B) /* PWM configuration structure. We use timer CT16B1 with 24 channels. */ static PWMConfig pwmcfg = { freq, /* PWM clock frequency. */ @@ -142,17 +149,136 @@ static void rgb_ch_ctrl(PWMConfig *cfg) { uint8_t pio_value = ((uint32_t)(PAL_PORT(led_row_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(B0)) - (uint32_t)(PAL_PORT(A0))) * PAL_IOPORTS_WIDTH + PAL_PAD(led_row_pins[i]); uint8_t ch_idx = pio_value % PWM_CHANNELS; chan_row_order[i] = ch_idx; -#endif +#endif // SN32_PWM_DIRECTION #if (SN32_PWM_CONTROL == HARDWARE_PWM) cfg->channels[ch_idx].pfpamsk = pio_value > (PWM_CHANNELS -1); cfg->channels[ch_idx].mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL; #endif // SN32_PWM_CONTROL } } -static void rgb_callback(PWMDriver *pwmp); +#elif defined(SN32F260) +/* PWM configuration structure. We use timer CT16B1 with 23 channels. */ +static const PWMConfig pwmcfg = { + freq, /* PWM clock frequency. */ + periodticks, /* PWM period (in ticks) 1S (1/10kHz=0.1mS 0.1ms*10000 ticks=1S) */ + rgb_callback, /* led Callback */ + .channels = + { + /* Default all channels to disabled */ + [0 ... PWM_CHANNELS-1] = {.mode = PWM_OUTPUT_DISABLED}, + /* Enable selected channels */ +# if defined(SN32_ACTIVATE_PWM_CHAN_0) + [0] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_0 +# if defined(SN32_ACTIVATE_PWM_CHAN_1) + [1] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_1 +# if defined(SN32_ACTIVATE_PWM_CHAN_2) + [2] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_2 +# if defined(SN32_ACTIVATE_PWM_CHAN_3) + [3] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_3 +# if defined(SN32_ACTIVATE_PWM_CHAN_4) + [4] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_4 +# if defined(SN32_ACTIVATE_PWM_CHAN_5) + [5] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_5 +# if defined(SN32_ACTIVATE_PWM_CHAN_6) + [6] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_6 +# if defined(SN32_ACTIVATE_PWM_CHAN_7) + [7] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_7 +# if defined(SN32_ACTIVATE_PWM_CHAN_8) + [8] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_8 +# if defined(SN32_ACTIVATE_PWM_CHAN_9) + [9] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_9 +# if defined(SN32_ACTIVATE_PWM_CHAN_10) + [10] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_10 +# if defined(SN32_ACTIVATE_PWM_CHAN_11) + [11] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_11 +# if defined(SN32_ACTIVATE_PWM_CHAN_12) + [12] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_12 +# if defined(SN32_ACTIVATE_PWM_CHAN_13) + [13] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_13 +# if defined(SN32_ACTIVATE_PWM_CHAN_14) + [14] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_14 +# if defined(SN32_ACTIVATE_PWM_CHAN_15) + [15] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_15 +# if defined(SN32_ACTIVATE_PWM_CHAN_16) + [16] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_16 +# if defined(SN32_ACTIVATE_PWM_CHAN_17) + [17] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_17 +# if defined(SN32_ACTIVATE_PWM_CHAN_18) + [18] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_18 +# if defined(SN32_ACTIVATE_PWM_CHAN_19) + [19] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_19 +# if defined(SN32_ACTIVATE_PWM_CHAN_20) + [20] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_20 +# if defined(SN32_ACTIVATE_PWM_CHAN_21) + [21] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_21 +# if defined(SN32_ACTIVATE_PWM_CHAN_22) + [22] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32_ACTIVATE_PWM_CHAN_22 + }, + 0 /* HW dependent part.*/ +}; + +static void rgb_ch_ctrl(void) { + /* Enable PWM function, IOs and select the PWM modes for the LED pins */ +#if (SN32_PWM_DIRECTION == COL2ROW) + for (uint8_t i = 0; i < SN32_RGB_MATRIX_COLS; i++) { +# if (SN32_PWM_CONTROL == HARDWARE_PWM) + // Only P0.0 to P0.15 and P3.0 to P3.8 can be used as pwm output + if (led_col_pins[i] > A15 && led_col_pins[i] < D0) continue; +# endif // SN32_PWM_CONTROL + /* We use a tricky here, accordint to pfpa table of sn32f260 datasheet, + pwm channel and pfpa of pin Px.y can be calculated as below: + channel = (x*16+y)%23 + */ + uint8_t pio_value = ((uint32_t)(PAL_PORT(led_col_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(D0)) - (uint32_t)(PAL_PORT(A0))) * PAL_IOPORTS_WIDTH + PAL_PAD(led_col_pins[i]); + uint8_t ch_idx = pio_value % PWM_CHANNELS; + chan_col_order[i] = ch_idx; +#elif (SN32_PWM_DIRECTION == ROW2COL) + for (uint8_t i = 0; i < SN32_RGB_MATRIX_ROWS_HW; i++) { +# if (SN32_PWM_CONTROL == HARDWARE_PWM) + // Only P0.0 to P0.15 and P3.0 to P3.8 can be used as pwm output + if (led_row_pins[i] > A15 && led_row_pins[i] < D0) continue; +# endif // SN32_PWM_CONTROL + /* We use a tricky here, accordint to pfpa table of sn32f260 datasheet, + pwm channel and pfpa of pin Px.y can be calculated as below: + channel = (x*16+y)%23 + */ + uint8_t pio_value = ((uint32_t)(PAL_PORT(led_row_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(D0)) - (uint32_t)(PAL_PORT(A0))) * PAL_IOPORTS_WIDTH + PAL_PAD(led_row_pins[i]); + uint8_t ch_idx = pio_value % PWM_CHANNELS; + chan_row_order[i] = ch_idx; +#endif // SN32_PWM_DIRECTION + } +} +#else +# error Unsupported MCU. Driver instance cant be configured. +#endif // chip selection static void shared_matrix_rgb_enable(void) { +# if !defined(SN32F260) pwmcfg.callback = rgb_callback; +# endif // SN32F260 needs static allocation pwmEnablePeriodicNotification(&PWMD1); } @@ -454,8 +580,13 @@ void sn32f2xx_init(void) { writePinHigh(led_row_pins[x]); # endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL } + // Determine which PWM channels we need to control +# if defined(SN32F240B) rgb_ch_ctrl(&pwmcfg); +# elif defined(SN32F260) + rgb_ch_ctrl(); +# endif // chip selection # if defined(SHARED_MATRIX) // initialize matrix state: all keys off From d744438a898e02b39ffcaa82b10306e9952a47e5 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Tue, 2 Jan 2024 21:22:53 +0200 Subject: [PATCH 09/19] sn32 rgb driver: prefer `UINT16_MAX` instead of hardcoded value --- drivers/led/sn32/rgb_matrix_sn32f2xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/led/sn32/rgb_matrix_sn32f2xx.c b/drivers/led/sn32/rgb_matrix_sn32f2xx.c index f162bdd55637..8597754cc272 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f2xx.c +++ b/drivers/led/sn32/rgb_matrix_sn32f2xx.c @@ -565,7 +565,7 @@ static void rgb_callback(PWMDriver *pwmp) { update_pwm_channels(pwmp); chSysLockFromISR(); // Advance the timer to just before the wrap-around, that will start a new PWM cycle - pwm_lld_change_counter(pwmp, 0xFFFF); + pwm_lld_change_counter(pwmp, UINT16_MAX); // Enable the interrupt pwmEnablePeriodicNotificationI(pwmp); chSysUnlockFromISR(); From ae5311eb751937f5786a97c4c29e13f6ed459661 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Tue, 2 Jan 2024 21:48:05 +0200 Subject: [PATCH 10/19] sn32 rgb driver: fix compilation issue on ROW2COL with COL2ROW PWM direction --- drivers/led/sn32/rgb_matrix_sn32f2xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/led/sn32/rgb_matrix_sn32f2xx.c b/drivers/led/sn32/rgb_matrix_sn32f2xx.c index 8597754cc272..ae76f3ebffd1 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f2xx.c +++ b/drivers/led/sn32/rgb_matrix_sn32f2xx.c @@ -68,7 +68,7 @@ static uint8_t last_key_col = 0; // key col scan co static uint8_t led_duty_cycle[SN32_RGB_MATRIX_ROWS_HW] = {0}; // track the channel duty cycle # endif #endif -#if (DIODE_DIRECTION == ROW2COL) +#if ((DIODE_DIRECTION == ROW2COL) && (SN32_PWM_DIRECTION != DIODE_DIRECTION)) static matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; #endif #if defined(SHARED_MATRIX) From f3d97c2555a8ce093f872aefe4d30a1360e01e2b Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Tue, 2 Jan 2024 22:17:36 +0200 Subject: [PATCH 11/19] sn32 shared matrix: add missing licence header happy new year! --- drivers/led/sn32/rgb_matrix_sn32f2xx.c | 16 ++++++++++++++++ drivers/led/sn32/sn32f2xx.h | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/led/sn32/rgb_matrix_sn32f2xx.c b/drivers/led/sn32/rgb_matrix_sn32f2xx.c index ae76f3ebffd1..aa668324eea9 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f2xx.c +++ b/drivers/led/sn32/rgb_matrix_sn32f2xx.c @@ -1,3 +1,19 @@ +/* Copyright 2024 Dimitris Mantzouranis + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include "matrix.h" #include "rgb_matrix.h" diff --git a/drivers/led/sn32/sn32f2xx.h b/drivers/led/sn32/sn32f2xx.h index 92d2d22f7ab9..80ffc28236d6 100644 --- a/drivers/led/sn32/sn32f2xx.h +++ b/drivers/led/sn32/sn32f2xx.h @@ -1,3 +1,19 @@ +/* Copyright 2024 Dimitris Mantzouranis + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #pragma once #include From 0ba8d200ae34a07caed1bf0d5dc188d0d346e806 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Wed, 3 Jan 2024 11:47:40 +0200 Subject: [PATCH 12/19] sn32 rgb driver: add individual channel color correction LED output differs depending on the module used, as well as the current limiting setup. Introduce a luminosity correction factor that will limit output on overdriven channels, allowing fine tuning through PWM scaling. --- drivers/led/sn32/rgb_matrix_sn32f2xx.c | 20 ++++++++++++-------- drivers/led/sn32/sn32f2xx.h | 10 ++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/led/sn32/rgb_matrix_sn32f2xx.c b/drivers/led/sn32/rgb_matrix_sn32f2xx.c index aa668324eea9..5a6e46e29b7f 100644 --- a/drivers/led/sn32/rgb_matrix_sn32f2xx.c +++ b/drivers/led/sn32/rgb_matrix_sn32f2xx.c @@ -623,6 +623,10 @@ void sn32f2xx_flush(void) { } void sn32f2xx_set_color(int index, uint8_t r, uint8_t g, uint8_t b) { + uint8_t color_r = r * SN32_LED_OUTPUT_LUMINOSITY_R; + uint8_t color_g = g * SN32_LED_OUTPUT_LUMINOSITY_G; + uint8_t color_b = b * SN32_LED_OUTPUT_LUMINOSITY_B; + #ifdef UNDERGLOW_RBG bool flip_gb = false; for (uint8_t led_id = 0; led_id < UNDERGLOW_LEDS; led_id++) { @@ -631,23 +635,23 @@ void sn32f2xx_set_color(int index, uint8_t r, uint8_t g, uint8_t b) { } } if (flip_gb) { - if (led_state_buf[index].r == r && led_state_buf[index].b == g && led_state_buf[index].g == b) { + if (led_state_buf[index].r == color_r && led_state_buf[index].b == color_g && led_state_buf[index].g == color_b) { return; } - led_state_buf[index].r = r; - led_state_buf[index].b = g; - led_state_buf[index].g = b; + led_state_buf[index].r = color_r; + led_state_buf[index].b = color_g; + led_state_buf[index].g = color_b; led_state_buf_update_required = true; } else { #endif // UNDERGLOW_RBG - if (led_state_buf[index].r == r && led_state_buf[index].b == b && led_state_buf[index].g == g) { + if (led_state_buf[index].r == color_r && led_state_buf[index].b == color_b && led_state_buf[index].g == color_g) { return; } - led_state_buf[index].r = r; - led_state_buf[index].b = b; - led_state_buf[index].g = g; + led_state_buf[index].r = color_r; + led_state_buf[index].b = color_b; + led_state_buf[index].g = color_g; led_state_buf_update_required = true; #ifdef UNDERGLOW_RBG } diff --git a/drivers/led/sn32/sn32f2xx.h b/drivers/led/sn32/sn32f2xx.h index 80ffc28236d6..e07c086efa7f 100644 --- a/drivers/led/sn32/sn32f2xx.h +++ b/drivers/led/sn32/sn32f2xx.h @@ -19,6 +19,16 @@ #include #include +#if !defined(SN32_LED_OUTPUT_LUMINOSITY_R) +# define SN32_LED_OUTPUT_LUMINOSITY_R 1 +#endif +#if !defined(SN32_LED_OUTPUT_LUMINOSITY_G) +# define SN32_LED_OUTPUT_LUMINOSITY_G 1 +#endif +#if !defined(SN32_LED_OUTPUT_LUMINOSITY_B) +# define SN32_LED_OUTPUT_LUMINOSITY_B 1 +#endif + #if defined(RGB_MATRIX_SN32F2XX) # define SN32F2XX_LED_COUNT RGB_MATRIX_LED_COUNT #endif From febf5f60a5ebee2430e6b6f6127b42c17fb17907 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Wed, 3 Jan 2024 12:50:19 +0200 Subject: [PATCH 13/19] drivers: sn32f2xx: simplify name and location --- builddefs/common_features.mk | 4 ++-- drivers/led/{sn32/rgb_matrix_sn32f2xx.c => sn32f2xx.c} | 0 drivers/led/{sn32 => }/sn32f2xx.h | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename drivers/led/{sn32/rgb_matrix_sn32f2xx.c => sn32f2xx.c} (100%) rename drivers/led/{sn32 => }/sn32f2xx.h (100%) diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 4a70c30bb8cc..754918a166d8 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -567,8 +567,8 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) endif ifeq ($(strip $(RGB_MATRIX_DRIVER)), sn32f2xx) - COMMON_VPATH += $(DRIVER_PATH)/led/sn32 - SRC += rgb_matrix_sn32f2xx.c + COMMON_VPATH += $(DRIVER_PATH)/led + SRC += sn32f2xx.c endif ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes) diff --git a/drivers/led/sn32/rgb_matrix_sn32f2xx.c b/drivers/led/sn32f2xx.c similarity index 100% rename from drivers/led/sn32/rgb_matrix_sn32f2xx.c rename to drivers/led/sn32f2xx.c diff --git a/drivers/led/sn32/sn32f2xx.h b/drivers/led/sn32f2xx.h similarity index 100% rename from drivers/led/sn32/sn32f2xx.h rename to drivers/led/sn32f2xx.h From 16c5a7908369b74a6438ebf82c459bff5273d4e1 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Thu, 20 Jun 2024 14:50:04 +0300 Subject: [PATCH 14/19] sn32: schemas: rename sn32f2xx rgb driver --- data/schemas/keyboard.jsonschema | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index acbf06599df7..8f86d52a113a 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -567,7 +567,7 @@ "snled27351", "ws2812", "sled1734x", - "sn32f24xb" + "sn32f2xx" ] }, "center_point": { From 2da91d09da073501d4899331186f4c660968ff62 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Thu, 12 Sep 2024 21:40:29 +0300 Subject: [PATCH 15/19] sn32 rgb driver: update gpio usage --- drivers/led/sn32f2xx.c | 64 +++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/led/sn32f2xx.c b/drivers/led/sn32f2xx.c index 5a6e46e29b7f..e57401a275f4 100644 --- a/drivers/led/sn32f2xx.c +++ b/drivers/led/sn32f2xx.c @@ -347,15 +347,15 @@ static void shared_matrix_rgb_disable_output(void) { # if (SN32_PWM_CONTROL == HARDWARE_PWM) pwmDisableChannel(&PWMD1, chan_col_order[y]); # elif (SN32_PWM_CONTROL == SOFTWARE_PWM) - setPinInput(led_col_pins[y]); + gpio_set_pin_input(led_col_pins[y]); # endif // SN32_PWM_CONTROL } // Disable LED outputs on RGB channel pins for (uint8_t x = 0; x < SN32_RGB_MATRIX_ROWS_HW; x++) { # if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) - writePinLow(led_row_pins[x]); + gpio_write_pin_low(led_row_pins[x]); # elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) - writePinHigh(led_row_pins[x]); + gpio_write_pin_high(led_row_pins[x]); # endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL } } @@ -414,11 +414,11 @@ static void update_pwm_channels(PWMDriver *pwmp) { # if defined(EVISION_BOTCHED_RED_CHANNEL) // some keyboards have a 151k resistor value tied to the R channel instead of a 10k, as the rest. /* Boost the output for that channel maximizing the current draw by disabling other sinks */ # if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) - writePinLow(led_row_pins[current_row + 1]); - writePinLow(led_row_pins[current_row + 2]); + gpio_write_pin_low(led_row_pins[current_row + 1]); + gpio_write_pin_low(led_row_pins[current_row + 2]); # elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) - writePinHigh(led_row_pins[current_row + 1]); - writePinHigh(led_row_pins[current_row + 2]); + gpio_write_pin_high(led_row_pins[current_row + 1]); + gpio_write_pin_high(led_row_pins[current_row + 2]); # endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL # endif // EVISION_BOTCHED_RED_CHANNEL break; @@ -435,9 +435,9 @@ static void update_pwm_channels(PWMDriver *pwmp) { // Enable RGB output if (enable_pwm_output) { # if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) - writePinHigh(led_row_pins[current_row]); + gpio_write_pin_high(led_row_pins[current_row]); # elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) - writePinLow(led_row_pins[current_row]); + gpio_write_pin_low(led_row_pins[current_row]); # endif } } @@ -447,13 +447,13 @@ static void shared_matrix_rgb_disable_output(void) { // Disable LED outputs on RGB channel pins for (uint8_t x = 0; x < SN32_RGB_MATRIX_COLS; x++) { # if (DIODE_DIRECTION != SN32_PWM_DIRECTION) - setPinInput(led_col_pins[x]); + gpio_set_pin_input(led_col_pins[x]); # endif // DIODE_DIRECTION != SN32_PWM_DIRECTION // Unselect all columns before scanning the key matrix # if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW || defined(MATRIX_UNSELECT_DRIVE_HIGH)) - writePinHigh(led_col_pins[x]); + gpio_write_pin_high(led_col_pins[x]); # elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) - writePinLow(led_col_pins[x]); + gpio_write_pin_low(led_col_pins[x]); # endif } # if (DIODE_DIRECTION != SN32_PWM_DIRECTION) @@ -462,7 +462,7 @@ static void shared_matrix_rgb_disable_output(void) { # if (SN32_PWM_CONTROL == HARDWARE_PWM) pwmDisableChannel(&PWMD1, chan_row_order[x]); # elif (SN32_PWM_CONTROL == SOFTWARE_PWM) - setPinInput(led_row_pins[x]); + gpio_set_pin_input(led_row_pins[x]); # endif // SN32_PWM_CONTROL } # endif // DIODE_DIRECTION != SN32_PWM_DIRECTION @@ -488,11 +488,11 @@ static void update_pwm_channels(PWMDriver *pwmp) { for (uint8_t x = 0; x < SN32_RGB_MATRIX_COLS; x++) { # if (DIODE_DIRECTION != SN32_PWM_DIRECTION) - setPinOutput(led_col_pins[x]); + gpio_set_pin_output_push_pull(led_col_pins[x]); # endif // DIODE_DIRECTION != SN32_PWM_DIRECTION // Disable all RGB columns before turning on PWM in case matrix read unselect high # if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH && defined(MATRIX_UNSELECT_DRIVE_HIGH)) - writePinLow(led_col_pins[x]); + gpio_write_pin_low(led_col_pins[x]); # endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH && defined(MATRIX_UNSELECT_DRIVE_HIGH) } @@ -516,9 +516,9 @@ static void update_pwm_channels(PWMDriver *pwmp) { // Enable RGB output if (enable_pwm_output) { # if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) - writePinHigh(led_col_pins[last_key_col]); + gpio_write_pin_high(led_col_pins[last_key_col]); # elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) - writePinLow(led_col_pins[last_key_col]); + gpio_write_pin_low(led_col_pins[last_key_col]); # endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL } # elif (SN32_PWM_CONTROL == SOFTWARE_PWM) @@ -529,9 +529,9 @@ static void update_pwm_channels(PWMDriver *pwmp) { // Enable RGB output if (enable_pwm_output) { # if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) - writePinHigh(led_col_pins[current_key_col]); + gpio_write_pin_high(led_col_pins[current_key_col]); # elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) - writePinLow(led_col_pins[current_key_col]); + gpio_write_pin_low(led_col_pins[current_key_col]); # endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL } # endif // SN32_PWM_CONTROL @@ -545,15 +545,15 @@ static void rgb_callback(PWMDriver *pwmp) { for (uint8_t pwm_cnt = 0; pwm_cnt < (SN32_RGB_MATRIX_COLS * RGB_MATRIX_HUE_STEP); pwm_cnt++) { uint8_t pwm_index = (pwm_cnt % SN32_RGB_MATRIX_COLS); if (((uint16_t)(pwmp->ct->TC) < ((uint16_t)(led_duty_cycle[pwm_index] + periodticks))) && (led_duty_cycle[pwm_index] > 0)) { - setPinOutput(led_col_pins[pwm_index]); + gpio_set_pin_output_push_pull(led_col_pins[pwm_index]); # if (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_LOW) - writePinLow(led_col_pins[pwm_index]); + gpio_write_pin_low(led_col_pins[pwm_index]); } else { - setPinInputHigh(led_col_pins[pwm_index]); + gpio_set_pin_input_high(led_col_pins[pwm_index]); # elif (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_HIGH) - writePinHigh(led_col_pins[pwm_index]); + gpio_write_pin_high(led_col_pins[pwm_index]); } else { - setPinInputLow(led_col_pins[pwm_index]); + gpio_set_pin_input_low(led_col_pins[pwm_index]); # endif // SN32_PWM_OUTPUT_ACTIVE_LEVEL } } @@ -562,17 +562,17 @@ static void rgb_callback(PWMDriver *pwmp) { uint8_t pwm_index = (pwm_cnt % SN32_RGB_MATRIX_ROWS_HW); if (((uint16_t)(pwmp->ct->TC) < ((uint16_t)(led_duty_cycle[pwm_index] + periodticks))) && (led_duty_cycle[pwm_index] > 0)) { # if (DIODE_DIRECTION != SN32_PWM_DIRECTION) - setPinOutput(led_row_pins[pwm_index]); + gpio_set_pin_output_push_pull(led_row_pins[pwm_index]); # endif // DIODE_DIRECTION != SN32_PWM_DIRECTION # if (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_LOW) - writePinLow(led_row_pins[pwm_index]); + gpio_write_pin_low(led_row_pins[pwm_index]); } else { - writePinHigh(led_row_pins[pwm_index]); + gpio_write_pin_high(led_row_pins[pwm_index]); # elif (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_HIGH) - writePinHigh(led_row_pins[pwm_index]); + gpio_write_pin_high(led_row_pins[pwm_index]); } else { - writePinLow(led_row_pins[pwm_index]); + gpio_write_pin_low(led_row_pins[pwm_index]); # endif // SN32_PWM_OUTPUT_ACTIVE_LEVEL } } @@ -589,11 +589,11 @@ static void rgb_callback(PWMDriver *pwmp) { void sn32f2xx_init(void) { for (uint8_t x = 0; x < SN32_RGB_MATRIX_ROWS_HW; x++) { - setPinOutput(led_row_pins[x]); + gpio_set_pin_output_push_pull(led_row_pins[x]); # if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) - writePinLow(led_row_pins[x]); + gpio_write_pin_low(led_row_pins[x]); # elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) - writePinHigh(led_row_pins[x]); + gpio_write_pin_high(led_row_pins[x]); # endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL } From 2a5e45f877e2756f215160dc6b5bada122156e23 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Thu, 12 Sep 2024 23:36:22 +0300 Subject: [PATCH 16/19] sn32 rgb driver: fix ROW2COL build --- drivers/led/sn32f2xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/led/sn32f2xx.c b/drivers/led/sn32f2xx.c index e57401a275f4..1040e1a9e9b1 100644 --- a/drivers/led/sn32f2xx.c +++ b/drivers/led/sn32f2xx.c @@ -84,7 +84,7 @@ static uint8_t last_key_col = 0; // key col scan co static uint8_t led_duty_cycle[SN32_RGB_MATRIX_ROWS_HW] = {0}; // track the channel duty cycle # endif #endif -#if ((DIODE_DIRECTION == ROW2COL) && (SN32_PWM_DIRECTION != DIODE_DIRECTION)) +#if (DIODE_DIRECTION == ROW2COL) static matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; #endif #if defined(SHARED_MATRIX) From 023d7a2fde610e800f4f2f69c5dd6e79b570851a Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Fri, 13 Sep 2024 01:16:54 +0300 Subject: [PATCH 17/19] sn32 rgb driver: correct SN32_RGB_MATRIX_ROWS_HW init fix ROW2COL PWM bug on COL2ROW A column would light up when pressed on this scenario --- drivers/led/sn32f2xx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/led/sn32f2xx.c b/drivers/led/sn32f2xx.c index 1040e1a9e9b1..3feaf8524706 100644 --- a/drivers/led/sn32f2xx.c +++ b/drivers/led/sn32f2xx.c @@ -461,9 +461,12 @@ static void shared_matrix_rgb_disable_output(void) { for (uint8_t x = 0; x < SN32_RGB_MATRIX_ROWS_HW; x++) { # if (SN32_PWM_CONTROL == HARDWARE_PWM) pwmDisableChannel(&PWMD1, chan_row_order[x]); -# elif (SN32_PWM_CONTROL == SOFTWARE_PWM) - gpio_set_pin_input(led_row_pins[x]); # endif // SN32_PWM_CONTROL +# if (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_HIGH) + gpio_write_pin_low(led_row_pins[x]); +# elif (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_LOW) + gpio_write_pin_high(led_row_pins[x]); +# endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL } # endif // DIODE_DIRECTION != SN32_PWM_DIRECTION } @@ -590,9 +593,11 @@ static void rgb_callback(PWMDriver *pwmp) { void sn32f2xx_init(void) { for (uint8_t x = 0; x < SN32_RGB_MATRIX_ROWS_HW; x++) { gpio_set_pin_output_push_pull(led_row_pins[x]); -# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) +# if ((SN32_PWM_DIRECTION == COL2ROW) && (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) || \ + (SN32_PWM_DIRECTION == ROW2COL) && (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_HIGH)) gpio_write_pin_low(led_row_pins[x]); -# elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) +# elif ((SN32_PWM_DIRECTION == COL2ROW) && (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) || \ + (SN32_PWM_DIRECTION == ROW2COL) && (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_LOW)) gpio_write_pin_high(led_row_pins[x]); # endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL } From 93db451855080d5e32cbfe0891444803ebd52a2d Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Fri, 13 Sep 2024 03:07:15 +0300 Subject: [PATCH 18/19] sn32 rgb driver: cleanup ROW2COL i/o --- drivers/led/sn32f2xx.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/led/sn32f2xx.c b/drivers/led/sn32f2xx.c index 3feaf8524706..9c7231913f6c 100644 --- a/drivers/led/sn32f2xx.c +++ b/drivers/led/sn32f2xx.c @@ -450,7 +450,7 @@ static void shared_matrix_rgb_disable_output(void) { gpio_set_pin_input(led_col_pins[x]); # endif // DIODE_DIRECTION != SN32_PWM_DIRECTION // Unselect all columns before scanning the key matrix -# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW || defined(MATRIX_UNSELECT_DRIVE_HIGH)) +# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) gpio_write_pin_high(led_col_pins[x]); # elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) gpio_write_pin_low(led_col_pins[x]); @@ -493,10 +493,6 @@ static void update_pwm_channels(PWMDriver *pwmp) { # if (DIODE_DIRECTION != SN32_PWM_DIRECTION) gpio_set_pin_output_push_pull(led_col_pins[x]); # endif // DIODE_DIRECTION != SN32_PWM_DIRECTION - // Disable all RGB columns before turning on PWM in case matrix read unselect high -# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH && defined(MATRIX_UNSELECT_DRIVE_HIGH)) - gpio_write_pin_low(led_col_pins[x]); -# endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH && defined(MATRIX_UNSELECT_DRIVE_HIGH) } bool enable_pwm_output = false; From 0f319642896919fb50f1e368550656738237e45e Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Fri, 13 Sep 2024 03:14:33 +0300 Subject: [PATCH 19/19] sn32 rgb driver: rename more keyboards sn32f24xb-> sn32f2xx --- keyboards/designedbygg/redblade/info.json | 2 +- keyboards/hator/gravity/tkl/keyboard.json | 2 +- keyboards/keychron/c1/rgb/keyboard.json | 2 +- keyboards/keychron/k12/rgb/info.json | 2 +- keyboards/keychron/k4/rgb/v2/iso/info.json | 2 +- keyboards/redragon/k552/v2/iso/info.json | 2 +- keyboards/redragon/k582/keyboard.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/keyboards/designedbygg/redblade/info.json b/keyboards/designedbygg/redblade/info.json index cf8340b16506..67a74e1050b6 100644 --- a/keyboards/designedbygg/redblade/info.json +++ b/keyboards/designedbygg/redblade/info.json @@ -206,7 +206,7 @@ "splash" : true, "typing_heatmap" : true }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ {"matrix": [0, 0],"flags": 1,"x":0, "y":0}, {"matrix": [0, 2],"flags": 1,"x":21, "y":0}, diff --git a/keyboards/hator/gravity/tkl/keyboard.json b/keyboards/hator/gravity/tkl/keyboard.json index e10356d2d684..9993f82a8663 100644 --- a/keyboards/hator/gravity/tkl/keyboard.json +++ b/keyboards/hator/gravity/tkl/keyboard.json @@ -54,7 +54,7 @@ "solid_splash": true, "riverflow": true }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ { "matrix": [ 0, 0 ], "flags": 4, "x": 0, "y": 0 }, { "matrix": [ 0, 1 ], "flags": 4, "x": 26, "y": 0 }, diff --git a/keyboards/keychron/c1/rgb/keyboard.json b/keyboards/keychron/c1/rgb/keyboard.json index 26d544d4f063..f7bfef96cb55 100644 --- a/keyboards/keychron/c1/rgb/keyboard.json +++ b/keyboards/keychron/c1/rgb/keyboard.json @@ -134,7 +134,7 @@ } }, "rgb_matrix": { - "driver": "sn32f24xb", + "driver": "sn32f2xx", "animations": { "breathing": true, "band_spiral_val": true, diff --git a/keyboards/keychron/k12/rgb/info.json b/keyboards/keychron/k12/rgb/info.json index 9a1f9ee2fe51..024cf7aa6ccd 100644 --- a/keyboards/keychron/k12/rgb/info.json +++ b/keyboards/keychron/k12/rgb/info.json @@ -45,7 +45,7 @@ "splash": true, "typing_heatmap": true }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "react_on_keyup": true, "sleep": true }, diff --git a/keyboards/keychron/k4/rgb/v2/iso/info.json b/keyboards/keychron/k4/rgb/v2/iso/info.json index e4272b0ba00f..b3d68c973af5 100644 --- a/keyboards/keychron/k4/rgb/v2/iso/info.json +++ b/keyboards/keychron/k4/rgb/v2/iso/info.json @@ -144,7 +144,7 @@ }, "rgb_matrix": { - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ { "matrix": [ 0, 0 ], "flags": 4, "x": 0, "y": 0 }, { "matrix": [ 0, 1 ], "flags": 4, "x": 12, "y": 0 }, diff --git a/keyboards/redragon/k552/v2/iso/info.json b/keyboards/redragon/k552/v2/iso/info.json index aa5d8992311d..aa3f06ab717d 100644 --- a/keyboards/redragon/k552/v2/iso/info.json +++ b/keyboards/redragon/k552/v2/iso/info.json @@ -78,7 +78,7 @@ "splash" : true, "typing_heatmap" : true }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ {"matrix": [0, 0], "flags": 4, "x": 0, "y": 0}, diff --git a/keyboards/redragon/k582/keyboard.json b/keyboards/redragon/k582/keyboard.json index 414b7bf9a59a..57f544002a16 100644 --- a/keyboards/redragon/k582/keyboard.json +++ b/keyboards/redragon/k582/keyboard.json @@ -56,7 +56,7 @@ "solid_splash": true, "riverflow": true }, - "driver": "sn32f24xb", + "driver": "sn32f2xx", "layout": [ {"matrix": [0, 0], "flags": 4, "x": 0, "y": 0},