Update q0

This commit is contained in:
lalalademaxiya1 2023-02-25 16:36:43 +08:00
parent f5fc0776cf
commit edaf67bea1
87 changed files with 397 additions and 257 deletions

View File

@ -19,11 +19,16 @@
bool is_siri_active = false;
uint32_t siri_timer = 0;
key_combination_t key_comb_list[4] = {{2, {KC_LWIN, KC_TAB}}, {2, {KC_LWIN, KC_E}}, {3, {KC_LSFT, KC_LCMD, KC_4}}, {2, {KC_LWIN, KC_C}}};
// clang-format off
key_combination_t key_comb_list[4] = {
{2, {KC_LWIN, KC_TAB}},
{2, {KC_LWIN, KC_E}},
{3, {KC_LSFT, KC_LCMD, KC_4}},
{2, {KC_LWIN, KC_C}}
};
static uint8_t mac_keycode[4] = {KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD};
//clang-format on
void housekeeping_task_keychron(void) {
if (is_siri_active) {
if (sync_timer_elapsed32(siri_timer) >= 500) {
@ -32,15 +37,9 @@ void housekeeping_task_keychron(void) {
is_siri_active = false;
}
}
housekeeping_task_keychron_ft();
}
bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
if (!process_record_keychron_ft(keycode, record)) {
return false;
}
switch (keycode) {
case KC_MISSION_CONTROL:
if (record->event.pressed) {
@ -48,14 +47,14 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
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
return false; // Skip all further processing of this key
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
@ -65,7 +64,7 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
return false; // Skip all further processing of this key
case KC_SIRI:
if (record->event.pressed) {
if (!is_siri_active) {
@ -77,7 +76,7 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
} else {
// Do something else when release
}
return false; // Skip all further processing of this key
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
case KC_SNAP:
@ -91,8 +90,101 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
return true; // Process all other keycodes normally
}
}
#if defined(RGB_MATRIX_ENABLE) && (defined(CAPS_LOCK_LED_INDEX) || defined(NUM_LOCK_LED_INDEX))
# define CAPS_NUM_LOCK_MAX_BRIGHTNESS 0xFF
# ifdef RGB_MATRIX_MAXIMUM_BRIGHTNESS
# undef CAPS_NUM_LOCK_MAX_BRIGHTNESS
# define CAPS_NUM_LOCK_MAX_BRIGHTNESS RGB_MATRIX_MAXIMUM_BRIGHTNESS
# endif
# define CAPS_NUM_LOCK_VAL_STEP 8
# ifdef RGB_MATRIX_VAL_STEP
# undef CAPS_NUM_LOCK_VAL_STEP
# define CAPS_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 < CAPS_NUM_LOCK_VAL_STEP) {
value = CAPS_NUM_LOCK_VAL_STEP;
} else if (value < (CAPS_NUM_LOCK_MAX_BRIGHTNESS - CAPS_NUM_LOCK_VAL_STEP)) {
value += CAPS_NUM_LOCK_VAL_STEP; // one step more than current brightness
} else {
value = CAPS_NUM_LOCK_MAX_BRIGHTNESS;
}
return value;
}
bool rgb_matrix_indicators_kb(void) {
if (!rgb_matrix_indicators_user()) {
return false;
}
# if defined(CAPS_LOCK_LED_INDEX)
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
}
# endif
# if defined(NUM_LOCK_LED_INDEX)
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
}
# endif
return true;
}
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 defined(CAPS_LOCK_LED_INDEX)
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);
}
# endif
# if defined(NUM_LOCK_LED_INDEX)
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);
}
# endif
rgb_matrix_update_pwm_buffers();
}
return res;
}
#endif

View File

@ -15,7 +15,6 @@
*/
#include "quantum_keycodes.h"
#include "keychron_ft_common.h"
#ifdef VIA_ENABLE
# include "via.h"
#endif

View File

@ -14,28 +14,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "raw_hid.h"
#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)
#include "keychron_ft_common.h"
// clang-format off
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;
OS_SWITCH = 0x01,
};
enum {
FACTORY_TEST_CMD_BACKLIGHT = 0x01,
@ -43,11 +28,6 @@ enum {
FACTORY_TEST_CMD_JUMP_TO_BL,
FACTORY_TEST_CMD_EEPROM_CLEAR
};
enum {
OS_SWITCH = 0x01,
};
// clang-format on
uint16_t key_press_status = 0;
@ -57,44 +37,44 @@ uint8_t factory_reset_count = 0;
bool report_os_sw_state = false;
extern matrix_row_t matrix[MATRIX_ROWS];
bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record) {
__attribute__((weak)) bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case MO(1):
case MO(2):
case MO(3):
case MO(4):
if (record->event.pressed) {
key_press_status |= KEY_PRESS_FN;
key_press_status |= KEY_PRESS_STEP_0;
} else {
key_press_status &= ~KEY_PRESS_FN;
key_press_status &= ~KEY_PRESS_STEP_0;
timer_3s_buffer = 0;
}
return true;
case KC_J:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_J;
key_press_status |= KEY_PRESS_STEP_1;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32() == 0 ? 1 : sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_J;
key_press_status &= ~KEY_PRESS_STEP_1;
timer_3s_buffer = 0;
}
return true;
case KC_Z:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_Z;
key_press_status |= KEY_PRESS_STEP_2;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32() == 0 ? 1 : sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_Z;
key_press_status &= ~KEY_PRESS_STEP_2;
timer_3s_buffer = 0;
}
return true;
case KC_RIGHT:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_RIGHT;
key_press_status |= KEY_PRESS_STEP_3;
if (led_test_mode) {
if (++led_test_mode >= LED_TEST_MODE_MAX) {
led_test_mode = LED_TEST_MODE_WHITE;
@ -103,20 +83,20 @@ bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record) {
timer_3s_buffer = sync_timer_read32() == 0 ? 1 : sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_RIGHT;
key_press_status &= ~KEY_PRESS_STEP_3;
timer_3s_buffer = 0;
}
return true;
case KC_HOME:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_HOME;
key_press_status |= KEY_PRESS_STEP_4;
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() == 0 ? 1 : sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_HOME;
key_press_status &= ~KEY_PRESS_STEP_4;
timer_3s_buffer = 0;
}
return true;
@ -243,11 +223,11 @@ static void system_switch_state_report(uint8_t index, bool active) {
if (report_os_sw_state) {
payload[0] = FACTORY_TEST_CMD_OS_SWITCH;
payload[1] = OS_SWITCH;
# if defined(OS_SWITCH_REVERSE)
#if defined(OS_SWITCH_REVERSE)
payload[2] = !active;
# else
#else
payload[2] = active;
# endif
#endif
data[0] = 0xAB;
memcpy(&data[1], payload, 3);
for (uint8_t i = 1; i < RAW_EPSIZE - 3; i++) {
@ -282,12 +262,14 @@ bool via_command_kb(uint8_t *data, uint8_t length) {
timer_3s_buffer = 0;
break;
#endif
#if defined(DIP_SWITCH_ENABLE)
case FACTORY_TEST_CMD_OS_SWITCH:
report_os_sw_state = data[2];
if (report_os_sw_state) {
dip_switch_read(true);
}
break;
#endif
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();
@ -306,6 +288,8 @@ bool via_command_kb(uint8_t *data, uint8_t length) {
return false;
}
#if defined(MCU) && (MCU == STM32L432)
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}
#endif

View File

@ -14,7 +14,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdint.h"
#include "quantum.h"
#define KEY_PRESS_STEP_0 (0x1 << 0)
#define KEY_PRESS_STEP_1 (0x1 << 1)
#define KEY_PRESS_STEP_2 (0x1 << 2)
#define KEY_PRESS_STEP_3 (0x1 << 3)
#define KEY_PRESS_STEP_4 (0x1 << 4)
#define KEY_PRESS_FACTORY_RESET (KEY_PRESS_STEP_0 | KEY_PRESS_STEP_1 | KEY_PRESS_STEP_2)
#define KEY_PRESS_LED_TEST (KEY_PRESS_STEP_0 | KEY_PRESS_STEP_3 | KEY_PRESS_STEP_4)
// clang-format off
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;
// clang-format on
extern uint16_t key_press_status;
extern uint32_t timer_3s_buffer;
bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record);
void housekeeping_task_keychron_ft(void);
bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record);

View File

@ -0,0 +1,89 @@
/* Copyright 2023 @ Keychron (https://www.keychron.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "keychron_ft_common.h"
bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case MO(1):
case MO(2):
case MO(3):
case MO(4):
if (record->event.pressed) {
key_press_status |= KEY_PRESS_STEP_0;
} else {
key_press_status &= ~KEY_PRESS_STEP_0;
timer_3s_buffer = 0;
}
return true;
case RGB_SAD:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_STEP_1;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32() == 0 ? 1 : sync_timer_read32();
} else {
}
} else {
rgb_matrix_decrease_sat_noeeprom();
key_press_status &= ~KEY_PRESS_STEP_1;
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_STEP_2;
if (key_press_status == KEY_PRESS_FACTORY_RESET) {
timer_3s_buffer = sync_timer_read32() == 0 ? 1 : sync_timer_read32();
} else {
}
} else {
rgb_matrix_decrease_hue_noeeprom();
key_press_status &= ~KEY_PRESS_STEP_2;
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_STEP_3;
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() == 0 ? 1 : sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_STEP_3;
timer_3s_buffer = 0;
}
return true;
case KC_DEL:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_STEP_4;
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() == 0 ? 1 : sync_timer_read32();
}
} else {
key_press_status &= ~KEY_PRESS_STEP_4;
timer_3s_buffer = 0;
}
return true;
default:
return true;
}
}

View File

@ -1,61 +0,0 @@
/* 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 "quantum.h"
#if defined(RGB_MATRIX_ENABLE) && defined(NUM_LOCK_LED_INDEX)
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
# ifdef RGB_MATRIX_ENABLE
case RGB_TOG:
if (record->event.pressed) {
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_set_color_all(0, 0, 0);
} break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
} break;
}
}
return false;
# endif
}
return true;
}
bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) {
return false;
}
// RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue);
if (host_keyboard_led_state().num_lock) {
RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_LED_INDEX, 255, 255, 255);
} else {
if (!rgb_matrix_get_flags()) {
RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_LED_INDEX, 0, 0, 0);
}
}
return true;
}
#endif // NUM_LOCK_LED_INDEX

View File

@ -17,8 +17,10 @@
#pragma once
/* key matrix pins */
#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 }
#define MATRIX_COL_PINS { A5, A6, A7, B0 }
#define MATRIX_ROW_PINS \
{ B5, B4, B3, A15, A14, A13 }
#define MATRIX_COL_PINS \
{ A5, A6, A7, B0 }
/* RGB Matrix Driver Configuration */
#define DRIVER_COUNT 1
@ -28,7 +30,8 @@
#define DRIVER_1_LED_TOTAL 21
#define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL
#define RGB_MATRIX_CENTER { 56, 16 }
#define CKLED2001_CURRENT_TUNE \
{ 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70 }
/* Enable num-lock LED */
#define NUM_LOCK_LED_INDEX 4

View File

@ -1,13 +1,15 @@
{
"keyboard_name": "Q0",
"keyboard_name": "Keychron Q0",
"manufacturer": "Keychron",
"url": "https://github.com/Keychron",
"maintainer": "lalalademaxiya1",
"usb": {
"vid": "0x3434",
"pid": "0x0130",
"device_version": "1.0.2"
"device_version": "1.0.3"
},
"processor": "STM32L432",
"bootloader": "stm32-dfu",
"layouts": {
"LAYOUT_numpad_6x4": {
"layout": [

View File

@ -16,22 +16,25 @@
#include QMK_KEYBOARD_H
enum layers { _BASE, _FN1};
enum layers {
L0,
L1
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_numpad_6x4(
MO(_FN1), KC_ESC, KC_BSPC, KC_TAB,
[L0] = LAYOUT_numpad_6x4(
MO(L1), KC_ESC, KC_BSPC, KC_TAB,
KC_NUM, 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, _______)
[L1] = 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, _______)
};

View File

@ -16,50 +16,62 @@
#include QMK_KEYBOARD_H
#include "keychron_common.h"
#include "keychron_ft_common.h"
enum layers { _BASE, _FN1, _RESERVED1, _RESERVED2 };
enum layers {
L0,
L1,
L2,
L3
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_numpad_6x4(
MO(_FN1), KC_ESC, KC_BSPC, KC_TAB,
[L0] = LAYOUT_numpad_6x4(
MO(L1), KC_ESC, KC_BSPC, KC_TAB,
KC_NUM, 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, _______),
[L1] = 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(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______),
[L2] = LAYOUT_numpad_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______),
[_RESERVED2] = LAYOUT_numpad_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______)
[L3] = LAYOUT_numpad_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______)
};
void housekeeping_task_user(void) {
housekeeping_task_keychron();
housekeeping_task_keychron_ft();
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_record_keychron(keycode, record)) {
return false;
}
if (!process_record_keychron_ft(keycode, record)) {
return false;
}
return true;
}

View File

@ -2,4 +2,4 @@ VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes
VPATH += keyboards/keychron/common
SRC += keychron_common.c
SRC += keychron_common.c keychron_ft_common.c factory.c

View File

@ -16,38 +16,43 @@
#include QMK_KEYBOARD_H
enum layers { _BASE, _FN1, _RESERVED1, _RESERVED2 };
enum layers {
L0,
L1,
L2,
L3
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_numpad_6x4(
MO(_FN1), KC_ESC, KC_BSPC, KC_TAB,
[L0] = LAYOUT_numpad_6x4(
MO(L1), KC_ESC, KC_BSPC, KC_TAB,
KC_NUM, 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, _______),
[L1] = 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(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______),
[L2] = LAYOUT_numpad_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______),
[_RESERVED2] = LAYOUT_numpad_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______)
[L3] = LAYOUT_numpad_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______)
};

View File

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

View File

@ -69,17 +69,17 @@ led_config_t g_led_config = {
},
{
// LED Index to Physical Position
{0,0}, {37,0}, {75,0}, {112,0},
{0,6}, {37,6}, {75,6}, {112,6},
{0,13}, {37,13}, {75,13},
{0,19}, {37,19}, {75,19}, {112,16},
{0,25}, {37,25}, {75,25},
{18,32}, {75,32}, {112,29},
{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,
8, 4, 4, 4,
4, 4, 4,
4, 4, 4, 4,
4, 4, 4,
@ -87,4 +87,4 @@ led_config_t g_led_config = {
}
};
#endif // RGB_MATRIX_ENABLE
#endif

View File

@ -1,9 +1,3 @@
# MCU name
MCU = STM32L432
# Bootloader selection
BOOTLOADER = stm32-dfu
# Build Options
# change yes to no to disable.
#
@ -19,7 +13,6 @@ AUDIO_ENABLE = no # Audio output
DIP_SWITCH_ENABLE = no
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = CKLED2001
LTO_ENABLE = yes
EEPROM_DRIVER = wear_leveling
WEAR_LEVELING_DRIVER = embedded_flash

View File

@ -17,8 +17,10 @@
#pragma once
/* key matrix pins */
#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 }
#define MATRIX_COL_PINS { C14, C15, A0, A1, A2 }
#define MATRIX_ROW_PINS \
{ B5, B4, B3, A15, A14, A13 }
#define MATRIX_COL_PINS \
{ C14, C15, A0, A1, A2 }
/* RGB Matrix Driver Configuration */
#define DRIVER_COUNT 1
@ -35,9 +37,10 @@
#define NUM_LOCK_LED_INDEX 5
/* Encoder Configuration */
#define ENCODERS_PAD_A { A3 }
#define ENCODERS_PAD_B { A4 }
#define ENCODER_RESOLUTION 4
#define ENCODERS_PAD_A \
{ A3 }
#define ENCODERS_PAD_B \
{ A4 }
#define ENCODER_DEFAULT_POS 0x3
/* Specify (0,1) which programmed as "Fn" key on this keyboard as bootmagic key */

View File

@ -6,7 +6,7 @@
"usb": {
"vid": "0x3434",
"pid": "0x0131",
"device_version": "1.0.0"
"device_version": "1.0.1"
},
"processor": "STM32L432",
"bootloader": "stm32-dfu",

View File

@ -19,31 +19,31 @@
// clang-format off
enum layers {
BASE,
FUNC
L0,
L1
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT_numpad_6x5(
KC_MUTE, MO(FUNC), KC_ESC, KC_BSPC, KC_TAB,
[L0] = LAYOUT_numpad_6x5(
KC_MUTE, MO(L1), KC_ESC, KC_BSPC, KC_TAB,
_______, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
_______, KC_P7, KC_P8, KC_P9, KC_PPLS,
_______, KC_P4, KC_P5, KC_P6,
_______, KC_P1, KC_P2, KC_P3, KC_PENT,
_______, KC_P0, KC_PDOT),
_______, KC_P0, KC_PDOT ),
[FUNC] = LAYOUT_numpad_6x5(
[L1] = LAYOUT_numpad_6x5(
RGB_TOG, _______, 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),
_______, RGB_TOG, KC_MNXT ),
};
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[FUNC] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
[L0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[L1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
};
#endif // ENCODER_MAP_ENABLE

View File

@ -16,32 +16,33 @@
#include QMK_KEYBOARD_H
#include "keychron_common.h"
#include "keychron_ft_common.h"
// clang-format off
enum layers {
BASE,
FUNC,
L0,
L1,
L2,
L3
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT_numpad_6x5(
KC_MUTE, MO(FUNC), KC_ESC, KC_BSPC, KC_TAB,
[L0] = LAYOUT_numpad_6x5(
KC_MUTE, MO(L1), KC_ESC, KC_BSPC, KC_TAB,
MACRO01, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
MACRO02, KC_P7, KC_P8, KC_P9, KC_PPLS,
MACRO03, KC_P4, KC_P5, KC_P6,
MACRO04, KC_P1, KC_P2, KC_P3, KC_PENT,
MACRO05, KC_P0, KC_PDOT),
MACRO05, KC_P0, KC_PDOT ),
[FUNC] = LAYOUT_numpad_6x5(
[L1] = LAYOUT_numpad_6x5(
RGB_TOG, _______, KC_MUTE, KC_VOLD, KC_VOLU,
MACRO01, RGB_MOD, RGB_VAI, RGB_HUI, KC_DEL,
MACRO02, RGB_RMOD, RGB_VAD, RGB_HUD, _______,
MACRO03, RGB_SAI, RGB_SPI, KC_MPRV,
MACRO04, RGB_SAD, RGB_SPD, KC_MPLY, _______,
MACRO05, RGB_TOG, KC_MNXT),
MACRO05, RGB_TOG, KC_MNXT ),
[L2] = LAYOUT_numpad_6x5(
_______, _______, _______, _______, _______,
@ -49,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______),
_______, _______, _______ ),
[L3] = LAYOUT_numpad_6x5(
_______, _______, _______, _______, _______,
@ -57,13 +58,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______)
_______, _______, _______ )
};
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[FUNC] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
[L0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[L1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
[L2] = { ENCODER_CCW_CW(_______, _______) },
[L3] = { ENCODER_CCW_CW(_______, _______) }
};
@ -73,11 +74,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
void housekeeping_task_user(void) {
housekeeping_task_keychron();
housekeeping_task_keychron_ft();
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_record_keychron(keycode, record)) {
return false;
}
if (!process_record_keychron_ft(keycode, record)) {
return false;
}
return true;
}

View File

@ -2,4 +2,4 @@ VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes
VPATH += keyboards/keychron/common
SRC += keychron_common.c
SRC += keychron_common.c keychron_ft_common.c factory.c

View File

@ -19,28 +19,28 @@
// clang-format off
enum layers {
BASE,
FUNC,
L0,
L1,
L2,
L3
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT_numpad_6x5(
KC_MUTE, MO(FUNC), KC_ESC, KC_BSPC, KC_TAB,
[L0] = LAYOUT_numpad_6x5(
KC_MUTE, MO(L1), KC_ESC, KC_BSPC, KC_TAB,
MACRO01, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
MACRO02, KC_P7, KC_P8, KC_P9, KC_PPLS,
MACRO03, KC_P4, KC_P5, KC_P6,
MACRO04, KC_P1, KC_P2, KC_P3, KC_PENT,
MACRO05, KC_P0, KC_PDOT),
MACRO05, KC_P0, KC_PDOT ),
[FUNC] = LAYOUT_numpad_6x5(
[L1] = LAYOUT_numpad_6x5(
RGB_TOG, _______, KC_MUTE, KC_VOLD, KC_VOLU,
MACRO01, RGB_MOD, RGB_VAI, RGB_HUI, KC_DEL,
MACRO02, RGB_RMOD, RGB_VAD, RGB_HUD, _______,
MACRO03, RGB_SAI, RGB_SPI, KC_MPRV,
MACRO04, RGB_SAD, RGB_SPD, KC_MPLY, _______,
MACRO05, RGB_TOG, KC_MNXT),
MACRO05, RGB_TOG, KC_MNXT ),
[L2] = LAYOUT_numpad_6x5(
_______, _______, _______, _______, _______,
@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______),
_______, _______, _______ ),
[L3] = LAYOUT_numpad_6x5(
_______, _______, _______, _______, _______,
@ -56,13 +56,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______)
_______, _______, _______ )
};
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[FUNC] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
[L0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[L1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
[L2] = { ENCODER_CCW_CW(_______, _______) },
[L3] = { ENCODER_CCW_CW(_______, _______) }
};

View File

@ -1,6 +1,6 @@
# The enhanced version with encoder of the Keychron Q0
# Keychron Q0 Plus
- The name of this keyboard is "Q0 Plus"
- The name of this keyboard is "Keychron Q0 Plus"
- Enable EC11 rotary encoder
- Turn clockwise to increase volume and turn anti-clockwise to decrease volume
- Press the knob button to mute

View File

@ -88,7 +88,7 @@ led_config_t g_led_config = {
4, 4, 4, 4, 4,
4, 4, 4, 4,
4, 4, 4, 4, 4,
4, 4, 1,
4, 4, 4,
}
};

View File

@ -6,8 +6,10 @@
"usb": {
"vid": "0x3434",
"pid": "0x0100",
"device_version": "1.0.0"
"device_version": "1.1.0"
},
"processor": "STM32L432",
"bootloader": "stm32-dfu",
"layouts": {
"LAYOUT_ansi_82": {
"layout": [

View File

@ -16,30 +16,15 @@
#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
@ -91,3 +76,6 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES

View File

@ -1,7 +1,5 @@
# Keychron Q1
![Keychron Q1](https://cdn.shopify.com/s/files/1/0059/0630/1017/t/5/assets/pf-823ebdc7--1073.jpg)
A customizable 75% keyboard.
* Keyboard Maintainer: [Keychron](https://github.com/keychron)
@ -10,11 +8,11 @@ A customizable 75% keyboard.
Make example for this keyboard (after setting up your build environment):
make keychron/q1/ansi:default
make keychron/q1/ansi_atmega32u4:default
Flashing example for this keyboard:
make keychron/q1/ansi:default:flash
make keychron/q1/ansi_atmega32u4:default:flash
**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard.