From f22a5e2061a38634ab906c428b8c27150df09b99 Mon Sep 17 00:00:00 2001 From: KeijoMika <54982553+KeijoMika@users.noreply.github.com> Date: Sat, 21 Oct 2023 11:47:13 +0300 Subject: [PATCH] [Keyboard] Add Keychron K2v2 RGB ISO (#358) * [Keyboard] Add Keychron K2v2 RGB ISO * Update Keychron K2v2 RGB ISO: -Move keymaps folder to iso folder, as it is ISO specific -Rename "iso" keymap folder to "default" * Update Keychron K2v2 RGB iso removed keyboards/keychron/k2/rgb/v2/iso/keymaps/via/config.h * Update keyboards/keychron/k2/rgb/v2/iso/readme.md Co-authored-by: dexter93 --------- Co-authored-by: dexter93 --- keyboards/keychron/k2/rgb/v2/config.h | 23 ++ keyboards/keychron/k2/rgb/v2/iso/config.h | 17 ++ keyboards/keychron/k2/rgb/v2/iso/info.json | 269 ++++++++++++++++++ .../k2/rgb/v2/iso/keymaps/default/keymap.c | 178 ++++++++++++ .../k2/rgb/v2/iso/keymaps/via/keymap.c | 178 ++++++++++++ .../k2/rgb/v2/iso/keymaps/via/readme.md | 11 + .../k2/rgb/v2/iso/keymaps/via/rules.mk | 2 + keyboards/keychron/k2/rgb/v2/iso/readme.md | 29 ++ keyboards/keychron/k2/rgb/v2/iso/rules.mk | 2 + .../keychron/k2/rgb/v2/via_json/k2_iso.json | 17 ++ 10 files changed, 726 insertions(+) create mode 100644 keyboards/keychron/k2/rgb/v2/config.h create mode 100644 keyboards/keychron/k2/rgb/v2/iso/config.h create mode 100644 keyboards/keychron/k2/rgb/v2/iso/info.json create mode 100644 keyboards/keychron/k2/rgb/v2/iso/keymaps/default/keymap.c create mode 100644 keyboards/keychron/k2/rgb/v2/iso/keymaps/via/keymap.c create mode 100644 keyboards/keychron/k2/rgb/v2/iso/keymaps/via/readme.md create mode 100644 keyboards/keychron/k2/rgb/v2/iso/keymaps/via/rules.mk create mode 100644 keyboards/keychron/k2/rgb/v2/iso/readme.md create mode 100644 keyboards/keychron/k2/rgb/v2/iso/rules.mk create mode 100644 keyboards/keychron/k2/rgb/v2/via_json/k2_iso.json diff --git a/keyboards/keychron/k2/rgb/v2/config.h b/keyboards/keychron/k2/rgb/v2/config.h new file mode 100644 index 000000000000..b73fd532640d --- /dev/null +++ b/keyboards/keychron/k2/rgb/v2/config.h @@ -0,0 +1,23 @@ +/* Copyright 2022 Philip Mourdjis + * Copyright 2023 KeijoMika (https://github.com/KeijoMika) + * + * 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 . + */ + +#pragma once +#define SN32_RGB_MATRIX_ROW_PINS { C3, C1, C0, C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3 } +#define DIP_SWITCH_PINS { D4, D5 } +#define WEAR_LEVELING_SN32_EMULATION_PAGE_COUNT 29 +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYPRESSES diff --git a/keyboards/keychron/k2/rgb/v2/iso/config.h b/keyboards/keychron/k2/rgb/v2/iso/config.h new file mode 100644 index 000000000000..c8366791a8a3 --- /dev/null +++ b/keyboards/keychron/k2/rgb/v2/iso/config.h @@ -0,0 +1,17 @@ +/* Copyright 2023 KeijoMika (https://github.com/KeijoMika) + * + * 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 . + */ + +#define RGB_MATRIX_LED_COUNT 85 diff --git a/keyboards/keychron/k2/rgb/v2/iso/info.json b/keyboards/keychron/k2/rgb/v2/iso/info.json new file mode 100644 index 000000000000..0460a97032f7 --- /dev/null +++ b/keyboards/keychron/k2/rgb/v2/iso/info.json @@ -0,0 +1,269 @@ +{ + "keyboard_name": "Keychron K2v2 RGB ISO", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "KeijoMika", + "usb": { + "pid": "0xFE03", + "vid": "0x0001", + "device_version": "1.0.0" + }, + "matrix_pins": { + "cols": ["A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7"], + "rows": ["C15", "D11", "D10", "D9", "D8", "D7"] + }, + "diode_direction": "COL2ROW", + "features": { + "rgb_matrix": true, + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": false, + "nkro": true, + "dip_switch": true + }, + "processor": "SN32F248BF", + "bootloader": "sn32-dfu", + "debounce": 5, + "indicators": { + "caps_lock": "B9", + "on_state": 1 + }, + "layouts": { + "LAYOUT_iso": { + "layout": [ + {"matrix":[0, 0], "x":0, "y":0}, + {"matrix":[0, 1], "x":1, "y":0}, + {"matrix":[0, 2], "x":2, "y":0}, + {"matrix":[0, 3], "x":3, "y":0}, + {"matrix":[0, 4], "x":4, "y":0}, + {"matrix":[0, 5], "x":5, "y":0}, + {"matrix":[0, 6], "x":6, "y":0}, + {"matrix":[0, 7], "x":7, "y":0}, + {"matrix":[0, 8], "x":8, "y":0}, + {"matrix":[0, 9], "x":9, "y":0}, + {"matrix":[0, 10], "x":10, "y":0}, + {"matrix":[0, 11], "x":11, "y":0}, + {"matrix":[0, 12], "x":12, "y":0}, + {"matrix":[0, 13], "x":13, "y":0}, + {"matrix":[0, 14], "x":14, "y":0}, + {"matrix":[0, 15], "x":15, "y":0}, + + {"matrix":[1, 0], "x":0, "y":1}, + {"matrix":[1, 1], "x":1, "y":1}, + {"matrix":[1, 2], "x":2, "y":1}, + {"matrix":[1, 3], "x":3, "y":1}, + {"matrix":[1, 4], "x":4, "y":1}, + {"matrix":[1, 5], "x":5, "y":1}, + {"matrix":[1, 6], "x":6, "y":1}, + {"matrix":[1, 7], "x":7, "y":1}, + {"matrix":[1, 8], "x":8, "y":1}, + {"matrix":[1, 9], "x":9, "y":1}, + {"matrix":[1, 10], "x":10, "y":1}, + {"matrix":[1, 11], "x":11, "y":1}, + {"matrix":[1, 12], "x":12, "y":1}, + {"matrix":[1, 13], "x":13, "y":1, "w":2}, + {"matrix":[1, 15], "x":15, "y":1}, + + {"matrix":[2, 0], "x":0, "y":2, "w":1.5}, + {"matrix":[2, 1], "x":1.5, "y":2}, + {"matrix":[2, 2], "x":2.5, "y":2}, + {"matrix":[2, 3], "x":3.5, "y":2}, + {"matrix":[2, 4], "x":4.5, "y":2}, + {"matrix":[2, 5], "x":5.5, "y":2}, + {"matrix":[2, 6], "x":6.5, "y":2}, + {"matrix":[2, 7], "x":7.5, "y":2}, + {"matrix":[2, 8], "x":8.5, "y":2}, + {"matrix":[2, 9], "x":9.5, "y":2}, + {"matrix":[2, 10], "x":10.5, "y":2}, + {"matrix":[2, 11], "x":11.5, "y":2}, + {"matrix":[2, 12], "x":12.5, "y":2}, + {"matrix":[2, 15], "x":15, "y":2}, + + {"matrix":[3, 0], "x":0, "y":3, "w":1.75}, + {"matrix":[3, 1], "x":1.75, "y":3}, + {"matrix":[3, 2], "x":2.75, "y":3}, + {"matrix":[3, 3], "x":3.75, "y":3}, + {"matrix":[3, 4], "x":4.75, "y":3}, + {"matrix":[3, 5], "x":5.75, "y":3}, + {"matrix":[3, 6], "x":6.75, "y":3}, + {"matrix":[3, 7], "x":7.75, "y":3}, + {"matrix":[3, 8], "x":8.75, "y":3}, + {"matrix":[3, 9], "x":9.75, "y":3}, + {"matrix":[3, 10], "x":10.75, "y":3}, + {"matrix":[3, 11], "x":11.75, "y":3}, + {"matrix":[3, 12], "x":12.75, "y":3}, + {"matrix":[3, 13], "x":12.75, "y":2, "h":2}, + {"matrix":[3, 15], "x":15, "y":3}, + + {"matrix":[4, 0], "x":0, "y":4, "w":1.25}, + {"matrix":[4, 1], "x":1.25, "y":4}, + {"matrix":[4, 2], "x":2.25, "y":4}, + {"matrix":[4, 3], "x":3.25, "y":4}, + {"matrix":[4, 4], "x":4.25, "y":4}, + {"matrix":[4, 5], "x":5.25, "y":4}, + {"matrix":[4, 6], "x":6.25, "y":4}, + {"matrix":[4, 7], "x":7.25, "y":4}, + {"matrix":[4, 8], "x":8.25, "y":4}, + {"matrix":[4, 9], "x":9.25, "y":4}, + {"matrix":[4, 10], "x":10.25, "y":4}, + {"matrix":[4, 11], "x":11.25, "y":4}, + {"matrix":[4, 13], "x":12.25, "y":4, "w":1.75}, + {"matrix":[4, 14], "x":14, "y":4}, + {"matrix":[4, 15], "x":15, "y":4}, + + {"matrix":[5, 0], "x":0, "y":5, "w":1.25}, + {"matrix":[5, 1], "x":1.25, "y":5, "w":1.25}, + {"matrix":[5, 2], "x":2.5, "y":5, "w":1.25}, + {"matrix":[5, 6], "x":3.75, "y":5, "w":6.25}, + {"matrix":[5, 10], "x":10, "y":5}, + {"matrix":[5, 11], "x":11, "y":5}, + {"matrix":[5, 12], "x":12, "y":5}, + {"matrix":[5, 13], "x":13, "y":5}, + {"matrix":[5, 14], "x":14, "y":5}, + {"matrix":[5, 15], "x":15, "y":5} + ] + } + }, + "rgb_matrix": { + "driver": "sn32f24xb", + "layout": [ + { "matrix": [ 0, 0 ], "flags": 4, "x": 7, "y": 0 }, + { "matrix": [ 0, 1 ], "flags": 4, "x": 21, "y": 0 }, + { "matrix": [ 0, 2 ], "flags": 4, "x": 35, "y": 0 }, + { "matrix": [ 0, 3 ], "flags": 4, "x": 49, "y": 0 }, + { "matrix": [ 0, 4 ], "flags": 4, "x": 63, "y": 0 }, + { "matrix": [ 0, 5 ], "flags": 4, "x": 77, "y": 0 }, + { "matrix": [ 0, 6 ], "flags": 4, "x": 91, "y": 0 }, + { "matrix": [ 0, 7 ], "flags": 4, "x": 105, "y": 0 }, + { "matrix": [ 0, 8 ], "flags": 4, "x": 119, "y": 0 }, + { "matrix": [ 0, 9 ], "flags": 4, "x": 133, "y": 0 }, + { "matrix": [ 0, 10 ], "flags": 4, "x": 147, "y": 0 }, + { "matrix": [ 0, 11 ], "flags": 4, "x": 161, "y": 0 }, + { "matrix": [ 0, 12 ], "flags": 4, "x": 175, "y": 0 }, + { "matrix": [ 0, 13 ], "flags": 4, "x": 189, "y": 0 }, + { "matrix": [ 0, 14 ], "flags": 4, "x": 203, "y": 0 }, + { "matrix": [ 0, 15 ], "flags": 4, "x": 217, "y": 0 }, + + { "matrix": [ 1, 0 ], "flags": 4, "x": 7, "y": 0 }, + { "matrix": [ 1, 1 ], "flags": 4, "x": 21, "y": 13 }, + { "matrix": [ 1, 2 ], "flags": 4, "x": 35, "y": 13 }, + { "matrix": [ 1, 3 ], "flags": 4, "x": 49, "y": 13 }, + { "matrix": [ 1, 4 ], "flags": 4, "x": 63, "y": 13 }, + { "matrix": [ 1, 5 ], "flags": 4, "x": 77, "y": 13 }, + { "matrix": [ 1, 6 ], "flags": 4, "x": 91, "y": 13 }, + { "matrix": [ 1, 7 ], "flags": 4, "x": 105, "y": 13 }, + { "matrix": [ 1, 8 ], "flags": 4, "x": 119, "y": 13 }, + { "matrix": [ 1, 9 ], "flags": 4, "x": 133, "y": 13 }, + { "matrix": [ 1, 10 ], "flags": 4, "x": 147, "y": 13 }, + { "matrix": [ 1, 11 ], "flags": 4, "x": 161, "y": 13 }, + { "matrix": [ 1, 12 ], "flags": 4, "x": 175, "y": 13 }, + { "matrix": [ 1, 13 ], "flags": 4, "x": 196, "y": 13 }, + { "matrix": [ 1, 15 ], "flags": 4, "x": 217, "y": 13 }, + + { "matrix": [ 2, 0 ], "flags": 4, "x": 11, "y": 26 }, + { "matrix": [ 2, 1 ], "flags": 4, "x": 28, "y": 26 }, + { "matrix": [ 2, 2 ], "flags": 4, "x": 42, "y": 26 }, + { "matrix": [ 2, 3 ], "flags": 4, "x": 56, "y": 26 }, + { "matrix": [ 2, 4 ], "flags": 4, "x": 70, "y": 26 }, + { "matrix": [ 2, 5 ], "flags": 4, "x": 84, "y": 26 }, + { "matrix": [ 2, 6 ], "flags": 4, "x": 98, "y": 26 }, + { "matrix": [ 2, 7 ], "flags": 4, "x": 112, "y": 26 }, + { "matrix": [ 2, 8 ], "flags": 4, "x": 126, "y": 26 }, + { "matrix": [ 2, 9 ], "flags": 4, "x": 140, "y": 26 }, + { "matrix": [ 2, 10 ], "flags": 4, "x": 154, "y": 26 }, + { "matrix": [ 2, 11 ], "flags": 4, "x": 168, "y": 26 }, + { "matrix": [ 2, 12 ], "flags": 4, "x": 182, "y": 26 }, + { "matrix": [ 2, 15 ], "flags": 4, "x": 217, "y": 26 }, + + { "matrix": [ 3, 0 ], "flags": 4, "x": 12, "y": 38 }, + { "matrix": [ 3, 1 ], "flags": 4, "x": 32, "y": 38 }, + { "matrix": [ 3, 2 ], "flags": 4, "x": 46, "y": 38 }, + { "matrix": [ 3, 3 ], "flags": 4, "x": 60, "y": 38 }, + { "matrix": [ 3, 4 ], "flags": 4, "x": 74, "y": 38 }, + { "matrix": [ 3, 5 ], "flags": 4, "x": 88, "y": 38 }, + { "matrix": [ 3, 6 ], "flags": 4, "x": 102, "y": 38 }, + { "matrix": [ 3, 7 ], "flags": 4, "x": 116, "y": 38 }, + { "matrix": [ 3, 8 ], "flags": 4, "x": 130, "y": 38 }, + { "matrix": [ 3, 9 ], "flags": 4, "x": 144, "y": 38 }, + { "matrix": [ 3, 10 ], "flags": 4, "x": 158, "y": 38 }, + { "matrix": [ 3, 11 ], "flags": 4, "x": 172, "y": 38 }, + { "matrix": [ 3, 12 ], "flags": 4, "x": 182, "y": 38 }, + { "matrix": [ 3, 13 ], "flags": 4, "x": 194, "y": 38 }, + { "matrix": [ 3, 15 ], "flags": 4, "x": 217, "y": 38 }, + + { "matrix": [ 4, 0 ], "flags": 4, "x": 9, "y": 51 }, + { "matrix": [ 4, 1 ], "flags": 4, "x": 26, "y": 51 }, + { "matrix": [ 4, 2 ], "flags": 4, "x": 39, "y": 51 }, + { "matrix": [ 4, 3 ], "flags": 4, "x": 53, "y": 51 }, + { "matrix": [ 4, 4 ], "flags": 4, "x": 67, "y": 51 }, + { "matrix": [ 4, 5 ], "flags": 4, "x": 81, "y": 51 }, + { "matrix": [ 4, 6 ], "flags": 4, "x": 95, "y": 51 }, + { "matrix": [ 4, 7 ], "flags": 4, "x": 109, "y": 51 }, + { "matrix": [ 4, 8 ], "flags": 4, "x": 123, "y": 51 }, + { "matrix": [ 4, 9 ], "flags": 4, "x": 137, "y": 51 }, + { "matrix": [ 4, 10 ], "flags": 4, "x": 151, "y": 51 }, + { "matrix": [ 4, 11 ], "flags": 4, "x": 165, "y": 51 }, + { "matrix": [ 4, 13 ], "flags": 4, "x": 184, "y": 51 }, + { "matrix": [ 4, 14 ], "flags": 4, "x": 203, "y": 51 }, + { "matrix": [ 4, 15 ], "flags": 4, "x": 217, "y": 51 }, + + { "matrix": [ 5, 0 ], "flags": 4, "x": 9, "y": 64 }, + { "matrix": [ 5, 1 ], "flags": 4, "x": 26, "y": 64 }, + { "matrix": [ 5, 2 ], "flags": 4, "x": 44, "y": 64 }, + { "matrix": [ 5, 6 ], "flags": 4, "x": 97, "y": 64 }, + { "matrix": [ 5, 10 ], "flags": 4, "x": 147, "y": 64 }, + { "matrix": [ 5, 11 ], "flags": 4, "x": 161, "y": 64 }, + { "matrix": [ 5, 12 ], "flags": 4, "x": 175, "y": 64 }, + { "matrix": [ 5, 13 ], "flags": 4, "x": 189, "y": 64 }, + { "matrix": [ 5, 14 ], "flags": 4, "x": 203, "y": 64 }, + { "matrix": [ 5, 15 ], "flags": 4, "x": 217, "y": 64 } + ], + "animations": { + "alphas_mods" : true, + "band_pinwheel_sat" : true, + "band_pinwheel_val" : true, + "band_sat" : true, + "band_spiral_sat" : true, + "band_spiral_val" : true, + "band_val" : true, + "breathing" : true, + "cycle_all" : true, + "cycle_left_right" : true, + "cycle_out_in" : true, + "cycle_out_in_dual" : true, + "cycle_pinwheel" : true, + "cycle_spiral" : true, + "cycle_up_down" : true, + "digital_rain" : true, + "dual_beacon" : true, + "gradient_left_right" : true, + "gradient_up_down" : true, + "hue_breathing" : true, + "hue_pendulum" : true, + "hue_wave" : true, + "jellybean_raindrops" : true, + "multisplash" : true, + "pixel_flow" : true, + "pixel_fractal" : true, + "pixel_rain" : true, + "rainbow_beacon" : true, + "rainbow_moving_chevron" : true, + "rainbow_pinwheels" : true, + "raindrops" : true, + "solid_multisplash" : true, + "solid_reactive" : true, + "solid_reactive_cross" : true, + "solid_reactive_multicross" : true, + "solid_reactive_multinexus" : true, + "solid_reactive_multiwide" : true, + "solid_reactive_nexus" : true, + "solid_reactive_simple" : true, + "solid_reactive_wide" : true, + "solid_splash" : true, + "splash" : true, + "typing_heatmap" : true + } + } +} diff --git a/keyboards/keychron/k2/rgb/v2/iso/keymaps/default/keymap.c b/keyboards/keychron/k2/rgb/v2/iso/keymaps/default/keymap.c new file mode 100644 index 000000000000..724271366f5e --- /dev/null +++ b/keyboards/keychron/k2/rgb/v2/iso/keymaps/default/keymap.c @@ -0,0 +1,178 @@ +/* Copyright 2020 Adam Honse + * Copyright 2020 Dimitris Mantzouranis + * Copyright 2022 Harrison Chan (Xelus) + * Copyright 2022 Pablo Ramirez + * Copyright 2022 Thomas Bowman Mørch (tbowmo) + * Copyright 2023 Mika Salmela (https://github.com/KeijoMika) + * + * 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 . + */ + +#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 { + WIN_BASE = 0, + WIN_FN = 1, + MAC_BASE = 2, + MAC_FN = 3, +}; + +#define KC_TASK LGUI(KC_TAB) // Task viewer +#define KC_FLXP LGUI(KC_E) // Windows file explorer +#define KC_CRTN LGUI(KC_C) // Cortana | Microsoft Teams + +#define KC_MSSN LGUI(KC_F3) // Mission Control +#define KC_FIND LALT(LGUI(KC_SPC)) // Finder +#define KC_SIRI LGUI(KC_SPC) // Siri +#define KC_MSNP LSFT(LGUI(KC_4)) // Mac snip tool +#define KC_MSCR LSFT(LGUI(KC_3)) // Mac screenshot + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Windows base layout + +------------------------------------------------------------------------------+ + | 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| + +------------------------------------------------------------------------------+ +*/ + [WIN_BASE] = LAYOUT_iso( + /* 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_PGUP , + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN , + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME , + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END , + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + +/* Windows Fn overlay + +------------------------------------------------------------------------------+ + | RST|BRID|BRIU|TASK|FLXP|RVAD|RVAI|MPRV|MPLY|MNXT|MUTE|VOLD|VOLU|SNIP|INS|RTOG| + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------- -----+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | |RSAI| | + +------------------------------------------------------------------------------+ + | | | | | | | |RHUD|RSAD|RHUI| + +------------------------------------------------------------------------------+ +*/ + [WIN_FN] = LAYOUT_iso( + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */ + QK_BOOT, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_INS, RGB_TOG , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, _______ , + _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_HUI + ), + +/* Mac base layout + +------------------------------------------------------------------------------+ + | 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| LALT| LGUI| SPACE | RALT| FN |RCTL|LEFT|DOWN|RGHT| + +------------------------------------------------------------------------------+ +*/ + [MAC_BASE] = LAYOUT_iso( + /* 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_MSCR, 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_PGUP , + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN , + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME , + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END , + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + +/* Mac Fn overlay + +------------------------------------------------------------------------------+ + | RST|BRID|BRIU|MCTL|LPAD|RVAD|RVAI|MPRV|MPLY|MNXT|MUTE|VOLD|VOLU|MSNP|INS|RTOG| + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------- -----+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | |RSAI| | + +------------------------------------------------------------------------------+ + | | | | | | | |RHUD|RSAD|RHUI| + +------------------------------------------------------------------------------+ +*/ + [MAC_FN] = LAYOUT_iso( + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */ + QK_BOOT, KC_BRID, KC_BRIU, KC_MSSN, KC_FIND, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MSNP, KC_INS, RGB_TOG , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, _______ , + _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_HUI + ), +}; + +bool dip_switch_update_user(uint8_t index, bool active){ + switch(index){ + case 0: + if(active) { // Mac mode + layer_move(MAC_BASE); + } else { // Windows mode + layer_move(WIN_BASE); + } + return false; + case 1: + if(active){ //Cable mode + // do stuff + } + else{ //BT 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; +} diff --git a/keyboards/keychron/k2/rgb/v2/iso/keymaps/via/keymap.c b/keyboards/keychron/k2/rgb/v2/iso/keymaps/via/keymap.c new file mode 100644 index 000000000000..724271366f5e --- /dev/null +++ b/keyboards/keychron/k2/rgb/v2/iso/keymaps/via/keymap.c @@ -0,0 +1,178 @@ +/* Copyright 2020 Adam Honse + * Copyright 2020 Dimitris Mantzouranis + * Copyright 2022 Harrison Chan (Xelus) + * Copyright 2022 Pablo Ramirez + * Copyright 2022 Thomas Bowman Mørch (tbowmo) + * Copyright 2023 Mika Salmela (https://github.com/KeijoMika) + * + * 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 . + */ + +#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 { + WIN_BASE = 0, + WIN_FN = 1, + MAC_BASE = 2, + MAC_FN = 3, +}; + +#define KC_TASK LGUI(KC_TAB) // Task viewer +#define KC_FLXP LGUI(KC_E) // Windows file explorer +#define KC_CRTN LGUI(KC_C) // Cortana | Microsoft Teams + +#define KC_MSSN LGUI(KC_F3) // Mission Control +#define KC_FIND LALT(LGUI(KC_SPC)) // Finder +#define KC_SIRI LGUI(KC_SPC) // Siri +#define KC_MSNP LSFT(LGUI(KC_4)) // Mac snip tool +#define KC_MSCR LSFT(LGUI(KC_3)) // Mac screenshot + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Windows base layout + +------------------------------------------------------------------------------+ + | 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| + +------------------------------------------------------------------------------+ +*/ + [WIN_BASE] = LAYOUT_iso( + /* 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_PGUP , + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN , + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME , + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END , + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + +/* Windows Fn overlay + +------------------------------------------------------------------------------+ + | RST|BRID|BRIU|TASK|FLXP|RVAD|RVAI|MPRV|MPLY|MNXT|MUTE|VOLD|VOLU|SNIP|INS|RTOG| + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------- -----+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | |RSAI| | + +------------------------------------------------------------------------------+ + | | | | | | | |RHUD|RSAD|RHUI| + +------------------------------------------------------------------------------+ +*/ + [WIN_FN] = LAYOUT_iso( + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */ + QK_BOOT, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_INS, RGB_TOG , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, _______ , + _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_HUI + ), + +/* Mac base layout + +------------------------------------------------------------------------------+ + | 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| LALT| LGUI| SPACE | RALT| FN |RCTL|LEFT|DOWN|RGHT| + +------------------------------------------------------------------------------+ +*/ + [MAC_BASE] = LAYOUT_iso( + /* 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_MSCR, 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_PGUP , + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN , + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME , + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END , + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + +/* Mac Fn overlay + +------------------------------------------------------------------------------+ + | RST|BRID|BRIU|MCTL|LPAD|RVAD|RVAI|MPRV|MPLY|MNXT|MUTE|VOLD|VOLU|MSNP|INS|RTOG| + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------- -----+ + | | | | | | | | | | | | | | | | + +------------------------------------------------------------------------------+ + | | | | | | | | | | | | | |RSAI| | + +------------------------------------------------------------------------------+ + | | | | | | | |RHUD|RSAD|RHUI| + +------------------------------------------------------------------------------+ +*/ + [MAC_FN] = LAYOUT_iso( + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */ + QK_BOOT, KC_BRID, KC_BRIU, KC_MSSN, KC_FIND, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MSNP, KC_INS, RGB_TOG , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ , + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, _______ , + _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_HUI + ), +}; + +bool dip_switch_update_user(uint8_t index, bool active){ + switch(index){ + case 0: + if(active) { // Mac mode + layer_move(MAC_BASE); + } else { // Windows mode + layer_move(WIN_BASE); + } + return false; + case 1: + if(active){ //Cable mode + // do stuff + } + else{ //BT 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; +} diff --git a/keyboards/keychron/k2/rgb/v2/iso/keymaps/via/readme.md b/keyboards/keychron/k2/rgb/v2/iso/keymaps/via/readme.md new file mode 100644 index 000000000000..560c382f11fd --- /dev/null +++ b/keyboards/keychron/k2/rgb/v2/iso/keymaps/via/readme.md @@ -0,0 +1,11 @@ +# Keychron K2v2 RGB ISO + +K2v2 RGB ISO with VIA support + +Make example for this keyboard (after setting up your build environment): + + qmk compile -kb keychron/k2/rgb/v2/iso -km via + +* * * + +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). \ No newline at end of file diff --git a/keyboards/keychron/k2/rgb/v2/iso/keymaps/via/rules.mk b/keyboards/keychron/k2/rgb/v2/iso/keymaps/via/rules.mk new file mode 100644 index 000000000000..16d33cd89fe4 --- /dev/null +++ b/keyboards/keychron/k2/rgb/v2/iso/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes + diff --git a/keyboards/keychron/k2/rgb/v2/iso/readme.md b/keyboards/keychron/k2/rgb/v2/iso/readme.md new file mode 100644 index 000000000000..5768d2e98092 --- /dev/null +++ b/keyboards/keychron/k2/rgb/v2/iso/readme.md @@ -0,0 +1,29 @@ +# Keychron K2V2 RGB ISO + + +*A 75% keyboard sold by keychron* + +* Keyboard Maintainer: [KeijoMika](https://github.com/KeijoMika) (based on work of dexter93 on a previous branch) +* Hardware Supported: *Keychron K2V2 RGB, MCU: SN32F248BF* +* Hardware Availability: *https://www.keychron.com/products/keychron-k2-hot-swappable-wireless-mechanical-keyboard* + +Compile example for this keyboard (after setting up your build environment): + + qmk compile -kb keychron/k2/rgb/v2/iso -km default + +Compile example for this keyboard with VIA (after setting up your build environment): + + qmk compile -kb keychron/k2/rgb/v2/iso -km via + +This keyboard must be flashed with an external [GUI](https://github.com/SonixQMK/sonix-flasher) or [CLI](https://github.com/SonixQMK/SonixFlasherC) + + + +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). + +## Bootloader + +Enter the bootloader in 2 ways: + +* **Physical Bootloader Pins**: Turn off the keyboard, Using a pair of tweezers or a paperclip, short the 2 pins left from spacebar switch holes and hold the tweezers on the pins while turning the keyboard on, this should put it into the bootloader. +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available. In the default keymap Fn+Esc. \ No newline at end of file diff --git a/keyboards/keychron/k2/rgb/v2/iso/rules.mk b/keyboards/keychron/k2/rgb/v2/iso/rules.mk new file mode 100644 index 000000000000..047de4137dd5 --- /dev/null +++ b/keyboards/keychron/k2/rgb/v2/iso/rules.mk @@ -0,0 +1,2 @@ +EEPROM_DRIVER = wear_leveling +WEAR_LEVELING_DRIVER = sn32_flash diff --git a/keyboards/keychron/k2/rgb/v2/via_json/k2_iso.json b/keyboards/keychron/k2/rgb/v2/via_json/k2_iso.json new file mode 100644 index 000000000000..f846fa10f0fa --- /dev/null +++ b/keyboards/keychron/k2/rgb/v2/via_json/k2_iso.json @@ -0,0 +1,17 @@ +{ + "name": "Keychron K2v2 RGB ISO", + "vendorId": "0x0001", + "productId": "0xFE03", + "matrix": {"rows": 6, "cols": 16}, + "keycodes": ["qmk_lighting"], + "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"] ] + }, + "menus": [ "qmk_rgb_matrix"] +}