From d082525a115ed3e5904cc2c620b0fab69be420f8 Mon Sep 17 00:00:00 2001 From: zvecr Date: Sat, 21 Oct 2023 20:41:40 +0100 Subject: [PATCH] Infer LED DRIVER_COUNT from configured addresses --- docs/feature_led_matrix.md | 4 ---- docs/feature_rgb_matrix.md | 12 ------------ drivers/led/aw20216s.h | 9 ++++++--- drivers/led/issi/is31fl3731-simple.h | 13 ++++++++++--- drivers/led/issi/is31fl3731.h | 13 ++++++++++--- drivers/led/issi/is31fl3733-simple.h | 13 ++++++++++--- drivers/led/issi/is31fl3733.h | 13 ++++++++++--- drivers/led/issi/is31fl3736-simple.h | 13 ++++++++++--- drivers/led/issi/is31fl3736.h | 13 ++++++++++--- drivers/led/issi/is31fl3737-simple.h | 13 ++++++++++--- drivers/led/issi/is31fl3737.h | 13 ++++++++++--- drivers/led/issi/is31fl3741-simple.h | 13 ++++++++++--- drivers/led/issi/is31fl3741.h | 13 ++++++++++--- drivers/led/issi/is31fl3743.h | 2 +- drivers/led/issi/is31fl3745.h | 2 +- drivers/led/issi/is31flcommon.h | 10 ++++++++++ drivers/led/snled27351-simple.h | 13 ++++++++++--- drivers/led/snled27351.h | 13 ++++++++++--- 18 files changed, 138 insertions(+), 57 deletions(-) diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md index 7dd2e71d61db..b1ce09d34946 100644 --- a/docs/feature_led_matrix.md +++ b/docs/feature_led_matrix.md @@ -21,7 +21,6 @@ You can use between 1 and 4 IS31FL3731 IC's. Do not specify `LED_DRIVER_ADDR_ |----------|-------------|---------| | `IS31FL3731_I2C_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | `IS31FL3731_I2C_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | -| `IS31FL3731_DRIVER_COUNT` | (Required) How many LED driver IC's are present | | | `LED_MATRIX_LED_COUNT` | (Required) How many LED lights are present across all drivers | | | `IS31FL3731_I2C_ADDRESS_1` | (Required) Address for the first LED driver | | | `IS31FL3731_I2C_ADDRESS_2` | (Optional) Address for the second LED driver | | @@ -43,7 +42,6 @@ Here is an example using 2 drivers. #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA -#define IS31FL3731_DRIVER_COUNT 2 #define LED_DRIVER_1_LED_TOTAL 25 #define LED_DRIVER_2_LED_TOTAL 24 #define LED_MATRIX_LED_COUNT (LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL) @@ -96,7 +94,6 @@ Configure the hardware via your `config.h`: |----------|-------------|---------| | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | -| `DRIVER_COUNT` | (Required) How many LED driver IC's are present | | | `LED_MATRIX_LED_COUNT` | (Required) How many LED lights are present across all drivers | | | `DRIVER_ADDR_1` | (Optional) Address for the first LED driver | | | `DRIVER_ADDR_` | (Required) Address for the additional LED drivers | | @@ -129,7 +126,6 @@ Here is an example using 2 drivers. ```c #define DRIVER_ADDR_2 0b0100001 -#define DRIVER_COUNT 2 #define DRIVER_1_LED_TOTAL 66 #define DRIVER_2_LED_TOTAL 42 #define LED_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index f068058093e3..01ecff1f3f89 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -22,7 +22,6 @@ You can use between 1 and 4 IS31FL3731 IC's. Do not specify `DRIVER_ADDR_` de | `IS31FL3731_I2C_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | `IS31FL3731_I2C_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | | `IS31FL3731_DEGHOST` | (Optional) Set this define to enable de-ghosting by halving Vcc during blanking time | | -| `IS31FL3731_DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | `RGB_MATRIX_LED_COUNT` | (Required) How many RGB lights are present across all drivers | | | `IS31FL3731_I2C_ADDRESS_1` | (Required) Address for the first RGB driver | | | `IS31FL3731_I2C_ADDRESS_2` | (Optional) Address for the second RGB driver | | @@ -44,7 +43,6 @@ Here is an example using 2 drivers. #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA -#define IS31FL3731_DRIVER_COUNT 2 #define DRIVER_1_LED_TOTAL 25 #define DRIVER_2_LED_TOTAL 24 #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) @@ -91,7 +89,6 @@ You can use between 1 and 4 IS31FL3733 IC's. Do not specify `DRIVER_ADDR_` de | `IS31FL3733_GLOBALCURRENT` | (Optional) Configuration for the Global Current Register | 0xFF | | `IS31FL3733_SWPULLUP` | (Optional) Set the value of the SWx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | | `IS31FL3733_CSPULLUP` | (Optional) Set the value of the CSx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | -| `IS31FL3733_DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | `RGB_MATRIX_LED_COUNT` | (Required) How many RGB lights are present across all drivers | | | `IS31FL3733_I2C_ADDRESS_1` | (Required) Address for the first RGB driver | | | `IS31FL3733_I2C_ADDRESS_2` | (Optional) Address for the second RGB driver | | @@ -130,7 +127,6 @@ Here is an example using 2 drivers. #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_VCC -#define IS31FL3733_DRIVER_COUNT 2 #define DRIVER_1_LED_TOTAL 58 #define DRIVER_2_LED_TOTAL 10 #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) @@ -178,7 +174,6 @@ Configure the hardware via your `config.h`: | `IS31FL3736_GLOBALCURRENT` | (Optional) Configuration for the Global Current Register | 0xFF | | `IS31FL3736_SWPULLUP` | (Optional) Set the value of the SWx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | | `IS31FL3736_CSPULLUP` | (Optional) Set the value of the CSx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | -| `IS31FL3736_DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | `RGB_MATRIX_LED_COUNT` | (Required) How many RGB lights are present across all drivers | | | `IS31FL3736_I2C_ADDRESS_1` | (Required) Address for the first RGB driver | | | `IS31FL3736_I2C_ADDRESS_2` | (Optional) Address for the second RGB driver | | @@ -214,7 +209,6 @@ Here is an example using 2 drivers. #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND #define IS31FL3736_I2C_ADDRESS_2 IS31FL3736_I2C_ADDRESS_GND_SCL -#define IS31FL3736_DRIVER_COUNT 2 #define DRIVER_1_LED_TOTAL 30 #define DRIVER_2_LED_TOTAL 32 #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) @@ -255,7 +249,6 @@ Configure the hardware via your `config.h`: | `IS31FL3737_GLOBALCURRENT` | (Optional) Configuration for the Global Current Register | 0xFF | | `IS31FL3737_SWPULLUP` | (Optional) Set the value of the SWx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | | `IS31FL3737_CSPULLUP` | (Optional) Set the value of the CSx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | -| `IS31FL3737_DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | `RGB_MATRIX_LED_COUNT` | (Required) How many RGB lights are present across all drivers | | | `IS31FL3737_I2C_ADDRESS_1` | (Required) Address for the first RGB driver | | | `IS31FL3737_I2C_ADDRESS_2` | (Optional) Address for the second RGB driver | | @@ -290,7 +283,6 @@ Here is an example using 2 drivers. #define IS31FL3737_I2C_ADDRESS_1 IS31FL3737_I2C_ADDRESS_GND #define IS31FL3737_I2C_ADDRESS_2 IS31FL3737_I2C_ADDRESS_SCL -#define IS31FL3737_DRIVER_COUNT 2 #define DRIVER_1_LED_TOTAL 30 #define DRIVER_2_LED_TOTAL 36 #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) @@ -341,7 +333,6 @@ Configure the hardware via your `config.h`: |----------|-------------|---------| | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | -| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | `RGB_MATRIX_LED_COUNT` | (Required) How many RGB lights are present across all drivers | | | `DRIVER_ADDR_1` | (Optional) Address for the first RGB driver | | | `DRIVER_ADDR_` | (Required) Address for the additional RGB drivers | | @@ -376,7 +367,6 @@ Here is an example using 2 drivers. ```c #define DRIVER_ADDR_2 0b0100001 -#define DRIVER_COUNT 2 #define DRIVER_1_LED_TOTAL 66 #define DRIVER_2_LED_TOTAL 42 #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) @@ -486,7 +476,6 @@ You can use up to 2 AW20216S IC's. Do not specify `DRIVER__xxx` defines for I | `AW20216S_EN_PIN_2` | (Optional) MCU pin connected to second RGB driver hardware enable line | | | `DRIVER_1_LED_TOTAL` | (Required) How many RGB lights are connected to first RGB driver | | | `DRIVER_2_LED_TOTAL` | (Optional) How many RGB lights are connected to second RGB driver | | -| `AW20216S_DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | `RGB_MATRIX_LED_COUNT` | (Required) How many RGB lights are present across all drivers | | | `AW20216S_SCALING_MAX` | (Optional) LED current scaling value (0-255, higher values mean LED is brighter at full PWM) | 150 | | `AW20216S_GLOBAL_CURRENT_MAX` | (Optional) Driver global current limit (0-255, higher values means the driver may consume more power) | 150 | @@ -502,7 +491,6 @@ Here is an example using 2 drivers. #define AW20216S_EN_PIN_1 C13 #define AW20216S_EN_PIN_2 C13 -#define AW20216S_DRIVER_COUNT 2 #define DRIVER_1_LED_TOTAL 66 #define DRIVER_2_LED_TOTAL 32 #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) diff --git a/drivers/led/aw20216s.h b/drivers/led/aw20216s.h index f8c0efcc6f90..b4acf29a2ec6 100644 --- a/drivers/led/aw20216s.h +++ b/drivers/led/aw20216s.h @@ -22,9 +22,6 @@ #include "gpio.h" // ======== DEPRECATED DEFINES - DO NOT USE ======== -#ifdef DRIVER_COUNT -# define AW20216S_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef AW_SCALING_MAX # define AW20216S_SCALING_MAX AW_SCALING_MAX #endif @@ -54,6 +51,12 @@ #define g_aw_leds g_aw20216s_leds // ======== +#if defined AW20216S_CS_PIN_2 +# define AW20216S_DRIVER_COUNT 2 +#elif defined AW20216S_CS_PIN_1 +# define AW20216S_DRIVER_COUNT 1 +#endif + typedef struct aw20216s_led_t { uint8_t driver : 2; uint8_t r; diff --git a/drivers/led/issi/is31fl3731-simple.h b/drivers/led/issi/is31fl3731-simple.h index 3233fdc0d75f..3852528953d0 100644 --- a/drivers/led/issi/is31fl3731-simple.h +++ b/drivers/led/issi/is31fl3731-simple.h @@ -35,9 +35,6 @@ #ifdef LED_DRIVER_ADDR_4 # define IS31FL3731_I2C_ADDRESS_4 LED_DRIVER_ADDR_4 #endif -#ifdef LED_DRIVER_COUNT -# define IS31FL3731_DRIVER_COUNT LED_DRIVER_COUNT -#endif #ifdef ISSI_TIMEOUT # define IS31FL3731_I2C_TIMEOUT ISSI_TIMEOUT #endif @@ -52,6 +49,16 @@ #define g_is31_leds g_is31fl3731_leds // ======== +#if defined IS31FL3731_I2C_ADDRESS_4 +# define IS31FL3731_DRIVER_COUNT 4 +#elif defined IS31FL3731_I2C_ADDRESS_3 +# define IS31FL3731_DRIVER_COUNT 3 +#elif defined IS31FL3731_I2C_ADDRESS_2 +# define IS31FL3731_DRIVER_COUNT 2 +#elif defined IS31FL3731_I2C_ADDRESS_1 +# define IS31FL3731_DRIVER_COUNT 1 +#endif + #define IS31FL3731_I2C_ADDRESS_GND 0x74 #define IS31FL3731_I2C_ADDRESS_SCL 0x75 #define IS31FL3731_I2C_ADDRESS_SDA 0x76 diff --git a/drivers/led/issi/is31fl3731.h b/drivers/led/issi/is31fl3731.h index fff91bfdbfc2..72197337f124 100644 --- a/drivers/led/issi/is31fl3731.h +++ b/drivers/led/issi/is31fl3731.h @@ -34,9 +34,6 @@ #ifdef DRIVER_ADDR_4 # define IS31FL3731_I2C_ADDRESS_4 DRIVER_ADDR_4 #endif -#ifdef DRIVER_COUNT -# define IS31FL3731_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef ISSI_TIMEOUT # define IS31FL3731_I2C_TIMEOUT ISSI_TIMEOUT #endif @@ -51,6 +48,16 @@ #define g_is31_leds g_is31fl3731_leds // ======== +#if defined IS31FL3731_I2C_ADDRESS_4 +# define IS31FL3731_DRIVER_COUNT 4 +#elif defined IS31FL3731_I2C_ADDRESS_3 +# define IS31FL3731_DRIVER_COUNT 3 +#elif defined IS31FL3731_I2C_ADDRESS_2 +# define IS31FL3731_DRIVER_COUNT 2 +#elif defined IS31FL3731_I2C_ADDRESS_1 +# define IS31FL3731_DRIVER_COUNT 1 +#endif + #define IS31FL3731_I2C_ADDRESS_GND 0x74 #define IS31FL3731_I2C_ADDRESS_SCL 0x75 #define IS31FL3731_I2C_ADDRESS_SDA 0x76 diff --git a/drivers/led/issi/is31fl3733-simple.h b/drivers/led/issi/is31fl3733-simple.h index 8041a7f0f36e..a8dc227dd70c 100644 --- a/drivers/led/issi/is31fl3733-simple.h +++ b/drivers/led/issi/is31fl3733-simple.h @@ -25,9 +25,6 @@ #include "progmem.h" // ======== DEPRECATED DEFINES - DO NOT USE ======== -#ifdef LED_DRIVER_COUNT -# define IS31FL3733_DRIVER_COUNT LED_DRIVER_COUNT -#endif #ifdef ISSI_TIMEOUT # define IS31FL3733_I2C_TIMEOUT ISSI_TIMEOUT #endif @@ -59,6 +56,16 @@ #define PUR_32KR IS31FL3733_PUR_32KR // ======== +#if defined IS31FL3733_I2C_ADDRESS_4 +# define IS31FL3733_DRIVER_COUNT 4 +#elif defined IS31FL3733_I2C_ADDRESS_3 +# define IS31FL3733_DRIVER_COUNT 3 +#elif defined IS31FL3733_I2C_ADDRESS_2 +# define IS31FL3733_DRIVER_COUNT 2 +#elif defined IS31FL3733_I2C_ADDRESS_1 +# define IS31FL3733_DRIVER_COUNT 1 +#endif + #define IS31FL3733_I2C_ADDRESS_GND_GND 0x50 #define IS31FL3733_I2C_ADDRESS_GND_SCL 0x51 #define IS31FL3733_I2C_ADDRESS_GND_SDA 0x52 diff --git a/drivers/led/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h index e56d04f66fb0..2275f74ff004 100644 --- a/drivers/led/issi/is31fl3733.h +++ b/drivers/led/issi/is31fl3733.h @@ -48,9 +48,6 @@ #ifdef DRIVER_ADDR_4 # define IS31FL3733_SYNC_4 DRIVER_SYNC_4 #endif -#ifdef DRIVER_COUNT -# define IS31FL3733_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef ISSI_TIMEOUT # define IS31FL3733_I2C_TIMEOUT ISSI_TIMEOUT #endif @@ -82,6 +79,16 @@ #define PUR_32KR IS31FL3733_PUR_32KR // ======== +#if defined IS31FL3733_I2C_ADDRESS_4 +# define IS31FL3733_DRIVER_COUNT 4 +#elif defined IS31FL3733_I2C_ADDRESS_3 +# define IS31FL3733_DRIVER_COUNT 3 +#elif defined IS31FL3733_I2C_ADDRESS_2 +# define IS31FL3733_DRIVER_COUNT 2 +#elif defined IS31FL3733_I2C_ADDRESS_1 +# define IS31FL3733_DRIVER_COUNT 1 +#endif + #define IS31FL3733_I2C_ADDRESS_GND_GND 0x50 #define IS31FL3733_I2C_ADDRESS_GND_SCL 0x51 #define IS31FL3733_I2C_ADDRESS_GND_SDA 0x52 diff --git a/drivers/led/issi/is31fl3736-simple.h b/drivers/led/issi/is31fl3736-simple.h index d5525e460d98..aad3c82689c6 100644 --- a/drivers/led/issi/is31fl3736-simple.h +++ b/drivers/led/issi/is31fl3736-simple.h @@ -22,9 +22,6 @@ #include "progmem.h" // ======== DEPRECATED DEFINES - DO NOT USE ======== -#ifdef DRIVER_COUNT -# define IS31FL3736_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef ISSI_TIMEOUT # define IS31FL3736_I2C_TIMEOUT ISSI_TIMEOUT #endif @@ -54,6 +51,16 @@ #define PUR_32KR IS31FL3736_PUR_32KR // ======== +#if defined IS31FL3736_I2C_ADDRESS_4 +# define IS31FL3736_DRIVER_COUNT 4 +#elif defined IS31FL3736_I2C_ADDRESS_3 +# define IS31FL3736_DRIVER_COUNT 3 +#elif defined IS31FL3736_I2C_ADDRESS_2 +# define IS31FL3736_DRIVER_COUNT 2 +#elif defined IS31FL3736_I2C_ADDRESS_1 +# define IS31FL3736_DRIVER_COUNT 1 +#endif + #define IS31FL3736_I2C_ADDRESS_GND_GND 0x50 #define IS31FL3736_I2C_ADDRESS_GND_SCL 0x51 #define IS31FL3736_I2C_ADDRESS_GND_SDA 0x52 diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h index 91312384ae18..5f38ab4931a7 100644 --- a/drivers/led/issi/is31fl3736.h +++ b/drivers/led/issi/is31fl3736.h @@ -34,9 +34,6 @@ #ifdef DRIVER_ADDR_4 # define IS31FL3736_I2C_ADDRESS_4 DRIVER_ADDR_4 #endif -#ifdef DRIVER_COUNT -# define IS31FL3736_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef ISSI_TIMEOUT # define IS31FL3736_I2C_TIMEOUT ISSI_TIMEOUT #endif @@ -66,6 +63,16 @@ #define PUR_32KR IS31FL3736_PUR_32KR // ======== +#if defined IS31FL3736_I2C_ADDRESS_4 +# define IS31FL3736_DRIVER_COUNT 4 +#elif defined IS31FL3736_I2C_ADDRESS_3 +# define IS31FL3736_DRIVER_COUNT 3 +#elif defined IS31FL3736_I2C_ADDRESS_2 +# define IS31FL3736_DRIVER_COUNT 2 +#elif defined IS31FL3736_I2C_ADDRESS_1 +# define IS31FL3736_DRIVER_COUNT 1 +#endif + #define IS31FL3736_I2C_ADDRESS_GND_GND 0x50 #define IS31FL3736_I2C_ADDRESS_GND_SCL 0x51 #define IS31FL3736_I2C_ADDRESS_GND_SDA 0x52 diff --git a/drivers/led/issi/is31fl3737-simple.h b/drivers/led/issi/is31fl3737-simple.h index 0f4e0d014b3d..9a055fb33cff 100644 --- a/drivers/led/issi/is31fl3737-simple.h +++ b/drivers/led/issi/is31fl3737-simple.h @@ -24,9 +24,6 @@ #include "progmem.h" // ======== DEPRECATED DEFINES - DO NOT USE ======== -#ifdef DRIVER_COUNT -# define IS31FL3737_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef ISSI_TIMEOUT # define IS31FL3737_I2C_TIMEOUT ISSI_TIMEOUT #endif @@ -56,6 +53,16 @@ #define PUR_32KR IS31FL3737_PUR_32KR // ======== +#if defined IS31FL3737_I2C_ADDRESS_4 +# define IS31FL3737_DRIVER_COUNT 4 +#elif defined IS31FL3737_I2C_ADDRESS_3 +# define IS31FL3737_DRIVER_COUNT 3 +#elif defined IS31FL3737_I2C_ADDRESS_2 +# define IS31FL3737_DRIVER_COUNT 2 +#elif defined IS31FL3737_I2C_ADDRESS_1 +# define IS31FL3737_DRIVER_COUNT 1 +#endif + #define IS31FL3737_I2C_ADDRESS_GND 0x50 #define IS31FL3737_I2C_ADDRESS_SCL 0x55 #define IS31FL3737_I2C_ADDRESS_SDA 0x5A diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h index a2a81640f653..c768ee653d0b 100644 --- a/drivers/led/issi/is31fl3737.h +++ b/drivers/led/issi/is31fl3737.h @@ -36,9 +36,6 @@ #ifdef DRIVER_ADDR_4 # define IS31FL3737_I2C_ADDRESS_4 DRIVER_ADDR_4 #endif -#ifdef DRIVER_COUNT -# define IS31FL3737_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef ISSI_TIMEOUT # define IS31FL3737_I2C_TIMEOUT ISSI_TIMEOUT #endif @@ -71,6 +68,16 @@ #define PUR_32KR IS31FL3737_PUR_32KR // ======== +#if defined IS31FL3737_I2C_ADDRESS_4 +# define IS31FL3737_DRIVER_COUNT 4 +#elif defined IS31FL3737_I2C_ADDRESS_3 +# define IS31FL3737_DRIVER_COUNT 3 +#elif defined IS31FL3737_I2C_ADDRESS_2 +# define IS31FL3737_DRIVER_COUNT 2 +#elif defined IS31FL3737_I2C_ADDRESS_1 +# define IS31FL3737_DRIVER_COUNT 1 +#endif + #define IS31FL3737_I2C_ADDRESS_GND 0x50 #define IS31FL3737_I2C_ADDRESS_SCL 0x55 #define IS31FL3737_I2C_ADDRESS_SDA 0x5A diff --git a/drivers/led/issi/is31fl3741-simple.h b/drivers/led/issi/is31fl3741-simple.h index 46c058c6445f..e958e405c804 100644 --- a/drivers/led/issi/is31fl3741-simple.h +++ b/drivers/led/issi/is31fl3741-simple.h @@ -24,9 +24,6 @@ #include "progmem.h" // ======== DEPRECATED DEFINES - DO NOT USE ======== -#ifdef DRIVER_COUNT -# define IS31FL3741_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef ISSI_TIMEOUT # define IS31FL3741_I2C_TIMEOUT ISSI_TIMEOUT #endif @@ -56,6 +53,16 @@ #define PUR_32KR IS31FL3741_PUR_32KR // ======== +#if defined IS31FL3741_I2C_ADDRESS_4 +# define IS31FL3741_DRIVER_COUNT 4 +#elif defined IS31FL3741_I2C_ADDRESS_3 +# define IS31FL3741_DRIVER_COUNT 3 +#elif defined IS31FL3741_I2C_ADDRESS_2 +# define IS31FL3741_DRIVER_COUNT 2 +#elif defined IS31FL3741_I2C_ADDRESS_1 +# define IS31FL3741_DRIVER_COUNT 1 +#endif + #define IS31FL3741_I2C_ADDRESS_GND 0x30 #define IS31FL3741_I2C_ADDRESS_SCL 0x31 #define IS31FL3741_I2C_ADDRESS_SDA 0x32 diff --git a/drivers/led/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h index 30fab248bc9c..82595dccfa5f 100644 --- a/drivers/led/issi/is31fl3741.h +++ b/drivers/led/issi/is31fl3741.h @@ -36,9 +36,6 @@ #ifdef DRIVER_ADDR_4 # define IS31FL3741_I2C_ADDRESS_4 DRIVER_ADDR_4 #endif -#ifdef DRIVER_COUNT -# define IS31FL3741_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef ISSI_TIMEOUT # define IS31FL3741_I2C_TIMEOUT ISSI_TIMEOUT #endif @@ -71,6 +68,16 @@ #define PUR_32KR IS31FL3741_PUR_32KR // ======== +#if defined IS31FL3741_I2C_ADDRESS_4 +# define IS31FL3741_DRIVER_COUNT 4 +#elif defined IS31FL3741_I2C_ADDRESS_3 +# define IS31FL3741_DRIVER_COUNT 3 +#elif defined IS31FL3741_I2C_ADDRESS_2 +# define IS31FL3741_DRIVER_COUNT 2 +#elif defined IS31FL3741_I2C_ADDRESS_1 +# define IS31FL3741_DRIVER_COUNT 1 +#endif + #define IS31FL3741_I2C_ADDRESS_GND 0x30 #define IS31FL3741_I2C_ADDRESS_SCL 0x31 #define IS31FL3741_I2C_ADDRESS_SDA 0x32 diff --git a/drivers/led/issi/is31fl3743.h b/drivers/led/issi/is31fl3743.h index d8fcd790963b..706b27125499 100644 --- a/drivers/led/issi/is31fl3743.h +++ b/drivers/led/issi/is31fl3743.h @@ -36,7 +36,7 @@ // Set defaults for Spread Spectrum Register #ifndef ISSI_SSR_1 -# if DRIVER_COUNT == 1 +# ifndef DRIVER_ADDR_2 # define ISSI_SSR_1 0x00 # else # define ISSI_SSR_1 0xC0 diff --git a/drivers/led/issi/is31fl3745.h b/drivers/led/issi/is31fl3745.h index ca5dd4a986a8..1e88aab4a8d9 100644 --- a/drivers/led/issi/is31fl3745.h +++ b/drivers/led/issi/is31fl3745.h @@ -36,7 +36,7 @@ // Set defaults for Spread Spectrum Register #ifndef ISSI_SSR_1 -# if DRIVER_COUNT == 1 +# ifndef DRIVER_ADDR_2 # define ISSI_SSR_1 0x00 # else # define ISSI_SSR_1 0xC0 diff --git a/drivers/led/issi/is31flcommon.h b/drivers/led/issi/is31flcommon.h index 93533e14de9d..ffc6ce40d755 100644 --- a/drivers/led/issi/is31flcommon.h +++ b/drivers/led/issi/is31flcommon.h @@ -35,6 +35,16 @@ # include "is31fl3746.h" #endif +#if defined DRIVER_ADDR_4 +# define DRIVER_COUNT 4 +#elif defined DRIVER_ADDR_3 +# define DRIVER_COUNT 3 +#elif defined DRIVER_ADDR_2 +# define DRIVER_COUNT 2 +#elif defined DRIVER_ADDR_1 +# define DRIVER_COUNT 1 +#endif + #ifdef RGB_MATRIX_ENABLE typedef struct is31_led { uint8_t driver; diff --git a/drivers/led/snled27351-simple.h b/drivers/led/snled27351-simple.h index ff71b44b9166..32b05402f73d 100644 --- a/drivers/led/snled27351-simple.h +++ b/drivers/led/snled27351-simple.h @@ -21,9 +21,6 @@ #include "progmem.h" // ======== DEPRECATED DEFINES - DO NOT USE ======== -#ifdef DRIVER_COUNT -# define SNLED27351_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef CKLED2001_TIMEOUT # define SNLED27351_I2C_TIMEOUT CKLED2001_TIMEOUT #endif @@ -54,6 +51,16 @@ #define g_ckled2001_leds g_snled27351_leds // ======== +#if defined SNLED27351_I2C_ADDRESS_4 +# define SNLED27351_DRIVER_COUNT 4 +#elif defined SNLED27351_I2C_ADDRESS_3 +# define SNLED27351_DRIVER_COUNT 3 +#elif defined SNLED27351_I2C_ADDRESS_2 +# define SNLED27351_DRIVER_COUNT 2 +#elif defined SNLED27351_I2C_ADDRESS_1 +# define SNLED27351_DRIVER_COUNT 1 +#endif + #define SNLED27351_I2C_ADDRESS_GND 0x74 #define SNLED27351_I2C_ADDRESS_SCL 0x75 #define SNLED27351_I2C_ADDRESS_SDA 0x76 diff --git a/drivers/led/snled27351.h b/drivers/led/snled27351.h index 67047c892174..198ab70f62e0 100644 --- a/drivers/led/snled27351.h +++ b/drivers/led/snled27351.h @@ -21,9 +21,6 @@ #include "progmem.h" // ======== DEPRECATED DEFINES - DO NOT USE ======== -#ifdef DRIVER_COUNT -# define SNLED27351_DRIVER_COUNT DRIVER_COUNT -#endif #ifdef DRIVER_ADDR_1 # define SNLED27351_I2C_ADDRESS_1 DRIVER_ADDR_1 #endif @@ -66,6 +63,16 @@ #define g_ckled2001_leds g_snled27351_leds // ======== +#if defined SNLED27351_I2C_ADDRESS_4 +# define SNLED27351_DRIVER_COUNT 4 +#elif defined SNLED27351_I2C_ADDRESS_3 +# define SNLED27351_DRIVER_COUNT 3 +#elif defined SNLED27351_I2C_ADDRESS_2 +# define SNLED27351_DRIVER_COUNT 2 +#elif defined SNLED27351_I2C_ADDRESS_1 +# define SNLED27351_DRIVER_COUNT 1 +#endif + #define SNLED27351_I2C_ADDRESS_GND 0x74 #define SNLED27351_I2C_ADDRESS_SCL 0x75 #define SNLED27351_I2C_ADDRESS_SDA 0x76