Compare commits

...

232 Commits

Author SHA1 Message Date
ducoterra
5413fb76a7 add custom q10 keymap 2022-10-14 21:42:24 -04:00
lalalademaxiya1
b0523764a0 Merge pull request #66 from lalalademaxiya1/playground
Update v5, v6
2022-09-19 14:01:30 +08:00
lalalademaxiya1
2e7b526f64 Update v5, v6 2022-09-19 14:00:11 +08:00
lalalademaxiya1
9a665f9f12 Update default keymap of all keyboards 2022-09-19 12:24:34 +08:00
lalalademaxiya1
fb39fc7e13 Merge pull request #65 from ToyKeeper/keychron-no-factory-tests-in-user-keymaps
moved factory tests to factory keymaps only (default + via)
2022-09-19 09:14:15 +08:00
lalalademaxiya1
e08360b190 Update all keyboards 2022-09-18 16:52:02 +08:00
lalalademaxiya1
4078f374f9 Update all keyboards 2022-09-18 12:01:05 +08:00
Selene ToyKeeper
39439c8d7e moved factory tests to factory keymaps only (default + via)
(these tests don't belong in user keymaps,
 and they break several user keymap functions)
2022-09-17 17:20:58 -06:00
lalalademaxiya1
a44d65b624 Merge pull request #63 from ToyKeeper/keychron-v1-fix-post-init-user
bug fix: un-break keyboard_post_init_user() in all Keychron keyboards
2022-09-17 11:21:33 +08:00
lalalademaxiya1
78ae45e658 Update test.c 2022-09-17 11:18:41 +08:00
lalalademaxiya1
a16b549e52 Merge pull request #64 from lalalademaxiya1/playground
Playground
2022-09-17 11:11:23 +08:00
lalalademaxiya1
68ff6019dd Update q60 2022-09-17 11:08:44 +08:00
Selene ToyKeeper
afe9ccb101 bug fix: allow user keymaps to use keyboard_post_init_user()
(applies previous commit to all Keychron keyboards)

Keyboard models which define keyboard_post_init_kb() are required
by QMK to call keyboard_post_init_user(), but Keychron's code did
not do this... so I fixed it.  This enables user keymaps to run
custom code on boot, like loading user eeprom data and activating
custom RGB settings.

For more info:
https://docs.qmk.fm/#/custom_quantum_functions?id=keyboard-post-initialization-code
https://docs.qmk.fm/#/custom_quantum_functions?id=example-implementation
2022-09-16 15:48:15 -06:00
Selene ToyKeeper
7083a70c21 bug fix: allow keyboard_post_init_user() to work
This lets the user run custom code at boot time,
like loading user eeprom values.  Without this,
the V1 couldn't load/save any custom settings in my
user keymap... even though all my other keyboards
worked fine.
2022-09-16 15:33:27 -06:00
lalalademaxiya1
539922211e Update q60 2022-09-16 21:43:39 +08:00
lalalademaxiya1
09a1c041ae Update all test.c 2022-09-15 12:09:07 +08:00
lalalademaxiya1
6d9254ebc3 Merge pull request #59 from darkstego/playground-fix
Unblock process_record_user for certain keys
2022-09-15 12:02:54 +08:00
lalalademaxiya1
b2f6c42b7a Merge branch 'develop' into playground 2022-09-15 11:50:50 +08:00
Abdulla Bubshait
0100fe5635 Add default case to process_record_kb 2022-09-12 08:26:52 -04:00
Abdulla Bubshait
a37f78f6f8 Remove calling process_record_user at end of process_record_kb
This avoids calling process_record_user twice in case of return true.
It should only be called before any processing.
2022-09-12 08:18:21 -04:00
Abdulla Bubshait
6f117dacdf Unblock process_record_user for certain keys
process_record_user should be called for all keys and if it returns
true then process_record_kb will continue processing.
2022-09-12 07:54:33 -04:00
lalalademaxiya1
ea02eb122c Update iso version 0f q5 2022-09-08 11:43:50 +08:00
lalalademaxiya1
744e8e75b0 Update settings.json 2022-09-02 11:15:05 +08:00
lalalademaxiya1
723e6561fd Add v10 for keychron 2022-09-01 14:23:16 +08:00
lalalademaxiya1
8cf88f04b6 Update s1 2022-08-30 12:19:45 +08:00
lalalademaxiya1
c75068a0ef Update s1 2022-08-30 12:15:39 +08:00
lalalademaxiya1
e28220c074 Merge pull request #57 from lalalademaxiya1/playground
Update q1
2022-08-26 15:04:38 +08:00
lalalademaxiya1
4e76ba7606 Update q1 2022-08-26 15:01:21 +08:00
lalalademaxiya1
0c564ffc76 Merge pull request #56 from lalalademaxiya1/playground
Playground
2022-08-25 17:28:26 +08:00
lalalademaxiya1
a7ecd8e1f9 Merge 2022-08-25 17:22:40 +08:00
lalalademaxiya1
65356eae42 Update iso version of q10 2022-08-25 17:11:06 +08:00
lalalademaxiya1
69e014586d Merge pull request #55 from lalalademaxiya1/playground
Update q10
2022-08-20 09:38:10 +08:00
lalalademaxiya1
b035a1e747 Update q10 2022-08-20 01:33:07 +08:00
lalalademaxiya1
7e688c5850 Merge pull request #54 from lalalademaxiya1/playground
Update test.c
2022-08-19 16:09:59 +08:00
lalalademaxiya1
a03de89b79 Update test.c 2022-08-19 16:09:02 +08:00
lalalademaxiya1
2b7af51fd3 Merge pull request #53 from lalalademaxiya1/playground
Playground
2022-08-17 14:54:53 +08:00
lalalademaxiya1
02ae9da074 Merge branch 'develop' into playground 2022-08-17 15:38:19 +09:00
lalalademaxiya1
22ccdc5583 Update v8 2022-08-17 15:36:19 +09:00
xiaonvziduoqing
110c5c67d2 Update q10 iso variant 2022-08-16 16:13:19 +08:00
xiaonvziduoqing
8c674af028 Merge branch 'develop' into playground 2022-08-16 13:57:25 +08:00
lalalademaxiya1
01a59c0a56 Add iso variant for keychron q10 2022-08-16 13:10:49 +08:00
lalalademaxiya1
610ec8a726 Add version iso for keychron q10 2022-08-15 12:57:46 +08:00
lalalademaxiya1
8f2426b7e3 Update the version jis of q2 2022-08-15 12:05:54 +08:00
lalalademaxiya1
5085d2d0e0 Merge pull request #52 from lalalademaxiya1/playground
Update test code
2022-08-15 11:53:36 +08:00
lalalademaxiya1
904a5cb799 Update test code 2022-08-15 11:47:23 +08:00
lalalademaxiya1
2fc4e36cec Merge pull request #51 from lalalademaxiya1/playground
Playground
2022-08-14 19:35:16 +08:00
lalalademaxiya1
62f75190df Update all keyboards 2022-08-14 19:11:38 +08:00
lalalademaxiya1
62d14ad731 Update ckled2001.c 2022-08-14 16:26:17 +08:00
lalalademaxiya1
8850c2cf02 Update v8 2022-08-14 16:18:28 +08:00
lalalademaxiya1
4da61b144a Update q5 q8 v3 v5 2022-08-12 14:54:02 +08:00
lalalademaxiya1
a94a1c3f89 Rename directory test 2022-08-08 14:15:47 +08:00
lalalademaxiya1
fe0d50733e Rename diretory test 2022-08-08 14:13:12 +08:00
lalalademaxiya1
e27437a18c Update v2 and v8 2022-08-08 14:03:05 +08:00
lalalademaxiya1
6c93ae4335 Remove chconf.h of q4 2022-08-05 11:43:04 +08:00
lalalademaxiya1
926ed4fa00 Remove chconf.h of q3 2022-08-05 10:35:51 +08:00
lalalademaxiya1
a3549b7639 Remove chconf.h of q10 2022-08-05 10:21:32 +08:00
lalalademaxiya1
8aad4e1f11 Update v2 and remove chconf.h of q6,v4 2022-08-04 16:40:58 +08:00
lalalademaxiya1
b016227aa6 Remove chconf.h of q8 2022-08-04 11:08:32 +08:00
lalalademaxiya1
79770ef7bd Update q5 and q6 2022-08-03 17:46:27 +08:00
lalalademaxiya1
ec7d6d1d8d Update v4 2022-08-02 14:42:41 +08:00
lalalademaxiya1
8964cf7235 Update q3 2022-08-01 16:44:04 +08:00
lalalademaxiya1
17ca68de9d Update q0 2022-07-30 17:49:41 +08:00
lalalademaxiya1
06d7fc71e9 Update v4 2022-07-30 16:32:12 +08:00
lalalademaxiya1
820642264c Update quantum/via.c 2022-07-30 15:12:04 +08:00
lalalademaxiya1
ddc3c5517a Update all keyboards 2022-07-30 14:47:20 +08:00
lalalademaxiya1
5a3a7beb27 Update config.h 2022-07-21 15:02:18 +08:00
lalalademaxiya1
df3331ce51 Update v5 2022-07-21 12:14:54 +08:00
lalalademaxiya1
6ad220e31c Update q3... 2022-07-20 18:01:59 +08:00
lalalademaxiya1
f87bca8f68 Update v1 for keychron 2022-07-20 15:34:30 +08:00
lalalademaxiya1
6412c16106 Update v6 2022-07-19 15:51:39 +08:00
lalalademaxiya1
753fd94096 Update v5 and test.c, q2.c 2022-07-19 15:22:31 +08:00
lalalademaxiya1
af46cdf377 Update q1.c for keychron q1 2022-07-19 12:15:26 +08:00
lalalademaxiya1
e4a022ac19 Update q5 2022-07-19 11:54:44 +08:00
lalalademaxiya1
5afd315f44 Update keymap.c 2022-07-18 17:26:56 +08:00
lalalademaxiya1
fa92192c1a Merge branch 'develop' into playground 2022-07-18 16:30:44 +08:00
lalalademaxiya1
2a26bc0c29 Update q3 and q6 2022-07-18 16:29:22 +08:00
lalalademaxiya1
1d0320145e Update q65 and q10 2022-07-16 14:33:51 +08:00
lalalademaxiya1
6bb4611199 Minor modifications 2022-07-14 17:34:22 +08:00
lalalademaxiya1
7afdf42dd0 Update common_features.mk 2022-07-14 12:25:00 +08:00
lalalademaxiya1
efcd6e0f37 Update wear_leveling_efl.c 2022-07-14 12:22:26 +08:00
lalalademaxiya1
83266926d2 Update v6 for keychron 2022-07-14 11:17:15 +08:00
lalalademaxiya1
73b43dc068 Update q2 2022-07-12 18:27:03 +08:00
lalalademaxiya1
57c561c7d8 Merge qmk/develop into playground 2022-07-12 16:29:17 +08:00
lalalademaxiya1
29af921cee Update q1 and change nkro toggle key 2022-07-12 16:18:28 +08:00
lalalademaxiya1
d1ce8f74a8 Merge 2022-07-11 23:33:15 +08:00
lalalademaxiya1
044619fc3d Merge branch 'playground' of https://github.com/lalalademaxiya1/qmk_firmware into playground 2022-07-10 08:01:03 -07:00
lalalademaxiya1
bf8d94b4b4 Update v5 and v6 for keychron 2022-07-10 22:54:50 +08:00
lalalademaxiya1
ebeec675fd Merge pull request #26 from ibootstrapper/playground
Added left hand gamer layer, added caps lock
2022-07-08 04:23:45 -07:00
lalalademaxiya1
51925bf6bf Merge pull request #48 from lalalademaxiya1/playground
Update q2 for keychron
2022-07-08 04:05:20 -07:00
lalalademaxiya1
9959b6c903 Update q2 for keychron
- Cancel forcing keyboard into NKRO state when plug
- Improve capslcok incicating
2022-07-08 04:01:57 -07:00
lokher
0a2c795a06 Correct MCU to STM32L432 in config.h 2022-07-07 21:29:12 +08:00
lalalademaxiya1
ac51258505 Merge pull request #47 from lalalademaxiya1/playground
Update q1 for keychron
2022-07-07 03:32:08 -07:00
lalalademaxiya1
3db3754abb Update q1 for keychron
- Improved capslock indicate and it will keep on when the system is in capslock state whenever the state of backlights are open or off.
2022-07-07 18:28:11 +08:00
lalalademaxiya1
770ad2a0cb Merge pull request #46 from lalalademaxiya1/playground
Add eeprom_stm32_l4.h
2022-07-06 23:45:47 -07:00
lalalademaxiya1
b066af9656 Add eeprom_stm32_l4.h 2022-07-07 14:44:00 +08:00
lalalademaxiya1
afcd4f9f1e Merge pull request #45 from lalalademaxiya1/playground
Playground
2022-07-06 23:27:20 -07:00
lalalademaxiya1
57a50169b6 Update command.c 2022-07-07 14:20:07 +08:00
lalalademaxiya1
26af2efb5d Merge branch 'playground' of https://github.com/lalalademaxiya1/qmk_firmware into playground 2022-07-07 14:08:57 +08:00
lalalademaxiya1
765c219388 Update q1 for keychron 2022-07-07 12:33:22 +08:00
lalalademaxiya1
537c1c0661 Merge branch 'Keychron:playground' into playground 2022-06-30 11:55:40 +08:00
lalalademaxiya1
c9d1e74f6d Update via2json.py 2022-06-30 11:44:42 +08:00
lalalademaxiya1
eb3e14c61b Updare platforms/chibios 2022-06-30 11:39:38 +08:00
lalalademaxiya1
5589c8f8bb Update quantum_keycodes_legacy.h 2022-06-30 11:32:05 +08:00
lalalademaxiya1
7185ed3cc8 Add docker_cmd.sh 2022-06-30 11:27:06 +08:00
lalalademaxiya1
f88ff97ac6 Update users 2022-06-30 11:20:08 +08:00
lalalademaxiya1
2977aa9d2d Update keyboards 2022-06-30 11:14:58 +08:00
lalalademaxiya1
1fa631eda5 Update docs 2022-06-30 11:06:33 +08:00
lalalademaxiya1
5a72cbf887 Add .vscode 2022-06-30 11:01:55 +08:00
lalalademaxiya1
524515f76f Merge branch 'Keychron:playground' into playground 2022-06-30 10:25:14 +08:00
lalalademaxiya1
9ab79d6418 Merge branch 'playground_new' into playground
Update playground with the latest features from branch develop in qmk
2022-06-30 10:09:59 +08:00
lalalademaxiya1
59d0c00ecb Merge remote-tracking branch 'upstream/develop' into playground_new
Add new features
2022-06-30 09:55:17 +08:00
lalalademaxiya1
e0a567e9d4 Update q5 2022-06-30 09:32:01 +08:00
lalalademaxiya1
6b35d3ac4b Merge pull request #43 from lalalademaxiya1/playground
Playground
2022-06-29 11:53:41 +08:00
lalalademaxiya1
4d6d545990 Merge branch 'playground' of https://github.com/lalalademaxiya1/qmk_firmware into playground 2022-06-29 11:39:28 +08:00
lalalademaxiya1
2688e7d16e Update common_features.mk 2022-06-29 11:37:25 +08:00
lalalademaxiya1
ad8298a965 Merge pull request #42 from lalalademaxiya1/playground
Playground
2022-06-29 09:26:27 +08:00
lalalademaxiya1
71687629a0 Override function restart_usb_driver 2022-06-29 09:17:21 +08:00
lalalademaxiya1
897759491f Update ckled2001.c 2022-06-28 23:55:37 +08:00
lalalademaxiya1
aae4f196d4 Resolve conflicting files 2022-06-28 23:51:51 +08:00
lalalademaxiya1
4753be86b9 Update q3 2022-06-28 21:51:07 +08:00
lalalademaxiya1
ea518140dc Merge pull request #41 from lalalademaxiya1/playground
Update eeprom_stm32_l4.c
2022-06-27 11:12:03 +08:00
lalalademaxiya1
58aba271f3 Update eeprom_stm32_l4.c 2022-06-27 11:11:10 +08:00
lalalademaxiya1
03aa277537 Merge pull request #40 from lalalademaxiya1/playground
Playground
2022-06-27 11:09:30 +08:00
lalalademaxiya1
08095b3f3d Resolve conflicts for merge playground_new into playground 2022-06-27 10:33:05 +08:00
lalalademaxiya1
96d8e32d8d Update subproject commit 2022-06-27 09:24:24 +08:00
lalalademaxiya1
de608e6324 Update q0 and add q10, q65 2022-06-27 09:08:04 +08:00
Your Name
909b1ea96e Merge branch 'Keychron-playground' into playground 2022-06-25 03:34:50 -05:00
Your Name
e0277f678e merge 2022-06-25 03:34:31 -05:00
lalalademaxiya1
9a93b32edb Update q65 2022-06-22 21:33:07 +08:00
lalalademaxiya1
e974bf5994 Merge pull request #38 from lalalademaxiya1/playground_new
Playground new
2022-06-19 12:51:06 +08:00
lalalademaxiya1
75bd92341a Update file json of q6 2022-06-19 12:42:02 +08:00
lalalademaxiya1
71cd1993c9 Update v5 iso version 2022-06-19 12:11:00 +08:00
lalalademaxiya1
e6f02ba63b Update q6 iso version 2022-06-19 12:04:21 +08:00
lalalademaxiya1
efa69ee1e4 Delete v8 iso version 2022-06-19 11:40:28 +08:00
lalalademaxiya1
1f6ac8e844 Delete m1 2022-06-19 11:33:05 +08:00
lalalademaxiya1
fb4552b8fc Add keyboard q65 for keychron 2022-06-18 18:28:24 +08:00
lalalademaxiya1
f69d460cf4 Update s1 and v3 of keychron 2022-06-18 16:33:34 +08:00
lalalademaxiya1
47351e03b1 Update s1 of keychron 2022-06-18 13:23:31 +08:00
lalalademaxiya1
1ae99bc017 Update s1 2022-06-18 09:18:37 +08:00
lalalademaxiya1
ad67ffceec Update q0 and add custom hid command in via.c 2022-06-16 16:51:27 +08:00
lalalademaxiya1
80fc251925 Add keychron keyboards. 2022-06-15 19:47:31 +08:00
lalalademaxiya1
f80692c140 Add new features for keychron keyboards. 2022-06-15 13:33:14 +08:00
lalalademaxiya1
9a112e5b99 Merge pull request #37 from lalalademaxiya1/playground
update ./keyboards/keychron/q3/q3_ansi_stm32l432_ec11/rules.mk
2022-06-09 10:01:16 +08:00
lalalademaxiya1
ac271e09b9 update ./keyboards/keychron/q3/q3_ansi_stm32l432_ec11/rules.mk 2022-06-09 09:36:36 +08:00
lalalademaxiya1
e3df51da6e Merge pull request #34 from lalalademaxiya1/playground
Update knob version
2022-05-04 11:15:58 +08:00
lalalademaxiya1
76ee809f52 Update knob version 2022-05-04 11:07:32 +08:00
lalalademaxiya1
dbda307eed Merge pull request #33 from lalalademaxiya1/playground
Playground
2022-04-29 10:02:05 +08:00
lalalademaxiya1
e9cc4f0cc1 Add playground branch 2022-04-27 18:19:56 +08:00
bootstrapper
602cc4b47e fixed right layer color on boot 2022-04-14 03:54:53 -05:00
bootstrapper
b3bcf0bd57 Merge branch 'playground' of https://github.com/ibootstrapper/qmk_firmware into playground 2022-04-12 00:27:58 -05:00
bootstrapper
6a76bc7593 Added left hand gamer layer, added caps lock 2022-04-11 21:36:50 -05:00
bootstrapper
0376e34005 Added left hand gamer layer, added caps lock 2022-04-11 20:36:15 -05:00
lalalademaxiya1
1b7b6b41dd Update test.c 2022-04-07 19:57:09 +08:00
lalalademaxiya1
c183bcf1fb Update q7 2022-04-07 15:05:09 +08:00
lalalademaxiya1
d846155734 Update q4 2022-04-06 18:06:59 +08:00
lalalademaxiya1
8c5b31a68c Update q9 2022-04-06 15:34:46 +08:00
lalalademaxiya1
70eceff30c Update q2 2022-04-06 11:51:27 +08:00
lalalademaxiya1
8f8c6a0445 Update q3 2022-04-06 10:33:43 +08:00
lalalademaxiya1
0e0caa4aa7 Have some updates 2022-04-02 16:09:05 +08:00
lalalademaxiya1
5288d96248 Make some updates 2022-04-01 12:19:03 +08:00
lalalademaxiya1
32fadf61bf Update all keyboards 2022-03-23 17:38:40 +08:00
lalalademaxiya1
841e8370d7 q4 q8 q6 v1 2022-03-16 09:09:20 +08:00
lalalademaxiya1
fd1ad26cab q3 q5 2022-03-14 16:32:31 +08:00
lalalademaxiya1
f596ddaf5b q5 2022-03-14 09:48:39 +08:00
lalalademaxiya1
6998ab5158 Make some minor changes 2022-03-11 18:09:00 +08:00
lalalademaxiya1
e09420bf45 Add keyboard v2 2022-03-08 09:16:03 +08:00
lalalademaxiya1
6ce7f470e0 Rewrite test code 2022-03-07 15:07:15 +08:00
lalalademaxiya1
8bda07f6ff Update iso version of q7 2022-03-04 14:30:29 +08:00
lalalademaxiya1
c2fa4da7d9 Update some boards 2022-03-04 09:26:24 +08:00
lalalademaxiya1
c7fb4ba6a5 Update some code 2022-02-25 19:22:33 +08:00
lalalademaxiya1
3f8ad9b9ab Update q8 q9 2022-02-22 17:49:57 +08:00
lalalademaxiya1
70ba4b1293 Update q8. 2022-02-22 09:39:30 +08:00
lalalademaxiya1
01d6687fff Update q8 2022-02-21 15:34:16 +08:00
lalalademaxiya1
961a837042 Update q4. 2022-02-16 09:55:34 +08:00
lalalademaxiya1
42d505bcfd Merge pull request #18 from lalalademaxiya1/playground
Playground
2022-02-14 11:31:39 +08:00
lalalademaxiya1
405db97f59 Add key NKRO for q2. 2022-02-11 20:26:56 +08:00
lalalademaxiya1
3b63a3514c Update product image of q1/q2 in readme.md. 2022-02-11 17:13:05 +08:00
lalalademaxiya1
635abb3f71 Add key NKRO for q1. 2022-02-11 16:44:07 +08:00
lalalademaxiya1
2cc0d2b01f Add ISO variant of q4. 2022-02-10 18:36:34 +08:00
lalalademaxiya1
db7f677287 Add JIS variant for q1. 2022-02-10 09:35:16 +08:00
lalalademaxiya1
56e090fcd5 Merge pull request #17 from lalalademaxiya1/playground
Update matrix.c and slightly trim some code formats.
2022-02-09 11:11:16 +08:00
lalalademaxiya1
809dac5ebc Merge branch 'Keychron:playground' into playground 2022-02-09 11:02:22 +08:00
lalalademaxiya1
de7f3ab7c6 Keychron q2 QMK Configurator Refactor 2022-02-09 10:56:42 +08:00
lalalademaxiya1
dfa898807d Update matrix.c 2022-02-09 09:22:45 +08:00
lalalademaxiya1
06260b94c1 Merge pull request #16 from lalalademaxiya1/playground
Rearrange some layout macros...
2022-02-07 17:06:57 +08:00
lalalademaxiya1
5a3614f843 Rearrange some layout macros and fix key sequence errors for q1 series, that soft of business. 2022-02-07 16:58:12 +08:00
lalalademaxiya1
3164bc2f0a Merge pull request #15 from ghost/vr-q2-rgb-matrix
Adjusted Q2 RGB matrix to centre animations
2022-02-07 09:20:10 +08:00
lalalademaxiya1
044354a1dd Merge pull request #14 from ghost/vr-q2-caps-lock-led
Add Caps Lock LED to the Q2 boards
2022-02-07 09:19:12 +08:00
Vino Rodrigues
6d84790dd7 adjusted matrix for centred animations 2022-01-31 19:07:06 +11:00
Vino Rodrigues
ae43e23aff Merge branch 'vr-q2-caps-lock-led' of https://github.com/keychron-contrib/qmk_firmware into vr-q2-caps-lock-led 2022-01-31 14:18:42 +11:00
Vino Rodrigues
e50c2e6a13 add caps-lock LED code to Q2 boards 2022-01-31 14:17:53 +11:00
lalalademaxiya1
ca212da183 Merge pull request #13 from keychron-contrib/elmo-q2-fix-scan-matrix
Elmo's q2 fix for missing matrix.c file
2022-01-31 09:56:39 +08:00
lalalademaxiya1
b1bc9dcd74 Merge pull request #12 from keychron-contrib/vr-q1-iso-led-matrix
Align Q1 led matrix of the ISO revisions to be the same as the ANSI ones
2022-01-31 09:55:21 +08:00
lalalademaxiya1
b23f7f3d96 Merge pull request #11 from keychron-contrib/vr-q1-caps-lock-led-all
Added Caps-Lock LED to all other Q1 revs
2022-01-31 09:48:52 +08:00
Vino Rodrigues
eea970e4c5 add caps-lock LED code to Q2 boards 2022-01-31 10:58:44 +11:00
Vino Rodrigues
db54ea7c0e add custom matrix.c to q2 2022-01-31 08:18:36 +11:00
Vino Rodrigues
c832826202 redo of g_led_config variable for ISO boards 2022-01-30 16:14:41 +11:00
Vino Rodrigues
e76de5a572 pipe-backslash is a LED_FLAG_KEYLIGHT 2022-01-30 15:53:16 +11:00
Vino Rodrigues
00549a04d8 corrected bottom row matrix position alignment on ANSI boards 2022-01-30 13:37:38 +11:00
Vino Rodrigues
d4d08da553 added caps-lock led to all other revs 2022-01-30 12:51:10 +11:00
lalalademaxiya1
ca65b2c896 Merge pull request #8 from keychron-contrib/vr-revert-pr6
revert some of pr #6
2022-01-25 09:23:27 +08:00
Vino Rodrigues
e165f336ac revert some of #6 as the LED matrix does not work without all the LEDs assigned 2022-01-25 00:26:57 +11:00
lalalademaxiya1
1c9197facb Merge pull request #7 from lalalademaxiya1/playground
Delete unwanted comments.
2022-01-24 10:45:59 +08:00
lalalademaxiya1
d6621a81aa Delete unwanted comments. 2022-01-24 10:41:55 +08:00
lalalademaxiya1
8a9cd2966a Merge pull request #6 from keychron-contrib/vr-q1-fix-led-matrix
[Q1] pretty up RGB matrix code on ANSI boards
2022-01-24 09:53:59 +08:00
lalalademaxiya1
955488a679 Merge pull request #5 from keychron-contrib/vr-q1-add-caps-lock-light
[Q1] add caps lock indicator
2022-01-24 09:43:06 +08:00
Vino Rodrigues
51254f181e revert startup hue 2022-01-21 19:48:58 +11:00
Vino Rodrigues
33bfbef0dc moved CAPS_LOCK_LED_INDEX to per-board 2022-01-21 19:46:01 +11:00
Vino Rodrigues
0a69fce67e pretty up RGB matrix code on ANSI boards 2022-01-21 02:00:08 +11:00
Vino Rodrigues
db1e468850 add caps-lock indicator 2022-01-20 23:05:00 +11:00
lalalademaxiya1
059710a44b Merge pull request #4 from lalalademaxiya1/playground
Update config.h
2022-01-20 15:23:31 +08:00
lalalademaxiya1
daab54dcb9 Update config.h 2022-01-20 15:22:49 +08:00
lalalademaxiya1
1d45a038d5 Update mcuconf.h, halconf.h, chconf.h. 2022-01-20 15:02:27 +08:00
lalalademaxiya1
2ec82dd56b Update v4. 2022-01-20 11:42:00 +08:00
lalalademaxiya1
055f83519e Update v4. 2022-01-20 09:49:52 +08:00
lalalademaxiya1
a6273e40c2 Update q8. 2022-01-20 09:32:11 +08:00
lalalademaxiya1
789bfa0dbf Merge pull request #3 from lalalademaxiya1/playground
Update .gitignore
2022-01-19 16:01:25 +08:00
lalalademaxiya1
54a4ac468f Update .gitignore 2022-01-19 16:00:49 +08:00
lalalademaxiya1
b20e2e456e Update v1 and v4. 2022-01-19 15:59:29 +08:00
lalalademaxiya1
d1076291c5 Update q8. 2022-01-19 14:50:46 +08:00
lalalademaxiya1
bffb7be4bd Update q0. 2022-01-18 15:15:41 +08:00
lalalademaxiya1
2bc2758eff Update q9/q0. 2022-01-18 14:34:36 +08:00
lalalademaxiya1
95cb80bfa4 Update q9. 2022-01-18 12:24:55 +08:00
lalalademaxiya1
6442612e62 Update q9. 2022-01-18 11:53:21 +08:00
lalalademaxiya1
969f3ae0c3 Add q1 again. 2022-01-17 19:00:05 +08:00
lalalademaxiya1
beb8a29d54 Delete q1. 2022-01-17 18:59:26 +08:00
lalalademaxiya1
5b6f578a4a Add keyboard of q series for keychron. 2022-01-17 18:54:03 +08:00
lalalademaxiya1
29d64de4d1 Update q1. 2022-01-17 12:08:42 +08:00
lalalademaxiya1
79c3bf0a7c Update q1 and add mouse support. 2022-01-14 18:35:38 +08:00
lalalademaxiya1
7314f4bbd2 Update q1. 2022-01-14 14:54:50 +08:00
lalalademaxiya1
2b465c78bf Merge branch 'qmk:master' into playground 2022-01-13 10:01:18 +08:00
lalalademaxiya1
2dad42edae Add rev_0107 and flash support in stm32l433. 2022-01-12 18:56:15 +08:00
1051 changed files with 65305 additions and 4285 deletions

View File

@@ -26,6 +26,6 @@
},
"python.formatting.provider": "yapf",
"[json]": {
"editor.formatOnSave": false
"editor.formatOnSave": false
}
}

View File

@@ -222,10 +222,16 @@ else
# True EEPROM on STM32L0xx, L1xx
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_L0_L1
SRC += eeprom_driver.c eeprom_stm32_L0_L1.c
else ifneq ($(filter $(MCU_SERIES),STM32L4xx),)
# Emulated EEPROM
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED
COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash
COMMON_VPATH += $(DRIVER_PATH)/flash
SRC += eeprom_driver.c eeprom_stm32_l4.c flash_stm32.c
else ifneq ($(filter $(MCU_SERIES),RP2040),)
# Wear-leveling EEPROM implementation, backed by RP2040 flash
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_WEAR_LEVELING
SRC += eeprom_driver.c eeprom_wear_leveling.c
# Wear-leveling EEPROM implementation, backed by RP2040 flash
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_WEAR_LEVELING
SRC += eeprom_driver.c eeprom_wear_leveling.c
WEAR_LEVELING_DRIVER = rp2040_flash
else ifneq ($(filter $(MCU_SERIES),KL2x K20x),)
# Teensy EEPROM implementations

View File

@@ -0,0 +1,309 @@
/* Copyright 2022 @ 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 <stdbool.h>
#include "config.h"
#include "quantum.h"
#include "raw_hid.h"
#define MAC_FN 1
#define WIN_FN 3
#ifndef RAW_EPSIZE
# define RAW_EPSIZE 32
#endif
static void timer_3s_task(void);
static void timer_300ms_task(void);
#define KEY_PRESS_FN (0x1<<0)
#define KEY_PRESS_J (0x1<<1)
#define KEY_PRESS_Z (0x1<<2)
#define KEY_PRESS_RIGHT (0x1<<3)
#define KEY_PRESS_HOME (0x1<<4)
#define KEY_PRESS_FACTORY_RESET (KEY_PRESS_FN | KEY_PRESS_J | KEY_PRESS_Z)
#define KEY_PRESS_LED_TEST (KEY_PRESS_FN | KEY_PRESS_RIGHT | KEY_PRESS_HOME)
enum {
LED_TEST_MODE_OFF,
LED_TEST_MODE_WHITE,
LED_TEST_MODE_RED,
LED_TEST_MODE_GREEN,
LED_TEST_MODE_BLUE,
LED_TEST_MODE_MAX
}led_test_mode;
enum {
FACTORY_TEST_CMD_BACKLIGHT = 0x01,
FACTORY_TEST_CMD_OS_SWITCH,
FACTORY_TEST_CMD_JUMP_TO_BL,
FACTORY_TEST_CMD_EEPROM_CLEAR
};
enum {
OS_SWITCH = 0x01,
};
uint16_t key_press_status = 0;
uint32_t timer_3s_buffer = 0;
uint32_t timer_300ms_buffer = 0;
uint8_t factory_reset_count = 0;
bool report_os_sw_state = false;
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
case MO(MAC_FN):
case MO(WIN_FN):
if (record->event.pressed) {
key_press_status |= KEY_PRESS_FN;
} else {
key_press_status &= ~KEY_PRESS_FN;
timer_3s_buffer = 0;
}
return true;
case KC_J:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_J;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_J;
timer_3s_buffer = 0;
}
return true;
case KC_Z:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_Z;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_Z;
timer_3s_buffer = 0;
}
return true;
case KC_RGHT:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_RIGHT;
if (led_test_mode) {
if (++led_test_mode >= LED_TEST_MODE_MAX) {
led_test_mode = LED_TEST_MODE_WHITE;
}
} else if (key_press_status == KEY_PRESS_LED_TEST) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_RIGHT;
timer_3s_buffer = 0;
}
return true;
case KC_HOME:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_HOME;
if (led_test_mode) {
led_test_mode = LED_TEST_MODE_OFF;
} else if (key_press_status == KEY_PRESS_LED_TEST) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_HOME;
timer_3s_buffer = 0;
}
return true;
default:
return true;
}
}
void matrix_scan_kb(void) {
if (timer_3s_buffer) {
timer_3s_task();
}
if (timer_300ms_buffer) {
timer_300ms_task();
}
matrix_scan_user();
}
static void factory_reset(void) {
timer_300ms_buffer = sync_timer_read32();
factory_reset_count++;
layer_state_t default_layer_tmp = default_layer_state;
eeconfig_init();
default_layer_set(default_layer_tmp);
led_test_mode = LED_TEST_MODE_OFF;
#ifdef LED_MATRIX_ENABLE
if (!led_matrix_is_enabled()) led_matrix_enable();
led_matrix_init();
#endif
#ifdef RGB_MATRIX_ENABLE
if (!rgb_matrix_is_enabled()) {
rgb_matrix_enable();
}
rgb_matrix_init();
#endif
}
static void timer_3s_task(void) {
if (sync_timer_elapsed32(timer_3s_buffer) > 3000) {
timer_3s_buffer = 0;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
factory_reset();
} else if (key_press_status == KEY_PRESS_LED_TEST) {
led_test_mode = LED_TEST_MODE_WHITE;
#ifdef RGB_MATRIX_ENABLE
if (!rgb_matrix_is_enabled()) {
rgb_matrix_enable();
}
#endif
}
key_press_status = 0;
}
}
static void timer_300ms_task(void) {
if (timer_300ms_buffer && sync_timer_elapsed32(timer_300ms_buffer) > 300) {
if (factory_reset_count++ > 6) {
timer_300ms_buffer = 0;
factory_reset_count = 0;
} else {
timer_300ms_buffer = sync_timer_read32();
}
}
}
#if LED_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (factory_reset_count) {
for (uint8_t i = led_min; i <= led_max; i++) {
led_matrix_set_value(i, factory_reset_count % 2 ? 0 : UINT8_MAX);
}
}
}
#endif // LED_MATRIX_ENABLE
#if RGB_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (factory_reset_count) {
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, factory_reset_count % 2 ? 0 : RGB_RED);
}
} else if (led_test_mode) {
switch (led_test_mode) {
case LED_TEST_MODE_WHITE:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_WHITE);
}
break;
case LED_TEST_MODE_RED:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_RED);
}
break;
case LED_TEST_MODE_GREEN:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_GREEN);
}
break;
case LED_TEST_MODE_BLUE:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_BLUE);
}
break;
default:
break;
}
}
}
#endif // RGB_MATRIX_ENABLE
extern matrix_row_t matrix[MATRIX_ROWS];
void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
if ( data[0] == 0xAB ) {
uint16_t checksum = 0;
for (uint8_t i = 1; i < RAW_EPSIZE-3; i++) {
checksum += data[i];
}
/* Verify checksum */
if ((checksum & 0xFF) != data[RAW_EPSIZE-2] || checksum >> 8 != data[RAW_EPSIZE-1]) {
return;
}
switch (data[1]) {
case FACTORY_TEST_CMD_BACKLIGHT:
led_test_mode = data[2];
timer_3s_buffer = 0;
break;
case FACTORY_TEST_CMD_OS_SWITCH:
report_os_sw_state = data[2];
// if (report_os_sw_state) {
// dip_switch_read(true);
// }
break;
case FACTORY_TEST_CMD_JUMP_TO_BL:
if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) {
if (memcmp(&data[2], "JumpToBootloader", strlen("JumpToBootloader")) == 0)
bootloader_jump();
}
break;
case FACTORY_TEST_CMD_EEPROM_CLEAR:
if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) {
if (data[2]) {
factory_reset();
}
}
break;
}
}
}
void system_switch_state_report(uint8_t index, bool active) {
uint16_t checksum = 0;
uint8_t data[RAW_EPSIZE] = {0};
uint8_t payload[3] = { 0 };
if (report_os_sw_state) {
payload[0] = FACTORY_TEST_CMD_OS_SWITCH;
payload[1] = OS_SWITCH;
#if defined(OS_SWITCH_REVERSE)
payload[2] = !active;
#else
payload[2] = active;
#endif
data[0] = 0xAB;
memcpy(&data[1], payload, 3);
for (uint8_t i=1; i<RAW_EPSIZE-3; i++ ) {
checksum += data[i];
}
data[RAW_EPSIZE-2] = checksum & 0xFF;
data[RAW_EPSIZE-1] = (checksum >> 8) & 0xFF;
raw_hid_send(data, RAW_EPSIZE);
}
}
bool dip_switch_update_user(uint8_t index, bool active) {
/* Send default layer state to host */
system_switch_state_report(index, active);
return true;
}

View File

@@ -0,0 +1,233 @@
/* Copyright 2022 @ 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 <stdbool.h>
#include "quantum.h"
#define _FN1 1
#define KEY_PRESS_FN (0x1<<0)
#define KEY_PRESS_J (0x1<<1)
#define KEY_PRESS_Z (0x1<<2)
#define KEY_PRESS_RIGHT (0x1<<3)
#define KEY_PRESS_HOME (0x1<<4)
#define KEY_PRESS_FACTORY_RESET (KEY_PRESS_FN | KEY_PRESS_J | KEY_PRESS_Z)
#define KEY_PRESS_LED_TEST (KEY_PRESS_FN | KEY_PRESS_RIGHT | KEY_PRESS_HOME)
enum {
LED_TEST_MODE_OFF,
LED_TEST_MODE_WHITE,
LED_TEST_MODE_RED,
LED_TEST_MODE_GREEN,
LED_TEST_MODE_BLUE,
LED_TEST_MODE_MAX
}led_test_mode;
enum {
FACTORY_TEST_CMD_BACKLIGHT = 0x01,
FACTORY_TEST_CMD_OS_SWITCH,
FACTORY_TEST_CMD_JUMP_TO_BL,
FACTORY_TEST_CMD_EEPROM_CLEAR
};
enum {
OS_SWITCH = 0x01,
};
uint16_t key_press_status = 0;
uint32_t timer_3s_buffer = 0;
uint32_t timer_300ms_buffer = 0;
uint8_t factory_reset_count = 0;
bool report_os_sw_state = false;
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
case MO(_FN1):
if (record->event.pressed) {
key_press_status |= KEY_PRESS_FN;
} else {
key_press_status &= ~KEY_PRESS_FN;
timer_3s_buffer = 0;
}
return true;
case RGB_SAD:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_J;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32();
} else {
rgb_matrix_decrease_sat_noeeprom();
}
} else {
key_press_status &= ~KEY_PRESS_J;
timer_3s_buffer = 0;
}
return false; // Skip all further processing of this key
case RGB_HUD:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_Z;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32();
} else {
rgb_matrix_decrease_hue_noeeprom();
}
} else {
key_press_status &= ~KEY_PRESS_Z;
timer_3s_buffer = 0;
}
return false; // Skip all further processing of this key
case KC_MPLY:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_RIGHT;
if (led_test_mode) {
if (++led_test_mode >= LED_TEST_MODE_MAX) {
led_test_mode = LED_TEST_MODE_WHITE;
}
} else if (key_press_status == KEY_PRESS_LED_TEST) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_RIGHT;
timer_3s_buffer = 0;
}
return true;
case KC_DEL:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_HOME;
if (led_test_mode) {
led_test_mode = LED_TEST_MODE_OFF;
} else if (key_press_status == KEY_PRESS_LED_TEST) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_HOME;
timer_3s_buffer = 0;
}
return true;
default:
return true;
}
}
static void factory_reset(void) {
timer_300ms_buffer = sync_timer_read32();
factory_reset_count++;
layer_state_t default_layer_tmp = default_layer_state;
eeconfig_init();
default_layer_set(default_layer_tmp);
led_test_mode = LED_TEST_MODE_OFF;
#ifdef LED_MATRIX_ENABLE
if (!led_matrix_is_enabled()) led_matrix_enable();
led_matrix_init();
#endif
#ifdef RGB_MATRIX_ENABLE
if (!rgb_matrix_is_enabled()) {
rgb_matrix_enable();
}
rgb_matrix_init();
#endif
}
static void timer_3s_task(void) {
if (sync_timer_elapsed32(timer_3s_buffer) > 3000) {
timer_3s_buffer = 0;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
factory_reset();
} else if (key_press_status == KEY_PRESS_LED_TEST) {
led_test_mode = LED_TEST_MODE_WHITE;
#ifdef RGB_MATRIX_ENABLE
if (!rgb_matrix_is_enabled()) {
rgb_matrix_enable();
}
#endif
}
key_press_status = 0;
}
}
static void timer_300ms_task(void) {
if (timer_300ms_buffer && sync_timer_elapsed32(timer_300ms_buffer) > 300) {
if (factory_reset_count++ > 6) {
timer_300ms_buffer = 0;
factory_reset_count = 0;
} else {
timer_300ms_buffer = sync_timer_read32();
}
}
}
void matrix_scan_kb(void) {
if (timer_3s_buffer) {
timer_3s_task();
}
if (timer_300ms_buffer) {
timer_300ms_task();
}
matrix_scan_user();
}
#if LED_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (factory_reset_count) {
for (uint8_t i = led_min; i <= led_max; i++) {
led_matrix_set_value(i, factory_reset_count % 2 ? 0 : UINT8_MAX);
}
}
}
#endif // LED_MATRIX_ENABLE
#if RGB_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (factory_reset_count) {
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, factory_reset_count % 2 ? 0 : RGB_RED);
}
} else if (led_test_mode) {
switch (led_test_mode) {
case LED_TEST_MODE_WHITE:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_WHITE);
}
break;
case LED_TEST_MODE_RED:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_RED);
}
break;
case LED_TEST_MODE_GREEN:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_GREEN);
}
break;
case LED_TEST_MODE_BLUE:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_BLUE);
}
break;
default:
break;
}
}
}
#endif // RGB_MATRIX_ENABLE

View File

@@ -0,0 +1,303 @@
/* Copyright 2022 @ 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 <stdbool.h>
#include "quantum.h"
#include "raw_hid.h"
#define MAC_FN 2
#define WIN_FN 3
#ifndef RAW_EPSIZE
# define RAW_EPSIZE 32
#endif
#define KEY_PRESS_FN (0x1<<0)
#define KEY_PRESS_J (0x1<<1)
#define KEY_PRESS_Z (0x1<<2)
#define KEY_PRESS_RIGHT (0x1<<3)
#define KEY_PRESS_HOME (0x1<<4)
#define KEY_PRESS_FACTORY_RESET (KEY_PRESS_FN | KEY_PRESS_J | KEY_PRESS_Z)
#define KEY_PRESS_LED_TEST (KEY_PRESS_FN | KEY_PRESS_RIGHT | KEY_PRESS_HOME)
enum {
LED_TEST_MODE_OFF,
LED_TEST_MODE_WHITE,
LED_TEST_MODE_RED,
LED_TEST_MODE_GREEN,
LED_TEST_MODE_BLUE,
LED_TEST_MODE_MAX
}led_test_mode;
enum {
FACTORY_TEST_CMD_BACKLIGHT = 0x01,
FACTORY_TEST_CMD_OS_SWITCH,
FACTORY_TEST_CMD_JUMP_TO_BL,
FACTORY_TEST_CMD_EEPROM_CLEAR
};
enum {
OS_SWITCH = 0x01,
};
uint16_t key_press_status = 0;
uint32_t timer_3s_buffer = 0;
uint32_t timer_300ms_buffer = 0;
uint8_t factory_reset_count = 0;
bool report_os_sw_state = false;
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
case MO(MAC_FN):
case MO(WIN_FN):
if (record->event.pressed) {
key_press_status |= KEY_PRESS_FN;
} else {
key_press_status &= ~KEY_PRESS_FN;
timer_3s_buffer = 0;
}
return true;
case KC_J:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_J;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_J;
timer_3s_buffer = 0;
}
return true;
case KC_Z:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_Z;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_Z;
timer_3s_buffer = 0;
}
return true;
case KC_RGHT:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_RIGHT;
if (led_test_mode) {
if (++led_test_mode >= LED_TEST_MODE_MAX) {
led_test_mode = LED_TEST_MODE_WHITE;
}
} else if (key_press_status == KEY_PRESS_LED_TEST) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_RIGHT;
timer_3s_buffer = 0;
}
return true;
case KC_HOME:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_HOME;
if (led_test_mode) {
led_test_mode = LED_TEST_MODE_OFF;
} else if (key_press_status == KEY_PRESS_LED_TEST) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_HOME;
timer_3s_buffer = 0;
}
return true;
default:
return true;
}
}
static void factory_reset(void) {
timer_300ms_buffer = sync_timer_read32();
factory_reset_count++;
layer_state_t default_layer_tmp = default_layer_state;
eeconfig_init();
default_layer_set(default_layer_tmp);
led_test_mode = LED_TEST_MODE_OFF;
#ifdef LED_MATRIX_ENABLE
if (!led_matrix_is_enabled()) led_matrix_enable();
led_matrix_init();
#endif
#ifdef RGB_MATRIX_ENABLE
if (!rgb_matrix_is_enabled()) {
rgb_matrix_enable();
}
rgb_matrix_init();
#endif
}
static void timer_3s_task(void) {
if (sync_timer_elapsed32(timer_3s_buffer) > 3000) {
timer_3s_buffer = 0;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
factory_reset();
} else if (key_press_status == KEY_PRESS_LED_TEST) {
led_test_mode = LED_TEST_MODE_WHITE;
#ifdef RGB_MATRIX_ENABLE
if (!rgb_matrix_is_enabled()) {
rgb_matrix_enable();
}
#endif
}
key_press_status = 0;
}
}
static void timer_300ms_task(void) {
if (timer_300ms_buffer && sync_timer_elapsed32(timer_300ms_buffer) > 300) {
if (factory_reset_count++ > 6) {
timer_300ms_buffer = 0;
factory_reset_count = 0;
} else {
timer_300ms_buffer = sync_timer_read32();
}
}
}
void matrix_scan_kb(void) {
if (timer_3s_buffer) {
timer_3s_task();
}
if (timer_300ms_buffer) {
timer_300ms_task();
}
matrix_scan_user();
}
#if LED_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (factory_reset_count) {
for (uint8_t i = led_min; i <= led_max; i++) {
led_matrix_set_value(i, factory_reset_count % 2 ? 0 : UINT8_MAX);
}
}
}
#endif // LED_MATRIX_ENABLE
#if RGB_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (factory_reset_count) {
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, factory_reset_count % 2 ? 0 : RGB_RED);
}
} else if (led_test_mode) {
switch (led_test_mode) {
case LED_TEST_MODE_WHITE:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_WHITE);
}
break;
case LED_TEST_MODE_RED:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_RED);
}
break;
case LED_TEST_MODE_GREEN:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_GREEN);
}
break;
case LED_TEST_MODE_BLUE:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_BLUE);
}
break;
default:
break;
}
}
}
#endif // RGB_MATRIX_ENABLE
extern matrix_row_t matrix[MATRIX_ROWS];
void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
if ( data[0] == 0xAB ) {
uint16_t checksum = 0;
for (uint8_t i = 1; i < RAW_EPSIZE-3; i++) {
checksum += data[i];
}
/* Verify checksum */
if ((checksum & 0xFF) != data[RAW_EPSIZE-2] || checksum >> 8 != data[RAW_EPSIZE-1]) {
return;
}
switch (data[1]) {
case FACTORY_TEST_CMD_BACKLIGHT:
led_test_mode = data[2];
timer_3s_buffer = 0;
break;
case FACTORY_TEST_CMD_OS_SWITCH:
report_os_sw_state = data[2];
// if (report_os_sw_state) {
// dip_switch_read(true);
// }
break;
case FACTORY_TEST_CMD_JUMP_TO_BL:
if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) {
if (memcmp(&data[2], "JumpToBootloader", strlen("JumpToBootloader")) == 0) bootloader_jump();
}
break;
case FACTORY_TEST_CMD_EEPROM_CLEAR:
if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) {
if (data[2]) {
factory_reset();
}
}
break;
}
}
}
void system_switch_state_report(uint8_t index, bool active) {
uint16_t checksum = 0;
uint8_t data[RAW_EPSIZE] = {0};
uint8_t payload[3] = { 0 };
if (report_os_sw_state) {
payload[0] = FACTORY_TEST_CMD_OS_SWITCH;
payload[1] = OS_SWITCH;
payload[2] = active;
data[0] = 0xAB;
// memcpy(&data[1], payload, 3);
data[1] = payload[0];
data[2] = payload[1];
data[3] = payload[2];
for (uint8_t i=1; i<RAW_EPSIZE-3; i++ ) {
checksum += data[i];
}
data[RAW_EPSIZE-2] = checksum & 0xFF;
data[RAW_EPSIZE-1] = (checksum >> 8) & 0xFF;
raw_hid_send(data, RAW_EPSIZE);
}
}
bool dip_switch_update_user(uint8_t index, bool active) {
/* Send default layer state to host */
system_switch_state_report(index, active);
return true;
}

View File

@@ -0,0 +1,305 @@
/* Copyright 2022 @ 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 <stdbool.h>
#include "keycode.h"
#include "quantum.h"
#include "raw_hid.h"
#define MAC_FN 2
#define WIN_FN 3
#ifndef RAW_EPSIZE
# define RAW_EPSIZE 32
#endif
static void timer_3s_task(void);
static void timer_300ms_task(void);
#define KEY_PRESS_FN (0x1<<0)
#define KEY_PRESS_J (0x1<<1)
#define KEY_PRESS_Z (0x1<<2)
#define KEY_PRESS_RIGHT (0x1<<3)
#define KEY_PRESS_HOME (0x1<<4)
#define KEY_PRESS_FACTORY_RESET (KEY_PRESS_FN | KEY_PRESS_J | KEY_PRESS_Z)
#define KEY_PRESS_LED_TEST (KEY_PRESS_FN | KEY_PRESS_RIGHT | KEY_PRESS_HOME)
enum {
LED_TEST_MODE_OFF,
LED_TEST_MODE_WHITE,
LED_TEST_MODE_RED,
LED_TEST_MODE_GREEN,
LED_TEST_MODE_BLUE,
LED_TEST_MODE_MAX
}led_test_mode;
enum {
FACTORY_TEST_CMD_BACKLIGHT = 0x01,
FACTORY_TEST_CMD_OS_SWITCH,
FACTORY_TEST_CMD_JUMP_TO_BL,
FACTORY_TEST_CMD_EEPROM_CLEAR
};
enum {
OS_SWITCH = 0x01,
};
uint16_t key_press_status = 0;
uint32_t timer_3s_buffer = 0;
uint32_t timer_300ms_buffer = 0;
uint8_t factory_reset_count = 0;
bool report_os_sw_state = false;
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
case MO(MAC_FN):
case MO(WIN_FN):
if (record->event.pressed) {
key_press_status |= KEY_PRESS_FN;
} else {
key_press_status &= ~KEY_PRESS_FN;
timer_3s_buffer = 0;
}
return true;
case KC_J:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_J;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_J;
timer_3s_buffer = 0;
}
return true;
case KC_Z:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_Z;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_Z;
timer_3s_buffer = 0;
}
return true;
case KC_B:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_RIGHT;
if (led_test_mode) {
if (++led_test_mode >= LED_TEST_MODE_MAX) {
led_test_mode = LED_TEST_MODE_WHITE;
}
} else if (key_press_status == KEY_PRESS_LED_TEST) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_RIGHT;
timer_3s_buffer = 0;
}
return true;
case KC_L:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_HOME;
if (led_test_mode) {
led_test_mode = LED_TEST_MODE_OFF;
} else if (key_press_status == KEY_PRESS_LED_TEST) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_HOME;
timer_3s_buffer = 0;
}
return true;
default:
return true;
}
}
void matrix_scan_kb(void) {
if (timer_3s_buffer) {
timer_3s_task();
}
if (timer_300ms_buffer) {
timer_300ms_task();
}
matrix_scan_user();
}
static void factory_reset(void) {
timer_300ms_buffer = sync_timer_read32();
factory_reset_count++;
layer_state_t default_layer_tmp = default_layer_state;
eeconfig_init();
default_layer_set(default_layer_tmp);
led_test_mode = LED_TEST_MODE_OFF;
#ifdef LED_MATRIX_ENABLE
if (!led_matrix_is_enabled()) led_matrix_enable();
led_matrix_init();
#endif
#ifdef RGB_MATRIX_ENABLE
if (!rgb_matrix_is_enabled()) {
rgb_matrix_enable();
}
rgb_matrix_init();
#endif
}
static void timer_3s_task(void) {
if (sync_timer_elapsed32(timer_3s_buffer) > 3000) {
timer_3s_buffer = 0;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
factory_reset();
} else if (key_press_status == KEY_PRESS_LED_TEST) {
key_press_status &= ~KEY_PRESS_LED_TEST;
led_test_mode = LED_TEST_MODE_WHITE;
#ifdef RGB_MATRIX_ENABLE
if (!rgb_matrix_is_enabled()) {
rgb_matrix_enable();
}
#endif
}
key_press_status = 0;
}
}
static void timer_300ms_task(void) {
if (timer_300ms_buffer && sync_timer_elapsed32(timer_300ms_buffer) > 300) {
if (factory_reset_count++ > 6) {
timer_300ms_buffer = 0;
factory_reset_count = 0;
} else {
timer_300ms_buffer = sync_timer_read32();
}
}
}
#if LED_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (factory_reset_count) {
for (uint8_t i = led_min; i <= led_max; i++) {
led_matrix_set_value(i, factory_reset_count % 2 ? 0 : UINT8_MAX);
}
}
}
#endif // LED_MATRIX_ENABLE
#if RGB_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (factory_reset_count) {
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, factory_reset_count % 2 ? 0 : RGB_RED);
}
} else if (led_test_mode) {
switch (led_test_mode) {
case LED_TEST_MODE_WHITE:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_WHITE);
}
break;
case LED_TEST_MODE_RED:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_RED);
}
break;
case LED_TEST_MODE_GREEN:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_GREEN);
}
break;
case LED_TEST_MODE_BLUE:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_BLUE);
}
break;
default:
break;
}
}
}
#endif // RGB_MATRIX_ENABLE
extern matrix_row_t matrix[MATRIX_ROWS];
void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
if ( data[0] == 0xAB ) {
uint16_t checksum = 0;
for (uint8_t i = 1; i < RAW_EPSIZE-3; i++) {
checksum += data[i];
}
/* Verify checksum */
if ((checksum & 0xFF) != data[RAW_EPSIZE-2] || checksum >> 8 != data[RAW_EPSIZE-1]) {
return;
}
switch (data[1]) {
case FACTORY_TEST_CMD_BACKLIGHT:
led_test_mode = data[2];
timer_3s_buffer = 0;
break;
case FACTORY_TEST_CMD_OS_SWITCH:
report_os_sw_state = data[2];
// if (report_os_sw_state) {
// dip_switch_read(true);
// }
break;
case FACTORY_TEST_CMD_JUMP_TO_BL:
if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) {
if (memcmp(&data[2], "JumpToBootloader", strlen("JumpToBootloader")) == 0) bootloader_jump();
}
break;
case FACTORY_TEST_CMD_EEPROM_CLEAR:
if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) {
if (data[2]) {
factory_reset();
}
}
break;
}
}
}
void system_switch_state_report(uint8_t index, bool active) {
uint16_t checksum = 0;
uint8_t data[RAW_EPSIZE] = {0};
uint8_t payload[3] = { 0 };
if (report_os_sw_state) {
payload[0] = FACTORY_TEST_CMD_OS_SWITCH;
payload[1] = OS_SWITCH;
payload[2] = active;
data[0] = 0xAB;
memcpy(&data[1], payload, 3);
for (uint8_t i=1; i<RAW_EPSIZE-3; i++ ) {
checksum += data[i];
}
data[RAW_EPSIZE-2] = checksum & 0xFF;
data[RAW_EPSIZE-1] = (checksum >> 8) & 0xFF;
raw_hid_send(data, RAW_EPSIZE);
}
}
bool dip_switch_update_user(uint8_t index, bool active) {
/* Send default layer state to host */
system_switch_state_report(index, active);
return true;
}

View File

@@ -0,0 +1,306 @@
/* Copyright 2022 @ 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 <stdbool.h>
#include "quantum.h"
#include "raw_hid.h"
#define MAC_FN 2
#define WIN_FN 3
#ifndef RAW_EPSIZE
# define RAW_EPSIZE 32
#endif
static void timer_3s_task(void);
static void timer_300ms_task(void);
#define KEY_PRESS_FN (0x1<<0)
#define KEY_PRESS_J (0x1<<1)
#define KEY_PRESS_Z (0x1<<2)
#define KEY_PRESS_RIGHT (0x1<<3)
#define KEY_PRESS_HOME (0x1<<4)
#define KEY_PRESS_FACTORY_RESET (KEY_PRESS_FN | KEY_PRESS_J | KEY_PRESS_Z)
#define KEY_PRESS_LED_TEST (KEY_PRESS_FN | KEY_PRESS_RIGHT | KEY_PRESS_HOME)
enum {
LED_TEST_MODE_OFF,
LED_TEST_MODE_WHITE,
LED_TEST_MODE_RED,
LED_TEST_MODE_GREEN,
LED_TEST_MODE_BLUE,
LED_TEST_MODE_MAX
}led_test_mode;
enum {
FACTORY_TEST_CMD_BACKLIGHT = 0x01,
FACTORY_TEST_CMD_OS_SWITCH,
FACTORY_TEST_CMD_JUMP_TO_BL,
FACTORY_TEST_CMD_EEPROM_CLEAR
};
enum {
OS_SWITCH = 0x01,
};
uint16_t key_press_status = 0;
uint32_t timer_3s_buffer = 0;
uint32_t timer_300ms_buffer = 0;
uint8_t factory_reset_count = 0;
bool report_os_sw_state = false;
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
case MO(MAC_FN):
case MO(WIN_FN):
if (record->event.pressed) {
key_press_status |= KEY_PRESS_FN;
} else {
key_press_status &= ~KEY_PRESS_FN;
timer_3s_buffer = 0;
}
return true;
case KC_J:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_J;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_J;
timer_3s_buffer = 0;
}
return true;
case RGB_RMOD:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_Z;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32();
} else {
rgb_matrix_step_reverse();
}
} else {
key_press_status &= ~KEY_PRESS_Z;
timer_3s_buffer = 0;
}
return false; // Skip all further processing of this key
case KC_RGHT:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_RIGHT;
if (led_test_mode) {
if (++led_test_mode >= LED_TEST_MODE_MAX) {
led_test_mode = LED_TEST_MODE_WHITE;
}
} else if (key_press_status == KEY_PRESS_LED_TEST) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_RIGHT;
timer_3s_buffer = 0;
}
return true;
case KC_HOME:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_HOME;
if (led_test_mode) {
led_test_mode = LED_TEST_MODE_OFF;
} else if (key_press_status == KEY_PRESS_LED_TEST) {
timer_3s_buffer = sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_HOME;
timer_3s_buffer = 0;
}
return true;
default:
return true;
}
}
void matrix_scan_kb(void) {
if (timer_3s_buffer) {
timer_3s_task();
}
if (timer_300ms_buffer) {
timer_300ms_task();
}
matrix_scan_user();
}
static void factory_reset(void) {
timer_300ms_buffer = sync_timer_read32();
factory_reset_count++;
layer_state_t default_layer_tmp = default_layer_state;
eeconfig_init();
default_layer_set(default_layer_tmp);
led_test_mode = LED_TEST_MODE_OFF;
#ifdef LED_MATRIX_ENABLE
if (!led_matrix_is_enabled()) led_matrix_enable();
led_matrix_init();
#endif
#ifdef RGB_MATRIX_ENABLE
if (!rgb_matrix_is_enabled()) {
rgb_matrix_enable();
}
rgb_matrix_init();
#endif
}
static void timer_3s_task(void) {
if (sync_timer_elapsed32(timer_3s_buffer) > 3000) {
timer_3s_buffer = 0;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
factory_reset();
} else if (key_press_status == KEY_PRESS_LED_TEST) {
key_press_status &= ~KEY_PRESS_LED_TEST;
led_test_mode = LED_TEST_MODE_WHITE;
#ifdef RGB_MATRIX_ENABLE
if (!rgb_matrix_is_enabled()) {
rgb_matrix_enable();
}
#endif
}
key_press_status = 0;
}
}
static void timer_300ms_task(void) {
if (timer_300ms_buffer && sync_timer_elapsed32(timer_300ms_buffer) > 300) {
if (factory_reset_count++ > 6) {
timer_300ms_buffer = 0;
factory_reset_count = 0;
} else {
timer_300ms_buffer = sync_timer_read32();
}
}
}
#if LED_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (factory_reset_count) {
for (uint8_t i = led_min; i <= led_max; i++) {
led_matrix_set_value(i, factory_reset_count % 2 ? 0 : UINT8_MAX);
}
}
}
#endif // LED_MATRIX_ENABLE
#if RGB_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (factory_reset_count) {
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, factory_reset_count % 2 ? 0 : RGB_RED);
}
} else if (led_test_mode) {
switch (led_test_mode) {
case LED_TEST_MODE_WHITE:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_WHITE);
}
break;
case LED_TEST_MODE_RED:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_RED);
}
break;
case LED_TEST_MODE_GREEN:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_GREEN);
}
break;
case LED_TEST_MODE_BLUE:
for (uint8_t i = led_min; i <= led_max; i++) {
rgb_matrix_set_color(i, RGB_BLUE);
}
break;
default:
break;
}
}
}
#endif // RGB_MATRIX_ENABLE
extern matrix_row_t matrix[MATRIX_ROWS];
void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
if ( data[0] == 0xAB ) {
uint16_t checksum = 0;
for (uint8_t i = 1; i < RAW_EPSIZE-3; i++) {
checksum += data[i];
}
/* Verify checksum */
if ((checksum & 0xFF) != data[RAW_EPSIZE-2] || checksum >> 8 != data[RAW_EPSIZE-1]) {
return;
}
switch (data[1]) {
case FACTORY_TEST_CMD_BACKLIGHT:
led_test_mode = data[2];
timer_3s_buffer = 0;
break;
case FACTORY_TEST_CMD_OS_SWITCH:
report_os_sw_state = data[2];
// if (report_os_sw_state) {
// dip_switch_read(true);
// }
break;
case FACTORY_TEST_CMD_JUMP_TO_BL:
if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) {
if (memcmp(&data[2], "JumpToBootloader", strlen("JumpToBootloader")) == 0) bootloader_jump();
}
break;
case FACTORY_TEST_CMD_EEPROM_CLEAR:
if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) {
if (data[2]) {
factory_reset();
}
}
break;
}
}
}
void system_switch_state_report(uint8_t index, bool active) {
uint16_t checksum = 0;
uint8_t data[RAW_EPSIZE] = {0};
uint8_t payload[3] = { 0 };
if (report_os_sw_state) {
payload[0] = FACTORY_TEST_CMD_OS_SWITCH;
payload[1] = OS_SWITCH;
payload[2] = active;
data[0] = 0xAB;
memcpy(&data[1], payload, 3);
for (uint8_t i=1; i<RAW_EPSIZE-3; i++ ) {
checksum += data[i];
}
data[RAW_EPSIZE-2] = checksum & 0xFF;
data[RAW_EPSIZE-1] = (checksum >> 8) & 0xFF;
raw_hid_send(data, RAW_EPSIZE);
}
}
bool dip_switch_update_user(uint8_t index, bool active) {
/* Send default layer state to host */
system_switch_state_report(index, active);
return true;
}

View File

@@ -0,0 +1,103 @@
/* 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/>.
*/
#pragma once
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 4
/* key matrix pins */
#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 }
#define MATRIX_COL_PINS { A5, A6, A7, B0 }
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* RGB Matrix Driver Configuration */
#define DRIVER_COUNT 1
#define DRIVER_ADDR_1 0b1110100
#define CKLED2001_CURRENT_TUNE \
{ 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70 }
/* NKRO */
#define FORCE_NKRO
/* turn off effects when suspended */
#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define DYNAMIC_KEYMAP_LAYER_COUNT 4
/* EEPROM Driver Configuration */
#define WEAR_LEVELING_LOGICAL_SIZE 2048
#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2)
// RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see:
// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
// #define ENABLE_RGB_MATRIX_ALPHAS_MODS
// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
#define ENABLE_RGB_MATRIX_BREATHING
// #define ENABLE_RGB_MATRIX_BAND_SAT
// #define ENABLE_RGB_MATRIX_BAND_VAL
// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
// #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
// #define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
#define ENABLE_RGB_MATRIX_CYCLE_ALL
#define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
#define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
#define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
#define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
#define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
#define ENABLE_RGB_MATRIX_DUAL_BEACON
#define ENABLE_RGB_MATRIX_RAINBOW_BEACON
// #define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
#define ENABLE_RGB_MATRIX_RAINDROPS
// #define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
// #define ENABLE_RGB_MATRIX_HUE_BREATHING
// #define ENABLE_RGB_MATRIX_HUE_PENDULUM
// #define ENABLE_RGB_MATRIX_HUE_WAVE
// #define ENABLE_RGB_MATRIX_PIXEL_RAIN
// #define ENABLE_RGB_MATRIX_PIXEL_FLOW
// #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL
// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined
#define ENABLE_RGB_MATRIX_TYPING_HEATMAP
#define ENABLE_RGB_MATRIX_DIGITAL_RAIN
// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
#define ENABLE_RGB_MATRIX_SPLASH
#define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
// #define RGB_MATRIX_KEYPRESSES
/* Enable receive custom command from host */
#define RAW_HID_CMD 0xAB

View File

@@ -1,4 +1,4 @@
/* Copyright 2022 @ Ionut Micu
/* 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
@@ -16,12 +16,6 @@
#pragma once
// clang-format off
#define HAL_USE_I2C TRUE
enum layers{
MAC_BASE,
WIN_BASE,
_FN1,
_FN2,
_FN3,
};
#include_next <halconf.h>

View File

@@ -16,10 +16,7 @@
#pragma once
#define CH_CFG_ST_FREQUENCY 10000
#include_next <mcuconf.h>
#define CH_CFG_OPTIMIZE_SPEED FALSE
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#include_next <chconf.h>
#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 TRUE

View File

@@ -0,0 +1,90 @@
/* 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 "q0.h"
#if defined(RGB_MATRIX_ENABLE) && defined(NUM_LOCK_LED_INDEX)
# define NUM_LOCK_MAX_BRIGHTNESS 0xFF
# ifdef RGB_MATRIX_MAXIMUM_BRIGHTNESS
# undef NUM_LOCK_MAX_BRIGHTNESS
# define NUM_LOCK_MAX_BRIGHTNESS RGB_MATRIX_MAXIMUM_BRIGHTNESS
# endif
# define NUM_LOCK_VAL_STEP 8
# ifdef RGB_MATRIX_VAL_STEP
# undef NUM_LOCK_VAL_STEP
# define NUM_LOCK_VAL_STEP RGB_MATRIX_VAL_STEP
# endif
extern void rgb_matrix_update_pwm_buffers(void);
static uint8_t light_brightness_get(void) {
uint8_t value = rgb_matrix_get_val();
if (value < NUM_LOCK_VAL_STEP) {
value = NUM_LOCK_VAL_STEP;
} else if (value < (NUM_LOCK_MAX_BRIGHTNESS - NUM_LOCK_VAL_STEP)) {
value += NUM_LOCK_VAL_STEP; // one step more than current brightness
} else {
value = NUM_LOCK_MAX_BRIGHTNESS;
}
return value;
}
void rgb_matrix_indicators_kb(void) {
if (host_keyboard_led_state().num_lock) {
uint8_t v = light_brightness_get();
rgb_matrix_set_color(NUM_LOCK_LED_INDEX, v, v, v); // white, with the adjusted brightness
}
}
void rgb_matrix_indicators_none_kb(void) {
rgb_matrix_indicators_kb();
rgb_matrix_update_pwm_buffers();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (rgb_matrix_is_enabled()
# if defined(ENABLE_RGB_MATRIX_RAINDROPS)
&& (rgb_matrix_get_mode() != RGB_MATRIX_RAINDROPS)
# endif
# if defined(ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS)
&& (rgb_matrix_get_mode() != RGB_MATRIX_JELLYBEAN_RAINDROPS)
# endif
# if defined(ENABLE_RGB_MATRIX_PIXEL_RAIN)
&& (rgb_matrix_get_mode() != RGB_MATRIX_PIXEL_RAIN)
# endif
) {
return res;
}
if (res) {
if (led_state.num_lock) {
uint8_t v = light_brightness_get();
rgb_matrix_set_color(NUM_LOCK_LED_INDEX, v, v, v);
} else {
rgb_matrix_set_color(NUM_LOCK_LED_INDEX, 0, 0, 0);
}
rgb_matrix_update_pwm_buffers();
}
return res;
}
#endif // NUM_LOCK_LED_INDEX

View File

@@ -0,0 +1,23 @@
/* 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/>.
*/
#pragma once
#include "quantum.h"
#if defined(KEYBOARD_keychron_q0_q0_stm32l432)
# include "q0_stm32l432.h"
#endif

View File

@@ -0,0 +1,24 @@
/* 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/>.
*/
#pragma once
/* RGB Matrix Configuration */
#define DRIVER_1_LED_TOTAL 21
#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL
/* Enable num-lock LED */
#define NUM_LOCK_LED_INDEX 4

View File

@@ -0,0 +1,43 @@
{
"keyboard_name": "Keychron Q0",
"manufacturer": "Keychron",
"url": "https://github.com/Keychron",
"maintainer": "lalalademaxiya1",
"usb": {
"vid": "0x3434",
"pid": "0x0130",
"device_version": "1.0.2"
},
"layouts": {
"LAYOUT_numpad_6x4": {
"layout": [
{"label":"Fn", "x":0, "y":0},
{"label":"Esc", "x":1, "y":0},
{"label":"Backspace", "x":2, "y":0},
{"label":"Tab", "x":3, "y":0},
{"label":"Num Lock", "x":0, "y":1},
{"label":"/", "x":1, "y":1},
{"label":"*", "x":2, "y":1},
{"label":"-", "x":3, "y":1},
{"label":"7", "x":0, "y":2},
{"label":"8", "x":1, "y":2},
{"label":"9", "x":2, "y":2},
{"label":"4", "x":0, "y":3},
{"label":"5", "x":1, "y":3},
{"label":"6", "x":2, "y":3},
{"label":"+", "x":3, "y":2, "h":2},
{"label":"1", "x":0, "y":4},
{"label":"2", "x":1, "y":4},
{"label":"3", "x":2, "y":4},
{"label":"0", "x":0, "y":5, "w":2},
{"label":".", "x":2, "y":5},
{"label":"Enter", "x":3, "y":4, "h":2}
]
}
}
}

View File

@@ -0,0 +1,53 @@
/* 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 QMK_KEYBOARD_H
enum layers { _BASE, _FN1, _RESERVED1, _RESERVED2 };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_numpad_6x4(
MO(_FN1), KC_ESC, KC_BSPACE, KC_TAB,
KC_NUMLOCK, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9,
KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3,
KC_P0, KC_PDOT, KC_PENT),
[_FN1] = LAYOUT_numpad_6x4(
_______, KC_MUTE, KC_VOLD, KC_VOLU,
RGB_MOD, RGB_VAI, RGB_HUI, KC_DEL,
RGB_RMOD, RGB_VAD, RGB_HUD,
RGB_SAI, RGB_SPI, KC_MPRV, _______,
RGB_SAD, RGB_SPD, KC_MPLY,
RGB_TOG, KC_MNXT, _______),
[_RESERVED1] = LAYOUT_numpad_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______),
[_RESERVED2] = LAYOUT_numpad_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______)
};

View File

@@ -0,0 +1 @@
SRC += factory/secondary/q0/test.c

View File

@@ -0,0 +1,53 @@
/* 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 QMK_KEYBOARD_H
enum layers { _BASE, _FN1, _RESERVED1, _RESERVED2 };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_numpad_6x4(
MO(_FN1), KC_ESC, KC_BSPACE, KC_TAB,
KC_NUMLOCK, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9,
KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3,
KC_P0, KC_PDOT, KC_PENT),
[_FN1] = LAYOUT_numpad_6x4(
_______, KC_MUTE, KC_VOLD, KC_VOLU,
RGB_MOD, RGB_VAI, RGB_HUI, KC_DEL,
RGB_RMOD, RGB_VAD, RGB_HUD,
RGB_SAI, RGB_SPI, KC_MPRV, _______,
RGB_SAD, RGB_SPD, KC_MPLY,
RGB_TOG, KC_MNXT, _______),
[_RESERVED1] = LAYOUT_numpad_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______),
[_RESERVED2] = LAYOUT_numpad_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______)
};

View File

@@ -0,0 +1,2 @@
VIA_ENABLE = yes
SRC += factory/secondary/q0/test.c

View File

@@ -0,0 +1,88 @@
/* 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 "quantum.h"
#ifdef RGB_MATRIX_ENABLE
const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL] = {
/* Refer to CKLED manual for these locations
* driver
* | R location
* | | G location
* | | | B location
* | | | | */
{0, F_5, D_5, E_5}, // 0
{0, I_5, G_5, H_5}, // 1
{0, L_5, J_5, K_5}, // 2
{0, C_5, A_5, B_5}, // 3
{0, F_4, D_4, E_4}, // 4
{0, I_4, G_4, H_4}, // 5
{0, L_4, J_4, K_4}, // 6
{0, C_4, A_4, B_4}, // 7
{0, F_6, D_6, E_6}, // 8
{0, I_6, G_6, H_6}, // 9
{0, L_6, J_6, K_6}, // 10
{0, F_3, D_3, E_3}, // 11
{0, I_3, G_3, H_3}, // 12
{0, L_3, J_3, K_3}, // 13
{0, C_6, A_6, B_6}, // 14
{0, F_2, D_2, E_2}, // 15
{0, I_2, G_2, H_2}, // 16
{0, L_2, J_2, K_2}, // 17
{0, F_1, D_1, E_1}, // 18
{0, L_1, J_1, K_1}, // 19
{0, C_2, A_2, B_2}, // 20
};
#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, 14 },
{ 11, 12, 13, __ },
{ 15, 16, 17, 20 },
{ 18, __, 19, __ }
},
{
// LED Index to Physical Position
{0,0}, {74,0}, {150,0}, {224,0},
{0,13}, {74,13}, {150,13}, {224,13},
{0,26}, {74,26}, {150,26},
{0,38}, {74,38}, {150,38}, {224,32},
{0,51}, {74,51}, {150,51},
{36,64}, {150,64}, {224,58},
},
{
// LED Index to Flag
1, 1, 1, 1,
9, 4, 4, 4,
4, 4, 4,
4, 4, 4, 4,
4, 4, 4,
4, 4, 1
}
};
#endif // RGB_MATRIX_ENABLE

View File

@@ -0,0 +1,38 @@
/* 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/>.
*/
#pragma once
#include "quantum.h"
#define XXX KC_NO
#define LAYOUT_numpad_6x4( \
K00, K01, K02, K03, \
K10, K11, K12, K13, \
K20, K21, K22, \
K30, K31, K32, K23, \
K40, K41, K42, \
K50, K52, K43 \
) \
{ \
{ K00, K01, K02, K03 }, \
{ K10, K11, K12, K13 }, \
{ K20, K21, K22, K23 }, \
{ K30, K31, K32, XXX }, \
{ K40, K41, K42, K43 }, \
{ K50, XXX, K52, XXX }, \
}

View File

@@ -0,0 +1 @@
# The base variant of the Keychron Q0

View File

@@ -0,0 +1,28 @@
# MCU name
MCU = STM32L432
# Bootloader selection
BOOTLOADER = stm32-dfu
# Build Options
# change yes to no to disable.
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Enable USB N-key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
DIP_SWITCH_ENABLE = no
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = CKLED2001
RAW_ENABLE = yes
LTO_ENABLE = yes
EEPROM_DRIVER = wear_leveling
WEAR_LEVELING_DRIVER = embedded_flash
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE

View File

@@ -0,0 +1,19 @@
# Keychron Q0
A customizable number keypad.
* Keyboard Maintainer: [Keychron](https://github.com/keychron)
* Hardware Supported: Keychron Q0
* Hardware Availability: [Keychron](https://www.keychron.com)
Make example for this keyboard (after setting up your build environment):
make keychron/q0/q0_stm32l432:default
Flashing example for this keyboard:
make keychron/q0/q0_stm32l432:default:flash
**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard.
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

View File

@@ -16,38 +16,18 @@
#pragma once
/* 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
/* NKRO */
#define FORCE_NKRO
/* Disable RGB lighting when PC is in suspend */
#define RGB_DISABLE_WHEN_USB_SUSPENDED
/* Allow VIA to edit lighting */
#ifdef VIA_ENABLE
#define VIA_QMK_RGBLIGHT_ENABLE
#endif
// RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see:
// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
@@ -96,8 +76,7 @@
#define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
// #define RGB_MATRIX_KEYPRESSES
/* Allow VIA to edit lighting */
#ifdef VIA_ENABLE
#define VIA_QMK_RGBLIGHT_ENABLE
#endif
/* Enable receive custom command from host */
#define RAW_HID_CMD 0xAB

View File

@@ -1,4 +1,4 @@
/* Copyright 2021 @ Grayson Carr
/* 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
@@ -16,13 +16,7 @@
#pragma once
// clang-format off
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
enum layers {
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
// clang-format on
#include_next <halconf.h>

View File

@@ -0,0 +1,179 @@
/* 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 "matrix.h"
#include "quantum.h"
// Pin connected to DS of 74HC595
#define DATA_PIN A7
// Pin connected to SH_CP of 74HC595
#define CLOCK_PIN B1
// Pin connected to ST_CP of 74HC595
#define LATCH_PIN B0
#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
#define ROWS_PER_HAND (MATRIX_ROWS)
/* 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 shiftOut(uint8_t dataOut) {
for (uint8_t i = 0; i < 8; i++) {
if (dataOut & 0x1) {
setPinOutput_writeHigh(DATA_PIN);
} else {
setPinOutput_writeLow(DATA_PIN);
}
dataOut = dataOut >> 1;
setPinOutput_writeHigh(CLOCK_PIN);
setPinOutput_writeLow(CLOCK_PIN);
}
setPinOutput_writeHigh(LATCH_PIN);
setPinOutput_writeLow(LATCH_PIN);
}
static bool select_col(uint8_t col) {
pin_t pin = col_pins[col];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
return true;
} else {
shiftOut(~(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) {
#ifdef MATRIX_UNSELECT_DRIVE_HIGH
setPinOutput_writeHigh(pin);
#else
setPinInputHigh_atomic(pin);
#endif
} else {
shiftOut(0xFF);
}
}
static void unselect_cols(void) {
// unselect column pins
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
#ifdef MATRIX_UNSELECT_DRIVE_HIGH
setPinOutput_writeHigh(pin);
#else
setPinInputHigh_atomic(pin);
#endif
}
}
// unselect Shift Register
shiftOut(0xFF);
}
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]);
}
}
}
static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) {
bool key_pressed = false;
// Select col
if (!select_col(current_col)) { // select col
return; // skip NO_PIN col
}
matrix_output_select_delay();
// For each row...
for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) {
// Check row pin state
if (readMatrixPin(row_pins[row_index]) == 0) {
// Pin LO, set col bit
current_matrix[row_index] |= row_shifter;
key_pressed = true;
} else {
// Pin HI, clear col bit
current_matrix[row_index] &= ~row_shifter;
}
}
// 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
matrix_row_t row_shifter = MATRIX_ROW_SHIFTER;
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) {
matrix_read_rows_on_col(curr_matrix, current_col, row_shifter);
}
bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0;
if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix));
return changed;
}

View File

@@ -1,4 +1,4 @@
/* Copyright 2021 @ Grayson Carr
/* 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
@@ -16,13 +16,7 @@
#pragma once
// clang-format off
#include_next <mcuconf.h>
enum layers {
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
// clang-format on
#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 TRUE

View File

@@ -16,15 +16,7 @@
#include "q1.h"
const matrix_row_t matrix_mask[] = {
0b0111111111111101,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
};
#ifdef DIP_SWITCH_ENABLE
bool dip_switch_update_kb(uint8_t index, bool active) {
if (!dip_switch_update_user(index, active)) { return false;}
@@ -33,3 +25,78 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
}
return true;
}
#endif // DIP_SWITCH_ENABLE
#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX)
#define CAPS_LOCK_MAX_BRIGHTNESS 0xFF
#ifdef RGB_MATRIX_MAXIMUM_BRIGHTNESS
#undef CAPS_LOCK_MAX_BRIGHTNESS
#define CAPS_LOCK_MAX_BRIGHTNESS RGB_MATRIX_MAXIMUM_BRIGHTNESS
#endif
#define CAPS_LOCK_VAL_STEP 8
#ifdef RGB_MATRIX_VAL_STEP
#undef CAPS_LOCK_VAL_STEP
#define CAPS_LOCK_VAL_STEP RGB_MATRIX_VAL_STEP
#endif
extern void rgb_matrix_update_pwm_buffers(void);
static uint8_t light_brightness_get(void) {
uint8_t value = rgb_matrix_get_val();
if (value < CAPS_LOCK_VAL_STEP) {
value = CAPS_LOCK_VAL_STEP;
} else if (value < (CAPS_LOCK_MAX_BRIGHTNESS - CAPS_LOCK_VAL_STEP)) {
value += CAPS_LOCK_VAL_STEP; // one step more than current brightness
} else {
value = CAPS_LOCK_MAX_BRIGHTNESS;
}
return value;
}
void rgb_matrix_indicators_kb(void) {
if (host_keyboard_led_state().caps_lock) {
uint8_t v = light_brightness_get();
rgb_matrix_set_color(CAPS_LOCK_LED_INDEX, v, v, v); // white, with the adjusted brightness
}
}
void rgb_matrix_indicators_none_kb(void) {
rgb_matrix_indicators_kb();
rgb_matrix_update_pwm_buffers();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (rgb_matrix_is_enabled()
# if defined(ENABLE_RGB_MATRIX_RAINDROPS)
&& (rgb_matrix_get_mode() != RGB_MATRIX_RAINDROPS)
# endif
# if defined(ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS)
&& (rgb_matrix_get_mode() != RGB_MATRIX_JELLYBEAN_RAINDROPS)
# endif
# if defined(ENABLE_RGB_MATRIX_PIXEL_RAIN)
&& (rgb_matrix_get_mode() != RGB_MATRIX_PIXEL_RAIN)
# endif
) {
return res;
}
if (res) {
if (led_state.caps_lock) {
uint8_t v = light_brightness_get();
rgb_matrix_set_color(CAPS_LOCK_LED_INDEX, v, v, v);
} else {
rgb_matrix_set_color(CAPS_LOCK_LED_INDEX, 0, 0, 0);
}
rgb_matrix_update_pwm_buffers();
}
return res;
}
#endif // CAPS_LOCK_LED_INDEX

View File

@@ -18,10 +18,24 @@
#include "quantum.h"
#if defined(KEYBOARD_keychron_q1_rev_0100)
# include "rev_0100.h"
#elif defined(KEYBOARD_keychron_q1_rev_0101)
# include "rev_0101.h"
#elif defined(KEYBOARD_keychron_q1_rev_0102)
# include "rev_0102.h"
#if defined(KEYBOARD_keychron_q1_q1_ansi_atmega32u4)
# include "q1_ansi_atmega32u4.h"
#elif defined(KEYBOARD_keychron_q1_q1_ansi_atmega32u4_ec11)
# include "q1_ansi_atmega32u4_ec11.h"
#elif defined(KEYBOARD_keychron_q1_q1_iso_atmega32u4)
# include "q1_iso_atmega32u4.h"
#elif defined(KEYBOARD_keychron_q1_q1_iso_atmega32u4_ec11)
# include "q1_iso_atmega32u4_ec11.h"
#elif defined(KEYBOARD_keychron_q1_q1_ansi_stm32l432)
# include "q1_ansi_stm32l432.h"
#elif defined(KEYBOARD_keychron_q1_q1_ansi_stm32l432_ec11)
# include "q1_ansi_stm32l432_ec11.h"
#elif defined(KEYBOARD_keychron_q1_q1_iso_stm32l432)
# include "q1_iso_stm32l432.h"
#elif defined(KEYBOARD_keychron_q1_q1_iso_stm32l432_ec11)
# include "q1_iso_stm32l432_ec11.h"
#elif defined(KEYBOARD_keychron_q1_q1_jis_stm32l432)
# include "q1_jis_stm32l432.h"
#elif defined(KEYBOARD_keychron_q1_q1_jis_stm32l432_ec11)
# include "q1_jis_stm32l432_ec11.h"
#endif

View File

@@ -16,18 +16,26 @@
#pragma once
/* 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)
/* Encoder used pins */
#define ENCODERS_PAD_A { E6 }
#define ENCODERS_PAD_B { B7 }
/* Specifies the number of pulses the encoder registers between each detent */
#define ENCODER_RESOLUTION 4
/* Enable caps-lock LED */
#define CAPS_LOCK_LED_INDEX 45

View File

@@ -0,0 +1,104 @@
{
"keyboard_name": "Keychron Q1",
"manufacturer": "Keychron",
"url": "https://github.com/Keychron",
"maintainer": "lalalademaxiya1",
"usb": {
"vid": "0x3434",
"pid": "0x0100",
"device_version": "1.0.9"
},
"layouts": {
"LAYOUT_ansi_82": {
"layout": [
{"label":"Esc", "x":0, "y":0},
{"label":"F1", "x":1.25, "y":0},
{"label":"F2", "x":2.25, "y":0},
{"label":"F3", "x":3.25, "y":0},
{"label":"F4", "x":4.25, "y":0},
{"label":"F5", "x":5.5, "y":0},
{"label":"F6", "x":6.5, "y":0},
{"label":"F7", "x":7.5, "y":0},
{"label":"F8", "x":8.5, "y":0},
{"label":"F9", "x":9.75, "y":0},
{"label":"F10", "x":10.75, "y":0},
{"label":"F11", "x":11.75, "y":0},
{"label":"F12", "x":12.75, "y":0},
{"label":"Delete", "x":14, "y":0},
{"label":"Insert", "x":15.25, "y":0},
{"label":"`~", "x":0, "y":1},
{"label":"1!", "x":1, "y":1},
{"label":"2@", "x":2, "y":1},
{"label":"3#", "x":3, "y":1},
{"label":"4$", "x":4, "y":1},
{"label":"5%", "x":5, "y":1},
{"label":"6^", "x":6, "y":1},
{"label":"7&", "x":7, "y":1},
{"label":"8*", "x":8, "y":1},
{"label":"9(", "x":9, "y":1},
{"label":"0)", "x":10, "y":1},
{"label":"-_", "x":11, "y":1},
{"label":"=+", "x":12, "y":1},
{"label":"Backspace", "x":13, "y":1, "w":2},
{"label":"Page Up", "x":15.25, "y":1},
{"label":"Tab", "x":0, "y":2, "w":1.5},
{"label":"Q", "x":1.5, "y":2},
{"label":"W", "x":2.5, "y":2},
{"label":"E", "x":3.5, "y":2},
{"label":"R", "x":4.5, "y":2},
{"label":"T", "x":5.5, "y":2},
{"label":"Y", "x":6.5, "y":2},
{"label":"U", "x":7.5, "y":2},
{"label":"I", "x":8.5, "y":2},
{"label":"O", "x":9.5, "y":2},
{"label":"P", "x":10.5, "y":2},
{"label":"[{", "x":11.5, "y":2},
{"label":"]}", "x":12.5, "y":2},
{"label":"\\|", "x":13.5, "y":2, "w":1.5},
{"label":"Page Down", "x":15.25, "y":2},
{"label":"Caps Lock", "x":0, "y":3, "w":1.75},
{"label":"A", "x":1.75, "y":3},
{"label":"S", "x":2.75, "y":3},
{"label":"D", "x":3.75, "y":3},
{"label":"F", "x":4.75, "y":3},
{"label":"G", "x":5.75, "y":3},
{"label":"H", "x":6.75, "y":3},
{"label":"J", "x":7.75, "y":3},
{"label":"K", "x":8.75, "y":3},
{"label":"L", "x":9.75, "y":3},
{"label":";:", "x":10.75, "y":3},
{"label":"'\"", "x":11.75, "y":3},
{"label":"Enter", "x":12.75, "y":3, "w":2.25},
{"label":"Home", "x":15.25, "y":3},
{"label":"Shift", "x":0, "y":4, "w":2.25},
{"label":"Z", "x":2.25, "y":4},
{"label":"X", "x":3.25, "y":4},
{"label":"C", "x":4.25, "y":4},
{"label":"V", "x":5.25, "y":4},
{"label":"B", "x":6.25, "y":4},
{"label":"N", "x":7.25, "y":4},
{"label":"M", "x":8.25, "y":4},
{"label":",<", "x":9.25, "y":4},
{"label":".>", "x":10.25, "y":4},
{"label":"/?", "x":11.25, "y":4},
{"label":"Shift", "x":12.25, "y":4, "w":1.75},
{"label":"Up", "x":14.25, "y":4.25},
{"label":"Ctrl", "x":0, "y":5, "w":1.25},
{"label":"Win", "x":1.25, "y":5, "w":1.25},
{"label":"Alt", "x":2.5, "y":5, "w":1.25},
{"label":"Space","x":3.75, "y":5, "w":6.25},
{"label":"Alt", "x":10, "y":5},
{"label":"Fn", "x":11, "y":5},
{"label":"Ctrl", "x":12, "y":5},
{"label":"Left", "x":13.25, "y":5.25},
{"label":"Down", "x":14.25, "y":5.25},
{"label":"Right", "x":15.25, "y":5.25}
]
}
}
}

View File

@@ -1,4 +1,4 @@
/* Copyright 2022 @ Teimor Epstein
/* 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
@@ -15,64 +15,74 @@
*/
#include QMK_KEYBOARD_H
#include "keymap_user.h"
#ifdef RGB_MATRIX_ENABLE
# include "rgb_matrix_user.h"
#endif
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = USER00,
KC_MISSION_CONTROL = SAFE_RANGE,
KC_LAUNCHPAD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define TG_NKRO MAGIC_TOGGLE_NKRO
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_END,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
KC_LGMAC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_MACFN, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_ansi_82(
_______, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MACPS, KC_INS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, _______,
KC_CAPS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, KC_LMAC, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_END,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
KC_LGWIN, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_WINFN, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_ansi_82(
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_INS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, _______,
KC_CAPS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
};
// clang-format on
void matrix_init_user(void) {
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_init_user();
#endif
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
@@ -89,7 +99,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1 @@
SRC += factory/major/test.c

View File

@@ -0,0 +1,133 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = USER00,
KC_LAUNCHPAD,
KC_LOPTN,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
static uint8_t mac_keycode[4] = { KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_ansi_82(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_ansi_82(
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
};
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1,2 @@
VIA_ENABLE = yes
SRC += factory/major/test.c

View File

@@ -16,6 +16,16 @@
#include "quantum.h"
const matrix_row_t matrix_mask[] = {
0b111111111111101,
0b111111111111111,
0b111111111111111,
0b111111111111111,
0b111111111111111,
0b111111111111111,
};
#ifdef RGB_MATRIX_ENABLE
const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
@@ -114,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,52},
{2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {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, 4, 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

View File

@@ -0,0 +1,37 @@
/* 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/>.
*/
#pragma once
#include "quantum.h"
#define xxx KC_NO
#define LAYOUT_ansi_82( \
K00, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K4E, K0E, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K3C, \
K50, K51, K52, K56, K5A, K5B, K5C, K5D, K4C, K5E \
) { \
{ K00, xxx, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
{ K40, xxx, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E }, \
{ K50, K51, K52, xxx, xxx, xxx, K56, xxx, xxx, xxx, K5A, K5B, K5C, K5D, K5E } \
}

View File

@@ -8,7 +8,7 @@ BOOTLOADER = atmel-dfu
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
@@ -19,3 +19,6 @@ AUDIO_ENABLE = no # Audio output
DIP_SWITCH_ENABLE = yes
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3733
RAW_ENABLE = yes
LTO_ENABLE = yes

View File

@@ -0,0 +1,50 @@
/* 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/>.
*/
#pragma once
/* 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)
/* Encoder Configuration */
#define ENCODERS_PAD_A { E6 }
#define ENCODERS_PAD_B { B7 }
#define ENCODER_RESOLUTION 4
#define ENCODER_DEFAULT_POS 0x3
#define AVR_USE_INT
/* Enable caps-lock LED */
#define CAPS_LOCK_LED_INDEX 45

View File

@@ -1,12 +1,12 @@
{
"keyboard_name": "Q1",
"keyboard_name": "Keychron Q1",
"manufacturer": "Keychron",
"url": "https://github.com/Keychron",
"maintainer": "lalalademaxiya1",
"usb": {
"vid": "0x3434",
"pid": "0x0101",
"device_version": "1.0.0"
"device_version": "1.0.2"
},
"layouts": {
"LAYOUT_ansi_82": {

View File

@@ -16,57 +16,73 @@
#include QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = USER00,
KC_MISSION_CONTROL = SAFE_RANGE,
KC_LAUNCHPAD,
KC_TASK,
KC_FLXP
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_ansi_82(
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_ansi_82(
KC_TRNS, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
};
// clang-format off
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
@@ -84,24 +100,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false; // Skip all further processing of this key
case KC_TASK:
if (record->event.pressed) {
register_code(KC_LWIN);
register_code(KC_TAB);
} else {
unregister_code(KC_LWIN);
unregister_code(KC_TAB);
}
return false; // Skip all further processing of this key
case KC_FLXP:
if (record->event.pressed) {
register_code(KC_LWIN);
register_code(KC_E);
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
unregister_code(KC_LWIN);
unregister_code(KC_E);
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1 @@
SRC += factory/major/test.c

View File

@@ -0,0 +1,179 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = USER00,
KC_LAUNCHPAD,
KC_LOPTN,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
static uint8_t mac_keycode[4] = { KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_all(
KC_VOLD, KC_VOLU,
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_all(
RGB_VAD, RGB_VAI,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_all(
KC_VOLD, KC_VOLU,
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_all(
RGB_VAD, RGB_VAI,
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
};
// clang-format on
#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
#define ENCODERS 1
static uint8_t encoder_state[ENCODERS] = {0};
static keypos_t encoder_cw[ENCODERS] = {{ 8, 5 }};
static keypos_t encoder_ccw[ENCODERS] = {{ 7, 5 }};
void encoder_action_unregister(void) {
for (int index = 0; index < ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = (timer_read() | 1)
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = (timer_read() | 1)
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_user(void) {
encoder_action_unregister();
}
bool encoder_update_user(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
return false;
};
#endif
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1,2 @@
VIA_ENABLE = yes
SRC += factory/major/test.c

View File

@@ -14,9 +14,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <avr/interrupt.h>
#include <avr/io.h>
#include "quantum.h"
const matrix_row_t matrix_mask[] = {
0b111111111111101,
0b111111111111111,
0b111111111111111,
0b111111111111111,
0b111111111111111,
0b111111111111111,
};
#ifdef RGB_MATRIX_ENABLE
const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
@@ -113,44 +125,68 @@ 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, 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}, {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}, {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,52},
{2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {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, 4, 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) {
if (clockwise) {
tap_code(KC_VOLU);
tap_code_delay(KC_VOLU, TAP_CODE_DELAY);
} else {
tap_code(KC_VOLD);
tap_code_delay(KC_VOLD, TAP_CODE_DELAY);
}
}
return true;
}
# if defined(AVR_USE_INT)
void keyboard_post_init_kb(void) {
PCMSK0 |= (1 << 7);
PCICR |= (1 << PCIE0);
sei();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
ISR(PCINT0_vect) {
encoder_insert_state(0);
}
# endif
#endif

View File

@@ -0,0 +1,53 @@
/* 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/>.
*/
#pragma once
#include "quantum.h"
#define xxx KC_NO
#define LAYOUT_all( \
K57, K58, \
K00, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K4E, K0E, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K3C, \
K50, K51, K52, K56, K5A, K5B, K5C, K5D, K4C, K5E \
) { \
{ K00, xxx, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
{ K40, xxx, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E }, \
{ K50, K51, K52, xxx, xxx, xxx, K56, K57, K58, xxx, K5A, K5B, K5C, K5D, K5E } \
}
#define LAYOUT_ansi_82( \
K00, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K4E, K0E, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K3C, \
K50, K51, K52, K56, K5A, K5B, K5C, K5D, K4C, K5E \
) { \
{ K00, xxx, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
{ K40, xxx, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E }, \
{ K50, K51, K52, xxx, xxx, xxx, K56, xxx, xxx, xxx, K5A, K5B, K5C, K5D, K5E } \
}

View File

@@ -0,0 +1,5 @@
# The ANSI variant of the Keychron Q1
- Enable EC11 rotary encoder.
- Turn colckwise to increase volume and turn anti-colckwise to decrease volume.
- Press top right key pushbutton to mute.

View File

@@ -8,7 +8,7 @@ BOOTLOADER = atmel-dfu
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
@@ -17,6 +17,10 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes # Enable Encoder
ENCODER_MAP_ENABLE = no
DIP_SWITCH_ENABLE = yes
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3733
RAW_ENABLE = yes
LTO_ENABLE = yes

View File

@@ -0,0 +1,51 @@
/* 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/>.
*/
#pragma once
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 16
/* key matrix pins */
#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 }
#define MATRIX_COL_PINS { C14, C15, A0, A1, A2, A3, A4, A5, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { {5,4} }
/* RGB Matrix Driver Configuration */
#define DRIVER_COUNT 2
#define DRIVER_ADDR_1 0b1110111
#define DRIVER_ADDR_2 0b1110100
/* RGB Matrix Configuration */
#define DRIVER_1_LED_TOTAL 45
#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
#define CKLED2001_CURRENT_TUNE \
{ 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50 }
/* EEPROM Driver Configuration */
#define WEAR_LEVELING_LOGICAL_SIZE 2048
#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2)
/* Enable caps-lock LED */
#define CAPS_LOCK_LED_INDEX 45

View File

@@ -0,0 +1,104 @@
{
"keyboard_name": "Keychron Q1",
"manufacturer": "Keychron",
"url": "https://github.com/Keychron",
"maintainer": "lalalademaxiya1",
"usb": {
"vid": "0x3434",
"pid": "0x0106",
"device_version": "2.0.4"
},
"layouts": {
"LAYOUT_ansi_82": {
"layout": [
{"label":"Esc", "x":0, "y":0},
{"label":"F1", "x":1.25, "y":0},
{"label":"F2", "x":2.25, "y":0},
{"label":"F3", "x":3.25, "y":0},
{"label":"F4", "x":4.25, "y":0},
{"label":"F5", "x":5.5, "y":0},
{"label":"F6", "x":6.5, "y":0},
{"label":"F7", "x":7.5, "y":0},
{"label":"F8", "x":8.5, "y":0},
{"label":"F9", "x":9.75, "y":0},
{"label":"F10", "x":10.75, "y":0},
{"label":"F11", "x":11.75, "y":0},
{"label":"F12", "x":12.75, "y":0},
{"label":"Delete", "x":14, "y":0},
{"label":"Insert", "x":15.25, "y":0},
{"label":"`~", "x":0, "y":1},
{"label":"1!", "x":1, "y":1},
{"label":"2@", "x":2, "y":1},
{"label":"3#", "x":3, "y":1},
{"label":"4$", "x":4, "y":1},
{"label":"5%", "x":5, "y":1},
{"label":"6^", "x":6, "y":1},
{"label":"7&", "x":7, "y":1},
{"label":"8*", "x":8, "y":1},
{"label":"9(", "x":9, "y":1},
{"label":"0)", "x":10, "y":1},
{"label":"-_", "x":11, "y":1},
{"label":"=+", "x":12, "y":1},
{"label":"Backspace", "x":13, "y":1, "w":2},
{"label":"Page Up", "x":15.25, "y":1},
{"label":"Tab", "x":0, "y":2, "w":1.5},
{"label":"Q", "x":1.5, "y":2},
{"label":"W", "x":2.5, "y":2},
{"label":"E", "x":3.5, "y":2},
{"label":"R", "x":4.5, "y":2},
{"label":"T", "x":5.5, "y":2},
{"label":"Y", "x":6.5, "y":2},
{"label":"U", "x":7.5, "y":2},
{"label":"I", "x":8.5, "y":2},
{"label":"O", "x":9.5, "y":2},
{"label":"P", "x":10.5, "y":2},
{"label":"[{", "x":11.5, "y":2},
{"label":"]}", "x":12.5, "y":2},
{"label":"\\|", "x":13.5, "y":2, "w":1.5},
{"label":"Page Down", "x":15.25, "y":2},
{"label":"Caps Lock", "x":0, "y":3, "w":1.75},
{"label":"A", "x":1.75, "y":3},
{"label":"S", "x":2.75, "y":3},
{"label":"D", "x":3.75, "y":3},
{"label":"F", "x":4.75, "y":3},
{"label":"G", "x":5.75, "y":3},
{"label":"H", "x":6.75, "y":3},
{"label":"J", "x":7.75, "y":3},
{"label":"K", "x":8.75, "y":3},
{"label":"L", "x":9.75, "y":3},
{"label":";:", "x":10.75, "y":3},
{"label":"'\"", "x":11.75, "y":3},
{"label":"Enter", "x":12.75, "y":3, "w":2.25},
{"label":"Home", "x":15.25, "y":3},
{"label":"Shift", "x":0, "y":4, "w":2.25},
{"label":"Z", "x":2.25, "y":4},
{"label":"X", "x":3.25, "y":4},
{"label":"C", "x":4.25, "y":4},
{"label":"V", "x":5.25, "y":4},
{"label":"B", "x":6.25, "y":4},
{"label":"N", "x":7.25, "y":4},
{"label":"M", "x":8.25, "y":4},
{"label":",<", "x":9.25, "y":4},
{"label":".>", "x":10.25, "y":4},
{"label":"/?", "x":11.25, "y":4},
{"label":"Shift", "x":12.25, "y":4, "w":1.75},
{"label":"Up", "x":14.25, "y":4.25},
{"label":"Ctrl", "x":0, "y":5, "w":1.25},
{"label":"Win", "x":1.25, "y":5, "w":1.25},
{"label":"Alt", "x":2.5, "y":5, "w":1.25},
{"label":"Space","x":3.75, "y":5, "w":6.25},
{"label":"Alt", "x":10, "y":5},
{"label":"Fn", "x":11, "y":5},
{"label":"Ctrl", "x":12, "y":5},
{"label":"Left", "x":13.25, "y":5.25},
{"label":"Down", "x":14.25, "y":5.25},
{"label":"Right", "x":15.25, "y":5.25}
]
}
}
}

View File

@@ -0,0 +1,117 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = SAFE_RANGE,
KC_LAUNCHPAD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_ansi_82(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_ansi_82(
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
};
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1 @@
SRC += factory/major/test.c

View File

@@ -0,0 +1,133 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = USER00,
KC_LAUNCHPAD,
KC_LOPTN,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
static uint8_t mac_keycode[4] = { KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_ansi_82(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_ansi_82(
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
};
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1,2 @@
VIA_ENABLE = yes
SRC += factory/major/test.c

View File

@@ -0,0 +1,158 @@
/* 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 "quantum.h"
const matrix_row_t matrix_mask[] = {
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111101111,
};
#ifdef RGB_MATRIX_ENABLE
const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
* | | G location
* | | | B location
* | | | | */
{0, C_1, A_1, B_1},
{0, C_2, A_2, B_2},
{0, C_3, A_3, B_3},
{0, C_4, A_4, B_4},
{0, C_5, A_5, B_5},
{0, C_6, A_6, B_6},
{0, C_7, A_7, B_7},
{0, C_8, A_8, B_8},
{0, C_9, A_9, B_9},
{0, C_10, A_10, B_10},
{0, C_11, A_11, B_11},
{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, I_1, G_1, H_1},
{0, I_2, G_2, H_2},
{0, I_3, G_3, H_3},
{0, I_4, G_4, H_4},
{0, I_5, G_5, H_5},
{0, I_6, G_6, H_6},
{0, I_7, G_7, H_7},
{0, I_8, G_8, H_8},
{0, I_9, G_9, H_9},
{0, I_10, G_10, H_10},
{0, I_11, G_11, H_11},
{0, I_12, G_12, H_12},
{0, I_13, G_13, H_13},
{0, I_14, G_14, H_14},
{0, I_16, G_16, H_16},
{0, F_1, D_1, E_1},
{0, F_2, D_2, E_2},
{0, F_3, D_3, E_3},
{0, F_4, D_4, E_4},
{0, F_5, D_5, E_5},
{0, F_6, D_6, E_6},
{0, F_7, D_7, E_7},
{0, F_8, D_8, E_8},
{0, F_9, D_9, E_9},
{0, F_10, D_10, E_10},
{0, F_11, D_11, E_11},
{0, F_12, D_12, E_12},
{0, F_13, D_13, E_13},
{0, F_14, D_14, E_14},
{0, F_16, D_16, E_16},
{1, I_1, G_1, H_1},
{1, I_2, G_2, H_2},
{1, I_3, G_3, H_3},
{1, I_4, G_4, H_4},
{1, I_5, G_5, H_5},
{1, I_6, G_6, H_6},
{1, I_7, G_7, H_7},
{1, I_8, G_8, H_8},
{1, I_9, G_9, H_9},
{1, I_10, G_10, H_10},
{1, I_11, G_11, H_11},
{1, I_12, G_12, H_12},
{1, I_14, G_14, H_14},
{1, I_16, G_16, H_16},
{1, F_1, D_1, E_1},
{1, F_3, D_3, E_3},
{1, F_4, D_4, E_4},
{1, F_5, D_5, E_5},
{1, F_6, D_6, E_6},
{1, F_7, D_7, E_7},
{1, F_8, D_8, E_8},
{1, F_9, D_9, E_9},
{1, F_10, D_10, E_10},
{1, F_11, D_11, E_11},
{1, F_12, D_12, E_12},
{1, F_14, D_14, E_14},
{1, F_15, D_15, E_15},
{1, C_1, A_1, B_1},
{1, C_2, A_2, B_2},
{1, C_3, A_3, B_3},
{1, C_7, A_7, B_7},
{1, C_11, A_11, B_11},
{1, C_12, A_12, B_12},
{1, C_13, A_13, B_13},
{1, C_14, A_14, B_14},
{1, C_15, A_15, B_15},
{1, C_16, A_16, B_16},
};
#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, 13, __, 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, __, 57, __, 58 },
{ 59, __, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, __, 70, 71, __ },
{ 72, 73, 74, __, __, __, 75, __, __, __, 76, 77, 78, 79, 80, 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,52},
{2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {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, 4, 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

View File

@@ -0,0 +1,37 @@
/* 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/>.
*/
#pragma once
#include "quantum.h"
#define XXX KC_NO
#define LAYOUT_ansi_82( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0F, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1F, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2F, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3F, \
K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K4E, \
K50, K51, K52, K56, K5A, K5B, K5C, K5D, K5E, K5F \
) { \
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, XXX, K0F }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, XXX, K1F }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, XXX, K2F }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, XXX, K3F }, \
{ K40, XXX, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, XXX, K4D, K4E, XXX }, \
{ K50, K51, K52, XXX, XXX, XXX, K56, XXX, XXX, XXX, K5A, K5B, K5C, K5D, K5E, K5F } \
}

View File

@@ -0,0 +1 @@
# The ANSI variant of the Keychron Q1

View File

@@ -0,0 +1,33 @@
# MCU name
MCU = STM32L432
# Bootloader selection
BOOTLOADER = stm32-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Enable USB N-key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
DIP_SWITCH_ENABLE = yes
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = CKLED2001
RAW_ENABLE = yes
LTO_ENABLE = yes
EEPROM_DRIVER = wear_leveling
WEAR_LEVELING_DRIVER = embedded_flash
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
# custom matrix setup
CUSTOM_MATRIX = lite
SRC += matrix.c

View File

@@ -0,0 +1,57 @@
/* 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/>.
*/
#pragma once
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 16
/* key matrix pins */
#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 }
#define MATRIX_COL_PINS { C14, C15, A0, A1, A2, A3, A4, A5, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { {5,4} }
/* RGB Matrix Driver Configuration */
#define DRIVER_COUNT 2
#define DRIVER_ADDR_1 0b1110111
#define DRIVER_ADDR_2 0b1110100
/* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */
#define PHASE_CHANNEL MSKPHASE_9CHANNEL
#define CKLED2001_CURRENT_TUNE \
{ 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50 }
/* RGB Matrix Configuration */
#define DRIVER_1_LED_TOTAL 45
#define DRIVER_2_LED_TOTAL 37
#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
/* EEPROM Driver Configuration */
#define WEAR_LEVELING_LOGICAL_SIZE 2048
#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2)
/* Encoder Configuration */
#define ENCODERS_PAD_A { A10 }
#define ENCODERS_PAD_B { A8 }
#define ENCODER_RESOLUTION 4
#define ENCODER_DEFAULT_POS 0x3
/* Enable caps-lock LED */
#define CAPS_LOCK_LED_INDEX 45

View File

@@ -0,0 +1,197 @@
{
"keyboard_name": "Keychron Q1",
"manufacturer": "Keychron",
"url": "https://github.com/Keychron",
"maintainer": "lalalademaxiya1",
"usb": {
"vid": "0x3434",
"pid": "0x0107",
"device_version": "2.0.5"
},
"layouts": {
"LAYOUT_ansi_82": {
"layout": [
{"label":"Esc", "x":0, "y":0},
{"label":"F1", "x":1.25, "y":0},
{"label":"F2", "x":2.25, "y":0},
{"label":"F3", "x":3.25, "y":0},
{"label":"F4", "x":4.25, "y":0},
{"label":"F5", "x":5.5, "y":0},
{"label":"F6", "x":6.5, "y":0},
{"label":"F7", "x":7.5, "y":0},
{"label":"F8", "x":8.5, "y":0},
{"label":"F9", "x":9.75, "y":0},
{"label":"F10", "x":10.75, "y":0},
{"label":"F11", "x":11.75, "y":0},
{"label":"F12", "x":12.75, "y":0},
{"label":"Delete", "x":14, "y":0},
{"label":"Mute", "x":15.25, "y":0},
{"label":"`~", "x":0, "y":1.25},
{"label":"1!", "x":1, "y":1.25},
{"label":"2@", "x":2, "y":1.25},
{"label":"3#", "x":3, "y":1.25},
{"label":"4$", "x":4, "y":1.25},
{"label":"5%", "x":5, "y":1.25},
{"label":"6^", "x":6, "y":1.25},
{"label":"7&", "x":7, "y":1.25},
{"label":"8*", "x":8, "y":1.25},
{"label":"9(", "x":9, "y":1.25},
{"label":"0)", "x":10, "y":1.25},
{"label":"-_", "x":11, "y":1.25},
{"label":"=+", "x":12, "y":1.25},
{"label":"Backspace", "x":13, "y":1.25, "w":2},
{"label":"Page Up", "x":15.25, "y":1.25},
{"label":"Tab", "x":0, "y":2.25, "w":1.5},
{"label":"Q", "x":1.5, "y":2.25},
{"label":"W", "x":2.5, "y":2.25},
{"label":"E", "x":3.5, "y":2.25},
{"label":"R", "x":4.5, "y":2.25},
{"label":"T", "x":5.5, "y":2.25},
{"label":"Y", "x":6.5, "y":2.25},
{"label":"U", "x":7.5, "y":2.25},
{"label":"I", "x":8.5, "y":2.25},
{"label":"O", "x":9.5, "y":2.25},
{"label":"P", "x":10.5, "y":2.25},
{"label":"[{", "x":11.5, "y":2.25},
{"label":"]}", "x":12.5, "y":2.25},
{"label":"\\|", "x":13.5, "y":2.25, "w":1.5},
{"label":"Page Down", "x":15.25, "y":2.25},
{"label":"Caps Lock", "x":0, "y":3.25, "w":1.75},
{"label":"A", "x":1.75, "y":3.25},
{"label":"S", "x":2.75, "y":3.25},
{"label":"D", "x":3.75, "y":3.25},
{"label":"F", "x":4.75, "y":3.25},
{"label":"G", "x":5.75, "y":3.25},
{"label":"H", "x":6.75, "y":3.25},
{"label":"J", "x":7.75, "y":3.25},
{"label":"K", "x":8.75, "y":3.25},
{"label":"L", "x":9.75, "y":3.25},
{"label":";:", "x":10.75, "y":3.25},
{"label":"'\"", "x":11.75, "y":3.25},
{"label":"Enter", "x":12.75, "y":3.25, "w":2.25},
{"label":"Home", "x":15.25, "y":3.25},
{"label":"Shift", "x":0, "y":4.25, "w":2.25},
{"label":"Z", "x":2.25, "y":4.25},
{"label":"X", "x":3.25, "y":4.25},
{"label":"C", "x":4.25, "y":4.25},
{"label":"V", "x":5.25, "y":4.25},
{"label":"B", "x":6.25, "y":4.25},
{"label":"N", "x":7.25, "y":4.25},
{"label":"M", "x":8.25, "y":4.25},
{"label":",<", "x":9.25, "y":4.25},
{"label":".>", "x":10.25, "y":4.25},
{"label":"/?", "x":11.25, "y":4.25},
{"label":"Shift", "x":12.25, "y":4.25, "w":1.75},
{"label":"Up", "x":14.25, "y":4.5},
{"label":"Ctrl", "x":0, "y":5.25, "w":1.25},
{"label":"Win", "x":1.25, "y":5.25, "w":1.25},
{"label":"Alt", "x":2.5, "y":5.25, "w":1.25},
{"label":"Space", "x":3.75, "y":5.25, "w":6.25},
{"label":"Alt", "x":10, "y":5.25},
{"label":"Fn", "x":11, "y":5.25},
{"label":"Ctrl", "x":12, "y":5.25},
{"label":"Left", "x":13.25, "y":5.5},
{"label":"Down", "x":14.25, "y":5.5},
{"label":"Right", "x":15.25, "y":5.5}
]
},
"LAYOUT_all": {
"layout": [
{"label":"Esc", "x":0, "y":0.5},
{"label":"F1", "x":1.25, "y":0.5},
{"label":"F2", "x":2.25, "y":0.5},
{"label":"F3", "x":3.25, "y":0.5},
{"label":"F4", "x":4.25, "y":0.5},
{"label":"F5", "x":5.5, "y":0.5},
{"label":"F6", "x":6.5, "y":0.5},
{"label":"F7", "x":7.5, "y":0.5},
{"label":"F8", "x":8.5, "y":0.5},
{"label":"F9", "x":9.75, "y":0.5},
{"label":"F10", "x":10.75, "y":0.5},
{"label":"F11", "x":11.75, "y":0.5},
{"label":"F12", "x":12.75, "y":0.5},
{"label":"Delete", "x":14, "y":0.5},
{"label":"CCW", "x":15.15, "y":0, "w":0.6, "h":0.5},
{"label":"Mute", "x":15.25, "y":0.5},
{"label":"CW", "x":15.75, "y":0, "w":0.6, "h":0.5},
{"label":"`~", "x":0, "y":1.75},
{"label":"1!", "x":1, "y":1.75},
{"label":"2@", "x":2, "y":1.75},
{"label":"3#", "x":3, "y":1.75},
{"label":"4$", "x":4, "y":1.75},
{"label":"5%", "x":5, "y":1.75},
{"label":"6^", "x":6, "y":1.75},
{"label":"7&", "x":7, "y":1.75},
{"label":"8*", "x":8, "y":1.75},
{"label":"9(", "x":9, "y":1.75},
{"label":"0)", "x":10, "y":1.75},
{"label":"-_", "x":11, "y":1.75},
{"label":"=+", "x":12, "y":1.75},
{"label":"Backspace", "x":13, "y":1.75, "w":2},
{"label":"Page Up", "x":15.25, "y":1.75},
{"label":"Tab", "x":0, "y":2.75, "w":1.5},
{"label":"Q", "x":1.5, "y":2.75},
{"label":"W", "x":2.5, "y":2.75},
{"label":"E", "x":3.5, "y":2.75},
{"label":"R", "x":4.5, "y":2.75},
{"label":"T", "x":5.5, "y":2.75},
{"label":"Y", "x":6.5, "y":2.75},
{"label":"U", "x":7.5, "y":2.75},
{"label":"I", "x":8.5, "y":2.75},
{"label":"O", "x":9.5, "y":2.75},
{"label":"P", "x":10.5, "y":2.75},
{"label":"[{", "x":11.5, "y":2.75},
{"label":"]}", "x":12.5, "y":2.75},
{"label":"\\|", "x":13.5, "y":2.75, "w":1.5},
{"label":"Page Down", "x":15.25, "y":2.75},
{"label":"Caps Lock", "x":0, "y":3.75, "w":1.75},
{"label":"A", "x":1.75, "y":3.75},
{"label":"S", "x":2.75, "y":3.75},
{"label":"D", "x":3.75, "y":3.75},
{"label":"F", "x":4.75, "y":3.75},
{"label":"G", "x":5.75, "y":3.75},
{"label":"H", "x":6.75, "y":3.75},
{"label":"J", "x":7.75, "y":3.75},
{"label":"K", "x":8.75, "y":3.75},
{"label":"L", "x":9.75, "y":3.75},
{"label":";:", "x":10.75, "y":3.75},
{"label":"'\"", "x":11.75, "y":3.75},
{"label":"Enter", "x":12.75, "y":3.75, "w":2.25},
{"label":"Home", "x":15.25, "y":3.75},
{"label":"Shift", "x":0, "y":4.75, "w":2.25},
{"label":"Z", "x":2.25, "y":4.75},
{"label":"X", "x":3.25, "y":4.75},
{"label":"C", "x":4.25, "y":4.75},
{"label":"V", "x":5.25, "y":4.75},
{"label":"B", "x":6.25, "y":4.75},
{"label":"N", "x":7.25, "y":4.75},
{"label":"M", "x":8.25, "y":4.75},
{"label":",<", "x":9.25, "y":4.75},
{"label":".>", "x":10.25, "y":4.75},
{"label":"/?", "x":11.25, "y":4.75},
{"label":"Shift", "x":12.25, "y":4.75, "w":1.75},
{"label":"Up", "x":14.25, "y":5},
{"label":"Ctrl", "x":0, "y":5.75, "w":1.25},
{"label":"Win", "x":1.25, "y":5.75, "w":1.25},
{"label":"Alt", "x":2.5, "y":5.75, "w":1.25},
{"label":"Space", "x":3.75, "y":5.75, "w":6.25},
{"label":"Alt", "x":10, "y":5.75},
{"label":"Fn", "x":11, "y":5.75},
{"label":"Ctrl", "x":12, "y":5.75},
{"label":"Left", "x":13.25, "y":6},
{"label":"Down", "x":14.25, "y":6},
{"label":"Right", "x":15.25, "y":6}
]
}
}
}

View File

@@ -0,0 +1,117 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = SAFE_RANGE,
KC_LAUNCHPAD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_ansi_82(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_ansi_82(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LCMD, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_ansi_82(
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
};
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1 @@
SRC += factory/major/test.c

View File

@@ -0,0 +1,179 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = USER00,
KC_LAUNCHPAD,
KC_LOPTN,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
static uint8_t mac_keycode[4] = { KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_all(
KC_VOLD, KC_VOLU,
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_all(
RGB_VAD, RGB_VAI,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_all(
KC_VOLD, KC_VOLU,
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_all(
RGB_VAD, RGB_VAI,
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
};
// clang-format on
#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
#define ENCODERS 1
static uint8_t encoder_state[ENCODERS] = {0};
static keypos_t encoder_cw[ENCODERS] = {{ 8, 5 }};
static keypos_t encoder_ccw[ENCODERS] = {{ 7, 5 }};
void encoder_action_unregister(void) {
for (int index = 0; index < ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = (timer_read() | 1)
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = (timer_read() | 1)
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_user(void) {
encoder_action_unregister();
}
bool encoder_update_user(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
return false;
};
#endif
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1,2 @@
VIA_ENABLE = yes
SRC += factory/major/test.c

View File

@@ -0,0 +1,195 @@
/* 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 "quantum.h"
const matrix_row_t matrix_mask[] = {
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111101111,
};
#ifdef RGB_MATRIX_ENABLE
const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
* | | G location
* | | | B location
* | | | | */
{0, C_1, A_1, B_1},
{0, C_2, A_2, B_2},
{0, C_3, A_3, B_3},
{0, C_4, A_4, B_4},
{0, C_5, A_5, B_5},
{0, C_6, A_6, B_6},
{0, C_7, A_7, B_7},
{0, C_8, A_8, B_8},
{0, C_9, A_9, B_9},
{0, C_10, A_10, B_10},
{0, C_11, A_11, B_11},
{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, I_1, G_1, H_1},
{0, I_2, G_2, H_2},
{0, I_3, G_3, H_3},
{0, I_4, G_4, H_4},
{0, I_5, G_5, H_5},
{0, I_6, G_6, H_6},
{0, I_7, G_7, H_7},
{0, I_8, G_8, H_8},
{0, I_9, G_9, H_9},
{0, I_10, G_10, H_10},
{0, I_11, G_11, H_11},
{0, I_12, G_12, H_12},
{0, I_13, G_13, H_13},
{0, I_14, G_14, H_14},
{0, I_16, G_16, H_16},
{0, F_1, D_1, E_1},
{0, F_2, D_2, E_2},
{0, F_3, D_3, E_3},
{0, F_4, D_4, E_4},
{0, F_5, D_5, E_5},
{0, F_6, D_6, E_6},
{0, F_7, D_7, E_7},
{0, F_8, D_8, E_8},
{0, F_9, D_9, E_9},
{0, F_10, D_10, E_10},
{0, F_11, D_11, E_11},
{0, F_12, D_12, E_12},
{0, F_13, D_13, E_13},
{0, F_14, D_14, E_14},
{0, F_16, D_16, E_16},
{1, I_1, G_1, H_1},
{1, I_2, G_2, H_2},
{1, I_3, G_3, H_3},
{1, I_4, G_4, H_4},
{1, I_5, G_5, H_5},
{1, I_6, G_6, H_6},
{1, I_7, G_7, H_7},
{1, I_8, G_8, H_8},
{1, I_9, G_9, H_9},
{1, I_10, G_10, H_10},
{1, I_11, G_11, H_11},
{1, I_12, G_12, H_12},
{1, I_14, G_14, H_14},
{1, I_16, G_16, H_16},
{1, F_1, D_1, E_1},
{1, F_3, D_3, E_3},
{1, F_4, D_4, E_4},
{1, F_5, D_5, E_5},
{1, F_6, D_6, E_6},
{1, F_7, D_7, E_7},
{1, F_8, D_8, E_8},
{1, F_9, D_9, E_9},
{1, F_10, D_10, E_10},
{1, F_11, D_11, E_11},
{1, F_12, D_12, E_12},
{1, F_14, D_14, E_14},
{1, F_15, D_15, E_15},
{1, C_1, A_1, B_1},
{1, C_2, A_2, B_2},
{1, C_3, A_3, B_3},
{1, C_7, A_7, B_7},
{1, C_11, A_11, B_11},
{1, C_12, A_12, B_12},
{1, C_13, A_13, B_13},
{1, C_14, A_14, B_14},
{1, C_15, A_15, B_15},
{1, C_16, A_16, B_16},
};
#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, 13, __, 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, __, 57, __, 58 },
{ 59, __, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, __, 70, 71, __ },
{ 72, 73, 74, __, __, __, 75, __, __, __, 76, 77, 78, 79, 80, 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,52},
{2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {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, 4, 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) {
if (clockwise) {
tap_code_delay(KC_VOLU, TAP_CODE_DELAY);
} else {
tap_code_delay(KC_VOLD, TAP_CODE_DELAY);
}
}
return true;
}
# if defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_insert_state(0);
}
void keyboard_post_init_kb(void) {
pin_t encoders_pad_a[] = ENCODERS_PAD_A;
pin_t encoders_pad_b[] = ENCODERS_PAD_B;
palEnableLineEvent(encoders_pad_a[0], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[0], PAL_EVENT_MODE_BOTH_EDGES);
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
# endif
#endif

View File

@@ -0,0 +1,53 @@
/* 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/>.
*/
#pragma once
#include "quantum.h"
#define XXX KC_NO
#define LAYOUT_all( \
K57, K58, \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0F, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1F, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2F, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3F, \
K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K4E, \
K50, K51, K52, K56, K5A, K5B, K5C, K5D, K5E, K5F \
) { \
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, XXX, K0F }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, XXX, K1F }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, XXX, K2F }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, XXX, K3F }, \
{ K40, XXX, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, XXX, K4D, K4E, XXX }, \
{ K50, K51, K52, XXX, XXX, XXX, K56, K57, K58, XXX, K5A, K5B, K5C, K5D, K5E, K5F } \
}
#define LAYOUT_ansi_82( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0F, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1F, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2F, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3F, \
K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K4E, \
K50, K51, K52, K56, K5A, K5B, K5C, K5D, K5E, K5F \
) { \
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, XXX, K0F }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, XXX, K1F }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, XXX, K2F }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, XXX, K3F }, \
{ K40, XXX, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, XXX, K4D, K4E, XXX }, \
{ K50, K51, K52, XXX, XXX, XXX, K56, XXX, XXX, XXX, K5A, K5B, K5C, K5D, K5E, K5F } \
}

View File

@@ -0,0 +1,5 @@
# The ANSI variant of the Keychron Q1
- Enable EC11 rotary encoder.
- Turn colckwise to increase volume and turn anti-colckwise to decrease volume.
- Press top right key pushbutton to mute.

View File

@@ -0,0 +1,35 @@
# MCU name
MCU = STM32L432
# Bootloader selection
BOOTLOADER = stm32-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Enable USB N-key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes # Enable Encoder
ENCODER_MAP_ENABLE = no
DIP_SWITCH_ENABLE = yes
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = CKLED2001
RAW_ENABLE = yes
LTO_ENABLE = yes
EEPROM_DRIVER = wear_leveling
WEAR_LEVELING_DRIVER = embedded_flash
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
# custom matrix setup
CUSTOM_MATRIX = lite
SRC += matrix.c

View File

@@ -0,0 +1,41 @@
/* 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/>.
*/
#pragma once
/* 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 24
#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
/* Enable caps-lock LED */
#define CAPS_LOCK_LED_INDEX 44

View File

@@ -1,12 +1,12 @@
{
"keyboard_name": "Q1",
"keyboard_name": "Keychron Q1",
"manufacturer": "Keychron",
"url": "https://github.com/Keychron",
"maintainer": "lalalademaxiya1",
"usb": {
"vid": "0x3434",
"pid": "0x0102",
"device_version": "1.0.0"
"device_version": "1.0.2"
},
"layouts": {
"LAYOUT_iso_83": {
@@ -27,19 +27,19 @@
{"label":"Delete", "x":14, "y":0},
{"label":"Insert", "x":15.25, "y":0},
{"label":"~", "x":0, "y":1.25},
{"label":"!", "x":1, "y":1.25},
{"label":"@", "x":2, "y":1.25},
{"label":"#", "x":3, "y":1.25},
{"label":"$", "x":4, "y":1.25},
{"label":"%", "x":5, "y":1.25},
{"label":"^", "x":6, "y":1.25},
{"label":"&", "x":7, "y":1.25},
{"label":"*", "x":8, "y":1.25},
{"label":"(", "x":9, "y":1.25},
{"label":")", "x":10, "y":1.25},
{"label":"_", "x":11, "y":1.25},
{"label":"+", "x":12, "y":1.25},
{"label":"`~", "x":0, "y":1.25},
{"label":"1!", "x":1, "y":1.25},
{"label":"2@", "x":2, "y":1.25},
{"label":"3#", "x":3, "y":1.25},
{"label":"4$", "x":4, "y":1.25},
{"label":"5%", "x":5, "y":1.25},
{"label":"6^", "x":6, "y":1.25},
{"label":"7&", "x":7, "y":1.25},
{"label":"8*", "x":8, "y":1.25},
{"label":"9(", "x":9, "y":1.25},
{"label":"0)", "x":10, "y":1.25},
{"label":"-_", "x":11, "y":1.25},
{"label":"=+", "x":12, "y":1.25},
{"label":"Backspace", "x":13, "y":1.25, "w":2},
{"label":"Page Up", "x":15.25, "y":1.25},
@@ -54,8 +54,8 @@
{"label":"I", "x":8.5, "y":2.25},
{"label":"O", "x":9.5, "y":2.25},
{"label":"P", "x":10.5, "y":2.25},
{"label":"{", "x":11.5, "y":2.25},
{"label":"}", "x":12.5, "y":2.25},
{"label":"[{", "x":11.5, "y":2.25},
{"label":"]}", "x":12.5, "y":2.25},
{"label":"Page Down", "x":15.25, "y":2.25},
{"label":"Caps Lock", "x":0, "y":3.25, "w":1.75},
@@ -68,8 +68,8 @@
{"label":"J", "x":7.75, "y":3.25},
{"label":"K", "x":8.75, "y":3.25},
{"label":"L", "x":9.75, "y":3.25},
{"label":":", "x":10.75, "y":3.25},
{"label":"\"", "x":11.75, "y":3.25},
{"label":";:", "x":10.75, "y":3.25},
{"label":"'\"", "x":11.75, "y":3.25},
{"label":"#~", "x":12.75, "y":3.25},
{"label":"Enter", "x":13.75, "y":2.25, "w":1.25, "h":2},
{"label":"Home", "x":15.25, "y":3.25},
@@ -83,11 +83,11 @@
{"label":"B", "x":6.25, "y":4.25},
{"label":"N", "x":7.25, "y":4.25},
{"label":"M", "x":8.25, "y":4.25},
{"label":"<", "x":9.25, "y":4.25},
{"label":">", "x":10.25, "y":4.25},
{"label":"?", "x":11.25, "y":4.25},
{"label":",<", "x":9.25, "y":4.25},
{"label":".>", "x":10.25, "y":4.25},
{"label":"/?", "x":11.25, "y":4.25},
{"label":"Shift", "x":12.25, "y":4.25, "w":1.75},
{"label":"\u2191", "x":14.25, "y":4.5},
{"label":"Up", "x":14.25, "y":4.5},
{"label":"Ctrl", "x":0, "y":5.25, "w":1.25},
{"label":"Win", "x":1.25, "y":5.25, "w":1.25},
@@ -96,9 +96,9 @@
{"label":"Alt", "x":10, "y":5.25},
{"label":"Fn", "x":11, "y":5.25},
{"label":"Ctrl", "x":12, "y":5.25},
{"label":"\u2190", "x":13.25, "y":5.5},
{"label":"\u2193", "x":14.25, "y":5.5},
{"label":"\u2192", "x":15.25, "y":5.5}
{"label":"Left", "x":13.25, "y":5.5},
{"label":"Down", "x":14.25, "y":5.5},
{"label":"Right", "x":15.25, "y":5.5}
]
}
}

View File

@@ -16,57 +16,73 @@
#include QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = USER00,
KC_MISSION_CONTROL = SAFE_RANGE,
KC_LAUNCHPAD,
KC_TASK,
KC_FLXP
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_iso_83(
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_iso_83(
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_iso_83(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_iso_83(
KC_TRNS, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
};
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
@@ -84,24 +100,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false; // Skip all further processing of this key
case KC_TASK:
if (record->event.pressed) {
register_code(KC_LWIN);
register_code(KC_TAB);
} else {
unregister_code(KC_LWIN);
unregister_code(KC_TAB);
}
return false; // Skip all further processing of this key
case KC_FLXP:
if (record->event.pressed) {
register_code(KC_LWIN);
register_code(KC_E);
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
unregister_code(KC_LWIN);
unregister_code(KC_E);
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1 @@
SRC += factory/major/test.c

View File

@@ -0,0 +1,133 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = USER00,
KC_LAUNCHPAD,
KC_LOPTN,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
static uint8_t mac_keycode[4] = { KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_iso_83(
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_iso_83(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_iso_83(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_iso_83(
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
};
// clang-fotmat on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1,2 @@
VIA_ENABLE = yes
SRC += factory/major/test.c

View File

@@ -16,7 +16,17 @@
#include "quantum.h"
const matrix_row_t matrix_mask[] = {
0b111111111111101,
0b111111111111111,
0b111111111111111,
0b111111111111111,
0b111111111111111,
0b111111111111111,
};
#ifdef RGB_MATRIX_ENABLE
const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
@@ -83,8 +93,8 @@ const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
{0, L_10, J_10, K_10},
{0, L_11, J_11, K_11},
{0, L_12, J_12, K_12},
{0, L_14, J_14, K_14},
{0, I_14, G_14, H_14},
{0, L_14, J_14, K_14},
{0, I_14, G_14, H_14},
{0, L_16, J_16, K_16},
{1, C_1, A_1, B_1},
@@ -114,31 +124,36 @@ const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
{1, F_16, D_16, E_16}
};
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, 57, 43 },
{ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 72, 56, 58 },
{ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 81, 71, 13 },
{ 73, 74, 75, NO_LED, NO_LED, NO_LED, 76, NO_LED, NO_LED, NO_LED, 77, 78, 79, 80, 82 }
},
{
{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}, {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}, {180,39}, {195,26}, {224,39},
{0,52}, {15,52}, {30,52}, {45,52}, {60,52}, {75,52}, {90,52}, {105,52}, {120,52}, {135,52}, {150,52}, {165,52}, {180,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, 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, 57, 43 },
{ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 72, 56, 58 },
{ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 81, 71, 13 },
{ 73, 74, 75, __, __, __, 76, __, __, __, 77, 78, 79, 80, 82 }
},
{
// 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}, {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}, {187,38}, {203,32}, {224,38},
{2,49}, {18,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,52},
{2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {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,
9, 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, 1, 1,
1, 1, 1, 4, 1, 1, 1, 1, 1, 1
}
};
#endif

View File

@@ -0,0 +1,37 @@
/* 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/>.
*/
#pragma once
#include "quantum.h"
#define xxx KC_NO
#define LAYOUT_iso_83( \
K00, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K4E, K0E, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2E, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K2D, K3E, \
K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K3C, \
K50, K51, K52, K56, K5A, K5B, K5C, K5D, K4C, K5E \
) { \
{ K00, xxx, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
{ K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E }, \
{ K50, K51, K52, xxx, xxx, xxx, K56, xxx, xxx, xxx, K5A, K5B, K5C, K5D, K5E } \
}

View File

@@ -8,7 +8,7 @@ BOOTLOADER = atmel-dfu
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
@@ -19,3 +19,6 @@ AUDIO_ENABLE = no # Audio output
DIP_SWITCH_ENABLE = yes
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3733
RAW_ENABLE = yes
LTO_ENABLE = yes

View File

@@ -0,0 +1,44 @@
/* 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/>.
*/
#pragma once
/* 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 24
#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
/* Encoder Configuration */
#define ENCODERS_PAD_A { E6 }
#define ENCODERS_PAD_B { B7 }
#define ENCODER_RESOLUTION 4
#define ENCODER_DEFAULT_POS 0x3
#define AVR_USE_INT
/* Enable caps-lock LED */
#define CAPS_LOCK_LED_INDEX 44

View File

@@ -0,0 +1,199 @@
{
"keyboard_name": "Keychron Q1",
"manufacturer": "Keychron",
"url": "https://github.com/Keychron",
"maintainer": "lalalademaxiya1",
"usb": {
"vid": "0x3434",
"pid": "0x0103",
"device_version": "1.0.2"
},
"layouts": {
"LAYOUT_iso_83": {
"layout": [
{"label":"Esc", "x":0, "y":0},
{"label":"F1", "x":1.25, "y":0},
{"label":"F2", "x":2.25, "y":0},
{"label":"F3", "x":3.25, "y":0},
{"label":"F4", "x":4.25, "y":0},
{"label":"F5", "x":5.5, "y":0},
{"label":"F6", "x":6.5, "y":0},
{"label":"F7", "x":7.5, "y":0},
{"label":"F8", "x":8.5, "y":0},
{"label":"F9", "x":9.75, "y":0},
{"label":"F10", "x":10.75, "y":0},
{"label":"F11", "x":11.75, "y":0},
{"label":"F12", "x":12.75, "y":0},
{"label":"Delete", "x":14, "y":0},
{"label":"Insert", "x":15.25, "y":0},
{"label":"`~", "x":0, "y":1.25},
{"label":"1!", "x":1, "y":1.25},
{"label":"2@", "x":2, "y":1.25},
{"label":"3#", "x":3, "y":1.25},
{"label":"4$", "x":4, "y":1.25},
{"label":"5%", "x":5, "y":1.25},
{"label":"6^", "x":6, "y":1.25},
{"label":"7&", "x":7, "y":1.25},
{"label":"8*", "x":8, "y":1.25},
{"label":"9(", "x":9, "y":1.25},
{"label":"0)", "x":10, "y":1.25},
{"label":"-_", "x":11, "y":1.25},
{"label":"=+", "x":12, "y":1.25},
{"label":"Backspace", "x":13, "y":1.25, "w":2},
{"label":"Page Up", "x":15.25, "y":1.25},
{"label":"Tab", "x":0, "y":2.25, "w":1.5},
{"label":"Q", "x":1.5, "y":2.25},
{"label":"W", "x":2.5, "y":2.25},
{"label":"E", "x":3.5, "y":2.25},
{"label":"R", "x":4.5, "y":2.25},
{"label":"T", "x":5.5, "y":2.25},
{"label":"Y", "x":6.5, "y":2.25},
{"label":"U", "x":7.5, "y":2.25},
{"label":"I", "x":8.5, "y":2.25},
{"label":"O", "x":9.5, "y":2.25},
{"label":"P", "x":10.5, "y":2.25},
{"label":"[{", "x":11.5, "y":2.25},
{"label":"]}", "x":12.5, "y":2.25},
{"label":"Page Down", "x":15.25, "y":2.25},
{"label":"Caps Lock", "x":0, "y":3.25, "w":1.75},
{"label":"A", "x":1.75, "y":3.25},
{"label":"S", "x":2.75, "y":3.25},
{"label":"D", "x":3.75, "y":3.25},
{"label":"F", "x":4.75, "y":3.25},
{"label":"G", "x":5.75, "y":3.25},
{"label":"H", "x":6.75, "y":3.25},
{"label":"J", "x":7.75, "y":3.25},
{"label":"K", "x":8.75, "y":3.25},
{"label":"L", "x":9.75, "y":3.25},
{"label":";:", "x":10.75, "y":3.25},
{"label":"'\"", "x":11.75, "y":3.25},
{"label":"#~", "x":12.75, "y":3.25},
{"label":"Enter", "x":13.75, "y":2.25, "w":1.25, "h":2},
{"label":"Home", "x":15.25, "y":3.25},
{"label":"Shift", "x":0, "y":4.25, "w":1.25},
{"label":"\\|", "x":1.25, "y":4.25},
{"label":"Z", "x":2.25, "y":4.25},
{"label":"X", "x":3.25, "y":4.25},
{"label":"C", "x":4.25, "y":4.25},
{"label":"V", "x":5.25, "y":4.25},
{"label":"B", "x":6.25, "y":4.25},
{"label":"N", "x":7.25, "y":4.25},
{"label":"M", "x":8.25, "y":4.25},
{"label":",<", "x":9.25, "y":4.25},
{"label":".>", "x":10.25, "y":4.25},
{"label":"/?", "x":11.25, "y":4.25},
{"label":"Shift", "x":12.25, "y":4.25, "w":1.75},
{"label":"Up", "x":14.25, "y":4.5},
{"label":"Ctrl", "x":0, "y":5.25, "w":1.25},
{"label":"Win", "x":1.25, "y":5.25, "w":1.25},
{"label":"Alt", "x":2.5, "y":5.25, "w":1.25},
{"label":"Space", "x":3.75, "y":5.25, "w":6.25},
{"label":"Alt", "x":10, "y":5.25},
{"label":"Fn", "x":11, "y":5.25},
{"label":"Ctrl", "x":12, "y":5.25},
{"label":"Left", "x":13.25, "y":5.5},
{"label":"Down", "x":14.25, "y":5.5},
{"label":"Right", "x":15.25, "y":5.5}
]
},
"LAYOUT_all": {
"layout": [
{"label":"Esc", "x":0, "y":0.5},
{"label":"F1", "x":1.25, "y":0.5},
{"label":"F2", "x":2.25, "y":0.5},
{"label":"F3", "x":3.25, "y":0.5},
{"label":"F4", "x":4.25, "y":0.5},
{"label":"F5", "x":5.5, "y":0.5},
{"label":"F6", "x":6.5, "y":0.5},
{"label":"F7", "x":7.5, "y":0.5},
{"label":"F8", "x":8.5, "y":0.5},
{"label":"F9", "x":9.75, "y":0.5},
{"label":"F10", "x":10.75, "y":0.5},
{"label":"F11", "x":11.75, "y":0.5},
{"label":"F12", "x":12.75, "y":0.5},
{"label":"Delete", "x":14, "y":0.5},
{"label":"CCW", "x":15.15, "y":0, "w":0.6, "h":0.5},
{"label":"Mute", "x":15.25, "y":0.5},
{"label":"CW", "x":15.75, "y":0, "w":0.6, "h":0.5},
{"label":"`~", "x":0, "y":1.75},
{"label":"1!", "x":1, "y":1.75},
{"label":"2@", "x":2, "y":1.75},
{"label":"3#", "x":3, "y":1.75},
{"label":"4$", "x":4, "y":1.75},
{"label":"5%", "x":5, "y":1.75},
{"label":"6^", "x":6, "y":1.75},
{"label":"7&", "x":7, "y":1.75},
{"label":"8*", "x":8, "y":1.75},
{"label":"9(", "x":9, "y":1.75},
{"label":"0)", "x":10, "y":1.75},
{"label":"-_", "x":11, "y":1.75},
{"label":"=+", "x":12, "y":1.75},
{"label":"Backspace", "x":13, "y":1.75, "w":2},
{"label":"Page Up", "x":15.25, "y":1.75},
{"label":"Tab", "x":0, "y":2.75, "w":1.5},
{"label":"Q", "x":1.5, "y":2.75},
{"label":"W", "x":2.5, "y":2.75},
{"label":"E", "x":3.5, "y":2.75},
{"label":"R", "x":4.5, "y":2.75},
{"label":"T", "x":5.5, "y":2.75},
{"label":"Y", "x":6.5, "y":2.75},
{"label":"U", "x":7.5, "y":2.75},
{"label":"I", "x":8.5, "y":2.75},
{"label":"O", "x":9.5, "y":2.75},
{"label":"P", "x":10.5, "y":2.75},
{"label":"[{", "x":11.5, "y":2.75},
{"label":"]}", "x":12.5, "y":2.75},
{"label":"Page Down", "x":15.25, "y":2.75},
{"label":"Caps Lock", "x":0, "y":3.75, "w":1.75},
{"label":"A", "x":1.75, "y":3.75},
{"label":"S", "x":2.75, "y":3.75},
{"label":"D", "x":3.75, "y":3.75},
{"label":"F", "x":4.75, "y":3.75},
{"label":"G", "x":5.75, "y":3.75},
{"label":"H", "x":6.75, "y":3.75},
{"label":"J", "x":7.75, "y":3.75},
{"label":"K", "x":8.75, "y":3.75},
{"label":"L", "x":9.75, "y":3.75},
{"label":";:", "x":10.75, "y":3.75},
{"label":"'\"", "x":11.75, "y":3.75},
{"label":"#~", "x":12.75, "y":3.75},
{"label":"Enter", "x":13.75, "y":2.75, "w":1.25, "h":2},
{"label":"Home", "x":15.25, "y":3.75},
{"label":"Shift", "x":0, "y":4.75, "w":2.25},
{"label":"\\|", "x":1.25, "y":4.75},
{"label":"Z", "x":2.25, "y":4.75},
{"label":"X", "x":3.25, "y":4.75},
{"label":"C", "x":4.25, "y":4.75},
{"label":"V", "x":5.25, "y":4.75},
{"label":"B", "x":6.25, "y":4.75},
{"label":"N", "x":7.25, "y":4.75},
{"label":"M", "x":8.25, "y":4.75},
{"label":",<", "x":9.25, "y":4.75},
{"label":".>", "x":10.25, "y":4.75},
{"label":"/?", "x":11.25, "y":4.75},
{"label":"Shift", "x":12.25, "y":4.75, "w":1.75},
{"label":"Up", "x":14.25, "y":5},
{"label":"Ctrl", "x":0, "y":5.75, "w":1.25},
{"label":"Win", "x":1.25, "y":5.75, "w":1.25},
{"label":"Alt", "x":2.5, "y":5.75, "w":1.25},
{"label":"Space", "x":3.75, "y":5.75, "w":6.25},
{"label":"Alt", "x":10, "y":5.75},
{"label":"Fn", "x":11, "y":5.75},
{"label":"Ctrl", "x":12, "y":5.75},
{"label":"Left", "x":13.25, "y":6},
{"label":"Down", "x":14.25, "y":6},
{"label":"Right", "x":15.25, "y":6}
]
}
}
}

View File

@@ -0,0 +1,117 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = SAFE_RANGE,
KC_LAUNCHPAD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_iso_83(
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPT, KC_LCMD , KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_iso_83(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_iso_83(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_iso_83(
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
};
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1 @@
SRC += factory/major/test.c

View File

@@ -0,0 +1,181 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers{
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = USER00,
KC_LAUNCHPAD,
KC_LOPTN,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}}
};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
static uint8_t mac_keycode[4] = { KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_all(
KC_VOLD, KC_VOLU,
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_all(
RGB_VAD, RGB_VAI,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_all(
KC_VOLD, KC_VOLU,
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_all(
RGB_VAD, RGB_VAI,
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
};
// clang-format on
#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
#define ENCODERS 1
static uint8_t encoder_state[ENCODERS] = {0};
static keypos_t encoder_cw[ENCODERS] = {{ 8, 5 }};
static keypos_t encoder_ccw[ENCODERS] = {{ 7, 5 }};
void encoder_action_unregister(void) {
for (int index = 0; index < ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = (timer_read() | 1)
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = (timer_read() | 1)
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_user(void) {
encoder_action_unregister();
}
bool encoder_update_user(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
return false;
};
#endif
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1,2 @@
VIA_ENABLE = yes
SRC += factory/major/test.c

View File

@@ -0,0 +1,191 @@
/* 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 "quantum.h"
const matrix_row_t matrix_mask[] = {
0b111111111111101,
0b111111111111111,
0b111111111111111,
0b111111111111111,
0b111111111111111,
0b111111111111111,
};
#ifdef RGB_MATRIX_ENABLE
const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
* | | G location
* | | | B location
* | | | | */
{0, C_1, A_1, B_1},
{0, C_3, A_3, B_3},
{0, C_4, A_4, B_4},
{0, C_5, A_5, B_5},
{0, C_6, A_6, B_6},
{0, C_7, A_7, B_7},
{0, C_8, A_8, B_8},
{0, C_9, A_9, B_9},
{0, C_10, A_10, B_10},
{0, C_11, A_11, B_11},
{0, C_12, A_12, B_12},
{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, F_1, D_1, E_1},
{0, F_2, D_2, E_2},
{0, F_3, D_3, E_3},
{0, F_4, D_4, E_4},
{0, F_5, D_5, E_5},
{0, F_6, D_6, E_6},
{0, F_7, D_7, E_7},
{0, F_8, D_8, E_8},
{0, F_9, D_9, E_9},
{0, F_10, D_10, E_10},
{0, F_11, D_11, E_11},
{0, F_12, D_12, E_12},
{0, F_13, D_13, E_13},
{0, F_14, D_14, E_14},
{0, F_16, D_16, E_16},
{0, I_1, G_1, H_1},
{0, I_2, G_2, H_2},
{0, I_3, G_3, H_3},
{0, I_4, G_4, H_4},
{0, I_5, G_5, H_5},
{0, I_6, G_6, H_6},
{0, I_7, G_7, H_7},
{0, I_8, G_8, H_8},
{0, I_9, G_9, H_9},
{0, I_10, G_10, H_10},
{0, I_11, G_11, H_11},
{0, I_12, G_12, H_12},
{0, I_13, G_13, H_13},
{0, I_16, G_16, H_16},
{0, L_1, J_1, K_1},
{0, L_2, J_2, K_2},
{0, L_3, J_3, K_3},
{0, L_4, J_4, K_4},
{0, L_5, J_5, K_5},
{0, L_6, J_6, K_6},
{0, L_7, J_7, K_7},
{0, L_8, J_8, K_8},
{0, L_9, J_9, K_9},
{0, L_10, J_10, K_10},
{0, L_11, J_11, K_11},
{0, L_12, J_12, K_12},
{0, L_14, J_14, K_14},
{0, I_14, G_14, H_14},
{0, L_16, J_16, K_16},
{1, C_1, A_1, B_1},
{1, C_2, A_2, B_2},
{1, C_3, A_3, B_3},
{1, C_4, A_4, B_4},
{1, C_5, A_5, B_5},
{1, C_6, A_6, B_6},
{1, C_7, A_7, B_7},
{1, C_8, A_8, B_8},
{1, C_9, A_9, B_9},
{1, C_10, A_10, B_10},
{1, C_11, A_11, B_11},
{1, C_12, A_12, B_12},
{1, C_14, A_14, B_14},
{1, C_15, A_15, B_15},
{1, F_1, D_1, E_1},
{1, F_2, D_2, E_2},
{1, F_3, D_3, E_3},
{1, F_7, D_7, E_7},
{1, F_11, D_11, E_11},
{1, F_12, D_12, E_12},
{1, F_13, D_13, E_13},
{1, F_14, D_14, E_14},
{1, F_15, D_15, E_15},
{1, F_16, D_16, E_16}
};
#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, 57, 43 },
{ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 72, 56, 58 },
{ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 81, 71, 13 },
{ 73, 74, 75, __, __, __, 76, __, __, __, 77, 78, 79, 80, 82 }
},
{
// 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}, {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}, {187,38}, {203,32}, {224,38},
{2,49}, {18,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,52},
{2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {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,
9, 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, 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) {
if (clockwise) {
tap_code_delay(KC_VOLU, TAP_CODE_DELAY);
} else {
tap_code_delay(KC_VOLD, TAP_CODE_DELAY);
}
}
return true;
}
# if defined(AVR_USE_INT)
void keyboard_post_init_kb(void) {
PCMSK0 |= (1 << 7);
PCICR |= (1 << PCIE0);
sei();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
ISR(PCINT0_vect) {
encoder_insert_state(0);
}
# endif
#endif

View File

@@ -0,0 +1,53 @@
/* 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/>.
*/
#pragma once
#include "quantum.h"
#define xxx KC_NO
#define LAYOUT_all( \
K57, K58, \
K00, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K4E, K0E, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2E, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K2D, K3E, \
K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K3C, \
K50, K51, K52, K56, K5A, K5B, K5C, K5D, K4C, K5E \
) { \
{ K00, xxx, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
{ K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E }, \
{ K50, K51, K52, xxx, xxx, xxx, K56, K57, K58, xxx, K5A, K5B, K5C, K5D, K5E } \
}
#define LAYOUT_iso_83( \
K00, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K4E, K0E, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2E, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K2D, K3E, \
K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K3C, \
K50, K51, K52, K56, K5A, K5B, K5C, K5D, K4C, K5E \
) { \
{ K00, xxx, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
{ K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E }, \
{ K50, K51, K52, xxx, xxx, xxx, K56, xxx, xxx, xxx, K5A, K5B, K5C, K5D, K5E } \
}

View File

@@ -0,0 +1,5 @@
# The ISO variant of the Keychron Q1
- Enable EC11 rotary encoder.
- Turn colckwise to increase volume and turn anti-colckwise to decrease volume.
- Press top right key pushbutton to mute.

View File

@@ -0,0 +1,26 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes # Enable Encoder
ENCODER_MAP_ENABLE = no
DIP_SWITCH_ENABLE = yes
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3733
RAW_ENABLE = yes
LTO_ENABLE = yes

View File

@@ -0,0 +1,51 @@
/* 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/>.
*/
#pragma once
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 16
/* key matrix pins */
#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 }
#define MATRIX_COL_PINS { C14, C15, A0, A1, A2, A3, A4, A5, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { {5,4} }
/* RGB Matrix Driver Configuration */
#define DRIVER_COUNT 2
#define DRIVER_ADDR_1 0b1110111
#define DRIVER_ADDR_2 0b1110100
/* RGB Matrix Configuration */
#define DRIVER_1_LED_TOTAL 45
#define DRIVER_2_LED_TOTAL 38
#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
#define CKLED2001_CURRENT_TUNE \
{ 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50 }
/* EEPROM Driver Configuration */
#define WEAR_LEVELING_LOGICAL_SIZE 2048
#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2)
/* Enable caps-lock LED */
#define CAPS_LOCK_LED_INDEX 44

View File

@@ -0,0 +1,105 @@
{
"keyboard_name": "Keychron Q1",
"manufacturer": "Keychron",
"url": "https://github.com/Keychron",
"maintainer": "lalalademaxiya1",
"usb": {
"vid": "0x3434",
"pid": "0x0108",
"device_version": "2.0.2"
},
"layouts": {
"LAYOUT_iso_83": {
"layout": [
{"label":"Esc", "x":0, "y":0},
{"label":"F1", "x":1.25, "y":0},
{"label":"F2", "x":2.25, "y":0},
{"label":"F3", "x":3.25, "y":0},
{"label":"F4", "x":4.25, "y":0},
{"label":"F5", "x":5.5, "y":0},
{"label":"F6", "x":6.5, "y":0},
{"label":"F7", "x":7.5, "y":0},
{"label":"F8", "x":8.5, "y":0},
{"label":"F9", "x":9.75, "y":0},
{"label":"F10", "x":10.75, "y":0},
{"label":"F11", "x":11.75, "y":0},
{"label":"F12", "x":12.75, "y":0},
{"label":"Delete", "x":14, "y":0},
{"label":"Insert", "x":15.25, "y":0},
{"label":"`~", "x":0, "y":1.25},
{"label":"1!", "x":1, "y":1.25},
{"label":"2@", "x":2, "y":1.25},
{"label":"3#", "x":3, "y":1.25},
{"label":"4$", "x":4, "y":1.25},
{"label":"5%", "x":5, "y":1.25},
{"label":"6^", "x":6, "y":1.25},
{"label":"7&", "x":7, "y":1.25},
{"label":"8*", "x":8, "y":1.25},
{"label":"9(", "x":9, "y":1.25},
{"label":"0)", "x":10, "y":1.25},
{"label":"-_", "x":11, "y":1.25},
{"label":"=+", "x":12, "y":1.25},
{"label":"Backspace", "x":13, "y":1.25, "w":2},
{"label":"Page Up", "x":15.25, "y":1.25},
{"label":"Tab", "x":0, "y":2.25, "w":1.5},
{"label":"Q", "x":1.5, "y":2.25},
{"label":"W", "x":2.5, "y":2.25},
{"label":"E", "x":3.5, "y":2.25},
{"label":"R", "x":4.5, "y":2.25},
{"label":"T", "x":5.5, "y":2.25},
{"label":"Y", "x":6.5, "y":2.25},
{"label":"U", "x":7.5, "y":2.25},
{"label":"I", "x":8.5, "y":2.25},
{"label":"O", "x":9.5, "y":2.25},
{"label":"P", "x":10.5, "y":2.25},
{"label":"[{", "x":11.5, "y":2.25},
{"label":"]}", "x":12.5, "y":2.25},
{"label":"Page Down", "x":15.25, "y":2.25},
{"label":"Caps Lock", "x":0, "y":3.25, "w":1.75},
{"label":"A", "x":1.75, "y":3.25},
{"label":"S", "x":2.75, "y":3.25},
{"label":"D", "x":3.75, "y":3.25},
{"label":"F", "x":4.75, "y":3.25},
{"label":"G", "x":5.75, "y":3.25},
{"label":"H", "x":6.75, "y":3.25},
{"label":"J", "x":7.75, "y":3.25},
{"label":"K", "x":8.75, "y":3.25},
{"label":"L", "x":9.75, "y":3.25},
{"label":";:", "x":10.75, "y":3.25},
{"label":"'\"", "x":11.75, "y":3.25},
{"label":"#~", "x":12.75, "y":3.25},
{"label":"Enter", "x":13.75, "y":2.25, "w":1.25, "h":2},
{"label":"Home", "x":15.25, "y":3.25},
{"label":"Shift", "x":0, "y":4.25, "w":1.25},
{"label":"\\|", "x":1.25, "y":4.25},
{"label":"Z", "x":2.25, "y":4.25},
{"label":"X", "x":3.25, "y":4.25},
{"label":"C", "x":4.25, "y":4.25},
{"label":"V", "x":5.25, "y":4.25},
{"label":"B", "x":6.25, "y":4.25},
{"label":"N", "x":7.25, "y":4.25},
{"label":"M", "x":8.25, "y":4.25},
{"label":",<", "x":9.25, "y":4.25},
{"label":".>", "x":10.25, "y":4.25},
{"label":"/?", "x":11.25, "y":4.25},
{"label":"Shift", "x":12.25, "y":4.25, "w":1.75},
{"label":"Up", "x":14.25, "y":4.5},
{"label":"Ctrl", "x":0, "y":5.25, "w":1.25},
{"label":"Win", "x":1.25, "y":5.25, "w":1.25},
{"label":"Alt", "x":2.5, "y":5.25, "w":1.25},
{"label":"Space", "x":3.75, "y":5.25, "w":6.25},
{"label":"Alt", "x":10, "y":5.25},
{"label":"Fn", "x":11, "y":5.25},
{"label":"Ctrl", "x":12, "y":5.25},
{"label":"Left", "x":13.25, "y":5.5},
{"label":"Down", "x":14.25, "y":5.5},
{"label":"Right", "x":15.25, "y":5.5}
]
}
}
}

View File

@@ -0,0 +1,114 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers {
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = SAFE_RANGE,
KC_LAUNCHPAD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {{2, {KC_LWIN, KC_TAB}}, {2, {KC_LWIN, KC_E}}};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_iso_83(
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_iso_83(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_iso_83(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_iso_83(
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
};
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1 @@
SRC += factory/major/test.c

View File

@@ -0,0 +1,130 @@
/* 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 QMK_KEYBOARD_H
// clang-format off
enum layers {
MAC_BASE,
MAC_FN,
WIN_BASE,
WIN_FN
};
enum custom_keycodes {
KC_MISSION_CONTROL = USER00,
KC_LAUNCHPAD,
KC_LOPTN,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};
typedef struct PACKED {
uint8_t len;
uint8_t keycode[2];
} key_combination_t;
key_combination_t key_comb_list[2] = {{2, {KC_LWIN, KC_TAB}}, {2, {KC_LWIN, KC_E}}};
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD
#define KC_TASK KC_TASK_VIEW
#define KC_FLXP KC_FILE_EXPLORER
static uint8_t mac_keycode[4] = {KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MAC_BASE] = LAYOUT_iso_83(
KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[MAC_FN] = LAYOUT_iso_83(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
[WIN_BASE] = LAYOUT_iso_83(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
[WIN_FN] = LAYOUT_iso_83(
_______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
};
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
register_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
} else {
for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}

View File

@@ -0,0 +1,2 @@
VIA_ENABLE = yes
SRC += factory/major/test.c

View File

@@ -0,0 +1,159 @@
/* 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 "quantum.h"
const matrix_row_t matrix_mask[] = {
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111101111,
};
#ifdef RGB_MATRIX_ENABLE
const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
* | | G location
* | | | B location
* | | | | */
{0, C_1, A_1, B_1},
{0, C_2, A_2, B_2},
{0, C_3, A_3, B_3},
{0, C_4, A_4, B_4},
{0, C_5, A_5, B_5},
{0, C_6, A_6, B_6},
{0, C_7, A_7, B_7},
{0, C_8, A_8, B_8},
{0, C_9, A_9, B_9},
{0, C_10, A_10, B_10},
{0, C_11, A_11, B_11},
{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, I_1, G_1, H_1},
{0, I_2, G_2, H_2},
{0, I_3, G_3, H_3},
{0, I_4, G_4, H_4},
{0, I_5, G_5, H_5},
{0, I_6, G_6, H_6},
{0, I_7, G_7, H_7},
{0, I_8, G_8, H_8},
{0, I_9, G_9, H_9},
{0, I_10, G_10, H_10},
{0, I_11, G_11, H_11},
{0, I_12, G_12, H_12},
{0, I_13, G_13, H_13},
{0, I_14, G_14, H_14},
{0, I_16, G_16, H_16},
{0, F_1, D_1, E_1},
{0, F_2, D_2, E_2},
{0, F_3, D_3, E_3},
{0, F_4, D_4, E_4},
{0, F_5, D_5, E_5},
{0, F_6, D_6, E_6},
{0, F_7, D_7, E_7},
{0, F_8, D_8, E_8},
{0, F_9, D_9, E_9},
{0, F_10, D_10, E_10},
{0, F_11, D_11, E_11},
{0, F_12, D_12, E_12},
{0, F_13, D_13, E_13},
{0, F_16, D_16, E_16},
{1, I_1, G_1, H_1},
{1, I_2, G_2, H_2},
{1, I_3, G_3, H_3},
{1, I_4, G_4, H_4},
{1, I_5, G_5, H_5},
{1, I_6, G_6, H_6},
{1, I_7, G_7, H_7},
{1, I_8, G_8, H_8},
{1, I_9, G_9, H_9},
{1, I_10, G_10, H_10},
{1, I_11, G_11, H_11},
{1, I_12, G_12, H_12},
{1, I_14, G_14, H_14},
{0, F_14, D_14, E_14},
{1, I_16, G_16, H_16},
{1, F_1, D_1, E_1},
{1, F_2, D_2, E_2},
{1, F_3, D_3, E_3},
{1, F_4, D_4, E_4},
{1, F_5, D_5, E_5},
{1, F_6, D_6, E_6},
{1, F_7, D_7, E_7},
{1, F_8, D_8, E_8},
{1, F_9, D_9, E_9},
{1, F_10, D_10, E_10},
{1, F_11, D_11, E_11},
{1, F_12, D_12, E_12},
{1, F_14, D_14, E_14},
{1, F_15, D_15, E_15},
{1, C_1, A_1, B_1},
{1, C_2, A_2, B_2},
{1, C_3, A_3, B_3},
{1, C_7, A_7, B_7},
{1, C_11, A_11, B_11},
{1, C_12, A_12, B_12},
{1, C_13, A_13, B_13},
{1, C_14, A_14, B_14},
{1, C_15, A_15, B_15},
{1, C_16, A_16, B_16},
};
#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, 13, __, 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, 57, __, 43 },
{ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, __, 56, __, 58 },
{ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, __, 71, 72, __ },
{ 73, 74, 75, __, __, __, 76, __, __, __, 77, 78, 79, 80, 81, 82 }
},
{
// 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}, {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}, {187,38}, {203,32}, {224,38},
{2,49}, {18,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,52},
{2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {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,
9, 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, 1, 1,
1, 1, 1, 4, 1, 1, 1, 1, 1, 1
}
};
#endif

View File

@@ -0,0 +1,37 @@
/* 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/>.
*/
#pragma once
#include "quantum.h"
#define XXX KC_NO
#define LAYOUT_iso_83( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0F, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1F, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2F, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K2D, K3F, \
K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K4E, \
K50, K51, K52, K56, K5A, K5B, K5C, K5D, K5E, K5F \
) { \
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, XXX, K0F }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, XXX, K1F }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, XXX, K2F }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, XXX, K3F }, \
{ K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, XXX, K4D, K4E, XXX }, \
{ K50, K51, K52, XXX, XXX, XXX, K56, XXX, XXX, XXX, K5A, K5B, K5C, K5D, K5E, K5F } \
}

View File

@@ -0,0 +1 @@
# The ISO variant of the Keychron Q1

View File

@@ -0,0 +1,33 @@
# MCU name
MCU = STM32L432
# Bootloader selection
BOOTLOADER = stm32-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Enable USB N-key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
DIP_SWITCH_ENABLE = yes
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = CKLED2001
RAW_ENABLE = yes
LTO_ENABLE = yes
EEPROM_DRIVER = wear_leveling
WEAR_LEVELING_DRIVER = embedded_flash
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
# custom matrix setup
CUSTOM_MATRIX = lite
SRC += matrix.c

View File

@@ -0,0 +1,57 @@
/* 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/>.
*/
#pragma once
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 16
/* key matrix pins */
#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 }
#define MATRIX_COL_PINS { C14, C15, A0, A1, A2, A3, A4, A5, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { {5,4} }
/* RGB Matrix Driver Configuration */
#define DRIVER_COUNT 2
#define DRIVER_ADDR_1 0b1110111
#define DRIVER_ADDR_2 0b1110100
/* RGB Matrix Configuration */
#define DRIVER_1_LED_TOTAL 45
#define DRIVER_2_LED_TOTAL 38
#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
#define CKLED2001_CURRENT_TUNE \
{ 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50, 0xA6, 0xA6, 0x50 }
/* Encoder Configuration */
#define ENCODERS_PAD_A { A10 }
#define ENCODERS_PAD_B { A8 }
#define ENCODER_RESOLUTION 4
#define ENCODER_DEFAULT_POS 0x3
/* EEPROM Driver Configuration */
#define WEAR_LEVELING_LOGICAL_SIZE 2048
#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2)
/* Enable caps-lock LED */
#define CAPS_LOCK_LED_INDEX 44

Some files were not shown because too many files have changed in this diff Show More