Skip to content

Commit

Permalink
Add and use I2C address defines for ISSI LED drivers (qmk#22008)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and zgagnon committed Dec 15, 2023
1 parent 6cf7e62 commit cd9327a
Show file tree
Hide file tree
Showing 166 changed files with 385 additions and 496 deletions.
32 changes: 17 additions & 15 deletions docs/feature_led_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ Here is an example using 2 drivers.
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 0b1110100 AD <-> GND
// 0b1110111 AD <-> VCC
// 0b1110101 AD <-> SCL
// 0b1110110 AD <-> SDA
#define LED_DRIVER_ADDR_1 0b1110100
#define LED_DRIVER_ADDR_2 0b1110110
// 00 AD <-> GND
// 01 AD <-> SCL
// 10 AD <-> SDA
// 11 AD <-> VCC
// ADDR represents A1:A0 of the 7-bit address.
// The result is: 0b11101(ADDR)
#define LED_DRIVER_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
#define LED_DRIVER_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA

#define IS31FL3731_DRIVER_COUNT 2
#define LED_DRIVER_1_LED_TOTAL 25
Expand Down Expand Up @@ -159,7 +161,7 @@ Then Define the array listing all the LEDs you want to override in your `<keyboa

```c
const is31_led PROGMEM g_is31_scaling[ISSI_MANUAL_SCALING] = {
* LED Index
/* LED Index
* | Scaling
* | | */
{5, 120},
Expand Down Expand Up @@ -248,16 +250,16 @@ enum led_matrix_effects {
LED_MATRIX_CYCLE_OUT_IN, // Full gradient scrolling out to in
LED_MATRIX_DUAL_BEACON, // Full gradient spinning around center of keyboard
LED_MATRIX_SOLID_REACTIVE_SIMPLE, // Pulses keys hit then fades out
LED_MATRIX_SOLID_REACTIVE_WIDE // Value pulses near a single key hit then fades out
LED_MATRIX_SOLID_REACTIVE_MULTIWIDE // Value pulses near multiple key hits then fades out
LED_MATRIX_SOLID_REACTIVE_CROSS // Value pulses the same column and row of a single key hit then fades out
LED_MATRIX_SOLID_REACTIVE_MULTICROSS // Value pulses the same column and row of multiple key hits then fades out
LED_MATRIX_SOLID_REACTIVE_NEXUS // Value pulses away on the same column and row of a single key hit then fades out
LED_MATRIX_SOLID_REACTIVE_MULTINEXUS // Value pulses away on the same column and row of multiple key hits then fades out
LED_MATRIX_SOLID_REACTIVE_WIDE, // Value pulses near a single key hit then fades out
LED_MATRIX_SOLID_REACTIVE_MULTIWIDE, // Value pulses near multiple key hits then fades out
LED_MATRIX_SOLID_REACTIVE_CROSS, // Value pulses the same column and row of a single key hit then fades out
LED_MATRIX_SOLID_REACTIVE_MULTICROSS, // Value pulses the same column and row of multiple key hits then fades out
LED_MATRIX_SOLID_REACTIVE_NEXUS, // Value pulses away on the same column and row of a single key hit then fades out
LED_MATRIX_SOLID_REACTIVE_MULTINEXUS, // Value pulses away on the same column and row of multiple key hits then fades out
LED_MATRIX_SOLID_SPLASH, // Value pulses away from a single key hit then fades out
LED_MATRIX_SOLID_MULTISPLASH, // Value pulses away from multiple key hits then fades out
LED_MATRIX_WAVE_LEFT_RIGHT // Sine wave scrolling from left to right
LED_MATRIX_WAVE_UP_DOWN // Sine wave scrolling from up to down
LED_MATRIX_WAVE_LEFT_RIGHT, // Sine wave scrolling from left to right
LED_MATRIX_WAVE_UP_DOWN, // Sine wave scrolling from up to down
LED_MATRIX_EFFECT_MAX
};
```
Expand Down
69 changes: 36 additions & 33 deletions docs/feature_rgb_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ Here is an example using 2 drivers.
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 0b1110100 AD <-> GND
// 0b1110111 AD <-> VCC
// 0b1110101 AD <-> SCL
// 0b1110110 AD <-> SDA
#define DRIVER_ADDR_1 0b1110100
#define DRIVER_ADDR_2 0b1110110
// 00 AD <-> GND
// 01 AD <-> SCL
// 10 AD <-> SDA
// 11 AD <-> VCC
// ADDR represents A1:A0 of the 7-bit address.
// The result is: 0b11101(ADDR)
#define DRIVER_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
#define DRIVER_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA

#define IS31FL3731_DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 25
Expand Down Expand Up @@ -118,15 +120,15 @@ Here is an example using 2 drivers.
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 00 <-> GND
// 01 <-> SCL
// 10 <-> SDA
// 11 <-> VCC
// 00 ADDRn <-> GND
// 01 ADDRn <-> SCL
// 10 ADDRn <-> SDA
// 11 ADDRn <-> VCC
// ADDR1 represents A1:A0 of the 7-bit address.
// ADDR2 represents A3:A2 of the 7-bit address.
// The result is: 0b101(ADDR2)(ADDR1)
#define DRIVER_ADDR_1 0b1010000
#define DRIVER_ADDR_2 0b1010011
#define DRIVER_ADDR_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define DRIVER_ADDR_2 IS31FL3733_I2C_ADDRESS_GND_VCC

#define IS31FL3733_DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 58
Expand Down Expand Up @@ -202,14 +204,15 @@ Here is an example using 2 drivers.
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 0000 <-> GND
// 0101 <-> SCL
// 1010 <-> SDA
// 1111 <-> VCC
// ADDR represents A3:A0 of the 7-bit address.
// The result is: 0b101(ADDR)
#define DRIVER_ADDR_1 0b1010000
#define DRIVER_ADDR_2 0b1010001
// 00 ADDRn <-> GND
// 01 ADDRn <-> SCL
// 10 ADDRn <-> SDA
// 11 ADDRn <-> VCC
// ADDR1 represents A1:A0 of the 7-bit address.
// ADDR2 represents A3:A2 of the 7-bit address.
// The result is: 0b101(ADDR2)(ADDR1)
#define DRIVER_ADDR_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define DRIVER_ADDR_2 IS31FL3736_I2C_ADDRESS_GND_SCL

#define IS31FL3736_DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 30
Expand Down Expand Up @@ -278,14 +281,14 @@ Here is an example using 2 drivers.
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 0000 <-> GND
// 0101 <-> SCL
// 1010 <-> SDA
// 1111 <-> VCC
// 0000 ADDR <-> GND
// 0101 ADDR <-> SCL
// 1010 ADDR <-> SDA
// 1111 ADDR <-> VCC
// ADDR represents A3:A0 of the 7-bit address.
// The result is: 0b101(ADDR)
#define DRIVER_ADDR_1 0b1010000
#define DRIVER_ADDR_2 0b1010001
#define DRIVER_ADDR_1 IS31FL3737_I2C_ADDRESS_GND
#define DRIVER_ADDR_2 IS31FL3737_I2C_ADDRESS_SCL

#define IS31FL3737_DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 30
Expand Down Expand Up @@ -407,7 +410,7 @@ Then Define the array listing all the LEDs you want to override in your `<keyboa

```c
const is31_led PROGMEM g_is31_scaling[ISSI_MANUAL_SCALING] = {
* LED Index
/* LED Index
* | R scaling
* | | G scaling
* | | | B scaling
Expand Down Expand Up @@ -654,12 +657,12 @@ enum rgb_matrix_effects {
RGB_MATRIX_DIGITAL_RAIN, // That famous computer simulation
RGB_MATRIX_SOLID_REACTIVE_SIMPLE, // Pulses keys hit to hue & value then fades value out
RGB_MATRIX_SOLID_REACTIVE, // Static single hue, pulses keys hit to shifted hue then fades to current hue
RGB_MATRIX_SOLID_REACTIVE_WIDE // Hue & value pulse near a single key hit then fades value out
RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // Hue & value pulse near multiple key hits then fades value out
RGB_MATRIX_SOLID_REACTIVE_CROSS // Hue & value pulse the same column and row of a single key hit then fades value out
RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // Hue & value pulse the same column and row of multiple key hits then fades value out
RGB_MATRIX_SOLID_REACTIVE_NEXUS // Hue & value pulse away on the same column and row of a single key hit then fades value out
RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // Hue & value pulse away on the same column and row of multiple key hits then fades value out
RGB_MATRIX_SOLID_REACTIVE_WIDE, // Hue & value pulse near a single key hit then fades value out
RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE, // Hue & value pulse near multiple key hits then fades value out
RGB_MATRIX_SOLID_REACTIVE_CROSS, // Hue & value pulse the same column and row of a single key hit then fades value out
RGB_MATRIX_SOLID_REACTIVE_MULTICROSS, // Hue & value pulse the same column and row of multiple key hits then fades value out
RGB_MATRIX_SOLID_REACTIVE_NEXUS, // Hue & value pulse away on the same column and row of a single key hit then fades value out
RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS, // Hue & value pulse away on the same column and row of multiple key hits then fades value out
RGB_MATRIX_SPLASH, // Full gradient & value pulse away from a single key hit then fades value out
RGB_MATRIX_MULTISPLASH, // Full gradient & value pulse away from multiple key hits then fades value out
RGB_MATRIX_SOLID_SPLASH, // Hue & value pulse away from a single key hit then fades value out
Expand Down
5 changes: 5 additions & 0 deletions drivers/led/ckled2001-simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
#define MSKPHASE_1CHANNEL CKLED2001_MSKPHASE_1CHANNEL
// ========

#define CKLED2001_I2C_ADDRESS_GND 0x74
#define CKLED2001_I2C_ADDRESS_SCL 0x75
#define CKLED2001_I2C_ADDRESS_SDA 0x76
#define CKLED2001_I2C_ADDRESS_VDDIO 0x77

typedef struct ckled2001_led {
uint8_t driver : 2;
uint8_t v;
Expand Down
5 changes: 5 additions & 0 deletions drivers/led/ckled2001.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
#define MSKPHASE_1CHANNEL CKLED2001_MSKPHASE_1CHANNEL
// ========

#define CKLED2001_I2C_ADDRESS_GND 0x74
#define CKLED2001_I2C_ADDRESS_SCL 0x75
#define CKLED2001_I2C_ADDRESS_SDA 0x76
#define CKLED2001_I2C_ADDRESS_VDDIO 0x77

typedef struct ckled2001_led {
uint8_t driver : 2;
uint8_t r;
Expand Down
9 changes: 0 additions & 9 deletions drivers/led/issi/is31fl3731-simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@
#include "i2c_master.h"
#include "wait.h"

// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 0b1110100 AD <-> GND
// 0b1110111 AD <-> VCC
// 0b1110101 AD <-> SCL
// 0b1110110 AD <-> SDA
#define IS31FL3731_I2C_ADDRESS_DEFAULT 0x74

#define IS31FL3731_REG_CONFIG 0x00
#define IS31FL3731_REG_CONFIG_PICTUREMODE 0x00
#define IS31FL3731_REG_CONFIG_AUTOPLAYMODE 0x08
Expand Down
5 changes: 5 additions & 0 deletions drivers/led/issi/is31fl3731-simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
#endif
// ========

#define IS31FL3731_I2C_ADDRESS_GND 0x74
#define IS31FL3731_I2C_ADDRESS_SCL 0x75
#define IS31FL3731_I2C_ADDRESS_SDA 0x76
#define IS31FL3731_I2C_ADDRESS_VCC 0x77

typedef struct is31_led {
uint8_t driver : 2;
uint8_t v;
Expand Down
9 changes: 0 additions & 9 deletions drivers/led/issi/is31fl3731.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@
#include "i2c_master.h"
#include "wait.h"

// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 0b1110100 AD <-> GND
// 0b1110111 AD <-> VCC
// 0b1110101 AD <-> SCL
// 0b1110110 AD <-> SDA
#define IS31FL3731_I2C_ADDRESS_DEFAULT 0x74

#define IS31FL3731_REG_CONFIG 0x00
#define IS31FL3731_REG_CONFIG_PICTUREMODE 0x00
#define IS31FL3731_REG_CONFIG_AUTOPLAYMODE 0x08
Expand Down
5 changes: 5 additions & 0 deletions drivers/led/issi/is31fl3731.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
#endif
// ========

#define IS31FL3731_I2C_ADDRESS_GND 0x74
#define IS31FL3731_I2C_ADDRESS_SCL 0x75
#define IS31FL3731_I2C_ADDRESS_SDA 0x76
#define IS31FL3731_I2C_ADDRESS_VCC 0x77

typedef struct is31_led {
uint8_t driver : 2;
uint8_t r;
Expand Down
12 changes: 0 additions & 12 deletions drivers/led/issi/is31fl3733-simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@
#include "i2c_master.h"
#include "wait.h"

// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 00 <-> GND
// 01 <-> SCL
// 10 <-> SDA
// 11 <-> VCC
// ADDR1 represents A1:A0 of the 7-bit address.
// ADDR2 represents A3:A2 of the 7-bit address.
// The result is: 0b101(ADDR2)(ADDR1)
#define IS31FL3733_I2C_ADDRESS_DEFAULT 0x50

#define IS31FL3733_COMMANDREGISTER 0xFD
#define IS31FL3733_COMMANDREGISTER_WRITELOCK 0xFE
#define IS31FL3733_INTERRUPTMASKREGISTER 0xF0
Expand Down
17 changes: 17 additions & 0 deletions drivers/led/issi/is31fl3733-simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@
#define PUR_32KR IS31FL3733_PUR_32KR
// ========

#define IS31FL3733_I2C_ADDRESS_GND_GND 0x50
#define IS31FL3733_I2C_ADDRESS_GND_SCL 0x51
#define IS31FL3733_I2C_ADDRESS_GND_SDA 0x52
#define IS31FL3733_I2C_ADDRESS_GND_VCC 0x53
#define IS31FL3733_I2C_ADDRESS_SCL_GND 0x54
#define IS31FL3733_I2C_ADDRESS_SCL_SCL 0x55
#define IS31FL3733_I2C_ADDRESS_SCL_SDA 0x56
#define IS31FL3733_I2C_ADDRESS_SCL_VCC 0x57
#define IS31FL3733_I2C_ADDRESS_SDA_GND 0x58
#define IS31FL3733_I2C_ADDRESS_SDA_SCL 0x59
#define IS31FL3733_I2C_ADDRESS_SDA_SDA 0x5A
#define IS31FL3733_I2C_ADDRESS_SDA_VCC 0x5B
#define IS31FL3733_I2C_ADDRESS_VCC_GND 0x5C
#define IS31FL3733_I2C_ADDRESS_VCC_SCL 0x5D
#define IS31FL3733_I2C_ADDRESS_VCC_SDA 0x5E
#define IS31FL3733_I2C_ADDRESS_VCC_VCC 0x5F

typedef struct is31_led {
uint8_t driver : 2;
uint8_t v;
Expand Down
12 changes: 0 additions & 12 deletions drivers/led/issi/is31fl3733.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@
#include "i2c_master.h"
#include "wait.h"

// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 00 <-> GND
// 01 <-> SCL
// 10 <-> SDA
// 11 <-> VCC
// ADDR1 represents A1:A0 of the 7-bit address.
// ADDR2 represents A3:A2 of the 7-bit address.
// The result is: 0b101(ADDR2)(ADDR1)
#define IS31FL3733_I2C_ADDRESS_DEFAULT 0x50

#define IS31FL3733_COMMANDREGISTER 0xFD
#define IS31FL3733_COMMANDREGISTER_WRITELOCK 0xFE
#define IS31FL3733_INTERRUPTMASKREGISTER 0xF0
Expand Down
17 changes: 17 additions & 0 deletions drivers/led/issi/is31fl3733.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,23 @@
#define PUR_32KR IS31FL3733_PUR_32KR
// ========

#define IS31FL3733_I2C_ADDRESS_GND_GND 0x50
#define IS31FL3733_I2C_ADDRESS_GND_SCL 0x51
#define IS31FL3733_I2C_ADDRESS_GND_SDA 0x52
#define IS31FL3733_I2C_ADDRESS_GND_VCC 0x53
#define IS31FL3733_I2C_ADDRESS_SCL_GND 0x54
#define IS31FL3733_I2C_ADDRESS_SCL_SCL 0x55
#define IS31FL3733_I2C_ADDRESS_SCL_SDA 0x56
#define IS31FL3733_I2C_ADDRESS_SCL_VCC 0x57
#define IS31FL3733_I2C_ADDRESS_SDA_GND 0x58
#define IS31FL3733_I2C_ADDRESS_SDA_SCL 0x59
#define IS31FL3733_I2C_ADDRESS_SDA_SDA 0x5A
#define IS31FL3733_I2C_ADDRESS_SDA_VCC 0x5B
#define IS31FL3733_I2C_ADDRESS_VCC_GND 0x5C
#define IS31FL3733_I2C_ADDRESS_VCC_SCL 0x5D
#define IS31FL3733_I2C_ADDRESS_VCC_SDA 0x5E
#define IS31FL3733_I2C_ADDRESS_VCC_VCC 0x5F

typedef struct is31_led {
uint8_t driver : 2;
uint8_t r;
Expand Down
12 changes: 0 additions & 12 deletions drivers/led/issi/is31fl3736.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@
#include "i2c_master.h"
#include "wait.h"

// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 00 <-> GND
// 01 <-> SCL
// 10 <-> SDA
// 11 <-> VCC
// ADDR1 represents A1:A0 of the 7-bit address.
// ADDR2 represents A3:A2 of the 7-bit address.
// The result is: 0b101(ADDR2)(ADDR1)
#define IS31FL3736_I2C_ADDRESS_DEFAULT 0x50

#define IS31FL3736_COMMANDREGISTER 0xFD
#define IS31FL3736_COMMANDREGISTER_WRITELOCK 0xFE
#define IS31FL3736_INTERRUPTMASKREGISTER 0xF0
Expand Down
17 changes: 17 additions & 0 deletions drivers/led/issi/is31fl3736.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@
#define PUR_32KR IS31FL3736_PUR_32KR
// ========

#define IS31FL3736_I2C_ADDRESS_GND_GND 0x50
#define IS31FL3736_I2C_ADDRESS_GND_SCL 0x51
#define IS31FL3736_I2C_ADDRESS_GND_SDA 0x52
#define IS31FL3736_I2C_ADDRESS_GND_VCC 0x53
#define IS31FL3736_I2C_ADDRESS_SCL_GND 0x54
#define IS31FL3736_I2C_ADDRESS_SCL_SCL 0x55
#define IS31FL3736_I2C_ADDRESS_SCL_SDA 0x56
#define IS31FL3736_I2C_ADDRESS_SCL_VCC 0x57
#define IS31FL3736_I2C_ADDRESS_SDA_GND 0x58
#define IS31FL3736_I2C_ADDRESS_SDA_SCL 0x59
#define IS31FL3736_I2C_ADDRESS_SDA_SDA 0x5A
#define IS31FL3736_I2C_ADDRESS_SDA_VCC 0x5B
#define IS31FL3736_I2C_ADDRESS_VCC_GND 0x5C
#define IS31FL3736_I2C_ADDRESS_VCC_SCL 0x5D
#define IS31FL3736_I2C_ADDRESS_VCC_SDA 0x5E
#define IS31FL3736_I2C_ADDRESS_VCC_VCC 0x5F

typedef struct is31_led {
uint8_t driver : 2;
uint8_t r;
Expand Down
12 changes: 0 additions & 12 deletions drivers/led/issi/is31fl3737.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@
#include "i2c_master.h"
#include "wait.h"

// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 00 <-> GND
// 01 <-> SCL
// 10 <-> SDA
// 11 <-> VCC
// ADDR1 represents A1:A0 of the 7-bit address.
// ADDR2 represents A3:A2 of the 7-bit address.
// The result is: 0b101(ADDR2)(ADDR1)
#define IS31FL3737_I2C_ADDRESS_DEFAULT 0x50

#define IS31FL3737_COMMANDREGISTER 0xFD
#define IS31FL3737_COMMANDREGISTER_WRITELOCK 0xFE
#define IS31FL3737_INTERRUPTMASKREGISTER 0xF0
Expand Down
Loading

0 comments on commit cd9327a

Please sign in to comment.