Relocate LED driver init code (#22365)

This commit is contained in:
Ryan 2023-11-01 11:53:45 +11:00 committed by GitHub
parent eac8e67888
commit b52aca0af8
Failed to generate hash of commit
100 changed files with 795 additions and 798 deletions

View file

@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31FL3741_DRIVER_COUNT 1
#define DRIVER_1_LED_TOTAL 87
#define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL
#define ISSI_DRIVER_TOTAL RGB_MATRIX_LED_COUNT
#define RGB_MATRIX_DEFAULT_VAL 80
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS

View file

@ -23,8 +23,8 @@
#define IS31FL3731_DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 36
#define DRIVER_2_LED_TOTAL 36
#define ISSI_DRIVER_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT ISSI_DRIVER_TOTAL
#define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT IS31FL3731_LED_COUNT
#define RGB_MATRIX_DEFAULT_VAL 80
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS

View file

@ -18,7 +18,7 @@
#include "drivers/led/issi/is31fl3731.h"
#ifdef RGB_MATRIX_ENABLE
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -149,7 +149,7 @@ static void init(void) {
is31fl3731_init(IS31FL3731_I2C_ADDRESS_1);
is31fl3731_init(IS31FL3731_I2C_ADDRESS_2);
for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) {
for (int index = 0; index < IS31FL3731_LED_COUNT; index++) {
bool enabled = !( ( index == 18+5) || //B5
( index == 36+17) || //C17
( index == 54+13) //D13

View file

@ -20,7 +20,7 @@
*/
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 3
#define IS31FL3731_LED_COUNT 3
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
*/

View file

@ -22,14 +22,7 @@
* init IS31FL3731 and i2c
*/
void init_fallacy_leds(void) {
i2c_init();
is31fl3731_init(IS31FL3731_I2C_ADDRESS_1);
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
is31fl3731_set_led_control_register(i, true);
}
is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0);
is31fl3731_init_drivers();
}
@ -54,7 +47,7 @@ void set_fallacy_led(int index, bool state) {
/* define LED matrix
*/
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[LED_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
{0, C1_1},
{0, C2_1},
{0, C3_1},

View file

@ -55,7 +55,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define IS31FL3733_DRIVER_COUNT 1
#define RGB_MATRIX_LED_COUNT 64
#define IS31FL3733_LED_COUNT 64
// These define which keys in the matrix are alphas/mods
// Used for backlight effects so colors are different for

View file

@ -55,7 +55,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define IS31FL3733_DRIVER_COUNT 1
#define RGB_MATRIX_LED_COUNT 64
#define IS31FL3733_LED_COUNT 64
// These define which keys in the matrix are alphas/mods
// Used for backlight effects so colors are different for

View file

@ -52,7 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define IS31FL3733_DRIVER_COUNT 1
#define RGB_MATRIX_LED_COUNT 64
#define IS31FL3733_LED_COUNT 64
// These define which keys in the matrix are alphas/mods
// Used for backlight effects so colors are different for

View file

@ -34,7 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_ONESHOT
#ifdef RGB_MATRIX_ENABLE
//#include "gpio.h"
// RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see:
// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
@ -106,7 +105,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
# define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_GND
# define IS31FL3733_DRIVER_COUNT 2
# define IS31FL3733_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
# define DRIVER_1_LED_TOTAL 64
# define DRIVER_2_LED_TOTAL 55
# define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
# define RGB_MATRIX_LED_COUNT IS31FL3733_LED_COUNT
#endif

View file

@ -26,6 +26,7 @@
#include <ch.h>
#include <hal.h>
#include "gpio.h"
#ifndef I2C_COUNT
# define I2C_COUNT 1

View file

@ -60,6 +60,19 @@
# define IS31FL3733_GLOBALCURRENT 0xFF
#endif
#ifndef IS31FL3733_SYNC_1
# define IS31FL3733_SYNC_1 IS31FL3733_SYNC_NONE
#endif
#ifndef IS31FL3733_SYNC_2
# define IS31FL3733_SYNC_2 IS31FL3733_SYNC_NONE
#endif
#ifndef IS31FL3733_SYNC_3
# define IS31FL3733_SYNC_3 IS31FL3733_SYNC_NONE
#endif
#ifndef IS31FL3733_SYNC_4
# define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE
#endif
// Transfer buffer for TWITransmitData()
uint8_t g_twi_transfer_buffer[20];
@ -125,6 +138,24 @@ bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffe
return true;
}
void is31fl3733_init_drivers(void) {
i2c_init(&I2CD1, I2C1_SCL_PIN, I2C1_SDA_PIN);
is31fl3733_init(0, IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1);
# ifdef USE_I2C2
i2c_init(&I2CD2, I2C2_SCL_PIN, I2C2_SDA_PIN);
is31fl3733_init(1, IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2);
# endif
for (int i = 0; i < IS31FL3733_LED_COUNT; i++) {
is31fl3733_set_led_control_register(i, true, true, true);
}
is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0);
# ifdef USE_I2C2
is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1);
# endif
}
void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync) {
// In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, shutdown is enabled last.
@ -173,7 +204,7 @@ void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync) {
void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31fl3733_led_t led;
if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
if (index >= 0 && index < IS31FL3733_LED_COUNT) {
memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led));
if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) {
@ -187,7 +218,7 @@ 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) {
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
for (int i = 0; i < IS31FL3733_LED_COUNT; i++) {
is31fl3733_set_color(i, red, green, blue);
}
}

View file

@ -46,8 +46,9 @@ typedef struct is31fl3733_led_t {
uint8_t b;
} __attribute__((packed)) is31fl3733_led_t;
extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT];
extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT];
void is31fl3733_init_drivers(void);
void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync);
bool is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data);
bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer);
@ -80,6 +81,10 @@ void is31fl3733_flush(void);
#define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0x03
#define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0x04
#define IS31FL3733_SYNC_NONE 0b00
#define IS31FL3733_SYNC_MASTER 0b01
#define IS31FL3733_SYNC_SLAVE 0b10
#define A_1 0x00
#define A_2 0x01
#define A_3 0x02

View file

@ -16,30 +16,10 @@
#ifdef RGB_MATRIX_ENABLE
# include "rgb_matrix.h"
# include "i2c_master.h"
# include "is31fl3733-dual.h"
# include "gpio.h"
static void init(void) {
i2c_init(&I2CD1, I2C1_SCL_PIN, I2C1_SDA_PIN);
is31fl3733_init(0, IS31FL3733_I2C_ADDRESS_1, 0);
# ifdef USE_I2C2
i2c_init(&I2CD2, I2C2_SCL_PIN, I2C2_SDA_PIN);
is31fl3733_init(1, IS31FL3733_I2C_ADDRESS_2, 0);
# endif
for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) {
bool enabled = true;
// This only caches it for later
is31fl3733_set_led_control_register(index, enabled, enabled, enabled);
}
is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0);
# ifdef USE_I2C2
is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1);
# endif
}
const rgb_matrix_driver_t rgb_matrix_driver = {
.init = init,
.init = is31fl3733_init_drivers,
.flush = is31fl3733_flush,
.set_color = is31fl3733_set_color,
.set_color_all = is31fl3733_set_color_all,

View file

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef RGB_MATRIX_ENABLE
# include "is31fl3733-dual.h"
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
{ 0, B_1, A_1, C_1 },
{ 0, B_2, A_2, C_2 },
{ 0, B_3, A_3, C_3 },

View file

@ -1,5 +1,5 @@
ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
# Additional files for RGB lighting
SRC += k_type-rgbdriver.c
QUANTUM_LIB_SRC += i2c_master.c is31fl3733-dual.c
SRC += k_type-rgbdriver.c is31fl3733-dual.c
QUANTUM_LIB_SRC += i2c_master.c
endif

View file

@ -53,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA
#define IS31FL3733_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 128
#define IS31FL3733_LED_COUNT 128
// These define which keys in the matrix are alphas/mods
// Used for backlight effects so colors are different for

View file

@ -74,7 +74,7 @@
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120
#define ISSI_LED_TOTAL DRIVER_1_LED_TOTAL
#define IS31FL3733_LED_COUNT DRIVER_1_LED_TOTAL
// Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them;
// don't use those LEDs in RGB Matrix in that case.
@ -84,7 +84,7 @@
# define WS2812_LED_TOTAL 6
#endif
#define RGB_MATRIX_LED_COUNT (ISSI_LED_TOTAL + WS2812_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_TOTAL)
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES

View file

@ -22,7 +22,7 @@
# include "is31fl3733.h"
# include "ws2812.h"
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
{ 0, B_1, A_1, C_1 },
{ 0, B_2, A_2, C_2 },
{ 0, B_3, A_3, C_3 },
@ -153,8 +153,8 @@ rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL];
static void rgb_matrix_driver_init(void) {
i2c_init();
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0);
for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) {
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE);
for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) {
bool enabled = true;
is31fl3733_set_led_control_register(index, enabled, enabled, enabled);
}
@ -169,13 +169,13 @@ static void rgb_matrix_driver_flush(void) {
}
static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index < ISSI_LED_TOTAL) {
if (index < IS31FL3733_LED_COUNT) {
is31fl3733_set_color(index, red, green, blue);
} else {
# if WS2812_LED_TOTAL > 0
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue;
# endif
}
}

View file

@ -82,7 +82,7 @@
// IS31FL3733+WS2812 driver setup used by this board the LED controller drivers
// are compiled unconditionally).
#define ISSI_LED_TOTAL DRIVER_1_LED_TOTAL
#define IS31FL3733_LED_COUNT DRIVER_1_LED_TOTAL
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180
@ -94,7 +94,7 @@
# define WS2812_LED_TOTAL 6
#endif
#define RGB_MATRIX_LED_COUNT (ISSI_LED_TOTAL + WS2812_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_TOTAL)
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES

View file

@ -24,7 +24,7 @@
# include "ws2812.h"
const PROGMEM is31fl3733_led_t g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const PROGMEM is31fl3733_led_t g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
{ 0, B_1, A_1, C_1 },
{ 0, B_2, A_2, C_2 },
{ 0, B_3, A_3, C_3 },
@ -153,8 +153,8 @@ rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL];
static void rgb_matrix_driver_init(void) {
i2c_init();
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0);
for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) {
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE);
for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) {
bool enabled = true;
is31fl3733_set_led_control_register(index, enabled, enabled, enabled);
}
@ -169,13 +169,13 @@ static void rgb_matrix_driver_flush(void) {
}
static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index < ISSI_LED_TOTAL) {
if (index < IS31FL3733_LED_COUNT) {
is31fl3733_set_color(index, red, green, blue);
} else {
# if WS2812_LED_TOTAL > 0
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue;
# endif
}
}

View file

@ -81,7 +81,7 @@
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define DRIVER_1_LED_TOTAL 61
#define ISSI_LED_TOTAL DRIVER_1_LED_TOTAL
#define IS31FL3733_LED_COUNT DRIVER_1_LED_TOTAL
// Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them;
// don't use those LEDs in RGB Matrix in that case.
@ -91,7 +91,7 @@
# define WS2812_LED_TOTAL 6
#endif
#define RGB_MATRIX_LED_COUNT (ISSI_LED_TOTAL + WS2812_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_TOTAL)
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES

View file

@ -21,7 +21,7 @@
# include "is31fl3733.h"
# include "ws2812.h"
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
{ 0, B_1, A_1, C_1 },
{ 0, B_2, A_2, C_2 },
{ 0, B_3, A_3, C_3 },
@ -149,8 +149,8 @@ rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL];
static void rgb_matrix_driver_init(void) {
i2c_init();
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0);
for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) {
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE);
for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) {
bool enabled = true;
is31fl3733_set_led_control_register(index, enabled, enabled, enabled);
}
@ -165,13 +165,13 @@ static void rgb_matrix_driver_flush(void) {
}
static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index < ISSI_LED_TOTAL) {
if (index < IS31FL3733_LED_COUNT) {
is31fl3733_set_color(index, red, green, blue);
} else {
# if WS2812_LED_TOTAL > 0
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue;
# endif
}
}

View file

@ -80,4 +80,4 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_DRIVER_COUNT 1
#define RGB_MATRIX_LED_COUNT 20
#define IS31FL3731_LED_COUNT 20

View file

@ -30,7 +30,7 @@
#endif
// rgb ring leds setting
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -371,13 +371,7 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds)
void rgb_ring_init(void)
{
i2c_init();
is31fl3731_init(IS31FL3731_I2C_ADDRESS_1);
for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) {
bool enabled = true;
is31fl3731_set_led_control_register(index, enabled, enabled, enabled);
}
is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0);
is31fl3731_init_drivers();
}
void rgb_ring_task(void)

View file

@ -111,7 +111,7 @@ static void self_testing(void)
}
if (rgb_state.index >= ST_LEFT_END) {
for (int i = rgb_state.index - 1; i < RGB_MATRIX_LED_COUNT - rgb_state.index + 1; i++) {
for (int i = rgb_state.index - 1; i < IS31FL3731_LED_COUNT - rgb_state.index + 1; i++) {
is31fl3731_set_color(i, led.r, led.g, led.b);
}
if (rgb_state.index == ST_LEFT_END) {
@ -173,13 +173,13 @@ static void self_testing(void)
}
break;
case ST_STAGE_3:
if (rgb_state.index != RGB_MATRIX_LED_COUNT/2) {
if (rgb_state.index != IS31FL3731_LED_COUNT/2) {
is31fl3731_set_color_all(0, 0, 0);
}
// light left and right
if (rgb_state.index == RGB_MATRIX_LED_COUNT/2) {
if (rgb_state.index == IS31FL3731_LED_COUNT/2) {
if (rgb_state.duration) {
rgb_state.duration--;
} else {
@ -207,7 +207,7 @@ static void self_testing(void)
update_ticks();
}
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -294,18 +294,8 @@ void matrix_init_kb(void)
setPinOutput(LED_CAPS_LOCK_PIN);
writePinLow(LED_CAPS_LOCK_PIN);
i2c_init();
is31fl3731_init(IS31FL3731_I2C_ADDRESS_1);
#ifdef IS31FL3731_I2C_ADDRESS_2
is31fl3731_init(IS31FL3731_I2C_ADDRESS_2);
#endif
for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) {
is31fl3731_set_led_control_register(index, true, true, true);
}
is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0);
#ifdef IS31FL3731_I2C_ADDRESS_2
is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1);
#endif
is31fl3731_init_drivers();
update_ticks();
matrix_init_user();
}
@ -350,16 +340,16 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds)
{
if (rgb_state.state != NORMAL) return;
for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
for (uint8_t i = 0; i < IS31FL3731_LED_COUNT; i++) {
is31fl3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b);
}
rgb_led_t leds[4];
for (int i = 0; i < 4; i++) {
leds[i].r = start_led[RGB_MATRIX_LED_COUNT+i].g;
leds[i].g = start_led[RGB_MATRIX_LED_COUNT+i].r;
leds[i].b = start_led[RGB_MATRIX_LED_COUNT+i].b;
leds[i].r = start_led[IS31FL3731_LED_COUNT+i].g;
leds[i].g = start_led[IS31FL3731_LED_COUNT+i].r;
leds[i].b = start_led[IS31FL3731_LED_COUNT+i].b;
}
//ws2812_setleds(start_led+RGB_MATRIX_LED_COUNT, 4);
//ws2812_setleds(start_led+IS31FL3731_LED_COUNT, 4);
ws2812_setleds(leds, 4);
}

View file

@ -35,6 +35,6 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL)
#define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL)
#define USB_SUSPEND_WAKEUP_DELAY 1000

View file

@ -35,4 +35,4 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL)
#define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL)

View file

@ -115,7 +115,7 @@ static void self_testing(void)
}
if (rgb_state.index >= ST_LEFT_END) {
for (int i = rgb_state.index - 1; i < RGB_MATRIX_LED_COUNT - rgb_state.index + 1; i++) {
for (int i = rgb_state.index - 1; i < IS31FL3731_LED_COUNT - rgb_state.index + 1; i++) {
is31fl3731_set_color(i, led.r, led.g, led.b);
}
if (rgb_state.index == ST_LEFT_END) {
@ -177,13 +177,13 @@ static void self_testing(void)
}
break;
case ST_STAGE_3:
if (rgb_state.index != RGB_MATRIX_LED_COUNT/2) {
if (rgb_state.index != IS31FL3731_LED_COUNT/2) {
is31fl3731_set_color_all(0, 0, 0);
}
// light left and right
if (rgb_state.index == RGB_MATRIX_LED_COUNT/2) {
if (rgb_state.index == IS31FL3731_LED_COUNT/2) {
if (rgb_state.duration) {
rgb_state.duration--;
} else {
@ -211,7 +211,7 @@ static void self_testing(void)
update_ticks();
}
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -298,18 +298,8 @@ void matrix_init_kb(void)
setPinOutput(LED_CAPS_LOCK_PIN);
writePinLow(LED_CAPS_LOCK_PIN);
i2c_init();
is31fl3731_init(IS31FL3731_I2C_ADDRESS_1);
#ifdef IS31FL3731_I2C_ADDRESS_2
is31fl3731_init(IS31FL3731_I2C_ADDRESS_2);
#endif
for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) {
is31fl3731_set_led_control_register(index, true, true, true);
}
is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0);
#ifdef IS31FL3731_I2C_ADDRESS_2
is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1);
#endif
is31fl3731_init_drivers();
update_ticks();
matrix_init_user();
}
@ -352,10 +342,10 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds)
{
if (rgb_state.state != NORMAL) return;
for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
for (uint8_t i = 0; i < IS31FL3731_LED_COUNT; i++) {
is31fl3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b);
}
ws2812_setleds(start_led+RGB_MATRIX_LED_COUNT, 1);
ws2812_setleds(start_led+IS31FL3731_LED_COUNT, 1);
}
bool led_update_kb(led_t led_state)

View file

@ -53,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA
#define IS31FL3733_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 128
#define IS31FL3733_LED_COUNT 128
// These define which keys in the matrix are alphas/mods
// Used for backlight effects so colors are different for

View file

@ -53,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA
#define IS31FL3733_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 128
#define IS31FL3733_LED_COUNT 128
// These define which keys in the matrix are alphas/mods
// Used for backlight effects so colors are different for

View file

@ -75,7 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_DRIVER_COUNT 1
#define RGB_MATRIX_LED_COUNT 16
#define IS31FL3731_LED_COUNT 16
// These define which keys in the matrix are alphas/mods
// Used for backlight effects so colors are different for

View file

@ -59,7 +59,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA
#define IS31FL3733_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 128
#define IS31FL3733_LED_COUNT 128
// These define which keys in the matrix are alphas/mods
// Used for backlight effects so colors are different for

View file

@ -51,7 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 67
#define IS31FL3731_LED_COUNT 67
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef RGB_MATRIX_ENABLE
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
{ 0, C2_1, C3_1, C4_1 },
{ 0, C1_1, C3_2, C4_2 },
{ 0, C1_2, C2_2, C4_3 },

View file

@ -81,7 +81,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// WT_RGB IS31FL3741 driver code
# define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
# define IS31FL3741_DRIVER_COUNT 1
# define RGB_MATRIX_LED_COUNT 98
# define IS31FL3741_LED_COUNT 98
# define RGB_BACKLIGHT_ENABLED 1

View file

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef RGB_MATRIX_ENABLE
const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = {
{0, CS18_SW1, CS17_SW1, CS16_SW1},
{0, CS18_SW2, CS17_SW2, CS16_SW2},
{0, CS18_SW3, CS17_SW3, CS16_SW3},

View file

@ -19,7 +19,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

View file

@ -19,7 +19,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

View file

@ -23,7 +23,7 @@
// IS31FL3731 driver
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_DRIVER_COUNT 1
#define RGB_MATRIX_LED_COUNT 12
#define IS31FL3731_LED_COUNT 12
// Enable WT RGB backlight
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -24,7 +24,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
// Enable WT RGB backlight
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -19,7 +19,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

View file

@ -24,7 +24,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
// Enable WT RGB backlight
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -24,7 +24,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
// Enable WT RGB backlight
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -20,7 +20,7 @@
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
#define RGB_MATRIX_LED_COUNT 6
#define IS31FL3218_LED_COUNT 6
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -42,7 +42,7 @@
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_I2C_ADDRESS_3 IS31FL3731_I2C_ADDRESS_SCL
#define IS31FL3731_DRIVER_COUNT 3
#define RGB_MATRIX_LED_COUNT 108
#define IS31FL3731_LED_COUNT 108
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -26,7 +26,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -26,7 +26,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -26,7 +26,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -50,7 +50,7 @@ backlight_config g_config = {
.color_1 = MONO_BACKLIGHT_COLOR_1,
};
const is31fl3736_led_t PROGMEM g_is31fl3736_leds[LED_MATRIX_LED_COUNT] = {
const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT] = {
{0, A_1},
{0, A_2},
{0, A_3},
@ -170,14 +170,7 @@ uint32_t g_any_key_hit = 0;
void backlight_init_drivers(void)
{
// Initialize I2C
i2c_init();
is31fl3736_init( IS31FL3736_I2C_ADDRESS_1 );
for ( uint8_t index = 0; index < 96; index++ ) {
is31fl3736_set_led_control_register( index, true );
}
is31fl3736_update_led_control_registers( IS31FL3736_I2C_ADDRESS_1, 0 );
is31fl3736_init_drivers();
}
void backlight_set_key_hit(uint8_t row, uint8_t column)

View file

@ -157,7 +157,7 @@ uint32_t g_any_key_hit = 0;
#if defined(RGB_BACKLIGHT_HS60)
#define ISSI_ADDR_1 IS31FL3733_I2C_ADDRESS_GND_GND
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -234,7 +234,7 @@ const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define ISSI_ADDR_2 IS31FL3733_I2C_ADDRESS_GND_SDA
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -375,7 +375,7 @@ const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
#elif defined(RGB_BACKLIGHT_NEBULA12)
#define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -406,7 +406,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA
#define ISSI_ADDR_3 IS31FL3731_I2C_ADDRESS_SCL
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -531,7 +531,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
#define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -610,7 +610,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
#define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_VCC
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -694,7 +694,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3741_I2C_ADDRESS_GND
#define ISSI_ADDR_2
const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -817,7 +817,7 @@ const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = {
};
#elif defined(RGB_BACKLIGHT_M6_B)
const is31fl3218_led_t PROGMEM g_is31fl3218_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT] = {
{OUT1, OUT2, OUT3},
{OUT4, OUT5, OUT6},
{OUT7, OUT8, OUT9},
@ -829,7 +829,7 @@ const is31fl3218_led_t PROGMEM g_is31fl3218_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
#define ISSI_ADDR_2
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
{0, C1_9, C3_10, C4_10}, // LB1
{0, C1_10, C2_10, C4_11}, // LB2
{0, C1_11, C2_11, C3_11}, // LB3
@ -847,7 +847,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
#define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -1817,12 +1817,12 @@ void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
is31fl3733_set_color( index, red, green, blue );
}
#elif defined(RGB_BACKLIGHT_DAWN60)
if( index < RGB_MATRIX_LED_COUNT ) {
if( index < IS31FL3731_LED_COUNT ) {
is31fl3731_set_color( index, red, green, blue );
} else {
g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].r = red;
g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].g = green;
g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].b = blue;
g_ws2812_leds[index - IS31FL3731_LED_COUNT].r = red;
g_ws2812_leds[index - IS31FL3731_LED_COUNT].g = green;
g_ws2812_leds[index - IS31FL3731_LED_COUNT].b = blue;
ws2812_setleds(g_ws2812_leds, WS2812_LED_TOTAL);
}
#else
@ -2111,9 +2111,9 @@ void backlight_effect_alphas_mods(void)
for (int i = 0; i < WS2812_LED_TOTAL; i++) {
if ((RGB_UNDERGLOW_ALPHA_TOP_START <= i && i <= RGB_UNDERGLOW_ALPHA_TOP_END) ||
(RGB_UNDERGLOW_ALPHA_BOT_START <= i && i <= RGB_UNDERGLOW_ALPHA_BOT_END)) {
backlight_set_color(i + RGB_MATRIX_LED_COUNT, rgb1.r, rgb1.g, rgb1.b);
backlight_set_color(i + IS31FL3731_LED_COUNT, rgb1.r, rgb1.g, rgb1.b);
} else {
backlight_set_color(i + RGB_MATRIX_LED_COUNT, rgb2.r, rgb2.g, rgb2.b);
backlight_set_color(i + IS31FL3731_LED_COUNT, rgb2.r, rgb2.g, rgb2.b);
}
}
#endif
@ -2902,7 +2902,7 @@ void backlight_init_drivers(void)
#if defined(RGB_BACKLIGHT_M6_B)
is31fl3218_init();
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3218_LED_COUNT; index++ )
{
bool enabled = true;
@ -2913,9 +2913,9 @@ void backlight_init_drivers(void)
// This actually updates the LED drivers
is31fl3218_update_led_control_registers();
#elif defined(RGB_BACKLIGHT_HS60)
is31fl3733_init( ISSI_ADDR_1, 0 );
is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE );
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ )
{
#if defined(HS60_ANSI)
bool enabled = !( ( index == 48-1 ) || //LA48
@ -2934,10 +2934,10 @@ void backlight_init_drivers(void)
// This actually updates the LED drivers
is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 );
#elif defined(RGB_BACKLIGHT_NK65)
is31fl3733_init( ISSI_ADDR_1, 0 );
is31fl3733_init( ISSI_ADDR_2, 0 );
is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE );
is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE );
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ )
{
bool enabled = !( ( index == 61-1 ) || //LA61
( index > 6+64-1 ) ); //LB7-LB64
@ -2949,10 +2949,10 @@ void backlight_init_drivers(void)
is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 );
is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 );
#elif defined(RGB_BACKLIGHT_NK87)
is31fl3733_init( ISSI_ADDR_1, 0 );
is31fl3733_init( ISSI_ADDR_2, 0 );
is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE );
is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE );
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ )
{
bool enabled = !( ( index == 61-1 ) || //LA61
( (index >= 2+64-1) && (index <= 4+64-1) ) ||
@ -2979,10 +2979,10 @@ void backlight_init_drivers(void)
is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 );
is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 );
#elif defined(RGB_BACKLIGHT_NEBULA68)
is31fl3733_init( ISSI_ADDR_1, 0 );
is31fl3733_init( ISSI_ADDR_2, 0 );
is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE );
is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE );
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ )
{
bool enabled = !( ( index == 61-1 ) || //LA61
( index > 5+64-1 ) ); //LB6-LB64
@ -2995,17 +2995,17 @@ void backlight_init_drivers(void)
#elif defined(RGB_BACKLIGHT_PORTICO75)
is31fl3741_init( ISSI_ADDR_1 );
bool enabled = true;
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3741_LED_COUNT; index++ )
{
is31fl3741_set_led_control_register( index, enabled, enabled, enabled );
}
// This actually updates the LED drivers
is31fl3741_update_led_control_registers( ISSI_ADDR_1, 0 );
#elif defined(RGB_BACKLIGHT_KW_MEGA)
is31fl3733_init( ISSI_ADDR_1, 0 );
is31fl3733_init( ISSI_ADDR_2, 0 );
is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE );
is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE );
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ )
{
bool enabled = !( ( index == 61-1 ) || //LA61
( index > 6+64-1 ) ); //LB7-LB64
@ -3032,7 +3032,7 @@ void backlight_init_drivers(void)
bool disable_spacebar_stab_leds = false;
#endif
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < BACKLIGHT_LED_COUNT; index++ )
{
// OR the possible "disabled" cases together, then NOT the result to get the enabled state
// LC6 LD13 not present on Zeal65

View file

@ -19,7 +19,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

View file

@ -19,7 +19,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 72
#define IS31FL3731_LED_COUNT 72
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

View file

@ -19,7 +19,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 64
#define IS31FL3731_LED_COUNT 64
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

View file

@ -30,8 +30,8 @@
#define IS31FL3731_DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 32
#define DRIVER_2_LED_TOTAL 32
#define ISSI_DRIVER_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL + WS2812_LED_TOTAL)
#define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (IS31FL3731_LED_COUNT + WS2812_LED_TOTAL)
#define RGB_MATRIX_DEFAULT_VAL 80
#define RGB_MATRIX_KEYPRESSES

View file

@ -25,7 +25,7 @@
#ifdef RGB_MATRIX_ENABLE
rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL];
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -99,28 +99,6 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
{1, C9_14, C8_14, C7_14}, //D14
{1, C9_15, C8_15, C6_14}, //D15
{1, C9_16, C7_15, C6_15}, //D16
//fake underglows 1- 20
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0}
};
__attribute__ ((weak))
@ -169,7 +147,7 @@ static void init(void) {
i2c_init();
is31fl3731_init(IS31FL3731_I2C_ADDRESS_1);
is31fl3731_init(IS31FL3731_I2C_ADDRESS_2);
for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) {
for (int index = 0; index < IS31FL3731_LED_COUNT; index++) {
bool enabled = true;
is31fl3731_set_led_control_register(index, enabled, enabled, enabled);
}
@ -187,12 +165,12 @@ static void flush(void) {
}
static void set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index < ISSI_DRIVER_TOTAL) {
if (index < IS31FL3731_LED_COUNT) {
is31fl3731_set_color(index, red, green, blue);
} else {
rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].r = red;
rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].g = green;
rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].b = blue;
rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].r = red;
rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].g = green;
rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].b = blue;
}
}

View file

@ -41,8 +41,7 @@
#define IS31FL3741_DRIVER_COUNT 1
#define DRIVER_1_LED_TOTAL 117
#define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL
#define ISSI_DRIVER_TOTAL RGB_MATRIX_LED_COUNT
#define IS31FL3741_LED_COUNT DRIVER_1_LED_TOTAL
#define RGB_MATRIX_DEFAULT_VAL 80
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS

View file

@ -22,7 +22,7 @@ void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); }
#ifdef RGB_MATRIX_ENABLE
#include "i2c_master.h"
#include "drivers/led/issi/is31fl3741.h"
const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -189,7 +189,7 @@ led_config_t g_led_config = { {
static void init(void) {
i2c_init();
is31fl3741_init(IS31FL3741_I2C_ADDRESS_1);
for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) {
for (int index = 0; index < IS31FL3741_LED_COUNT; index++) {
bool enabled = !( ( index == -1+0+13) || //A13
( index == -1+13+3) || //B3
( index == -1+13+13) || //B13

View file

@ -41,8 +41,7 @@
#define IS31FL3741_DRIVER_COUNT 1
#define DRIVER_1_LED_TOTAL 117
#define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL
#define ISSI_DRIVER_TOTAL RGB_MATRIX_LED_COUNT
#define IS31FL3741_LED_COUNT DRIVER_1_LED_TOTAL
#define RGB_MATRIX_DEFAULT_VAL 80
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS

View file

@ -22,7 +22,7 @@ void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); }
#ifdef RGB_MATRIX_ENABLE
#include "i2c_master.h"
#include "drivers/led/issi/is31fl3741.h"
const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -195,7 +195,7 @@ led_config_t g_led_config = { {
static void init(void) {
i2c_init();
is31fl3741_init(IS31FL3741_I2C_ADDRESS_1);
for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) {
for (int index = 0; index < IS31FL3741_LED_COUNT; index++) {
bool enabled = !( ( index == -1+0+13) || //A13
( index == -1+13+3) || //B3
( index == -1+13+13) || //B13