RGB Matrix: driver naming cleanups (#21594)

This commit is contained in:
Ryan 2023-08-23 10:00:03 +10:00 committed by GitHub
parent dfb6d38f08
commit 37bc949945
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
513 changed files with 1166 additions and 1170 deletions

View file

@ -416,7 +416,7 @@ endif
RGB_MATRIX_ENABLE ?= no RGB_MATRIX_ENABLE ?= no
VALID_RGB_MATRIX_TYPES := AW20216 IS31FL3731 IS31FL3733 IS31FL3736 IS31FL3737 IS31FL3741 IS31FL3742A IS31FL3743A IS31FL3745 IS31FL3746A CKLED2001 WS2812 custom VALID_RGB_MATRIX_TYPES := aw20216 is31fl3731 is31fl3733 is31fl3736 is31fl3737 is31fl3741 is31fl3742a is31fl3743a is31fl3745 is31fl3746a ckled2001 ws2812 custom
ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),) ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),)
$(call CATASTROPHIC_ERROR,Invalid RGB_MATRIX_DRIVER,RGB_MATRIX_DRIVER="$(RGB_MATRIX_DRIVER)" is not a valid matrix type) $(call CATASTROPHIC_ERROR,Invalid RGB_MATRIX_DRIVER,RGB_MATRIX_DRIVER="$(RGB_MATRIX_DRIVER)" is not a valid matrix type)
@ -437,89 +437,89 @@ endif
CIE1931_CURVE := yes CIE1931_CURVE := yes
RGB_KEYCODES_ENABLE := yes RGB_KEYCODES_ENABLE := yes
ifeq ($(strip $(RGB_MATRIX_DRIVER)), AW20216) ifeq ($(strip $(RGB_MATRIX_DRIVER)), aw20216)
OPT_DEFS += -DAW20216 -DSTM32_SPI -DHAL_USE_SPI=TRUE OPT_DEFS += -DAW20216 -DSTM32_SPI -DHAL_USE_SPI=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led COMMON_VPATH += $(DRIVER_PATH)/led
SRC += aw20216.c SRC += aw20216.c
QUANTUM_LIB_SRC += spi_master.c QUANTUM_LIB_SRC += spi_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3731) ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3731)
OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led/issi COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31fl3731.c SRC += is31fl3731.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3733) ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3733)
OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led/issi COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31fl3733.c SRC += is31fl3733.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3736) ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3736)
OPT_DEFS += -DIS31FL3736 -DSTM32_I2C -DHAL_USE_I2C=TRUE OPT_DEFS += -DIS31FL3736 -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led/issi COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31fl3736.c SRC += is31fl3736.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3737) ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3737)
OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led/issi COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31fl3737.c SRC += is31fl3737.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3741) ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3741)
OPT_DEFS += -DIS31FL3741 -DSTM32_I2C -DHAL_USE_I2C=TRUE OPT_DEFS += -DIS31FL3741 -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led/issi COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31fl3741.c SRC += is31fl3741.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3742A) ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3742a)
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3742A -DSTM32_I2C -DHAL_USE_I2C=TRUE OPT_DEFS += -DIS31FLCOMMON -DIS31FL3742A -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led/issi COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31flcommon.c SRC += is31flcommon.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3743A) ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3743a)
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3743A -DSTM32_I2C -DHAL_USE_I2C=TRUE OPT_DEFS += -DIS31FLCOMMON -DIS31FL3743A -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led/issi COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31flcommon.c SRC += is31flcommon.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3745) ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3745)
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3745 -DSTM32_I2C -DHAL_USE_I2C=TRUE OPT_DEFS += -DIS31FLCOMMON -DIS31FL3745 -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led/issi COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31flcommon.c SRC += is31flcommon.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3746A) ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3746a)
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3746A -DSTM32_I2C -DHAL_USE_I2C=TRUE OPT_DEFS += -DIS31FLCOMMON -DIS31FL3746A -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led/issi COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31flcommon.c SRC += is31flcommon.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), CKLED2001) ifeq ($(strip $(RGB_MATRIX_DRIVER)), ckled2001)
OPT_DEFS += -DCKLED2001 -DSTM32_I2C -DHAL_USE_I2C=TRUE OPT_DEFS += -DCKLED2001 -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/led COMMON_VPATH += $(DRIVER_PATH)/led
SRC += ckled2001.c SRC += ckled2001.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), WS2812) ifeq ($(strip $(RGB_MATRIX_DRIVER)), ws2812)
OPT_DEFS += -DWS2812 OPT_DEFS += -DWS2812
WS2812_DRIVER_REQUIRED := yes WS2812_DRIVER_REQUIRED := yes
endif endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), APA102) ifeq ($(strip $(RGB_MATRIX_DRIVER)), apa102)
OPT_DEFS += -DAPA102 OPT_DEFS += -DAPA102
APA102_DRIVER_REQUIRED := yes APA102_DRIVER_REQUIRED := yes
endif endif

View file

@ -12,7 +12,7 @@ There is basic support for addressable RGB matrix lighting with the I2C IS31FL37
```make ```make
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3731 RGB_MATRIX_DRIVER = is31fl3731
``` ```
You can use between 1 and 4 IS31FL3731 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`: You can use between 1 and 4 IS31FL3731 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
@ -76,7 +76,7 @@ There is basic support for addressable RGB matrix lighting with the I2C IS31FL37
```make ```make
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3733 RGB_MATRIX_DRIVER = is31fl3733
``` ```
You can use between 1 and 4 IS31FL3733 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`: You can use between 1 and 4 IS31FL3733 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
@ -162,7 +162,7 @@ There is basic support for addressable RGB matrix lighting with the I2C IS31FL37
```make ```make
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3736 RGB_MATRIX_DRIVER = is31fl3736
``` ```
You can use between 1 and 4 IS31FL3736 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can use between 1 and 4 IS31FL3736 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard.
@ -238,7 +238,7 @@ There is basic support for addressable RGB matrix lighting with the I2C IS31FL37
```make ```make
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3737 RGB_MATRIX_DRIVER = is31fl3737
``` ```
You can use between 1 and 4 IS31FL3737 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can use between 1 and 4 IS31FL3737 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard.
@ -428,7 +428,7 @@ There is basic support for addressable RGB matrix lighting with a WS2811/WS2812{
```make ```make
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = WS2812 RGB_MATRIX_DRIVER = ws2812
``` ```
Configure the hardware via your `config.h`: Configure the hardware via your `config.h`:
@ -450,7 +450,7 @@ There is basic support for APA102 based addressable LED strands. To enable it, a
```make ```make
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = APA102 RGB_MATRIX_DRIVER = apa102
``` ```
Configure the hardware via your `config.h`: Configure the hardware via your `config.h`:
@ -470,7 +470,7 @@ There is basic support for addressable RGB matrix lighting with the SPI AW20216
```make ```make
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = AW20216 RGB_MATRIX_DRIVER = aw20216
``` ```
You can use up to 2 AW20216 IC's. Do not specify `DRIVER_<N>_xxx` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`: You can use up to 2 AW20216 IC's. Do not specify `DRIVER_<N>_xxx` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:

View file

@ -71,7 +71,7 @@
uint8_t g_pwm_buffer[DRIVER_COUNT][AW_PWM_REGISTER_COUNT]; uint8_t g_pwm_buffer[DRIVER_COUNT][AW_PWM_REGISTER_COUNT];
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
bool AW20216_write(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t* data, uint8_t len) { bool aw20216_write(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t* data, uint8_t len) {
static uint8_t s_spi_transfer_buffer[2] = {0}; static uint8_t s_spi_transfer_buffer[2] = {0};
if (!spi_start(cs_pin, false, AW_SPI_MODE, AW_SPI_DIVISOR)) { if (!spi_start(cs_pin, false, AW_SPI_MODE, AW_SPI_DIVISOR)) {
@ -96,52 +96,52 @@ bool AW20216_write(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t* data, uint8
return true; return true;
} }
static inline bool AW20216_write_register(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t value) { static inline bool aw20216_write_register(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t value) {
// Little wrapper so callers need not care about sending a buffer // Little wrapper so callers need not care about sending a buffer
return AW20216_write(cs_pin, page, reg, &value, 1); return aw20216_write(cs_pin, page, reg, &value, 1);
} }
void AW20216_soft_reset(pin_t cs_pin) { void aw20216_soft_reset(pin_t cs_pin) {
AW20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_RESET, AW_RESET_CMD); aw20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_RESET, AW_RESET_CMD);
} }
static void AW20216_init_scaling(pin_t cs_pin) { static void aw20216_init_scaling(pin_t cs_pin) {
// Set constant current to the max, control brightness with PWM // Set constant current to the max, control brightness with PWM
for (uint8_t i = 0; i < AW_PWM_REGISTER_COUNT; i++) { for (uint8_t i = 0; i < AW_PWM_REGISTER_COUNT; i++) {
AW20216_write_register(cs_pin, AW_PAGE_SCALING, i, AW_SCALING_MAX); aw20216_write_register(cs_pin, AW_PAGE_SCALING, i, AW_SCALING_MAX);
} }
} }
static inline void AW20216_init_current_limit(pin_t cs_pin) { static inline void aw20216_init_current_limit(pin_t cs_pin) {
// Push config // Push config
AW20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_GLOBALCURRENT, AW_GLOBAL_CURRENT_MAX); aw20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_GLOBALCURRENT, AW_GLOBAL_CURRENT_MAX);
} }
static inline void AW20216_soft_enable(pin_t cs_pin) { static inline void aw20216_soft_enable(pin_t cs_pin) {
// Push config // Push config
AW20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_CONFIGURATION, AW_CONFIG_DEFAULT | AW_CHIPEN); aw20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_CONFIGURATION, AW_CONFIG_DEFAULT | AW_CHIPEN);
} }
static inline void AW20216_auto_lowpower(pin_t cs_pin) { static inline void aw20216_auto_lowpower(pin_t cs_pin) {
AW20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_MIXFUNCTION, AW_MIXCR_DEFAULT | AW_LPEN); aw20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_MIXFUNCTION, AW_MIXCR_DEFAULT | AW_LPEN);
} }
void AW20216_init(pin_t cs_pin, pin_t en_pin) { void aw20216_init(pin_t cs_pin, pin_t en_pin) {
setPinOutput(en_pin); setPinOutput(en_pin);
writePinHigh(en_pin); writePinHigh(en_pin);
AW20216_soft_reset(cs_pin); aw20216_soft_reset(cs_pin);
wait_ms(2); wait_ms(2);
// Drivers should start with all scaling and PWM registers as off // Drivers should start with all scaling and PWM registers as off
AW20216_init_current_limit(cs_pin); aw20216_init_current_limit(cs_pin);
AW20216_init_scaling(cs_pin); aw20216_init_scaling(cs_pin);
AW20216_soft_enable(cs_pin); aw20216_soft_enable(cs_pin);
AW20216_auto_lowpower(cs_pin); aw20216_auto_lowpower(cs_pin);
} }
void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { void aw20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
aw_led led; aw_led led;
memcpy_P(&led, (&g_aw_leds[index]), sizeof(led)); memcpy_P(&led, (&g_aw_leds[index]), sizeof(led));
@ -154,15 +154,15 @@ void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
g_pwm_buffer_update_required[led.driver] = true; g_pwm_buffer_update_required[led.driver] = true;
} }
void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { void aw20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
AW20216_set_color(i, red, green, blue); aw20216_set_color(i, red, green, blue);
} }
} }
void AW20216_update_pwm_buffers(pin_t cs_pin, uint8_t index) { void aw20216_update_pwm_buffers(pin_t cs_pin, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
AW20216_write(cs_pin, AW_PAGE_PWM, 0, g_pwm_buffer[index], AW_PWM_REGISTER_COUNT); aw20216_write(cs_pin, AW_PAGE_PWM, 0, g_pwm_buffer[index], AW_PWM_REGISTER_COUNT);
} }
g_pwm_buffer_update_required[index] = false; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -30,10 +30,10 @@ typedef struct aw_led {
extern const aw_led PROGMEM g_aw_leds[RGB_MATRIX_LED_COUNT]; extern const aw_led PROGMEM g_aw_leds[RGB_MATRIX_LED_COUNT];
void AW20216_init(pin_t cs_pin, pin_t en_pin); void aw20216_init(pin_t cs_pin, pin_t en_pin);
void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void aw20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void aw20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void AW20216_update_pwm_buffers(pin_t cs_pin, uint8_t index); void aw20216_update_pwm_buffers(pin_t cs_pin, uint8_t index);
#define CS1_SW1 0x00 #define CS1_SW1 0x00
#define CS2_SW1 0x01 #define CS2_SW1 0x01

View file

@ -42,7 +42,7 @@ uint8_t g_twi_transfer_buffer[65];
// The control buffers match the PG0 LED On/Off registers. // The control buffers match the PG0 LED On/Off registers.
// Storing them like this is optimal for I2C transfers to the registers. // Storing them like this is optimal for I2C transfers to the registers.
// We could optimize this and take out the unused registers from these // We could optimize this and take out the unused registers from these
// buffers and the transfers in CKLED2001_write_pwm_buffer() but it's // buffers and the transfers in ckled2001_write_pwm_buffer() but it's
// probably not worth the extra complexity. // probably not worth the extra complexity.
uint8_t g_pwm_buffer[DRIVER_COUNT][192]; uint8_t g_pwm_buffer[DRIVER_COUNT][192];
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
@ -50,7 +50,7 @@ bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0}; uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
bool g_led_control_registers_update_required[DRIVER_COUNT] = {false}; bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
bool CKLED2001_write_register(uint8_t addr, uint8_t reg, uint8_t data) { bool ckled2001_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
// If the transaction fails function returns false. // If the transaction fails function returns false.
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
@ -69,7 +69,7 @@ bool CKLED2001_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
return true; return true;
} }
bool CKLED2001_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { bool ckled2001_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
// Assumes PG1 is already selected. // Assumes PG1 is already selected.
// If any of the transactions fails function returns false. // If any of the transactions fails function returns false.
// Transmit PWM registers in 3 transfers of 64 bytes. // Transmit PWM registers in 3 transfers of 64 bytes.
@ -99,53 +99,53 @@ bool CKLED2001_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
return true; return true;
} }
void CKLED2001_init(uint8_t addr) { void ckled2001_init(uint8_t addr) {
// Select to function page // Select to function page
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE); ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
// Setting LED driver to shutdown mode // Setting LED driver to shutdown mode
CKLED2001_write_register(addr, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE); ckled2001_write_register(addr, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE);
// Setting internal channel pulldown/pullup // Setting internal channel pulldown/pullup
CKLED2001_write_register(addr, PDU_REG, MSKSET_CA_CB_CHANNEL); ckled2001_write_register(addr, PDU_REG, MSKSET_CA_CB_CHANNEL);
// Select number of scan phase // Select number of scan phase
CKLED2001_write_register(addr, SCAN_PHASE_REG, PHASE_CHANNEL); ckled2001_write_register(addr, SCAN_PHASE_REG, PHASE_CHANNEL);
// Setting PWM Delay Phase // Setting PWM Delay Phase
CKLED2001_write_register(addr, SLEW_RATE_CONTROL_MODE1_REG, MSKPWM_DELAY_PHASE_ENABLE); ckled2001_write_register(addr, SLEW_RATE_CONTROL_MODE1_REG, MSKPWM_DELAY_PHASE_ENABLE);
// Setting Driving/Sinking Channel Slew Rate // Setting Driving/Sinking Channel Slew Rate
CKLED2001_write_register(addr, SLEW_RATE_CONTROL_MODE2_REG, MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_ENABLE); ckled2001_write_register(addr, SLEW_RATE_CONTROL_MODE2_REG, MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_ENABLE);
// Setting Iref // Setting Iref
CKLED2001_write_register(addr, SOFTWARE_SLEEP_REG, MSKSLEEP_DISABLE); ckled2001_write_register(addr, SOFTWARE_SLEEP_REG, MSKSLEEP_DISABLE);
// Set LED CONTROL PAGE (Page 0) // Set LED CONTROL PAGE (Page 0)
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE); ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE);
for (int i = 0; i < LED_CONTROL_ON_OFF_LENGTH; i++) { for (int i = 0; i < LED_CONTROL_ON_OFF_LENGTH; i++) {
CKLED2001_write_register(addr, i, 0x00); ckled2001_write_register(addr, i, 0x00);
} }
// Set PWM PAGE (Page 1) // Set PWM PAGE (Page 1)
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_PWM_PAGE); ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_PWM_PAGE);
for (int i = 0; i < LED_CURRENT_TUNE_LENGTH; i++) { for (int i = 0; i < LED_CURRENT_TUNE_LENGTH; i++) {
CKLED2001_write_register(addr, i, 0x00); ckled2001_write_register(addr, i, 0x00);
} }
// Set CURRENT PAGE (Page 4) // Set CURRENT PAGE (Page 4)
uint8_t current_tuen_reg_list[LED_CURRENT_TUNE_LENGTH] = CKLED2001_CURRENT_TUNE; uint8_t current_tuen_reg_list[LED_CURRENT_TUNE_LENGTH] = CKLED2001_CURRENT_TUNE;
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, CURRENT_TUNE_PAGE); ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, CURRENT_TUNE_PAGE);
for (int i = 0; i < LED_CURRENT_TUNE_LENGTH; i++) { for (int i = 0; i < LED_CURRENT_TUNE_LENGTH; i++) {
CKLED2001_write_register(addr, i, current_tuen_reg_list[i]); ckled2001_write_register(addr, i, current_tuen_reg_list[i]);
} }
// Enable LEDs ON/OFF // Enable LEDs ON/OFF
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE); ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE);
for (int i = 0; i < LED_CONTROL_ON_OFF_LENGTH; i++) { for (int i = 0; i < LED_CONTROL_ON_OFF_LENGTH; i++) {
CKLED2001_write_register(addr, i, 0xFF); ckled2001_write_register(addr, i, 0xFF);
} }
// Select to function page // Select to function page
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE); ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
// Setting LED driver to normal mode // Setting LED driver to normal mode
CKLED2001_write_register(addr, CONFIGURATION_REG, MSKSW_NORMAL_MODE); ckled2001_write_register(addr, CONFIGURATION_REG, MSKSW_NORMAL_MODE);
} }
void CKLED2001_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { void ckled2001_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
ckled2001_led led; ckled2001_led led;
if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led)); memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led));
@ -160,13 +160,13 @@ void CKLED2001_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
} }
} }
void CKLED2001_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { void ckled2001_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
CKLED2001_set_color(i, red, green, blue); ckled2001_set_color(i, red, green, blue);
} }
} }
void CKLED2001_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { void ckled2001_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
ckled2001_led led; ckled2001_led led;
memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led)); memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led));
@ -196,41 +196,41 @@ void CKLED2001_set_led_control_register(uint8_t index, bool red, bool green, boo
g_led_control_registers_update_required[led.driver] = true; g_led_control_registers_update_required[led.driver] = true;
} }
void CKLED2001_update_pwm_buffers(uint8_t addr, uint8_t index) { void ckled2001_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_PWM_PAGE); ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_PWM_PAGE);
// If any of the transactions fail we risk writing dirty PG0, // If any of the transactions fail we risk writing dirty PG0,
// refresh page 0 just in case. // refresh page 0 just in case.
if (!CKLED2001_write_pwm_buffer(addr, g_pwm_buffer[index])) { if (!ckled2001_write_pwm_buffer(addr, g_pwm_buffer[index])) {
g_led_control_registers_update_required[index] = true; g_led_control_registers_update_required[index] = true;
} }
} }
g_pwm_buffer_update_required[index] = false; g_pwm_buffer_update_required[index] = false;
} }
void CKLED2001_update_led_control_registers(uint8_t addr, uint8_t index) { void ckled2001_update_led_control_registers(uint8_t addr, uint8_t index) {
if (g_led_control_registers_update_required[index]) { if (g_led_control_registers_update_required[index]) {
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE); ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE);
for (int i = 0; i < 24; i++) { for (int i = 0; i < 24; i++) {
CKLED2001_write_register(addr, i, g_led_control_registers[index][i]); ckled2001_write_register(addr, i, g_led_control_registers[index][i]);
} }
} }
g_led_control_registers_update_required[index] = false; g_led_control_registers_update_required[index] = false;
} }
void CKLED2001_sw_return_normal(uint8_t addr) { void ckled2001_sw_return_normal(uint8_t addr) {
// Select to function page // Select to function page
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE); ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
// Setting LED driver to normal mode // Setting LED driver to normal mode
CKLED2001_write_register(addr, CONFIGURATION_REG, MSKSW_NORMAL_MODE); ckled2001_write_register(addr, CONFIGURATION_REG, MSKSW_NORMAL_MODE);
} }
void CKLED2001_sw_shutdown(uint8_t addr) { void ckled2001_sw_shutdown(uint8_t addr) {
// Select to function page // Select to function page
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE); ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
// Setting LED driver to shutdown mode // Setting LED driver to shutdown mode
CKLED2001_write_register(addr, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE); ckled2001_write_register(addr, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE);
// Write SW Sleep Register // Write SW Sleep Register
CKLED2001_write_register(addr, SOFTWARE_SLEEP_REG, MSKSLEEP_ENABLE); ckled2001_write_register(addr, SOFTWARE_SLEEP_REG, MSKSLEEP_ENABLE);
} }

View file

@ -29,24 +29,24 @@ typedef struct ckled2001_led {
extern const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT]; extern const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT];
void CKLED2001_init(uint8_t addr); void ckled2001_init(uint8_t addr);
bool CKLED2001_write_register(uint8_t addr, uint8_t reg, uint8_t data); bool ckled2001_write_register(uint8_t addr, uint8_t reg, uint8_t data);
bool CKLED2001_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); bool ckled2001_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
void CKLED2001_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void ckled2001_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
void CKLED2001_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void ckled2001_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void CKLED2001_set_led_control_register(uint8_t index, bool red, bool green, bool blue); void ckled2001_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
// This should not be called from an interrupt // This should not be called from an interrupt
// (eg. from a timer interrupt). // (eg. from a timer interrupt).
// Call this while idle (in between matrix scans). // Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer. // If the buffer is dirty, it will update the driver with the buffer.
void CKLED2001_update_pwm_buffers(uint8_t addr, uint8_t index); void ckled2001_update_pwm_buffers(uint8_t addr, uint8_t index);
void CKLED2001_update_led_control_registers(uint8_t addr, uint8_t index); void ckled2001_update_led_control_registers(uint8_t addr, uint8_t index);
void CKLED2001_sw_return_normal(uint8_t addr); void ckled2001_sw_return_normal(uint8_t addr);
void CKLED2001_sw_shutdown(uint8_t addr); void ckled2001_sw_shutdown(uint8_t addr);
// Registers Page Define // Registers Page Define
#define CONFIGURE_CMD_PAGE 0xFD #define CONFIGURE_CMD_PAGE 0xFD

View file

@ -37,41 +37,41 @@ uint8_t g_twi_transfer_buffer[20];
uint8_t g_pwm_buffer[18]; uint8_t g_pwm_buffer[18];
bool g_pwm_buffer_update_required = false; bool g_pwm_buffer_update_required = false;
void IS31FL3218_write_register(uint8_t reg, uint8_t data) { void is31fl3218_write_register(uint8_t reg, uint8_t data) {
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 2, ISSI_TIMEOUT); i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
} }
void IS31FL3218_write_pwm_buffer(uint8_t *pwm_buffer) { void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) {
g_twi_transfer_buffer[0] = ISSI_REG_PWM; g_twi_transfer_buffer[0] = ISSI_REG_PWM;
memcpy(g_twi_transfer_buffer + 1, pwm_buffer, 18); memcpy(g_twi_transfer_buffer + 1, pwm_buffer, 18);
i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 19, ISSI_TIMEOUT); i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 19, ISSI_TIMEOUT);
} }
void IS31FL3218_init(void) { void is31fl3218_init(void) {
// In case we ever want to reinitialize (?) // In case we ever want to reinitialize (?)
IS31FL3218_write_register(ISSI_REG_RESET, 0x00); is31fl3218_write_register(ISSI_REG_RESET, 0x00);
// Turn off software shutdown // Turn off software shutdown
IS31FL3218_write_register(ISSI_REG_SHUTDOWN, 0x01); is31fl3218_write_register(ISSI_REG_SHUTDOWN, 0x01);
// Set all PWM values to zero // Set all PWM values to zero
for (uint8_t i = 0; i < 18; i++) { for (uint8_t i = 0; i < 18; i++) {
IS31FL3218_write_register(ISSI_REG_PWM + i, 0x00); is31fl3218_write_register(ISSI_REG_PWM + i, 0x00);
} }
// Enable all channels // Enable all channels
for (uint8_t i = 0; i < 3; i++) { for (uint8_t i = 0; i < 3; i++) {
IS31FL3218_write_register(ISSI_REG_CONTROL + i, 0b00111111); is31fl3218_write_register(ISSI_REG_CONTROL + i, 0b00111111);
} }
// Load PWM registers and LED Control register data // Load PWM registers and LED Control register data
IS31FL3218_write_register(ISSI_REG_UPDATE, 0x01); is31fl3218_write_register(ISSI_REG_UPDATE, 0x01);
} }
void IS31FL3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (g_pwm_buffer[index * 3 + 0] == red && g_pwm_buffer[index * 3 + 1] == green && g_pwm_buffer[index * 3 + 2] == blue) { if (g_pwm_buffer[index * 3 + 0] == red && g_pwm_buffer[index * 3 + 1] == green && g_pwm_buffer[index * 3 + 2] == blue) {
return; return;
} }
@ -81,17 +81,17 @@ void IS31FL3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
g_pwm_buffer_update_required = true; g_pwm_buffer_update_required = true;
} }
void IS31FL3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
IS31FL3218_set_color(i, red, green, blue); is31fl3218_set_color(i, red, green, blue);
} }
} }
void IS31FL3218_update_pwm_buffers(void) { void is31fl3218_update_pwm_buffers(void) {
if (g_pwm_buffer_update_required) { if (g_pwm_buffer_update_required) {
IS31FL3218_write_pwm_buffer(g_pwm_buffer); is31fl3218_write_pwm_buffer(g_pwm_buffer);
// Load PWM registers and LED Control register data // Load PWM registers and LED Control register data
IS31FL3218_write_register(ISSI_REG_UPDATE, 0x01); is31fl3218_write_register(ISSI_REG_UPDATE, 0x01);
} }
g_pwm_buffer_update_required = false; g_pwm_buffer_update_required = false;
} }

View file

@ -20,7 +20,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
void IS31FL3218_init(void); void is31fl3218_init(void);
void IS31FL3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3218_update_pwm_buffers(void); void is31fl3218_update_pwm_buffers(void);

View file

@ -63,7 +63,7 @@ uint8_t g_twi_transfer_buffer[20];
// These buffers match the IS31FL3731 PWM registers 0x24-0xB3. // These buffers match the IS31FL3731 PWM registers 0x24-0xB3.
// Storing them like this is optimal for I2C transfers to the registers. // Storing them like this is optimal for I2C transfers to the registers.
// We could optimize this and take out the unused registers from these // We could optimize this and take out the unused registers from these
// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's // buffers and the transfers in is31fl3731_write_pwm_buffer() but it's
// probably not worth the extra complexity. // probably not worth the extra complexity.
uint8_t g_pwm_buffer[DRIVER_COUNT][144]; uint8_t g_pwm_buffer[DRIVER_COUNT][144];
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
@ -85,7 +85,7 @@ bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09 // 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09 // 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) { void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
@ -98,7 +98,7 @@ void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#endif #endif
} }
void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
// assumes bank is already selected // assumes bank is already selected
// transmit PWM registers in 9 transfers of 16 bytes // transmit PWM registers in 9 transfers of 16 bytes
@ -123,62 +123,62 @@ void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
} }
} }
void IS31FL3731_init(uint8_t addr) { void is31fl3731_init(uint8_t addr) {
// In order to avoid the LEDs being driven with garbage data // In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, first enable software shutdown, // in the LED driver's PWM registers, first enable software shutdown,
// then set up the mode and other settings, clear the PWM registers, // then set up the mode and other settings, clear the PWM registers,
// then disable software shutdown. // then disable software shutdown.
// select "function register" bank // select "function register" bank
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG); is31fl3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
// enable software shutdown // enable software shutdown
IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00); is31fl3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
#ifdef ISSI_3731_DEGHOST // set to enable de-ghosting of the array #ifdef ISSI_3731_DEGHOST // set to enable de-ghosting of the array
IS31FL3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10); is31fl3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10);
#endif #endif
// this delay was copied from other drivers, might not be needed // this delay was copied from other drivers, might not be needed
wait_ms(10); wait_ms(10);
// picture mode // picture mode
IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE); is31fl3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);
// display frame 0 // display frame 0
IS31FL3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00); is31fl3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00);
// audio sync off // audio sync off
IS31FL3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00); is31fl3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00);
// select bank 0 // select bank 0
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0); is31fl3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
// turn off all LEDs in the LED control register // turn off all LEDs in the LED control register
for (int i = 0x00; i <= 0x11; i++) { for (int i = 0x00; i <= 0x11; i++) {
IS31FL3731_write_register(addr, i, 0x00); is31fl3731_write_register(addr, i, 0x00);
} }
// turn off all LEDs in the blink control register (not really needed) // turn off all LEDs in the blink control register (not really needed)
for (int i = 0x12; i <= 0x23; i++) { for (int i = 0x12; i <= 0x23; i++) {
IS31FL3731_write_register(addr, i, 0x00); is31fl3731_write_register(addr, i, 0x00);
} }
// set PWM on all LEDs to 0 // set PWM on all LEDs to 0
for (int i = 0x24; i <= 0xB3; i++) { for (int i = 0x24; i <= 0xB3; i++) {
IS31FL3731_write_register(addr, i, 0x00); is31fl3731_write_register(addr, i, 0x00);
} }
// select "function register" bank // select "function register" bank
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG); is31fl3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
// disable software shutdown // disable software shutdown
IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01); is31fl3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01);
// select bank 0 and leave it selected. // select bank 0 and leave it selected.
// most usage after initialization is just writing PWM buffers in bank 0 // most usage after initialization is just writing PWM buffers in bank 0
// as there's not much point in double-buffering // as there's not much point in double-buffering
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0); is31fl3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
} }
void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { void is31fl3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31_led led; is31_led led;
if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
@ -194,13 +194,13 @@ void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
} }
} }
void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { void is31fl3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL3731_set_color(i, red, green, blue); is31fl3731_set_color(i, red, green, blue);
} }
} }
void IS31FL3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { void is31fl3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
is31_led led; is31_led led;
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
@ -230,17 +230,17 @@ void IS31FL3731_set_led_control_register(uint8_t index, bool red, bool green, bo
g_led_control_registers_update_required[led.driver] = true; g_led_control_registers_update_required[led.driver] = true;
} }
void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index) { void is31fl3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
IS31FL3731_write_pwm_buffer(addr, g_pwm_buffer[index]); is31fl3731_write_pwm_buffer(addr, g_pwm_buffer[index]);
} }
g_pwm_buffer_update_required[index] = false; g_pwm_buffer_update_required[index] = false;
} }
void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index) { void is31fl3731_update_led_control_registers(uint8_t addr, uint8_t index) {
if (g_led_control_registers_update_required[index]) { if (g_led_control_registers_update_required[index]) {
for (int i = 0; i < 18; i++) { for (int i = 0; i < 18; i++) {
IS31FL3731_write_register(addr, i, g_led_control_registers[index][i]); is31fl3731_write_register(addr, i, g_led_control_registers[index][i]);
} }
} }
g_led_control_registers_update_required[index] = false; g_led_control_registers_update_required[index] = false;

View file

@ -31,21 +31,21 @@ typedef struct is31_led {
extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
void IS31FL3731_init(uint8_t addr); void is31fl3731_init(uint8_t addr);
void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data);
void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void is31fl3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue); void is31fl3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
// This should not be called from an interrupt // This should not be called from an interrupt
// (eg. from a timer interrupt). // (eg. from a timer interrupt).
// Call this while idle (in between matrix scans). // Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer. // If the buffer is dirty, it will update the driver with the buffer.
void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index); void is31fl3731_update_pwm_buffers(uint8_t addr, uint8_t index);
void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index); void is31fl3731_update_led_control_registers(uint8_t addr, uint8_t index);
#define C1_1 0x24 #define C1_1 0x24
#define C1_2 0x25 #define C1_2 0x25

View file

@ -80,7 +80,7 @@ uint8_t g_twi_transfer_buffer[20];
// The control buffers match the PG0 LED On/Off registers. // The control buffers match the PG0 LED On/Off registers.
// Storing them like this is optimal for I2C transfers to the registers. // Storing them like this is optimal for I2C transfers to the registers.
// We could optimize this and take out the unused registers from these // We could optimize this and take out the unused registers from these
// buffers and the transfers in IS31FL3733_write_pwm_buffer() but it's // buffers and the transfers in is31fl3733_write_pwm_buffer() but it's
// probably not worth the extra complexity. // probably not worth the extra complexity.
uint8_t g_pwm_buffer[DRIVER_COUNT][192]; uint8_t g_pwm_buffer[DRIVER_COUNT][192];
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
@ -88,7 +88,7 @@ bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0}; uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
bool g_led_control_registers_update_required[DRIVER_COUNT] = {false}; bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) { bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
// If the transaction fails function returns false. // If the transaction fails function returns false.
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
@ -107,7 +107,7 @@ bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
return true; return true;
} }
bool IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
// Assumes PG1 is already selected. // Assumes PG1 is already selected.
// If any of the transactions fails function returns false. // If any of the transactions fails function returns false.
// Transmit PWM registers in 12 transfers of 16 bytes. // Transmit PWM registers in 12 transfers of 16 bytes.
@ -138,7 +138,7 @@ bool IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
return true; return true;
} }
void IS31FL3733_init(uint8_t addr, uint8_t sync) { void is31fl3733_init(uint8_t addr, uint8_t sync) {
// In order to avoid the LEDs being driven with garbage data // In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, shutdown is enabled last. // in the LED driver's PWM registers, shutdown is enabled last.
// Set up the mode and other settings, clear the PWM registers, // Set up the mode and other settings, clear the PWM registers,
@ -146,45 +146,45 @@ void IS31FL3733_init(uint8_t addr, uint8_t sync) {
// Sync is passed so set it according to the datasheet. // Sync is passed so set it according to the datasheet.
// Unlock the command register. // Unlock the command register.
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG0 // Select PG0
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); is31fl3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
// Turn off all LEDs. // Turn off all LEDs.
for (int i = 0x00; i <= 0x17; i++) { for (int i = 0x00; i <= 0x17; i++) {
IS31FL3733_write_register(addr, i, 0x00); is31fl3733_write_register(addr, i, 0x00);
} }
// Unlock the command register. // Unlock the command register.
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG1 // Select PG1
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); is31fl3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
// Set PWM on all LEDs to 0 // Set PWM on all LEDs to 0
// No need to setup Breath registers to PWM as that is the default. // No need to setup Breath registers to PWM as that is the default.
for (int i = 0x00; i <= 0xBF; i++) { for (int i = 0x00; i <= 0xBF; i++) {
IS31FL3733_write_register(addr, i, 0x00); is31fl3733_write_register(addr, i, 0x00);
} }
// Unlock the command register. // Unlock the command register.
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG3 // Select PG3
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION); is31fl3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
// Set de-ghost pull-up resistors (SWx) // Set de-ghost pull-up resistors (SWx)
IS31FL3733_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP); is31fl3733_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
// Set de-ghost pull-down resistors (CSx) // Set de-ghost pull-down resistors (CSx)
IS31FL3733_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP); is31fl3733_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
// Set global current to maximum. // Set global current to maximum.
IS31FL3733_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT); is31fl3733_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT);
// Disable software shutdown. // Disable software shutdown.
IS31FL3733_write_register(addr, ISSI_REG_CONFIGURATION, ((sync & 0b11) << 6) | ((ISSI_PWM_FREQUENCY & 0b111) << 3) | 0x01); is31fl3733_write_register(addr, ISSI_REG_CONFIGURATION, ((sync & 0b11) << 6) | ((ISSI_PWM_FREQUENCY & 0b111) << 3) | 0x01);
// Wait 10ms to ensure the device has woken up. // Wait 10ms to ensure the device has woken up.
wait_ms(10); wait_ms(10);
} }
void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31_led led; is31_led led;
if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
@ -199,13 +199,13 @@ void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
} }
} }
void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL3733_set_color(i, red, green, blue); is31fl3733_set_color(i, red, green, blue);
} }
} }
void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { void is31fl3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
is31_led led; is31_led led;
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
@ -235,28 +235,28 @@ void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bo
g_led_control_registers_update_required[led.driver] = true; g_led_control_registers_update_required[led.driver] = true;
} }
void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index) { void is31fl3733_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
// Firstly we need to unlock the command register and select PG1. // Firstly we need to unlock the command register and select PG1.
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); is31fl3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
// If any of the transactions fail we risk writing dirty PG0, // If any of the transactions fail we risk writing dirty PG0,
// refresh page 0 just in case. // refresh page 0 just in case.
if (!IS31FL3733_write_pwm_buffer(addr, g_pwm_buffer[index])) { if (!is31fl3733_write_pwm_buffer(addr, g_pwm_buffer[index])) {
g_led_control_registers_update_required[index] = true; g_led_control_registers_update_required[index] = true;
} }
} }
g_pwm_buffer_update_required[index] = false; g_pwm_buffer_update_required[index] = false;
} }
void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index) { void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index) {
if (g_led_control_registers_update_required[index]) { if (g_led_control_registers_update_required[index]) {
// Firstly we need to unlock the command register and select PG0 // Firstly we need to unlock the command register and select PG0
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); is31fl3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
for (int i = 0; i < 24; i++) { for (int i = 0; i < 24; i++) {
IS31FL3733_write_register(addr, i, g_led_control_registers[index][i]); is31fl3733_write_register(addr, i, g_led_control_registers[index][i]);
} }
} }
g_led_control_registers_update_required[index] = false; g_led_control_registers_update_required[index] = false;

View file

@ -32,21 +32,21 @@ typedef struct is31_led {
extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
void IS31FL3733_init(uint8_t addr, uint8_t sync); void is31fl3733_init(uint8_t addr, uint8_t sync);
bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
bool IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue); void is31fl3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
// This should not be called from an interrupt // This should not be called from an interrupt
// (eg. from a timer interrupt). // (eg. from a timer interrupt).
// Call this while idle (in between matrix scans). // Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer. // If the buffer is dirty, it will update the driver with the buffer.
void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index); void is31fl3733_update_pwm_buffers(uint8_t addr, uint8_t index);
void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index); void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index);
#define PUR_0R 0x00 // No PUR resistor #define PUR_0R 0x00 // No PUR resistor
#define PUR_05KR 0x02 // 0.5k Ohm resistor in t_NOL #define PUR_05KR 0x02 // 0.5k Ohm resistor in t_NOL

View file

@ -74,7 +74,7 @@ uint8_t g_twi_transfer_buffer[20];
// The control buffers match the PG0 LED On/Off registers. // The control buffers match the PG0 LED On/Off registers.
// Storing them like this is optimal for I2C transfers to the registers. // Storing them like this is optimal for I2C transfers to the registers.
// We could optimize this and take out the unused registers from these // We could optimize this and take out the unused registers from these
// buffers and the transfers in IS31FL3736_write_pwm_buffer() but it's // buffers and the transfers in is31fl3736_write_pwm_buffer() but it's
// probably not worth the extra complexity. // probably not worth the extra complexity.
uint8_t g_pwm_buffer[DRIVER_COUNT][192]; uint8_t g_pwm_buffer[DRIVER_COUNT][192];
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
@ -82,7 +82,7 @@ bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}}; uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}};
bool g_led_control_registers_update_required = false; bool g_led_control_registers_update_required = false;
void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) { void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
@ -95,7 +95,7 @@ void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#endif #endif
} }
void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
// assumes PG1 is already selected // assumes PG1 is already selected
// transmit PWM registers in 12 transfers of 16 bytes // transmit PWM registers in 12 transfers of 16 bytes
@ -119,52 +119,52 @@ void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
} }
} }
void IS31FL3736_init(uint8_t addr) { void is31fl3736_init(uint8_t addr) {
// In order to avoid the LEDs being driven with garbage data // In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, shutdown is enabled last. // in the LED driver's PWM registers, shutdown is enabled last.
// Set up the mode and other settings, clear the PWM registers, // Set up the mode and other settings, clear the PWM registers,
// then disable software shutdown. // then disable software shutdown.
// Unlock the command register. // Unlock the command register.
IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG0 // Select PG0
IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); is31fl3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
// Turn off all LEDs. // Turn off all LEDs.
for (int i = 0x00; i <= 0x17; i++) { for (int i = 0x00; i <= 0x17; i++) {
IS31FL3736_write_register(addr, i, 0x00); is31fl3736_write_register(addr, i, 0x00);
} }
// Unlock the command register. // Unlock the command register.
IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG1 // Select PG1
IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); is31fl3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
// Set PWM on all LEDs to 0 // Set PWM on all LEDs to 0
// No need to setup Breath registers to PWM as that is the default. // No need to setup Breath registers to PWM as that is the default.
for (int i = 0x00; i <= 0xBF; i++) { for (int i = 0x00; i <= 0xBF; i++) {
IS31FL3736_write_register(addr, i, 0x00); is31fl3736_write_register(addr, i, 0x00);
} }
// Unlock the command register. // Unlock the command register.
IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG3 // Select PG3
IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION); is31fl3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
// Set de-ghost pull-up resistors (SWx) // Set de-ghost pull-up resistors (SWx)
IS31FL3736_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP); is31fl3736_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
// Set de-ghost pull-down resistors (CSx) // Set de-ghost pull-down resistors (CSx)
IS31FL3736_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP); is31fl3736_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
// Set global current to maximum. // Set global current to maximum.
IS31FL3736_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT); is31fl3736_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT);
// Disable software shutdown. // Disable software shutdown.
IS31FL3736_write_register(addr, ISSI_REG_CONFIGURATION, 0x01); is31fl3736_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
// Wait 10ms to ensure the device has woken up. // Wait 10ms to ensure the device has woken up.
wait_ms(10); wait_ms(10);
} }
void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { void is31fl3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31_led led; is31_led led;
if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
@ -179,13 +179,13 @@ void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
} }
} }
void IS31FL3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { void is31fl3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL3736_set_color(i, red, green, blue); is31fl3736_set_color(i, red, green, blue);
} }
} }
void IS31FL3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { void is31fl3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
is31_led led; is31_led led;
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
@ -229,7 +229,7 @@ void IS31FL3736_set_led_control_register(uint8_t index, bool red, bool green, bo
g_led_control_registers_update_required = true; g_led_control_registers_update_required = true;
} }
void IS31FL3736_mono_set_brightness(int index, uint8_t value) { void is31fl3736_mono_set_brightness(int index, uint8_t value) {
if (index >= 0 && index < 96) { if (index >= 0 && index < 96) {
// Index in range 0..95 -> A1..A8, B1..B8, etc. // Index in range 0..95 -> A1..A8, B1..B8, etc.
// Map index 0..95 to registers 0x00..0xBE (interleaved) // Map index 0..95 to registers 0x00..0xBE (interleaved)
@ -239,13 +239,13 @@ void IS31FL3736_mono_set_brightness(int index, uint8_t value) {
} }
} }
void IS31FL3736_mono_set_brightness_all(uint8_t value) { void is31fl3736_mono_set_brightness_all(uint8_t value) {
for (int i = 0; i < 96; i++) { for (int i = 0; i < 96; i++) {
IS31FL3736_mono_set_brightness(i, value); is31fl3736_mono_set_brightness(i, value);
} }
} }
void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled) { void is31fl3736_mono_set_led_control_register(uint8_t index, bool enabled) {
// Index in range 0..95 -> A1..A8, B1..B8, etc. // Index in range 0..95 -> A1..A8, B1..B8, etc.
// Map index 0..95 to registers 0x00..0xBE (interleaved) // Map index 0..95 to registers 0x00..0xBE (interleaved)
@ -263,25 +263,25 @@ void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled) {
g_led_control_registers_update_required = true; g_led_control_registers_update_required = true;
} }
void IS31FL3736_update_pwm_buffers(uint8_t addr, uint8_t index) { void is31fl3736_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
// Firstly we need to unlock the command register and select PG1 // Firstly we need to unlock the command register and select PG1
IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); is31fl3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
IS31FL3736_write_pwm_buffer(addr, g_pwm_buffer[index]); is31fl3736_write_pwm_buffer(addr, g_pwm_buffer[index]);
} }
g_pwm_buffer_update_required[index] = false; g_pwm_buffer_update_required[index] = false;
} }
void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2) { void is31fl3736_update_led_control_registers(uint8_t addr1, uint8_t addr2) {
if (g_led_control_registers_update_required) { if (g_led_control_registers_update_required) {
// Firstly we need to unlock the command register and select PG0 // Firstly we need to unlock the command register and select PG0
IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3736_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); is31fl3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
for (int i = 0; i < 24; i++) { for (int i = 0; i < 24; i++) {
IS31FL3736_write_register(addr1, i, g_led_control_registers[0][i]); is31fl3736_write_register(addr1, i, g_led_control_registers[0][i]);
// IS31FL3736_write_register(addr2, i, g_led_control_registers[1][i]); // is31fl3736_write_register(addr2, i, g_led_control_registers[1][i]);
} }
g_led_control_registers_update_required = false; g_led_control_registers_update_required = false;
} }

View file

@ -42,25 +42,25 @@ typedef struct is31_led {
extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
void IS31FL3736_init(uint8_t addr); void is31fl3736_init(uint8_t addr);
void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data);
void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void is31fl3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue); void is31fl3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
void IS31FL3736_mono_set_brightness(int index, uint8_t value); void is31fl3736_mono_set_brightness(int index, uint8_t value);
void IS31FL3736_mono_set_brightness_all(uint8_t value); void is31fl3736_mono_set_brightness_all(uint8_t value);
void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled); void is31fl3736_mono_set_led_control_register(uint8_t index, bool enabled);
// This should not be called from an interrupt // This should not be called from an interrupt
// (eg. from a timer interrupt). // (eg. from a timer interrupt).
// Call this while idle (in between matrix scans). // Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer. // If the buffer is dirty, it will update the driver with the buffer.
void IS31FL3736_update_pwm_buffers(uint8_t addr, uint8_t index); void is31fl3736_update_pwm_buffers(uint8_t addr, uint8_t index);
void IS31FL3736_update_led_control_registers(uint8_t addr, uint8_t index); void is31fl3736_update_led_control_registers(uint8_t addr, uint8_t index);
#define PUR_0R 0x00 // No PUR resistor #define PUR_0R 0x00 // No PUR resistor
#define PUR_05KR 0x01 // 0.5k Ohm resistor #define PUR_05KR 0x01 // 0.5k Ohm resistor

View file

@ -80,7 +80,7 @@ uint8_t g_twi_transfer_buffer[20];
// The control buffers match the PG0 LED On/Off registers. // The control buffers match the PG0 LED On/Off registers.
// Storing them like this is optimal for I2C transfers to the registers. // Storing them like this is optimal for I2C transfers to the registers.
// We could optimize this and take out the unused registers from these // We could optimize this and take out the unused registers from these
// buffers and the transfers in IS31FL3737_write_pwm_buffer() but it's // buffers and the transfers in is31fl3737_write_pwm_buffer() but it's
// probably not worth the extra complexity. // probably not worth the extra complexity.
uint8_t g_pwm_buffer[DRIVER_COUNT][192]; uint8_t g_pwm_buffer[DRIVER_COUNT][192];
@ -89,7 +89,7 @@ bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0}; uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
bool g_led_control_registers_update_required[DRIVER_COUNT] = {false}; bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) { void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
@ -102,7 +102,7 @@ void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#endif #endif
} }
void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
// assumes PG1 is already selected // assumes PG1 is already selected
// transmit PWM registers in 12 transfers of 16 bytes // transmit PWM registers in 12 transfers of 16 bytes
@ -126,52 +126,52 @@ void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
} }
} }
void IS31FL3737_init(uint8_t addr) { void is31fl3737_init(uint8_t addr) {
// In order to avoid the LEDs being driven with garbage data // In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, shutdown is enabled last. // in the LED driver's PWM registers, shutdown is enabled last.
// Set up the mode and other settings, clear the PWM registers, // Set up the mode and other settings, clear the PWM registers,
// then disable software shutdown. // then disable software shutdown.
// Unlock the command register. // Unlock the command register.
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG0 // Select PG0
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); is31fl3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
// Turn off all LEDs. // Turn off all LEDs.
for (int i = 0x00; i <= 0x17; i++) { for (int i = 0x00; i <= 0x17; i++) {
IS31FL3737_write_register(addr, i, 0x00); is31fl3737_write_register(addr, i, 0x00);
} }
// Unlock the command register. // Unlock the command register.
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG1 // Select PG1
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); is31fl3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
// Set PWM on all LEDs to 0 // Set PWM on all LEDs to 0
// No need to setup Breath registers to PWM as that is the default. // No need to setup Breath registers to PWM as that is the default.
for (int i = 0x00; i <= 0xBF; i++) { for (int i = 0x00; i <= 0xBF; i++) {
IS31FL3737_write_register(addr, i, 0x00); is31fl3737_write_register(addr, i, 0x00);
} }
// Unlock the command register. // Unlock the command register.
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG3 // Select PG3
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION); is31fl3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
// Set de-ghost pull-up resistors (SWx) // Set de-ghost pull-up resistors (SWx)
IS31FL3737_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP); is31fl3737_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
// Set de-ghost pull-down resistors (CSx) // Set de-ghost pull-down resistors (CSx)
IS31FL3737_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP); is31fl3737_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
// Set global current to maximum. // Set global current to maximum.
IS31FL3737_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT); is31fl3737_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT);
// Disable software shutdown. // Disable software shutdown.
IS31FL3737_write_register(addr, ISSI_REG_CONFIGURATION, ((ISSI_PWM_FREQUENCY & 0b111) << 3) | 0x01); is31fl3737_write_register(addr, ISSI_REG_CONFIGURATION, ((ISSI_PWM_FREQUENCY & 0b111) << 3) | 0x01);
// Wait 10ms to ensure the device has woken up. // Wait 10ms to ensure the device has woken up.
wait_ms(10); wait_ms(10);
} }
void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { void is31fl3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31_led led; is31_led led;
if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
@ -186,13 +186,13 @@ void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
} }
} }
void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { void is31fl3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL3737_set_color(i, red, green, blue); is31fl3737_set_color(i, red, green, blue);
} }
} }
void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { void is31fl3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
is31_led led; is31_led led;
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
@ -222,24 +222,24 @@ void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bo
g_led_control_registers_update_required[led.driver] = true; g_led_control_registers_update_required[led.driver] = true;
} }
void IS31FL3737_update_pwm_buffers(uint8_t addr, uint8_t index) { void is31fl3737_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
// Firstly we need to unlock the command register and select PG1 // Firstly we need to unlock the command register and select PG1
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); is31fl3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
IS31FL3737_write_pwm_buffer(addr, g_pwm_buffer[index]); is31fl3737_write_pwm_buffer(addr, g_pwm_buffer[index]);
} }
g_pwm_buffer_update_required[index] = false; g_pwm_buffer_update_required[index] = false;
} }
void IS31FL3737_update_led_control_registers(uint8_t addr, uint8_t index) { void is31fl3737_update_led_control_registers(uint8_t addr, uint8_t index) {
if (g_led_control_registers_update_required[index]) { if (g_led_control_registers_update_required[index]) {
// Firstly we need to unlock the command register and select PG0 // Firstly we need to unlock the command register and select PG0
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); is31fl3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
for (int i = 0; i < 24; i++) { for (int i = 0; i < 24; i++) {
IS31FL3737_write_register(addr, i, g_led_control_registers[index][i]); is31fl3737_write_register(addr, i, g_led_control_registers[index][i]);
} }
} }
g_led_control_registers_update_required[index] = false; g_led_control_registers_update_required[index] = false;

View file

@ -33,21 +33,21 @@ typedef struct is31_led {
extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
void IS31FL3737_init(uint8_t addr); void is31fl3737_init(uint8_t addr);
void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data);
void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void is31fl3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue); void is31fl3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
// This should not be called from an interrupt // This should not be called from an interrupt
// (eg. from a timer interrupt). // (eg. from a timer interrupt).
// Call this while idle (in between matrix scans). // Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer. // If the buffer is dirty, it will update the driver with the buffer.
void IS31FL3737_update_pwm_buffers(uint8_t addr, uint8_t index); void is31fl3737_update_pwm_buffers(uint8_t addr, uint8_t index);
void IS31FL3737_update_led_control_registers(uint8_t addr, uint8_t index); void is31fl3737_update_led_control_registers(uint8_t addr, uint8_t index);
#define PUR_0R 0x00 // No PUR resistor #define PUR_0R 0x00 // No PUR resistor
#define PUR_05KR 0x01 // 0.5k Ohm resistor in t_NOL #define PUR_05KR 0x01 // 0.5k Ohm resistor in t_NOL

View file

@ -82,7 +82,7 @@ uint8_t g_twi_transfer_buffer[20] = {0xFF};
// The scaling buffers match the PG2 and PG3 LED On/Off registers. // The scaling buffers match the PG2 and PG3 LED On/Off registers.
// Storing them like this is optimal for I2C transfers to the registers. // Storing them like this is optimal for I2C transfers to the registers.
// We could optimize this and take out the unused registers from these // We could optimize this and take out the unused registers from these
// buffers and the transfers in IS31FL3741_write_pwm_buffer() but it's // buffers and the transfers in is31fl3741_write_pwm_buffer() but it's
// probably not worth the extra complexity. // probably not worth the extra complexity.
uint8_t g_pwm_buffer[DRIVER_COUNT][ISSI_MAX_LEDS]; uint8_t g_pwm_buffer[DRIVER_COUNT][ISSI_MAX_LEDS];
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
@ -90,7 +90,7 @@ bool g_scaling_registers_update_required[DRIVER_COUNT] = {false};
uint8_t g_scaling_registers[DRIVER_COUNT][ISSI_MAX_LEDS]; uint8_t g_scaling_registers[DRIVER_COUNT][ISSI_MAX_LEDS];
void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data) { void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
@ -103,14 +103,14 @@ void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#endif #endif
} }
bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
// Assume PG0 is already selected // Assume PG0 is already selected
for (int i = 0; i < 342; i += 18) { for (int i = 0; i < 342; i += 18) {
if (i == 180) { if (i == 180) {
// unlock the command register and select PG1 // unlock the command register and select PG1
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM1); is31fl3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM1);
} }
g_twi_transfer_buffer[0] = i % 180; g_twi_transfer_buffer[0] = i % 180;
@ -148,7 +148,7 @@ bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
return true; return true;
} }
void IS31FL3741_init(uint8_t addr) { void is31fl3741_init(uint8_t addr) {
// In order to avoid the LEDs being driven with garbage data // In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, shutdown is enabled last. // in the LED driver's PWM registers, shutdown is enabled last.
// Set up the mode and other settings, clear the PWM registers, // Set up the mode and other settings, clear the PWM registers,
@ -156,26 +156,26 @@ void IS31FL3741_init(uint8_t addr) {
// Unlock the command register. // Unlock the command register.
// Unlock the command register. // Unlock the command register.
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG4 // Select PG4
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION); is31fl3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
// Set to Normal operation // Set to Normal operation
IS31FL3741_write_register(addr, ISSI_REG_CONFIGURATION, 0x01); is31fl3741_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
// Set Golbal Current Control Register // Set Golbal Current Control Register
IS31FL3741_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT); is31fl3741_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT);
// Set Pull up & Down for SWx CSy // Set Pull up & Down for SWx CSy
IS31FL3741_write_register(addr, ISSI_REG_PULLDOWNUP, ((ISSI_CSPULLUP << 4) | ISSI_SWPULLUP)); is31fl3741_write_register(addr, ISSI_REG_PULLDOWNUP, ((ISSI_CSPULLUP << 4) | ISSI_SWPULLUP));
// IS31FL3741_update_led_scaling_registers(addr, 0xFF, 0xFF, 0xFF); // is31fl3741_update_led_scaling_registers(addr, 0xFF, 0xFF, 0xFF);
// Wait 10ms to ensure the device has woken up. // Wait 10ms to ensure the device has woken up.
wait_ms(10); wait_ms(10);
} }
void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { void is31fl3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31_led led; is31_led led;
if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
@ -190,13 +190,13 @@ void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
} }
} }
void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { void is31fl3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL3741_set_color(i, red, green, blue); is31fl3741_set_color(i, red, green, blue);
} }
} }
void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { void is31fl3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
is31_led led; is31_led led;
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
@ -221,19 +221,19 @@ void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bo
g_scaling_registers_update_required[led.driver] = true; g_scaling_registers_update_required[led.driver] = true;
} }
void IS31FL3741_update_pwm_buffers(uint8_t addr, uint8_t index) { void is31fl3741_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
// unlock the command register and select PG2 // unlock the command register and select PG2
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM0); is31fl3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM0);
IS31FL3741_write_pwm_buffer(addr, g_pwm_buffer[index]); is31fl3741_write_pwm_buffer(addr, g_pwm_buffer[index]);
} }
g_pwm_buffer_update_required[index] = false; g_pwm_buffer_update_required[index] = false;
} }
void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) { void is31fl3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) {
g_pwm_buffer[pled->driver][pled->r] = red; g_pwm_buffer[pled->driver][pled->r] = red;
g_pwm_buffer[pled->driver][pled->g] = green; g_pwm_buffer[pled->driver][pled->g] = green;
g_pwm_buffer[pled->driver][pled->b] = blue; g_pwm_buffer[pled->driver][pled->b] = blue;
@ -241,31 +241,31 @@ void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green,
g_pwm_buffer_update_required[pled->driver] = true; g_pwm_buffer_update_required[pled->driver] = true;
} }
void IS31FL3741_update_led_control_registers(uint8_t addr, uint8_t index) { void is31fl3741_update_led_control_registers(uint8_t addr, uint8_t index) {
if (g_scaling_registers_update_required[index]) { if (g_scaling_registers_update_required[index]) {
// unlock the command register and select PG2 // unlock the command register and select PG2
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_SCALING_0); is31fl3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_SCALING_0);
// CS1_SW1 to CS30_SW6 are on PG2 // CS1_SW1 to CS30_SW6 are on PG2
for (int i = CS1_SW1; i <= CS30_SW6; ++i) { for (int i = CS1_SW1; i <= CS30_SW6; ++i) {
IS31FL3741_write_register(addr, i, g_scaling_registers[index][i]); is31fl3741_write_register(addr, i, g_scaling_registers[index][i]);
} }
// unlock the command register and select PG3 // unlock the command register and select PG3
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); is31fl3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_SCALING_1); is31fl3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_SCALING_1);
// CS1_SW7 to CS39_SW9 are on PG3 // CS1_SW7 to CS39_SW9 are on PG3
for (int i = CS1_SW7; i <= CS39_SW9; ++i) { for (int i = CS1_SW7; i <= CS39_SW9; ++i) {
IS31FL3741_write_register(addr, i - CS1_SW7, g_scaling_registers[index][i]); is31fl3741_write_register(addr, i - CS1_SW7, g_scaling_registers[index][i]);
} }
g_scaling_registers_update_required[index] = false; g_scaling_registers_update_required[index] = false;
} }
} }
void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) { void is31fl3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) {
g_scaling_registers[pled->driver][pled->r] = red; g_scaling_registers[pled->driver][pled->r] = red;
g_scaling_registers[pled->driver][pled->g] = green; g_scaling_registers[pled->driver][pled->g] = green;
g_scaling_registers[pled->driver][pled->b] = blue; g_scaling_registers[pled->driver][pled->b] = blue;

View file

@ -32,24 +32,24 @@ typedef struct is31_led {
extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
void IS31FL3741_init(uint8_t addr); void is31fl3741_init(uint8_t addr);
void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data);
bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void is31fl3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue); void is31fl3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
// This should not be called from an interrupt // This should not be called from an interrupt
// (eg. from a timer interrupt). // (eg. from a timer interrupt).
// Call this while idle (in between matrix scans). // Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer. // If the buffer is dirty, it will update the driver with the buffer.
void IS31FL3741_update_pwm_buffers(uint8_t addr, uint8_t index); void is31fl3741_update_pwm_buffers(uint8_t addr, uint8_t index);
void IS31FL3741_update_led_control_registers(uint8_t addr, uint8_t index); void is31fl3741_update_led_control_registers(uint8_t addr, uint8_t index);
void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue); void is31fl3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue); void is31fl3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
#define PUR_0R 0x00 // No PUR resistor #define PUR_0R 0x00 // No PUR resistor
#define PUR_05KR 0x01 // 0.5k Ohm resistor #define PUR_05KR 0x01 // 0.5k Ohm resistor

View file

@ -36,7 +36,7 @@
] ]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 4, "matrix": [0, 2], "x": 0, "y": 0}, {"flags": 4, "matrix": [0, 2], "x": 0, "y": 0},
{"flags": 4, "matrix": [1, 0], "x": 20, "y": 0}, {"flags": 4, "matrix": [1, 0], "x": 20, "y": 0},

View file

@ -40,7 +40,7 @@
"pin": "GP24" "pin": "GP24"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{ "flags": 4, "matrix": [0, 0], "x": 23, "y": 26 }, { "flags": 4, "matrix": [0, 0], "x": 23, "y": 26 },
{ "flags": 4, "matrix": [0, 1], "x": 62, "y": 26 }, { "flags": 4, "matrix": [0, 1], "x": 62, "y": 26 },

View file

@ -40,7 +40,7 @@
] ]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 1, "matrix": [0, 0], "x": 9, "y": 8}, {"flags": 1, "matrix": [0, 0], "x": 9, "y": 8},
{"flags": 4, "matrix": [0, 1], "x": 28, "y": 8}, {"flags": 4, "matrix": [0, 1], "x": 28, "y": 8},

View file

@ -40,7 +40,7 @@
] ]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 1, "matrix": [0, 0], "x": 9, "y": 8}, {"flags": 1, "matrix": [0, 0], "x": 9, "y": 8},
{"flags": 4, "matrix": [0, 1], "x": 28, "y": 8}, {"flags": 4, "matrix": [0, 1], "x": 28, "y": 8},

View file

@ -17,8 +17,6 @@ MOUSEKEY_ENABLE = no # Mouse keys
LEADER_ENABLE = yes LEADER_ENABLE = yes
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = WS2812
WS2812_DRIVER = vendor
ENCODER_ENABLE = yes ENCODER_ENABLE = yes
ENCODER_MAP_ENABLE = yes ENCODER_MAP_ENABLE = yes
OLED_ENABLE = yes OLED_ENABLE = yes

View file

@ -40,7 +40,7 @@
] ]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 1, "matrix": [0, 0], "x": 9, "y": 8}, {"flags": 1, "matrix": [0, 0], "x": 9, "y": 8},
{"flags": 4, "matrix": [0, 1], "x": 28, "y": 8}, {"flags": 4, "matrix": [0, 1], "x": 28, "y": 8},

View file

@ -38,7 +38,7 @@
] ]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"max_brightness": 150, "max_brightness": 150,
"animations": { "animations": {
"solid_color": true, "solid_color": true,

View file

@ -41,7 +41,7 @@
] ]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 2, "x": 17, "y": 50}, {"flags": 2, "x": 17, "y": 50},
{"flags": 2, "x": 37, "y": 50}, {"flags": 2, "x": 37, "y": 50},

View file

@ -32,7 +32,7 @@
"rows": ["GP4", "GP3", "GP2", "GP1", "GP0", "GP21"] "rows": ["GP4", "GP3", "GP2", "GP1", "GP0", "GP21"]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 2, "x": 98, "y": 51}, {"flags": 2, "x": 98, "y": 51},
{"flags": 2, "x": 68, "y": 51}, {"flags": 2, "x": 68, "y": 51},

View file

@ -38,7 +38,7 @@
"enabled": true "enabled": true
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 1, "matrix": [5, 5], "x": 103, "y": 58}, {"flags": 1, "matrix": [5, 5], "x": 103, "y": 58},
{"flags": 1, "matrix": [5, 10], "x": 159, "y": 58}, {"flags": 1, "matrix": [5, 10], "x": 159, "y": 58},

View file

@ -18,7 +18,7 @@
"sleep": true "sleep": true
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["D4", "C6", "F6", "F7"], "cols": ["D4", "C6", "F6", "F7"],

View file

@ -12,7 +12,7 @@
"pin": "B5" "pin": "B5"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["D5", "D6", "C2", "D0"], "cols": ["D5", "D6", "C2", "D0"],

View file

@ -41,7 +41,7 @@
] ]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 4, "matrix": [0, 0], "x": 28, "y": 12}, {"flags": 4, "matrix": [0, 0], "x": 28, "y": 12},
{"flags": 4, "matrix": [0, 1], "x": 84, "y": 12}, {"flags": 4, "matrix": [0, 1], "x": 84, "y": 12},

View file

@ -39,7 +39,7 @@
] ]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 4, "matrix": [0, 0], "x": 28, "y": 12}, {"flags": 4, "matrix": [0, 0], "x": 28, "y": 12},
{"flags": 4, "matrix": [0, 1], "x": 84, "y": 12}, {"flags": 4, "matrix": [0, 1], "x": 84, "y": 12},

View file

@ -8,7 +8,7 @@
"device_version": "0.0.1" "device_version": "0.0.1"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"processor": "atmega32u4", "processor": "atmega32u4",
"bootloader": "caterina" "bootloader": "caterina"

View file

@ -9,7 +9,7 @@
"device_version": "0.0.1" "device_version": "0.0.1"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["F4", "D7"], "cols": ["F4", "D7"],

View file

@ -9,7 +9,7 @@
"device_version": "0.0.1" "device_version": "0.0.1"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "IS31FL3733" "driver": "is31fl3733"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["A1", "B12", "B14", "A2", "A0", "A3", "A4"], "cols": ["A1", "B12", "B14", "A2", "A0", "A3", "A4"],

View file

@ -25,7 +25,7 @@
"driver": "vendor" "driver": "vendor"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"processor": "RP2040", "processor": "RP2040",
"bootloader": "rp2040", "bootloader": "rp2040",

View file

@ -27,7 +27,7 @@
}, },
"processor": "STM32F103", "processor": "STM32F103",
"rgb_matrix": { "rgb_matrix": {
"driver": "IS31FL3733", "driver": "is31fl3733",
"layout": [ "layout": [
{"matrix": [0, 0], "x": 7, "y": 2, "flags": 4}, {"matrix": [0, 0], "x": 7, "y": 2, "flags": 4},
{"matrix": [0, 2], "x": 34, "y": 2, "flags": 4}, {"matrix": [0, 2], "x": 34, "y": 2, "flags": 4},

View file

@ -8,7 +8,7 @@
"pin": "B15" "pin": "B15"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["C8", "C9", "A8", "A10", "C7", "C6", "B14", "B12", "B10", "B1", "C5", "C4", "A7", "B0", "C11", "A3", "B4"], "cols": ["C8", "C9", "A8", "A10", "C7", "C6", "B14", "B12", "B10", "B1", "C5", "C4", "A7", "B0", "C11", "A3", "B4"],

View file

@ -5,7 +5,7 @@
"device_version": "0.0.3" "device_version": "0.0.3"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "IS31FL3741" "driver": "is31fl3741"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["B3", "A15", "A10", "A8", "B14", "B12", "B10", "B1", "B0", "A7", "A4", "A5", "A6", "C15", "A0", "A1"], "cols": ["B3", "A15", "A10", "A8", "B14", "B12", "B10", "B1", "B0", "A7", "A4", "A5", "A6", "C15", "A0", "A1"],

View file

@ -12,7 +12,7 @@
"pin": "B15" "pin": "B15"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["C8", "C9", "A8", "A10", "C7", "C6", "B14", "B12", "B10", "B1", "C5", "C4", "A7", "B0", "C11", "A3", "B4"], "cols": ["C8", "C9", "A8", "A10", "C7", "C6", "B14", "B12", "B10", "B1", "C5", "C4", "A7", "B0", "C11", "A3", "B4"],

View file

@ -12,7 +12,7 @@
"pin": "B15" "pin": "B15"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["C8", "C9", "A8", "A10", "C7", "C6", "B14", "B12", "B10", "B1", "C5", "C4", "A7", "B0", "C11", "A3", "B4"], "cols": ["C8", "C9", "A8", "A10", "C7", "C6", "B14", "B12", "B10", "B1", "C5", "C4", "A7", "B0", "C11", "A3", "B4"],

View file

@ -14,7 +14,7 @@
] ]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"bootmagic": { "bootmagic": {
"matrix": [1, 2] "matrix": [1, 2]

View file

@ -13,7 +13,7 @@
"pin": "B7" "pin": "B7"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"sat_steps": 24 "sat_steps": 24
}, },
"qmk": { "qmk": {

View file

@ -11,7 +11,7 @@
"pin": "F4" "pin": "F4"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["D3", "D2", "F5", "F6", "B2"], "cols": ["D3", "D2", "F5", "F6", "B2"],

View file

@ -145,30 +145,30 @@ led_config_t g_led_config = { {
// Custom Driver // Custom Driver
static void init(void) { static void init(void) {
i2c_init(); i2c_init();
IS31FL3731_init(DRIVER_ADDR_1); is31fl3731_init(DRIVER_ADDR_1);
IS31FL3731_init(DRIVER_ADDR_2); is31fl3731_init(DRIVER_ADDR_2);
for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) { for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) {
bool enabled = !( ( index == 18+5) || //B5 bool enabled = !( ( index == 18+5) || //B5
( index == 36+17) || //C17 ( index == 36+17) || //C17
( index == 54+13) //D13 ( index == 54+13) //D13
); );
IS31FL3731_set_led_control_register(index, enabled, enabled, enabled); is31fl3731_set_led_control_register(index, enabled, enabled, enabled);
} }
IS31FL3731_update_led_control_registers(DRIVER_ADDR_1, 0); is31fl3731_update_led_control_registers(DRIVER_ADDR_1, 0);
IS31FL3731_update_led_control_registers(DRIVER_ADDR_2, 1); is31fl3731_update_led_control_registers(DRIVER_ADDR_2, 1);
} }
static void flush(void) { static void flush(void) {
IS31FL3731_update_pwm_buffers(DRIVER_ADDR_1, 0); is31fl3731_update_pwm_buffers(DRIVER_ADDR_1, 0);
IS31FL3731_update_pwm_buffers(DRIVER_ADDR_2, 1); is31fl3731_update_pwm_buffers(DRIVER_ADDR_2, 1);
} }
static void set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { static void set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
IS31FL3731_set_color(index, red, green, blue); is31fl3731_set_color(index, red, green, blue);
} }
static void set_color_all(uint8_t red, uint8_t green, uint8_t blue) { static void set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
IS31FL3731_set_color_all( red, green, blue ); is31fl3731_set_color_all( red, green, blue );
} }

View file

@ -31,7 +31,7 @@
"caps_lock": "C10" "caps_lock": "C10"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "IS31FL3733", "driver": "is31fl3733",
"max_brightness": 180, "max_brightness": 180,
"animations": { "animations": {
"breathing": true, "breathing": true,

View file

@ -27,7 +27,7 @@
}, },
"diode_direction": "ROW2COL", "diode_direction": "ROW2COL",
"rgb_matrix": { "rgb_matrix": {
"driver": "IS31FL3733", "driver": "is31fl3733",
"max_brightness": 180, "max_brightness": 180,
"animations": { "animations": {
"breathing": true, "breathing": true,

View file

@ -27,7 +27,7 @@
}, },
"diode_direction": "ROW2COL", "diode_direction": "ROW2COL",
"rgb_matrix": { "rgb_matrix": {
"driver": "IS31FL3733", "driver": "is31fl3733",
"max_brightness": 180, "max_brightness": 180,
"animations": { "animations": {
"breathing": true, "breathing": true,

View file

@ -19,7 +19,7 @@
"split_count": [34, 34] "split_count": [34, 34]
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"sat_steps": 8, "sat_steps": 8,
"val_steps": 8, "val_steps": 8,
"speed_steps": 10 "speed_steps": 10

View file

@ -110,7 +110,7 @@
"led_count": 70 "led_count": 70
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 4, "matrix": [0, 0], "x": 0, "y": 0}, {"flags": 4, "matrix": [0, 0], "x": 0, "y": 0},
{"flags": 4, "matrix": [0, 1], "x": 17, "y": 0}, {"flags": 4, "matrix": [0, 1], "x": 17, "y": 0},

View file

@ -9,7 +9,7 @@
"force_nkro": true "force_nkro": true
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["F0", "C7", "C6", "B6", "B5", "B4", "D7", "D6", "B2", "B7", "D3", "D2", "D1", "D0", "B3"], "cols": ["F0", "C7", "C6", "B6", "B5", "B4", "D7", "D6", "B2", "B7", "D3", "D2", "D1", "D0", "B3"],

View file

@ -64,7 +64,7 @@
} }
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"center_point": [126, 126], "center_point": [126, 126],
"layout": [ "layout": [
{"flags": 4, "matrix": [1, 0], "x": 74, "y": 165}, {"flags": 4, "matrix": [1, 0], "x": 74, "y": 165},

View file

@ -9,7 +9,7 @@
"device_version": "0.0.1" "device_version": "0.0.1"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "IS31FL3733" "driver": "is31fl3733"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["C7", "F7", "F6", "F5", "F4", "F1", "F0", "B0", "B1", "B2", "B3", "B7", "D2", "D3", "D5"], "cols": ["C7", "F7", "F6", "F5", "F4", "F1", "F0", "B0", "B1", "B2", "B3", "B7", "D2", "D3", "D5"],

View file

@ -9,7 +9,7 @@
"device_version": "0.0.1" "device_version": "0.0.1"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["D1", "E6", "F7", "B1", "B3", "B2", "D0"], "cols": ["D1", "E6", "F7", "B1", "B3", "B2", "D0"],

View file

@ -4,7 +4,7 @@
"device_version": "1.0.0" "device_version": "1.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "A1", "pin": "A1",

View file

@ -7,7 +7,7 @@
"pin": "D3" "pin": "D3"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["C7", "F0", "D7", "E6", "B4"], "cols": ["C7", "F0", "D7", "E6", "B4"],

View file

@ -7,7 +7,7 @@
"pin": "D3" "pin": "D3"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["F5", "B6", "D7", "E6", "B4"], "cols": ["F5", "B6", "D7", "E6", "B4"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP28", "GP15", "GP6", "GP7", "GP8"], "cols": ["GP28", "GP15", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP28", "GP21", "GP6", "GP7", "GP8"], "cols": ["GP28", "GP21", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "D3", "pin": "D3",

View file

@ -4,7 +4,7 @@
"device_version": "1.0.0" "device_version": "1.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "A1", "pin": "A1",

View file

@ -7,7 +7,7 @@
"pin": "D3" "pin": "D3"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["D5", "C7", "F0", "D7", "E6", "B4"], "cols": ["D5", "C7", "F0", "D7", "E6", "B4"],

View file

@ -7,7 +7,7 @@
"pin": "D3" "pin": "D3"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["F6", "F5", "B6", "D7", "E6", "B4"], "cols": ["F6", "F5", "B6", "D7", "E6", "B4"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP27", "GP28", "GP15", "GP6", "GP7", "GP8"], "cols": ["GP27", "GP28", "GP15", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP27", "GP28", "GP21", "GP6", "GP7", "GP8"], "cols": ["GP27", "GP28", "GP21", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "D3", "pin": "D3",

View file

@ -4,7 +4,7 @@
"device_version": "1.0.0" "device_version": "1.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "A1", "pin": "A1",

View file

@ -7,7 +7,7 @@
"pin": "D3" "pin": "D3"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["D5", "C7", "F0", "D7", "E6", "B4"], "cols": ["D5", "C7", "F0", "D7", "E6", "B4"],

View file

@ -7,7 +7,7 @@
"pin": "D3" "pin": "D3"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["F6", "F5", "B6", "D7", "E6", "B4"], "cols": ["F6", "F5", "B6", "D7", "E6", "B4"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP27", "GP28", "GP15", "GP6", "GP7", "GP8"], "cols": ["GP27", "GP28", "GP15", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP27", "GP28", "GP21", "GP6", "GP7", "GP8"], "cols": ["GP27", "GP28", "GP21", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "D3", "pin": "D3",

View file

@ -5,7 +5,7 @@
"pid": "0x1835" "pid": "0x1835"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP8", "GP9", "GP7", "GP6", "GP28"], "cols": ["GP8", "GP9", "GP7", "GP6", "GP28"],

View file

@ -4,7 +4,7 @@
"device_version": "1.0.0" "device_version": "1.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "A1", "pin": "A1",

View file

@ -7,7 +7,7 @@
"pin": "D2" "pin": "D2"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["B4", "E6", "C6", "B1", "B3", "B2"], "cols": ["B4", "E6", "C6", "B1", "B3", "B2"],

View file

@ -7,7 +7,7 @@
"pin": "D3" "pin": "D3"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["F6", "F5", "B6", "D7", "E6", "B4"], "cols": ["F6", "F5", "B6", "D7", "E6", "B4"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP27", "GP28", "GP15", "GP6", "GP7", "GP8"], "cols": ["GP27", "GP28", "GP15", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP27", "GP28", "GP21", "GP6", "GP7", "GP8"], "cols": ["GP27", "GP28", "GP21", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "D3", "pin": "D3",

View file

@ -4,7 +4,7 @@
"device_version": "1.0.0" "device_version": "1.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "A1", "pin": "A1",

View file

@ -7,7 +7,7 @@
"pin": "D2" "pin": "D2"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["E6", "C6", "B1", "B3", "B2"], "cols": ["E6", "C6", "B1", "B3", "B2"],

View file

@ -7,7 +7,7 @@
"pin": "D3" "pin": "D3"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["F5", "B6", "D7", "E6", "B4"], "cols": ["F5", "B6", "D7", "E6", "B4"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP28", "GP15", "GP6", "GP7", "GP8"], "cols": ["GP28", "GP15", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP28", "GP21", "GP6", "GP7", "GP8"], "cols": ["GP28", "GP21", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "D3", "pin": "D3",

View file

@ -4,7 +4,7 @@
"device_version": "1.0.0" "device_version": "1.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "A1", "pin": "A1",

View file

@ -7,7 +7,7 @@
"pin": "D2" "pin": "D2"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["B4", "E6", "C6", "B1", "B3", "B2"], "cols": ["B4", "E6", "C6", "B1", "B3", "B2"],

View file

@ -7,7 +7,7 @@
"pin": "D3" "pin": "D3"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["F6", "F5", "B6", "D7", "E6", "B4"], "cols": ["F6", "F5", "B6", "D7", "E6", "B4"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP27", "GP28", "GP15", "GP6", "GP7", "GP8"], "cols": ["GP27", "GP28", "GP15", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"matrix_pins": { "matrix_pins": {
"cols": ["GP27", "GP28", "GP21", "GP6", "GP7", "GP8"], "cols": ["GP27", "GP28", "GP21", "GP6", "GP7", "GP8"],

View file

@ -4,7 +4,7 @@
"device_version": "2.0.0" "device_version": "2.0.0"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "ws2812"
}, },
"ws2812": { "ws2812": {
"pin": "D3", "pin": "D3",

View file

@ -28,7 +28,7 @@
"pin": "B15" "pin": "B15"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 4, "matrix": [0, 0], "x": 0, "y": 0}, {"flags": 4, "matrix": [0, 0], "x": 0, "y": 0},
{"flags": 4, "matrix": [0, 1], "x": 112, "y": 0}, {"flags": 4, "matrix": [0, 1], "x": 112, "y": 0},

View file

@ -29,7 +29,7 @@
"vid": "0x3141" "vid": "0x3141"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 4, "matrix": [0, 0], "x": 7, "y": 5}, {"flags": 4, "matrix": [0, 0], "x": 7, "y": 5},
{"flags": 4, "matrix": [0, 1], "x": 22, "y": 5}, {"flags": 4, "matrix": [0, 1], "x": 22, "y": 5},

View file

@ -19,7 +19,7 @@
"pin": "B7" "pin": "B7"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"sat_steps": 8, "sat_steps": 8,
"val_steps": 8, "val_steps": 8,
"speed_steps": 10 "speed_steps": 10

View file

@ -25,7 +25,7 @@
"vid": "0x4273" "vid": "0x4273"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 2, "x": 16, "y": 38}, {"flags": 2, "x": 16, "y": 38},
{"flags": 2, "x": 16, "y": 113}, {"flags": 2, "x": 16, "y": 113},

View file

@ -22,7 +22,7 @@
"enabled": true "enabled": true
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"split_count": [35, 35], "split_count": [35, 35],
"max_brightness": 150, "max_brightness": 150,
"animations": { "animations": {

View file

@ -35,7 +35,7 @@
} }
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 2, "x": 12, "y": 11}, {"flags": 2, "x": 12, "y": 11},
{"flags": 2, "x": 86, "y": 11}, {"flags": 2, "x": 86, "y": 11},

View file

@ -26,7 +26,7 @@
"vid": "0x4273" "vid": "0x4273"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 2, "x": 220, "y": 17}, {"flags": 2, "x": 220, "y": 17},
{"flags": 2, "x": 172, "y": 17}, {"flags": 2, "x": 172, "y": 17},

View file

@ -26,7 +26,7 @@
"vid": "0x4273" "vid": "0x4273"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 2, "x": 220, "y": 17}, {"flags": 2, "x": 220, "y": 17},
{"flags": 2, "x": 172, "y": 17}, {"flags": 2, "x": 172, "y": 17},

View file

@ -43,7 +43,7 @@
"pin": "C6" "pin": "C6"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812", "driver": "ws2812",
"layout": [ "layout": [
{"flags": 2, "x": 224, "y": 42}, {"flags": 2, "x": 224, "y": 42},
{"flags": 2, "x": 224, "y": 21}, {"flags": 2, "x": 224, "y": 21},

Some files were not shown because too many files have changed in this diff Show more