Skip to content

Commit

Permalink
Added Keychron K3 ISO keymap (qmk#195)
Browse files Browse the repository at this point in the history
* Added K3 ISO keymap

* Aligned KC_Y and KC_H
  • Loading branch information
Gibbio authored Jan 13, 2022
1 parent ffcfac2 commit 0e6d154
Show file tree
Hide file tree
Showing 11 changed files with 331 additions and 444 deletions.
4 changes: 4 additions & 0 deletions keyboards/keychron/k3/keymaps/ansi/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* USB Device descriptor parameter */
#define VENDOR_ID 0x3434
#define PRODUCT_ID 0xFE04
#define DEVICE_VER 0x0001
110 changes: 110 additions & 0 deletions keyboards/keychron/k3/keymaps/ansi/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
Copyright 2020 Dimitris Mantzouranis
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

// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layer_names {
_BASE = 0,
_FN,
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

/*
*****************************************************************************************************************
* ESC * F1 * F2 * F3 * F4 * F5 * F6 * F7 * F8 * F9 * F10 * F11 * F12 * PSCR * DEL * RMOD *
*****************************************************************************************************************
* ~ * 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 0 * * * = * BSPC * PGUP *
*****************************************************************************************************************
* TAB * Q * W * E * R * T * Y * U * I * O * P * [ * ] * \ * PGDN *
*****************************************************************************************************************
* CAPS * A * S * D * F * G * H * J * K * L * ; * ' * ENT * HOME *
*****************************************************************************************************************
* LSFT * Z * X * C * V * B * N * M * , * . * / * RSFT * UP * END *
*****************************************************************************************************************
* LCTL * LGUI * LALT * SPC * RALT * FN * RCTL * LEFT * DOWN * RGHT *
*****************************************************************************************************************
*/
[_BASE] = {
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
{ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_DEL, RGB_MOD },
{ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, XXXXXXX, KC_PGUP },
{ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, XXXXXXX, KC_PGDN },
{ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXXX, KC_ENT, XXXXXXX, KC_HOME },
{ KC_LSFT, XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, XXXXXXX, KC_RSFT, KC_UP, KC_END },
{ KC_LCTL, KC_LGUI, KC_LALT, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_RALT, MO(_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }
},

/*
*****************************************************************************************************************
* * * * * * RVAD * RVAI * MPRV * MPLY * MNXT * MUTE * VOLD * VOLU * * * RTOG *
*****************************************************************************************************************
* * * * * * * * * * * * * * * RM_P *
*****************************************************************************************************************
* * * * * * * * * * * * * * * *
*****************************************************************************************************************
* * * * * * * * * * * * * * *
*****************************************************************************************************************
* * * * * * * * * * * * * RSAI * *
*****************************************************************************************************************
* * * * * * FN * * RHUD * RSAD * RHUI *
*****************************************************************************************************************
*/
[_FN] = {
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
{ RESET, KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_TOG },
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, RGB_M_P },
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, KC_NO },
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, KC_NO, XXXXXXX, KC_NO },
{ KC_NO, XXXXXXX, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, KC_NO, RGB_SAI, KC_NO },
{ KC_NO, KC_NO, KC_NO, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO, MO(_FN), KC_NO, RGB_HUD, RGB_SAD, RGB_HUI }
}
};

bool dip_switch_update_user(uint8_t index, bool active) {
switch(index) {
case 0: // OS switch
if (active) { // Win/Android mode
// do stuff
}
else { // Mac/iOS mode
// do stuff
}
break;
case 1: // Connection switch
// Probably it's not possible to do anything sensible here as switching from Cable to BT requires turning off the board. (BT / OFF / Cable)
if (active) { // BT mode
// do stuff
}
else { //Cable mode
// do stuff
}
break;
}
return true;
}

void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
// debug_enable = true;
// debug_matrix = true;
// debug_keyboard = true;
// debug_mouse = true;
}
17 changes: 17 additions & 0 deletions keyboards/keychron/k3/keymaps/ansi/via_ansi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Keychron K3 ANSI",
"vendorId": "0x3434",
"productId": "0xFE04",
"lighting": "none",
"matrix": {"rows": 6, "cols": 16},
"layouts": {
"keymap": [
[ "0,0","0,1","0,2","0,3","0,4","0,5","0,6","0,7","0,8","0,9","0,10","0,11","0,12","0,13","0,14","0,15" ],
[ "1,0","1,1","1,2","1,3","1,4","1,5","1,6","1,7","1,8","1,9","1,10","1,11","1,12",{"w": 2},"1,13","1,15" ],
[{"w": 1.5},"2,0","2,1","2,2","2,3","2,4","2,5","2,6","2,7","2,8","2,9","2,10","2,11","2,12",{"w": 1.5},"2,13","2,15" ],
[{"w": 1.75},"3,0","3,1","3,2","3,3","3,4","3,5","3,6","3,7","3,8","3,9","3,10","3,11",{"w": 2.25},"3,13","3,15" ],
[{"w": 2.25},"4,0","4,2","4,3","4,4","4,5","4,6","4,7","4,8","4,9","4,10","4,11",{"w": 1.75},"4,13","4,14","4,15" ],
[{"w": 1.25},"5,0",{"w": 1.25},"5,1",{"w": 1.25},"5,2",{"w": 6.25},"5,6","5,10","5,11","5,12","5,13","5,14","5,15" ]
]
}
}
6 changes: 6 additions & 0 deletions keyboards/keychron/k3/keymaps/iso/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* USB Device descriptor parameter */
#define VENDOR_ID 0x3434
#define PRODUCT_ID 0xFE05
#define DEVICE_VER 0x0001

#define KEYMAP_ISO 1
107 changes: 107 additions & 0 deletions keyboards/keychron/k3/keymaps/iso/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
Copyright 2020 Dimitris Mantzouranis
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

// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layer_names {
_BASE = 0,
_FN,
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

/* +------------------------------------------------------------------------------+
| ESC| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10| F11| F12|PSCR|DEL|RMOD|
+------------------------------------------------------------------------------+
| ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BACKSP |PGUP|
+------------------------------------------------------------------------------+
| TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | |PGDN|
+------------------------------------------------------------------- RET -----+
|CAPSLCK| A | S | D | F | G | H | J | K | L | ; | ' | # | |HOME|
+------------------------------------------------------------------------------+
|LSHFT| \ | Z | X | C | V | B | N | M | , | . | / | RSHIFT| UP | END|
+------------------------------------------------------------------------------+
|LCTRL| LGUI| LALT| SPACE | RALT| FN |RCTL|LEFT|DOWN|RGHT|
+------------------------------------------------------------------------------+
*/
[_BASE] = {
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
{ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_DEL, RGB_MOD },
{ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NO, KC_PGUP },
{ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_NO, KC_NO, KC_PGDN },
{ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_NO, 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_NO, KC_RSFT, KC_UP, KC_END },
{ KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, MO(_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }
},
/* +------------------------------------------------------------------------------+
| | | | | |RVAD|RVAI|MPRV|MPLY|MNXT|MUTE|VOLD|VOLU| | |RTOG|
+------------------------------------------------------------------------------+
| | | | | | | | | | | | | | |RM_P|
+------------------------------------------------------------------------------+
| | | | | | | | | | | | | | | |
+------------------------------------------------------------------- RET -----+
| | | | | | | | | | | | | | | |
+------------------------------------------------------------------------------+
| | | | | | | | | | | | | |RSAI| |
+------------------------------------------------------------------------------+
| | | | | | FN | |RHUD|RSAD|RHUI|
+------------------------------------------------------------------------------+
*/
[_FN] = {
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
{ RESET, KC_NO, KC_NO, KC_APP, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_TOG },
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, RGB_M_P },
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, KC_NO },
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, KC_NO, XXXXXXX, KC_NO },
{ KC_NO, XXXXXXX, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, KC_NO, RGB_SAI, KC_NO },
{ KC_NO, KC_NO, KC_NO, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO, MO(_FN), KC_NO, RGB_HUD, RGB_SAD, RGB_HUI }
}
};

bool dip_switch_update_user(uint8_t index, bool active) {
switch(index) {
case 0: // OS switch
if (active) { // Win/Android mode
// do stuff
}
else { // Mac/iOS mode
// do stuff
}
break;
case 1: // Connection switch
// Probably it's not possible to do anything sensible here as switching from Cable to BT requires turning off the board. (BT / OFF / Cable)
if (active) { // BT mode
// do stuff
}
else { //Cable mode
// do stuff
}
break;
}
return true;
}

void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
// debug_enable = true;
// debug_matrix = true;
// debug_keyboard = true;
// debug_mouse = true;
}
17 changes: 17 additions & 0 deletions keyboards/keychron/k3/keymaps/iso/via_iso.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Keychron K3 ISO",
"vendorId": "0x3434",
"productId": "0xFE05",
"lighting": "none",
"matrix": {"rows": 6, "cols": 16},
"layouts": {
"keymap": [
[ "0,0","0,1","0,2","0,3","0,4","0,5","0,6","0,7","0,8","0,9","0,10","0,11","0,12","0,13","0,14","0,15" ],
[ "1,0","1,1","1,2","1,3","1,4","1,5","1,6","1,7","1,8","1,9","1,10","1,11","1,12",{"w": 2},"1,13","1,15" ],
[{"w": 1.5},"2,0","2,1","2,2","2,3","2,4","2,5","2,6","2,7","2,8","2,9","2,10","2,11","2,12",{"x": 0.25,"w": 1.25,"h": 2,"w2": 1.5,"h2": 1,"x2": -0.25},"3,13","2,15" ],
[{"w": 1.75},"3,0","3,1","3,2","3,3","3,4","3,5","3,6","3,7","3,8","3,9","3,10","3,11","3,12",{"x": 1.25},"3,15" ],
[{"w": 1.25},"4,0","4,1","4,2","4,3","4,4","4,5","4,6","4,7","4,8","4,9","4,10","4,11",{"w": 1.75},"4,13","4,14","4,15" ],
[{"w": 1.25},"5,0",{"w": 1.25},"5,1",{"w": 1.25},"5,2",{"w": 6.25},"5,6","5,10","5,11","5,12","5,13","5,14","5,15" ]
]
}
}
32 changes: 31 additions & 1 deletion keyboards/keychron/k3/rgb/config_led.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,36 @@

#define NA NO_LED // readability

#ifdef KEYMAP_ISO
/* ISO keymap LEDs */
led_config_t g_led_config = {
{
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
{ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, NA, 30 },
{ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, NA, NA, 44 },
{ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, NA, 59 },
{ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, NA, 72, 73, 74 },
{ 75, 76, 77, NA, NA, NA, 78, NA, NA, NA, 79, 80, 81, 82, 83, 84 }
},
{
{7 , 0}, {21 , 0}, {35 , 0}, {49 , 0}, {63 , 0}, {77 , 0}, {91 , 0}, {105, 0}, {119, 0}, {133, 0}, {147, 0}, {161, 0}, {175, 0}, {189, 0}, {203, 0}, {217, 0},
{7 ,13}, {21 ,13}, {35 ,13}, {49 ,13}, {63 ,13}, {77 ,13}, {91 ,13}, {105,13}, {119,13}, {133,13}, {147,13}, {161,13}, {175,13}, {196,13}, {217,13},
{11 ,26}, {28 ,26}, {42 ,26}, {56 ,26}, {70 ,26}, {84 ,26}, {98 ,26}, {112,26}, {126,26}, {140,26}, {154,26}, {168,26}, {182,26}, {217,26},
{12 ,38}, {32 ,38}, {46 ,38}, {60 ,38}, {74 ,38}, {88 ,38}, {102,38}, {116,38}, {130,38}, {144,38}, {158,38}, {172,38}, {182,38}, {194,38}, {217,38},
{9 ,51}, {26 ,51}, {39 ,51}, {53 ,51}, {67 ,51}, {81 ,51}, {95 ,51}, {109,51}, {123,51}, {137,51}, {151,51}, {165,51}, {184,51}, {203,51}, {217,51},
{9 ,64}, {26 ,64}, {44 ,64}, {97 ,64}, {147,64}, {161,64}, {175,64}, {189,64}, {203,64}, {217,64},
},
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
}
};
#else
/* ANSI keymap LEDs */
/*
****************************************************************************************************************
* 1 * 7 * 13 * 19 * 25 * 31 * 37 * 43 * 49 * 55 * 61 * 67 * 73 * 79 * 85 * 91 *
Expand Down Expand Up @@ -61,5 +91,5 @@ led_config_t g_led_config = {
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
}
};

#endif
#endif
4 changes: 4 additions & 0 deletions keyboards/keychron/k3/rgb/config_led.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define LED_MATRIX_COLS MATRIX_COLS
#define LED_MATRIX_COL_PINS MATRIX_COL_PINS

#ifdef KEYMAP_ISO
#define DRIVER_LED_TOTAL (85)
#else
#define DRIVER_LED_TOTAL (84)
#endif
Loading

0 comments on commit 0e6d154

Please sign in to comment.