diff options
author | TerryMathews <terry@terrymathews.net> | 2021-07-20 00:01:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-19 21:01:36 -0700 |
commit | 9941cf00519349c8487ac18fee92f5114150194a (patch) | |
tree | d6df3cac6ae277f36084736f0a594949690b3b94 /keyboards/wilba_tech | |
parent | 8b0a996d5d4bec0ee5901ee217650d8f432b4f5a (diff) | |
download | qmk_firmware-9941cf00519349c8487ac18fee92f5114150194a.tar.gz qmk_firmware-9941cf00519349c8487ac18fee92f5114150194a.zip |
[Keyboard] PORTICO: add support for wt_rgb (#13241)
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/wilba_tech')
-rw-r--r-- | keyboards/wilba_tech/wt_rgb_backlight.c | 129 |
1 files changed, 125 insertions, 4 deletions
diff --git a/keyboards/wilba_tech/wt_rgb_backlight.c b/keyboards/wilba_tech/wt_rgb_backlight.c index 306f8186e0..e57d061b20 100644 --- a/keyboards/wilba_tech/wt_rgb_backlight.c +++ b/keyboards/wilba_tech/wt_rgb_backlight.c @@ -30,6 +30,7 @@ defined(RGB_BACKLIGHT_NEBULA68) || \ defined(RGB_BACKLIGHT_U80_A) || \ defined(RGB_BACKLIGHT_DAWN60) || \ + defined(RGB_BACKLIGHT_PORTICO) || \ defined(RGB_BACKLIGHT_WT60_B) || \ defined(RGB_BACKLIGHT_WT60_BX) || \ defined(RGB_BACKLIGHT_WT60_C) || \ @@ -94,6 +95,8 @@ LED_TYPE g_ws2812_leds[WS2812_LED_TOTAL]; #define BACKLIGHT_LED_COUNT 108 #elif defined(RGB_BACKLIGHT_DAWN60) #define BACKLIGHT_LED_COUNT 84 //64 + 20 +#elif defined(RGB_BACKLIGHT_PORTICO) +#define BACKLIGHT_LED_COUNT 67 //36 + 31 #elif defined(RGB_BACKLIGHT_NEBULA12) #define BACKLIGHT_LED_COUNT 16 #elif defined(RGB_BACKLIGHT_M10_C) @@ -613,6 +616,91 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {1, C9_15, C8_15, C6_14}, //D15 {1, C9_16, C7_15, C6_15} //D16 }; +#elif defined(RGB_BACKLIGHT_PORTICO) +// 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) +#define ISSI_ADDR_1 0x74 +#define ISSI_ADDR_2 0x77 + +const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +/* Refer to IS31 manual for these locations + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + { 0, C2_1, C3_1, C4_1 }, + { 0, C1_1, C3_2, C4_2 }, + { 0, C1_2, C2_2, C4_3 }, + { 0, C1_3, C2_3, C3_3 }, + { 0, C1_4, C2_4, C3_4 }, + { 0, C1_5, C2_5, C3_5 }, + { 0, C1_6, C2_6, C3_6 }, + { 0, C1_7, C2_7, C3_7 }, + { 0, C1_8, C2_8, C3_8 }, + { 1, C2_1, C3_1, C4_1 }, + { 1, C1_1, C3_2, C4_2 }, + { 1, C1_2, C2_2, C4_3 }, + { 1, C1_3, C2_3, C3_3 }, + { 1, C1_4, C2_4, C3_4 }, + { 1, C1_5, C2_5, C3_5 }, + + { 0, C9_1, C8_1, C7_1 }, + { 0, C9_2, C8_2, C7_2 }, + { 0, C9_3, C8_3, C7_3 }, + { 0, C9_4, C8_4, C7_4 }, + { 0, C9_5, C8_5, C7_5 }, + { 0, C9_6, C8_6, C7_6 }, + { 0, C9_7, C8_7, C6_6 }, + { 0, C9_8, C7_7, C6_7 }, + { 0, C8_8, C7_8, C6_8 }, + { 1, C9_1, C8_1, C7_1 }, + { 1, C9_2, C8_2, C7_2 }, + { 1, C9_3, C8_3, C7_3 }, + { 1, C9_4, C8_4, C7_4 }, + { 1, C9_5, C8_5, C7_5 }, + { 1, C9_6, C8_6, C7_6 }, + + { 0, C1_9, C3_10, C4_10 }, + { 0, C1_10, C2_10, C4_11 }, + { 0, C1_11, C2_11, C3_11 }, + { 0, C1_12, C2_12, C3_12 }, + { 0, C1_13, C2_13, C3_13 }, + { 0, C1_14, C2_14, C3_14 }, + { 0, C1_15, C2_15, C3_15 }, + { 0, C1_16, C2_16, C3_16 }, + { 1, C1_10, C2_10, C4_11 }, + { 1, C1_11, C2_11, C3_11 }, + { 1, C1_12, C2_12, C3_12 }, + { 1, C1_13, C2_13, C3_13 }, + { 1, C1_14, C2_14, C3_14 }, + { 1, C9_7, C8_7, C6_6 }, + + { 0, C2_9, C3_9, C4_9 }, + { 0, C9_12, C8_12, C7_12 }, + { 0, C9_13, C8_13, C7_13 }, + { 0, C9_14, C8_14, C7_14 }, + { 0, C9_15, C8_15, C6_14 }, + { 0, C9_16, C7_15, C6_15 }, + { 1, C2_9, C3_9, C4_9 }, + { 1, C1_9, C3_10, C4_10 }, + { 1, C9_9, C8_9, C7_9 }, + { 1, C9_10, C8_10, C7_10 }, + { 1, C9_11, C8_11, C7_11 }, + { 1, C9_14, C8_14, C7_14 }, + { 1, C1_15, C2_15, C3_15 }, + { 1, C1_16, C2_16, C3_16 }, + + { 0, C9_9, C8_9, C7_9 }, + { 0, C9_10, C8_10, C7_10 }, + { 0, C9_11, C8_11, C7_11 }, + { 0, C8_16, C7_16, C6_16 }, + { 1, C9_12, C8_12, C7_12 }, + { 1, C9_13, C8_13, C7_13 }, + { 1, C9_15, C8_15, C6_14 }, + { 1, C9_16, C7_15, C6_15 }, + { 1, C8_16, C7_16, C6_16 } +}; #elif defined(RGB_BACKLIGHT_M6_B) // Driver has fixed mapping of index to the red, green and blue LEDs #elif defined(RGB_BACKLIGHT_M10_C) @@ -776,7 +864,8 @@ const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { // LC0..LC17 {112,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {64,60}, {44,60}, {24,64}, {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {255,255}, {10,48}, {4,64}, - // LD0..LD17 + // LD0..LD1762 + {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48}, {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {160,60}, {180,64}, {208,64}, {255,255} }; @@ -1156,6 +1245,21 @@ const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { //11 - 20 {234,255}, {222,255}, {213,255}, {197,255}, {180,255}, {167,255}, {152,255}, {147,255}, {128,255}, {101,255} }; +#elif defined(RGB_BACKLIGHT_PORTICO) +const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { + { 0, 0 }, { 15, 0 }, { 30, 0 }, { 45, 0 }, { 60, 0 }, { 75, 0 }, { 90, 0 }, { 105, 0 }, { 120, 0 }, { 135, 0 }, { 150, 0 }, { 165, 0 }, { 180, 0 }, { 203, 0 }, { 224, 0 }, + { 4, 16 }, { 23, 16 }, { 38, 16 }, { 53, 16 }, { 68, 16 }, { 83, 16 }, { 98, 16 }, { 113, 16 }, { 128, 16 }, { 143, 16 }, { 158, 16 }, { 173, 16 }, { 188, 16 }, { 206, 16 }, { 224, 16 }, + { 6, 32 }, { 26, 32 }, { 41, 32 }, { 56, 32 }, { 71, 32 }, { 86, 32 }, { 101, 32 }, { 116, 32 }, { 131, 32 }, { 146, 32 }, { 161, 32 }, { 176, 32 }, { 201, 32 }, { 224, 32 }, + { 9, 48 }, { 34, 48 }, { 49, 48 }, { 64, 48 }, { 79, 48 }, { 94, 48 }, { 109, 48 }, { 124, 48 }, { 139, 48 }, { 154, 48 }, { 169, 48 }, { 189, 48 }, { 210, 48 }, { 224, 48 }, + { 2, 64 }, { 21, 64 }, { 39, 64 }, { 96, 64 }, { 152, 64 }, { 171, 64 }, { 195, 64 }, { 210, 64 }, { 224, 64 }, +}; +const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { + { 138, 240 }, { 140, 210 }, { 142, 181 }, { 145, 153 }, { 149, 126 }, { 156, 101 }, { 166, 80 }, { 182, 67 }, { 200, 68 }, { 216, 81 }, { 226, 102 }, { 232, 128 }, { 236, 155 }, { 240, 199 }, { 243, 240 }, //Done through here TM 052421 143PM + { 133, 225 }, { 134, 186 }, { 136, 156 }, { 138, 126 }, { 141, 96 }, { 147, 68 }, { 161, 44 }, { 193, 33 }, { 222, 47 }, { 235, 72 }, { 240, 100 }, { 244, 130 }, { 246, 160 }, { 247, 196 }, { 248, 233 }, //Done through here TM 052421 235PM + { 127, 218 }, { 127, 177 }, { 127, 146 }, { 127, 115 }, { 127, 84 }, { 127, 54 }, { 127, 23 }, { 0, 8 }, { 0, 39 }, { 0, 70 }, { 0, 101 }, { 0, 132 }, { 0, 183 }, { 0, 231 }, + { 121, 215 }, { 119, 164 }, { 117, 134 }, { 114, 104 }, { 109, 76 }, { 98, 50 }, { 71, 34 }, { 37, 41 }, { 22, 65 }, { 15, 93 }, { 11, 122 }, { 8, 162 }, { 7, 205 }, { 6, 233 }, + { 116, 236 }, { 113, 199 }, { 110, 164 }, { 82, 74 }, { 27, 106 }, { 20, 138 }, { 15, 183 }, { 13, 212 }, { 11, 240 } +}; #elif defined(RGB_BACKLIGHT_M50_A) const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { // LA0..LA17 @@ -1198,7 +1302,7 @@ void map_led_to_point( uint8_t index, Point *point ) point->x = pgm_read_byte(addr); 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) || \ +#if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) || defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_PORTICO) || \ defined(RGB_BACKLIGHT_NK87) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_NEBULA12) || defined(RGB_BACKLIGHT_KW_MEGA) return; #endif @@ -1474,6 +1578,14 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { { 31+15, 31+5 , 31+4 , 31+3 , 31+2 , 31+1 , 47+9 , 47+10, 47+11, 47+12, 255 ,47+6 , 47+7 , 15+16}, { 31+16, 31+8 , 31+7 , 255 , 255 , 31+6 , 255 , 255 , 255 , 47+13, 47+14, 47+15, 47+16, 47+8 } }; +#elif defined(RGB_BACKLIGHT_PORTICO) +const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, + { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, + { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 255, 43 }, + { 44, 255, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 }, + { 58, 59, 60, 255, 255, 255, 61, 255, 255, 255, 62, 63, 64, 65, 66 } +}; #elif defined(RGB_BACKLIGHT_M50_A) // LA15, LA14, LA13, LA12, LA11, LA10, LA9, LB1, LB2, LB3, LB4, LB5, LB6 // LA16, LA6, LA5, LA4, LA3, LA2, LA1, LB9, LB10, LB11, LB12, LB13, LB14 @@ -1546,6 +1658,8 @@ void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) IS31FL3218_set_color( index, red, green, blue ); #elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_KW_MEGA) IS31FL3733_set_color( index, red, green, blue ); +#elif defined (RGB_BACKLIGHT_PORTICO) + IS31FL3731_set_color( index, red, green, blue ); #elif defined(RGB_BACKLIGHT_NK87) // This is done to avoid indicator LEDs being set if (( index != 63+64-1 ) && ( index != 48+64-1 )) { @@ -1574,6 +1688,11 @@ void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) { IS31FL3733_set_color(i, red, green, blue); } +#elif defined (RGB_BACKLIGHT_PORTICO) + // This is done to avoid indicator LEDs being set + for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) { + IS31FL3731_set_color(i, red, green, blue); + } #elif defined(RGB_BACKLIGHT_NK87) // This is done to avoid indicator LEDs being set for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) { @@ -1639,6 +1758,7 @@ void backlight_timer_disable(void) { TIMSK3 &= ~_BV(OCIE3A); } + #elif defined(RGB_BACKLIGHT_NEBULA12) //STM32, use GPT with TIM3. Enable in halconf.h static void gpt_backlight_timer_task(GPTDriver *gptp); // Timer setup at 200Khz, callback at 10k ticks = 20Hz @@ -1661,6 +1781,7 @@ void backlight_timer_disable(void) { gptStopTimer(&GPTD3); } + #else //STM32, use GPT with TIM4. Enable in halconf.h static void gpt_backlight_timer_task(GPTDriver *gptp); // Timer setup at 200Khz, callback at 10k ticks = 20Hz @@ -2851,6 +2972,8 @@ void backlight_init_drivers(void) ( index == 54+17 ) ); #elif defined(RGB_BACKLIGHT_M10_C) bool enabled = true; +#elif defined(RGB_BACKLIGHT_PORTICO) + bool enabled = true; #endif // This only caches it for later IS31FL3731_set_led_control_register( index, enabled, enabled, enabled ); @@ -3121,5 +3244,3 @@ void backlight_debug_led( bool state ) } } #endif // defined(RGB_DEBUGGING_ONLY) - - |