aboutsummaryrefslogtreecommitdiff
path: root/keyboards/wilba_tech/wt_rgb_backlight.c
diff options
context:
space:
mode:
authoryiancar <yiangosyiangou@cytanet.com.cy>2020-08-19 01:56:40 +0100
committerGitHub <noreply@github.com>2020-08-18 17:56:40 -0700
commit1ff68165b855e4af3325adb3cf532d78fffb17fb (patch)
tree766e6070f11e74d0216d5e7b7c93f93bd0eb041e /keyboards/wilba_tech/wt_rgb_backlight.c
parent33579efee3195e9c0c8ab180c47699cc765129a4 (diff)
downloadqmk_firmware-1ff68165b855e4af3325adb3cf532d78fffb17fb.tar.gz
qmk_firmware-1ff68165b855e4af3325adb3cf532d78fffb17fb.zip
[Keyboard] NK87 (#9965)
* Initial commit * Fix1 * Final Prettify * Update keyboards/nk87/config.h * Update keyboards/nk87/keymaps/default/keymap.c * Update keyboards/nk87/keymaps/via/keymap.c * Update keyboards/nk87/rules.mk * Remove unnecessary junk * Update keyboards/nk87/readme.md * Update keyboards/nk87/readme.md * Update keyboards/nk87/readme.md * Update keyboards/nk87/keymaps/default/readme.md * Update keyboards/nk87/keymaps/via/readme.md
Diffstat (limited to 'keyboards/wilba_tech/wt_rgb_backlight.c')
-rw-r--r--keyboards/wilba_tech/wt_rgb_backlight.c118
1 files changed, 105 insertions, 13 deletions
diff --git a/keyboards/wilba_tech/wt_rgb_backlight.c b/keyboards/wilba_tech/wt_rgb_backlight.c
index 73d8208a7..30c9c4c56 100644
--- a/keyboards/wilba_tech/wt_rgb_backlight.c
+++ b/keyboards/wilba_tech/wt_rgb_backlight.c
@@ -24,6 +24,7 @@
24 defined(RGB_BACKLIGHT_M65_BX) || \ 24 defined(RGB_BACKLIGHT_M65_BX) || \
25 defined(RGB_BACKLIGHT_HS60) || \ 25 defined(RGB_BACKLIGHT_HS60) || \
26 defined(RGB_BACKLIGHT_NK65) || \ 26 defined(RGB_BACKLIGHT_NK65) || \
27 defined(RGB_BACKLIGHT_NK87) || \
27 defined(RGB_BACKLIGHT_NEBULA12) || \ 28 defined(RGB_BACKLIGHT_NEBULA12) || \
28 defined(RGB_BACKLIGHT_NEBULA65) || \ 29 defined(RGB_BACKLIGHT_NEBULA65) || \
29 defined(RGB_BACKLIGHT_U80_A) || \ 30 defined(RGB_BACKLIGHT_U80_A) || \
@@ -49,7 +50,7 @@
49#include "wt_rgb_backlight_api.h" 50#include "wt_rgb_backlight_api.h"
50#include "wt_rgb_backlight_keycodes.h" 51#include "wt_rgb_backlight_keycodes.h"
51 52
52#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) 53#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NK87) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12)
53#include <avr/interrupt.h> 54#include <avr/interrupt.h>
54#include "drivers/avr/i2c_master.h" 55#include "drivers/avr/i2c_master.h"
55#else 56#else
@@ -83,6 +84,9 @@ LED_TYPE g_ws2812_leds[WS2812_LED_TOTAL];
83#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65) 84#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65)
84#include "drivers/issi/is31fl3733.h" 85#include "drivers/issi/is31fl3733.h"
85#define BACKLIGHT_LED_COUNT 69 86#define BACKLIGHT_LED_COUNT 69
87#elif defined(RGB_BACKLIGHT_NK87)
88#include "drivers/issi/is31fl3733.h"
89#define BACKLIGHT_LED_COUNT 128
86#else 90#else
87#include "drivers/issi/is31fl3731.h" 91#include "drivers/issi/is31fl3731.h"
88#if defined(RGB_BACKLIGHT_U80_A) 92#if defined(RGB_BACKLIGHT_U80_A)
@@ -223,7 +227,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
223 {0, K_16, J_16, L_16}, //LA64 227 {0, K_16, J_16, L_16}, //LA64
224}; 228};
225 229
226#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65) 230#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65) || defined(RGB_BACKLIGHT_NK87)
227 231
228// This is a 7-bit address, that gets left-shifted and bit 0 232// This is a 7-bit address, that gets left-shifted and bit 0
229// set to 0 for write, 1 for read (as per I2C protocol) 233// set to 0 for write, 1 for read (as per I2C protocol)
@@ -1020,7 +1024,30 @@ const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = {
1020 //LA62..LB5 1024 //LA62..LB5
1021 {221,255}, {225,255}, {229,255}, {22,255}, {12,255}, {244,255}, {234,255}, {255,255} 1025 {221,255}, {225,255}, {229,255}, {22,255}, {12,255}, {244,255}, {234,255}, {255,255}
1022}; 1026};
1023 1027#elif defined(RGB_BACKLIGHT_NK87)
1028const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
1029 {0,19}, {4,33}, {6,48}, {9,63}, {15,19}, {22,33}, {26,48}, {33,63}, {30,19}, {37,33}, {41,48}, {48,63}, {44,19}, {52,33}, {56,48}, {63,63},
1030 {59,19}, {67,33}, {70,48}, {78,63}, {74,19}, {81,33}, {85,48}, {93,63}, {89,19}, {96,33}, {100,48}, {107,63}, {104,19}, {111,33}, {115,48},
1031 {122,63}, {118,19}, {126,33}, {130,48}, {137,63}, {133,19}, {141,33}, {144,48}, {152,63}, {148,19}, {155,33}, {159,48}, {167,63}, {163,19},
1032 {170,33}, {174,48}, {226,78}, {178,19}, {185,33}, {194,63}, {241,63}, {200,19}, {204,33}, {198,48}, {241,78}, {4,78}, {22,78}, {41,78}, {104,78},
1033 {255,255}, {167,78}, {185,78}, {204,78}, {0,0}, {255,255}, {255,255}, {255,255}, {19,0}, {255,255}, {255,255}, {255,255}, {33,0}, {255,255},
1034 {255,255}, {255,78}, {48,0}, {255,255}, {255,255}, {255,255}, {63,0}, {255,255}, {255,255}, {255,255}, {81,0}, {255,255}, {255,255}, {255,255},
1035 {96,0}, {255,255}, {255,255}, {255,255}, {111,0}, {255,255}, {255,255}, {255,255}, {126,0}, {255,255}, {255,255}, {255,255}, {144,0}, {255,255},
1036 {255,255}, {255,255}, {159,0}, {255,255}, {255,255}, {255,255}, {174,0}, {255,255}, {255,255}, {255,255}, {189,0}, {255,255}, {226,33}, {226,19},
1037 {207,0}, {255,255}, {241,33}, {241,19}, {226,0}, {255,255}, {255,33}, {255,19}, {241,0}, {255,255}, {255,255}, {255,0}
1038};
1039const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = {
1040 {104,255}, {120,242}, {141,246}, {157,255}, {101,255}, {119,208}, {143,210}, {162,255}, {99,251}, {118,180}, {145,183}, {165,248}, {95,230},
1041 {116,153}, {148,158}, {169,232}, {91,212}, {113,126}, {152,133}, {173,218}, {87,195}, {109,100}, {158,111}, {178,207}, {81,182}, {102,75},
1042 {167,92}, {184,200}, {75,172}, {89,55}, {179,79}, {190,196}, {68,167}, {67,45}, {194,75}, {196,197}, {61,166}, {43,52}, {208,82}, {201,201},
1043 {55,170}, {29,70}, {220,97}, {207,210}, {48,179}, {21,93}, {227,116}, {214,255}, {43,191}, {16,119}, {216,234}, {226,255}, {36,216}, {12,153},
1044 {235,155}, {216,255}, {166,255}, {169,255}, {172,255}, {186,255}, {255,255}, {201,255}, {206,255}, {210,255}, {91,255}, {255,255}, {255,255},
1045 {255,255}, {88,255}, {255,255}, {255,255}, {255,255}, {85,255}, {255,255}, {255,255}, {219,255}, {82,255}, {255,255}, {255,255}, {255,255},
1046 {79,255}, {255,255}, {255,255}, {255,255}, {75,255}, {255,255}, {255,255}, {255,255}, {72,255}, {255,255}, {255,255}, {255,255}, {68,255},
1047 {255,255}, {255,255}, {255,255}, {64,255}, {255,255}, {255,255}, {255,255}, {60,255}, {255,255}, {255,255}, {255,255}, {56,255}, {255,255},
1048 {255,255}, {255,255}, {53,255}, {255,255}, {255,255}, {255,255}, {50,255}, {255,255}, {10,194}, {29,251}, {46,255}, {255,255}, {8,222}, {27,255},
1049 {42,255}, {255,255}, {7,249}, {24,255}, {40,255}, {255,255}, {255,255}, {37,255}
1050};
1024#elif defined(RGB_BACKLIGHT_NEBULA12) 1051#elif defined(RGB_BACKLIGHT_NEBULA12)
1025const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { 1052const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
1026 // A1..A16 1053 // A1..A16
@@ -1034,7 +1061,6 @@ const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = {
1034 {255,255}, {255,255}, {255,255}, {255,255}, 1061 {255,255}, {255,255}, {255,255}, {255,255},
1035 {200,196}, {192,192}, {184,196}, {213,74} 1062 {200,196}, {192,192}, {184,196}, {213,74}
1036}; 1063};
1037
1038#elif defined(RGB_BACKLIGHT_NEBULA65) 1064#elif defined(RGB_BACKLIGHT_NEBULA65)
1039const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { 1065const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
1040 // LA1..LA60 1066 // LA1..LA60
@@ -1058,7 +1084,6 @@ const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = {
1058 //LA62..LB5 1084 //LA62..LB5
1059 {207,255}, {213,255}, {218,255}, {35,255}, {21,255}, {19,255}, {224,255}, {32,255} 1085 {207,255}, {213,255}, {218,255}, {35,255}, {21,255}, {19,255}, {224,255}, {32,255}
1060}; 1086};
1061
1062#elif defined(RGB_BACKLIGHT_M6_B) 1087#elif defined(RGB_BACKLIGHT_M6_B)
1063// M6-B is really simple: 1088// M6-B is really simple:
1064// 0 3 5 1089// 0 3 5
@@ -1172,7 +1197,7 @@ void map_led_to_point( uint8_t index, Point *point )
1172 point->x = pgm_read_byte(addr); 1197 point->x = pgm_read_byte(addr);
1173 point->y = pgm_read_byte(addr+1); 1198 point->y = pgm_read_byte(addr+1);
1174 1199
1175#if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) || defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65) || defined(RGB_BACKLIGHT_NEBULA12) 1200#if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) || defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NK87) || defined(RGB_BACKLIGHT_NEBULA65) || defined(RGB_BACKLIGHT_NEBULA12)
1176 return; 1201 return;
1177#endif 1202#endif
1178 1203
@@ -1389,6 +1414,22 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
1389 { 4-1, 255, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 51-1, 52-1, 3+64-1 }, 1414 { 4-1, 255, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 51-1, 52-1, 3+64-1 },
1390 { 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 48-1, 62-1, 63-1, 64-1, 56-1, 4+64-1 } 1415 { 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 48-1, 62-1, 63-1, 64-1, 56-1, 4+64-1 }
1391}; 1416};
1417#elif defined(RGB_BACKLIGHT_NK87)
1418//
1419// LB1, LB5, LB9, LB13, LB17, LB21, LB25, LB29, LB33, LB37, LB41, LB45, LB49, LB53, LB57, LB61, LB64,
1420// LA1, LA5, LA9, LA13, LA17, LA21, LA25, LA29, LA33, LA37, LA41, LA45, LA49, LA53, LB52, LB56, LB60,
1421// LA2, LA6, LA10, LA14, LA18, LA22, LA26, LA30, LA34, LA38, LA42, LA46, LA50, ---, LB51, LB55, LB59,
1422// LA3, LA7, LA11, LA15, LA19, LA23, LA27, LA31, LA35, LA39, LA43, LA47, LA54, LA55, ---, ---, ---,
1423// LA4, ---, LA8, LA12, LA16, LA20, LA24, LA28, LA32, LA36, LA40, LA44, LA51, ---, ---, LA52, ---,
1424// LA57, LA58, LA59, ---, ---, ---, LA60, ---, ---, ---, ---, LA62, LA63, LA64, LA48, LA56, LB12
1425const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
1426 { 1+64-1, 5+64-1, 9+64-1, 13+64-1, 17+64-1, 21+64-1, 25+64-1, 29+64-1, 33+64-1, 37+64-1, 41+64-1, 45+64-1, 49+64-1, 53+64-1, 57+64-1, 61+64-1, 64+64-1 },
1427 { 1-1, 5-1, 9-1, 13-1, 17-1, 21-1, 25-1, 29-1, 33-1, 37-1, 41-1, 45-1, 49-1, 53-1, 52+64-1, 56+64-1, 60+64-1 },
1428 { 2-1, 6-1, 10-1, 14-1, 18-1, 22-1, 26-1, 30-1, 34-1, 38-1, 42-1, 46-1, 50-1, 255, 51+64-1, 55+64-1, 59+64-1 },
1429 { 3-1, 7-1, 11-1, 15-1, 19-1, 23-1, 27-1, 31-1, 35-1, 39-1, 43-1, 47-1, 54-1, 55-1, 255, 255, 255 },
1430 { 4-1, 255, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 51-1, 255, 255, 52-1, 255 },
1431 { 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 255, 255, 62-1, 63-1, 64-1, 48-1, 56-1, 12+64-1 }
1432};
1392#elif defined(RGB_BACKLIGHT_NEBULA12) 1433#elif defined(RGB_BACKLIGHT_NEBULA12)
1393// 1434//
1394// A1, A2, A3, 1435// A1, A2, A3,
@@ -1463,7 +1504,7 @@ void backlight_update_pwm_buffers(void)
1463#elif defined(RGB_BACKLIGHT_HS60) 1504#elif defined(RGB_BACKLIGHT_HS60)
1464 IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 ); 1505 IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 );
1465 IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); 1506 IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 );
1466#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65) 1507#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65) || defined(RGB_BACKLIGHT_NK87)
1467 IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 ); 1508 IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 );
1468 IS31FL3733_update_pwm_buffers( ISSI_ADDR_2, 1 ); 1509 IS31FL3733_update_pwm_buffers( ISSI_ADDR_2, 1 );
1469 IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); 1510 IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 );
@@ -1503,6 +1544,11 @@ void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
1503 IS31FL3218_set_color( index, red, green, blue ); 1544 IS31FL3218_set_color( index, red, green, blue );
1504#elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65) 1545#elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65)
1505 IS31FL3733_set_color( index, red, green, blue ); 1546 IS31FL3733_set_color( index, red, green, blue );
1547#elif defined(RGB_BACKLIGHT_NK87)
1548 // This is done to avoid indicator LEDs being set
1549 if (( index != 63+64-1 ) && ( index != 48+64-1 )) {
1550 IS31FL3733_set_color( index, red, green, blue );
1551 }
1506#elif defined(RGB_BACKLIGHT_DAWN60) 1552#elif defined(RGB_BACKLIGHT_DAWN60)
1507 if( index < DRIVER_LED_TOTAL ) { 1553 if( index < DRIVER_LED_TOTAL ) {
1508 IS31FL3731_set_color( index, red, green, blue ); 1554 IS31FL3731_set_color( index, red, green, blue );
@@ -1526,6 +1572,13 @@ void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue )
1526 for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) { 1572 for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) {
1527 IS31FL3733_set_color(i, red, green, blue); 1573 IS31FL3733_set_color(i, red, green, blue);
1528 } 1574 }
1575#elif defined(RGB_BACKLIGHT_NK87)
1576 // This is done to avoid indicator LEDs being set
1577 for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) {
1578 if (( i != 63+64-1 ) && ( i != 48+64-1 )) {
1579 IS31FL3733_set_color(i, red, green, blue);
1580 }
1581 }
1529#elif defined(RGB_BACKLIGHT_DAWN60) 1582#elif defined(RGB_BACKLIGHT_DAWN60)
1530 IS31FL3731_set_color_all( red, green, blue ); 1583 IS31FL3731_set_color_all( red, green, blue );
1531 for (uint8_t i = 0; i < WS2812_LED_TOTAL; i++) { 1584 for (uint8_t i = 0; i < WS2812_LED_TOTAL; i++) {
@@ -1548,7 +1601,7 @@ void backlight_set_key_hit(uint8_t row, uint8_t column)
1548 g_any_key_hit = 0; 1601 g_any_key_hit = 0;
1549} 1602}
1550 1603
1551#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) 1604#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
1552// This is (F_CPU/1024) / 20 Hz 1605// This is (F_CPU/1024) / 20 Hz
1553// = 15625 Hz / 20 Hz 1606// = 15625 Hz / 20 Hz
1554// = 781 1607// = 781
@@ -1628,7 +1681,7 @@ void backlight_timer_disable(void)
1628{ 1681{
1629 gptStopTimer(&GPTD4); 1682 gptStopTimer(&GPTD4);
1630} 1683}
1631#endif //!defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA12) 1684#endif //!defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
1632 1685
1633void backlight_set_suspend_state(bool state) 1686void backlight_set_suspend_state(bool state)
1634{ 1687{
@@ -1748,6 +1801,15 @@ void backlight_effect_alphas_mods(void)
1748 { 1801 {
1749 is_alpha = ( column < 16 ) && (( g_config.alphas_mods[row-1] & (1<<column) ) == 0); 1802 is_alpha = ( column < 16 ) && (( g_config.alphas_mods[row-1] & (1<<column) ) == 0);
1750 } 1803 }
1804#elif defined(RGB_BACKLIGHT_NK87)
1805 if ( row == 0 )
1806 {
1807 is_alpha = ( ( 0b11100000111100001 & (1<<column) ) == 0);
1808 }
1809 else
1810 {
1811 is_alpha = ( column < 16 ) && (( g_config.alphas_mods[row-1] & (1<<column) ) == 0);
1812 }
1751#else 1813#else
1752 is_alpha = ( g_config.alphas_mods[row] & (1<<column) ) == 0; 1814 is_alpha = ( g_config.alphas_mods[row] & (1<<column) ) == 0;
1753#endif 1815#endif
@@ -1865,7 +1927,7 @@ void backlight_effect_cycle_all(void)
1865 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) 1927 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
1866 { 1928 {
1867 uint16_t offset2 = g_key_hit[i]<<2; 1929 uint16_t offset2 = g_key_hit[i]<<2;
1868#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_DAWN60) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) 1930#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_DAWN60) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
1869 // stabilizer LEDs use spacebar hits 1931 // stabilizer LEDs use spacebar hits
1870 if ( i == 36+6 || i == 54+13 || // LC6, LD13 1932 if ( i == 36+6 || i == 54+13 || // LC6, LD13
1871 ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 1933 ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14
@@ -1890,7 +1952,7 @@ void backlight_effect_cycle_left_right(void)
1890 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) 1952 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
1891 { 1953 {
1892 uint16_t offset2 = g_key_hit[i]<<2; 1954 uint16_t offset2 = g_key_hit[i]<<2;
1893#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_DAWN60) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) 1955#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_DAWN60) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
1894 // stabilizer LEDs use spacebar hits 1956 // stabilizer LEDs use spacebar hits
1895 if ( i == 36+6 || i == 54+13 || // LC6, LD13 1957 if ( i == 36+6 || i == 54+13 || // LC6, LD13
1896 ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 1958 ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14
@@ -1917,7 +1979,7 @@ void backlight_effect_cycle_up_down(void)
1917 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) 1979 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
1918 { 1980 {
1919 uint16_t offset2 = g_key_hit[i]<<2; 1981 uint16_t offset2 = g_key_hit[i]<<2;
1920#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_DAWN60) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) 1982#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_DAWN60) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
1921 // stabilizer LEDs use spacebar hits 1983 // stabilizer LEDs use spacebar hits
1922 if ( i == 36+6 || i == 54+13 || // LC6, LD13 1984 if ( i == 36+6 || i == 54+13 || // LC6, LD13
1923 ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 1985 ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14
@@ -2098,7 +2160,7 @@ void backlight_effect_indicators(void)
2098 } 2160 }
2099} 2161}
2100 2162
2101#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) 2163#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
2102ISR(TIMER3_COMPA_vect) 2164ISR(TIMER3_COMPA_vect)
2103#else //STM32 interrupt 2165#else //STM32 interrupt
2104static void gpt_backlight_timer_task(GPTDriver *gptp) 2166static void gpt_backlight_timer_task(GPTDriver *gptp)
@@ -2595,6 +2657,36 @@ void backlight_init_drivers(void)
2595 // This actually updates the LED drivers 2657 // This actually updates the LED drivers
2596 IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); 2658 IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 );
2597 IS31FL3733_update_led_control_registers( ISSI_ADDR_2, 1 ); 2659 IS31FL3733_update_led_control_registers( ISSI_ADDR_2, 1 );
2660#elif defined(RGB_BACKLIGHT_NK87)
2661 IS31FL3733_init( ISSI_ADDR_1, 0 );
2662 IS31FL3733_init( ISSI_ADDR_2, 0 );
2663
2664 for ( int index = 0; index < DRIVER_LED_TOTAL; index++ )
2665 {
2666 bool enabled = !( ( index == 61-1 ) || //LA61
2667 ( (index >= 2+64-1) && (index <= 4+64-1) ) ||
2668 ( (index >= 6+64-1) && (index <= 8+64-1) ) ||
2669 ( index == 10+64-1 ) || ( index == 11+64-1 ) ||
2670 ( (index >= 14+64-1) && (index <= 16+64-1) ) ||
2671 ( (index >= 18+64-1) && (index <= 20+64-1) ) ||
2672 ( (index >= 22+64-1) && (index <= 24+64-1) ) ||
2673 ( (index >= 26+64-1) && (index <= 28+64-1) ) ||
2674 ( (index >= 30+64-1) && (index <= 32+64-1) ) ||
2675 ( (index >= 34+64-1) && (index <= 36+64-1) ) ||
2676 ( (index >= 38+64-1) && (index <= 40+64-1) ) ||
2677 ( (index >= 42+64-1) && (index <= 44+64-1) ) ||
2678 ( (index >= 46+64-1) && (index <= 48+64-1) ) ||
2679 ( index == 50+64-1 ) ||
2680 ( index == 54+64-1 ) ||
2681 ( index == 58+64-1 ) ||
2682 ( index == 62+64-1 ) );
2683 // This only caches it for later
2684 IS31FL3733_set_led_control_register( index, enabled, enabled, enabled );
2685 }
2686 IS31FL3733_set_led_control_register( 48+64-1, 0, 0, 1 ); //Enable LB48 blue enable for indicators
2687 // This actually updates the LED drivers
2688 IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 );
2689 IS31FL3733_update_led_control_registers( ISSI_ADDR_2, 1 );
2598#elif defined(RGB_BACKLIGHT_NEBULA65) 2690#elif defined(RGB_BACKLIGHT_NEBULA65)
2599 IS31FL3733_init( ISSI_ADDR_1, 0 ); 2691 IS31FL3733_init( ISSI_ADDR_1, 0 );
2600 IS31FL3733_init( ISSI_ADDR_2, 0 ); 2692 IS31FL3733_init( ISSI_ADDR_2, 0 );