aboutsummaryrefslogtreecommitdiff
path: root/keyboards/wilba_tech
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/wilba_tech')
-rw-r--r--keyboards/wilba_tech/wt_rgb_backlight.c129
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 306f8186e..e57d061b2 100644
--- a/keyboards/wilba_tech/wt_rgb_backlight.c
+++ b/keyboards/wilba_tech/wt_rgb_backlight.c
@@ -30,6 +30,7 @@
30 defined(RGB_BACKLIGHT_NEBULA68) || \ 30 defined(RGB_BACKLIGHT_NEBULA68) || \
31 defined(RGB_BACKLIGHT_U80_A) || \ 31 defined(RGB_BACKLIGHT_U80_A) || \
32 defined(RGB_BACKLIGHT_DAWN60) || \ 32 defined(RGB_BACKLIGHT_DAWN60) || \
33 defined(RGB_BACKLIGHT_PORTICO) || \
33 defined(RGB_BACKLIGHT_WT60_B) || \ 34 defined(RGB_BACKLIGHT_WT60_B) || \
34 defined(RGB_BACKLIGHT_WT60_BX) || \ 35 defined(RGB_BACKLIGHT_WT60_BX) || \
35 defined(RGB_BACKLIGHT_WT60_C) || \ 36 defined(RGB_BACKLIGHT_WT60_C) || \
@@ -94,6 +95,8 @@ LED_TYPE g_ws2812_leds[WS2812_LED_TOTAL];
94#define BACKLIGHT_LED_COUNT 108 95#define BACKLIGHT_LED_COUNT 108
95#elif defined(RGB_BACKLIGHT_DAWN60) 96#elif defined(RGB_BACKLIGHT_DAWN60)
96#define BACKLIGHT_LED_COUNT 84 //64 + 20 97#define BACKLIGHT_LED_COUNT 84 //64 + 20
98#elif defined(RGB_BACKLIGHT_PORTICO)
99#define BACKLIGHT_LED_COUNT 67 //36 + 31
97#elif defined(RGB_BACKLIGHT_NEBULA12) 100#elif defined(RGB_BACKLIGHT_NEBULA12)
98#define BACKLIGHT_LED_COUNT 16 101#define BACKLIGHT_LED_COUNT 16
99#elif defined(RGB_BACKLIGHT_M10_C) 102#elif defined(RGB_BACKLIGHT_M10_C)
@@ -613,6 +616,91 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
613 {1, C9_15, C8_15, C6_14}, //D15 616 {1, C9_15, C8_15, C6_14}, //D15
614 {1, C9_16, C7_15, C6_15} //D16 617 {1, C9_16, C7_15, C6_15} //D16
615}; 618};
619#elif defined(RGB_BACKLIGHT_PORTICO)
620// This is a 7-bit address, that gets left-shifted and bit 0
621// set to 0 for write, 1 for read (as per I2C protocol)
622#define ISSI_ADDR_1 0x74
623#define ISSI_ADDR_2 0x77
624
625const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
626/* Refer to IS31 manual for these locations
627 * driver
628 * | R location
629 * | | G location
630 * | | | B location
631 * | | | | */
632 { 0, C2_1, C3_1, C4_1 },
633 { 0, C1_1, C3_2, C4_2 },
634 { 0, C1_2, C2_2, C4_3 },
635 { 0, C1_3, C2_3, C3_3 },
636 { 0, C1_4, C2_4, C3_4 },
637 { 0, C1_5, C2_5, C3_5 },
638 { 0, C1_6, C2_6, C3_6 },
639 { 0, C1_7, C2_7, C3_7 },
640 { 0, C1_8, C2_8, C3_8 },
641 { 1, C2_1, C3_1, C4_1 },
642 { 1, C1_1, C3_2, C4_2 },
643 { 1, C1_2, C2_2, C4_3 },
644 { 1, C1_3, C2_3, C3_3 },
645 { 1, C1_4, C2_4, C3_4 },
646 { 1, C1_5, C2_5, C3_5 },
647
648 { 0, C9_1, C8_1, C7_1 },
649 { 0, C9_2, C8_2, C7_2 },
650 { 0, C9_3, C8_3, C7_3 },
651 { 0, C9_4, C8_4, C7_4 },
652 { 0, C9_5, C8_5, C7_5 },
653 { 0, C9_6, C8_6, C7_6 },
654 { 0, C9_7, C8_7, C6_6 },
655 { 0, C9_8, C7_7, C6_7 },
656 { 0, C8_8, C7_8, C6_8 },
657 { 1, C9_1, C8_1, C7_1 },
658 { 1, C9_2, C8_2, C7_2 },
659 { 1, C9_3, C8_3, C7_3 },
660 { 1, C9_4, C8_4, C7_4 },
661 { 1, C9_5, C8_5, C7_5 },
662 { 1, C9_6, C8_6, C7_6 },
663
664 { 0, C1_9, C3_10, C4_10 },
665 { 0, C1_10, C2_10, C4_11 },
666 { 0, C1_11, C2_11, C3_11 },
667 { 0, C1_12, C2_12, C3_12 },
668 { 0, C1_13, C2_13, C3_13 },
669 { 0, C1_14, C2_14, C3_14 },
670 { 0, C1_15, C2_15, C3_15 },
671 { 0, C1_16, C2_16, C3_16 },
672 { 1, C1_10, C2_10, C4_11 },
673 { 1, C1_11, C2_11, C3_11 },
674 { 1, C1_12, C2_12, C3_12 },
675 { 1, C1_13, C2_13, C3_13 },
676 { 1, C1_14, C2_14, C3_14 },
677 { 1, C9_7, C8_7, C6_6 },
678
679 { 0, C2_9, C3_9, C4_9 },
680 { 0, C9_12, C8_12, C7_12 },
681 { 0, C9_13, C8_13, C7_13 },
682 { 0, C9_14, C8_14, C7_14 },
683 { 0, C9_15, C8_15, C6_14 },
684 { 0, C9_16, C7_15, C6_15 },
685 { 1, C2_9, C3_9, C4_9 },
686 { 1, C1_9, C3_10, C4_10 },
687 { 1, C9_9, C8_9, C7_9 },
688 { 1, C9_10, C8_10, C7_10 },
689 { 1, C9_11, C8_11, C7_11 },
690 { 1, C9_14, C8_14, C7_14 },
691 { 1, C1_15, C2_15, C3_15 },
692 { 1, C1_16, C2_16, C3_16 },
693
694 { 0, C9_9, C8_9, C7_9 },
695 { 0, C9_10, C8_10, C7_10 },
696 { 0, C9_11, C8_11, C7_11 },
697 { 0, C8_16, C7_16, C6_16 },
698 { 1, C9_12, C8_12, C7_12 },
699 { 1, C9_13, C8_13, C7_13 },
700 { 1, C9_15, C8_15, C6_14 },
701 { 1, C9_16, C7_15, C6_15 },
702 { 1, C8_16, C7_16, C6_16 }
703};
616#elif defined(RGB_BACKLIGHT_M6_B) 704#elif defined(RGB_BACKLIGHT_M6_B)
617 // Driver has fixed mapping of index to the red, green and blue LEDs 705 // Driver has fixed mapping of index to the red, green and blue LEDs
618#elif defined(RGB_BACKLIGHT_M10_C) 706#elif defined(RGB_BACKLIGHT_M10_C)
@@ -776,7 +864,8 @@ const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
776 // LC0..LC17 864 // LC0..LC17
777 {112,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {64,60}, {44,60}, {24,64}, 865 {112,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {64,60}, {44,60}, {24,64},
778 {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {255,255}, {10,48}, {4,64}, 866 {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {255,255}, {10,48}, {4,64},
779 // LD0..LD17 867 // LD0..LD1762
868
780 {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48}, 869 {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48},
781 {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {160,60}, {180,64}, {208,64}, {255,255} 870 {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {160,60}, {180,64}, {208,64}, {255,255}
782}; 871};
@@ -1156,6 +1245,21 @@ const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = {
1156 //11 - 20 1245 //11 - 20
1157 {234,255}, {222,255}, {213,255}, {197,255}, {180,255}, {167,255}, {152,255}, {147,255}, {128,255}, {101,255} 1246 {234,255}, {222,255}, {213,255}, {197,255}, {180,255}, {167,255}, {152,255}, {147,255}, {128,255}, {101,255}
1158}; 1247};
1248#elif defined(RGB_BACKLIGHT_PORTICO)
1249const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
1250 { 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 },
1251 { 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 },
1252 { 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 },
1253 { 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 },
1254 { 2, 64 }, { 21, 64 }, { 39, 64 }, { 96, 64 }, { 152, 64 }, { 171, 64 }, { 195, 64 }, { 210, 64 }, { 224, 64 },
1255};
1256const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = {
1257 { 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
1258 { 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
1259 { 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 },
1260 { 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 },
1261 { 116, 236 }, { 113, 199 }, { 110, 164 }, { 82, 74 }, { 27, 106 }, { 20, 138 }, { 15, 183 }, { 13, 212 }, { 11, 240 }
1262};
1159#elif defined(RGB_BACKLIGHT_M50_A) 1263#elif defined(RGB_BACKLIGHT_M50_A)
1160const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { 1264const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
1161 // LA0..LA17 1265 // LA0..LA17
@@ -1198,7 +1302,7 @@ void map_led_to_point( uint8_t index, Point *point )
1198 point->x = pgm_read_byte(addr); 1302 point->x = pgm_read_byte(addr);
1199 point->y = pgm_read_byte(addr+1); 1303 point->y = pgm_read_byte(addr+1);
1200 1304
1201#if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) || defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || \ 1305#if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) || defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_PORTICO) || \
1202 defined(RGB_BACKLIGHT_NK87) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_NEBULA12) || defined(RGB_BACKLIGHT_KW_MEGA) 1306 defined(RGB_BACKLIGHT_NK87) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_NEBULA12) || defined(RGB_BACKLIGHT_KW_MEGA)
1203 return; 1307 return;
1204#endif 1308#endif
@@ -1474,6 +1578,14 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
1474 { 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}, 1578 { 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},
1475 { 31+16, 31+8 , 31+7 , 255 , 255 , 31+6 , 255 , 255 , 255 , 47+13, 47+14, 47+15, 47+16, 47+8 } 1579 { 31+16, 31+8 , 31+7 , 255 , 255 , 31+6 , 255 , 255 , 255 , 47+13, 47+14, 47+15, 47+16, 47+8 }
1476}; 1580};
1581#elif defined(RGB_BACKLIGHT_PORTICO)
1582const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
1583 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 },
1584 { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 },
1585 { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 255, 43 },
1586 { 44, 255, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 },
1587 { 58, 59, 60, 255, 255, 255, 61, 255, 255, 255, 62, 63, 64, 65, 66 }
1588};
1477#elif defined(RGB_BACKLIGHT_M50_A) 1589#elif defined(RGB_BACKLIGHT_M50_A)
1478// LA15, LA14, LA13, LA12, LA11, LA10, LA9, LB1, LB2, LB3, LB4, LB5, LB6 1590// LA15, LA14, LA13, LA12, LA11, LA10, LA9, LB1, LB2, LB3, LB4, LB5, LB6
1479// LA16, LA6, LA5, LA4, LA3, LA2, LA1, LB9, LB10, LB11, LB12, LB13, LB14 1591// 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 )
1546 IS31FL3218_set_color( index, red, green, blue ); 1658 IS31FL3218_set_color( index, red, green, blue );
1547#elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_KW_MEGA) 1659#elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_KW_MEGA)
1548 IS31FL3733_set_color( index, red, green, blue ); 1660 IS31FL3733_set_color( index, red, green, blue );
1661#elif defined (RGB_BACKLIGHT_PORTICO)
1662 IS31FL3731_set_color( index, red, green, blue );
1549#elif defined(RGB_BACKLIGHT_NK87) 1663#elif defined(RGB_BACKLIGHT_NK87)
1550 // This is done to avoid indicator LEDs being set 1664 // This is done to avoid indicator LEDs being set
1551 if (( index != 63+64-1 ) && ( index != 48+64-1 )) { 1665 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 )
1574 for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) { 1688 for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) {
1575 IS31FL3733_set_color(i, red, green, blue); 1689 IS31FL3733_set_color(i, red, green, blue);
1576 } 1690 }
1691#elif defined (RGB_BACKLIGHT_PORTICO)
1692 // This is done to avoid indicator LEDs being set
1693 for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) {
1694 IS31FL3731_set_color(i, red, green, blue);
1695 }
1577#elif defined(RGB_BACKLIGHT_NK87) 1696#elif defined(RGB_BACKLIGHT_NK87)
1578 // This is done to avoid indicator LEDs being set 1697 // This is done to avoid indicator LEDs being set
1579 for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) { 1698 for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) {
@@ -1639,6 +1758,7 @@ void backlight_timer_disable(void)
1639{ 1758{
1640 TIMSK3 &= ~_BV(OCIE3A); 1759 TIMSK3 &= ~_BV(OCIE3A);
1641} 1760}
1761
1642#elif defined(RGB_BACKLIGHT_NEBULA12) //STM32, use GPT with TIM3. Enable in halconf.h 1762#elif defined(RGB_BACKLIGHT_NEBULA12) //STM32, use GPT with TIM3. Enable in halconf.h
1643static void gpt_backlight_timer_task(GPTDriver *gptp); 1763static void gpt_backlight_timer_task(GPTDriver *gptp);
1644// Timer setup at 200Khz, callback at 10k ticks = 20Hz 1764// Timer setup at 200Khz, callback at 10k ticks = 20Hz
@@ -1661,6 +1781,7 @@ void backlight_timer_disable(void)
1661{ 1781{
1662 gptStopTimer(&GPTD3); 1782 gptStopTimer(&GPTD3);
1663} 1783}
1784
1664#else //STM32, use GPT with TIM4. Enable in halconf.h 1785#else //STM32, use GPT with TIM4. Enable in halconf.h
1665static void gpt_backlight_timer_task(GPTDriver *gptp); 1786static void gpt_backlight_timer_task(GPTDriver *gptp);
1666// Timer setup at 200Khz, callback at 10k ticks = 20Hz 1787// Timer setup at 200Khz, callback at 10k ticks = 20Hz
@@ -2851,6 +2972,8 @@ void backlight_init_drivers(void)
2851 ( index == 54+17 ) ); 2972 ( index == 54+17 ) );
2852#elif defined(RGB_BACKLIGHT_M10_C) 2973#elif defined(RGB_BACKLIGHT_M10_C)
2853 bool enabled = true; 2974 bool enabled = true;
2975#elif defined(RGB_BACKLIGHT_PORTICO)
2976 bool enabled = true;
2854#endif 2977#endif
2855 // This only caches it for later 2978 // This only caches it for later
2856 IS31FL3731_set_led_control_register( index, enabled, enabled, enabled ); 2979 IS31FL3731_set_led_control_register( index, enabled, enabled, enabled );
@@ -3121,5 +3244,3 @@ void backlight_debug_led( bool state )
3121 } 3244 }
3122} 3245}
3123#endif // defined(RGB_DEBUGGING_ONLY) 3246#endif // defined(RGB_DEBUGGING_ONLY)
3124
3125