[Keyboard] Add Keychron_q1 rev_0101 and Keychron q2 series (#15025)
Co-authored-by: Joel Challis <git@zvecr.com> Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Cesar Rojas <cesar.fieoner@gmail.com> Co-authored-by: lokher <lokher@gmail.com> Co-authored-by: Adam Karim <adam@akarsoft.com>
This commit is contained in:
parent
9e92d8a905
commit
ca0f922e07
63 changed files with 3255 additions and 136 deletions
30
keyboards/keychron/q2/chconf.h
Normal file
30
keyboards/keychron/q2/chconf.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* Copyright 2020 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file was auto-generated by:
|
||||
* `qmk chibios-confmigrate -i keyboards/acheron/arctic/chconf.h -r platforms/chibios/common/configs/chconf.h`
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CH_CFG_ST_FREQUENCY 10000
|
||||
|
||||
#define CH_CFG_OPTIMIZE_SPEED FALSE
|
||||
|
||||
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
|
||||
|
||||
#include_next <chconf.h>
|
54
keyboards/keychron/q2/config.h
Normal file
54
keyboards/keychron/q2/config.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* 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
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0x3434
|
||||
#define MANUFACTURER Keychron
|
||||
#define PRODUCT Keychron Q2
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 15
|
||||
|
||||
/* key matrix pins */
|
||||
#define MATRIX_ROW_PINS { B4, B3, A15, A14, A13 }
|
||||
#define MATRIX_COL_PINS { C14, C15, A0, A1, A2, A3, A4, A5, A6, A7, B0, B1, A8, A9, H3 }
|
||||
|
||||
/* DIP switch */
|
||||
#define DIP_SWITCH_MATRIX_GRID { {4, 4} }
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
#define DIODE_DIRECTION ROW2COL
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* Disable DIP switch in matrix data */
|
||||
#define MATRIX_MASKED
|
||||
|
||||
/* NKRO */
|
||||
#define FORCE_NKRO
|
||||
|
||||
/* turn off effects when suspended */
|
||||
#define RGB_DISABLE_WHEN_USB_SUSPENDED
|
||||
|
||||
/* Use 5 dynamic keymap layers */
|
||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 5
|
||||
|
||||
/* EEPROM Driver Configuration */
|
||||
#define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100010
|
26
keyboards/keychron/q2/halconf.h
Normal file
26
keyboards/keychron/q2/halconf.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* Copyright 2020 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file was auto-generated by:
|
||||
* `qmk chibios-confmigrate -i keyboards/nk65/halconf.h -r platforms/chibios/QMK_PROTON_C/configs/halconf.h`
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_I2C TRUE
|
||||
|
||||
#include_next <halconf.h>
|
139
keyboards/keychron/q2/matrix.c
Normal file
139
keyboards/keychron/q2/matrix.c
Normal file
|
@ -0,0 +1,139 @@
|
|||
/* Copyright 2021 @ Keychron (https://www.keychron.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
#include "debounce.h"
|
||||
#include "quantum.h"
|
||||
|
||||
#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 bool select_col(uint8_t col) {
|
||||
pin_t pin = col_pins[col];
|
||||
if (pin != NO_PIN) {
|
||||
setPinOutput_writeLow(pin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col) {
|
||||
pin_t pin = col_pins[col];
|
||||
if (pin != NO_PIN) {
|
||||
setPinOutput_writeHigh(pin);
|
||||
}
|
||||
}
|
||||
|
||||
static void unselect_cols(void) {
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
unselect_col(x);
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < ROWS_PER_HAND; x++) {
|
||||
if (row_pins[x] != NO_PIN) {
|
||||
setPinInputHigh_atomic(row_pins[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
|
||||
bool key_pressed = false;
|
||||
|
||||
// Select col
|
||||
if (!select_col(current_col)) { // 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] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
key_pressed = true;
|
||||
} else {
|
||||
// Pin HI, clear col bit
|
||||
current_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << current_col);
|
||||
}
|
||||
}
|
||||
|
||||
// Unselect col
|
||||
unselect_col(current_col);
|
||||
matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH
|
||||
}
|
||||
|
||||
void matrix_init_custom(void) {
|
||||
// initialize key pins
|
||||
matrix_init_pins();
|
||||
}
|
||||
|
||||
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
||||
matrix_row_t curr_matrix[MATRIX_ROWS] = {0};
|
||||
|
||||
// Set col, read rows
|
||||
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
||||
matrix_read_rows_on_col(curr_matrix, current_col);
|
||||
}
|
||||
|
||||
bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0;
|
||||
if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix));
|
||||
|
||||
return (uint8_t)changed;
|
||||
}
|
27
keyboards/keychron/q2/mcuconf.h
Normal file
27
keyboards/keychron/q2/mcuconf.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/* Copyright 2020 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file was auto-generated by:
|
||||
* `qmk chibios-confmigrate -i keyboards/acheron/arctic/mcuconf.h -r platforms/chibios/GENERIC_STM32_F072XB/configs/mcuconf.h`
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_I2C_USE_I2C1
|
||||
#define STM32_I2C_USE_I2C1 TRUE
|
33
keyboards/keychron/q2/q2.c
Normal file
33
keyboards/keychron/q2/q2.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* 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 "q2.h"
|
||||
|
||||
const matrix_row_t matrix_mask[] = {
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111101111,
|
||||
};
|
||||
|
||||
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||
if (!dip_switch_update_user(index, active)) { return false;}
|
||||
if (index == 0) {
|
||||
default_layer_set(1UL << (active ? 1 : 0));
|
||||
}
|
||||
return true;
|
||||
}
|
29
keyboards/keychron/q2/q2.h
Normal file
29
keyboards/keychron/q2/q2.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* 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_q2_rev_0110)
|
||||
# include "rev_0110.h"
|
||||
#elif defined(KEYBOARD_keychron_q2_rev_0111)
|
||||
# include "rev_0111.h"
|
||||
#elif defined(KEYBOARD_keychron_q2_rev_0112)
|
||||
# include "rev_0112.h"
|
||||
#elif defined(KEYBOARD_keychron_q2_rev_0113)
|
||||
# include "rev_0113.h"
|
||||
#endif
|
19
keyboards/keychron/q2/readme.md
Normal file
19
keyboards/keychron/q2/readme.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Keychron Q2
|
||||
|
||||
A customizable 65% keyboard.
|
||||
|
||||
* Keyboard Maintainer: [Keychron](https://github.com/keychron)
|
||||
* Hardware Supported: Keychron Q2
|
||||
* Hardware Availability: [Keychron](https://www.keychron.com)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make keychron/q2/rev_0110:default
|
||||
|
||||
Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](https://docs.qmk.fm/#/flashing_bootloadhid))
|
||||
|
||||
make keychron/q2/rev_0110: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).
|
21
keyboards/keychron/q2/rev_0110/config.h
Normal file
21
keyboards/keychron/q2/rev_0110/config.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* 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
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define PRODUCT_ID 0x0110
|
||||
#define DEVICE_VER 0x0100
|
82
keyboards/keychron/q2/rev_0110/info.json
Normal file
82
keyboards/keychron/q2/rev_0110/info.json
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
"keyboard_name": "Keychron Q2",
|
||||
"url": "https://github.com/Keychron",
|
||||
"maintainer": "lalalademaxiya1",
|
||||
"layouts": {
|
||||
"LAYOUT_ansi_67": {
|
||||
"layout": [
|
||||
{"label":"Insert", "x":15.25, "y":0},
|
||||
|
||||
{"label":"Esc", "x":0, "y":0.25},
|
||||
{"label":"!", "x":1, "y":0.25},
|
||||
{"label":"@", "x":2, "y":0.25},
|
||||
{"label":"", "x":3, "y":0.25},
|
||||
{"label":"$", "x":4, "y":0.25},
|
||||
{"label":"%", "x":5, "y":0.25},
|
||||
{"label":"^", "x":6, "y":0.25},
|
||||
{"label":"&", "x":7, "y":0.25},
|
||||
{"label":"*", "x":8, "y":0.25},
|
||||
{"label":"(", "x":9, "y":0.25},
|
||||
{"label":")", "x":10, "y":0.25},
|
||||
{"label":"_", "x":11, "y":0.25},
|
||||
{"label":"+", "x":12, "y":0.25},
|
||||
{"label":"Backspace", "x":13, "y":0.25, "w":2},
|
||||
|
||||
{"label":"Tab", "x":0, "y":1.25, "w":1.5},
|
||||
{"label":"Q", "x":1.5, "y":1.25},
|
||||
{"label":"W", "x":2.5, "y":1.25},
|
||||
{"label":"E", "x":3.5, "y":1.25},
|
||||
{"label":"R", "x":4.5, "y":1.25},
|
||||
{"label":"T", "x":5.5, "y":1.25},
|
||||
{"label":"Y", "x":6.5, "y":1.25},
|
||||
{"label":"U", "x":7.5, "y":1.25},
|
||||
{"label":"I", "x":8.5, "y":1.25},
|
||||
{"label":"O", "x":9.5, "y":1.25},
|
||||
{"label":"P", "x":10.5, "y":1.25},
|
||||
{"label":"{", "x":11.5, "y":1.25},
|
||||
{"label":"}", "x":12.5, "y":1.25},
|
||||
{"label":"|", "x":13.5, "y":1.25, "w":1.5},
|
||||
{"label":"Delete", "x":15.25, "y":1.25},
|
||||
|
||||
{"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
|
||||
{"label":"A", "x":1.75, "y":2.25},
|
||||
{"label":"S", "x":2.75, "y":2.25},
|
||||
{"label":"D", "x":3.75, "y":2.25},
|
||||
{"label":"F", "x":4.75, "y":2.25},
|
||||
{"label":"G", "x":5.75, "y":2.25},
|
||||
{"label":"H", "x":6.75, "y":2.25},
|
||||
{"label":"J", "x":7.75, "y":2.25},
|
||||
{"label":"K", "x":8.75, "y":2.25},
|
||||
{"label":"L", "x":9.75, "y":2.25},
|
||||
{"label":":", "x":10.75, "y":2.25},
|
||||
{"label":"\"", "x":11.75, "y":2.25},
|
||||
{"label":"Enter", "x":12.75, "y":2.25, "w":2.25},
|
||||
{"label":"Home", "x":15.25, "y":2.25},
|
||||
|
||||
{"label":"Shift", "x":0, "y":3.25, "w":2.25},
|
||||
{"label":"Z", "x":2.25, "y":3.25},
|
||||
{"label":"X", "x":3.25, "y":3.25},
|
||||
{"label":"C", "x":4.25, "y":3.25},
|
||||
{"label":"V", "x":5.25, "y":3.25},
|
||||
{"label":"B", "x":6.25, "y":3.25},
|
||||
{"label":"N", "x":7.25, "y":3.25},
|
||||
{"label":"M", "x":8.25, "y":3.25},
|
||||
{"label":"<", "x":9.25, "y":3.25},
|
||||
{"label":">", "x":10.25, "y":3.25},
|
||||
{"label":"?", "x":11.25, "y":3.25},
|
||||
{"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
|
||||
{"label":"Up", "x":14.25, "y":3.5},
|
||||
|
||||
{"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
|
||||
{"label":"Win", "x":1.25, "y":4.25, "w":1.25},
|
||||
{"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
|
||||
{"label":"Space", "x":3.75, "y":4.25, "w":6.25},
|
||||
{"label":"Alt", "x":10, "y":4.25},
|
||||
{"label":"Fn1", "x":11, "y":4.25},
|
||||
{"label":"Fn2", "x":12, "y":4.25},
|
||||
{"label":"Left", "x":13.25, "y":4.5},
|
||||
{"label":"Down", "x":14.25, "y":4.5},
|
||||
{"label":"Right", "x":15.25, "y":4.5} ]
|
||||
}
|
||||
}
|
||||
}
|
94
keyboards/keychron/q2/rev_0110/keymaps/default/keymap.c
Normal file
94
keyboards/keychron/q2/rev_0110/keymaps/default/keymap.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/* 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{
|
||||
MAC_BASE,
|
||||
WIN_BASE,
|
||||
_FN1,
|
||||
_FN2,
|
||||
_FN3
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
KC_MISSION_CONTROL = SAFE_RANGE,
|
||||
KC_LAUNCHPAD
|
||||
};
|
||||
|
||||
#define KC_WAVE S(KC_GRV)
|
||||
#define KC_TASK LGUI(KC_TAB)
|
||||
#define KC_FLXP LGUI(KC_E)
|
||||
#define KC_MCTL KC_MISSION_CONTROL
|
||||
#define KC_LPAD KC_LAUNCHPAD
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[MAC_BASE] = LAYOUT_ansi_67(
|
||||
KC_ESC, 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_INS,
|
||||
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_DEL,
|
||||
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(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[WIN_BASE] = LAYOUT_ansi_67(
|
||||
KC_ESC, 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_INS,
|
||||
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_DEL,
|
||||
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(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[_FN1] = LAYOUT_ansi_67(
|
||||
KC_GRV, 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_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),
|
||||
|
||||
[_FN2] = LAYOUT_ansi_67(
|
||||
KC_GRV, 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,
|
||||
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),
|
||||
|
||||
[_FN3] = LAYOUT_ansi_67(
|
||||
KC_WAVE, 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,
|
||||
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)
|
||||
};
|
||||
|
||||
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
|
||||
default:
|
||||
return true; // Process all other keycodes normally
|
||||
}
|
||||
}
|
112
keyboards/keychron/q2/rev_0110/keymaps/via/keymap.c
Normal file
112
keyboards/keychron/q2/rev_0110/keymaps/via/keymap.c
Normal file
|
@ -0,0 +1,112 @@
|
|||
/* 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{
|
||||
MAC_BASE,
|
||||
WIN_BASE,
|
||||
_FN1,
|
||||
_FN2,
|
||||
_FN3
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
KC_MISSION_CONTROL = USER00,
|
||||
KC_LAUNCHPAD,
|
||||
KC_TASK,
|
||||
KC_FLXP
|
||||
};
|
||||
|
||||
#define KC_WAVE S(KC_GRV)
|
||||
#define KC_MCTL KC_MISSION_CONTROL
|
||||
#define KC_LPAD KC_LAUNCHPAD
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[MAC_BASE] = LAYOUT_ansi_67(
|
||||
KC_ESC, 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_INS,
|
||||
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_DEL,
|
||||
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(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[WIN_BASE] = LAYOUT_ansi_67(
|
||||
KC_ESC, 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_INS,
|
||||
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_DEL,
|
||||
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(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[_FN1] = LAYOUT_ansi_67(
|
||||
KC_GRV, 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_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),
|
||||
|
||||
[_FN2] = LAYOUT_ansi_67(
|
||||
KC_GRV, 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,
|
||||
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),
|
||||
|
||||
[_FN3] = LAYOUT_ansi_67(
|
||||
KC_WAVE, 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,
|
||||
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)
|
||||
};
|
||||
|
||||
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:
|
||||
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);
|
||||
} else {
|
||||
unregister_code(KC_LWIN);
|
||||
unregister_code(KC_E);
|
||||
}
|
||||
return false; // Skip all further processing of this key
|
||||
default:
|
||||
return true; // Process all other keycodes normally
|
||||
}
|
||||
}
|
2
keyboards/keychron/q2/rev_0110/keymaps/via/rules.mk
Normal file
2
keyboards/keychron/q2/rev_0110/keymaps/via/rules.mk
Normal file
|
@ -0,0 +1,2 @@
|
|||
VIA_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = no
|
1
keyboards/keychron/q2/rev_0110/readme.md
Normal file
1
keyboards/keychron/q2/rev_0110/readme.md
Normal file
|
@ -0,0 +1 @@
|
|||
# The ANSI variant of the Keychron Q2
|
17
keyboards/keychron/q2/rev_0110/rev_0110.c
Normal file
17
keyboards/keychron/q2/rev_0110/rev_0110.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/* 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"
|
35
keyboards/keychron/q2/rev_0110/rev_0110.h
Normal file
35
keyboards/keychron/q2/rev_0110/rev_0110.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* 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_67( \
|
||||
K00, K01, 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, K2D, K2E,\
|
||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
|
||||
K40, K41, K42, K46, K4A, K4B, K4C, K4D, K2C, K4E \
|
||||
) { \
|
||||
{ K00, K01, 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, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, K3E, }, \
|
||||
{ K40, K41, K42, XXX, XXX, XXX, K46, XXX, XXX, XXX, K4A, K4B, K4C, K4D, K4E, } \
|
||||
}
|
34
keyboards/keychron/q2/rev_0110/rules.mk
Normal file
34
keyboards/keychron/q2/rev_0110/rules.mk
Normal file
|
@ -0,0 +1,34 @@
|
|||
# MCU name
|
||||
# MCU = STM32L432
|
||||
MCU = cortex-m4
|
||||
ARMV = 7
|
||||
MCU_FAMILY = STM32
|
||||
MCU_SERIES = STM32L4xx
|
||||
MCU_LDSCRIPT = STM32L432xB
|
||||
MCU_STARTUP = stm32l4xx
|
||||
BOARD = GENERIC_STM32_L433XC
|
||||
PLATFORM_NAME = platform_l432
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = no # 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 = no # Enable Encoder
|
||||
DIP_SWITCH_ENABLE = yes
|
||||
EEPROM_DRIVER = i2c
|
||||
|
||||
# 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
|
28
keyboards/keychron/q2/rev_0111/config.h
Normal file
28
keyboards/keychron/q2/rev_0111/config.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* 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
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define PRODUCT_ID 0x0111
|
||||
#define DEVICE_VER 0x0100
|
||||
|
||||
/* Encoder used pins */
|
||||
#define ENCODERS_PAD_A { A10 }
|
||||
#define ENCODERS_PAD_B { B5 }
|
||||
|
||||
/* Specifies the number of pulses the encoder registers between each detent */
|
||||
#define ENCODER_RESOLUTION 2
|
82
keyboards/keychron/q2/rev_0111/keymaps/default/info.json
Normal file
82
keyboards/keychron/q2/rev_0111/keymaps/default/info.json
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
"keyboard_name": "Keychron Q2",
|
||||
"url": "https://github.com/Keychron",
|
||||
"maintainer": "lalalademaxiya1",
|
||||
"layouts": {
|
||||
"LAYOUT_ansi_": {
|
||||
"layout": [
|
||||
{"label":"Mute", "x":15.25, "y":0},
|
||||
|
||||
{"label":"Esc", "x":0, "y":0.25},
|
||||
{"label":"!", "x":1, "y":0.25},
|
||||
{"label":"@", "x":2, "y":0.25},
|
||||
{"label":"", "x":3, "y":0.25},
|
||||
{"label":"$", "x":4, "y":0.25},
|
||||
{"label":"%", "x":5, "y":0.25},
|
||||
{"label":"^", "x":6, "y":0.25},
|
||||
{"label":"&", "x":7, "y":0.25},
|
||||
{"label":"*", "x":8, "y":0.25},
|
||||
{"label":"(", "x":9, "y":0.25},
|
||||
{"label":")", "x":10, "y":0.25},
|
||||
{"label":"_", "x":11, "y":0.25},
|
||||
{"label":"+", "x":12, "y":0.25},
|
||||
{"label":"Backspace", "x":13, "y":0.25, "w":2},
|
||||
|
||||
{"label":"Tab", "x":0, "y":1.25, "w":1.5},
|
||||
{"label":"Q", "x":1.5, "y":1.25},
|
||||
{"label":"W", "x":2.5, "y":1.25},
|
||||
{"label":"E", "x":3.5, "y":1.25},
|
||||
{"label":"R", "x":4.5, "y":1.25},
|
||||
{"label":"T", "x":5.5, "y":1.25},
|
||||
{"label":"Y", "x":6.5, "y":1.25},
|
||||
{"label":"U", "x":7.5, "y":1.25},
|
||||
{"label":"I", "x":8.5, "y":1.25},
|
||||
{"label":"O", "x":9.5, "y":1.25},
|
||||
{"label":"P", "x":10.5, "y":1.25},
|
||||
{"label":"{", "x":11.5, "y":1.25},
|
||||
{"label":"}", "x":12.5, "y":1.25},
|
||||
{"label":"|", "x":13.5, "y":1.25, "w":1.5},
|
||||
{"label":"Delete", "x":15.25, "y":1.25},
|
||||
|
||||
{"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
|
||||
{"label":"A", "x":1.75, "y":2.25},
|
||||
{"label":"S", "x":2.75, "y":2.25},
|
||||
{"label":"D", "x":3.75, "y":2.25},
|
||||
{"label":"F", "x":4.75, "y":2.25},
|
||||
{"label":"G", "x":5.75, "y":2.25},
|
||||
{"label":"H", "x":6.75, "y":2.25},
|
||||
{"label":"J", "x":7.75, "y":2.25},
|
||||
{"label":"K", "x":8.75, "y":2.25},
|
||||
{"label":"L", "x":9.75, "y":2.25},
|
||||
{"label":":", "x":10.75, "y":2.25},
|
||||
{"label":"\"", "x":11.75, "y":2.25},
|
||||
{"label":"Enter", "x":12.75, "y":2.25, "w":2.25},
|
||||
{"label":"Home", "x":15.25, "y":2.25},
|
||||
|
||||
{"label":"Shift", "x":0, "y":3.25, "w":2.25},
|
||||
{"label":"Z", "x":2.25, "y":3.25},
|
||||
{"label":"X", "x":3.25, "y":3.25},
|
||||
{"label":"C", "x":4.25, "y":3.25},
|
||||
{"label":"V", "x":5.25, "y":3.25},
|
||||
{"label":"B", "x":6.25, "y":3.25},
|
||||
{"label":"N", "x":7.25, "y":3.25},
|
||||
{"label":"M", "x":8.25, "y":3.25},
|
||||
{"label":"<", "x":9.25, "y":3.25},
|
||||
{"label":">", "x":10.25, "y":3.25},
|
||||
{"label":"?", "x":11.25, "y":3.25},
|
||||
{"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
|
||||
{"label":"Up", "x":14.25, "y":3.5},
|
||||
|
||||
{"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
|
||||
{"label":"Win", "x":1.25, "y":4.25, "w":1.25},
|
||||
{"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
|
||||
{"label":"Space", "x":3.75, "y":4.25, "w":6.25},
|
||||
{"label":"Alt", "x":10, "y":4.25},
|
||||
{"label":"Fn1", "x":11, "y":4.25},
|
||||
{"label":"Fn2", "x":12, "y":4.25},
|
||||
{"label":"Left", "x":13.25, "y":4.5},
|
||||
{"label":"Down", "x":14.25, "y":4.5},
|
||||
{"label":"Right", "x":15.25, "y":4.5} ]
|
||||
}
|
||||
}
|
||||
}
|
94
keyboards/keychron/q2/rev_0111/keymaps/default/keymap.c
Normal file
94
keyboards/keychron/q2/rev_0111/keymaps/default/keymap.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/* 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{
|
||||
MAC_BASE,
|
||||
WIN_BASE,
|
||||
_FN1,
|
||||
_FN2,
|
||||
_FN3
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
KC_MISSION_CONTROL = SAFE_RANGE,
|
||||
KC_LAUNCHPAD
|
||||
};
|
||||
|
||||
#define KC_WAVE S(KC_GRV)
|
||||
#define KC_TASK LGUI(KC_TAB)
|
||||
#define KC_FLXP LGUI(KC_E)
|
||||
#define KC_MCTL KC_MISSION_CONTROL
|
||||
#define KC_LPAD KC_LAUNCHPAD
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[MAC_BASE] = LAYOUT_ansi_67(
|
||||
KC_ESC, 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_MUTE,
|
||||
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_DEL,
|
||||
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(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[WIN_BASE] = LAYOUT_ansi_67(
|
||||
KC_ESC, 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_MUTE,
|
||||
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_DEL,
|
||||
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(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[_FN1] = LAYOUT_ansi_67(
|
||||
KC_GRV, 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_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),
|
||||
|
||||
[_FN2] = LAYOUT_ansi_67(
|
||||
KC_GRV, 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,
|
||||
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),
|
||||
|
||||
[_FN3] = LAYOUT_ansi_67(
|
||||
KC_WAVE, 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,
|
||||
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)
|
||||
};
|
||||
|
||||
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
|
||||
default:
|
||||
return true; // Process all other keycodes normally
|
||||
}
|
||||
}
|
84
keyboards/keychron/q2/rev_0111/keymaps/via/info.json
Normal file
84
keyboards/keychron/q2/rev_0111/keymaps/via/info.json
Normal file
|
@ -0,0 +1,84 @@
|
|||
{
|
||||
"keyboard_name": "Keychron Q2",
|
||||
"url": "https://github.com/Keychron",
|
||||
"maintainer": "lalalademaxiya1",
|
||||
"layouts": {
|
||||
"LAYOUT_ansi_": {
|
||||
"layout": [
|
||||
{"label":"Mute", "x":15.25, "y":0, "w":0.75},
|
||||
{"label":"Vol-", "x":16, "y":0, "w":0.75, "h":0.5},
|
||||
{"label":"Vol+", "x":16, "y":0.5, "w":0.75, "h":0.5},
|
||||
|
||||
{"label":"Esc", "x":0, "y":0.25},
|
||||
{"label":"!", "x":1, "y":0.25},
|
||||
{"label":"@", "x":2, "y":0.25},
|
||||
{"label":"", "x":3, "y":0.25},
|
||||
{"label":"$", "x":4, "y":0.25},
|
||||
{"label":"%", "x":5, "y":0.25},
|
||||
{"label":"^", "x":6, "y":0.25},
|
||||
{"label":"&", "x":7, "y":0.25},
|
||||
{"label":"*", "x":8, "y":0.25},
|
||||
{"label":"(", "x":9, "y":0.25},
|
||||
{"label":")", "x":10, "y":0.25},
|
||||
{"label":"_", "x":11, "y":0.25},
|
||||
{"label":"+", "x":12, "y":0.25},
|
||||
{"label":"Backspace", "x":13, "y":0.25, "w":2},
|
||||
|
||||
{"label":"Tab", "x":0, "y":1.25, "w":1.5},
|
||||
{"label":"Q", "x":1.5, "y":1.25},
|
||||
{"label":"W", "x":2.5, "y":1.25},
|
||||
{"label":"E", "x":3.5, "y":1.25},
|
||||
{"label":"R", "x":4.5, "y":1.25},
|
||||
{"label":"T", "x":5.5, "y":1.25},
|
||||
{"label":"Y", "x":6.5, "y":1.25},
|
||||
{"label":"U", "x":7.5, "y":1.25},
|
||||
{"label":"I", "x":8.5, "y":1.25},
|
||||
{"label":"O", "x":9.5, "y":1.25},
|
||||
{"label":"P", "x":10.5, "y":1.25},
|
||||
{"label":"{", "x":11.5, "y":1.25},
|
||||
{"label":"}", "x":12.5, "y":1.25},
|
||||
{"label":"|", "x":13.5, "y":1.25, "w":1.5},
|
||||
{"label":"Delete", "x":15.25, "y":1.25},
|
||||
|
||||
{"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
|
||||
{"label":"A", "x":1.75, "y":2.25},
|
||||
{"label":"S", "x":2.75, "y":2.25},
|
||||
{"label":"D", "x":3.75, "y":2.25},
|
||||
{"label":"F", "x":4.75, "y":2.25},
|
||||
{"label":"G", "x":5.75, "y":2.25},
|
||||
{"label":"H", "x":6.75, "y":2.25},
|
||||
{"label":"J", "x":7.75, "y":2.25},
|
||||
{"label":"K", "x":8.75, "y":2.25},
|
||||
{"label":"L", "x":9.75, "y":2.25},
|
||||
{"label":":", "x":10.75, "y":2.25},
|
||||
{"label":"\"", "x":11.75, "y":2.25},
|
||||
{"label":"Enter", "x":12.75, "y":2.25, "w":2.25},
|
||||
{"label":"Home", "x":15.25, "y":2.25},
|
||||
|
||||
{"label":"Shift", "x":0, "y":3.25, "w":2.25},
|
||||
{"label":"Z", "x":2.25, "y":3.25},
|
||||
{"label":"X", "x":3.25, "y":3.25},
|
||||
{"label":"C", "x":4.25, "y":3.25},
|
||||
{"label":"V", "x":5.25, "y":3.25},
|
||||
{"label":"B", "x":6.25, "y":3.25},
|
||||
{"label":"N", "x":7.25, "y":3.25},
|
||||
{"label":"M", "x":8.25, "y":3.25},
|
||||
{"label":"<", "x":9.25, "y":3.25},
|
||||
{"label":">", "x":10.25, "y":3.25},
|
||||
{"label":"?", "x":11.25, "y":3.25},
|
||||
{"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
|
||||
{"label":"Up", "x":14.25, "y":3.5},
|
||||
|
||||
{"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
|
||||
{"label":"Win", "x":1.25, "y":4.25, "w":1.25},
|
||||
{"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
|
||||
{"label":"Space", "x":3.75, "y":4.25, "w":6.25},
|
||||
{"label":"Alt", "x":10, "y":4.25},
|
||||
{"label":"Fn1", "x":11, "y":4.25},
|
||||
{"label":"Fn2", "x":12, "y":4.25},
|
||||
{"label":"Left", "x":13.25, "y":4.5},
|
||||
{"label":"Down", "x":14.25, "y":4.5},
|
||||
{"label":"Right", "x":15.25, "y":4.5} ]
|
||||
}
|
||||
}
|
||||
}
|
154
keyboards/keychron/q2/rev_0111/keymaps/via/keymap.c
Normal file
154
keyboards/keychron/q2/rev_0111/keymaps/via/keymap.c
Normal file
|
@ -0,0 +1,154 @@
|
|||
/* 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{
|
||||
MAC_BASE,
|
||||
WIN_BASE,
|
||||
_FN1,
|
||||
_FN2,
|
||||
_FN3
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
KC_MISSION_CONTROL = USER00,
|
||||
KC_LAUNCHPAD,
|
||||
KC_TASK,
|
||||
KC_FLXP
|
||||
};
|
||||
|
||||
#define KC_WAVE S(KC_GRV)
|
||||
#define KC_MCTL KC_MISSION_CONTROL
|
||||
#define KC_LPAD KC_LAUNCHPAD
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[MAC_BASE] = LAYOUT_all(
|
||||
KC_ESC, 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_MUTE,
|
||||
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_DEL,
|
||||
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_VOLD, KC_VOLU, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[WIN_BASE] = LAYOUT_all(
|
||||
KC_ESC, 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_MUTE,
|
||||
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_DEL,
|
||||
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_VOLD, KC_VOLU, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[_FN1] = LAYOUT_all(
|
||||
KC_GRV, 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_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_TRNS, KC_TRNS),
|
||||
|
||||
[_FN2] = LAYOUT_all(
|
||||
KC_GRV, 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,
|
||||
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_TRNS, KC_TRNS),
|
||||
|
||||
[_FN3] = LAYOUT_all(
|
||||
KC_WAVE, 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,
|
||||
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_TRNS, KC_TRNS)
|
||||
};
|
||||
|
||||
#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
|
||||
|
||||
#define ENCODERS 1
|
||||
static uint8_t encoder_state[ENCODERS] = {0};
|
||||
static keypos_t encoder_cw[ENCODERS] = {{ 8, 4 }};
|
||||
static keypos_t encoder_ccw[ENCODERS] = {{ 7, 4 }};
|
||||
|
||||
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 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 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_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);
|
||||
} else {
|
||||
unregister_code(KC_LWIN);
|
||||
unregister_code(KC_E);
|
||||
}
|
||||
return false; // Skip all further processing of this key
|
||||
default:
|
||||
return true; // Process all other keycodes normally
|
||||
}
|
||||
}
|
2
keyboards/keychron/q2/rev_0111/keymaps/via/rules.mk
Normal file
2
keyboards/keychron/q2/rev_0111/keymaps/via/rules.mk
Normal file
|
@ -0,0 +1,2 @@
|
|||
VIA_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = no
|
5
keyboards/keychron/q2/rev_0111/readme.md
Normal file
5
keyboards/keychron/q2/rev_0111/readme.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# The ANSI variant of the Keychron Q2 and support encoder
|
||||
|
||||
- Enable EC11 rotary encoder
|
||||
- Turn colckwise to increase volume and turn anti-colckwise to decrease volume
|
||||
- Press top right key pushbutton to mute
|
31
keyboards/keychron/q2/rev_0111/rev_0111.c
Normal file
31
keyboards/keychron/q2/rev_0111/rev_0111.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* 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 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, 10);
|
||||
} else {
|
||||
tap_code_delay(KC_VOLD, 10);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
48
keyboards/keychron/q2/rev_0111/rev_0111.h
Normal file
48
keyboards/keychron/q2/rev_0111/rev_0111.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* 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( \
|
||||
K00, K01, 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, K2D, K2E,\
|
||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
|
||||
K40, K41, K42, K46, K47, K48, K4A, K4B, K4C, K4D, K2C, K4E \
|
||||
) { \
|
||||
{ K00, K01, 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, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, K3E, }, \
|
||||
{ K40, K41, K42, XXX, XXX, XXX, K46, K47, K48, XXX, K4A, K4B, K4C, K4D, K4E, } \
|
||||
}
|
||||
#define LAYOUT_ansi_67( \
|
||||
K00, K01, 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, K2D, K2E,\
|
||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
|
||||
K40, K41, K42, K46, K4A, K4B, K4C, K4D, K2C, K4E \
|
||||
) { \
|
||||
{ K00, K01, 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, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, K3E, }, \
|
||||
{ K40, K41, K42, XXX, XXX, XXX, K46, XXX, XXX, XXX, K4A, K4B, K4C, K4D, K4E, } \
|
||||
}
|
34
keyboards/keychron/q2/rev_0111/rules.mk
Normal file
34
keyboards/keychron/q2/rev_0111/rules.mk
Normal file
|
@ -0,0 +1,34 @@
|
|||
# MCU name
|
||||
# MCU = STM32L432
|
||||
MCU = cortex-m4
|
||||
ARMV = 7
|
||||
MCU_FAMILY = STM32
|
||||
MCU_SERIES = STM32L4xx
|
||||
MCU_LDSCRIPT = STM32L432xB
|
||||
MCU_STARTUP = stm32l4xx
|
||||
BOARD = GENERIC_STM32_L433XC
|
||||
PLATFORM_NAME = platform_l432
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = no # 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
|
||||
DIP_SWITCH_ENABLE = yes
|
||||
EEPROM_DRIVER = i2c
|
||||
|
||||
# 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
|
21
keyboards/keychron/q2/rev_0112/config.h
Normal file
21
keyboards/keychron/q2/rev_0112/config.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* 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
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define PRODUCT_ID 0x0112
|
||||
#define DEVICE_VER 0x0100
|
83
keyboards/keychron/q2/rev_0112/info.json
Normal file
83
keyboards/keychron/q2/rev_0112/info.json
Normal file
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
"keyboard_name": "Keychron Q2",
|
||||
"url": "https://github.com/Keychron",
|
||||
"maintainer": "lalalademaxiya1",
|
||||
"layouts": {
|
||||
"LAYOUT_iso_68": {
|
||||
"layout": [
|
||||
{"label":"Insert", "x":15.25, "y":0},
|
||||
|
||||
{"label":"Esc", "x":0, "y":0.25},
|
||||
{"label":"!", "x":1, "y":0.25},
|
||||
{"label":"@", "x":2, "y":0.25},
|
||||
{"label":"", "x":3, "y":0.25},
|
||||
{"label":"$", "x":4, "y":0.25},
|
||||
{"label":"%", "x":5, "y":0.25},
|
||||
{"label":"^", "x":6, "y":0.25},
|
||||
{"label":"&", "x":7, "y":0.25},
|
||||
{"label":"*", "x":8, "y":0.25},
|
||||
{"label":"(", "x":9, "y":0.25},
|
||||
{"label":")", "x":10, "y":0.25},
|
||||
{"label":"_", "x":11, "y":0.25},
|
||||
{"label":"+", "x":12, "y":0.25},
|
||||
{"label":"Backspace", "x":13, "y":0.25, "w":2},
|
||||
|
||||
{"label":"Tab", "x":0, "y":1.25, "w":1.5},
|
||||
{"label":"Q", "x":1.5, "y":1.25},
|
||||
{"label":"W", "x":2.5, "y":1.25},
|
||||
{"label":"E", "x":3.5, "y":1.25},
|
||||
{"label":"R", "x":4.5, "y":1.25},
|
||||
{"label":"T", "x":5.5, "y":1.25},
|
||||
{"label":"Y", "x":6.5, "y":1.25},
|
||||
{"label":"U", "x":7.5, "y":1.25},
|
||||
{"label":"I", "x":8.5, "y":1.25},
|
||||
{"label":"O", "x":9.5, "y":1.25},
|
||||
{"label":"P", "x":10.5, "y":1.25},
|
||||
{"label":"{", "x":11.5, "y":1.25},
|
||||
{"label":"}", "x":12.5, "y":1.25},
|
||||
{"label":"Delete", "x":15.25, "y":1.25},
|
||||
|
||||
{"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
|
||||
{"label":"A", "x":1.75, "y":2.25},
|
||||
{"label":"S", "x":2.75, "y":2.25},
|
||||
{"label":"D", "x":3.75, "y":2.25},
|
||||
{"label":"F", "x":4.75, "y":2.25},
|
||||
{"label":"G", "x":5.75, "y":2.25},
|
||||
{"label":"H", "x":6.75, "y":2.25},
|
||||
{"label":"J", "x":7.75, "y":2.25},
|
||||
{"label":"K", "x":8.75, "y":2.25},
|
||||
{"label":"L", "x":9.75, "y":2.25},
|
||||
{"label":":", "x":10.75, "y":2.25},
|
||||
{"label":"\"", "x":11.75, "y":2.25},
|
||||
{"label":"#~", "x":12.75, "y":2.25},
|
||||
{"label":"Enter", "x":13.75, "y":2.25, "w":1.25}
|
||||
{"label":"Home", "x":15.25, "y":2.25},
|
||||
|
||||
{"label":"Shift", "x":0, "y":3.25, "w":1.25},
|
||||
{"label":"|", "x":1.25, "y":3.25},
|
||||
{"label":"Z", "x":2.25, "y":3.25},
|
||||
{"label":"X", "x":3.25, "y":3.25},
|
||||
{"label":"C", "x":4.25, "y":3.25},
|
||||
{"label":"V", "x":5.25, "y":3.25},
|
||||
{"label":"B", "x":6.25, "y":3.25},
|
||||
{"label":"N", "x":7.25, "y":3.25},
|
||||
{"label":"M", "x":8.25, "y":3.25},
|
||||
{"label":"<", "x":9.25, "y":3.25},
|
||||
{"label":">", "x":10.25, "y":3.25},
|
||||
{"label":"?", "x":11.25, "y":3.25},
|
||||
{"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
|
||||
{"label":"Up", "x":14.25, "y":3.5},
|
||||
|
||||
{"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
|
||||
{"label":"Win", "x":1.25, "y":4.25, "w":1.25},
|
||||
{"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
|
||||
{"label":"Space", "x":3.75, "y":4.25, "w":6.25},
|
||||
{"label":"Alt", "x":10, "y":4.25},
|
||||
{"label":"Fn1", "x":11, "y":4.25},
|
||||
{"label":"Fn2", "x":12, "y":4.25},
|
||||
{"label":"Left", "x":13.25, "y":4.5},
|
||||
{"label":"Down", "x":14.25, "y":4.5},
|
||||
{"label":"Right", "x":15.25, "y":4.5} ]
|
||||
}
|
||||
}
|
||||
}
|
94
keyboards/keychron/q2/rev_0112/keymaps/default/keymap.c
Normal file
94
keyboards/keychron/q2/rev_0112/keymaps/default/keymap.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/* 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{
|
||||
MAC_BASE,
|
||||
WIN_BASE,
|
||||
_FN1,
|
||||
_FN2,
|
||||
_FN3
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
KC_MISSION_CONTROL = SAFE_RANGE,
|
||||
KC_LAUNCHPAD
|
||||
};
|
||||
|
||||
#define KC_WAVE S(KC_GRV)
|
||||
#define KC_TASK LGUI(KC_TAB)
|
||||
#define KC_FLXP LGUI(KC_E)
|
||||
#define KC_MCTL KC_MISSION_CONTROL
|
||||
#define KC_LPAD KC_LAUNCHPAD
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[MAC_BASE] = LAYOUT_iso_68(
|
||||
KC_ESC, KC_1, KC_2, KC_F3, KC_F4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
|
||||
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_DEL,
|
||||
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(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[WIN_BASE] = LAYOUT_iso_68(
|
||||
KC_ESC, 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_INS,
|
||||
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_DEL,
|
||||
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(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[_FN1] = LAYOUT_iso_68(
|
||||
KC_GRV, 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_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),
|
||||
|
||||
[_FN2] = LAYOUT_iso_68(
|
||||
KC_GRV, 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,
|
||||
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),
|
||||
|
||||
[_FN3] = LAYOUT_iso_68(
|
||||
KC_WAVE, 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,
|
||||
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)
|
||||
};
|
||||
|
||||
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
|
||||
default:
|
||||
return true; // Process all other keycodes normally
|
||||
}
|
||||
}
|
112
keyboards/keychron/q2/rev_0112/keymaps/via/keymap.c
Normal file
112
keyboards/keychron/q2/rev_0112/keymaps/via/keymap.c
Normal file
|
@ -0,0 +1,112 @@
|
|||
/* 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{
|
||||
MAC_BASE,
|
||||
WIN_BASE,
|
||||
_FN1,
|
||||
_FN2,
|
||||
_FN3
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
KC_MISSION_CONTROL = USER00,
|
||||
KC_LAUNCHPAD,
|
||||
KC_TASK,
|
||||
KC_FLXP
|
||||
};
|
||||
|
||||
#define KC_WAVE S(KC_GRV)
|
||||
#define KC_MCTL KC_MISSION_CONTROL
|
||||
#define KC_LPAD KC_LAUNCHPAD
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[MAC_BASE] = LAYOUT_iso_68(
|
||||
KC_ESC, KC_1, KC_2, KC_F3, KC_F4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
|
||||
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_DEL,
|
||||
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(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[WIN_BASE] = LAYOUT_iso_68(
|
||||
KC_ESC, 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_INS,
|
||||
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_DEL,
|
||||
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(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[_FN1] = LAYOUT_iso_68(
|
||||
KC_GRV, 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_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),
|
||||
|
||||
[_FN2] = LAYOUT_iso_68(
|
||||
KC_GRV, 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,
|
||||
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),
|
||||
|
||||
[_FN3] = LAYOUT_iso_68(
|
||||
KC_WAVE, 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,
|
||||
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)
|
||||
};
|
||||
|
||||
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:
|
||||
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);
|
||||
} else {
|
||||
unregister_code(KC_LWIN);
|
||||
unregister_code(KC_E);
|
||||
}
|
||||
return false; // Skip all further processing of this key
|
||||
default:
|
||||
return true; // Process all other keycodes normally
|
||||
}
|
||||
}
|
2
keyboards/keychron/q2/rev_0112/keymaps/via/rules.mk
Normal file
2
keyboards/keychron/q2/rev_0112/keymaps/via/rules.mk
Normal file
|
@ -0,0 +1,2 @@
|
|||
VIA_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = no
|
1
keyboards/keychron/q2/rev_0112/readme.md
Normal file
1
keyboards/keychron/q2/rev_0112/readme.md
Normal file
|
@ -0,0 +1 @@
|
|||
# The ISO variant of the Keychron Q2
|
17
keyboards/keychron/q2/rev_0112/rev_0112.c
Normal file
17
keyboards/keychron/q2/rev_0112/rev_0112.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/* 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"
|
36
keyboards/keychron/q2/rev_0112/rev_0112.h
Normal file
36
keyboards/keychron/q2/rev_0112/rev_0112.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* 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_68( \
|
||||
K00, K01, 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, K1E,\
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K1D, K2E,\
|
||||
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
|
||||
K40, K41, K42, K46, K4A, K4B, K4C, K4D, K2C, K4E \
|
||||
) { \
|
||||
{ K00, K01, 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, XXX, K3D, K3E, }, \
|
||||
{ K40, K41, K42, XXX, XXX, XXX, K46, XXX, XXX, XXX, K4A, K4B, K4C, K4D, K4E, } \
|
||||
}
|
||||
|
34
keyboards/keychron/q2/rev_0112/rules.mk
Normal file
34
keyboards/keychron/q2/rev_0112/rules.mk
Normal file
|
@ -0,0 +1,34 @@
|
|||
# MCU name
|
||||
# MCU = STM32L432
|
||||
MCU = cortex-m4
|
||||
ARMV = 7
|
||||
MCU_FAMILY = STM32
|
||||
MCU_SERIES = STM32L4xx
|
||||
MCU_LDSCRIPT = STM32L432xB
|
||||
MCU_STARTUP = stm32l4xx
|
||||
BOARD = GENERIC_STM32_L433XC
|
||||
PLATFORM_NAME = platform_l432
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = no # 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 = no # Enable Encoder
|
||||
DIP_SWITCH_ENABLE = yes
|
||||
EEPROM_DRIVER = i2c
|
||||
|
||||
# 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
|
28
keyboards/keychron/q2/rev_0113/config.h
Normal file
28
keyboards/keychron/q2/rev_0113/config.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* 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
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define PRODUCT_ID 0x0113
|
||||
#define DEVICE_VER 0x0100
|
||||
|
||||
/* Encoder used pins */
|
||||
#define ENCODERS_PAD_A { A10 }
|
||||
#define ENCODERS_PAD_B { B5 }
|
||||
|
||||
/* Specifies the number of pulses the encoder registers between each detent */
|
||||
#define ENCODER_RESOLUTION 2
|
83
keyboards/keychron/q2/rev_0113/keymaps/default/info.json
Normal file
83
keyboards/keychron/q2/rev_0113/keymaps/default/info.json
Normal file
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
"keyboard_name": "Keychron Q2",
|
||||
"url": "https://github.com/Keychron",
|
||||
"maintainer": "lalalademaxiya1",
|
||||
"layouts": {
|
||||
"LAYOUT_iso_68": {
|
||||
"layout": [
|
||||
{"label":"Mute", "x":15.25, "y":0},
|
||||
|
||||
{"label":"Esc", "x":0, "y":0.25},
|
||||
{"label":"!", "x":1, "y":0.25},
|
||||
{"label":"@", "x":2, "y":0.25},
|
||||
{"label":"", "x":3, "y":0.25},
|
||||
{"label":"$", "x":4, "y":0.25},
|
||||
{"label":"%", "x":5, "y":0.25},
|
||||
{"label":"^", "x":6, "y":0.25},
|
||||
{"label":"&", "x":7, "y":0.25},
|
||||
{"label":"*", "x":8, "y":0.25},
|
||||
{"label":"(", "x":9, "y":0.25},
|
||||
{"label":")", "x":10, "y":0.25},
|
||||
{"label":"_", "x":11, "y":0.25},
|
||||
{"label":"+", "x":12, "y":0.25},
|
||||
{"label":"Backspace", "x":13, "y":0.25, "w":2},
|
||||
|
||||
{"label":"Tab", "x":0, "y":1.25, "w":1.5},
|
||||
{"label":"Q", "x":1.5, "y":1.25},
|
||||
{"label":"W", "x":2.5, "y":1.25},
|
||||
{"label":"E", "x":3.5, "y":1.25},
|
||||
{"label":"R", "x":4.5, "y":1.25},
|
||||
{"label":"T", "x":5.5, "y":1.25},
|
||||
{"label":"Y", "x":6.5, "y":1.25},
|
||||
{"label":"U", "x":7.5, "y":1.25},
|
||||
{"label":"I", "x":8.5, "y":1.25},
|
||||
{"label":"O", "x":9.5, "y":1.25},
|
||||
{"label":"P", "x":10.5, "y":1.25},
|
||||
{"label":"{", "x":11.5, "y":1.25},
|
||||
{"label":"}", "x":12.5, "y":1.25},
|
||||
{"label":"Delete", "x":15.25, "y":1.25},
|
||||
|
||||
{"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
|
||||
{"label":"A", "x":1.75, "y":2.25},
|
||||
{"label":"S", "x":2.75, "y":2.25},
|
||||
{"label":"D", "x":3.75, "y":2.25},
|
||||
{"label":"F", "x":4.75, "y":2.25},
|
||||
{"label":"G", "x":5.75, "y":2.25},
|
||||
{"label":"H", "x":6.75, "y":2.25},
|
||||
{"label":"J", "x":7.75, "y":2.25},
|
||||
{"label":"K", "x":8.75, "y":2.25},
|
||||
{"label":"L", "x":9.75, "y":2.25},
|
||||
{"label":":", "x":10.75, "y":2.25},
|
||||
{"label":"\"", "x":11.75, "y":2.25},
|
||||
{"label":"#~", "x":12.75, "y":2.25},
|
||||
{"label":"Enter", "x":13.75, "y":2.25, "w":1.25},
|
||||
{"label":"Home", "x":15.25, "y":2.25},
|
||||
|
||||
{"label":"Shift", "x":0, "y":3.25, "w":1.25},
|
||||
{"label":"|", "x":1.25, "y":3.25},
|
||||
{"label":"Z", "x":2.25, "y":3.25},
|
||||
{"label":"X", "x":3.25, "y":3.25},
|
||||
{"label":"C", "x":4.25, "y":3.25},
|
||||
{"label":"V", "x":5.25, "y":3.25},
|
||||
{"label":"B", "x":6.25, "y":3.25},
|
||||
{"label":"N", "x":7.25, "y":3.25},
|
||||
{"label":"M", "x":8.25, "y":3.25},
|
||||
{"label":"<", "x":9.25, "y":3.25},
|
||||
{"label":">", "x":10.25, "y":3.25},
|
||||
{"label":"?", "x":11.25, "y":3.25},
|
||||
{"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
|
||||
{"label":"Up", "x":14.25, "y":3.5},
|
||||
|
||||
{"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
|
||||
{"label":"Win", "x":1.25, "y":4.25, "w":1.25},
|
||||
{"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
|
||||
{"label":"Space", "x":3.75, "y":4.25, "w":6.25},
|
||||
{"label":"Alt", "x":10, "y":4.25},
|
||||
{"label":"Fn1", "x":11, "y":4.25},
|
||||
{"label":"Fn2", "x":12, "y":4.25},
|
||||
{"label":"Left", "x":13.25, "y":4.5},
|
||||
{"label":"Down", "x":14.25, "y":4.5},
|
||||
{"label":"Right", "x":15.25, "y":4.5} ]
|
||||
}
|
||||
}
|
||||
}
|
94
keyboards/keychron/q2/rev_0113/keymaps/default/keymap.c
Normal file
94
keyboards/keychron/q2/rev_0113/keymaps/default/keymap.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/* 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{
|
||||
MAC_BASE,
|
||||
WIN_BASE,
|
||||
_FN1,
|
||||
_FN2,
|
||||
_FN3
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
KC_MISSION_CONTROL = SAFE_RANGE,
|
||||
KC_LAUNCHPAD
|
||||
};
|
||||
|
||||
#define KC_WAVE S(KC_GRV)
|
||||
#define KC_TASK LGUI(KC_TAB)
|
||||
#define KC_FLXP LGUI(KC_E)
|
||||
#define KC_MCTL KC_MISSION_CONTROL
|
||||
#define KC_LPAD KC_LAUNCHPAD
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[MAC_BASE] = LAYOUT_iso_68(
|
||||
KC_ESC, KC_1, KC_2, KC_F3, KC_F4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE,
|
||||
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_DEL,
|
||||
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(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[WIN_BASE] = LAYOUT_iso_68(
|
||||
KC_ESC, 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_MUTE,
|
||||
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_DEL,
|
||||
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(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[_FN1] = LAYOUT_iso_68(
|
||||
KC_GRV, 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_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),
|
||||
|
||||
[_FN2] = LAYOUT_iso_68(
|
||||
KC_GRV, 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,
|
||||
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),
|
||||
|
||||
[_FN3] = LAYOUT_iso_68(
|
||||
KC_WAVE, 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,
|
||||
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)
|
||||
};
|
||||
|
||||
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
|
||||
default:
|
||||
return true; // Process all other keycodes normally
|
||||
}
|
||||
}
|
85
keyboards/keychron/q2/rev_0113/keymaps/via/info.json
Normal file
85
keyboards/keychron/q2/rev_0113/keymaps/via/info.json
Normal file
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"keyboard_name": "Keychron Q2",
|
||||
"url": "https://github.com/Keychron",
|
||||
"maintainer": "lalalademaxiya1",
|
||||
"layouts": {
|
||||
"LAYOUT_iso_68": {
|
||||
"layout": [
|
||||
{"label":"Mute", "x":15.25, "y":0, "w":0.75},
|
||||
{"label":"Vol-", "x":16, "y":0, "w":0.75, "h":0.5},
|
||||
{"label":"Vol+", "x":16, "y":0.5, "w":0.75, "h":0.5},
|
||||
|
||||
{"label":"Esc", "x":0, "y":0.25},
|
||||
{"label":"!", "x":1, "y":0.25},
|
||||
{"label":"@", "x":2, "y":0.25},
|
||||
{"label":"", "x":3, "y":0.25},
|
||||
{"label":"$", "x":4, "y":0.25},
|
||||
{"label":"%", "x":5, "y":0.25},
|
||||
{"label":"^", "x":6, "y":0.25},
|
||||
{"label":"&", "x":7, "y":0.25},
|
||||
{"label":"*", "x":8, "y":0.25},
|
||||
{"label":"(", "x":9, "y":0.25},
|
||||
{"label":")", "x":10, "y":0.25},
|
||||
{"label":"_", "x":11, "y":0.25},
|
||||
{"label":"+", "x":12, "y":0.25},
|
||||
{"label":"Backspace", "x":13, "y":0.25, "w":2},
|
||||
|
||||
{"label":"Tab", "x":0, "y":1.25, "w":1.5},
|
||||
{"label":"Q", "x":1.5, "y":1.25},
|
||||
{"label":"W", "x":2.5, "y":1.25},
|
||||
{"label":"E", "x":3.5, "y":1.25},
|
||||
{"label":"R", "x":4.5, "y":1.25},
|
||||
{"label":"T", "x":5.5, "y":1.25},
|
||||
{"label":"Y", "x":6.5, "y":1.25},
|
||||
{"label":"U", "x":7.5, "y":1.25},
|
||||
{"label":"I", "x":8.5, "y":1.25},
|
||||
{"label":"O", "x":9.5, "y":1.25},
|
||||
{"label":"P", "x":10.5, "y":1.25},
|
||||
{"label":"{", "x":11.5, "y":1.25},
|
||||
{"label":"}", "x":12.5, "y":1.25},
|
||||
{"label":"Delete", "x":15.25, "y":1.25},
|
||||
|
||||
{"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
|
||||
{"label":"A", "x":1.75, "y":2.25},
|
||||
{"label":"S", "x":2.75, "y":2.25},
|
||||
{"label":"D", "x":3.75, "y":2.25},
|
||||
{"label":"F", "x":4.75, "y":2.25},
|
||||
{"label":"G", "x":5.75, "y":2.25},
|
||||
{"label":"H", "x":6.75, "y":2.25},
|
||||
{"label":"J", "x":7.75, "y":2.25},
|
||||
{"label":"K", "x":8.75, "y":2.25},
|
||||
{"label":"L", "x":9.75, "y":2.25},
|
||||
{"label":":", "x":10.75, "y":2.25},
|
||||
{"label":"\"", "x":11.75, "y":2.25},
|
||||
{"label":"#~", "x":12.75, "y":2.25},
|
||||
{"label":"Enter", "x":13.75, "y":2.25, "w":1.25},
|
||||
{"label":"Home", "x":15.25, "y":2.25},
|
||||
|
||||
{"label":"Shift", "x":0, "y":3.25, "w":1.25},
|
||||
{"label":"|", "x":1.25, "y":3.25},
|
||||
{"label":"Z", "x":2.25, "y":3.25},
|
||||
{"label":"X", "x":3.25, "y":3.25},
|
||||
{"label":"C", "x":4.25, "y":3.25},
|
||||
{"label":"V", "x":5.25, "y":3.25},
|
||||
{"label":"B", "x":6.25, "y":3.25},
|
||||
{"label":"N", "x":7.25, "y":3.25},
|
||||
{"label":"M", "x":8.25, "y":3.25},
|
||||
{"label":"<", "x":9.25, "y":3.25},
|
||||
{"label":">", "x":10.25, "y":3.25},
|
||||
{"label":"?", "x":11.25, "y":3.25},
|
||||
{"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
|
||||
{"label":"Up", "x":14.25, "y":3.5},
|
||||
|
||||
{"label":"Ctrl", "x":0, "y":4.25, "w":1.25},
|
||||
{"label":"Win", "x":1.25, "y":4.25, "w":1.25},
|
||||
{"label":"Alt", "x":2.5, "y":4.25, "w":1.25},
|
||||
{"label":"Space", "x":3.75, "y":4.25, "w":6.25},
|
||||
{"label":"Alt", "x":10, "y":4.25},
|
||||
{"label":"Fn1", "x":11, "y":4.25},
|
||||
{"label":"Fn2", "x":12, "y":4.25},
|
||||
{"label":"Left", "x":13.25, "y":4.5},
|
||||
{"label":"Down", "x":14.25, "y":4.5},
|
||||
{"label":"Right", "x":15.25, "y":4.5} ]
|
||||
}
|
||||
}
|
||||
}
|
154
keyboards/keychron/q2/rev_0113/keymaps/via/keymap.c
Normal file
154
keyboards/keychron/q2/rev_0113/keymaps/via/keymap.c
Normal file
|
@ -0,0 +1,154 @@
|
|||
/* 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{
|
||||
MAC_BASE,
|
||||
WIN_BASE,
|
||||
_FN1,
|
||||
_FN2,
|
||||
_FN3
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
KC_MISSION_CONTROL = USER00,
|
||||
KC_LAUNCHPAD,
|
||||
KC_TASK,
|
||||
KC_FLXP
|
||||
};
|
||||
|
||||
#define KC_WAVE S(KC_GRV)
|
||||
#define KC_MCTL KC_MISSION_CONTROL
|
||||
#define KC_LPAD KC_LAUNCHPAD
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[MAC_BASE] = LAYOUT_all(
|
||||
KC_ESC, KC_1, KC_2, KC_F3, KC_F4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE,
|
||||
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_DEL,
|
||||
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_VOLD, KC_VOLU, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[WIN_BASE] = LAYOUT_all(
|
||||
KC_ESC, 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_MUTE,
|
||||
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_DEL,
|
||||
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_VOLD, KC_VOLU, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[_FN1] = LAYOUT_all(
|
||||
KC_GRV, 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_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_TRNS, KC_TRNS),
|
||||
|
||||
[_FN2] = LAYOUT_all(
|
||||
KC_GRV, 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,
|
||||
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_TRNS, KC_TRNS),
|
||||
|
||||
[_FN3] = LAYOUT_all(
|
||||
KC_WAVE, 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,
|
||||
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_TRNS, KC_TRNS)
|
||||
};
|
||||
|
||||
#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
|
||||
|
||||
#define ENCODERS 1
|
||||
static uint8_t encoder_state[ENCODERS] = {0};
|
||||
static keypos_t encoder_cw[ENCODERS] = {{ 8, 4 }};
|
||||
static keypos_t encoder_ccw[ENCODERS] = {{ 7, 4 }};
|
||||
|
||||
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 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 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_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);
|
||||
} else {
|
||||
unregister_code(KC_LWIN);
|
||||
unregister_code(KC_E);
|
||||
}
|
||||
return false; // Skip all further processing of this key
|
||||
default:
|
||||
return true; // Process all other keycodes normally
|
||||
}
|
||||
}
|
2
keyboards/keychron/q2/rev_0113/keymaps/via/rules.mk
Normal file
2
keyboards/keychron/q2/rev_0113/keymaps/via/rules.mk
Normal file
|
@ -0,0 +1,2 @@
|
|||
VIA_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = no
|
5
keyboards/keychron/q2/rev_0113/readme.md
Normal file
5
keyboards/keychron/q2/rev_0113/readme.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# The ISO variant of the Keychron Q2 and support encoder
|
||||
|
||||
- Enable EC11 rotary encoder
|
||||
- Turn colckwise to increase volume and turn anti-colckwise to decrease volume
|
||||
- Press top right key pushbutton to mute
|
31
keyboards/keychron/q2/rev_0113/rev_0113.c
Normal file
31
keyboards/keychron/q2/rev_0113/rev_0113.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* 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 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, 10);
|
||||
} else {
|
||||
tap_code_delay(KC_VOLD, 10);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
48
keyboards/keychron/q2/rev_0113/rev_0113.h
Normal file
48
keyboards/keychron/q2/rev_0113/rev_0113.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* 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( \
|
||||
K00, K01, 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, K1E,\
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K1D, K2E,\
|
||||
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
|
||||
K40, K41, K42, K46, K47, K48, K4A, K4B, K4C, K4D, K2C, K4E \
|
||||
) { \
|
||||
{ K00, K01, 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, XXX, K3D, K3E, }, \
|
||||
{ K40, K41, K42, XXX, XXX, XXX, K46, K47, K48, XXX, K4A, K4B, K4C, K4D, K4E, } \
|
||||
}
|
||||
#define LAYOUT_iso_68( \
|
||||
K00, K01, 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, K1E,\
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K1D, K2E,\
|
||||
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \
|
||||
K40, K41, K42, K46, K4A, K4B, K4C, K4D, K2C, K4E \
|
||||
) { \
|
||||
{ K00, K01, 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, XXX, K3D, K3E, }, \
|
||||
{ K40, K41, K42, XXX, XXX, XXX, K46, XXX, XXX, XXX, K4A, K4B, K4C, K4D, K4E, } \
|
||||
}
|
34
keyboards/keychron/q2/rev_0113/rules.mk
Normal file
34
keyboards/keychron/q2/rev_0113/rules.mk
Normal file
|
@ -0,0 +1,34 @@
|
|||
# MCU name
|
||||
# MCU = STM32L432
|
||||
MCU = cortex-m4
|
||||
ARMV = 7
|
||||
MCU_FAMILY = STM32
|
||||
MCU_SERIES = STM32L4xx
|
||||
MCU_LDSCRIPT = STM32L432xB
|
||||
MCU_STARTUP = stm32l4xx
|
||||
BOARD = GENERIC_STM32_L433XC
|
||||
PLATFORM_NAME = platform_l432
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = no # 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
|
||||
DIP_SWITCH_ENABLE = yes
|
||||
EEPROM_DRIVER = i2c
|
||||
|
||||
# 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
|
Loading…
Add table
Add a link
Reference in a new issue