From 0a69fce67e3d60647f065edc2dd2a121c2891a57 Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Fri, 21 Jan 2022 02:00:08 +1100 Subject: [PATCH] pretty up RGB matrix code on ANSI boards --- .../keychron/q1/q1_ansi_atmega32u4/config.h | 7 ++- .../q1_ansi_atmega32u4/q1_ansi_atmega32u4.c | 58 +++++++++++-------- .../q1/q1_ansi_atmega32u4_ec11/config.h | 7 ++- .../q1_ansi_atmega32u4_ec11.c | 47 +++++++++------ .../keychron/q1/q1_ansi_stm32l432/config.h | 9 ++- .../q1/q1_ansi_stm32l432/q1_ansi_stm32l432.c | 43 ++++++++------ .../q1/q1_ansi_stm32l432_ec11/config.h | 11 +++- .../q1_ansi_stm32l432_ec11.c | 47 +++++++++------ .../keychron/q1/q1_iso_stm32l432/config.h | 4 +- .../q1/q1_iso_stm32l432_ec11/config.h | 4 +- 10 files changed, 145 insertions(+), 92 deletions(-) diff --git a/keyboards/keychron/q1/q1_ansi_atmega32u4/config.h b/keyboards/keychron/q1/q1_ansi_atmega32u4/config.h index 3d70a76a19..a55fb6bed5 100644 --- a/keyboards/keychron/q1/q1_ansi_atmega32u4/config.h +++ b/keyboards/keychron/q1/q1_ansi_atmega32u4/config.h @@ -39,4 +39,9 @@ /* RGB Matrix Configuration */ #define DRIVER_1_LED_TOTAL 59 #define DRIVER_2_LED_TOTAL 23 -#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) \ No newline at end of file +#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) + +/* Sets the default hue and saturation values */ +/* = Royal Blue (#4169E1) */ +#define RGB_MATRIX_STARTUP_HUE 159 +#define RGB_MATRIX_STARTUP_SAT 181 diff --git a/keyboards/keychron/q1/q1_ansi_atmega32u4/q1_ansi_atmega32u4.c b/keyboards/keychron/q1/q1_ansi_atmega32u4/q1_ansi_atmega32u4.c index 6a02a8944d..38921fe6b0 100644 --- a/keyboards/keychron/q1/q1_ansi_atmega32u4/q1_ansi_atmega32u4.c +++ b/keyboards/keychron/q1/q1_ansi_atmega32u4/q1_ansi_atmega32u4.c @@ -25,6 +25,8 @@ const matrix_row_t matrix_mask[] = { 0b0111111111111111, }; +#ifdef RGB_MATRIX_ENABLE + const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver @@ -122,30 +124,36 @@ const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = { }; -led_config_t g_led_config = { - { - { 0, NO_LED, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 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, 43, 44 }, - { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 71, 57, 58 }, - { 59, NO_LED, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 70, 13 }, - { 72, 73, 74, NO_LED, NO_LED, NO_LED, 75, NO_LED, NO_LED, NO_LED, 76, 77, 78, 79, 81 } - }, - { - {0,0}, {30, 0}, {45, 0}, {60, 0}, {75, 0}, {90, 0}, {105, 0}, {120, 0}, {135, 0}, {150, 0}, {165, 0}, {180, 0}, {195, 0}, {210, 0}, {224, 0}, - {0,13}, {15,13}, {30,13}, {45,13}, {60,13}, {75,13}, {90,13}, {105,13}, {120,13}, {135,13}, {150,13}, {165,13}, {180,13}, {195,13}, {224,13}, - {0,26}, {15,26}, {30,26}, {45,26}, {60,26}, {75,26}, {90,26}, {105,26}, {120,26}, {135,26}, {150,26}, {165,26}, {180,26}, {195,26}, {224,26}, - {0,39}, {15,39}, {30,39}, {45,39}, {60,39}, {75,39}, {90,39}, {105,39}, {120,39}, {135,39}, {150,39}, {165,39}, {195,39}, {224,39}, - {0,52}, {30,52}, {45,52}, {60,52}, {75,52}, {90,52}, {105,52}, {120,52}, {135,52}, {150,52}, {165,52}, {195,52}, {210,52}, - {0,64}, {15,64}, {30,64}, {90,64}, {150,64}, {165,64}, {180,64}, {195,64}, {210,64}, {224,64}, - }, - { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 +#define __ NO_LED - } +led_config_t g_led_config = { + { + // Key Matrix to LED Index + { 0, __, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 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, 43, 44 }, + { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 71, 57, 58 }, + { 59, __, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 70, 13 }, + { 72, 73, 74, __, __, __, 75, __, __, __, 76, 77, 78, 79, 81 } + }, + { + // LED Index to Physical Position + {0,0}, {18,0}, {33,0}, {48,0}, {62,0}, {81,0}, {95,0}, {110,0}, {125,0}, {143,0}, {158,0}, {173,0}, {187,0}, {206,0}, {224,0}, + {0,15}, {15,15}, {29,15}, {44,15}, {59,15}, {73,15}, {88,15}, {103,15}, {118,15}, {132,15}, {147,15}, {162,15}, {176,15}, {198,15}, {224,15}, + {4,26}, {22,26}, {37,26}, {51,26}, {66,26}, {81,26}, {95,26}, {110,26}, {125,26}, {140,26}, {154,26}, {169,26}, {184,26}, {202,26}, {224,26}, + {6,38}, {26,38}, {40,38}, {55,38}, {70,38}, {84,38}, {99,38}, {114,38}, {129,38}, {143,38}, {158,38}, {173,38}, {196,38}, {224,38}, + {9,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,49}, + {2,57}, {20,57}, {39,57}, {94,57}, {147,57}, {162,57}, {176,57}, {195,64}, {209,64}, {224,64} + }, + { + // RGB LED Index to Flag + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, + } }; + +#endif diff --git a/keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/config.h b/keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/config.h index 0323b449ba..66e16c7586 100644 --- a/keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/config.h +++ b/keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/config.h @@ -37,7 +37,7 @@ #define DRIVER_ADDR_2 0b1011111 /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 59 +#define DRIVER_1_LED_TOTAL 58 // -1, disable LED under EC11 #define DRIVER_2_LED_TOTAL 23 #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) @@ -47,3 +47,8 @@ /* Specifies the number of pulses the encoder registers between each detent */ #define ENCODER_RESOLUTION 4 + +/* Sets the default hue and saturation values */ +/* = Royal Blue (#4169E1) */ +#define RGB_MATRIX_STARTUP_HUE 159 +#define RGB_MATRIX_STARTUP_SAT 181 diff --git a/keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/q1_ansi_atmega32u4_ec11.c b/keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/q1_ansi_atmega32u4_ec11.c index 0b107536ea..efa7a28c93 100644 --- a/keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/q1_ansi_atmega32u4_ec11.c +++ b/keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/q1_ansi_atmega32u4_ec11.c @@ -26,6 +26,7 @@ const matrix_row_t matrix_mask[] = { }; #ifdef RGB_MATRIX_ENABLE + const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver @@ -47,7 +48,7 @@ const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = { {0, C_13, A_13, B_13}, {0, C_14, A_14, B_14}, {0, C_15, A_15, B_15}, - {0, C_16, A_16, B_16}, + // {0, C_16, A_16, B_16}, {0, F_1, D_1, E_1}, {0, F_2, D_2, E_2}, @@ -122,35 +123,42 @@ const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = { {1, F_16, D_16, E_16} }; +#define __ NO_LED + led_config_t g_led_config = { { - { 0, NO_LED, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 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, 43, 44 }, - { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 71, 57, 58 }, - { 59, NO_LED, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 70, 13 }, - { 72, 73, 74, NO_LED, NO_LED, NO_LED, 75, NO_LED, NO_LED, NO_LED, 76, 77, 78, 79, 81 } + // Key Matrix to LED Index + { 0, __, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, __ }, + { 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, 43, 44 }, + { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 71, 57, 58 }, + { 59, __, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 70, 13 }, + { 72, 73, 74, __, __, __, 75, __, __, __, 76, 77, 78, 79, 81 } }, { - {0, 0}, {30, 0}, {45, 0}, {60, 0}, {75, 0}, {90, 0}, {105, 0}, {120, 0}, {135, 0}, {150, 0}, {165, 0}, {180, 0}, {195, 0}, {210, 0}, {224, 0}, - {0,13}, {15,13}, {30,13}, {45,13}, {60,13}, {75,13}, {90,13}, {105,13}, {120,13}, {135,13}, {150,13}, {165,13}, {180,13}, {195,13}, {224,13}, - {0,26}, {15,26}, {30,26}, {45,26}, {60,26}, {75,26}, {90,26}, {105,26}, {120,26}, {135,26}, {150,26}, {165,26}, {180,26}, {195,26}, {224,26}, - {0,39}, {15,39}, {30,39}, {45,39}, {60,39}, {75,39}, {90,39}, {105,39}, {120,39}, {135,39}, {150,39}, {165,39}, {195,39}, {224,39}, - {0,52}, {30,52}, {45,52}, {60,52}, {75,52}, {90,52}, {105,52}, {120,52}, {135,52}, {150,52}, {165,52}, {195,52}, {210,52}, - {0,64}, {15,64}, {30,64}, {90,64}, {150,64}, {165,64}, {180,64}, {195,64}, {210,64}, {224,64} + // LED Index to Physical Position + {0,0}, {18,0}, {33,0}, {48,0}, {62,0}, {81,0}, {95,0}, {110,0}, {125,0}, {143,0}, {158,0}, {173,0}, {187,0}, {206,0}, + {0,15}, {15,15}, {29,15}, {44,15}, {59,15}, {73,15}, {88,15}, {103,15}, {118,15}, {132,15}, {147,15}, {162,15}, {176,15}, {198,15}, {224,15}, + {4,26}, {22,26}, {37,26}, {51,26}, {66,26}, {81,26}, {95,26}, {110,26}, {125,26}, {140,26}, {154,26}, {169,26}, {184,26}, {202,26}, {224,26}, + {6,38}, {26,38}, {40,38}, {55,38}, {70,38}, {84,38}, {99,38}, {114,38}, {129,38}, {143,38}, {158,38}, {173,38}, {196,38}, {224,38}, + {9,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,49}, + {2,57}, {20,57}, {39,57}, {94,57}, {147,57}, {162,57}, {176,57}, {195,64}, {209,64}, {224,64} }, { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 + // RGB LED Index to Flag + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, } }; + #endif #ifdef ENCODER_ENABLE + bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { return false; } if (index == 0) { @@ -162,4 +170,5 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { } return true; } + #endif diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432/config.h b/keyboards/keychron/q1/q1_ansi_stm32l432/config.h index 832ebc4059..161b940a1e 100644 --- a/keyboards/keychron/q1/q1_ansi_stm32l432/config.h +++ b/keyboards/keychron/q1/q1_ansi_stm32l432/config.h @@ -44,11 +44,16 @@ /* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ #define PHASE_CHANNEL MSKPHASE_9CHANNEL -/* Set the maxium brightness as 190 in order to limit the current to 450mA */ -#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 190 +/* Set the maxium brightness as 192 in order to limit the current to 450mA */ +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS (24 * 8) // 0 = RGB_MATRIX_VAL_STEP /* Set USB polling rate as 1 milliseconds */ #define USB_POLLING_INTERVAL_MS 1 /* We have 2KB EEPROM size on STM32L432 */ #define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047 + +/* Sets the default hue and saturation values */ +/* = Royal Blue (#4169E1) */ +#define RGB_MATRIX_STARTUP_HUE 159 +#define RGB_MATRIX_STARTUP_SAT 181 diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432/q1_ansi_stm32l432.c b/keyboards/keychron/q1/q1_ansi_stm32l432/q1_ansi_stm32l432.c index deac3c95ec..2cf24ba7fa 100644 --- a/keyboards/keychron/q1/q1_ansi_stm32l432/q1_ansi_stm32l432.c +++ b/keyboards/keychron/q1/q1_ansi_stm32l432/q1_ansi_stm32l432.c @@ -26,6 +26,7 @@ const matrix_row_t matrix_mask[] = { }; #ifdef RGB_MATRIX_ENABLE + const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver @@ -122,30 +123,36 @@ const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL] = { {1, C_16, A_16, B_16}, }; +#define __ NO_LED + led_config_t g_led_config = { { - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, NO_LED, 14 }, - { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, NO_LED, 29 }, - { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, NO_LED, 44 }, - { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, NO_LED, 57, NO_LED, 58 }, - { 59, NO_LED, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, NO_LED, 70, 71, NO_LED }, - { 72, 73, 74, NO_LED, NO_LED, NO_LED, 75, NO_LED, NO_LED, NO_LED, 76, 77, 78, 79, 80, 81 }, + // Key Matrix to LED Index + { 0, __, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 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, 43, 44 }, + { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 71, 57, 58 }, + { 59, __, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 70, 13 }, + { 72, 73, 74, __, __, __, 75, __, __, __, 76, 77, 78, 79, 81 } }, { - {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}, {195, 0}, {224, 0}, - {0,13}, {15,13}, {30,13}, {45,13}, {60,13}, {75,13}, {90,13}, {105,13}, {120,13}, {135,13}, {150,13}, {165,13}, {180,13}, {195,13}, {224,13}, - {0,26}, {15,26}, {30,26}, {45,26}, {60,26}, {75,26}, {90,26}, {105,26}, {120,26}, {135,26}, {150,26}, {165,26}, {180,26}, {195,26}, {224,26}, - {0,39}, {15,39}, {30,39}, {45,39}, {60,39}, {75,39}, {90,39}, {105,39}, {120,39}, {135,39}, {150,39}, {165,39}, {195,39}, {224,39}, - {0,52}, {30,52}, {45,52}, {60,52}, {75,52}, {90,52}, {105,52}, {120,52}, {135,52}, {150,52}, {165,52}, {195,52}, {210,52}, - {0,64}, {15,64}, {30,64}, {90,64}, {150,64}, {165,64}, {180,64}, {195,64}, {210,64}, {224,64}, + // LED Index to Physical Position + {0,0}, {18,0}, {33,0}, {48,0}, {62,0}, {81,0}, {95,0}, {110,0}, {125,0}, {143,0}, {158,0}, {173,0}, {187,0}, {206,0}, {224,0}, + {0,15}, {15,15}, {29,15}, {44,15}, {59,15}, {73,15}, {88,15}, {103,15}, {118,15}, {132,15}, {147,15}, {162,15}, {176,15}, {198,15}, {224,15}, + {4,26}, {22,26}, {37,26}, {51,26}, {66,26}, {81,26}, {95,26}, {110,26}, {125,26}, {140,26}, {154,26}, {169,26}, {184,26}, {202,26}, {224,26}, + {6,38}, {26,38}, {40,38}, {55,38}, {70,38}, {84,38}, {99,38}, {114,38}, {129,38}, {143,38}, {158,38}, {173,38}, {196,38}, {224,38}, + {9,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,49}, + {2,57}, {20,57}, {39,57}, {94,57}, {147,57}, {162,57}, {176,57}, {195,64}, {209,64}, {224,64} }, { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + // RGB LED Index to Flag + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, } }; + #endif diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/config.h b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/config.h index 034796c7f9..22f0abe184 100644 --- a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/config.h +++ b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/config.h @@ -37,15 +37,15 @@ #define DRIVER_ADDR_2 0b1110100 /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 45 +#define DRIVER_1_LED_TOTAL 44 // -1, no LED under EC11 #define DRIVER_2_LED_TOTAL 37 #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) /* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ #define PHASE_CHANNEL MSKPHASE_9CHANNEL -/* Set the maxium brightness as 190 in order to limit the current to 450mA */ -#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 190 +/* Set the maxium brightness as 192 in order to limit the current to 450mA */ +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS (24 * 8) // 9 = RGB_MATRIX_VAL_STEP /* Set USB polling rate as 1 milliseconds */ #define USB_POLLING_INTERVAL_MS 1 @@ -59,3 +59,8 @@ /* Specifies the number of pulses the encoder registers between each detent */ #define ENCODER_RESOLUTION 4 + +/* Sets the default hue and saturation values */ +/* = Royal Blue (#4169E1) */ +#define RGB_MATRIX_STARTUP_HUE 159 +#define RGB_MATRIX_STARTUP_SAT 181 diff --git a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/q1_ansi_stm32l432_ec11.c b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/q1_ansi_stm32l432_ec11.c index c8f16309d3..e532a78352 100644 --- a/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/q1_ansi_stm32l432_ec11.c +++ b/keyboards/keychron/q1/q1_ansi_stm32l432_ec11/q1_ansi_stm32l432_ec11.c @@ -26,6 +26,7 @@ const matrix_row_t matrix_mask[] = { }; #ifdef RGB_MATRIX_ENABLE + const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver @@ -47,7 +48,7 @@ const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL] = { {0, C_12, A_12, B_12}, {0, C_13, A_13, B_13}, {0, C_14, A_14, B_14}, - {0, C_16, A_16, B_16}, + // {0, C_16, A_16, B_16}, {0, I_1, G_1, H_1}, {0, I_2, G_2, H_2}, @@ -122,35 +123,42 @@ const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL] = { {1, C_16, A_16, B_16}, }; +#define __ NO_LED + led_config_t g_led_config = { { - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, NO_LED, 14 }, - { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, NO_LED, 29 }, - { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, NO_LED, 44 }, - { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, NO_LED, 57, NO_LED, 58 }, - { 59, NO_LED, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, NO_LED, 70, 71, NO_LED }, - { 72, 73, 74, NO_LED, NO_LED, NO_LED, 75, NO_LED, NO_LED, NO_LED, 76, 77, 78, 79, 80, 81 }, + // Key Matrix to LED Index + { 0, __, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, __ }, + { 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, 43, 44 }, + { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 71, 57, 58 }, + { 59, __, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 70, 13 }, + { 72, 73, 74, __, __, __, 75, __, __, __, 76, 77, 78, 79, 81 } }, { - {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}, {195, 0}, {224, 0}, - {0,13}, {15,13}, {30,13}, {45,13}, {60,13}, {75,13}, {90,13}, {105,13}, {120,13}, {135,13}, {150,13}, {165,13}, {180,13}, {195,13}, {224,13}, - {0,26}, {15,26}, {30,26}, {45,26}, {60,26}, {75,26}, {90,26}, {105,26}, {120,26}, {135,26}, {150,26}, {165,26}, {180,26}, {195,26}, {224,26}, - {0,39}, {15,39}, {30,39}, {45,39}, {60,39}, {75,39}, {90,39}, {105,39}, {120,39}, {135,39}, {150,39}, {165,39}, {195,39}, {224,39}, - {0,52}, {30,52}, {45,52}, {60,52}, {75,52}, {90,52}, {105,52}, {120,52}, {135,52}, {150,52}, {165,52}, {195,52}, {210,52}, - {0,64}, {15,64}, {30,64}, {90,64}, {150,64}, {165,64}, {180,64}, {195,64}, {210,64}, {224,64}, + // LED Index to Physical Position + {0,0}, {18,0}, {33,0}, {48,0}, {62,0}, {81,0}, {95,0}, {110,0}, {125,0}, {143,0}, {158,0}, {173,0}, {187,0}, {206,0}, + {0,15}, {15,15}, {29,15}, {44,15}, {59,15}, {73,15}, {88,15}, {103,15}, {118,15}, {132,15}, {147,15}, {162,15}, {176,15}, {198,15}, {224,15}, + {4,26}, {22,26}, {37,26}, {51,26}, {66,26}, {81,26}, {95,26}, {110,26}, {125,26}, {140,26}, {154,26}, {169,26}, {184,26}, {202,26}, {224,26}, + {6,38}, {26,38}, {40,38}, {55,38}, {70,38}, {84,38}, {99,38}, {114,38}, {129,38}, {143,38}, {158,38}, {173,38}, {196,38}, {224,38}, + {9,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,49}, + {2,57}, {20,57}, {39,57}, {94,57}, {147,57}, {162,57}, {176,57}, {195,64}, {209,64}, {224,64} }, { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + // RGB LED Index to Flag + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, } }; + #endif #ifdef ENCODER_ENABLE + bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { return false; } if (index == 0) { @@ -162,4 +170,5 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { } return true; } + #endif diff --git a/keyboards/keychron/q1/q1_iso_stm32l432/config.h b/keyboards/keychron/q1/q1_iso_stm32l432/config.h index 153186db07..47c42162d9 100644 --- a/keyboards/keychron/q1/q1_iso_stm32l432/config.h +++ b/keyboards/keychron/q1/q1_iso_stm32l432/config.h @@ -44,8 +44,8 @@ /* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ #define PHASE_CHANNEL MSKPHASE_9CHANNEL -/* Set the maxium brightness as 190 in order to limit the current to 450mA */ -#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 190 +/* Set the maxium brightness as 192 in order to limit the current to 450mA */ +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS (24*8) /* Set USB polling rate as 1 milliseconds */ #define USB_POLLING_INTERVAL_MS 1 diff --git a/keyboards/keychron/q1/q1_iso_stm32l432_ec11/config.h b/keyboards/keychron/q1/q1_iso_stm32l432_ec11/config.h index f6a90ed3dd..4c9260b952 100644 --- a/keyboards/keychron/q1/q1_iso_stm32l432_ec11/config.h +++ b/keyboards/keychron/q1/q1_iso_stm32l432_ec11/config.h @@ -44,8 +44,8 @@ /* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ #define PHASE_CHANNEL MSKPHASE_9CHANNEL -/* Set the maxium brightness as 190 in order to limit the current to 450mA */ -#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 188 +/* Set the maxium brightness as 192 in order to limit the current to 450mA */ +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS (24*8) /* Encoder used pins */ #define ENCODERS_PAD_A { A10 }