summaryrefslogtreecommitdiff
path: root/keyboards/neson_design
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2023-11-01 11:53:45 +1100
committerGitHub <noreply@github.com>2023-11-01 00:53:45 +0000
commitb52aca0af83fade24c56b4bb7369f18183123bd3 (patch)
tree9b553c4b771717cc334f3c8683052bc701472c4d /keyboards/neson_design
parenteac8e6788871a087eafdc5492eee425a7205d727 (diff)
Relocate LED driver init code (#22365)
Diffstat (limited to 'keyboards/neson_design')
-rw-r--r--keyboards/neson_design/700e/700e.c32
-rw-r--r--keyboards/neson_design/700e/config.h2
-rw-r--r--keyboards/neson_design/n6/config.h2
-rw-r--r--keyboards/neson_design/n6/n6.c26
4 files changed, 21 insertions, 41 deletions
diff --git a/keyboards/neson_design/700e/700e.c b/keyboards/neson_design/700e/700e.c
index d4aa336edb..9def73d6a4 100644
--- a/keyboards/neson_design/700e/700e.c
+++ b/keyboards/neson_design/700e/700e.c
@@ -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);
}
diff --git a/keyboards/neson_design/700e/config.h b/keyboards/neson_design/700e/config.h
index bd1d9888ec..4cecb6165a 100644
--- a/keyboards/neson_design/700e/config.h
+++ b/keyboards/neson_design/700e/config.h
@@ -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
diff --git a/keyboards/neson_design/n6/config.h b/keyboards/neson_design/n6/config.h
index 22a25a0d92..847b26eb25 100644
--- a/keyboards/neson_design/n6/config.h
+++ b/keyboards/neson_design/n6/config.h
@@ -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)
diff --git a/keyboards/neson_design/n6/n6.c b/keyboards/neson_design/n6/n6.c
index 5f3ae3a169..38b634eeb7 100644
--- a/keyboards/neson_design/n6/n6.c
+++ b/keyboards/neson_design/n6/n6.c
@@ -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)