forked from mirrors/qmk_firmware
Compare commits
232 Commits
master
...
playground
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5413fb76a7 | ||
|
|
b0523764a0 | ||
|
|
2e7b526f64 | ||
|
|
9a665f9f12 | ||
|
|
fb39fc7e13 | ||
|
|
e08360b190 | ||
|
|
4078f374f9 | ||
|
|
39439c8d7e | ||
|
|
a44d65b624 | ||
|
|
78ae45e658 | ||
|
|
a16b549e52 | ||
|
|
68ff6019dd | ||
|
|
afe9ccb101 | ||
|
|
7083a70c21 | ||
|
|
539922211e | ||
|
|
09a1c041ae | ||
|
|
6d9254ebc3 | ||
|
|
b2f6c42b7a | ||
|
|
0100fe5635 | ||
|
|
a37f78f6f8 | ||
|
|
6f117dacdf | ||
|
|
ea02eb122c | ||
|
|
744e8e75b0 | ||
|
|
723e6561fd | ||
|
|
8cf88f04b6 | ||
|
|
c75068a0ef | ||
|
|
e28220c074 | ||
|
|
4e76ba7606 | ||
|
|
0c564ffc76 | ||
|
|
a7ecd8e1f9 | ||
|
|
65356eae42 | ||
|
|
69e014586d | ||
|
|
b035a1e747 | ||
|
|
7e688c5850 | ||
|
|
a03de89b79 | ||
|
|
2b7af51fd3 | ||
|
|
02ae9da074 | ||
|
|
22ccdc5583 | ||
|
|
110c5c67d2 | ||
|
|
8c674af028 | ||
|
|
01a59c0a56 | ||
|
|
610ec8a726 | ||
|
|
8f2426b7e3 | ||
|
|
5085d2d0e0 | ||
|
|
904a5cb799 | ||
|
|
2fc4e36cec | ||
|
|
62f75190df | ||
|
|
62d14ad731 | ||
|
|
8850c2cf02 | ||
|
|
4da61b144a | ||
|
|
a94a1c3f89 | ||
|
|
fe0d50733e | ||
|
|
e27437a18c | ||
|
|
6c93ae4335 | ||
|
|
926ed4fa00 | ||
|
|
a3549b7639 | ||
|
|
8aad4e1f11 | ||
|
|
b016227aa6 | ||
|
|
79770ef7bd | ||
|
|
ec7d6d1d8d | ||
|
|
8964cf7235 | ||
|
|
17ca68de9d | ||
|
|
06d7fc71e9 | ||
|
|
820642264c | ||
|
|
ddc3c5517a | ||
|
|
5a3a7beb27 | ||
|
|
df3331ce51 | ||
|
|
6ad220e31c | ||
|
|
f87bca8f68 | ||
|
|
6412c16106 | ||
|
|
753fd94096 | ||
|
|
af46cdf377 | ||
|
|
e4a022ac19 | ||
|
|
5afd315f44 | ||
|
|
fa92192c1a | ||
|
|
2a26bc0c29 | ||
|
|
1d0320145e | ||
|
|
6bb4611199 | ||
|
|
7afdf42dd0 | ||
|
|
efcd6e0f37 | ||
|
|
83266926d2 | ||
|
|
73b43dc068 | ||
|
|
57c561c7d8 | ||
|
|
29af921cee | ||
|
|
d1ce8f74a8 | ||
|
|
044619fc3d | ||
|
|
bf8d94b4b4 | ||
|
|
ebeec675fd | ||
|
|
51925bf6bf | ||
|
|
9959b6c903 | ||
|
|
0a2c795a06 | ||
|
|
ac51258505 | ||
|
|
3db3754abb | ||
|
|
770ad2a0cb | ||
|
|
b066af9656 | ||
|
|
afcd4f9f1e | ||
|
|
57a50169b6 | ||
|
|
26af2efb5d | ||
|
|
765c219388 | ||
|
|
537c1c0661 | ||
|
|
c9d1e74f6d | ||
|
|
eb3e14c61b | ||
|
|
5589c8f8bb | ||
|
|
7185ed3cc8 | ||
|
|
f88ff97ac6 | ||
|
|
2977aa9d2d | ||
|
|
1fa631eda5 | ||
|
|
5a72cbf887 | ||
|
|
524515f76f | ||
|
|
9ab79d6418 | ||
|
|
59d0c00ecb | ||
|
|
e0a567e9d4 | ||
|
|
6b35d3ac4b | ||
|
|
4d6d545990 | ||
|
|
2688e7d16e | ||
|
|
ad8298a965 | ||
|
|
71687629a0 | ||
|
|
897759491f | ||
|
|
aae4f196d4 | ||
|
|
4753be86b9 | ||
|
|
ea518140dc | ||
|
|
58aba271f3 | ||
|
|
03aa277537 | ||
|
|
08095b3f3d | ||
|
|
96d8e32d8d | ||
|
|
de608e6324 | ||
|
|
909b1ea96e | ||
|
|
e0277f678e | ||
|
|
9a93b32edb | ||
|
|
e974bf5994 | ||
|
|
75bd92341a | ||
|
|
71cd1993c9 | ||
|
|
e6f02ba63b | ||
|
|
efa69ee1e4 | ||
|
|
1f6ac8e844 | ||
|
|
fb4552b8fc | ||
|
|
f69d460cf4 | ||
|
|
47351e03b1 | ||
|
|
1ae99bc017 | ||
|
|
ad67ffceec | ||
|
|
80fc251925 | ||
|
|
f80692c140 | ||
|
|
9a112e5b99 | ||
|
|
ac271e09b9 | ||
|
|
e3df51da6e | ||
|
|
76ee809f52 | ||
|
|
dbda307eed | ||
|
|
e9cc4f0cc1 | ||
|
|
602cc4b47e | ||
|
|
b3bcf0bd57 | ||
|
|
6a76bc7593 | ||
|
|
0376e34005 | ||
|
|
1b7b6b41dd | ||
|
|
c183bcf1fb | ||
|
|
d846155734 | ||
|
|
8c5b31a68c | ||
|
|
70eceff30c | ||
|
|
8f8c6a0445 | ||
|
|
0e0caa4aa7 | ||
|
|
5288d96248 | ||
|
|
32fadf61bf | ||
|
|
841e8370d7 | ||
|
|
fd1ad26cab | ||
|
|
f596ddaf5b | ||
|
|
6998ab5158 | ||
|
|
e09420bf45 | ||
|
|
6ce7f470e0 | ||
|
|
8bda07f6ff | ||
|
|
c2fa4da7d9 | ||
|
|
c7fb4ba6a5 | ||
|
|
3f8ad9b9ab | ||
|
|
70ba4b1293 | ||
|
|
01d6687fff | ||
|
|
961a837042 | ||
|
|
42d505bcfd | ||
|
|
405db97f59 | ||
|
|
3b63a3514c | ||
|
|
635abb3f71 | ||
|
|
2cc0d2b01f | ||
|
|
db7f677287 | ||
|
|
56e090fcd5 | ||
|
|
809dac5ebc | ||
|
|
de7f3ab7c6 | ||
|
|
dfa898807d | ||
|
|
06260b94c1 | ||
|
|
5a3614f843 | ||
|
|
3164bc2f0a | ||
|
|
044354a1dd | ||
|
|
6d84790dd7 | ||
|
|
ae43e23aff | ||
|
|
e50c2e6a13 | ||
|
|
ca212da183 | ||
|
|
b1bc9dcd74 | ||
|
|
b23f7f3d96 | ||
|
|
eea970e4c5 | ||
|
|
db54ea7c0e | ||
|
|
c832826202 | ||
|
|
e76de5a572 | ||
|
|
00549a04d8 | ||
|
|
d4d08da553 | ||
|
|
ca65b2c896 | ||
|
|
e165f336ac | ||
|
|
1c9197facb | ||
|
|
d6621a81aa | ||
|
|
8a9cd2966a | ||
|
|
955488a679 | ||
|
|
51254f181e | ||
|
|
33bfbef0dc | ||
|
|
0a69fce67e | ||
|
|
db1e468850 | ||
|
|
059710a44b | ||
|
|
daab54dcb9 | ||
|
|
1d45a038d5 | ||
|
|
2ec82dd56b | ||
|
|
055f83519e | ||
|
|
a6273e40c2 | ||
|
|
789bfa0dbf | ||
|
|
54a4ac468f | ||
|
|
b20e2e456e | ||
|
|
d1076291c5 | ||
|
|
bffb7be4bd | ||
|
|
2bc2758eff | ||
|
|
95cb80bfa4 | ||
|
|
6442612e62 | ||
|
|
969f3ae0c3 | ||
|
|
beb8a29d54 | ||
|
|
5b6f578a4a | ||
|
|
29d64de4d1 | ||
|
|
79c3bf0a7c | ||
|
|
7314f4bbd2 | ||
|
|
2b465c78bf | ||
|
|
2dad42edae |
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -26,6 +26,6 @@
|
||||
},
|
||||
"python.formatting.provider": "yapf",
|
||||
"[json]": {
|
||||
"editor.formatOnSave": false
|
||||
"editor.formatOnSave": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
309
keyboards/keychron/factory/major/test.c
Normal file
309
keyboards/keychron/factory/major/test.c
Normal 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;
|
||||
}
|
||||
233
keyboards/keychron/factory/secondary/q0/test.c
Normal file
233
keyboards/keychron/factory/secondary/q0/test.c
Normal 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
|
||||
303
keyboards/keychron/factory/secondary/q2/test.c
Normal file
303
keyboards/keychron/factory/secondary/q2/test.c
Normal 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;
|
||||
}
|
||||
305
keyboards/keychron/factory/secondary/q60/test.c
Normal file
305
keyboards/keychron/factory/secondary/q60/test.c
Normal 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;
|
||||
}
|
||||
306
keyboards/keychron/factory/secondary/q9/test.c
Normal file
306
keyboards/keychron/factory/secondary/q9/test.c
Normal 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;
|
||||
}
|
||||
103
keyboards/keychron/q0/config.h
Normal file
103
keyboards/keychron/q0/config.h
Normal 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
|
||||
@@ -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>
|
||||
@@ -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
|
||||
90
keyboards/keychron/q0/q0.c
Normal file
90
keyboards/keychron/q0/q0.c
Normal 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
|
||||
23
keyboards/keychron/q0/q0.h
Normal file
23
keyboards/keychron/q0/q0.h
Normal 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
|
||||
24
keyboards/keychron/q0/q0_stm32l432/config.h
Normal file
24
keyboards/keychron/q0/q0_stm32l432/config.h
Normal 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
|
||||
43
keyboards/keychron/q0/q0_stm32l432/info.json
Normal file
43
keyboards/keychron/q0/q0_stm32l432/info.json
Normal 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}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
53
keyboards/keychron/q0/q0_stm32l432/keymaps/default/keymap.c
Normal file
53
keyboards/keychron/q0/q0_stm32l432/keymaps/default/keymap.c
Normal 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(
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______)
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
SRC += factory/secondary/q0/test.c
|
||||
53
keyboards/keychron/q0/q0_stm32l432/keymaps/via/keymap.c
Normal file
53
keyboards/keychron/q0/q0_stm32l432/keymaps/via/keymap.c
Normal 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(
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______)
|
||||
};
|
||||
2
keyboards/keychron/q0/q0_stm32l432/keymaps/via/rules.mk
Normal file
2
keyboards/keychron/q0/q0_stm32l432/keymaps/via/rules.mk
Normal file
@@ -0,0 +1,2 @@
|
||||
VIA_ENABLE = yes
|
||||
SRC += factory/secondary/q0/test.c
|
||||
88
keyboards/keychron/q0/q0_stm32l432/q0_stm32l432.c
Normal file
88
keyboards/keychron/q0/q0_stm32l432/q0_stm32l432.c
Normal 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
|
||||
38
keyboards/keychron/q0/q0_stm32l432/q0_stm32l432.h
Normal file
38
keyboards/keychron/q0/q0_stm32l432/q0_stm32l432.h
Normal 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 }, \
|
||||
}
|
||||
1
keyboards/keychron/q0/q0_stm32l432/readme.md
Normal file
1
keyboards/keychron/q0/q0_stm32l432/readme.md
Normal file
@@ -0,0 +1 @@
|
||||
# The base variant of the Keychron Q0
|
||||
28
keyboards/keychron/q0/q0_stm32l432/rules.mk
Normal file
28
keyboards/keychron/q0/q0_stm32l432/rules.mk
Normal 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
|
||||
19
keyboards/keychron/q0/readme.md
Normal file
19
keyboards/keychron/q0/readme.md
Normal 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).
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
179
keyboards/keychron/q1/matrix.c
Normal file
179
keyboards/keychron/q1/matrix.c
Normal 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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
104
keyboards/keychron/q1/q1_ansi_atmega32u4/info.json
Normal file
104
keyboards/keychron/q1/q1_ansi_atmega32u4/info.json
Normal 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}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
SRC += factory/major/test.c
|
||||
133
keyboards/keychron/q1/q1_ansi_atmega32u4/keymaps/via/keymap.c
Normal file
133
keyboards/keychron/q1/q1_ansi_atmega32u4/keymaps/via/keymap.c
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
VIA_ENABLE = yes
|
||||
SRC += factory/major/test.c
|
||||
@@ -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
|
||||
@@ -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 } \
|
||||
}
|
||||
@@ -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
|
||||
|
||||
50
keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/config.h
Normal file
50
keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/config.h
Normal 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
|
||||
@@ -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": {
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
SRC += factory/major/test.c
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
VIA_ENABLE = yes
|
||||
SRC += factory/major/test.c
|
||||
@@ -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
|
||||
@@ -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 } \
|
||||
}
|
||||
5
keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/readme.md
Normal file
5
keyboards/keychron/q1/q1_ansi_atmega32u4_ec11/readme.md
Normal 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.
|
||||
@@ -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
|
||||
|
||||
51
keyboards/keychron/q1/q1_ansi_stm32l432/config.h
Normal file
51
keyboards/keychron/q1/q1_ansi_stm32l432/config.h
Normal 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
|
||||
104
keyboards/keychron/q1/q1_ansi_stm32l432/info.json
Normal file
104
keyboards/keychron/q1/q1_ansi_stm32l432/info.json
Normal 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}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
117
keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/default/keymap.c
Normal file
117
keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/default/keymap.c
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
SRC += factory/major/test.c
|
||||
133
keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/via/keymap.c
Normal file
133
keyboards/keychron/q1/q1_ansi_stm32l432/keymaps/via/keymap.c
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
VIA_ENABLE = yes
|
||||
SRC += factory/major/test.c
|
||||
158
keyboards/keychron/q1/q1_ansi_stm32l432/q1_ansi_stm32l432.c
Normal file
158
keyboards/keychron/q1/q1_ansi_stm32l432/q1_ansi_stm32l432.c
Normal 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
|
||||
37
keyboards/keychron/q1/q1_ansi_stm32l432/q1_ansi_stm32l432.h
Normal file
37
keyboards/keychron/q1/q1_ansi_stm32l432/q1_ansi_stm32l432.h
Normal 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 } \
|
||||
}
|
||||
1
keyboards/keychron/q1/q1_ansi_stm32l432/readme.md
Normal file
1
keyboards/keychron/q1/q1_ansi_stm32l432/readme.md
Normal file
@@ -0,0 +1 @@
|
||||
# The ANSI variant of the Keychron Q1
|
||||
33
keyboards/keychron/q1/q1_ansi_stm32l432/rules.mk
Normal file
33
keyboards/keychron/q1/q1_ansi_stm32l432/rules.mk
Normal 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
|
||||
57
keyboards/keychron/q1/q1_ansi_stm32l432_ec11/config.h
Normal file
57
keyboards/keychron/q1/q1_ansi_stm32l432_ec11/config.h
Normal 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
|
||||
197
keyboards/keychron/q1/q1_ansi_stm32l432_ec11/info.json
Normal file
197
keyboards/keychron/q1/q1_ansi_stm32l432_ec11/info.json
Normal 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}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
SRC += factory/major/test.c
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
VIA_ENABLE = yes
|
||||
SRC += factory/major/test.c
|
||||
@@ -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
|
||||
@@ -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 } \
|
||||
}
|
||||
5
keyboards/keychron/q1/q1_ansi_stm32l432_ec11/readme.md
Normal file
5
keyboards/keychron/q1/q1_ansi_stm32l432_ec11/readme.md
Normal 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.
|
||||
35
keyboards/keychron/q1/q1_ansi_stm32l432_ec11/rules.mk
Normal file
35
keyboards/keychron/q1/q1_ansi_stm32l432_ec11/rules.mk
Normal 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
|
||||
41
keyboards/keychron/q1/q1_iso_atmega32u4/config.h
Normal file
41
keyboards/keychron/q1/q1_iso_atmega32u4/config.h
Normal 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
|
||||
@@ -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}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
SRC += factory/major/test.c
|
||||
133
keyboards/keychron/q1/q1_iso_atmega32u4/keymaps/via/keymap.c
Normal file
133
keyboards/keychron/q1/q1_iso_atmega32u4/keymaps/via/keymap.c
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
VIA_ENABLE = yes
|
||||
SRC += factory/major/test.c
|
||||
@@ -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
|
||||
37
keyboards/keychron/q1/q1_iso_atmega32u4/q1_iso_atmega32u4.h
Normal file
37
keyboards/keychron/q1/q1_iso_atmega32u4/q1_iso_atmega32u4.h
Normal 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 } \
|
||||
}
|
||||
@@ -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
|
||||
|
||||
44
keyboards/keychron/q1/q1_iso_atmega32u4_ec11/config.h
Normal file
44
keyboards/keychron/q1/q1_iso_atmega32u4_ec11/config.h
Normal 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
|
||||
199
keyboards/keychron/q1/q1_iso_atmega32u4_ec11/info.json
Normal file
199
keyboards/keychron/q1/q1_iso_atmega32u4_ec11/info.json
Normal 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}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
SRC += factory/major/test.c
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
VIA_ENABLE = yes
|
||||
SRC += factory/major/test.c
|
||||
@@ -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
|
||||
@@ -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 } \
|
||||
}
|
||||
5
keyboards/keychron/q1/q1_iso_atmega32u4_ec11/readme.md
Normal file
5
keyboards/keychron/q1/q1_iso_atmega32u4_ec11/readme.md
Normal 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.
|
||||
26
keyboards/keychron/q1/q1_iso_atmega32u4_ec11/rules.mk
Normal file
26
keyboards/keychron/q1/q1_iso_atmega32u4_ec11/rules.mk
Normal 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
|
||||
|
||||
51
keyboards/keychron/q1/q1_iso_stm32l432/config.h
Normal file
51
keyboards/keychron/q1/q1_iso_stm32l432/config.h
Normal 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
|
||||
105
keyboards/keychron/q1/q1_iso_stm32l432/info.json
Normal file
105
keyboards/keychron/q1/q1_iso_stm32l432/info.json
Normal 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}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
114
keyboards/keychron/q1/q1_iso_stm32l432/keymaps/default/keymap.c
Normal file
114
keyboards/keychron/q1/q1_iso_stm32l432/keymaps/default/keymap.c
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
SRC += factory/major/test.c
|
||||
130
keyboards/keychron/q1/q1_iso_stm32l432/keymaps/via/keymap.c
Normal file
130
keyboards/keychron/q1/q1_iso_stm32l432/keymaps/via/keymap.c
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
VIA_ENABLE = yes
|
||||
SRC += factory/major/test.c
|
||||
159
keyboards/keychron/q1/q1_iso_stm32l432/q1_iso_stm32l432.c
Normal file
159
keyboards/keychron/q1/q1_iso_stm32l432/q1_iso_stm32l432.c
Normal 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
|
||||
37
keyboards/keychron/q1/q1_iso_stm32l432/q1_iso_stm32l432.h
Normal file
37
keyboards/keychron/q1/q1_iso_stm32l432/q1_iso_stm32l432.h
Normal 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 } \
|
||||
}
|
||||
1
keyboards/keychron/q1/q1_iso_stm32l432/readme.md
Normal file
1
keyboards/keychron/q1/q1_iso_stm32l432/readme.md
Normal file
@@ -0,0 +1 @@
|
||||
# The ISO variant of the Keychron Q1
|
||||
33
keyboards/keychron/q1/q1_iso_stm32l432/rules.mk
Normal file
33
keyboards/keychron/q1/q1_iso_stm32l432/rules.mk
Normal 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
|
||||
57
keyboards/keychron/q1/q1_iso_stm32l432_ec11/config.h
Normal file
57
keyboards/keychron/q1/q1_iso_stm32l432_ec11/config.h
Normal 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
Reference in New Issue
Block a user