aboutsummaryrefslogtreecommitdiff
path: root/keyboards/keychron/q1/q1.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/keychron/q1/q1.c')
-rw-r--r--keyboards/keychron/q1/q1.c159
1 files changed, 159 insertions, 0 deletions
diff --git a/keyboards/keychron/q1/q1.c b/keyboards/keychron/q1/q1.c
new file mode 100644
index 000000000..943cf26ce
--- /dev/null
+++ b/keyboards/keychron/q1/q1.c
@@ -0,0 +1,159 @@
1/* Copyright 2021 @ Keychron (https://www.keychron.com)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "q1.h"
18
19const matrix_row_t matrix_mask[] = {
20 0b0111111111111101,
21 0b0111111111111111,
22 0b0111111111111111,
23 0b0111111111111111,
24 0b0111111111111111,
25 0b0111111111111111,
26};
27
28void dip_switch_update_kb(uint8_t index, bool active) {
29 if (index == 0) {
30 default_layer_set(1UL << (active ? 2 : 0));
31 }
32 dip_switch_update_user(index, active);
33}
34
35const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
36/* Refer to IS31 manual for these locations
37 * driver
38 * | R location
39 * | | G location
40 * | | | B location
41 * | | | | */
42
43 {0, A_1, C_1, B_1},
44 {0, A_3, C_3, B_3},
45 {0, A_4, C_4, B_4},
46 {0, A_5, C_5, B_5},
47 {0, A_6, C_6, B_6},
48 {0, A_7, C_7, B_7},
49 {0, A_8, C_8, B_8},
50 {0, A_9, C_9, B_9},
51 {0, A_10, C_10, B_10},
52 {0, A_11, C_11, B_11},
53 {0, A_12, C_12, B_12},
54 {0, A_13, C_13, B_13},
55 {0, A_14, C_14, B_14},
56 {0, A_15, C_15, B_15},
57 {0, A_16, C_16, B_16},
58
59 {0, D_1, F_1, E_1},
60 {0, D_2, F_2, E_2},
61 {0, D_3, F_3, E_3},
62 {0, D_4, F_4, E_4},
63 {0, D_5, F_5, E_5},
64 {0, D_6, F_6, E_6},
65 {0, D_7, F_7, E_7},
66 {0, D_8, F_8, E_8},
67 {0, D_9, F_9, E_9},
68 {0, D_10, F_10, E_10},
69 {0, D_11, F_11, E_11},
70 {0, D_12, F_12, E_12},
71 {0, D_13, F_13, E_13},
72 {0, D_14, F_14, E_14},
73 {0, D_16, F_16, E_16},
74
75 {0, G_1, I_1, H_1},
76 {0, G_2, I_2, H_2},
77 {0, G_3, I_3, H_3},
78 {0, G_4, I_4, H_4},
79 {0, G_5, I_5, H_5},
80 {0, G_6, I_6, H_6},
81 {0, G_7, I_7, H_7},
82 {0, G_8, I_8, H_8},
83 {0, G_9, I_9, H_9},
84 {0, G_10, I_10, H_10},
85 {0, G_11, I_11, H_11},
86 {0, G_12, I_12, H_12},
87 {0, G_13, I_13, H_13},
88 {0, G_14, I_14, H_14},
89 {0, G_16, I_16, H_16},
90
91 {0, J_1, L_1, K_1},
92 {0, J_2, L_2, K_2},
93 {0, J_3, L_3, K_3},
94 {0, J_4, L_4, K_4},
95 {0, J_5, L_5, K_5},
96 {0, J_6, L_6, K_6},
97 {0, J_7, L_7, K_7},
98 {0, J_8, L_8, K_8},
99 {0, J_9, L_9, K_9},
100 {0, J_10, L_10, K_10},
101 {0, J_11, L_11, K_11},
102 {0, J_12, L_12, K_12},
103 {0, J_14, L_14, K_14},
104 {0, J_16, L_16, K_16},
105 {1, A_1, C_1, B_1},
106
107 {1, A_3, C_3, B_3},
108 {1, A_4, C_4, B_4},
109 {1, A_5, C_5, B_5},
110 {1, A_6, C_6, B_6},
111 {1, A_7, C_7, B_7},
112 {1, A_8, C_8, B_8},
113 {1, A_9, C_9, B_9},
114 {1, A_10, C_10, B_10},
115 {1, A_11, C_11, B_11},
116 {1, A_12, C_12, B_12},
117 {1, A_14, C_14, B_14},
118 {1, A_15, C_15, B_15},
119
120 {1, D_1, F_1, E_1},
121 {1, D_2, F_2, E_2},
122 {1, D_3, F_3, E_3},
123 {1, D_7, F_7, E_7},
124 {1, D_11, F_11, E_11},
125 {1, D_12, F_12, E_12},
126 {1, D_13, F_13, E_13},
127 {1, D_14, F_14, E_14},
128 {1, D_15, F_15, E_15},
129 {1, D_16, F_16, E_16}
130
131};
132
133led_config_t g_led_config = {
134 {
135 { 0, NO_LED, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14 },
136 { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 },
137 { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 },
138 { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 71, 57, 58 },
139 { 59, NO_LED, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 70, 13 },
140 { 72, 73, 74, NO_LED, NO_LED, NO_LED,75, NO_LED, NO_LED, NO_LED, 76, 77, 78, 79, 81 }
141 },
142 {
143 {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},
144 {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},
145 {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},
146 {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},
147 {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},
148 {0,64}, {15,64}, {30,64}, {90,64}, {150,64}, {165,64}, {180,64}, {195,64}, {210,64}, {224,64},
149 },
150 {
151 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
152 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
153 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
154 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
155 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
156 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
157
158 }
159};