Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new keyboard rev_0106 and rev_0107 for keychron #16369

Closed
wants to merge 176 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
89b22ba
Add new keyboard keychron_q1_rev_0101 for Keychron.
KeychronMacro Nov 2, 2021
5682500
Update keymaps of keychron_q1_rev_0100 and keychron_q1_rev_0102.
KeychronMacro Nov 2, 2021
37d6c51
Update keyboards/keychron/q1/rev_0101/rev_0101.h
KeychronMacro Nov 3, 2021
baea4f9
Update keymap.c
KeychronMacro Nov 3, 2021
0e4857f
Add new info.json.
KeychronMacro Nov 3, 2021
3037883
Update info.json
KeychronMacro Nov 3, 2021
dc45c86
Update keyboards/keychron/q1/rev_0101/keymaps/default/keymap.c
KeychronMacro Nov 4, 2021
0c2ebe4
Update keyboards/keychron/q1/rev_0101/rev_0101.c
KeychronMacro Nov 4, 2021
71564e6
Update keyboards/keychron/q1/rev_0101/keymaps/via/keymap.c
KeychronMacro Nov 4, 2021
c6cf4f1
Update keyboards/keychron/q1/rev_0101/rev_0101.c
KeychronMacro Nov 4, 2021
8c85173
Update keymap.c
KeychronMacro Nov 4, 2021
a34e8f6
Merge branch 'qmk:master' into master
KeychronMacro Nov 5, 2021
05763f9
Merge branch 'qmk:master' into master
KeychronMacro Nov 5, 2021
a7e0863
Update info.json
KeychronMacro Nov 5, 2021
2ee932b
Merge branch 'qmk:master' into master
KeychronMacro Nov 10, 2021
4b738e5
Merge branch 'qmk:master' into master
KeychronMacro Nov 11, 2021
81c61b3
Merge branch 'qmk:master' into master
KeychronMacro Nov 17, 2021
2aa8369
Merge branch 'qmk:master' into master
KeychronMacro Nov 18, 2021
78a5064
Merge branch 'qmk:master' into master
KeychronMacro Nov 23, 2021
ecdb01b
Merge branch 'qmk:master' into master
KeychronMacro Nov 25, 2021
b11ea27
Update all via keymaps keymaps of q1 series. KC_TASK and KC_FLXP are…
KeychronMacro Nov 25, 2021
526ef58
Add keyboards keychron_q2 series.
KeychronMacro Nov 26, 2021
9f36022
Update default keymaps of keychron_q2 series.
KeychronMacro Nov 26, 2021
c69d5e9
Update rules.mk and MCU_LDSCRIPT specified as STM32L432xB.
KeychronMacro Nov 27, 2021
569bde0
Update keyboards/keychron/q1/rev_0101/rev_0101.c
KeychronMacro Nov 30, 2021
9dc4969
Update config.h
KeychronMacro Nov 30, 2021
0876eda
Update config.h
KeychronMacro Nov 30, 2021
03194af
Update config.h
KeychronMacro Nov 30, 2021
8ea9cb8
removed duplicated ifdef
Fieoner Dec 2, 2021
fb3ec91
Merge branch 'qmk:master' into master
lokher Dec 20, 2021
bf5d3b5
Merge pull request #1 from Fieoner/duplicate_line_on_rev_0101
KeychronMacro Dec 20, 2021
07918e0
Merge branch 'qmk:master' into master
lokher Dec 21, 2021
8fd8012
Update keyboards/keychron/q1/rev_0101/rules.mk
KeychronMacro Dec 21, 2021
329963e
Update keyboards/keychron/q2/rev_0110/rules.mk
KeychronMacro Dec 21, 2021
332a2e0
Update keyboards/keychron/q2/rev_0110/rules.mk
KeychronMacro Dec 21, 2021
4383ab0
Update keyboards/keychron/q2/rev_0113/rules.mk
KeychronMacro Dec 21, 2021
036081f
Update keyboards/keychron/q2/rev_0111/rules.mk
KeychronMacro Dec 21, 2021
45ab64f
Update keyboards/keychron/q2/rev_0111/rules.mk
KeychronMacro Dec 21, 2021
4909394
Update keyboards/keychron/q2/rev_0112/rules.mk
KeychronMacro Dec 21, 2021
9ae624d
Update keyboards/keychron/q2/rev_0112/rules.mk
KeychronMacro Dec 21, 2021
40c9bcf
Update keyboards/keychron/q2/rev_0113/rules.mk
KeychronMacro Dec 21, 2021
8f401f4
Merge branch 'qmk:master' into master
KeychronMacro Dec 25, 2021
a8ea9f3
Merge branch 'qmk:master' into master
KeychronMacro Dec 27, 2021
267ec7b
Merge branch 'qmk:master' into master
KeychronMacro Dec 28, 2021
851d8ea
Merge branch 'qmk:master' into master
KeychronMacro Jan 4, 2022
9d5daa3
Update rev_0101.c
KeychronMacro Jan 4, 2022
1d5ebc6
Update rev_0101.
KeychronMacro Jan 5, 2022
72d8ecb
Merge branch 'qmk:master' into master
KeychronMacro Jan 5, 2022
58327d7
Enable support for edit RGB lighting in VIA.
archite Dec 28, 2021
00fcbbb
Merge branch 'qmk:master' into master
KeychronMacro Jan 7, 2022
ee46349
Merge branch 'qmk:master' into master
KeychronMacro Jan 8, 2022
8f7af4b
Merge pull request #2 from archite/master
KeychronMacro Jan 8, 2022
ec06785
Merge branch 'qmk:master' into master
KeychronMacro Jan 12, 2022
0da76d0
Update q1.
KeychronMacro Jan 12, 2022
2ba2791
Merge branch 'master' of https://github.com/Keychron/qmk_firmware
KeychronMacro Jan 12, 2022
b6f08c1
Merge branch 'qmk:master' into master
KeychronMacro Jan 13, 2022
9a9779c
Merge branch 'qmk:master' into master
KeychronMacro Jan 14, 2022
9428120
Merge branch 'qmk:master' into master
KeychronMacro Jan 17, 2022
93fe7a5
Merge branch 'qmk:master' into master
KeychronMacro Jan 18, 2022
87859cc
Merge branch 'qmk:master' into master
KeychronMacro Jan 19, 2022
c47d6b3
Merge branch 'qmk:master' into master
KeychronMacro Jan 20, 2022
4f3811f
Add rgb matrix support for q2 of keychron.
galican Jan 20, 2022
b0c1e83
Update rule.mk.
galican Jan 20, 2022
2eaf1ae
Merge branch 'qmk:master' into master
KeychronMacro Jan 21, 2022
d797b08
Delete comment block which is unwanted.
galican Jan 21, 2022
7f156a1
Merge branch 'qmk:master' into master
KeychronMacro Jan 22, 2022
46b9397
Merge branch 'qmk:master' into master
KeychronMacro Jan 24, 2022
d9bd81b
Merge branch 'qmk:master' into master
KeychronMacro Jan 24, 2022
572e527
Update .gitignore
galican Jan 24, 2022
8ff6614
Merge branch 'qmk:master' into master
KeychronMacro Jan 25, 2022
e097735
Merge branch 'Keychron:master' into master
KeychronMacro Jan 25, 2022
3703fdf
Update .gitignore
galican Jan 25, 2022
bc8923f
Merge branch 'qmk:master' into master
KeychronMacro Jan 26, 2022
a2f7c62
Merge branch 'Keychron:master' into master
KeychronMacro Jan 26, 2022
2481e9d
Merge branch 'qmk:master' into master
KeychronMacro Jan 27, 2022
83889ea
Merge branch 'Keychron:master' into master
KeychronMacro Jan 27, 2022
9d62243
Merge branch 'qmk:master' into master
KeychronMacro Jan 27, 2022
f7b4443
Merge branch 'Keychron:master' into master
KeychronMacro Jan 27, 2022
e4c6282
Merge branch 'qmk:master' into master
KeychronMacro Jan 28, 2022
b9b6d85
Merge branch 'Keychron:master' into master
KeychronMacro Jan 28, 2022
748104d
Merge branch 'qmk:master' into master
KeychronMacro Jan 29, 2022
18c25b8
Merge branch 'Keychron:master' into master
KeychronMacro Jan 29, 2022
4724d2a
Merge branch 'qmk:master' into master
KeychronMacro Feb 7, 2022
0cf7914
Merge branch 'Keychron:master' into master
KeychronMacro Feb 7, 2022
22333fd
Merge branch 'qmk:master' into master
KeychronMacro Feb 8, 2022
d0c2310
Merge branch 'Keychron:master' into master
KeychronMacro Feb 8, 2022
80bfc5b
Merge branch 'qmk:master' into master
KeychronMacro Feb 9, 2022
b676308
Merge branch 'Keychron:master' into master
KeychronMacro Feb 9, 2022
1c8bce9
Merge branch 'qmk:master' into master
KeychronMacro Feb 10, 2022
3e60989
Merge branch 'Keychron:master' into master
KeychronMacro Feb 10, 2022
3a6f863
Merge branch 'qmk:master' into master
KeychronMacro Feb 11, 2022
194ec84
Merge branch 'Keychron:master' into master
KeychronMacro Feb 11, 2022
ba61002
Merge branch 'qmk:master' into master
KeychronMacro Feb 14, 2022
cfc249d
Merge branch 'Keychron:master' into master
KeychronMacro Feb 14, 2022
773f93b
Merge branch 'qmk:master' into master
KeychronMacro Feb 15, 2022
9b1a6ac
Merge branch 'Keychron:master' into master
KeychronMacro Feb 15, 2022
4f12e64
Merge branch 'qmk:master' into master
KeychronMacro Feb 16, 2022
9b71cc4
Merge branch 'Keychron:master' into master
KeychronMacro Feb 16, 2022
efd1780
Add keyboard rev_0106 and rev_0107 for keychron q1
KeychronMacro Feb 16, 2022
df9bb4e
Merge pull request #19 from lalalademaxiya1/master
KeychronMacro Feb 16, 2022
6b2aa9f
Merge branch 'qmk:master' into master
KeychronMacro Feb 18, 2022
dce8c98
Merge branch 'qmk:master' into master
KeychronMacro Feb 21, 2022
7e8499f
Update keyboards/keychron/q1/rev_0107/config.h
KeychronMacro Feb 21, 2022
4f22b9e
Slight modification
KeychronMacro Feb 21, 2022
ad3e1e6
Merge pull request #20 from lalalademaxiya1/master
KeychronMacro Feb 21, 2022
894adbd
Merge branch 'qmk:master' into master
KeychronMacro Feb 22, 2022
989cec6
Update keyboards/keychron/q1/rev_0107/rules.mk
KeychronMacro Feb 22, 2022
c6d51d5
Update keyboards/keychron/q1/rev_0107/rules.mk
KeychronMacro Feb 22, 2022
3391861
Update keyboards/keychron/q1/rev_0106/rules.mk
KeychronMacro Feb 22, 2022
f9c5669
Update keyboards/keychron/q1/rev_0106/rules.mk
KeychronMacro Feb 22, 2022
3543296
Merge branch 'qmk:master' into master
KeychronMacro Feb 23, 2022
2df5098
Merge branch 'qmk:master' into master
KeychronMacro Feb 26, 2022
6a0eb19
Merge branch 'qmk:master' into master
KeychronMacro Feb 28, 2022
0186837
Create matrix.c
KeychronMacro Feb 28, 2022
72fec4d
Merge pull request #21 from lalalademaxiya1/master
KeychronMacro Feb 28, 2022
85b2728
Merge branch 'qmk:master' into master
KeychronMacro Mar 1, 2022
5c37668
Merge branch 'qmk:master' into master
KeychronMacro Mar 3, 2022
fa59b0f
Merge branch 'qmk:master' into master
KeychronMacro Mar 4, 2022
c8428b7
Merge branch 'qmk:master' into master
KeychronMacro Mar 7, 2022
c9f7c3f
Merge branch 'qmk:master' into master
KeychronMacro Mar 8, 2022
1b88bf4
Merge branch 'qmk:master' into master
KeychronMacro Mar 9, 2022
5407dbc
Merge branch 'qmk:master' into master
KeychronMacro Mar 10, 2022
1ca6e82
Merge branch 'qmk:master' into master
KeychronMacro Mar 11, 2022
4fdf0d6
Merge branch 'qmk:master' into master
KeychronMacro Mar 14, 2022
fe28af2
Merge branch 'qmk:master' into master
KeychronMacro Mar 16, 2022
cde4ad1
Merge branch 'qmk:master' into master
KeychronMacro Mar 17, 2022
797884c
Merge branch 'qmk:master' into master
KeychronMacro Mar 21, 2022
a9356ed
Merge branch 'qmk:master' into master
KeychronMacro Mar 22, 2022
712830d
Merge branch 'qmk:master' into master
KeychronMacro Mar 23, 2022
fafab6a
Merge branch 'qmk:master' into master
KeychronMacro Mar 24, 2022
f286851
Merge branch 'qmk:master' into master
KeychronMacro Mar 26, 2022
02b1ca0
Merge branch 'qmk:master' into master
KeychronMacro Mar 28, 2022
a70a775
Merge branch 'qmk:master' into master
KeychronMacro Mar 30, 2022
98356a4
Merge branch 'qmk:master' into master
KeychronMacro Mar 31, 2022
fc4142a
Merge branch 'qmk:master' into master
KeychronMacro Apr 6, 2022
9480aa8
Add q3
KeychronMacro Apr 6, 2022
a63caee
Update q3
KeychronMacro Apr 6, 2022
d7237cd
Update q3
KeychronMacro Apr 6, 2022
300a99d
Merge pull request #22 from lalalademaxiya1/master
KeychronMacro Apr 6, 2022
db2c836
Merge branch 'qmk:master' into master
KeychronMacro Apr 7, 2022
057f732
Merge branch 'qmk:master' into master
KeychronMacro Apr 8, 2022
e664c23
added q3 rev 0120 left-hand gamer layer
i-am-logger Apr 9, 2022
083b21a
Add keycodes which more closely match Apple's new layout
archite Apr 9, 2022
ee06a5b
Merge branch 'qmk:master' into master
KeychronMacro Apr 11, 2022
7b2c239
Merge pull request #23 from ibootstrapper/master
KeychronMacro Apr 11, 2022
b5578fc
Merge pull request #24 from archite/archite
KeychronMacro Apr 11, 2022
575b45a
Merge branch 'qmk:master' into master
KeychronMacro Apr 12, 2022
493eeb7
Revert "added q3 rev 0120 left-hand gamer layer"
KeychronMacro Apr 12, 2022
056efd9
Merge pull request #27 from Keychron/revert-23-master
KeychronMacro Apr 12, 2022
5c81c65
Revert "Add keycodes which more closely match Apple's new layout"
KeychronMacro Apr 12, 2022
02b8e1f
Merge pull request #28 from Keychron/revert-24-archite
KeychronMacro Apr 12, 2022
279e186
Revert "Add new keyboard q3 for keychron"
KeychronMacro Apr 12, 2022
a79d488
Merge pull request #30 from Keychron/revert-22-master
KeychronMacro Apr 12, 2022
8dda18d
Merge branch 'qmk:master' into master
KeychronMacro Apr 20, 2022
fe3a7b9
Merge branch 'qmk:master' into master
KeychronMacro Apr 22, 2022
e762afa
Merge branch 'qmk:master' into master
KeychronMacro Apr 23, 2022
3667b2a
Merge branch 'qmk:master' into master
KeychronMacro Apr 25, 2022
ae22d61
Merge branch 'qmk:master' into master
KeychronMacro Apr 26, 2022
f9e82d8
Merge branch 'qmk:master' into master
KeychronMacro Apr 27, 2022
49493d1
Merge branch 'qmk:master' into master
KeychronMacro Apr 28, 2022
c8f9c24
Update q2
KeychronMacro Apr 28, 2022
3a51716
Merge branch 'master' of https://github.com/keychron/qmk_firmware int…
KeychronMacro Apr 28, 2022
186fc8a
Resume q2 in master
KeychronMacro Apr 28, 2022
5987078
Update encoder.h
KeychronMacro Apr 28, 2022
eca6b0e
Delete config.h
KeychronMacro Apr 28, 2022
dc2d093
Merge branch 'qmk:master' into master
KeychronMacro Apr 29, 2022
756a7b8
Merge branch 'qmk:master' into master
KeychronMacro May 4, 2022
c1ca77d
Merge branch 'qmk:master' into master
KeychronMacro May 5, 2022
7dc6f0d
Merge branch 'qmk:master' into master
KeychronMacro May 6, 2022
2671444
Merge branch 'qmk:master' into master
KeychronMacro May 11, 2022
bbd24a7
Merge branch 'qmk:master' into master
KeychronMacro Jun 2, 2022
d8e775a
Merge branch 'qmk:master' into master
KeychronMacro Jun 14, 2022
4f9cb1c
Merge branch 'qmk:master' into master
KeychronMacro Jun 15, 2022
17d2c9e
Merge branch 'qmk:master' into master
KeychronMacro Jul 4, 2022
70214c7
Merge branch 'qmk:master' into master
KeychronMacro Jul 5, 2022
af6b37b
Update q2 for keychron
KeychronMacro Jul 6, 2022
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
25 changes: 25 additions & 0 deletions keyboards/keychron/q1/chconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* Copyright 2020 QMK
*
* 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

#define CH_CFG_ST_FREQUENCY 10000

#define CH_CFG_OPTIMIZE_SPEED FALSE

#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE

#include_next <chconf.h>
17 changes: 0 additions & 17 deletions keyboards/keychron/q1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,12 @@
#define MANUFACTURER Keychron
#define PRODUCT Keychron Q1

/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 15

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL

/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5

/* RGB Matrix Driver Configuration */
#define DRIVER_COUNT 2
#define DRIVER_ADDR_1 0b1010000
#define DRIVER_ADDR_2 0b1011111

/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { {0,1} }

/* Disable DIP switch in matrix data */
#define MATRIX_MASKED

Expand Down Expand Up @@ -101,8 +89,3 @@
#define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH

/* Allow VIA to edit lighting */
#ifdef VIA_ENABLE
#define VIA_QMK_RGBLIGHT_ENABLE
#endif
21 changes: 21 additions & 0 deletions keyboards/keychron/q1/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright 2020 QMK
*
* 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

#define HAL_USE_I2C TRUE

#include_next <halconf.h>
172 changes: 172 additions & 0 deletions keyboards/keychron/q1/matrix.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/* Copyright 2021 @ 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 <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "util.h"
#include "matrix.h"
#include "debounce.h"
#include "quantum.h"

#define DS A7
#define STCP B0
#define SHCP B1

#ifdef MATRIX_ROW_PINS
static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
#endif // MATRIX_ROW_PINS
#ifdef MATRIX_COL_PINS
static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
#endif // MATRIX_COL_PINS

/* matrix state(1:on, 0:off) */
extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values

static inline void setPinOutput_writeLow(pin_t pin) {
ATOMIC_BLOCK_FORCEON {
setPinOutput(pin);
writePinLow(pin);
}
}

static inline void setPinOutput_writeHigh(pin_t pin) {
ATOMIC_BLOCK_FORCEON {
setPinOutput(pin);
writePinHigh(pin);
}
}

static inline void setPinInputHigh_atomic(pin_t pin) {
ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); }
}

static inline uint8_t readMatrixPin(pin_t pin) {
if (pin != NO_PIN) {
return readPin(pin);
} else {
return 1;
}
}

static void delay_nTime(uint8_t time) {
while(time--);
}

static void SendTo595(uint8_t byteData) {
uint8_t i = 0;

for (; i < 8; i++) {
if (byteData & 0x1) {
setPinOutput_writeHigh(DS);
} else {
setPinOutput_writeLow(DS);
}
byteData = byteData>>1;

setPinOutput_writeHigh(SHCP);
delay_nTime(10);
setPinOutput_writeLow(SHCP);
}
setPinOutput_writeHigh(STCP);
delay_nTime(10);
setPinOutput_writeLow(STCP);
}

static bool select_col(uint8_t col) {
pin_t pin = col_pins[col];

if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
return true;
} else {
SendTo595(~(0x1<<(MATRIX_COLS - col -1)));
return true;
}
return false;
}

static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];

if (pin != NO_PIN) {
setPinInputHigh_atomic(pin);
} else {
SendTo595(0xFF);
}
}

static void unselect_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
unselect_col(x);
}
}

static void matrix_init_pins(void) {
unselect_cols();
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
if (row_pins[x] != NO_PIN) {
setPinInputHigh_atomic(row_pins[x]);
}
}
}

void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
bool key_pressed = false;

// Select col
if (!select_col(current_col)) {
return; // skip NO_PIN col
}
matrix_output_select_delay();

// For each row...
for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
// Check row pin state
if (readMatrixPin(row_pins[row_index]) == 0) {
// Pin LO, set col bit
current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
key_pressed = true;
} else {
// Pin HI, clear col bit
current_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << current_col);
}
}

// Unselect col
unselect_col(current_col);
matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH
}

void matrix_init_custom(void) {
// initialize key pins
matrix_init_pins();
}

bool matrix_scan_custom(matrix_row_t current_matrix[]) {
matrix_row_t curr_matrix[MATRIX_ROWS] = {0};

// Set col, read rows
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
matrix_read_rows_on_col(curr_matrix, current_col);
}

bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0;
if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix));

return changed;
}
22 changes: 22 additions & 0 deletions keyboards/keychron/q1/mcuconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Copyright 2020 QMK
*
* 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

#include_next <mcuconf.h>

#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 TRUE
10 changes: 0 additions & 10 deletions keyboards/keychron/q1/q1.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@

#include "q1.h"


const matrix_row_t matrix_mask[] = {
0b0111111111111101,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
};

bool dip_switch_update_kb(uint8_t index, bool active) {
if (!dip_switch_update_user(index, active)) { return false;}
if (index == 0) {
Expand Down
4 changes: 4 additions & 0 deletions keyboards/keychron/q1/q1.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@
# include "rev_0101.h"
#elif defined(KEYBOARD_keychron_q1_rev_0102)
# include "rev_0102.h"
#elif defined(KEYBOARD_keychron_q1_rev_0106)
# include "rev_0106.h"
#elif defined(KEYBOARD_keychron_q1_rev_0107)
# include "rev_0107.h"
#endif
15 changes: 13 additions & 2 deletions keyboards/keychron/q1/rev_0100/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,27 @@

#pragma once


/* USB Device descriptor parameter */
#define PRODUCT_ID 0x0100
#define DEVICE_VER 0x0100

/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 15

/* key matrix pins */
#define MATRIX_ROW_PINS { D3, D2, B3, B2, B1, B0 }
#define MATRIX_COL_PINS { D5, D4, D6, D7, B4, B5, B6, C6, C7, F7, F6, F5, F4, F1, F0 }

/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { {0,1} }

/* RGB Matrix Driver Configuration */
#define DRIVER_COUNT 2
#define DRIVER_ADDR_1 0b1010000
#define DRIVER_ADDR_2 0b1011111

/* 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)
#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
Loading