diff options
Diffstat (limited to 'keyboards/wilba_tech/wt_rgb_backlight.c')
| -rw-r--r-- | keyboards/wilba_tech/wt_rgb_backlight.c | 231 |
1 files changed, 212 insertions, 19 deletions
diff --git a/keyboards/wilba_tech/wt_rgb_backlight.c b/keyboards/wilba_tech/wt_rgb_backlight.c index 92e14165e..24d9d85ec 100644 --- a/keyboards/wilba_tech/wt_rgb_backlight.c +++ b/keyboards/wilba_tech/wt_rgb_backlight.c | |||
| @@ -18,7 +18,10 @@ | |||
| 18 | defined(RGB_BACKLIGHT_ZEAL65) || \ | 18 | defined(RGB_BACKLIGHT_ZEAL65) || \ |
| 19 | defined(RGB_BACKLIGHT_M60_A) || \ | 19 | defined(RGB_BACKLIGHT_M60_A) || \ |
| 20 | defined(RGB_BACKLIGHT_M6_B) || \ | 20 | defined(RGB_BACKLIGHT_M6_B) || \ |
| 21 | defined(RGB_BACKLIGHT_M10_C) || \ | ||
| 21 | defined(RGB_BACKLIGHT_KOYU) || \ | 22 | defined(RGB_BACKLIGHT_KOYU) || \ |
| 23 | defined(RGB_BACKLIGHT_M65_B) || \ | ||
| 24 | defined(RGB_BACKLIGHT_M65_BX) || \ | ||
| 22 | defined(RGB_BACKLIGHT_HS60) || \ | 25 | defined(RGB_BACKLIGHT_HS60) || \ |
| 23 | defined(RGB_BACKLIGHT_NK65) || \ | 26 | defined(RGB_BACKLIGHT_NK65) || \ |
| 24 | defined(RGB_BACKLIGHT_NEBULA12) || \ | 27 | defined(RGB_BACKLIGHT_NEBULA12) || \ |
| @@ -27,7 +30,8 @@ | |||
| 27 | defined(RGB_BACKLIGHT_DAWN60) || \ | 30 | defined(RGB_BACKLIGHT_DAWN60) || \ |
| 28 | defined(RGB_BACKLIGHT_WT60_B) || \ | 31 | defined(RGB_BACKLIGHT_WT60_B) || \ |
| 29 | defined(RGB_BACKLIGHT_WT60_BX) || \ | 32 | defined(RGB_BACKLIGHT_WT60_BX) || \ |
| 30 | defined(RGB_BACKLIGHT_WT60_C) | 33 | defined(RGB_BACKLIGHT_WT60_C) || \ |
| 34 | defined(RGB_BACKLIGHT_M50_A) | ||
| 31 | #else | 35 | #else |
| 32 | #error wt_rgb_backlight.c compiled without setting configuration symbol | 36 | #error wt_rgb_backlight.c compiled without setting configuration symbol |
| 33 | #endif | 37 | #endif |
| @@ -87,6 +91,8 @@ LED_TYPE g_ws2812_leds[WS2812_LED_TOTAL]; | |||
| 87 | #define BACKLIGHT_LED_COUNT 84 //64 + 20 | 91 | #define BACKLIGHT_LED_COUNT 84 //64 + 20 |
| 88 | #elif defined(RGB_BACKLIGHT_NEBULA12) | 92 | #elif defined(RGB_BACKLIGHT_NEBULA12) |
| 89 | #define BACKLIGHT_LED_COUNT 16 | 93 | #define BACKLIGHT_LED_COUNT 16 |
| 94 | #elif defined(RGB_BACKLIGHT_M10_C) | ||
| 95 | #define BACKLIGHT_LED_COUNT 12 | ||
| 90 | #else | 96 | #else |
| 91 | #define BACKLIGHT_LED_COUNT 72 | 97 | #define BACKLIGHT_LED_COUNT 72 |
| 92 | #endif | 98 | #endif |
| @@ -120,6 +126,8 @@ backlight_config g_config = { | |||
| 120 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 }, | 126 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 }, |
| 121 | #if defined(RGB_BACKLIGHT_M6_B) | 127 | #if defined(RGB_BACKLIGHT_M6_B) |
| 122 | .custom_color = { { 0, 255 }, { 43, 255 }, { 85, 255 }, { 128, 255 }, { 171, 255 }, { 213, 255 } } | 128 | .custom_color = { { 0, 255 }, { 43, 255 }, { 85, 255 }, { 128, 255 }, { 171, 255 }, { 213, 255 } } |
| 129 | #elif defined(RGB_BACKLIGHT_M10_C) | ||
| 130 | .custom_color = { { 0, 255 }, { 43, 255 }, { 85, 255 }, { 128, 255 }, { 171, 255 }, { 213, 255 }, { 0, 255 }, { 43, 255 }, { 85, 255 }, { 128, 255 } } | ||
| 123 | #endif | 131 | #endif |
| 124 | }; | 132 | }; |
| 125 | 133 | ||
| @@ -600,7 +608,29 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | |||
| 600 | {1, C9_15, C8_15, C6_14}, //D15 | 608 | {1, C9_15, C8_15, C6_14}, //D15 |
| 601 | {1, C9_16, C7_15, C6_15} //D16 | 609 | {1, C9_16, C7_15, C6_15} //D16 |
| 602 | }; | 610 | }; |
| 603 | #elif !defined(RGB_BACKLIGHT_M6_B) | 611 | #elif defined(RGB_BACKLIGHT_M6_B) |
| 612 | // Driver has fixed mapping of index to the red, green and blue LEDs | ||
| 613 | #elif defined(RGB_BACKLIGHT_M10_C) | ||
| 614 | // This is a 7-bit address, that gets left-shifted and bit 0 | ||
| 615 | // set to 0 for write, 1 for read (as per I2C protocol) | ||
| 616 | #define ISSI_ADDR_1 0x74 | ||
| 617 | #define ISSI_ADDR_2 | ||
| 618 | |||
| 619 | const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | ||
| 620 | {0, C1_9, C3_10, C4_10}, // LB1 | ||
| 621 | {0, C1_10, C2_10, C4_11}, // LB2 | ||
| 622 | {0, C1_11, C2_11, C3_11}, // LB3 | ||
| 623 | {0, C1_12, C2_12, C3_12}, // LB4 | ||
| 624 | {0, C1_13, C2_13, C3_13}, // LB5 | ||
| 625 | {0, C1_14, C2_14, C3_14}, // LB6 | ||
| 626 | {0, C9_11, C8_11, C7_11}, // LB11 | ||
| 627 | {0, C9_12, C8_12, C7_12}, // LB12 | ||
| 628 | {0, C9_13, C8_13, C7_13}, // LB13 | ||
| 629 | {0, C9_14, C8_14, C7_14}, // LB14 | ||
| 630 | {0, C9_15, C8_15, C6_14}, // LB15 | ||
| 631 | {0, C9_16, C7_15, C6_15} // LB16 | ||
| 632 | }; | ||
| 633 | #else | ||
| 604 | // This is a 7-bit address, that gets left-shifted and bit 0 | 634 | // This is a 7-bit address, that gets left-shifted and bit 0 |
| 605 | // set to 0 for write, 1 for read (as per I2C protocol) | 635 | // set to 0 for write, 1 for read (as per I2C protocol) |
| 606 | #define ISSI_ADDR_1 0x74 | 636 | #define ISSI_ADDR_1 0x74 |
| @@ -689,7 +719,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | |||
| 689 | {1, C9_16, C7_15, C6_15}, // LD16 | 719 | {1, C9_16, C7_15, C6_15}, // LD16 |
| 690 | {1, C8_16, C7_16, C6_16}, // LD17 | 720 | {1, C8_16, C7_16, C6_16}, // LD17 |
| 691 | }; | 721 | }; |
| 692 | #endif // !defined(RGB_BACKLIGHT_M6_B) | 722 | #endif |
| 693 | 723 | ||
| 694 | 724 | ||
| 695 | typedef struct Point { | 725 | typedef struct Point { |
| @@ -759,6 +789,35 @@ const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | |||
| 759 | {0,9}, {0,43}, {0,77}, {0,111}, {0,145}, {0,201}, {224,181}, {230,217}, {235,255}, | 789 | {0,9}, {0,43}, {0,77}, {0,111}, {0,145}, {0,201}, {224,181}, {230,217}, {235,255}, |
| 760 | {189,128}, {200,131}, {210,141}, {218,159}, {255,255}, {207,238}, {211,255}, {218,255}, {255,255} | 790 | {189,128}, {200,131}, {210,141}, {218,159}, {255,255}, {207,238}, {211,255}, {218,255}, {255,255} |
| 761 | }; | 791 | }; |
| 792 | #elif defined(RGB_BACKLIGHT_M65_B) || defined(RGB_BACKLIGHT_M65_BX) | ||
| 793 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | ||
| 794 | // LA0..LA17 | ||
| 795 | {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, | ||
| 796 | {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, | ||
| 797 | // LB0..LB17 | ||
| 798 | {144,0}, {160,0}, {176,0}, {192,0}, {208,0}, {224,0}, {216,0}, {240,0}, {240,16}, | ||
| 799 | {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {240,32}, {240,48}, {240,64}, | ||
| 800 | // LC0..LC17 | ||
| 801 | {112,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {64,60}, {44,60}, {24,64}, | ||
| 802 | {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {255,255}, {10,48}, {4,64}, | ||
| 803 | // LD0..LD17 | ||
| 804 | {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48}, | ||
| 805 | {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {160,60}, {180,64}, {208,64}, {224,64} | ||
| 806 | }; | ||
| 807 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | ||
| 808 | // LA0..LA17 | ||
| 809 | {64,128}, {75,132}, {84,145}, {91,164}, {97,187}, {102,213}, {105,242}, {109,255}, {128,243}, | ||
| 810 | {61,255}, {67,255}, {72,255}, {77,255}, {82,255}, {86,255}, {90,255}, {93,255}, {96,255}, | ||
| 811 | // LB0..LB17 | ||
| 812 | {56,255}, {51,255}, {46,255}, {42,255}, {38,255}, {35,255}, {37,255}, {32,255}, {19,255}, | ||
| 813 | {53,132}, {44,145}, {37,164}, {31,187}, {26,213}, {22,249}, {0,255}, {237,255}, {224,255}, | ||
| 814 | // LC0..LC17 | ||
| 815 | {189,255}, {179,135}, {170,149}, {163,169}, {157,193}, {153,220}, {172,252}, {169,255}, {165,255}, | ||
| 816 | {128,26}, {128,60}, {128,94}, {128,128}, {128,162}, {128,196}, {255,255}, {148,255}, {161,255}, | ||
| 817 | // LD0..LD17 | ||
| 818 | {0,9}, {0,43}, {0,77}, {0,111}, {0,145}, {0,201}, {224,181}, {230,217}, {235,255}, | ||
| 819 | {189,128}, {200,131}, {210,141}, {218,159}, {255,255}, {207,238}, {211,255}, {218,255}, {221,255} | ||
| 820 | }; | ||
| 762 | #elif defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_M60_A) | 821 | #elif defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_M60_A) |
| 763 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | 822 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { |
| 764 | // LA0..LA17 | 823 | // LA0..LA17 |
| @@ -1010,6 +1069,24 @@ const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | |||
| 1010 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | 1069 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { |
| 1011 | {160,255}, {96,255}, {77,255}, {179,255}, {51,255}, {205,255} | 1070 | {160,255}, {96,255}, {77,255}, {179,255}, {51,255}, {205,255} |
| 1012 | }; | 1071 | }; |
| 1072 | #elif defined(RGB_BACKLIGHT_M10_C) | ||
| 1073 | // M10-C is really simple: | ||
| 1074 | // 0 1 2 | ||
| 1075 | // 3 4 5 | ||
| 1076 | // 8 7 6 | ||
| 1077 | // 11 10 9 | ||
| 1078 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | ||
| 1079 | {0,0}, {16,0}, {32,0}, | ||
| 1080 | {0,16}, {16,16}, {32,16}, | ||
| 1081 | {32,32}, {16,32}, {0,32}, | ||
| 1082 | {32,48}, {24,48}, {16,48} | ||
| 1083 | }; | ||
| 1084 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | ||
| 1085 | {160,255}, {192,255}, {224,255}, | ||
| 1086 | {128,255}, {0,0}, {0,255}, | ||
| 1087 | {32,255}, {64,255}, {96,255}, | ||
| 1088 | {45,255}, {54,255}, {64,255} | ||
| 1089 | }; | ||
| 1013 | #elif defined(RGB_BACKLIGHT_DAWN60) | 1090 | #elif defined(RGB_BACKLIGHT_DAWN60) |
| 1014 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | 1091 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { |
| 1015 | // LA1..LA16 | 1092 | // LA1..LA16 |
| @@ -1053,7 +1130,35 @@ const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | |||
| 1053 | //11 - 20 | 1130 | //11 - 20 |
| 1054 | {234,255}, {222,255}, {213,255}, {197,255}, {180,255}, {167,255}, {152,255}, {147,255}, {128,255}, {101,255} | 1131 | {234,255}, {222,255}, {213,255}, {197,255}, {180,255}, {167,255}, {152,255}, {147,255}, {128,255}, {101,255} |
| 1055 | }; | 1132 | }; |
| 1056 | 1133 | #elif defined(RGB_BACKLIGHT_M50_A) | |
| 1134 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | ||
| 1135 | // LA0..LA17 | ||
| 1136 | {255,255}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {255,255}, {255,255}, | ||
| 1137 | {104,0}, {88,0}, {72,0}, {56,0}, {40,0}, {24,0}, {0,0}, {0,16}, {255,255}, | ||
| 1138 | // LB0..LB17 | ||
| 1139 | {255,255}, {120,0}, {136,0}, {152,0}, {168,0}, {184,0}, {200,0}, {255,255}, {255,255}, | ||
| 1140 | {120,16}, {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {255,255}, {255,255}, {255,255}, | ||
| 1141 | // LC0..LC17 | ||
| 1142 | {255,255}, {112,48}, {88,48}, {72,48}, {56,48}, {40,48}, {24,48}, {0,48}, {255,255}, | ||
| 1143 | {104,32}, {88,32}, {72,32}, {56,32}, {40,32}, {24,32}, {0,32}, {255,255}, {255,255}, | ||
| 1144 | // LD0..LD17 | ||
| 1145 | {255,255}, {120,32}, {136,32}, {152,32}, {168,32}, {184,32}, {200,32}, {255,255}, {255,255}, | ||
| 1146 | {255,255}, {136,48}, {152,48}, {168,48}, {184,48}, {200,48}, {255,255}, {255,255}, {255,255} | ||
| 1147 | }; | ||
| 1148 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | ||
| 1149 | // LA0..LA17 | ||
| 1150 | {255,255}, {73,88}, {89,104}, {99,130}, {105,162}, {110,197}, {113,233}, {255,255}, {255,255}, | ||
| 1151 | {67,255}, {73,255}, {79,255}, {84,255}, {89,255}, {93,255}, {98,255}, {116,255}, {255,255}, | ||
| 1152 | // LB0..LB17 | ||
| 1153 | {0,0}, {61,255}, {55,255}, {49,255}, {44,255}, {39,255}, {35,255}, {255,255}, {255,255}, | ||
| 1154 | {55,88}, {39,104}, {29,130}, {23,162}, {18,197}, {15,233}, {255,255}, {255,255}, {255,255}, | ||
| 1155 | // LC0..LC17 | ||
| 1156 | {255,255}, {192,255}, {183,255}, {177,255}, {172,255}, {167,255}, {163,255}, {158,255}, {255,255}, | ||
| 1157 | {183,88}, {167,104}, {157,130}, {151,162}, {146,197}, {143,233}, {140,255}, {255,255}, {255,255}, | ||
| 1158 | // LD0..LD17 | ||
| 1159 | {255,255}, {201,88}, {217,104}, {227,130}, {233,162}, {238,197}, {241,233}, {255,255}, {255,255}, | ||
| 1160 | {255,255}, {201,255}, {207,255}, {212,255}, {217,255}, {221,255}, {255,255}, {255,255}, {255,255} | ||
| 1161 | }; | ||
| 1057 | #endif | 1162 | #endif |
| 1058 | 1163 | ||
| 1059 | // This may seem counter-intuitive, but it's quite flexible. | 1164 | // This may seem counter-intuitive, but it's quite flexible. |
| @@ -1067,7 +1172,7 @@ void map_led_to_point( uint8_t index, Point *point ) | |||
| 1067 | point->x = pgm_read_byte(addr); | 1172 | point->x = pgm_read_byte(addr); |
| 1068 | point->y = pgm_read_byte(addr+1); | 1173 | point->y = pgm_read_byte(addr+1); |
| 1069 | 1174 | ||
| 1070 | #if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA65) || defined(RGB_BACKLIGHT_NEBULA12) | 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) |
| 1071 | return; | 1176 | return; |
| 1072 | #endif | 1177 | #endif |
| 1073 | 1178 | ||
| @@ -1177,6 +1282,22 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||
| 1177 | { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8, 18+15 }, | 1282 | { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8, 18+15 }, |
| 1178 | { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 255, 54+14, 54+15, 54+16, 18+17, 18+16 } | 1283 | { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 255, 54+14, 54+15, 54+16, 18+17, 18+16 } |
| 1179 | }; | 1284 | }; |
| 1285 | #elif defined(RGB_BACKLIGHT_M65_B) || defined(RGB_BACKLIGHT_M65_BX) | ||
| 1286 | // Note: Left spacebar stab is at 4,4 (LC6) | ||
| 1287 | // Right spacebar stab is at 4,10 (D14) | ||
| 1288 | // (B6) | ||
| 1289 | // A17, A16, A15, A14, A13, A12, A11, A10, A9, B0, B1, B2, B3, B4, B7 | ||
| 1290 | // A7, A6, A5, A4, A3, A2, A1, A0, B9, B10, B11, B12, B13, B14, B8 | ||
| 1291 | // A8, C14, C13, C12, C11, C10, C9, D0, D1, D2, D3, D4, D5, B5, B15 | ||
| 1292 | // C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, B16 | ||
| 1293 | // C17, C8, C7, C6, ---, ---, ---, C0, ---, ---, D14, D15, D16, D17, B17 | ||
| 1294 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | ||
| 1295 | { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4, 18+7 }, | ||
| 1296 | { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14, 18+8 }, | ||
| 1297 | { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5, 18+15 }, | ||
| 1298 | { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8, 18+16 }, | ||
| 1299 | { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 255, 54+14, 54+15, 54+16, 54+17, 18+17 } | ||
| 1300 | }; | ||
| 1180 | #elif defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_M60_A) | 1301 | #elif defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_M60_A) |
| 1181 | // Note: Left spacebar stab is at 4,3 (LC6) | 1302 | // Note: Left spacebar stab is at 4,3 (LC6) |
| 1182 | // Right spacebar stab is at 4,9 (LD13) or 4,10 (LD14) | 1303 | // Right spacebar stab is at 4,9 (LD13) or 4,10 (LD14) |
| @@ -1287,6 +1408,15 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||
| 1287 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | 1408 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { |
| 1288 | { 0, 3, 5, 1, 2, 4 } | 1409 | { 0, 3, 5, 1, 2, 4 } |
| 1289 | }; | 1410 | }; |
| 1411 | #elif defined(RGB_BACKLIGHT_M10_C) | ||
| 1412 | // M10-C is really simple: | ||
| 1413 | // 0 1 2 | ||
| 1414 | // 3 4 5 | ||
| 1415 | // 8 7 6 | ||
| 1416 | // 11 10 9 | ||
| 1417 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | ||
| 1418 | { 0, 1, 2, 3, 4, 5, 8, 7, 6, 10 } | ||
| 1419 | }; | ||
| 1290 | #elif defined(RGB_BACKLIGHT_DAWN60) | 1420 | #elif defined(RGB_BACKLIGHT_DAWN60) |
| 1291 | //Dawn60 | 1421 | //Dawn60 |
| 1292 | // A16, A15, A14, A13, A12, A11, A10, A9, B1, B2, B3, B4, B5, B6, | 1422 | // A16, A15, A14, A13, A12, A11, A10, A9, B1, B2, B3, B4, B5, B6, |
| @@ -1300,6 +1430,16 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||
| 1300 | { -1+8 , 31+14, 31+13, 31+12, 31+11, 31+10, 31+9 , 47+1 , 47+2 , 47+3 , 47+4 , 47+5 , 15+8 , 15+7 }, | 1430 | { -1+8 , 31+14, 31+13, 31+12, 31+11, 31+10, 31+9 , 47+1 , 47+2 , 47+3 , 47+4 , 47+5 , 15+8 , 15+7 }, |
| 1301 | { 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}, | 1431 | { 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}, |
| 1302 | { 31+16, 31+8 , 31+7 , 255 , 255 , 31+6 , 255 , 255 , 255 , 47+13, 47+14, 47+15, 47+16, 47+8 } | 1432 | { 31+16, 31+8 , 31+7 , 255 , 255 , 31+6 , 255 , 255 , 255 , 47+13, 47+14, 47+15, 47+16, 47+8 } |
| 1433 | #elif defined(RGB_BACKLIGHT_M50_A) | ||
| 1434 | // LA15, LA14, LA13, LA12, LA11, LA10, LA9, LB1, LB2, LB3, LB4, LB5, LB6 | ||
| 1435 | // LA16, LA6, LA5, LA4, LA3, LA2, LA1, LB9, LB10, LB11, LB12, LB13, LB14 | ||
| 1436 | // LC15, LC14, LC13, LC12, LC11, LC10, LC9, LD1, LD2, LD3, LD4, LD5, LD6 | ||
| 1437 | // LC7, LC6, LC5, LC4, LC3, LC2, LC1, ----, LD10, LD11, LD12, LD13, LD14 | ||
| 1438 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | ||
| 1439 | { 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+1, 18+2, 18+3, 18+4, 18+5, 18+6 }, | ||
| 1440 | { 0+16, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14 }, | ||
| 1441 | { 36+15, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+1, 54+2, 54+3, 54+4, 54+5, 54+6 }, | ||
| 1442 | { 36+7, 36+6, 36+5, 36+4, 36+3, 36+2, 36+1, 255, 54+10, 54+11, 54+12, 54+13, 54+14 }, | ||
| 1303 | }; | 1443 | }; |
| 1304 | #endif | 1444 | #endif |
| 1305 | 1445 | ||
| @@ -1316,6 +1456,9 @@ void backlight_update_pwm_buffers(void) | |||
| 1316 | { | 1456 | { |
| 1317 | #if defined(RGB_BACKLIGHT_M6_B) | 1457 | #if defined(RGB_BACKLIGHT_M6_B) |
| 1318 | IS31FL3218_update_pwm_buffers(); | 1458 | IS31FL3218_update_pwm_buffers(); |
| 1459 | #elif defined(RGB_BACKLIGHT_M10_C) | ||
| 1460 | IS31FL3731_update_pwm_buffers( ISSI_ADDR_1, 0 ); | ||
| 1461 | IS31FL3731_update_led_control_registers( ISSI_ADDR_1, 0 ); | ||
| 1319 | #elif defined(RGB_BACKLIGHT_HS60) | 1462 | #elif defined(RGB_BACKLIGHT_HS60) |
| 1320 | IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 ); | 1463 | IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 ); |
| 1321 | IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); | 1464 | IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); |
| @@ -1856,17 +1999,24 @@ void backlight_effect_cycle_radial2(void) | |||
| 1856 | } | 1999 | } |
| 1857 | } | 2000 | } |
| 1858 | 2001 | ||
| 1859 | #if defined(RGB_BACKLIGHT_M6_B) | 2002 | #if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) |
| 1860 | void backlight_effect_custom_colors(void) | 2003 | void backlight_effect_custom_colors(void) |
| 1861 | { | 2004 | { |
| 1862 | RGB rgb; | 2005 | RGB rgb; |
| 1863 | for ( uint8_t i = 0; i < 6; i++ ) | 2006 | for ( uint8_t i = 0; i < RGB_BACKLIGHT_CUSTOM_COLORS_COUNT; i++ ) |
| 1864 | { | 2007 | { |
| 1865 | HSV hsv = { .h = g_config.custom_color[i].h, .s = g_config.custom_color[i].s, .v = g_config.brightness }; | 2008 | HSV hsv = { .h = g_config.custom_color[i].h, .s = g_config.custom_color[i].s, .v = g_config.brightness }; |
| 1866 | rgb = hsv_to_rgb( hsv ); | 2009 | rgb = hsv_to_rgb( hsv ); |
| 1867 | uint8_t led; | 2010 | uint8_t led; |
| 1868 | map_row_column_to_led( 0, i, &led ); | 2011 | map_row_column_to_led( 0, i, &led ); |
| 1869 | backlight_set_color( led, rgb.r, rgb.g, rgb.b ); | 2012 | backlight_set_color( led, rgb.r, rgb.g, rgb.b ); |
| 2013 | #if defined(RGB_BACKLIGHT_M10_C) | ||
| 2014 | // Set stab LEDs with the same color | ||
| 2015 | if ( led == 10 ) { | ||
| 2016 | backlight_set_color( 9, rgb.r, rgb.g, rgb.b ); | ||
| 2017 | backlight_set_color( 11, rgb.r, rgb.g, rgb.b ); | ||
| 2018 | } | ||
| 2019 | #endif | ||
| 1870 | } | 2020 | } |
| 1871 | } | 2021 | } |
| 1872 | #endif | 2022 | #endif |
| @@ -1887,10 +2037,10 @@ void backlight_effect_indicators_set_colors( uint8_t index, HS color ) | |||
| 1887 | // do the same for the spacebar stabilizers | 2037 | // do the same for the spacebar stabilizers |
| 1888 | if ( index == 36+0 ) // LC0 | 2038 | if ( index == 36+0 ) // LC0 |
| 1889 | { | 2039 | { |
| 1890 | #if defined(RGB_BACKLIGHT_ZEAL65) | 2040 | #if defined(RGB_BACKLIGHT_ZEAL65) |
| 1891 | backlight_set_color( 36+7, rgb.r, rgb.g, rgb.b ); // LC7 | 2041 | backlight_set_color( 36+7, rgb.r, rgb.g, rgb.b ); // LC7 |
| 1892 | backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 | 2042 | backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 |
| 1893 | #elif defined(RGB_BACKLIGHT_KOYU) | 2043 | #elif defined(RGB_BACKLIGHT_KOYU) || defined(RGB_BACKLIGHT_M65_B) || defined(RGB_BACKLIGHT_M65_BX) |
| 1894 | backlight_set_color( 36+6, rgb.r, rgb.g, rgb.b ); // LC6 | 2044 | backlight_set_color( 36+6, rgb.r, rgb.g, rgb.b ); // LC6 |
| 1895 | backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 | 2045 | backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 |
| 1896 | #elif defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_M60_A) | 2046 | #elif defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_M60_A) |
| @@ -2008,7 +2158,7 @@ static void gpt_backlight_timer_task(GPTDriver *gptp) | |||
| 2008 | backlight_effect_solid_color(); | 2158 | backlight_effect_solid_color(); |
| 2009 | break; | 2159 | break; |
| 2010 | case 2: | 2160 | case 2: |
| 2011 | #if defined(RGB_BACKLIGHT_M6_B) | 2161 | #if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) |
| 2012 | backlight_effect_custom_colors(); | 2162 | backlight_effect_custom_colors(); |
| 2013 | #else | 2163 | #else |
| 2014 | backlight_effect_alphas_mods(); | 2164 | backlight_effect_alphas_mods(); |
| @@ -2045,7 +2195,7 @@ static void gpt_backlight_timer_task(GPTDriver *gptp) | |||
| 2045 | 2195 | ||
| 2046 | if ( ! suspend_backlight ) | 2196 | if ( ! suspend_backlight ) |
| 2047 | { | 2197 | { |
| 2048 | #if !defined(RGB_BACKLIGHT_M6_B) | 2198 | #if !defined(RGB_BACKLIGHT_M6_B) && !defined(RGB_BACKLIGHT_M10_C) |
| 2049 | backlight_effect_indicators(); | 2199 | backlight_effect_indicators(); |
| 2050 | #endif | 2200 | #endif |
| 2051 | } | 2201 | } |
| @@ -2231,11 +2381,11 @@ void backlight_config_set_value( uint8_t *data ) | |||
| 2231 | g_config.alphas_mods[i] = ( *(value_data+i*2) << 8 ) | ( *(value_data+i*2+1) ); | 2381 | g_config.alphas_mods[i] = ( *(value_data+i*2) << 8 ) | ( *(value_data+i*2+1) ); |
| 2232 | } | 2382 | } |
| 2233 | } | 2383 | } |
| 2234 | #if defined(RGB_BACKLIGHT_M6_B) | 2384 | #if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) |
| 2235 | case id_custom_color: | 2385 | case id_custom_color: |
| 2236 | { | 2386 | { |
| 2237 | uint8_t index = value_data[0]; | 2387 | uint8_t index = value_data[0]; |
| 2238 | if ( index >= 0 && index <= 6 ) | 2388 | if ( index >= 0 && index < RGB_BACKLIGHT_CUSTOM_COLORS_COUNT ) |
| 2239 | { | 2389 | { |
| 2240 | _set_color( &(g_config.custom_color[index]), &(value_data[1]) ); | 2390 | _set_color( &(g_config.custom_color[index]), &(value_data[1]) ); |
| 2241 | } | 2391 | } |
| @@ -2368,11 +2518,11 @@ void backlight_config_get_value( uint8_t *data ) | |||
| 2368 | *(value_data+i*2+1) = g_config.alphas_mods[i] & 0xFF; | 2518 | *(value_data+i*2+1) = g_config.alphas_mods[i] & 0xFF; |
| 2369 | } | 2519 | } |
| 2370 | } | 2520 | } |
| 2371 | #if defined(RGB_BACKLIGHT_M6_B) | 2521 | #if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) |
| 2372 | case id_custom_color: | 2522 | case id_custom_color: |
| 2373 | { | 2523 | { |
| 2374 | uint8_t index = value_data[0]; | 2524 | uint8_t index = value_data[0]; |
| 2375 | if ( index >= 0 && index <= 6 ) | 2525 | if ( index >= 0 && index < RGB_BACKLIGHT_CUSTOM_COLORS_COUNT ) |
| 2376 | { | 2526 | { |
| 2377 | _get_color( &(g_config.custom_color[index]), &(value_data[1]) ); | 2527 | _get_color( &(g_config.custom_color[index]), &(value_data[1]) ); |
| 2378 | } | 2528 | } |
| @@ -2459,10 +2609,13 @@ void backlight_init_drivers(void) | |||
| 2459 | IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); | 2609 | IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); |
| 2460 | IS31FL3733_update_led_control_registers( ISSI_ADDR_2, 1 ); | 2610 | IS31FL3733_update_led_control_registers( ISSI_ADDR_2, 1 ); |
| 2461 | #else | 2611 | #else |
| 2612 | // Init the #1 driver | ||
| 2462 | IS31FL3731_init( ISSI_ADDR_1 ); | 2613 | IS31FL3731_init( ISSI_ADDR_1 ); |
| 2463 | #if !defined(RGB_BACKLIGHT_NEBULA12) | 2614 | // Init the #2 driver (if used) |
| 2615 | #if !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_M10_C) | ||
| 2464 | IS31FL3731_init( ISSI_ADDR_2 ); | 2616 | IS31FL3731_init( ISSI_ADDR_2 ); |
| 2465 | #endif | 2617 | #endif |
| 2618 | // Init the #3 driver (if used) | ||
| 2466 | #if defined(RGB_BACKLIGHT_U80_A) | 2619 | #if defined(RGB_BACKLIGHT_U80_A) |
| 2467 | IS31FL3731_init( ISSI_ADDR_3 ); | 2620 | IS31FL3731_init( ISSI_ADDR_3 ); |
| 2468 | #endif | 2621 | #endif |
| @@ -2484,6 +2637,15 @@ void backlight_init_drivers(void) | |||
| 2484 | bool enabled = !( ( index == 36+15 ) || // LC15 | 2637 | bool enabled = !( ( index == 36+15 ) || // LC15 |
| 2485 | ( index == 54+13 ) || // LD13 | 2638 | ( index == 54+13 ) || // LD13 |
| 2486 | ( index == 54+17 ) ); // LD17 | 2639 | ( index == 54+17 ) ); // LD17 |
| 2640 | #elif defined(RGB_BACKLIGHT_M65_B) || defined(RGB_BACKLIGHT_M65_BX) | ||
| 2641 | bool enabled = !( | ||
| 2642 | // LB6 not present on M65-B | ||
| 2643 | #if defined(RGB_BACKLIGHT_M65_B) | ||
| 2644 | ( index == 18+6 ) || // LB6 | ||
| 2645 | #endif | ||
| 2646 | // LC15 LD13 not present on M65-B, M65-BX | ||
| 2647 | ( index == 36+15 ) || // LC15 | ||
| 2648 | ( index == 54+13 ) ); // LD13 | ||
| 2487 | #elif defined(RGB_BACKLIGHT_M60_A) | 2649 | #elif defined(RGB_BACKLIGHT_M60_A) |
| 2488 | bool enabled = !( | 2650 | bool enabled = !( |
| 2489 | // LB6 LB7 LB8 LB15 LB16 LB17 not present on M60-A | 2651 | // LB6 LB7 LB8 LB15 LB16 LB17 not present on M60-A |
| @@ -2550,19 +2712,50 @@ void backlight_init_drivers(void) | |||
| 2550 | ( index == 47+15 && g_config.use_7u_spacebar ) ); //LD15 | 2712 | ( index == 47+15 && g_config.use_7u_spacebar ) ); //LD15 |
| 2551 | #elif defined(RGB_BACKLIGHT_NEBULA12) | 2713 | #elif defined(RGB_BACKLIGHT_NEBULA12) |
| 2552 | bool enabled = !( ( index >= 9-1 && index <= 12-1 ) ); // A9-A12 | 2714 | bool enabled = !( ( index >= 9-1 && index <= 12-1 ) ); // A9-A12 |
| 2715 | #elif defined(RGB_BACKLIGHT_M50_A) | ||
| 2716 | bool enabled = !( | ||
| 2717 | // LA0, LA7, LA8, LA17 | ||
| 2718 | ( index == 0+0 ) || | ||
| 2719 | ( index == 0+7 ) || | ||
| 2720 | ( index == 0+8 ) || | ||
| 2721 | ( index == 0+17 ) || | ||
| 2722 | |||
| 2723 | // LB0, LB7, LB8, LB15, LB16, LB17, | ||
| 2724 | ( index == 18+0 ) || | ||
| 2725 | ( index == 18+7 ) || | ||
| 2726 | ( index == 18+8 ) || | ||
| 2727 | ( index == 18+15 ) || | ||
| 2728 | ( index == 18+16 ) || | ||
| 2729 | ( index == 18+17 ) || | ||
| 2730 | // LC0, LC8, LC16, LC17 | ||
| 2731 | ( index == 36+0 ) || | ||
| 2732 | ( index == 36+8 ) || | ||
| 2733 | ( index == 36+16 ) || | ||
| 2734 | ( index == 36+17 ) || | ||
| 2735 | // LD0, LD7, LD8, LD9, LD15, LD16, LD17 | ||
| 2736 | ( index == 54+0 ) || | ||
| 2737 | ( index == 54+7 ) || | ||
| 2738 | ( index == 54+8 ) || | ||
| 2739 | ( index == 54+9 ) || | ||
| 2740 | ( index == 54+15 ) || | ||
| 2741 | ( index == 54+16 ) || | ||
| 2742 | ( index == 54+17 ) ); | ||
| 2743 | #elif defined(RGB_BACKLIGHT_M10_C) | ||
| 2744 | bool enabled = true; | ||
| 2553 | #endif | 2745 | #endif |
| 2554 | // This only caches it for later | 2746 | // This only caches it for later |
| 2555 | IS31FL3731_set_led_control_register( index, enabled, enabled, enabled ); | 2747 | IS31FL3731_set_led_control_register( index, enabled, enabled, enabled ); |
| 2556 | } | 2748 | } |
| 2557 | // This actually updates the LED drivers | 2749 | // This actually updates the LED drivers |
| 2750 | // TODO: refactor this to use DRIVER_COUNT | ||
| 2558 | IS31FL3731_update_led_control_registers( ISSI_ADDR_1, 0 ); | 2751 | IS31FL3731_update_led_control_registers( ISSI_ADDR_1, 0 ); |
| 2559 | #if !defined(RGB_BACKLIGHT_NEBULA12) | 2752 | #if !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_M10_C) |
| 2560 | IS31FL3731_update_led_control_registers( ISSI_ADDR_2, 1 ); | 2753 | IS31FL3731_update_led_control_registers( ISSI_ADDR_2, 1 ); |
| 2561 | #endif | 2754 | #endif |
| 2562 | #if defined(RGB_BACKLIGHT_U80_A) | 2755 | #if defined(RGB_BACKLIGHT_U80_A) |
| 2563 | IS31FL3731_update_led_control_registers( ISSI_ADDR_3, 2 ); | 2756 | IS31FL3731_update_led_control_registers( ISSI_ADDR_3, 2 ); |
| 2564 | #endif | 2757 | #endif |
| 2565 | #endif // !defined(RGB_BACKLIGHT_M6_B) | 2758 | #endif |
| 2566 | 2759 | ||
| 2567 | // TODO: put the 1 second startup delay here? | 2760 | // TODO: put the 1 second startup delay here? |
| 2568 | 2761 | ||
