diff options
author | Joel Challis <git@zvecr.com> | 2023-11-10 05:14:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 05:14:22 +0000 |
commit | 84df69572ce47f74213869120211f9db371cd3cf (patch) | |
tree | 50a562f9d7136ac3c55c1b9e7c38e0c96741a8ee /drivers/led | |
parent | 8136cf4bfb2664a0a492f7346132afc78110cce0 (diff) |
Infer LED DRIVER_COUNT from configured addresses (#22311)
Diffstat (limited to 'drivers/led')
-rw-r--r-- | drivers/led/aw20216s.h | 9 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3731-simple.h | 13 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3731.h | 13 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3733-simple.h | 13 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3733.h | 13 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3736-simple.h | 13 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3736.h | 13 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3737-simple.h | 13 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3737.h | 13 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3741-simple.h | 13 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3741.h | 13 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3743.h | 2 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3745.h | 2 | ||||
-rw-r--r-- | drivers/led/issi/is31flcommon.h | 10 | ||||
-rw-r--r-- | drivers/led/snled27351-simple.h | 13 | ||||
-rw-r--r-- | drivers/led/snled27351.h | 13 |
16 files changed, 138 insertions, 41 deletions
diff --git a/drivers/led/aw20216s.h b/drivers/led/aw20216s.h index 7ad1e5653b..d79d632084 100644 --- a/drivers/led/aw20216s.h +++ b/drivers/led/aw20216s.h @@ -23,9 +23,6 @@ #include "util.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 @@ -59,6 +56,12 @@ # define AW20216S_LED_COUNT RGB_MATRIX_LED_COUNT #endif +#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 185e80683b..32b42feab0 100644 --- a/drivers/led/issi/is31fl3731-simple.h +++ b/drivers/led/issi/is31fl3731-simple.h @@ -36,9 +36,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 @@ -62,6 +59,16 @@ # define IS31FL3731_LED_COUNT LED_MATRIX_LED_COUNT #endif +#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 + typedef struct is31fl3731_led_t { uint8_t driver : 2; uint8_t v; diff --git a/drivers/led/issi/is31fl3731.h b/drivers/led/issi/is31fl3731.h index 77162ded30..d7b512e4c4 100644 --- a/drivers/led/issi/is31fl3731.h +++ b/drivers/led/issi/is31fl3731.h @@ -35,9 +35,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 @@ -61,6 +58,16 @@ # define IS31FL3731_LED_COUNT RGB_MATRIX_LED_COUNT #endif +#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 + typedef struct is31fl3731_led_t { uint8_t driver : 2; uint8_t r; diff --git a/drivers/led/issi/is31fl3733-simple.h b/drivers/led/issi/is31fl3733-simple.h index 2c6014455f..201d3ff788 100644 --- a/drivers/led/issi/is31fl3733-simple.h +++ b/drivers/led/issi/is31fl3733-simple.h @@ -26,9 +26,6 @@ #include "util.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 @@ -81,6 +78,16 @@ # define IS31FL3733_LED_COUNT LED_MATRIX_LED_COUNT #endif +#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 + typedef struct is31fl3733_led_t { uint8_t driver : 2; uint8_t v; diff --git a/drivers/led/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h index a87d790c44..c86aa9ee1e 100644 --- a/drivers/led/issi/is31fl3733.h +++ b/drivers/led/issi/is31fl3733.h @@ -49,9 +49,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 @@ -104,6 +101,16 @@ # define IS31FL3733_LED_COUNT RGB_MATRIX_LED_COUNT #endif +#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 + typedef struct is31fl3733_led_t { uint8_t driver : 2; uint8_t r; diff --git a/drivers/led/issi/is31fl3736-simple.h b/drivers/led/issi/is31fl3736-simple.h index 7e3e728641..9ff9c650aa 100644 --- a/drivers/led/issi/is31fl3736-simple.h +++ b/drivers/led/issi/is31fl3736-simple.h @@ -23,9 +23,6 @@ #include "util.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 @@ -76,6 +73,16 @@ # define IS31FL3736_LED_COUNT LED_MATRIX_LED_COUNT #endif +#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 + typedef struct is31fl3736_led_t { uint8_t driver : 2; uint8_t v; diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h index bdb787494d..c3fa158de7 100644 --- a/drivers/led/issi/is31fl3736.h +++ b/drivers/led/issi/is31fl3736.h @@ -35,9 +35,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 @@ -88,6 +85,16 @@ # define IS31FL3736_LED_COUNT RGB_MATRIX_LED_COUNT #endif +#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 + typedef struct is31fl3736_led_t { uint8_t driver : 2; uint8_t r; diff --git a/drivers/led/issi/is31fl3737-simple.h b/drivers/led/issi/is31fl3737-simple.h index 3262987697..36125518c6 100644 --- a/drivers/led/issi/is31fl3737-simple.h +++ b/drivers/led/issi/is31fl3737-simple.h @@ -25,9 +25,6 @@ #include "util.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 @@ -66,6 +63,16 @@ # define IS31FL3737_LED_COUNT LED_MATRIX_LED_COUNT #endif +#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 + typedef struct is31fl3737_led_t { uint8_t driver : 2; uint8_t v; diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h index 17d2635dd8..6a2f301052 100644 --- a/drivers/led/issi/is31fl3737.h +++ b/drivers/led/issi/is31fl3737.h @@ -37,9 +37,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 @@ -81,6 +78,16 @@ # define IS31FL3737_LED_COUNT RGB_MATRIX_LED_COUNT #endif +#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 + typedef struct is31fl3737_led_t { uint8_t driver : 2; uint8_t r; diff --git a/drivers/led/issi/is31fl3741-simple.h b/drivers/led/issi/is31fl3741-simple.h index b8cda3da34..04f0c2793a 100644 --- a/drivers/led/issi/is31fl3741-simple.h +++ b/drivers/led/issi/is31fl3741-simple.h @@ -25,9 +25,6 @@ #include "util.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 @@ -66,6 +63,16 @@ # define IS31FL3741_LED_COUNT LED_MATRIX_LED_COUNT #endif +#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 + typedef struct is31fl3741_led_t { uint8_t driver : 2; uint16_t v : 9; diff --git a/drivers/led/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h index 7f3c31a8ab..0c3f7d3d18 100644 --- a/drivers/led/issi/is31fl3741.h +++ b/drivers/led/issi/is31fl3741.h @@ -37,9 +37,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 @@ -81,6 +78,16 @@ # define IS31FL3741_LED_COUNT RGB_MATRIX_LED_COUNT #endif +#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 + typedef struct is31fl3741_led_t { uint8_t driver : 2; uint16_t r : 9; diff --git a/drivers/led/issi/is31fl3743.h b/drivers/led/issi/is31fl3743.h index d8fcd79096..706b271254 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 ca5dd4a986..1e88aab4a8 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 5414b54047..10613a6eed 100644 --- a/drivers/led/issi/is31flcommon.h +++ b/drivers/led/issi/is31flcommon.h @@ -36,6 +36,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 : 2; diff --git a/drivers/led/snled27351-simple.h b/drivers/led/snled27351-simple.h index 051271cca8..66e5d162d0 100644 --- a/drivers/led/snled27351-simple.h +++ b/drivers/led/snled27351-simple.h @@ -22,9 +22,6 @@ #include "util.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 @@ -64,6 +61,16 @@ # define SNLED27351_LED_COUNT LED_MATRIX_LED_COUNT #endif +#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 + typedef struct snled27351_led_t { uint8_t driver : 2; uint8_t v; diff --git a/drivers/led/snled27351.h b/drivers/led/snled27351.h index dd60f59183..77837d36aa 100644 --- a/drivers/led/snled27351.h +++ b/drivers/led/snled27351.h @@ -22,9 +22,6 @@ #include "util.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 @@ -76,6 +73,16 @@ # define SNLED27351_LED_COUNT RGB_MATRIX_LED_COUNT #endif +#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 + typedef struct snled27351_led_t { uint8_t driver : 2; uint8_t r; |