|
|
@ -26,7 +26,7 @@
|
|
|
|
defined(RGB_BACKLIGHT_NK65) || \
|
|
|
|
defined(RGB_BACKLIGHT_NK65) || \
|
|
|
|
defined(RGB_BACKLIGHT_NK87) || \
|
|
|
|
defined(RGB_BACKLIGHT_NK87) || \
|
|
|
|
defined(RGB_BACKLIGHT_NEBULA12) || \
|
|
|
|
defined(RGB_BACKLIGHT_NEBULA12) || \
|
|
|
|
defined(RGB_BACKLIGHT_NEBULA65) || \
|
|
|
|
defined(RGB_BACKLIGHT_NEBULA68) || \
|
|
|
|
defined(RGB_BACKLIGHT_U80_A) || \
|
|
|
|
defined(RGB_BACKLIGHT_U80_A) || \
|
|
|
|
defined(RGB_BACKLIGHT_DAWN60) || \
|
|
|
|
defined(RGB_BACKLIGHT_DAWN60) || \
|
|
|
|
defined(RGB_BACKLIGHT_WT60_B) || \
|
|
|
|
defined(RGB_BACKLIGHT_WT60_B) || \
|
|
|
@ -50,7 +50,7 @@
|
|
|
|
#include "wt_rgb_backlight_api.h"
|
|
|
|
#include "wt_rgb_backlight_api.h"
|
|
|
|
#include "wt_rgb_backlight_keycodes.h"
|
|
|
|
#include "wt_rgb_backlight_keycodes.h"
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NK87) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12)
|
|
|
|
#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NK87) && !defined(RGB_BACKLIGHT_NEBULA68) && !defined(RGB_BACKLIGHT_NEBULA12)
|
|
|
|
#include <avr/interrupt.h>
|
|
|
|
#include <avr/interrupt.h>
|
|
|
|
#include "drivers/avr/i2c_master.h"
|
|
|
|
#include "drivers/avr/i2c_master.h"
|
|
|
|
#else
|
|
|
|
#else
|
|
|
@ -81,7 +81,7 @@ LED_TYPE g_ws2812_leds[WS2812_LED_TOTAL];
|
|
|
|
#elif defined(RGB_BACKLIGHT_HS60)
|
|
|
|
#elif defined(RGB_BACKLIGHT_HS60)
|
|
|
|
#include "drivers/issi/is31fl3733.h"
|
|
|
|
#include "drivers/issi/is31fl3733.h"
|
|
|
|
#define BACKLIGHT_LED_COUNT 64
|
|
|
|
#define BACKLIGHT_LED_COUNT 64
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65)
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68)
|
|
|
|
#include "drivers/issi/is31fl3733.h"
|
|
|
|
#include "drivers/issi/is31fl3733.h"
|
|
|
|
#define BACKLIGHT_LED_COUNT 69
|
|
|
|
#define BACKLIGHT_LED_COUNT 69
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK87)
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK87)
|
|
|
@ -227,7 +227,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
|
|
|
|
{0, K_16, J_16, L_16}, //LA64
|
|
|
|
{0, K_16, J_16, L_16}, //LA64
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65) || defined(RGB_BACKLIGHT_NK87)
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_NK87)
|
|
|
|
|
|
|
|
|
|
|
|
// This is a 7-bit address, that gets left-shifted and bit 0
|
|
|
|
// This is a 7-bit address, that gets left-shifted and bit 0
|
|
|
|
// set to 0 for write, 1 for read (as per I2C protocol)
|
|
|
|
// set to 0 for write, 1 for read (as per I2C protocol)
|
|
|
@ -1061,7 +1061,7 @@ const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = {
|
|
|
|
{255,255}, {255,255}, {255,255}, {255,255},
|
|
|
|
{255,255}, {255,255}, {255,255}, {255,255},
|
|
|
|
{200,196}, {192,192}, {184,196}, {213,74}
|
|
|
|
{200,196}, {192,192}, {184,196}, {213,74}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
#elif defined(RGB_BACKLIGHT_NEBULA65)
|
|
|
|
#elif defined(RGB_BACKLIGHT_NEBULA68)
|
|
|
|
const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
|
|
|
|
const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
|
|
|
|
// LA1..LA60
|
|
|
|
// LA1..LA60
|
|
|
|
{0,0}, {4,16}, {6,31}, {10,47}, {16,0}, {24,16}, {27,31}, {35,47}, {31,0}, {39,16}, {43,31}, {51,47},
|
|
|
|
{0,0}, {4,16}, {6,31}, {10,47}, {16,0}, {24,16}, {27,31}, {35,47}, {31,0}, {39,16}, {43,31}, {51,47},
|
|
|
@ -1197,7 +1197,7 @@ void map_led_to_point( uint8_t index, Point *point )
|
|
|
|
point->x = pgm_read_byte(addr);
|
|
|
|
point->x = pgm_read_byte(addr);
|
|
|
|
point->y = pgm_read_byte(addr+1);
|
|
|
|
point->y = pgm_read_byte(addr+1);
|
|
|
|
|
|
|
|
|
|
|
|
#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)
|
|
|
|
#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_NEBULA68) || defined(RGB_BACKLIGHT_NEBULA12)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -1400,7 +1400,7 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
|
|
|
{ 4-1, 48-1, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 255, 52-1 },
|
|
|
|
{ 4-1, 48-1, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 255, 52-1 },
|
|
|
|
{ 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 255, 62-1, 63-1, 64-1, 56-1 }
|
|
|
|
{ 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 255, 62-1, 63-1, 64-1, 56-1 }
|
|
|
|
};
|
|
|
|
};
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65)
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68)
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// LA1, LA5, LA9, LA13, LA17, LA21, LA25, LA29, LA33, LA37, LA41, LA45, LA49, LA53, LB1,
|
|
|
|
// LA1, LA5, LA9, LA13, LA17, LA21, LA25, LA29, LA33, LA37, LA41, LA45, LA49, LA53, LB1,
|
|
|
|
// LA2, LA6, LA10, LA14, LA18, LA22, LA26, LA30, LA34, LA38, LA42, LA46, LA50, ---, LB2,
|
|
|
|
// LA2, LA6, LA10, LA14, LA18, LA22, LA26, LA30, LA34, LA38, LA42, LA46, LA50, ---, LB2,
|
|
|
@ -1504,7 +1504,7 @@ void backlight_update_pwm_buffers(void)
|
|
|
|
#elif defined(RGB_BACKLIGHT_HS60)
|
|
|
|
#elif defined(RGB_BACKLIGHT_HS60)
|
|
|
|
IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 );
|
|
|
|
IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 );
|
|
|
|
IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 );
|
|
|
|
IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 );
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65) || defined(RGB_BACKLIGHT_NK87)
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_NK87)
|
|
|
|
IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 );
|
|
|
|
IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 );
|
|
|
|
IS31FL3733_update_pwm_buffers( ISSI_ADDR_2, 1 );
|
|
|
|
IS31FL3733_update_pwm_buffers( ISSI_ADDR_2, 1 );
|
|
|
|
IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 );
|
|
|
|
IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 );
|
|
|
@ -1542,7 +1542,7 @@ void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined(RGB_BACKLIGHT_M6_B)
|
|
|
|
#if defined(RGB_BACKLIGHT_M6_B)
|
|
|
|
IS31FL3218_set_color( index, red, green, blue );
|
|
|
|
IS31FL3218_set_color( index, red, green, blue );
|
|
|
|
#elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65)
|
|
|
|
#elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68)
|
|
|
|
IS31FL3733_set_color( index, red, green, blue );
|
|
|
|
IS31FL3733_set_color( index, red, green, blue );
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK87)
|
|
|
|
#elif defined(RGB_BACKLIGHT_NK87)
|
|
|
|
// This is done to avoid indicator LEDs being set
|
|
|
|
// This is done to avoid indicator LEDs being set
|
|
|
@ -1567,7 +1567,7 @@ void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined(RGB_BACKLIGHT_M6_B)
|
|
|
|
#if defined(RGB_BACKLIGHT_M6_B)
|
|
|
|
IS31FL3218_set_color_all( red, green, blue );
|
|
|
|
IS31FL3218_set_color_all( red, green, blue );
|
|
|
|
#elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65)
|
|
|
|
#elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68)
|
|
|
|
// This is done to avoid indicator LEDs being set
|
|
|
|
// This is done to avoid indicator LEDs being set
|
|
|
|
for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) {
|
|
|
|
for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) {
|
|
|
|
IS31FL3733_set_color(i, red, green, blue);
|
|
|
|
IS31FL3733_set_color(i, red, green, blue);
|
|
|
@ -1601,7 +1601,7 @@ void backlight_set_key_hit(uint8_t row, uint8_t column)
|
|
|
|
g_any_key_hit = 0;
|
|
|
|
g_any_key_hit = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
|
|
|
|
#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA68) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
|
|
|
|
// This is (F_CPU/1024) / 20 Hz
|
|
|
|
// This is (F_CPU/1024) / 20 Hz
|
|
|
|
// = 15625 Hz / 20 Hz
|
|
|
|
// = 15625 Hz / 20 Hz
|
|
|
|
// = 781
|
|
|
|
// = 781
|
|
|
@ -1681,7 +1681,7 @@ void backlight_timer_disable(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gptStopTimer(&GPTD4);
|
|
|
|
gptStopTimer(&GPTD4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif //!defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
|
|
|
|
#endif //!defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA68) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
|
|
|
|
|
|
|
|
|
|
|
|
void backlight_set_suspend_state(bool state)
|
|
|
|
void backlight_set_suspend_state(bool state)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1927,7 +1927,7 @@ void backlight_effect_cycle_all(void)
|
|
|
|
for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
|
|
|
|
for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint16_t offset2 = g_key_hit[i]<<2;
|
|
|
|
uint16_t offset2 = g_key_hit[i]<<2;
|
|
|
|
#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)
|
|
|
|
#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_DAWN60) && !defined(RGB_BACKLIGHT_NEBULA68) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
|
|
|
|
// stabilizer LEDs use spacebar hits
|
|
|
|
// stabilizer LEDs use spacebar hits
|
|
|
|
if ( i == 36+6 || i == 54+13 || // LC6, LD13
|
|
|
|
if ( i == 36+6 || i == 54+13 || // LC6, LD13
|
|
|
|
( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14
|
|
|
|
( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14
|
|
|
@ -1952,7 +1952,7 @@ void backlight_effect_cycle_left_right(void)
|
|
|
|
for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
|
|
|
|
for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint16_t offset2 = g_key_hit[i]<<2;
|
|
|
|
uint16_t offset2 = g_key_hit[i]<<2;
|
|
|
|
#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)
|
|
|
|
#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_DAWN60) && !defined(RGB_BACKLIGHT_NEBULA68) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
|
|
|
|
// stabilizer LEDs use spacebar hits
|
|
|
|
// stabilizer LEDs use spacebar hits
|
|
|
|
if ( i == 36+6 || i == 54+13 || // LC6, LD13
|
|
|
|
if ( i == 36+6 || i == 54+13 || // LC6, LD13
|
|
|
|
( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14
|
|
|
|
( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14
|
|
|
@ -1979,7 +1979,7 @@ void backlight_effect_cycle_up_down(void)
|
|
|
|
for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
|
|
|
|
for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint16_t offset2 = g_key_hit[i]<<2;
|
|
|
|
uint16_t offset2 = g_key_hit[i]<<2;
|
|
|
|
#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)
|
|
|
|
#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_DAWN60) && !defined(RGB_BACKLIGHT_NEBULA68) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
|
|
|
|
// stabilizer LEDs use spacebar hits
|
|
|
|
// stabilizer LEDs use spacebar hits
|
|
|
|
if ( i == 36+6 || i == 54+13 || // LC6, LD13
|
|
|
|
if ( i == 36+6 || i == 54+13 || // LC6, LD13
|
|
|
|
( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14
|
|
|
|
( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14
|
|
|
@ -2160,7 +2160,7 @@ void backlight_effect_indicators(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA65) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
|
|
|
|
#if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NEBULA68) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_NK87)
|
|
|
|
ISR(TIMER3_COMPA_vect)
|
|
|
|
ISR(TIMER3_COMPA_vect)
|
|
|
|
#else //STM32 interrupt
|
|
|
|
#else //STM32 interrupt
|
|
|
|
static void gpt_backlight_timer_task(GPTDriver *gptp)
|
|
|
|
static void gpt_backlight_timer_task(GPTDriver *gptp)
|
|
|
@ -2687,7 +2687,7 @@ void backlight_init_drivers(void)
|
|
|
|
// This actually updates the LED drivers
|
|
|
|
// This actually updates the LED drivers
|
|
|
|
IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 );
|
|
|
|
IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 );
|
|
|
|
IS31FL3733_update_led_control_registers( ISSI_ADDR_2, 1 );
|
|
|
|
IS31FL3733_update_led_control_registers( ISSI_ADDR_2, 1 );
|
|
|
|
#elif defined(RGB_BACKLIGHT_NEBULA65)
|
|
|
|
#elif defined(RGB_BACKLIGHT_NEBULA68)
|
|
|
|
IS31FL3733_init( ISSI_ADDR_1, 0 );
|
|
|
|
IS31FL3733_init( ISSI_ADDR_1, 0 );
|
|
|
|
IS31FL3733_init( ISSI_ADDR_2, 0 );
|
|
|
|
IS31FL3733_init( ISSI_ADDR_2, 0 );
|
|
|
|
|
|
|
|
|
|
|
|