diff options
Diffstat (limited to 'keyboards/neson_design/n6')
-rw-r--r-- | keyboards/neson_design/n6/config.h | 8 | ||||
-rw-r--r-- | keyboards/neson_design/n6/n6.c | 41 | ||||
-rw-r--r-- | keyboards/neson_design/n6/rules.mk | 3 |
3 files changed, 20 insertions, 32 deletions
diff --git a/keyboards/neson_design/n6/config.h b/keyboards/neson_design/n6/config.h index 91d96c6a4d..847b26eb25 100644 --- a/keyboards/neson_design/n6/config.h +++ b/keyboards/neson_design/n6/config.h @@ -32,7 +32,7 @@ #define DRIVER_1_LED_TOTAL 32 #define DRIVER_2_LED_TOTAL 32 -#define DRIVER_ADDR_1 0b1110100 -#define DRIVER_ADDR_2 0b1110111 -#define DRIVER_COUNT 2 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL) +#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND +#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC +#define IS31FL3731_DRIVER_COUNT 2 +#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 cf99404641..38b634eeb7 100644 --- a/keyboards/neson_design/n6/n6.c +++ b/keyboards/neson_design/n6/n6.c @@ -48,18 +48,18 @@ enum { // led index #define ST_LEFT_BEGIN 0 -#ifdef DRIVER_ADDR_2 +#ifdef IS31FL3731_I2C_ADDRESS_2 #define ST_LEFT_SIZE 4 #else #define ST_LEFT_SIZE 2 #endif #define ST_LEFT_END (ST_LEFT_BEGIN+ST_LEFT_SIZE-1) -#ifdef DRIVER_ADDR_2 +#ifdef IS31FL3731_I2C_ADDRESS_2 #define ST_RIGHT_BEGIN 60 #else #define ST_RIGHT_BEGIN 30 #endif -#ifdef DRIVER_ADDR_2 +#ifdef IS31FL3731_I2C_ADDRESS_2 #define ST_RIGHT_SIZE 4 #else #define ST_RIGHT_SIZE 2 @@ -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 is31_led PROGMEM g_is31_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(DRIVER_ADDR_1); -#ifdef DRIVER_ADDR_2 - is31fl3731_init(DRIVER_ADDR_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(DRIVER_ADDR_1, 0); -#ifdef DRIVER_ADDR_2 - is31fl3731_update_led_control_registers(DRIVER_ADDR_2, 1); -#endif + is31fl3731_init_drivers(); + update_ticks(); matrix_init_user(); } @@ -320,7 +310,7 @@ void housekeeping_task_kb(void) self_testing(); } else if (rgb_state.state == CAPS_ALERT) { //gold 0xFF, 0xD9, 0x00 - LED_TYPE led = { + rgb_led_t led = { .r = 0xFF, //.g = 0xD9, .g = 0xA5, @@ -343,22 +333,19 @@ void housekeeping_task_kb(void) } } - is31fl3731_update_pwm_buffers(DRIVER_ADDR_1, 0); -#ifdef DRIVER_ADDR_2 - is31fl3731_update_pwm_buffers(DRIVER_ADDR_2, 1); -#endif + is31fl3731_flush(); housekeeping_task_user(); } -void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) +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) diff --git a/keyboards/neson_design/n6/rules.mk b/keyboards/neson_design/n6/rules.mk index 5d8397653e..a3e4abe6cd 100644 --- a/keyboards/neson_design/n6/rules.mk +++ b/keyboards/neson_design/n6/rules.mk @@ -10,4 +10,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -QUANTUM_LIB_SRC += i2c_master.c drivers/led/issi/is31fl3731.c +QUANTUM_LIB_SRC += drivers/led/issi/is31fl3731.c +I2C_DRIVER_REQUIRED = yes |