Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 168 additions & 0 deletions keyboards/keychron/q1_pro/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
/* Copyright 2023 @ Keychron (https://www.keychron.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "quantum.h"

// clang-format off
#ifdef RGB_MATRIX_ENABLE
const snled27351_led_t g_snled27351_leds[RGB_MATRIX_LED_COUNT] = {
/* Refer to SNLED27351 manual for these locations
* driver
* | R location
* | | G location
* | | | B location
* | | | | */
{0, CB9_CA1, CB7_CA1, CB8_CA1},
{0, CB9_CA2, CB7_CA2, CB8_CA2},
{0, CB9_CA3, CB7_CA3, CB8_CA3},
{0, CB9_CA4, CB7_CA4, CB8_CA4},
{0, CB9_CA5, CB7_CA5, CB8_CA5},
{0, CB9_CA6, CB7_CA6, CB8_CA6},
{0, CB9_CA7, CB7_CA7, CB8_CA7},
{0, CB9_CA8, CB7_CA8, CB8_CA8},
{0, CB9_CA9, CB7_CA9, CB8_CA9},
{0, CB9_CA10, CB7_CA10, CB8_CA10},
{0, CB9_CA11, CB7_CA11, CB8_CA11},
{0, CB9_CA12, CB7_CA12, CB8_CA12},
{0, CB9_CA13, CB7_CA13, CB8_CA13},
{0, CB9_CA14, CB7_CA14, CB8_CA14},
{0, CB9_CA16, CB7_CA16, CB8_CA16},

{0, CB3_CA1, CB1_CA1, CB2_CA1},
{0, CB3_CA2, CB1_CA2, CB2_CA2},
{0, CB3_CA3, CB1_CA3, CB2_CA3},
{0, CB3_CA4, CB1_CA4, CB2_CA4},
{0, CB3_CA5, CB1_CA5, CB2_CA5},
{0, CB3_CA6, CB1_CA6, CB2_CA6},
{0, CB3_CA7, CB1_CA7, CB2_CA7},
{0, CB3_CA8, CB1_CA8, CB2_CA8},
{0, CB3_CA9, CB1_CA9, CB2_CA9},
{0, CB3_CA10, CB1_CA10, CB2_CA10},
{0, CB3_CA11, CB1_CA11, CB2_CA11},
{0, CB3_CA12, CB1_CA12, CB2_CA12},
{0, CB3_CA13, CB1_CA13, CB2_CA13},
{0, CB3_CA14, CB1_CA14, CB2_CA14},
{0, CB3_CA16, CB1_CA16, CB2_CA16},

{0, CB6_CA1, CB4_CA1, CB5_CA1},
{0, CB6_CA2, CB4_CA2, CB5_CA2},
{0, CB6_CA3, CB4_CA3, CB5_CA3},
{0, CB6_CA4, CB4_CA4, CB5_CA4},
{0, CB6_CA5, CB4_CA5, CB5_CA5},
{0, CB6_CA6, CB4_CA6, CB5_CA6},
{0, CB6_CA7, CB4_CA7, CB5_CA7},
{0, CB6_CA8, CB4_CA8, CB5_CA8},
{0, CB6_CA9, CB4_CA9, CB5_CA9},
{0, CB6_CA10, CB4_CA10, CB5_CA10},
{0, CB6_CA11, CB4_CA11, CB5_CA11},
{0, CB6_CA12, CB4_CA12, CB5_CA12},
{0, CB6_CA13, CB4_CA13, CB5_CA13},
{0, CB6_CA14, CB4_CA14, CB5_CA14},
{0, CB6_CA16, CB4_CA16, CB5_CA16},

{1, CB3_CA16, CB1_CA16, CB2_CA16},
{1, CB3_CA15, CB1_CA15, CB2_CA15},
{1, CB3_CA14, CB1_CA14, CB2_CA14},
{1, CB3_CA13, CB1_CA13, CB2_CA13},
{1, CB3_CA12, CB1_CA12, CB2_CA12},
{1, CB3_CA11, CB1_CA11, CB2_CA11},
{1, CB3_CA10, CB1_CA10, CB2_CA10},
{1, CB3_CA9, CB1_CA9, CB2_CA9},
{1, CB3_CA8, CB1_CA8, CB2_CA8},
{1, CB3_CA7, CB1_CA7, CB2_CA7},
{1, CB3_CA6, CB1_CA6, CB2_CA6},
{1, CB3_CA5, CB1_CA5, CB2_CA5},
{1, CB3_CA3, CB1_CA3, CB2_CA3},
{1, CB3_CA1, CB1_CA1, CB2_CA1},

{1, CB9_CA16, CB7_CA16, CB8_CA16},
{1, CB9_CA14, CB7_CA14, CB8_CA14},
{1, CB9_CA13, CB7_CA13, CB8_CA13},
{1, CB9_CA12, CB7_CA12, CB8_CA12},
{1, CB9_CA11, CB7_CA11, CB8_CA11},
{1, CB9_CA10, CB7_CA10, CB8_CA10},
{1, CB9_CA9, CB7_CA9, CB8_CA9},
{1, CB9_CA8, CB7_CA8, CB8_CA8},
{1, CB9_CA7, CB7_CA7, CB8_CA7},
{1, CB9_CA6, CB7_CA6, CB8_CA6},
{1, CB9_CA5, CB7_CA5, CB8_CA5},
{1, CB9_CA3, CB7_CA3, CB8_CA3},
{1, CB9_CA2, CB7_CA2, CB8_CA2},

{1, CB6_CA16, CB4_CA16, CB5_CA16},
{1, CB6_CA15, CB4_CA15, CB5_CA15},
{1, CB6_CA14, CB4_CA14, CB5_CA14},
{1, CB6_CA10, CB4_CA10, CB5_CA10},
{1, CB6_CA6, CB4_CA6, CB5_CA6},
{1, CB6_CA5, CB4_CA5, CB5_CA5},
{1, CB6_CA4, CB4_CA4, CB5_CA4},
{1, CB6_CA3, CB4_CA3, CB5_CA3},
{1, CB6_CA2, CB4_CA2, CB5_CA2},
{1, CB6_CA1, CB4_CA1, CB5_CA1}
};

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 }
},
{
{0, 0}, {18, 0}, {32, 0}, {47, 0}, {62, 0}, {80, 0}, {95, 0}, {109, 0}, {124, 0}, {142, 0}, {157, 0}, {172, 0}, {186, 0}, {205, 0}, {223, 0},
{0,14}, {14,14}, {29,14}, {43,14}, {58,14}, {73,14}, {87,14}, {102, 14}, {117, 14}, {131, 14}, {146, 14}, {161, 14}, {175, 14}, {197, 14}, {224, 14},
{3,26}, {21,26}, {36,26}, {51,26}, {65,26}, {80,26}, {95,26}, {109, 26}, {124, 26}, {139, 26}, {153, 26}, {168, 26}, {183, 26}, {201, 26}, {224, 26},
{5,37}, {25,37}, {40,37}, {54,37}, {69,37}, {84,37}, {98,37}, {113, 37}, {128, 37}, {142, 37}, {157, 37}, {172, 37}, {195, 37}, {224, 37},
{9,50}, {32,50}, {47,50}, {62,50}, {76,50}, {91,50}, {106, 50}, {120, 50}, {135, 50}, {150, 50}, {164, 50}, {185, 50}, {209, 50},
{1,62}, {20,62}, {38,62}, {93,62}, {146, 62}, {161, 62}, {176, 62}, {194, 62}, {209, 62}, {224, 62}

},
{
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
}
};

// Default Color of Per Key RGB
#define DC_RED {HSV_RED}
#define DC_BLU {HSV_BLUE}
#define DC_YLW {HSV_YELLOW}

HSV default_per_key_led[RGB_MATRIX_LED_COUNT] = {
DC_RED, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW,
DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, DC_YLW,
DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW,
DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_RED, DC_YLW,
DC_YLW, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_BLU, DC_YLW, DC_YLW,
DC_YLW, DC_YLW, DC_YLW, DC_BLU, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW, DC_YLW
};

// Default mixed RGB region
uint8_t default_region[RGB_MATRIX_LED_COUNT] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#endif
40 changes: 40 additions & 0 deletions keyboards/keychron/q1_pro/ansi_encoder/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* Copyright 2023 ~ 2026 @ Keychron (https://www.keychron.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

/* Encoder Configuration */
#ifdef ENCODER_ENABLE
# define ENCODER_DEFAULT_POS 0x3
#endif

#ifdef RGB_MATRIX_ENABLE
/* SNLED27351 Driver Configuration */
# define SNLED27351_I2C_ADDRESS_1 SNLED27351_I2C_ADDRESS_VDDIO
# define SNLED27351_I2C_ADDRESS_2 SNLED27351_I2C_ADDRESS_GND

/* LED Current Configuration */
# define SNLED27351_CURRENT_TUNE \
{ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 }

/* RGB Matrix Configuration */
# define RGB_MATRIX_LED_COUNT 82

/* RGB Matrix key and indicator indices */
# define CAPS_LOCK_INDEX 45
# define LOW_BAT_IND_INDEX \
{ 75 }
#endif
131 changes: 131 additions & 0 deletions keyboards/keychron/q1_pro/ansi_encoder/keyboard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"usb": {
"pid": "0x0610",
"device_version": "1.2.0"
},
"features": {
"encoder": true,
"encoder_map": true,
"rgb_matrix": true
},
"encoder": {
"rotary": [
{"pin_a": "A10", "pin_b": "A0", "resolution": 4}
]
},
"rgb_matrix": {
"driver": "snled27351",
"sleep": true,
"animations": {
"breathing": true,
"band_spiral_val": true,
"cycle_all": true,
"cycle_left_right": true,
"cycle_up_down": true,
"rainbow_moving_chevron": true,
"cycle_out_in": true,
"cycle_out_in_dual": true,
"cycle_pinwheel": true,
"cycle_spiral": true,
"dual_beacon": true,
"rainbow_beacon": true,
"jellybean_raindrops": true,
"pixel_rain": true,
"typing_heatmap": true,
"digital_rain": true,
"solid_reactive_simple": true,
"solid_reactive_multiwide": true,
"solid_reactive_multinexus": true,
"splash": true,
"solid_splash": true
}
},
"layouts": {
"LAYOUT_ansi_82": {
"layout": [
{"matrix":[0, 0], "x":0, "y":0},
{"matrix":[0, 1], "x":1.25, "y":0},
{"matrix":[0, 2], "x":2.25, "y":0},
{"matrix":[0, 3], "x":3.25, "y":0},
{"matrix":[0, 4], "x":4.25, "y":0},
{"matrix":[0, 5], "x":5.5, "y":0},
{"matrix":[0, 6], "x":6.5, "y":0},
{"matrix":[0, 7], "x":7.5, "y":0},
{"matrix":[0, 8], "x":8.5, "y":0},
{"matrix":[0, 9], "x":9.75, "y":0},
{"matrix":[0,10], "x":10.75, "y":0},
{"matrix":[0,11], "x":11.75, "y":0},
{"matrix":[0,12], "x":12.75, "y":0},
{"matrix":[0,13], "x":14, "y":0},
{"matrix":[0,15], "x":15.25, "y":0},
{"matrix":[1, 0], "x":0, "y":1.25},
{"matrix":[1, 1], "x":1, "y":1.25},
{"matrix":[1, 2], "x":2, "y":1.25},
{"matrix":[1, 3], "x":3, "y":1.25},
{"matrix":[1, 4], "x":4, "y":1.25},
{"matrix":[1, 5], "x":5, "y":1.25},
{"matrix":[1, 6], "x":6, "y":1.25},
{"matrix":[1, 7], "x":7, "y":1.25},
{"matrix":[1, 8], "x":8, "y":1.25},
{"matrix":[1, 9], "x":9, "y":1.25},
{"matrix":[1,10], "x":10, "y":1.25},
{"matrix":[1,11], "x":11, "y":1.25},
{"matrix":[1,12], "x":12, "y":1.25},
{"matrix":[1,13], "x":13, "y":1.25, "w":2},
{"matrix":[1,15], "x":15.25, "y":1.25},
{"matrix":[2, 0], "x":0, "y":2.25, "w":1.5},
{"matrix":[2, 1], "x":1.5, "y":2.25},
{"matrix":[2, 2], "x":2.5, "y":2.25},
{"matrix":[2, 3], "x":3.5, "y":2.25},
{"matrix":[2, 4], "x":4.5, "y":2.25},
{"matrix":[2, 5], "x":5.5, "y":2.25},
{"matrix":[2, 6], "x":6.5, "y":2.25},
{"matrix":[2, 7], "x":7.5, "y":2.25},
{"matrix":[2, 8], "x":8.5, "y":2.25},
{"matrix":[2, 9], "x":9.5, "y":2.25},
{"matrix":[2,10], "x":10.5, "y":2.25},
{"matrix":[2,11], "x":11.5, "y":2.25},
{"matrix":[2,12], "x":12.5, "y":2.25},
{"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5},
{"matrix":[2,15], "x":15.25, "y":2.25},
{"matrix":[3, 0], "x":0, "y":3.25, "w":1.75},
{"matrix":[3, 1], "x":1.75, "y":3.25},
{"matrix":[3, 2], "x":2.75, "y":3.25},
{"matrix":[3, 3], "x":3.75, "y":3.25},
{"matrix":[3, 4], "x":4.75, "y":3.25},
{"matrix":[3, 5], "x":5.75, "y":3.25},
{"matrix":[3, 6], "x":6.75, "y":3.25},
{"matrix":[3, 7], "x":7.75, "y":3.25},
{"matrix":[3, 8], "x":8.75, "y":3.25},
{"matrix":[3, 9], "x":9.75, "y":3.25},
{"matrix":[3,10], "x":10.75, "y":3.25},
{"matrix":[3,11], "x":11.75, "y":3.25},
{"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25},
{"matrix":[3,15], "x":15.25, "y":3.25},
{"matrix":[4, 0], "x":0, "y":4.25, "w":2.25},
{"matrix":[4, 2], "x":2.25, "y":4.25},
{"matrix":[4, 3], "x":3.25, "y":4.25},
{"matrix":[4, 4], "x":4.25, "y":4.25},
{"matrix":[4, 5], "x":5.25, "y":4.25},
{"matrix":[4, 6], "x":6.25, "y":4.25},
{"matrix":[4, 7], "x":7.25, "y":4.25},
{"matrix":[4, 8], "x":8.25, "y":4.25},
{"matrix":[4, 9], "x":9.25, "y":4.25},
{"matrix":[4,10], "x":10.25, "y":4.25},
{"matrix":[4,11], "x":11.25, "y":4.25},
{"matrix":[4,13], "x":12.25, "y":4.25, "w":1.75},
{"matrix":[4,14], "x":14.25, "y":4.5},
{"matrix":[5, 0], "x":0, "y":5.25, "w":1.25},
{"matrix":[5, 1], "x":1.25, "y":5.25, "w":1.25},
{"matrix":[5, 2], "x":2.5, "y":5.25, "w":1.25},
{"matrix":[5, 6], "x":3.75, "y":5.25, "w":6.25},
{"matrix":[5,10], "x":10, "y":5.25},
{"matrix":[5,11], "x":11, "y":5.25},
{"matrix":[5,12], "x":12, "y":5.25},
{"matrix":[5,13], "x":13.25, "y":5.5},
{"matrix":[5,14], "x":14.25, "y":5.5},
{"matrix":[5,15], "x":15.25, "y":5.5}
]
}
}
}
Loading
Loading