From 5ae58a483efc3960cce0b2841b29eee40b0be157 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Thu, 1 Feb 2024 09:34:30 +0800 Subject: [PATCH 01/31] Create gk104_q1_ansi keyboard --- keyboards/skyloong/gk104/q1/ansi/info.json | 341 ++++++++++++++++++ .../gk104/q1/ansi/keymaps/default/keymap.c | 33 ++ .../gk104/q1/ansi/keymaps/default/rules.mk | 1 + .../gk104/q1/ansi/keymaps/via/keymap.c | 175 +++++++++ .../gk104/q1/ansi/keymaps/via/rules.mk | 2 + keyboards/skyloong/gk104/q1/ansi/rules.mk | 2 + keyboards/skyloong/gk104/q1/config.h | 29 ++ keyboards/skyloong/gk104/q1/halconf.h | 9 + keyboards/skyloong/gk104/q1/info.json | 80 ++++ keyboards/skyloong/gk104/q1/matrix.c | 166 +++++++++ keyboards/skyloong/gk104/q1/mcuconf.h | 16 + keyboards/skyloong/gk104/q1/q1.c | 293 +++++++++++++++ keyboards/skyloong/gk104/q1/readme.md | 33 ++ 13 files changed, 1180 insertions(+) create mode 100644 keyboards/skyloong/gk104/q1/ansi/info.json create mode 100644 keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c create mode 100644 keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk create mode 100644 keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c create mode 100644 keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk create mode 100644 keyboards/skyloong/gk104/q1/ansi/rules.mk create mode 100644 keyboards/skyloong/gk104/q1/config.h create mode 100644 keyboards/skyloong/gk104/q1/halconf.h create mode 100644 keyboards/skyloong/gk104/q1/info.json create mode 100644 keyboards/skyloong/gk104/q1/matrix.c create mode 100644 keyboards/skyloong/gk104/q1/mcuconf.h create mode 100644 keyboards/skyloong/gk104/q1/q1.c create mode 100644 keyboards/skyloong/gk104/q1/readme.md diff --git a/keyboards/skyloong/gk104/q1/ansi/info.json b/keyboards/skyloong/gk104/q1/ansi/info.json new file mode 100644 index 00000000000..45dd6cb1fe1 --- /dev/null +++ b/keyboards/skyloong/gk104/q1/ansi/info.json @@ -0,0 +1,341 @@ +{ + "keyboard_name": "GK980 Q1_ANSI_1.0.0", + + "rgb_matrix": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, + {"matrix": [0, 1], "x": 18.2, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 30.3, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 52, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 42.4, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 69.6, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 81.7, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 93.9, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 106, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 121.1, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 133.2, "y": 0, "flags": 4}, + {"matrix": [5, 3], "x": 145.3, "y": 0, "flags": 4}, + {"matrix": [5, 4], "x": 157.4, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 187.7, "y": 0, "flags": 4}, + {"matrix": [0, 13], "x": 199.8, "y": 0, "flags": 4}, + {"matrix": [0, 14], "x": 211.9, "y": 0, "flags": 4}, + {"matrix": [6, 13], "x": 224, "y": 0, "flags": 4}, + + {"matrix": [1, 0], "x": 0, "y": 14.5, "flags": 4}, + {"matrix": [1, 1], "x": 12.1, "y": 14.5, "flags": 4}, + {"matrix": [1, 2], "x": 24.2, "y": 14.5, "flags": 4}, + {"matrix": [1, 3], "x": 36.3, "y": 14.5, "flags": 4}, + {"matrix": [1, 4], "x": 48.4, "y": 14.5, "flags": 4}, + {"matrix": [1, 5], "x": 60.6, "y": 14.5, "flags": 4}, + {"matrix": [1, 6], "x": 72.7, "y": 14.5, "flags": 4}, + {"matrix": [1, 7], "x": 84.8, "y": 14.5, "flags": 8}, + {"matrix": [1, 8], "x": 96.9, "y": 14.5, "flags": 4}, + {"matrix": [1, 9], "x": 109, "y": 14.5, "flags": 4}, + {"matrix": [1, 10], "x": 121.1, "y": 14.5, "flags": 4}, + {"matrix": [6, 3], "x": 133.2, "y": 14.5, "flags": 4}, + {"matrix": [6, 4], "x": 145.3, "y": 14.5, "flags": 4}, + {"matrix": [1, 11], "x": 157.4, "y": 14.5, "flags": 4}, + {"matrix": [1, 12], "x": 187.7, "y": 14.5, "flags": 4}, + {"matrix": [1, 13], "x": 199.8, "y": 14.5, "flags": 4}, + {"matrix": [1, 14], "x": 211.9, "y": 14.5, "flags": 4}, + {"matrix": [6, 14], "x": 224, "y": 14.5, "flags": 4}, + + {"matrix": [2, 0], "x": 0, "y": 26.2, "flags": 4}, + {"matrix": [2, 1], "x": 18.2, "y": 26.2, "flags": 4}, + {"matrix": [2, 2], "x": 30.3, "y": 26.2, "flags": 4}, + {"matrix": [2, 3], "x": 42.4, "y": 26.2, "flags": 4}, + {"matrix": [2, 4], "x": 54.5, "y": 26.2, "flags": 4}, + {"matrix": [2, 5], "x": 66.6, "y": 26.2, "flags": 4}, + {"matrix": [2, 6], "x": 78.7, "y": 26.2, "flags": 4}, + {"matrix": [2, 7], "x": 90.8, "y": 26.2, "flags": 4}, + {"matrix": [2, 8], "x": 102.9, "y": 26.2, "flags": 4}, + {"matrix": [2, 9], "x": 115, "y": 26.2, "flags": 4}, + {"matrix": [2, 10], "x": 127.2, "y": 26.2, "flags": 4}, + {"matrix": [6, 5], "x": 139.3, "y": 26.2, "flags": 4}, + {"matrix": [6, 6], "x": 151.4, "y": 26.2, "flags": 4}, + {"matrix": [2, 11], "x": 163.5, "y": 26.2, "flags": 4}, + {"matrix": [2, 12], "x": 187.7, "y": 26.2, "flags": 4}, + {"matrix": [2, 13], "x": 199.8, "y": 26.2, "flags": 4}, + {"matrix": [2, 14], "x": 211.9, "y": 26.2, "flags": 4}, + {"matrix": [6, 11], "x": 224, "y": 32, "flags": 4}, + + {"matrix": [3, 0], "x": 0, "y": 37.8, "flags": 4}, + {"matrix": [3, 1], "x": 21.2, "y": 37.8, "flags": 4}, + {"matrix": [3, 2], "x": 33.3, "y": 37.8, "flags": 4}, + {"matrix": [3, 3], "x": 45.4, "y": 37.8, "flags": 4}, + {"matrix": [3, 4], "x": 57.5, "y": 37.8, "flags": 4}, + {"matrix": [3, 5], "x": 69.6, "y": 37.8, "flags": 4}, + {"matrix": [3, 6], "x": 81.7, "y": 37.8, "flags": 4}, + {"matrix": [3, 7], "x": 93.9, "y": 37.8, "flags": 4}, + {"matrix": [3, 8], "x": 106, "y": 37.8, "flags": 4}, + {"matrix": [3, 9], "x": 118.1, "y": 37.8, "flags": 4}, + {"matrix": [3, 10], "x": 130.2, "y": 37.8, "flags": 4}, + {"matrix": [6, 7], "x": 142.3, "y": 37.8, "flags": 4}, + {"matrix": [3, 11], "x": 154.4, "y": 37.8, "flags": 4}, + {"matrix": [3, 12], "x": 187.7, "y": 37.8, "flags": 4}, + {"matrix": [3, 13], "x": 199.8, "y": 37.8, "flags": 4}, + {"matrix": [3, 14], "x": 211.9, "y": 37.8, "flags": 4}, + + {"matrix": [4, 0], "x": 0, "y": 49.5, "flags": 4}, + {"matrix": [4, 1], "x": 27.2, "y": 49.5, "flags": 4}, + {"matrix": [4, 2], "x": 39.4, "y": 49.5, "flags": 4}, + {"matrix": [4, 3], "x": 51.5, "y": 49.5, "flags": 4}, + {"matrix": [4, 4], "x": 63.6, "y": 49.5, "flags": 4}, + {"matrix": [4, 5], "x": 75.7, "y": 49.5, "flags": 4}, + {"matrix": [4, 6], "x": 87.8, "y": 49.5, "flags": 4}, + {"matrix": [4, 7], "x": 99.9, "y": 49.5, "flags": 4}, + {"matrix": [4, 8], "x": 112, "y": 49.5, "flags": 4}, + {"matrix": [4, 9], "x": 124.1, "y": 49.5, "flags": 4}, + {"matrix": [4, 10], "x": 136.2, "y": 49.5, "flags": 4}, + {"matrix": [6, 8], "x": 148.3, "y": 49.5, "flags": 4}, + {"matrix": [4, 11], "x": 172.6, "y": 49.5, "flags": 4}, + {"matrix": [4, 12], "x": 187.7, "y": 49.5, "flags": 4}, + {"matrix": [4, 13], "x": 199.8, "y": 49.5, "flags": 4}, + {"matrix": [4, 14], "x": 211.9, "y": 49.5, "flags": 4}, + {"matrix": [6, 12], "x": 224, "y": 55.3, "flags": 4}, + + {"matrix": [5, 0], "x": 0, "y": 61.1, "flags": 4}, + {"matrix": [5, 1], "x": 15.1, "y": 61.1, "flags": 4}, + {"matrix": [6, 1], "x": 30.3, "y": 61.1, "flags": 4}, + {"matrix": [6, 0], "x": 45.4, "y": 61.1, "flags": 4}, + {"matrix": [5, 5], "x": 68.1, "y": 61.1, "flags": 4}, + {"matrix": [5, 6], "x": 90.8, "y": 61.1, "flags": 4}, + {"matrix": [5, 9], "x": 121.1, "y": 61.1, "flags": 4}, + {"matrix": [5, 7], "x": 133.2, "y": 61.1, "flags": 4}, + {"matrix": [5, 10], "x": 145.3, "y": 61.1, "flags": 4}, + {"matrix": [6, 9], "x": 160.5, "y": 64, "flags": 4}, + {"matrix": [5, 11], "x": 172.6, "y": 64, "flags": 4}, + {"matrix": [5, 12], "x": 184.7, "y": 64, "flags": 4}, + {"matrix": [5, 13], "x": 199.8, "y": 61.1, "flags": 4}, + {"matrix": [5, 14], "x": 211.9, "y": 61.1, "flags": 4} + ] + }, + "usb": { + "device_version": "1.0.0", + "pid": "0x6098" + }, + "layouts": { + "LAYOUT_all": { + "layout": [ + {"label": "ESC", "matrix": [0, 0], "x": 0, "y": 0}, + {"label": "F1", "matrix": [0, 1], "x": 1.5, "y": 0}, + {"label": "F2", "matrix": [0, 2], "x": 2.5, "y": 0}, + {"label": "F3", "matrix": [0, 3], "x": 3.5, "y": 0}, + {"label": "F4", "matrix": [0, 4], "x": 4.5, "y": 0}, + {"label": "F5", "matrix": [0, 5], "x": 5.75, "y": 0}, + {"label": "F6", "matrix": [0, 6], "x": 6.75, "y": 0}, + {"label": "F7", "matrix": [0, 7], "x": 7.75, "y": 0}, + {"label": "F8", "matrix": [0, 8], "x": 8.75, "y": 0}, + {"label": "F9", "matrix": [0, 9], "x": 10, "y": 0}, + {"label": "F10", "matrix": [0, 10], "x": 11, "y": 0}, + {"label": "F11", "matrix": [5, 3], "x": 12, "y": 0}, + {"label": "F12", "matrix": [5, 4], "x": 13, "y": 0}, + {"label": "Mute", "matrix": [0, 11], "x": 14.25, "y": 0}, + {"label": "PgUp", "matrix": [0, 12], "x": 15.5, "y": 0}, + {"label": "PgDn", "matrix": [0, 13], "x": 16.5, "y": 0}, + {"label": "PB", "matrix": [0, 14], "x": 17.5, "y": 0}, + {"label": "PrtSc", "matrix": [6, 13], "x": 18.5, "y": 0}, + + {"label": "~", "matrix": [1, 0], "x": 0, "y": 1.25}, + {"label": "1", "matrix": [1, 1], "x": 1, "y": 1.25}, + {"label": "2", "matrix": [1, 2], "x": 2, "y": 1.25}, + {"label": "3", "matrix": [1, 3], "x": 3, "y": 1.25}, + {"label": "4", "matrix": [1, 4], "x": 4, "y": 1.25}, + {"label": "5", "matrix": [1, 5], "x": 5, "y": 1.25}, + {"label": "6", "matrix": [1, 6], "x": 6, "y": 1.25}, + {"label": "7", "matrix": [1, 7], "x": 7, "y": 1.25}, + {"label": "8", "matrix": [1, 8], "x": 8, "y": 1.25}, + {"label": "9", "matrix": [1, 9], "x": 9, "y": 1.25}, + {"label": "0", "matrix": [1, 10], "x": 10, "y": 1.25}, + {"label": "-_", "matrix": [6, 3], "x": 11, "y": 1.25}, + {"label": "=+", "matrix": [6, 4], "x": 12, "y": 1.25}, + {"label": "BS", "matrix": [1, 11], "x": 13, "y": 1.25, "w": 2}, + {"label": "NumLk", "matrix": [1, 12], "x": 15.5, "y": 1.25}, + {"label": "P/", "matrix": [1, 13], "x": 16.5, "y": 1.25}, + {"label": "P*", "matrix": [1, 14], "x": 17.5, "y": 1.25}, + {"label": "P-", "matrix": [6, 14], "x": 18.5, "y": 1.25}, + + {"label": "Tab", "matrix": [2, 0], "x": 0, "y": 2.25, "w": 1.5}, + {"label": "Q", "matrix": [2, 1], "x": 1.5, "y": 2.25}, + {"label": "W", "matrix": [2, 2], "x": 2.5, "y": 2.25}, + {"label": "E", "matrix": [2, 3], "x": 3.5, "y": 2.25}, + {"label": "R", "matrix": [2, 4], "x": 4.5, "y": 2.25}, + {"label": "T", "matrix": [2, 5], "x": 5.5, "y": 2.25}, + {"label": "Y", "matrix": [2, 6], "x": 6.5, "y": 2.25}, + {"label": "U", "matrix": [2, 7], "x": 7.5, "y": 2.25}, + {"label": "I", "matrix": [2, 8], "x": 8.5, "y": 2.25}, + {"label": "O", "matrix": [2, 9], "x": 9.5, "y": 2.25}, + {"label": "P", "matrix": [2, 10], "x": 10.5, "y": 2.25}, + {"label": "[", "matrix": [6, 5], "x": 11.5, "y": 2.25}, + {"label": "]", "matrix": [6, 6], "x": 12.5, "y": 2.25}, + {"label": "|", "matrix": [2, 11], "x": 13.5, "y": 2.25, "w": 1.5}, + {"label": "P7", "matrix": [2, 12], "x": 15.5, "y": 2.25}, + {"label": "P8", "matrix": [2, 13], "x": 16.5, "y": 2.25}, + {"label": "P9", "matrix": [2, 14], "x": 17.5, "y": 2.25}, + {"label": "P+", "matrix": [6, 11], "x": 18.5, "y": 2.25, "h": 2.0}, + + {"label": "Cap", "matrix": [3, 0], "x": 0, "y": 3.25, "w": 1.75}, + {"label": "A", "matrix": [3, 1], "x": 1.75, "y": 3.25}, + {"label": "S", "matrix": [3, 2], "x": 2.75, "y": 3.25}, + {"label": "D", "matrix": [3, 3], "x": 3.75, "y": 3.25}, + {"label": "F", "matrix": [3, 4], "x": 4.75, "y": 3.25}, + {"label": "G", "matrix": [3, 5], "x": 5.75, "y": 3.25}, + {"label": "H", "matrix": [3, 6], "x": 6.75, "y": 3.25}, + {"label": "J", "matrix": [3, 7], "x": 7.75, "y": 3.25}, + {"label": "K", "matrix": [3, 8], "x": 8.75, "y": 3.25}, + {"label": "L", "matrix": [3, 9], "x": 9.75, "y": 3.25}, + {"label": ";", "matrix": [3, 10], "x": 10.75, "y": 3.25}, + {"label": "'", "matrix": [6, 7], "x": 11.75, "y": 3.25}, + {"label": "Ent", "matrix": [3, 11], "x": 12.75, "y": 3.25, "w": 2.25}, + {"label": "P4", "matrix": [3, 12], "x": 15.5, "y": 3.25}, + {"label": "P5", "matrix": [3, 13], "x": 16.5, "y": 3.25}, + {"label": "P6", "matrix": [3, 14], "x": 17.5, "y": 3.25}, + + {"label": "Shift", "matrix": [4, 0], "x": 0, "y": 4.25, "w": 2.25}, + {"label": "Z", "matrix": [4, 1], "x": 2.25, "y": 4.25}, + {"label": "X", "matrix": [4, 2], "x": 3.25, "y": 4.25}, + {"label": "C", "matrix": [4, 3], "x": 4.25, "y": 4.25}, + {"label": "V", "matrix": [4, 4], "x": 5.25, "y": 4.25}, + {"label": "B", "matrix": [4, 5], "x": 6.25, "y": 4.25}, + {"label": "N", "matrix": [4, 6], "x": 7.25, "y": 4.25}, + {"label": "M", "matrix": [4, 7], "x": 8.25, "y": 4.25}, + {"label": ",", "matrix": [4, 8], "x": 9.25, "y": 4.25}, + {"label": ".", "matrix": [4, 9], "x": 10.25, "y": 4.25}, + {"label": "?", "matrix": [4, 10], "x": 11.25, "y": 4.25}, + {"label": "Shift", "matrix": [6, 8], "x": 12.25, "y": 4.25, "w": 1.75}, + {"label": "Up", "matrix": [4, 11], "x": 14.25, "y": 4.5}, + {"label": "P1", "matrix": [4, 12], "x": 15.5, "y": 4.25}, + {"label": "P2", "matrix": [4, 13], "x": 16.5, "y": 4.25}, + {"label": "P3", "matrix": [4, 14], "x": 17.5, "y": 4.25}, + {"label": "PENT", "matrix": [6, 12], "x": 18.5, "y": 4.25, "h": 2.0}, + + + {"label": "Ctrl", "matrix": [5, 0], "x": 0, "y": 5.25, "w": 1.25}, + {"label": "Com", "matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25}, + {"label": "Alt", "matrix": [6, 1], "x": 2.5, "y": 5.25, "w": 1.25}, + {"label": "SPAC1", "matrix": [6, 0], "x": 3.75, "y": 5.25, "w": 3.125, "h": 0.5}, + {"label": "SPAC", "matrix": [5, 5], "x": 3.75, "y": 5.75, "w": 6.25, "h":0.5}, + {"label": "SPAC2", "matrix": [5, 6], "x": 6.875, "y": 5.25, "w": 3.125, "h":0.5}, + {"label": "Alt", "matrix": [5, 9], "x": 10, "y": 5.25}, + {"label": "Fn", "matrix": [5, 7], "x": 11, "y": 5.25}, + {"label": "Menu", "matrix": [5, 10], "x": 12, "y": 5.25}, + {"label": "Left", "matrix": [6, 9], "x": 13.25, "y": 5.5}, + {"label": "Down", "matrix": [5, 11], "x": 14.25, "y": 5.5}, + {"label": "Right", "matrix": [5, 12], "x": 15.25, "y": 5.5}, + {"label": "P0", "matrix": [5, 13], "x": 16.5, "y": 5.25}, + {"label": "PDOT", "matrix": [5, 14], "x": 17.5, "y": 5.25} + ] + }, + "LAYOUT_980_ansi_split_space": { + "layout": [ + {"label": "ESC", "matrix": [0, 0], "x": 0, "y": 0}, + {"label": "F1", "matrix": [0, 1], "x": 1.5, "y": 0}, + {"label": "F2", "matrix": [0, 2], "x": 2.5, "y": 0}, + {"label": "F3", "matrix": [0, 3], "x": 3.5, "y": 0}, + {"label": "F4", "matrix": [0, 4], "x": 4.5, "y": 0}, + {"label": "F5", "matrix": [0, 5], "x": 5.75, "y": 0}, + {"label": "F6", "matrix": [0, 6], "x": 6.75, "y": 0}, + {"label": "F7", "matrix": [0, 7], "x": 7.75, "y": 0}, + {"label": "F8", "matrix": [0, 8], "x": 8.75, "y": 0}, + {"label": "F9", "matrix": [0, 9], "x": 10, "y": 0}, + {"label": "F10", "matrix": [0, 10], "x": 11, "y": 0}, + {"label": "F11", "matrix": [5, 3], "x": 12, "y": 0}, + {"label": "F12", "matrix": [5, 4], "x": 13, "y": 0}, + {"label": "Mute", "matrix": [0, 11], "x": 14.25, "y": 0}, + {"label": "PgUp", "matrix": [0, 12], "x": 15.5, "y": 0}, + {"label": "PgDn", "matrix": [0, 13], "x": 16.5, "y": 0}, + {"label": "PB", "matrix": [0, 14], "x": 17.5, "y": 0}, + {"label": "PrtSc", "matrix": [6, 13], "x": 18.5, "y": 0}, + + {"label": "~", "matrix": [1, 0], "x": 0, "y": 1.25}, + {"label": "1", "matrix": [1, 1], "x": 1, "y": 1.25}, + {"label": "2", "matrix": [1, 2], "x": 2, "y": 1.25}, + {"label": "3", "matrix": [1, 3], "x": 3, "y": 1.25}, + {"label": "4", "matrix": [1, 4], "x": 4, "y": 1.25}, + {"label": "5", "matrix": [1, 5], "x": 5, "y": 1.25}, + {"label": "6", "matrix": [1, 6], "x": 6, "y": 1.25}, + {"label": "7", "matrix": [1, 7], "x": 7, "y": 1.25}, + {"label": "8", "matrix": [1, 8], "x": 8, "y": 1.25}, + {"label": "9", "matrix": [1, 9], "x": 9, "y": 1.25}, + {"label": "0", "matrix": [1, 10], "x": 10, "y": 1.25}, + {"label": "-_", "matrix": [6, 3], "x": 11, "y": 1.25}, + {"label": "=+", "matrix": [6, 4], "x": 12, "y": 1.25}, + {"label": "BS", "matrix": [1, 11], "x": 13, "y": 1.25, "w": 2}, + {"label": "NumLk", "matrix": [1, 12], "x": 15.5, "y": 1.25}, + {"label": "P/", "matrix": [1, 13], "x": 16.5, "y": 1.25}, + {"label": "P*", "matrix": [1, 14], "x": 17.5, "y": 1.25}, + {"label": "P-", "matrix": [6, 14], "x": 18.5, "y": 1.25}, + + {"label": "Tab", "matrix": [2, 0], "x": 0, "y": 2.25, "w": 1.5}, + {"label": "Q", "matrix": [2, 1], "x": 1.5, "y": 2.25}, + {"label": "W", "matrix": [2, 2], "x": 2.5, "y": 2.25}, + {"label": "E", "matrix": [2, 3], "x": 3.5, "y": 2.25}, + {"label": "R", "matrix": [2, 4], "x": 4.5, "y": 2.25}, + {"label": "T", "matrix": [2, 5], "x": 5.5, "y": 2.25}, + {"label": "Y", "matrix": [2, 6], "x": 6.5, "y": 2.25}, + {"label": "U", "matrix": [2, 7], "x": 7.5, "y": 2.25}, + {"label": "I", "matrix": [2, 8], "x": 8.5, "y": 2.25}, + {"label": "O", "matrix": [2, 9], "x": 9.5, "y": 2.25}, + {"label": "P", "matrix": [2, 10], "x": 10.5, "y": 2.25}, + {"label": "[", "matrix": [6, 5], "x": 11.5, "y": 2.25}, + {"label": "]", "matrix": [6, 6], "x": 12.5, "y": 2.25}, + {"label": "|", "matrix": [2, 11], "x": 13.5, "y": 2.25, "w": 1.5}, + {"label": "P7", "matrix": [2, 12], "x": 15.5, "y": 2.25}, + {"label": "P8", "matrix": [2, 13], "x": 16.5, "y": 2.25}, + {"label": "P9", "matrix": [2, 14], "x": 17.5, "y": 2.25}, + {"label": "P+", "matrix": [6, 11], "x": 18.5, "y": 2.25, "h": 2.0}, + + {"label": "Cap", "matrix": [3, 0], "x": 0, "y": 3.25, "w": 1.75}, + {"label": "A", "matrix": [3, 1], "x": 1.75, "y": 3.25}, + {"label": "S", "matrix": [3, 2], "x": 2.75, "y": 3.25}, + {"label": "D", "matrix": [3, 3], "x": 3.75, "y": 3.25}, + {"label": "F", "matrix": [3, 4], "x": 4.75, "y": 3.25}, + {"label": "G", "matrix": [3, 5], "x": 5.75, "y": 3.25}, + {"label": "H", "matrix": [3, 6], "x": 6.75, "y": 3.25}, + {"label": "J", "matrix": [3, 7], "x": 7.75, "y": 3.25}, + {"label": "K", "matrix": [3, 8], "x": 8.75, "y": 3.25}, + {"label": "L", "matrix": [3, 9], "x": 9.75, "y": 3.25}, + {"label": ";", "matrix": [3, 10], "x": 10.75, "y": 3.25}, + {"label": "'", "matrix": [6, 7], "x": 11.75, "y": 3.25}, + {"label": "Ent", "matrix": [3, 11], "x": 12.75, "y": 3.25, "w": 2.25}, + {"label": "P4", "matrix": [3, 12], "x": 15.5, "y": 3.25}, + {"label": "P5", "matrix": [3, 13], "x": 16.5, "y": 3.25}, + {"label": "P6", "matrix": [3, 14], "x": 17.5, "y": 3.25}, + + {"label": "Shift", "matrix": [4, 0], "x": 0, "y": 4.25, "w": 2.25}, + {"label": "Z", "matrix": [4, 1], "x": 2.25, "y": 4.25}, + {"label": "X", "matrix": [4, 2], "x": 3.25, "y": 4.25}, + {"label": "C", "matrix": [4, 3], "x": 4.25, "y": 4.25}, + {"label": "V", "matrix": [4, 4], "x": 5.25, "y": 4.25}, + {"label": "B", "matrix": [4, 5], "x": 6.25, "y": 4.25}, + {"label": "N", "matrix": [4, 6], "x": 7.25, "y": 4.25}, + {"label": "M", "matrix": [4, 7], "x": 8.25, "y": 4.25}, + {"label": ",", "matrix": [4, 8], "x": 9.25, "y": 4.25}, + {"label": ".", "matrix": [4, 9], "x": 10.25, "y": 4.25}, + {"label": "?", "matrix": [4, 10], "x": 11.25, "y": 4.25}, + {"label": "Shift", "matrix": [6, 8], "x": 12.25, "y": 4.25, "w": 1.75}, + {"label": "Up", "matrix": [4, 11], "x": 14.25, "y": 4.5}, + {"label": "P1", "matrix": [4, 12], "x": 15.5, "y": 4.25}, + {"label": "P2", "matrix": [4, 13], "x": 16.5, "y": 4.25}, + {"label": "P3", "matrix": [4, 14], "x": 17.5, "y": 4.25}, + {"label": "PENT", "matrix": [6, 12], "x": 18.5, "y": 4.25, "h": 2.0}, + + + {"label": "Ctrl", "matrix": [5, 0], "x": 0, "y": 5.25, "w": 1.25}, + {"label": "Com", "matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25}, + {"label": "Alt", "matrix": [6, 1], "x": 2.5, "y": 5.25, "w": 1.25}, + {"label": "SPAC1", "matrix": [6, 0], "x": 3.75, "y": 5.25, "w": 3.125}, + {"label": "SPAC2", "matrix": [5, 6], "x": 6.875, "y": 5.25, "w": 3.125}, + {"label": "Alt", "matrix": [5, 9], "x": 10, "y": 5.25}, + {"label": "Fn", "matrix": [5, 7], "x": 11, "y": 5.25}, + {"label": "Menu", "matrix": [5, 10], "x": 12, "y": 5.25}, + {"label": "Left", "matrix": [6, 9], "x": 13.25, "y": 5.5}, + {"label": "Down", "matrix": [5, 11], "x": 14.25, "y": 5.5}, + {"label": "Right", "matrix": [5, 12], "x": 15.25, "y": 5.5}, + {"label": "P0", "matrix": [5, 13], "x": 16.5, "y": 5.25}, + {"label": "PDOT", "matrix": [5, 14], "x": 17.5, "y": 5.25} + ] + } + + } +} diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c new file mode 100644 index 00000000000..6d820d1d350 --- /dev/null +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c @@ -0,0 +1,33 @@ +// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT_all( + 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_MUTE, KC_SCRL, KC_PAUS, KC_HOME, KC_END, + 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_NUM, KC_PSLS, KC_PAST, KC_PMNS, + 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_P7, KC_P8, KC_P9, KC_PPLS, + 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_P4, KC_P5, KC_P6, + 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_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(1), KC_MENU, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + ), + + [1] = LAYOUT_all( + _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_PGUP, KC_PGDN, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, + _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT + ), +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(RGB_HUD, RGB_HUI), ENCODER_CCW_CW(RGB_SPD, RGB_SPI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, + [1] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(RGB_HUD, RGB_HUI), ENCODER_CCW_CW(RGB_SPD, RGB_SPI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))} +}; +#endif + diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk new file mode 100644 index 00000000000..ee325681483 --- /dev/null +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c new file mode 100644 index 00000000000..40949bbfdde --- /dev/null +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c @@ -0,0 +1,175 @@ +// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H +int FN_WIN = 0; +int FN_MAC = 0; +int L_WIN = 0; +int L_MAC = 0; + +enum layer_names { + _WIN, + _MAC, + _WIN_INDEX, + _MAC_INDEX +}; +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_WIN] = LAYOUT_all( + 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_MUTE, KC_DEL, KC_PGUP, KC_PGDN, KC_PSCR, + 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_NUM, KC_PSLS, KC_PAST, KC_PMNS, + 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_P7, KC_P8, KC_P9, KC_PPLS, + 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_P4, KC_P5, KC_P6, + 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_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_WIN_INDEX), KC_APP, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + ), + + [_MAC] = LAYOUT_all( + KC_ESC, KC_F14, KC_F15, C(KC_UP), G(KC_D), G(KC_SPC), LAG(KC_EJCT), KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_DEL, KC_PGUP, KC_PGDN, KC_PSCR, + 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_NUM, KC_PSLS, KC_PAST, KC_PMNS, + 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_P7, KC_P8, KC_P9, KC_PPLS, + 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_P4, KC_P5, KC_P6, + 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_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RCMD, MO(_MAC_INDEX), KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + ), + + [_WIN_INDEX] = LAYOUT_all( + _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_HOME, KC_END, + _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, _______, _______, _______, KC_RALT, _______, KC_APP, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT + ), + + [_MAC_INDEX] = LAYOUT_all( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_HOME, KC_END, + _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LALT, KC_LGUI, _______, _______, _______, KC_RCMD, _______, KC_RALT, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT + ) +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [_WIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, + [_MAC] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, + [_WIN_INDEX] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, + [_MAC_INDEX] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))} +}; +#endif + +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + + switch (get_highest_layer(layer_state)) { + case 2:{ + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } break; + case 3:{ + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + } + } break; + + case 0:{ + if (L_WIN) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + }else{ + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + } + } + } break; + + case 1:{ + if (L_MAC) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + } + }else{ + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } + } break; + + default:{ + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } + } + return true; +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + switch (keycode) { +# ifdef RGB_MATRIX_ENABLE + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + } break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + } break; + } + } + return false; + case RGB_VAI: + rgb_matrix_set_flags(LED_FLAG_ALL); + return true; +# endif + case TO(0): + if (record->event.pressed) { + L_WIN = 1; + set_single_persistent_default_layer(0); // Save default layer 0 to eeprom + } else { + L_WIN = 0; + } + return true; // continue all further processing of this key + + case MO(2): + if (record->event.pressed) { + FN_WIN = 1; + } else { + FN_WIN = 0; + } + return true; // continue all further processing of this key + + case TO(1): + if (record->event.pressed) { + L_MAC = 1; + set_single_persistent_default_layer(1); //Save default layer 1 to eeprom + } else { + L_MAC = 0; + } + return true; // continue all further processing of this key + + case MO(3): + if (record->event.pressed) { + FN_MAC = 1; + } else { + FN_MAC = 0; + } + return true; // continue all further processing of this key + default: + return true; + } +} diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk new file mode 100644 index 00000000000..f1adcab005e --- /dev/null +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/skyloong/gk104/q1/ansi/rules.mk b/keyboards/skyloong/gk104/q1/ansi/rules.mk new file mode 100644 index 00000000000..6aebeff05a8 --- /dev/null +++ b/keyboards/skyloong/gk104/q1/ansi/rules.mk @@ -0,0 +1,2 @@ + CUSTOM_MATRIX = lite + SRC += matrix.c diff --git a/keyboards/skyloong/gk104/q1/config.h b/keyboards/skyloong/gk104/q1/config.h new file mode 100644 index 00000000000..134473ed4fc --- /dev/null +++ b/keyboards/skyloong/gk104/q1/config.h @@ -0,0 +1,29 @@ +// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define MAC_PIN C13 +#define DEBOUNCE 10 + +#ifdef ENCODER_ENABLE +# define ENCODER_MAP_KEY_DELAY 20 +#endif + +#ifdef RGB_MATRIX_ENABLE +# define AW20216S_CS_PIN_1 B12 +# define AW20216S_CS_PIN_2 B11 +// Hardware enable lines may be connected to the same pin +# define AW20216S_EN_PIN_1 B5 +# define AW20216S_EN_PIN_2 B5 + +# define NUM_LOCK_INDEX 31 +# define WIN_MOD_INDEX 23 +# define MAC_MOD_INDEX 24 +# define WIN_LOCK_INDEX 75 +# define SCR_LOCK_INDEX 14 +# define SDB B5 +# define RGB_MATRIX_KEYPRESSES +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#endif // RGB_MATRIX_ENABLE + diff --git a/keyboards/skyloong/gk104/q1/halconf.h b/keyboards/skyloong/gk104/q1/halconf.h new file mode 100644 index 00000000000..d13f22eaf73 --- /dev/null +++ b/keyboards/skyloong/gk104/q1/halconf.h @@ -0,0 +1,9 @@ +// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#define HAL_USE_SPI TRUE +#define SPI_USE_WAIT TRUE +#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD + +#include_next diff --git a/keyboards/skyloong/gk104/q1/info.json b/keyboards/skyloong/gk104/q1/info.json new file mode 100644 index 00000000000..22acc9db18c --- /dev/null +++ b/keyboards/skyloong/gk104/q1/info.json @@ -0,0 +1,80 @@ +{ + "manufacturer": "skyloong", + "maintainer": "NaturalZh", + "bootloader": "stm32duino", + "build": { + "debounce_type": "asym_eager_defer_pk" + }, + "eeprom": { + "wear_leveling": { + "backing_size": 4096 + } + }, + "encoder": { + "rotary": [ + {"pin_a": "A1", "pin_b": "A0", "resolution": 2}, + {"pin_a": "A3", "pin_b": "A2", "resolution": 2}, + {"pin_a": "A4", "pin_b": "B0", "resolution": 2}, + {"pin_a": "B3", "pin_b": "B1", "resolution": 2}, + {"pin_a": "B10", "pin_b": "B4", "resolution": 2} + ] + }, + "features": { + "bootmagic": true, + "command": true, + "console": false, + "encoder": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "indicators": { + "num_lock": "C15", + "on_state": 1, + "caps_lock": "C14" + }, + "matrix_pins": { + "cols": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null], + "rows": ["A8", "A9", "A10", "A15", "B6", "B7","B9"] + }, + "processor": "STM32F103", + "rgb_matrix": { + "animations": { + "band_spiral_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, + "jellybean_raindrops": true, + "pixel_rain": true, + "rainbow_moving_chevron": true, + "raindrops": true, + "solid_reactive_multinexus": true, + "solid_reactive_multiwide": true, + "solid_reactive_simple": true, + "solid_splash": true, + "splash": true, + "typing_heatmap": true + }, + "driver": "aw20216", + "hue_steps": 20, + "max_brightness": 200, + "sat_steps": 20, + "speed_steps": 20, + "val_steps": 20, + "sleep": true + }, + "url": "https://www.skyloong.vip", + "usb": { + "max_power": 380, + "vid": "0x1EA7" + } + +} diff --git a/keyboards/skyloong/gk104/q1/matrix.c b/keyboards/skyloong/gk104/q1/matrix.c new file mode 100644 index 00000000000..12e7d6c5dc0 --- /dev/null +++ b/keyboards/skyloong/gk104/q1/matrix.c @@ -0,0 +1,166 @@ +// Copyright 2023 NaturaZh (@NaturalZh) +// SPDX-License-Identifier: GPL-2.0-or-later +//Matrix read rows set col:DIODE_DIRECTION == ROW2COL + +#include "quantum.h" +#include "debounce.h" + +#define ReadDelayTime 120 +#define ClockTime 15 +#define MATRIX_INPUT_PRESSED_STATE 0 + +#define HC595_ST_PIN A6 +#define HC595_SH_PIN A5 +#define HC595_DS_PIN A7 //定义74HC595的串口数据输入端 + +/* 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 + +pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +// user-defined overridable functions +__attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter); + +static inline void select_delay(uint16_t n) { + while (n-- > 0) { + asm volatile("nop" ::: "memory"); + }; +} + +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) == MATRIX_INPUT_PRESSED_STATE) ? 0 : 1; + } else { + return 1; + } +} + +static inline void clockPulse(uint16_t n) { + writePinHigh(HC595_SH_PIN); + writePinHigh(HC595_ST_PIN); + select_delay(n); + writePinLow(HC595_SH_PIN); + writePinLow(HC595_ST_PIN); +} + +// matrix code + +static bool select_col(uint8_t col) { + setPinOutput_writeHigh(HC595_DS_PIN); + for (uint8_t m = 0; m <= col; m++) { + if(m == 0){ + writePinLow(HC595_DS_PIN); + }else{ + writePinHigh(HC595_DS_PIN); + } + clockPulse(ClockTime); + } + return true; + +} + +static void unselect_col(uint8_t col) { + uint8_t x = (MATRIX_COLS - col); + setPinOutput_writeHigh(HC595_DS_PIN); + for (uint8_t y = 0; y < x ; y++) { + clockPulse(ClockTime); + } +} + +static void unselect_cols(void) { + setPinOutput_writeLow(HC595_SH_PIN); + setPinOutput_writeLow(HC595_ST_PIN); + setPinOutput_writeHigh(HC595_DS_PIN); + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + clockPulse(ClockTime); + } +} + +__attribute__((weak)) void matrix_init_pins(void) { + unselect_cols(); + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + if (row_pins[x] != NO_PIN) { + setPinInputHigh_atomic(row_pins[x]); + } + } +} + +__attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) { + bool key_pressed = false; + + // Select col + if (!select_col(current_col)) { // select col + return; // skip NO_PIN col + } + matrix_output_select_delay(); + + // For each row... + for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { + // Check row pin state + if (readMatrixPin(row_pins[row_index]) == 0) { + // Pin LO, set col bit + current_matrix[row_index] |= row_shifter; + key_pressed = true; + } else { + // Pin HI, clear col bit + current_matrix[row_index] &= ~row_shifter; + } + } + + // Unselect col + unselect_col(current_col); + matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH +} + +void matrix_init_custom(void) { + + // initialize key pins + matrix_init_pins(); + + // initialize matrix state: all keys off + memset(matrix, 0, sizeof(matrix)); + memset(raw_matrix, 0, sizeof(raw_matrix)); + + debounce_init(MATRIX_ROWS); + + matrix_init_kb(); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + matrix_row_t curr_matrix[MATRIX_ROWS] = {0}; + + // Set col, read rows + matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) { + matrix_read_rows_on_col(curr_matrix, current_col, row_shifter); + } + + bool changed = memcmp(raw_matrix, curr_matrix, sizeof(curr_matrix)) != 0; + if (changed) memcpy(raw_matrix, curr_matrix, sizeof(curr_matrix)); + + changed = debounce(raw_matrix, matrix, MATRIX_ROWS, changed); + matrix_scan_kb(); + return (uint8_t)changed; +} diff --git a/keyboards/skyloong/gk104/q1/mcuconf.h b/keyboards/skyloong/gk104/q1/mcuconf.h new file mode 100644 index 00000000000..af06d34b273 --- /dev/null +++ b/keyboards/skyloong/gk104/q1/mcuconf.h @@ -0,0 +1,16 @@ +// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#include_next + +#undef STM32_SPI_USE_SPI2 +#define STM32_SPI_USE_SPI2 TRUE + +#undef STM32_SPI_USE_DMA +#define STM32_SPI_USE_DMA TRUE + +#undef STM32_SPI_USE_SPI1 +#define STM32_SPI_USE_SPI1 TRUE + + diff --git a/keyboards/skyloong/gk104/q1/q1.c b/keyboards/skyloong/gk104/q1/q1.c new file mode 100644 index 00000000000..b0f47726fde --- /dev/null +++ b/keyboards/skyloong/gk104/q1/q1.c @@ -0,0 +1,293 @@ +// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// SPDX-License-Identifier: GPL-2.0-or-later +#include "quantum.h" + +#define MAC_OFF 0x1A //disable mac layer indicator on LED display +#define MAC_ON 0x3B //enable mac layer indicator on LED diaplay + + +uint8_t IND = 0; //buffer of LED Display + +#if defined(RGB_MATRIX_ENABLE) /*&& defined(CAPS_LOCK_INDEX)*/ +const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT] = { +/* Each AW20216 channel is controlled by a register at some offset between 0x00 + * and 0xD7 inclusive. + * See drivers/awinic/aw20216.h for the mapping between register offsets and + * driver pin locations. + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + {0, CS1_SW1, CS2_SW1, CS3_SW1}, + {0, CS1_SW3, CS2_SW3, CS3_SW3}, + {0, CS1_SW4, CS2_SW4, CS3_SW4}, + {0, CS1_SW5, CS2_SW5, CS3_SW5}, + {0, CS1_SW6, CS2_SW6, CS3_SW6}, + {0, CS1_SW7, CS2_SW7, CS3_SW7}, + {0, CS1_SW8, CS2_SW8, CS3_SW8}, + {0, CS1_SW9, CS2_SW9, CS3_SW9}, + {0, CS1_SW10, CS2_SW10, CS3_SW10}, + {0, CS1_SW11, CS2_SW11, CS3_SW11}, + {0, CS1_SW12, CS2_SW12, CS3_SW12}, + {0, CS10_SW2, CS11_SW2, CS12_SW2}, + {0, CS10_SW3, CS11_SW3, CS12_SW3}, + //encoder no led + {0, CS10_SW5, CS11_SW5, CS12_SW5}, + {0, CS10_SW6, CS11_SW6, CS12_SW6}, + {0, CS10_SW7, CS11_SW7, CS12_SW7}, + {0, CS10_SW8, CS11_SW8, CS12_SW8}, + + {0, CS4_SW1, CS5_SW1, CS6_SW1}, + {0, CS4_SW2, CS5_SW2, CS6_SW2}, + {0, CS4_SW3, CS5_SW3, CS6_SW3}, + {0, CS4_SW4, CS5_SW4, CS6_SW4}, + {0, CS4_SW5, CS5_SW5, CS6_SW5}, + {0, CS4_SW6, CS5_SW6, CS6_SW6}, + {0, CS4_SW7, CS5_SW7, CS6_SW7}, + {0, CS4_SW8, CS5_SW8, CS6_SW8}, + {0, CS4_SW9, CS5_SW9, CS6_SW9}, + {0, CS4_SW10, CS5_SW10, CS6_SW10}, + {0, CS4_SW11, CS5_SW11, CS6_SW11}, + {0, CS4_SW12, CS5_SW12, CS6_SW12}, + {0, CS13_SW2, CS14_SW2, CS15_SW2}, + {0, CS13_SW3, CS14_SW3, CS15_SW3}, + {0, CS13_SW4, CS14_SW4, CS15_SW4}, + {0, CS13_SW5, CS14_SW5, CS15_SW5}, + {0, CS13_SW6, CS14_SW6, CS15_SW6}, + {0, CS13_SW7, CS14_SW7, CS15_SW7}, + + {0, CS7_SW1, CS8_SW1, CS9_SW1}, + {0, CS7_SW2, CS8_SW2, CS9_SW2}, + {0, CS7_SW3, CS8_SW3, CS9_SW3}, + {0, CS7_SW4, CS8_SW4, CS9_SW4}, + {0, CS7_SW5, CS8_SW5, CS9_SW5}, + {0, CS7_SW6, CS8_SW6, CS9_SW6}, + {0, CS7_SW7, CS8_SW7, CS9_SW7}, + {0, CS7_SW8, CS8_SW8, CS9_SW8}, + {0, CS7_SW9, CS8_SW9, CS9_SW9}, + {0, CS7_SW10, CS8_SW10, CS9_SW10}, + {0, CS7_SW11, CS8_SW11, CS9_SW11}, + {0, CS7_SW12, CS8_SW12, CS9_SW12}, + {0, CS16_SW2, CS17_SW2, CS18_SW2}, + {0, CS16_SW3, CS17_SW3, CS18_SW3}, + {0, CS16_SW4, CS17_SW4, CS18_SW4}, + {0, CS16_SW5, CS17_SW5, CS18_SW5}, + {0, CS16_SW6, CS17_SW6, CS18_SW6}, + {0, CS16_SW7, CS17_SW7, CS18_SW7}, + + + {1, CS1_SW1, CS2_SW1, CS3_SW1}, + {1, CS1_SW2, CS2_SW2, CS3_SW2}, + {1, CS1_SW3, CS2_SW3, CS3_SW3}, + {1, CS1_SW4, CS2_SW4, CS3_SW4}, + {1, CS1_SW5, CS2_SW5, CS3_SW5}, + {1, CS1_SW6, CS2_SW6, CS3_SW6}, + {1, CS1_SW7, CS2_SW7, CS3_SW7}, + {1, CS1_SW8, CS2_SW8, CS3_SW8}, + {1, CS1_SW9, CS2_SW9, CS3_SW9}, + {1, CS1_SW10, CS2_SW10, CS3_SW10}, + {1, CS1_SW11, CS2_SW11, CS3_SW11}, + {1, CS1_SW12, CS2_SW12, CS3_SW12}, + {1, CS10_SW3, CS11_SW3, CS12_SW3}, + {1, CS10_SW4, CS11_SW4, CS12_SW4}, + {1, CS10_SW5, CS11_SW5, CS12_SW5}, + {1, CS10_SW6, CS11_SW6, CS12_SW6}, + + {1, CS4_SW1, CS5_SW1, CS6_SW1}, + {1, CS4_SW2, CS5_SW2, CS6_SW2}, + {1, CS4_SW3, CS5_SW3, CS6_SW3}, + {1, CS4_SW4, CS5_SW4, CS6_SW4}, + {1, CS4_SW5, CS5_SW5, CS6_SW5}, + {1, CS4_SW6, CS5_SW6, CS6_SW6}, + {1, CS4_SW7, CS5_SW7, CS6_SW7}, + {1, CS4_SW8, CS5_SW8, CS6_SW8}, + {1, CS4_SW9, CS5_SW9, CS6_SW9}, + {1, CS4_SW10, CS5_SW10, CS6_SW10}, + {1, CS4_SW11, CS5_SW11, CS6_SW11}, + {1, CS13_SW2, CS14_SW2, CS15_SW2}, + {1, CS13_SW3, CS14_SW3, CS15_SW3}, + {1, CS13_SW4, CS14_SW4, CS15_SW4}, + {1, CS13_SW5, CS14_SW5, CS15_SW5}, + {1, CS13_SW6, CS14_SW6, CS15_SW6}, + {1, CS13_SW7, CS14_SW7, CS15_SW7}, + + + {1, CS7_SW1, CS8_SW1, CS9_SW1}, + {1, CS7_SW2, CS8_SW2, CS9_SW2}, + {1, CS7_SW3, CS8_SW3, CS9_SW3}, + {1, CS7_SW5, CS8_SW5, CS9_SW5}, + {1, CS7_SW6, CS8_SW6, CS9_SW6}, + {1, CS7_SW8, CS8_SW8, CS9_SW8}, + {1, CS7_SW10, CS8_SW10, CS9_SW10}, + {1, CS7_SW11, CS8_SW11, CS9_SW11}, + {1, CS7_SW12, CS8_SW12, CS9_SW12}, + {1, CS16_SW2, CS17_SW2, CS18_SW2}, + {1, CS16_SW3, CS17_SW3, CS18_SW3}, + {1, CS16_SW4, CS17_SW4, CS18_SW4}, + {1, CS16_SW5, CS17_SW5, CS18_SW5}, + {1, CS16_SW6, CS17_SW6, CS18_SW6} +}; + +#endif + + + +void suspend_power_down_kb() { +# ifdef RGB_MATRIX_ENABLE + writePinLow(SDB); +# endif + writePinLow(MAC_PIN); + suspend_power_down_user(); +} + +void suspend_wakeup_init_kb() { +# ifdef RGB_MATRIX_ENABLE + writePinHigh(SDB); +# endif + suspend_wakeup_init_user(); +} + +bool shutdown_kb(bool jump_to_bootloader) { + writePinLow(SDB); + return shutdown_user(jump_to_bootloader); +} + +layer_state_t default_layer_state_set_kb(layer_state_t state) { + switch (get_highest_layer(state)) { + case 0: + writePinLow(MAC_PIN); + IND =& MAC_OFF; + serial_to_parallel(IND); + break; + case 1: + writePinHigh(MAC_PIN); + IND =|| MAC_ON; + serial_to_parallel(IND); + break; + } + return state; +} + + +bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { + if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { + return false; + } + + if (host_keyboard_led_state().caps_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 255, 255, 255); + } else { + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 0, 0, 0); + } + } + + switch (get_highest_layer(layer_state)) { + case 2:{ + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } break; + case 3:{ + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + } + } break; + + case 0:{ + if (L_WIN) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + }else{ + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + } + } + } break; + + case 1:{ + if (L_MAC) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + } + }else{ + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } + } break; + + default:{ + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } + } + return false; +} + + +void board_init(void) { + // JTAG-DP Disabled and SW-DP Disabled + AFIO->MAPR = (AFIO->MAPR & ~AFIO_MAPR_SWJ_CFG_Msk) | AFIO_MAPR_SWJ_CFG_DISABLE; +# ifdef RGB_MATRIX_ENABLE + setPinOutput(SDB); + writePinHigh(SDB); +# endif + setPinOutput(MAC_PIN); + writePinHigh(MAC_PIN); +} + +/* +LED display driver +*/ +#define ClockTime 15 +#define HC595_ST_PIN A6 //74HC595 storage register clock input +#define HC595_SH_PIN A5 //74HC595 shift register clock input +#define HC595_DS A7 // 74HC595 serial data input + +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 select_delay(uint16_t n) { + while (n-- > 0) { + asm volatile("nop" ::: "memory"); + }; +} + +static inline void clockPulse(uint16_t n) { + writePinHigh(HC595_SH_PIN); + writePinHigh(HC595_ST_PIN); + select_delay(n); + writePinLow(HC595_SH_PIN); + writePinLow(HC595_ST_PIN); +} + +void serial_to_parallel(uint8_t data) { // 串口转并口函数 + setPinOutput_writeLow(HC595_DS); + setPinOutput_writeLow(HC595_SH_PIN); + setPinOutput_writeLow(HC595_ST_PIN); + for(uint8_t i = 0; i < 8; i++) { // 循环8次,每次输出一位数据 + HC595_DS = (data & 0x01); // 将最低位写入串口数据输入端 + clockPulse(ClockTime); + data >>= 1; // 将数据右移一位,准备输出下一位数据 + } +} diff --git a/keyboards/skyloong/gk104/q1/readme.md b/keyboards/skyloong/gk104/q1/readme.md new file mode 100644 index 00000000000..a07fa733682 --- /dev/null +++ b/keyboards/skyloong/gk104/q1/readme.md @@ -0,0 +1,33 @@ +# GK980 Q1 Keyboard + +![GK980 Q1](https://i.imgur.com/TYx22dhh.jpg) + +## The PCB features: +* QMK & VIA compatibility +* RGB Matrix backlight +* Use PTIR switches instead of mechanical switches to increase the service life and reliability of switches. + + +The following is the QMK Firmware for the Destop 87% keylayout - designed by Dongguan Jizhi Electronic Technology Co., Ltd + +* Keyboard Maintainer: [JZ-Skyloong](https://github.com/JZ-skyloong) +* Hardware Supported: DestopPCB for Skyloong keylayout 85%, STM32F103C8T6 +* Hardware Availability: http://www.skyloong.com.cn https://skyloong.vip + +Make example for this keyboard (after setting up your build environment): + + make skyloong/gk980/q1:default + +Flashing example for this keyboard: + + make skyloong/gk980/q1:default:flash + +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 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available From 47b1f3871b1273052932a97e2c1853aba7966c4f Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Fri, 2 Feb 2024 14:35:04 +0800 Subject: [PATCH 02/31] gk104_q1_ansi compiled pass. --- .../gk104/q1/ansi/keymaps/default/keymap.c | 164 ++++++++++++++++-- .../gk104/q1/ansi/keymaps/default/rules.mk | 1 - keyboards/skyloong/gk104/q1/config.h | 21 +++ keyboards/skyloong/gk104/q1/led_hc595.c | 104 +++++++++++ keyboards/skyloong/gk104/q1/q1.c | 159 ++++++----------- keyboards/skyloong/gk104/q1/readme.md | 14 +- 6 files changed, 336 insertions(+), 127 deletions(-) delete mode 100644 keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk create mode 100644 keyboards/skyloong/gk104/q1/led_hc595.c diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c index 6d820d1d350..37020ff1e48 100644 --- a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c @@ -2,32 +2,172 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include QMK_KEYBOARD_H +int FN_WIN = 0; +int FN_MAC = 0; +int L_WIN = 0; +int L_MAC = 0; +enum layer_names { + _WIN, + _MAC, + _WIN_INDEX, + _MAC_INDEX +}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_all( - 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_MUTE, KC_SCRL, KC_PAUS, KC_HOME, KC_END, + [_WIN] = LAYOUT_all( + 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_MUTE, KC_DEL, KC_PGUP, KC_PGDN, KC_PSCR, 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_NUM, KC_PSLS, KC_PAST, KC_PMNS, 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_P7, KC_P8, KC_P9, KC_PPLS, 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_P4, KC_P5, KC_P6, 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_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(1), KC_MENU, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_WIN_INDEX), KC_APP, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [1] = LAYOUT_all( - _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_PGUP, KC_PGDN, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, - _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT + [_MAC] = LAYOUT_all( + KC_ESC, KC_F14, KC_F15, C(KC_UP), G(KC_D), G(KC_SPC), LAG(KC_EJCT), KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_DEL, KC_PGUP, KC_PGDN, KC_PSCR, + 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_NUM, KC_PSLS, KC_PAST, KC_PMNS, + 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_P7, KC_P8, KC_P9, KC_PPLS, + 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_P4, KC_P5, KC_P6, + 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_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RCMD, MO(_MAC_INDEX), KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [_WIN_INDEX] = LAYOUT_all( + _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_HOME, KC_END, + _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, _______, _______, _______, KC_RALT, _______, KC_APP, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT + ), + + [_MAC_INDEX] = LAYOUT_all( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_HOME, KC_END, + _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LALT, KC_LGUI, _______, _______, _______, KC_RCMD, _______, KC_RALT, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT + ) }; #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { - [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(RGB_HUD, RGB_HUI), ENCODER_CCW_CW(RGB_SPD, RGB_SPI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, - [1] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(RGB_HUD, RGB_HUI), ENCODER_CCW_CW(RGB_SPD, RGB_SPI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))} + [_WIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, + [_MAC] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, + [_WIN_INDEX] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, + [_MAC_INDEX] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))} }; #endif +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + + switch (get_highest_layer(layer_state)) { + case 2:{ + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } break; + case 3:{ + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + } + } break; + + case 0:{ + if (L_WIN) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + }else{ + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + } + } + } break; + + case 1:{ + if (L_MAC) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + } + }else{ + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } + } break; + + default:{ + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } + } + return true; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { +# ifdef RGB_MATRIX_ENABLE + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + } break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + } break; + } + } + return false; + case RGB_VAI: + rgb_matrix_set_flags(LED_FLAG_ALL); + return true; +# endif + case TO(0): + if (record->event.pressed) { + L_WIN = 1; + set_single_persistent_default_layer(0); // Save default layer 0 to eeprom + } else { + L_WIN = 0; + } + return true; // continue all further processing of this key + + case MO(2): + if (record->event.pressed) { + FN_WIN = 1; + } else { + FN_WIN = 0; + } + return true; // continue all further processing of this key + + case TO(1): + if (record->event.pressed) { + L_MAC = 1; + set_single_persistent_default_layer(1); //Save default layer 1 to eeprom + } else { + L_MAC = 0; + } + return true; // continue all further processing of this key + + case MO(3): + if (record->event.pressed) { + FN_MAC = 1; + } else { + FN_MAC = 0; + } + return true; // continue all further processing of this key + default: + return true; + } +} + diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk deleted file mode 100644 index ee325681483..00000000000 --- a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk +++ /dev/null @@ -1 +0,0 @@ -ENCODER_MAP_ENABLE = yes diff --git a/keyboards/skyloong/gk104/q1/config.h b/keyboards/skyloong/gk104/q1/config.h index 134473ed4fc..8f970378d58 100644 --- a/keyboards/skyloong/gk104/q1/config.h +++ b/keyboards/skyloong/gk104/q1/config.h @@ -21,9 +21,30 @@ # define WIN_MOD_INDEX 23 # define MAC_MOD_INDEX 24 # define WIN_LOCK_INDEX 75 +# define CAPS_LOCK_INDEX 35 # define SCR_LOCK_INDEX 14 # define SDB B5 # define RGB_MATRIX_KEYPRESSES # define RGB_MATRIX_FRAMEBUFFER_EFFECTS #endif // RGB_MATRIX_ENABLE +/* + *LED display driver.74HC595 Serial to parallel control LED field on/off. + * data(default):1-on/0-off + * bit0 --- MAC layer indicator + * bit1 --- Win layer indicator + * bit2 --- CAPS indicator + * bit3 --- NUM indicator + * bit4 --- SCR indicator + * bit7 --- Skyloong LOGO display + */ + + +#define MAC_ON 0b00000001 +#define WIN_ON 0b00000010 +#define CAPS_ON 0b00000100 +#define NUM_ON 0b00001000 +#define SCR_ON 0b00010000 +#define SKYLOONG 0b10000000 + + diff --git a/keyboards/skyloong/gk104/q1/led_hc595.c b/keyboards/skyloong/gk104/q1/led_hc595.c new file mode 100644 index 00000000000..ff701305bdb --- /dev/null +++ b/keyboards/skyloong/gk104/q1/led_hc595.c @@ -0,0 +1,104 @@ +// Copyright 2023 NaturalZh (@NaturalZh) +// SPDX-License-Identifier: GPL-2.0-or-later +#include "quantum.h" + +#ifndef HC595_ST_PIN +# error hc595: no storage register clock pins defined! +#endif + +#ifndef HC595_SH_PIN +# error hc595: no shift register clock pins defined! +#endif + +#ifndef HC595_DS +# error hc595: no serial data input pins defined! +#endif + +/** + * 74HC595 Skyloong LED display Driver + * data(default):1-on/0-off + * bit0 --- MAC layer indicator + * bit1 --- Win layer indicator + * bit2 --- CAPS indicator + * bit3 --- NUM indicator + * bit4 --- SCR indicator + * bit7 --- Skyloong LOGO display + * +**/ +#ifndef ClockTime +# define ClockTime 15 +#endif + +//enable mac layer indicator on LED diaplay +#ifndef MAC_ON +# define MAC_ON 0b00000001 +#endif + +//enable win layer indicator on LED diaplay +#ifndef WIN_ON +# define WIN_ON 0b00000010 +#endif + +//enable caps lock indicator on LED diaplay +#ifndef CAPS_ON +# define CAPS_ON 0b00000100 +#endif + +//enable number lock indicator on LED diaplay +#ifndef NUM_ON +# define NUM_ON 0b00001000 +#endif + +//enable scroll lock indicator on LED diaplay +#ifndef SCR_ON +# define SCR_ON 0b00010000 +#endif + +//Skyloong LOGO display on +#ifndef SKYLOONG +# define SKYLOONG 0b10000000 +#endif + +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 select_delay(uint16_t n) { + while (n-- > 0) { + asm volatile("nop" ::: "memory"); + }; +} + +static inline void clockPulse(uint16_t n) { + writePinHigh(HC595_SH_PIN); + writePinHigh(HC595_ST_PIN); + select_delay(n); + writePinLow(HC595_SH_PIN); + writePinLow(HC595_ST_PIN); +} + +static void s_serial_to_parallel(uint8_t data) { // Serial port to parallel port function + setPinOutput_writeLow(HC595_DS); + setPinOutput_writeLow(HC595_SH_PIN); + setPinOutput_writeLow(HC595_ST_PIN); + for(uint8_t i = 0; i < 8; i++) { + if(data & 0x01){ + writePinHigh(HC595_DS); + }else{ + writePinLow(HC595_DS); + } + clockPulse(ClockTime); + data >>= 1; // Move the data one digit to the right + } +} + diff --git a/keyboards/skyloong/gk104/q1/q1.c b/keyboards/skyloong/gk104/q1/q1.c index b0f47726fde..f488ff3bee3 100644 --- a/keyboards/skyloong/gk104/q1/q1.c +++ b/keyboards/skyloong/gk104/q1/q1.c @@ -1,11 +1,22 @@ -// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// Copyright 2023 NaturalZh (@NaturalZh) // SPDX-License-Identifier: GPL-2.0-or-later #include "quantum.h" -#define MAC_OFF 0x1A //disable mac layer indicator on LED display -#define MAC_ON 0x3B //enable mac layer indicator on LED diaplay - - +/** + * 74HC595 Skyloong LED display Driver + * data(default):1-on/0-off + * bit0 --- MAC layer indicator + * bit1 --- Win layer indicator + * bit2 --- CAPS indicator + * bit3 --- NUM indicator + * bit4 --- SCR indicator + * bit7 --- Skyloong LOGO display + * +**/ +#define HC595_ST_PIN A6 //74HC595 storage register clock input +#define HC595_SH_PIN A5 //74HC595 shift register clock input +#define HC595_DS A7 // 74HC595 serial data input +#include "led_hc595.c" uint8_t IND = 0; //buffer of LED Display #if defined(RGB_MATRIX_ENABLE) /*&& defined(CAPS_LOCK_INDEX)*/ @@ -128,16 +139,14 @@ const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT] = { {1, CS16_SW5, CS17_SW5, CS18_SW5}, {1, CS16_SW6, CS17_SW6, CS18_SW6} }; - #endif - - void suspend_power_down_kb() { # ifdef RGB_MATRIX_ENABLE writePinLow(SDB); # endif writePinLow(MAC_PIN); + s_serial_to_parallel(0); suspend_power_down_user(); } @@ -145,11 +154,13 @@ void suspend_wakeup_init_kb() { # ifdef RGB_MATRIX_ENABLE writePinHigh(SDB); # endif + s_serial_to_parallel(IND); suspend_wakeup_init_user(); } bool shutdown_kb(bool jump_to_bootloader) { writePinLow(SDB); + s_serial_to_parallel(0); return shutdown_user(jump_to_bootloader); } @@ -157,15 +168,18 @@ layer_state_t default_layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case 0: writePinLow(MAC_PIN); - IND =& MAC_OFF; - serial_to_parallel(IND); + //switch to win layer display + IND = IND & (~MAC_ON); + IND = IND | WIN_ON; break; case 1: writePinHigh(MAC_PIN); - IND =|| MAC_ON; - serial_to_parallel(IND); + //switch to mac layer display + IND = IND & (~WIN_ON); + IND = IND | MAC_ON; break; } + s_serial_to_parallel(IND); return state; } @@ -174,63 +188,39 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { return false; } - + //caps lock display if (host_keyboard_led_state().caps_lock) { RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 255, 255, 255); + IND = IND | CAPS_ON; } else { if (!rgb_matrix_get_flags()) { RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 0, 0, 0); } + IND = IND & (~CAPS_ON); + } + //number lock display + if (host_keyboard_led_state().num_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 255, 255, 255); + IND = IND | NUM_ON; + } else { + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 0, 0, 0); + } + IND = IND & (~NUM_ON); + } + //scroll lock display + if (host_keyboard_led_state().scroll_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(SCR_LOCK_INDEX, 255, 255, 255); + IND = IND | SCR_ON; + } else { + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(SCR_LOCK_INDEX, 0, 0, 0); + } + IND = IND & (~SCR_ON); } - switch (get_highest_layer(layer_state)) { - case 2:{ - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - } break; - case 3:{ - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - } - } break; - - case 0:{ - if (L_WIN) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - }else{ - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - } - } - } break; - - case 1:{ - if (L_MAC) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - } - }else{ - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - } - } break; - - default:{ - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - } - } - return false; + s_serial_to_parallel(IND); + return true; } @@ -243,51 +233,6 @@ void board_init(void) { # endif setPinOutput(MAC_PIN); writePinHigh(MAC_PIN); + s_serial_to_parallel(SKYLOONG); } -/* -LED display driver -*/ -#define ClockTime 15 -#define HC595_ST_PIN A6 //74HC595 storage register clock input -#define HC595_SH_PIN A5 //74HC595 shift register clock input -#define HC595_DS A7 // 74HC595 serial data input - -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 select_delay(uint16_t n) { - while (n-- > 0) { - asm volatile("nop" ::: "memory"); - }; -} - -static inline void clockPulse(uint16_t n) { - writePinHigh(HC595_SH_PIN); - writePinHigh(HC595_ST_PIN); - select_delay(n); - writePinLow(HC595_SH_PIN); - writePinLow(HC595_ST_PIN); -} - -void serial_to_parallel(uint8_t data) { // 串口转并口函数 - setPinOutput_writeLow(HC595_DS); - setPinOutput_writeLow(HC595_SH_PIN); - setPinOutput_writeLow(HC595_ST_PIN); - for(uint8_t i = 0; i < 8; i++) { // 循环8次,每次输出一位数据 - HC595_DS = (data & 0x01); // 将最低位写入串口数据输入端 - clockPulse(ClockTime); - data >>= 1; // 将数据右移一位,准备输出下一位数据 - } -} diff --git a/keyboards/skyloong/gk104/q1/readme.md b/keyboards/skyloong/gk104/q1/readme.md index a07fa733682..e4922897f18 100644 --- a/keyboards/skyloong/gk104/q1/readme.md +++ b/keyboards/skyloong/gk104/q1/readme.md @@ -1,26 +1,26 @@ -# GK980 Q1 Keyboard +# GK104 Q1 LED Display Keyboard -![GK980 Q1](https://i.imgur.com/TYx22dhh.jpg) +![GK104 Q1](https://i.imgur.com/TYx22dhh.jpg) ## The PCB features: * QMK & VIA compatibility * RGB Matrix backlight -* Use PTIR switches instead of mechanical switches to increase the service life and reliability of switches. +* Mechanical switches Keyboard with LED display. The following is the QMK Firmware for the Destop 87% keylayout - designed by Dongguan Jizhi Electronic Technology Co., Ltd -* Keyboard Maintainer: [JZ-Skyloong](https://github.com/JZ-skyloong) -* Hardware Supported: DestopPCB for Skyloong keylayout 85%, STM32F103C8T6 +* Keyboard Maintainer: [NaturalZh](https://github.com/NaturalZh) +* Hardware Supported: DestopPCB for Skyloong keylayout 100%, STM32F103C8T6 * Hardware Availability: http://www.skyloong.com.cn https://skyloong.vip Make example for this keyboard (after setting up your build environment): - make skyloong/gk980/q1:default + make skyloong/gk104/q1/ansi:default Flashing example for this keyboard: - make skyloong/gk980/q1:default:flash + make skyloong/gk104/q1/ansi:default:flash 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). From 6209b157eed8769b4e638e8a2f22f67e22dcfdd0 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Thu, 7 Mar 2024 20:52:13 +0800 Subject: [PATCH 03/31] Update skyloong/gk104 q1 ansi keyboard --- keyboards/skyloong/gk104/q1/ansi/info.json | 625 +++++++++--------- .../gk104/q1/ansi/keymaps/default/keymap.c | 154 +---- .../gk104/q1/ansi/keymaps/default/rules.mk | 2 + .../gk104/q1/ansi/keymaps/via/keymap.c | 155 +---- .../gk104/q1/ansi/keymaps/via/rules.mk | 3 +- keyboards/skyloong/gk104/q1/ansi/rules.mk | 1 + keyboards/skyloong/gk104/q1/config.h | 32 +- keyboards/skyloong/gk104/q1/info.json | 10 +- keyboards/skyloong/gk104/q1/led_hc595.c | 62 +- keyboards/skyloong/gk104/q1/q1.c | 353 ++++++---- 10 files changed, 661 insertions(+), 736 deletions(-) create mode 100644 keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk diff --git a/keyboards/skyloong/gk104/q1/ansi/info.json b/keyboards/skyloong/gk104/q1/ansi/info.json index 45dd6cb1fe1..b65102f4cbc 100644 --- a/keyboards/skyloong/gk104/q1/ansi/info.json +++ b/keyboards/skyloong/gk104/q1/ansi/info.json @@ -1,339 +1,360 @@ { - "keyboard_name": "GK980 Q1_ANSI_1.0.0", + "keyboard_name": "GK104 Q1_ANSI_1.0.0", "rgb_matrix": { "layout": [ - {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, - {"matrix": [0, 1], "x": 18.2, "y": 0, "flags": 4}, - {"matrix": [0, 2], "x": 30.3, "y": 0, "flags": 4}, - {"matrix": [0, 3], "x": 52, "y": 0, "flags": 4}, - {"matrix": [0, 4], "x": 42.4, "y": 0, "flags": 4}, - {"matrix": [0, 5], "x": 69.6, "y": 0, "flags": 4}, - {"matrix": [0, 6], "x": 81.7, "y": 0, "flags": 4}, - {"matrix": [0, 7], "x": 93.9, "y": 0, "flags": 4}, - {"matrix": [0, 8], "x": 106, "y": 0, "flags": 4}, - {"matrix": [0, 9], "x": 121.1, "y": 0, "flags": 4}, - {"matrix": [0, 10], "x": 133.2, "y": 0, "flags": 4}, - {"matrix": [5, 3], "x": 145.3, "y": 0, "flags": 4}, - {"matrix": [5, 4], "x": 157.4, "y": 0, "flags": 4}, - {"matrix": [0, 12], "x": 187.7, "y": 0, "flags": 4}, - {"matrix": [0, 13], "x": 199.8, "y": 0, "flags": 4}, - {"matrix": [0, 14], "x": 211.9, "y": 0, "flags": 4}, - {"matrix": [6, 13], "x": 224, "y": 0, "flags": 4}, + {"matrix": [0, 0],"x": 0, "y": 0, "flags": 4}, + {"matrix": [0, 1], "x": 20.6, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 30.9, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 41.2, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 51.5, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 66.9, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 77.2, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 87.5, "y": 0, "flags": 4}, + {"matrix": [6, 7], "x": 97.8, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 113.3, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 123.6, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 133.9, "y": 0, "flags": 4}, + {"matrix": [6, 10], "x": 144.2, "y": 0, "flags": 4}, + {"matrix": [0, 11], "x": 157.1, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 167.4, "y": 0, "flags": 4}, + {"matrix": [6, 12], "x": 177.7, "y": 0, "flags": 4}, - {"matrix": [1, 0], "x": 0, "y": 14.5, "flags": 4}, - {"matrix": [1, 1], "x": 12.1, "y": 14.5, "flags": 4}, - {"matrix": [1, 2], "x": 24.2, "y": 14.5, "flags": 4}, - {"matrix": [1, 3], "x": 36.3, "y": 14.5, "flags": 4}, - {"matrix": [1, 4], "x": 48.4, "y": 14.5, "flags": 4}, - {"matrix": [1, 5], "x": 60.6, "y": 14.5, "flags": 4}, - {"matrix": [1, 6], "x": 72.7, "y": 14.5, "flags": 4}, - {"matrix": [1, 7], "x": 84.8, "y": 14.5, "flags": 8}, - {"matrix": [1, 8], "x": 96.9, "y": 14.5, "flags": 4}, - {"matrix": [1, 9], "x": 109, "y": 14.5, "flags": 4}, - {"matrix": [1, 10], "x": 121.1, "y": 14.5, "flags": 4}, - {"matrix": [6, 3], "x": 133.2, "y": 14.5, "flags": 4}, - {"matrix": [6, 4], "x": 145.3, "y": 14.5, "flags": 4}, - {"matrix": [1, 11], "x": 157.4, "y": 14.5, "flags": 4}, - {"matrix": [1, 12], "x": 187.7, "y": 14.5, "flags": 4}, - {"matrix": [1, 13], "x": 199.8, "y": 14.5, "flags": 4}, - {"matrix": [1, 14], "x": 211.9, "y": 14.5, "flags": 4}, - {"matrix": [6, 14], "x": 224, "y": 14.5, "flags": 4}, + {"matrix": [1, 0], "x": 0, "y": 17.5, "flags": 4}, + {"matrix": [1, 1], "x": 10.3, "y": 17.5, "flags": 4}, + {"matrix": [1, 2], "x": 20.6, "y": 17.5, "flags": 4}, + {"matrix": [6, 2], "x": 30.9, "y": 17.5, "flags": 4}, + {"matrix": [1, 3], "x": 41.2, "y": 17.5, "flags": 4}, + {"matrix": [1, 4], "x": 51.5, "y": 17.5, "flags": 4}, + {"matrix": [1, 5], "x": 61.8, "y": 17.5, "flags": 4}, + {"matrix": [1, 6], "x": 72.1, "y": 17.5, "flags": 4}, + {"matrix": [6, 6], "x": 82.4, "y": 17.5, "flags": 4}, + {"matrix": [1, 7], "x": 92.7, "y": 17.5, "flags": 4}, + {"matrix": [1, 8], "x": 103, "y": 17.5, "flags": 4}, + {"matrix": [6, 8], "x": 113.3, "y": 17.5, "flags": 4}, + {"matrix": [1, 9], "x": 123.6, "y": 17.5, "flags": 4}, + {"matrix": [1, 10], "x": 143, "y": 17.5, "flags": 4}, + {"matrix": [1, 11], "x": 157.1, "y": 17.5, "flags": 4}, + {"matrix": [1, 12], "x": 167.4, "y": 17.5, "flags": 4}, + {"matrix": [3, 12], "x": 177.7, "y": 17.5, "flags": 4}, + {"matrix": [1, 13], "x": 193.1, "y": 17.5, "flags": 4}, + {"matrix": [1, 14], "x": 203.4, "y": 17.5, "flags": 4}, + {"matrix": [4, 14], "x": 213.7, "y": 17.5, "flags": 4}, + {"matrix": [1, 15], "x": 224, "y": 17.5, "flags": 4}, - {"matrix": [2, 0], "x": 0, "y": 26.2, "flags": 4}, - {"matrix": [2, 1], "x": 18.2, "y": 26.2, "flags": 4}, - {"matrix": [2, 2], "x": 30.3, "y": 26.2, "flags": 4}, - {"matrix": [2, 3], "x": 42.4, "y": 26.2, "flags": 4}, - {"matrix": [2, 4], "x": 54.5, "y": 26.2, "flags": 4}, - {"matrix": [2, 5], "x": 66.6, "y": 26.2, "flags": 4}, - {"matrix": [2, 6], "x": 78.7, "y": 26.2, "flags": 4}, - {"matrix": [2, 7], "x": 90.8, "y": 26.2, "flags": 4}, - {"matrix": [2, 8], "x": 102.9, "y": 26.2, "flags": 4}, - {"matrix": [2, 9], "x": 115, "y": 26.2, "flags": 4}, - {"matrix": [2, 10], "x": 127.2, "y": 26.2, "flags": 4}, - {"matrix": [6, 5], "x": 139.3, "y": 26.2, "flags": 4}, - {"matrix": [6, 6], "x": 151.4, "y": 26.2, "flags": 4}, - {"matrix": [2, 11], "x": 163.5, "y": 26.2, "flags": 4}, - {"matrix": [2, 12], "x": 187.7, "y": 26.2, "flags": 4}, - {"matrix": [2, 13], "x": 199.8, "y": 26.2, "flags": 4}, - {"matrix": [2, 14], "x": 211.9, "y": 26.2, "flags": 4}, - {"matrix": [6, 11], "x": 224, "y": 32, "flags": 4}, + {"matrix": [2, 0], "x": 3, "y": 29.1, "flags": 4}, + {"matrix": [2, 1], "x": 15.4, "y": 29.1, "flags": 4}, + {"matrix": [2, 2], "x": 25.7, "y": 29.1, "flags": 4}, + {"matrix": [5, 2], "x": 36, "y": 29.1, "flags": 4}, + {"matrix": [2, 3], "x": 46.3, "y": 29.1, "flags": 4}, + {"matrix": [2, 4], "x": 56.6, "y": 29.1, "flags": 4}, + {"matrix": [2, 5], "x": 66.9, "y": 29.1, "flags": 4}, + {"matrix": [2, 6], "x": 77.2, "y": 29.1, "flags": 4}, + {"matrix": [5, 6], "x": 87.5, "y": 29.1, "flags": 4}, + {"matrix": [2, 7], "x": 97.8, "y": 29.1, "flags": 4}, + {"matrix": [2, 8], "x": 108.1, "y": 29.1, "flags": 4}, + {"matrix": [2, 9], "x": 118.4, "y": 29.1, "flags": 4}, + {"matrix": [6, 9], "x": 128.7, "y": 29.1, "flags": 4}, + {"matrix": [2, 10], "x": 142, "y": 29.1, "flags": 4}, + {"matrix": [2, 11], "x": 157.1, "y": 29.1, "flags": 4}, + {"matrix": [3, 11], "x": 167.4, "y": 29.1, "flags": 4}, + {"matrix": [2, 12], "x": 177.7, "y": 29.1, "flags": 4}, + {"matrix": [2, 13], "x": 193.1, "y": 29.1, "flags": 4}, + {"matrix": [2, 14], "x": 203.4, "y": 29.1, "flags": 4}, + {"matrix": [5, 14], "x": 213.7, "y": 29.1, "flags": 4}, + {"matrix": [2, 15], "x": 224, "y": 34, "flags": 4}, - {"matrix": [3, 0], "x": 0, "y": 37.8, "flags": 4}, - {"matrix": [3, 1], "x": 21.2, "y": 37.8, "flags": 4}, - {"matrix": [3, 2], "x": 33.3, "y": 37.8, "flags": 4}, - {"matrix": [3, 3], "x": 45.4, "y": 37.8, "flags": 4}, - {"matrix": [3, 4], "x": 57.5, "y": 37.8, "flags": 4}, - {"matrix": [3, 5], "x": 69.6, "y": 37.8, "flags": 4}, - {"matrix": [3, 6], "x": 81.7, "y": 37.8, "flags": 4}, - {"matrix": [3, 7], "x": 93.9, "y": 37.8, "flags": 4}, - {"matrix": [3, 8], "x": 106, "y": 37.8, "flags": 4}, - {"matrix": [3, 9], "x": 118.1, "y": 37.8, "flags": 4}, - {"matrix": [3, 10], "x": 130.2, "y": 37.8, "flags": 4}, - {"matrix": [6, 7], "x": 142.3, "y": 37.8, "flags": 4}, - {"matrix": [3, 11], "x": 154.4, "y": 37.8, "flags": 4}, - {"matrix": [3, 12], "x": 187.7, "y": 37.8, "flags": 4}, - {"matrix": [3, 13], "x": 199.8, "y": 37.8, "flags": 4}, - {"matrix": [3, 14], "x": 211.9, "y": 37.8, "flags": 4}, + {"matrix": [3, 0], "x": 5, "y": 40.7, "flags": 4}, + {"matrix": [3, 1], "x": 18, "y": 40.7, "flags": 4}, + {"matrix": [3, 2], "x": 28.3, "y": 40.7, "flags": 4}, + {"matrix": [4, 2], "x": 38.6, "y": 40.7, "flags": 4}, + {"matrix": [3, 3], "x": 48.9, "y": 40.7, "flags": 4}, + {"matrix": [3, 4], "x": 59.2, "y": 40.7, "flags": 4}, + {"matrix": [3, 5], "x": 69.5, "y": 40.7, "flags": 4}, + {"matrix": [6, 5], "x": 79.8, "y": 40.7, "flags": 4}, + {"matrix": [3, 6], "x": 90.1, "y": 40.7, "flags": 4}, + {"matrix": [3, 7], "x": 100.4, "y": 40.7, "flags": 4}, + {"matrix": [3, 8], "x": 110.7, "y": 40.7, "flags": 4}, + {"matrix": [3, 9], "x": 121, "y": 40.7, "flags": 4}, + {"matrix": [3, 10], "x": 131.3, "y": 40.7, "flags": 4}, + {"matrix": [3, 13], "x": 193.1, "y": 40.7, "flags": 4}, + {"matrix": [3, 14], "x": 203.4, "y": 40.7, "flags": 4}, + {"matrix": [3, 15], "x": 213.7, "y": 40.7, "flags": 4}, - {"matrix": [4, 0], "x": 0, "y": 49.5, "flags": 4}, - {"matrix": [4, 1], "x": 27.2, "y": 49.5, "flags": 4}, - {"matrix": [4, 2], "x": 39.4, "y": 49.5, "flags": 4}, - {"matrix": [4, 3], "x": 51.5, "y": 49.5, "flags": 4}, - {"matrix": [4, 4], "x": 63.6, "y": 49.5, "flags": 4}, - {"matrix": [4, 5], "x": 75.7, "y": 49.5, "flags": 4}, - {"matrix": [4, 6], "x": 87.8, "y": 49.5, "flags": 4}, - {"matrix": [4, 7], "x": 99.9, "y": 49.5, "flags": 4}, - {"matrix": [4, 8], "x": 112, "y": 49.5, "flags": 4}, - {"matrix": [4, 9], "x": 124.1, "y": 49.5, "flags": 4}, - {"matrix": [4, 10], "x": 136.2, "y": 49.5, "flags": 4}, - {"matrix": [6, 8], "x": 148.3, "y": 49.5, "flags": 4}, - {"matrix": [4, 11], "x": 172.6, "y": 49.5, "flags": 4}, - {"matrix": [4, 12], "x": 187.7, "y": 49.5, "flags": 4}, - {"matrix": [4, 13], "x": 199.8, "y": 49.5, "flags": 4}, - {"matrix": [4, 14], "x": 211.9, "y": 49.5, "flags": 4}, - {"matrix": [6, 12], "x": 224, "y": 55.3, "flags": 4}, + {"matrix": [4, 0], "x": 10, "y": 52.4, "flags": 4}, + {"matrix": [4, 1], "x": 23.2, "y": 52.4, "flags": 4}, + {"matrix": [6, 1], "x": 33.5, "y": 52.4, "flags": 4}, + {"matrix": [4, 3], "x": 43.8, "y": 52.4, "flags": 4}, + {"matrix": [6, 3], "x": 54.1, "y": 52.4, "flags": 4}, + {"matrix": [4, 4], "x": 64.4, "y": 52.4, "flags": 4}, + {"matrix": [6, 4], "x": 74.7, "y": 52.4, "flags": 4}, + {"matrix": [4, 5], "x": 85, "y": 52.4, "flags": 4}, + {"matrix": [4, 6], "x": 95.3, "y": 52.4, "flags": 4}, + {"matrix": [4, 7], "x": 105.6, "y": 52.4, "flags": 4}, + {"matrix": [4, 8], "x": 115.9, "y": 52.4, "flags": 4}, + {"matrix": [4, 10], "x": 136, "y": 52.4, "flags": 4}, + {"matrix": [4, 11], "x": 167.4, "y": 52.4, "flags": 4}, + {"matrix": [4, 13], "x": 193.1, "y": 52.4, "flags": 4}, + {"matrix": [6, 13], "x": 203.4, "y": 52.4, "flags": 4}, + {"matrix": [4, 15], "x": 213.7, "y": 52.4, "flags": 4}, + {"matrix": [6, 15], "x": 224, "y": 57, "flags": 4}, - {"matrix": [5, 0], "x": 0, "y": 61.1, "flags": 4}, - {"matrix": [5, 1], "x": 15.1, "y": 61.1, "flags": 4}, - {"matrix": [6, 1], "x": 30.3, "y": 61.1, "flags": 4}, - {"matrix": [6, 0], "x": 45.4, "y": 61.1, "flags": 4}, - {"matrix": [5, 5], "x": 68.1, "y": 61.1, "flags": 4}, - {"matrix": [5, 6], "x": 90.8, "y": 61.1, "flags": 4}, - {"matrix": [5, 9], "x": 121.1, "y": 61.1, "flags": 4}, - {"matrix": [5, 7], "x": 133.2, "y": 61.1, "flags": 4}, - {"matrix": [5, 10], "x": 145.3, "y": 61.1, "flags": 4}, - {"matrix": [6, 9], "x": 160.5, "y": 64, "flags": 4}, - {"matrix": [5, 11], "x": 172.6, "y": 64, "flags": 4}, - {"matrix": [5, 12], "x": 184.7, "y": 64, "flags": 4}, - {"matrix": [5, 13], "x": 199.8, "y": 61.1, "flags": 4}, - {"matrix": [5, 14], "x": 211.9, "y": 61.1, "flags": 4} + + {"matrix": [5, 0], "x": 0, "y": 64, "flags": 4}, + {"matrix": [6, 0], "x": 12.9, "y": 64, "flags": 4}, + {"matrix": [5, 1], "x": 25.7, "y": 64, "flags": 4}, + {"matrix": [5, 3], "x": 54, "y": 64, "flags": 4}, + {"matrix": [5, 4], "x": 72, "y": 64, "flags": 4}, + {"matrix": [5, 5], "x": 87, "y": 64, "flags": 4}, + {"matrix": [5, 7], "x": 103, "y": 64, "flags": 4}, + {"matrix": [5, 8], "x": 115.9, "y": 64, "flags": 4}, + {"matrix": [5, 9], "x": 128.7, "y": 64, "flags": 4}, + {"matrix": [5, 10], "x": 141.6, "y": 64, "flags": 4}, + {"matrix": [5, 11], "x": 157.1, "y": 64, "flags": 4}, + {"matrix": [6, 11], "x": 167.4, "y": 64, "flags": 4}, + {"matrix": [4, 12], "x": 177.7, "y": 64, "flags": 4}, + {"matrix": [5, 13], "x": 198, "y": 64, "flags": 4}, + {"matrix": [5, 15], "x": 213.7, "y": 64, "flags": 4} ] }, "usb": { "device_version": "1.0.0", - "pid": "0x6098" + "pid": "0x6104" }, "layouts": { "LAYOUT_all": { "layout": [ {"label": "ESC", "matrix": [0, 0], "x": 0, "y": 0}, - {"label": "F1", "matrix": [0, 1], "x": 1.5, "y": 0}, - {"label": "F2", "matrix": [0, 2], "x": 2.5, "y": 0}, - {"label": "F3", "matrix": [0, 3], "x": 3.5, "y": 0}, - {"label": "F4", "matrix": [0, 4], "x": 4.5, "y": 0}, - {"label": "F5", "matrix": [0, 5], "x": 5.75, "y": 0}, - {"label": "F6", "matrix": [0, 6], "x": 6.75, "y": 0}, - {"label": "F7", "matrix": [0, 7], "x": 7.75, "y": 0}, - {"label": "F8", "matrix": [0, 8], "x": 8.75, "y": 0}, - {"label": "F9", "matrix": [0, 9], "x": 10, "y": 0}, - {"label": "F10", "matrix": [0, 10], "x": 11, "y": 0}, - {"label": "F11", "matrix": [5, 3], "x": 12, "y": 0}, - {"label": "F12", "matrix": [5, 4], "x": 13, "y": 0}, - {"label": "Mute", "matrix": [0, 11], "x": 14.25, "y": 0}, - {"label": "PgUp", "matrix": [0, 12], "x": 15.5, "y": 0}, - {"label": "PgDn", "matrix": [0, 13], "x": 16.5, "y": 0}, - {"label": "PB", "matrix": [0, 14], "x": 17.5, "y": 0}, - {"label": "PrtSc", "matrix": [6, 13], "x": 18.5, "y": 0}, + {"label": "F1", "matrix": [0, 1], "x": 2, "y": 0}, + {"label": "F2", "matrix": [0, 2], "x": 3, "y": 0}, + {"label": "F3", "matrix": [0, 3], "x": 4, "y": 0}, + {"label": "F4", "matrix": [0, 4], "x": 5, "y": 0}, + {"label": "F5", "matrix": [0, 5], "x": 6.5, "y": 0}, + {"label": "F6", "matrix": [0, 6], "x": 7.5, "y": 0}, + {"label": "F7", "matrix": [0, 7], "x": 8.5, "y": 0}, + {"label": "F8", "matrix": [6, 7], "x": 9.5, "y": 0}, + {"label": "F9", "matrix": [0, 8], "x": 11, "y": 0}, + {"label": "F10", "matrix": [0, 9], "x": 12, "y": 0}, + {"label": "F11", "matrix": [0, 10], "x": 13, "y": 0}, + {"label": "F12", "matrix": [6, 10], "x": 14, "y": 0}, + {"label": "PrtSc", "matrix": [0, 11], "x": 15.25, "y": 0}, + {"label": "ScrLK", "matrix": [0, 12], "x": 16.25, "y": 0}, + {"label": "Pause", "matrix": [6, 12], "x": 17.25, "y": 0}, + {"label": "En1", "matrix": [0, 14], "x": 20.75, "y": 0}, + {"label": "En2", "matrix": [0, 15], "x": 21.75, "y": 0}, - {"label": "~", "matrix": [1, 0], "x": 0, "y": 1.25}, - {"label": "1", "matrix": [1, 1], "x": 1, "y": 1.25}, - {"label": "2", "matrix": [1, 2], "x": 2, "y": 1.25}, - {"label": "3", "matrix": [1, 3], "x": 3, "y": 1.25}, - {"label": "4", "matrix": [1, 4], "x": 4, "y": 1.25}, - {"label": "5", "matrix": [1, 5], "x": 5, "y": 1.25}, - {"label": "6", "matrix": [1, 6], "x": 6, "y": 1.25}, - {"label": "7", "matrix": [1, 7], "x": 7, "y": 1.25}, - {"label": "8", "matrix": [1, 8], "x": 8, "y": 1.25}, - {"label": "9", "matrix": [1, 9], "x": 9, "y": 1.25}, - {"label": "0", "matrix": [1, 10], "x": 10, "y": 1.25}, - {"label": "-_", "matrix": [6, 3], "x": 11, "y": 1.25}, - {"label": "=+", "matrix": [6, 4], "x": 12, "y": 1.25}, - {"label": "BS", "matrix": [1, 11], "x": 13, "y": 1.25, "w": 2}, - {"label": "NumLk", "matrix": [1, 12], "x": 15.5, "y": 1.25}, - {"label": "P/", "matrix": [1, 13], "x": 16.5, "y": 1.25}, - {"label": "P*", "matrix": [1, 14], "x": 17.5, "y": 1.25}, - {"label": "P-", "matrix": [6, 14], "x": 18.5, "y": 1.25}, + {"label": "~", "matrix": [1, 0], "x": 0, "y": 1.5}, + {"label": "1", "matrix": [1, 1], "x": 1, "y": 1.5}, + {"label": "2", "matrix": [1, 2], "x": 2, "y": 1.5}, + {"label": "3", "matrix": [6, 2], "x": 3, "y": 1.5}, + {"label": "4", "matrix": [1, 3], "x": 4, "y": 1.5}, + {"label": "5", "matrix": [1, 4], "x": 5, "y": 1.5}, + {"label": "6", "matrix": [1, 5], "x": 6, "y": 1.5}, + {"label": "7", "matrix": [1, 6], "x": 7, "y": 1.5}, + {"label": "8", "matrix": [6, 6], "x": 8, "y": 1.5}, + {"label": "9", "matrix": [1, 7], "x": 9, "y": 1.5}, + {"label": "0", "matrix": [1, 8], "x": 10, "y": 1.5}, + {"label": "-_", "matrix": [6, 8], "x": 11, "y": 1.5}, + {"label": "=+", "matrix": [1, 9], "x": 12, "y": 1.5}, + {"label": "BS", "matrix": [1, 10], "x": 13, "y": 1.5, "w": 2}, + {"label": "INS", "matrix": [1, 11], "x": 15.25, "y": 1.5}, + {"label": "HOME", "matrix": [1, 12], "x": 16.25, "y": 1.5}, + {"label": "PgUp", "matrix": [3, 12], "x": 17.25, "y": 1.5}, + {"label": "NumLk", "matrix": [1, 13], "x": 18.75, "y": 1.5}, + {"label": "P/", "matrix": [1, 14], "x": 19.75, "y": 1.5}, + {"label": "P*", "matrix": [4, 14], "x": 20.75, "y": 1.5}, + {"label": "P-", "matrix": [1, 15], "x": 21.75, "y": 1.5}, - {"label": "Tab", "matrix": [2, 0], "x": 0, "y": 2.25, "w": 1.5}, - {"label": "Q", "matrix": [2, 1], "x": 1.5, "y": 2.25}, - {"label": "W", "matrix": [2, 2], "x": 2.5, "y": 2.25}, - {"label": "E", "matrix": [2, 3], "x": 3.5, "y": 2.25}, - {"label": "R", "matrix": [2, 4], "x": 4.5, "y": 2.25}, - {"label": "T", "matrix": [2, 5], "x": 5.5, "y": 2.25}, - {"label": "Y", "matrix": [2, 6], "x": 6.5, "y": 2.25}, - {"label": "U", "matrix": [2, 7], "x": 7.5, "y": 2.25}, - {"label": "I", "matrix": [2, 8], "x": 8.5, "y": 2.25}, - {"label": "O", "matrix": [2, 9], "x": 9.5, "y": 2.25}, - {"label": "P", "matrix": [2, 10], "x": 10.5, "y": 2.25}, - {"label": "[", "matrix": [6, 5], "x": 11.5, "y": 2.25}, - {"label": "]", "matrix": [6, 6], "x": 12.5, "y": 2.25}, - {"label": "|", "matrix": [2, 11], "x": 13.5, "y": 2.25, "w": 1.5}, - {"label": "P7", "matrix": [2, 12], "x": 15.5, "y": 2.25}, - {"label": "P8", "matrix": [2, 13], "x": 16.5, "y": 2.25}, - {"label": "P9", "matrix": [2, 14], "x": 17.5, "y": 2.25}, - {"label": "P+", "matrix": [6, 11], "x": 18.5, "y": 2.25, "h": 2.0}, + {"label": "Tab", "matrix": [2, 0], "x": 0, "y": 2.5, "w": 1.5}, + {"label": "Q", "matrix": [2, 1], "x": 1.5, "y": 2.5}, + {"label": "W", "matrix": [2, 2], "x": 2.5, "y": 2.5}, + {"label": "E", "matrix": [5, 2], "x": 3.5, "y": 2.5}, + {"label": "R", "matrix": [2, 3], "x": 4.5, "y": 2.5}, + {"label": "T", "matrix": [2, 4], "x": 5.5, "y": 2.5}, + {"label": "Y", "matrix": [2, 5], "x": 6.5, "y": 2.5}, + {"label": "U", "matrix": [2, 6], "x": 7.5, "y": 2.5}, + {"label": "I", "matrix": [5, 6], "x": 8.5, "y": 2.5}, + {"label": "O", "matrix": [2, 7], "x": 9.5, "y": 2.5}, + {"label": "P", "matrix": [2, 8], "x": 10.5, "y": 2.5}, + {"label": "[", "matrix": [2, 9], "x": 11.5, "y": 2.5}, + {"label": "]", "matrix": [6, 9], "x": 12.5, "y": 2.5}, + {"label": "|", "matrix": [2, 10], "x": 13.5, "y": 2.5, "w": 1.5}, + {"label": "DEL", "matrix": [2, 11], "x": 15.25, "y": 2.5}, + {"label": "END", "matrix": [3, 11], "x": 16.25, "y": 2.5}, + {"label": "PgDn", "matrix": [2, 12], "x": 17.25, "y": 2.5}, + {"label": "P7", "matrix": [2, 13], "x": 18.75, "y": 2.5}, + {"label": "P8", "matrix": [2, 14], "x": 19.75, "y": 2.5}, + {"label": "P9", "matrix": [5, 14], "x": 20.75, "y": 2.5}, + {"label": "P+", "matrix": [2, 15], "x": 21.75, "y": 2.5, "h": 2.0}, - {"label": "Cap", "matrix": [3, 0], "x": 0, "y": 3.25, "w": 1.75}, - {"label": "A", "matrix": [3, 1], "x": 1.75, "y": 3.25}, - {"label": "S", "matrix": [3, 2], "x": 2.75, "y": 3.25}, - {"label": "D", "matrix": [3, 3], "x": 3.75, "y": 3.25}, - {"label": "F", "matrix": [3, 4], "x": 4.75, "y": 3.25}, - {"label": "G", "matrix": [3, 5], "x": 5.75, "y": 3.25}, - {"label": "H", "matrix": [3, 6], "x": 6.75, "y": 3.25}, - {"label": "J", "matrix": [3, 7], "x": 7.75, "y": 3.25}, - {"label": "K", "matrix": [3, 8], "x": 8.75, "y": 3.25}, - {"label": "L", "matrix": [3, 9], "x": 9.75, "y": 3.25}, - {"label": ";", "matrix": [3, 10], "x": 10.75, "y": 3.25}, - {"label": "'", "matrix": [6, 7], "x": 11.75, "y": 3.25}, - {"label": "Ent", "matrix": [3, 11], "x": 12.75, "y": 3.25, "w": 2.25}, - {"label": "P4", "matrix": [3, 12], "x": 15.5, "y": 3.25}, - {"label": "P5", "matrix": [3, 13], "x": 16.5, "y": 3.25}, - {"label": "P6", "matrix": [3, 14], "x": 17.5, "y": 3.25}, + {"label": "Cap", "matrix": [3, 0], "x": 0, "y": 3.5, "w": 1.75}, + {"label": "A", "matrix": [3, 1], "x": 1.75, "y": 3.5}, + {"label": "S", "matrix": [3, 2], "x": 2.75, "y": 3.5}, + {"label": "D", "matrix": [4, 2], "x": 3.75, "y": 3.5}, + {"label": "F", "matrix": [3, 3], "x": 4.75, "y": 3.5}, + {"label": "G", "matrix": [3, 4], "x": 5.75, "y": 3.5}, + {"label": "H", "matrix": [3, 5], "x": 6.75, "y": 3.5}, + {"label": "J", "matrix": [6, 5], "x": 7.75, "y": 3.5}, + {"label": "K", "matrix": [3, 6], "x": 8.75, "y": 3.5}, + {"label": "L", "matrix": [3, 7], "x": 9.75, "y": 3.5}, + {"label": ";", "matrix": [3, 8], "x": 10.75, "y": 3.5}, + {"label": "'", "matrix": [3, 9], "x": 11.75, "y": 3.5}, + {"label": "Ent", "matrix": [3, 10], "x": 12.75, "y": 3.5, "w": 2.25}, + {"label": "P4", "matrix": [3, 13], "x": 18.75, "y": 3.5}, + {"label": "P5", "matrix": [3, 14], "x": 19.75, "y": 3.5}, + {"label": "P6", "matrix": [3, 15], "x": 20.75, "y": 3.5}, - {"label": "Shift", "matrix": [4, 0], "x": 0, "y": 4.25, "w": 2.25}, - {"label": "Z", "matrix": [4, 1], "x": 2.25, "y": 4.25}, - {"label": "X", "matrix": [4, 2], "x": 3.25, "y": 4.25}, - {"label": "C", "matrix": [4, 3], "x": 4.25, "y": 4.25}, - {"label": "V", "matrix": [4, 4], "x": 5.25, "y": 4.25}, - {"label": "B", "matrix": [4, 5], "x": 6.25, "y": 4.25}, - {"label": "N", "matrix": [4, 6], "x": 7.25, "y": 4.25}, - {"label": "M", "matrix": [4, 7], "x": 8.25, "y": 4.25}, - {"label": ",", "matrix": [4, 8], "x": 9.25, "y": 4.25}, - {"label": ".", "matrix": [4, 9], "x": 10.25, "y": 4.25}, - {"label": "?", "matrix": [4, 10], "x": 11.25, "y": 4.25}, - {"label": "Shift", "matrix": [6, 8], "x": 12.25, "y": 4.25, "w": 1.75}, - {"label": "Up", "matrix": [4, 11], "x": 14.25, "y": 4.5}, - {"label": "P1", "matrix": [4, 12], "x": 15.5, "y": 4.25}, - {"label": "P2", "matrix": [4, 13], "x": 16.5, "y": 4.25}, - {"label": "P3", "matrix": [4, 14], "x": 17.5, "y": 4.25}, - {"label": "PENT", "matrix": [6, 12], "x": 18.5, "y": 4.25, "h": 2.0}, + {"label": "Shift", "matrix": [4, 0], "x": 0, "y": 4.5, "w": 2.25}, + {"label": "Z", "matrix": [4, 1], "x": 2.25, "y": 4.5}, + {"label": "X", "matrix": [6, 1], "x": 3.25, "y": 4.5}, + {"label": "C", "matrix": [4, 3], "x": 4.25, "y": 4.5}, + {"label": "V", "matrix": [6, 3], "x": 5.25, "y": 4.5}, + {"label": "B", "matrix": [4, 4], "x": 6.25, "y": 4.5}, + {"label": "N", "matrix": [6, 4], "x": 7.25, "y": 4.5}, + {"label": "M", "matrix": [4, 5], "x": 8.25, "y": 4.5}, + {"label": ",", "matrix": [4, 6], "x": 9.25, "y": 4.5}, + {"label": ".", "matrix": [4, 7], "x": 10.25, "y": 4.5}, + {"label": "?", "matrix": [4, 8], "x": 11.25, "y": 4.5}, + {"label": "Shift", "matrix": [4, 10], "x": 12.25, "y": 4.5, "w": 2.75}, + {"label": "Up", "matrix": [4, 11], "x": 16.25, "y": 4.5}, + {"label": "P1", "matrix": [4, 13], "x": 18.75, "y": 4.5}, + {"label": "P2", "matrix": [6, 13], "x": 19.75, "y": 4.5}, + {"label": "P3", "matrix": [4, 15], "x": 20.75, "y": 4.5}, + {"label": "PENT", "matrix": [6, 15], "x": 21.75, "y": 4.5, "h": 2.0}, - {"label": "Ctrl", "matrix": [5, 0], "x": 0, "y": 5.25, "w": 1.25}, - {"label": "Com", "matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25}, - {"label": "Alt", "matrix": [6, 1], "x": 2.5, "y": 5.25, "w": 1.25}, - {"label": "SPAC1", "matrix": [6, 0], "x": 3.75, "y": 5.25, "w": 3.125, "h": 0.5}, - {"label": "SPAC", "matrix": [5, 5], "x": 3.75, "y": 5.75, "w": 6.25, "h":0.5}, - {"label": "SPAC2", "matrix": [5, 6], "x": 6.875, "y": 5.25, "w": 3.125, "h":0.5}, - {"label": "Alt", "matrix": [5, 9], "x": 10, "y": 5.25}, - {"label": "Fn", "matrix": [5, 7], "x": 11, "y": 5.25}, - {"label": "Menu", "matrix": [5, 10], "x": 12, "y": 5.25}, - {"label": "Left", "matrix": [6, 9], "x": 13.25, "y": 5.5}, - {"label": "Down", "matrix": [5, 11], "x": 14.25, "y": 5.5}, - {"label": "Right", "matrix": [5, 12], "x": 15.25, "y": 5.5}, - {"label": "P0", "matrix": [5, 13], "x": 16.5, "y": 5.25}, - {"label": "PDOT", "matrix": [5, 14], "x": 17.5, "y": 5.25} + {"label": "Ctrl", "matrix": [5, 0], "x": 0, "y": 5.5, "w": 1.25}, + {"label": "Com", "matrix": [6, 0], "x": 1.25, "y": 5.5, "w": 1.25}, + {"label": "Alt", "matrix": [5, 1], "x": 2.5, "y": 5.5, "w": 1.25}, + {"label": "SPAC1", "matrix": [5, 3], "x": 3.75, "y": 5.5, "w": 3.125, "h": 0.5}, + {"label": "SPAC", "matrix": [5, 4], "x": 3.75, "y": 6, "w": 6.25, "h":0.5}, + {"label": "SPAC2", "matrix": [5, 5], "x": 6.875, "y": 5.5, "w": 3.125, "h":0.5}, + {"label": "Alt", "matrix": [5, 7], "x": 10, "y": 5.5, "w": 1.25}, + {"label": "Fn", "matrix": [5, 8], "x": 11.25, "y": 5.5, "w": 1.25}, + {"label": "Menu", "matrix": [5, 9], "x": 12.5, "y": 5.5, "w": 1.25}, + {"label": "Ctrl", "matrix": [5, 10], "x": 13.75, "y": 5.5, "w": 1.25}, + {"label": "Left", "matrix": [5, 11], "x": 15.25, "y": 5.5}, + {"label": "Down", "matrix": [6, 11], "x": 16.25, "y": 5.5}, + {"label": "Right", "matrix": [4, 12], "x": 17.25, "y": 5.5}, + {"label": "P0", "matrix": [5, 13], "x": 18.75, "y": 5.5, "w": 2}, + {"label": "PDOT", "matrix": [5, 15], "x": 20.75, "y": 5.5} ] }, - "LAYOUT_980_ansi_split_space": { + "LAYOUT_104_ansi_split_space": { "layout": [ {"label": "ESC", "matrix": [0, 0], "x": 0, "y": 0}, - {"label": "F1", "matrix": [0, 1], "x": 1.5, "y": 0}, - {"label": "F2", "matrix": [0, 2], "x": 2.5, "y": 0}, - {"label": "F3", "matrix": [0, 3], "x": 3.5, "y": 0}, - {"label": "F4", "matrix": [0, 4], "x": 4.5, "y": 0}, - {"label": "F5", "matrix": [0, 5], "x": 5.75, "y": 0}, - {"label": "F6", "matrix": [0, 6], "x": 6.75, "y": 0}, - {"label": "F7", "matrix": [0, 7], "x": 7.75, "y": 0}, - {"label": "F8", "matrix": [0, 8], "x": 8.75, "y": 0}, - {"label": "F9", "matrix": [0, 9], "x": 10, "y": 0}, - {"label": "F10", "matrix": [0, 10], "x": 11, "y": 0}, - {"label": "F11", "matrix": [5, 3], "x": 12, "y": 0}, - {"label": "F12", "matrix": [5, 4], "x": 13, "y": 0}, - {"label": "Mute", "matrix": [0, 11], "x": 14.25, "y": 0}, - {"label": "PgUp", "matrix": [0, 12], "x": 15.5, "y": 0}, - {"label": "PgDn", "matrix": [0, 13], "x": 16.5, "y": 0}, - {"label": "PB", "matrix": [0, 14], "x": 17.5, "y": 0}, - {"label": "PrtSc", "matrix": [6, 13], "x": 18.5, "y": 0}, + {"label": "F1", "matrix": [0, 1], "x": 2, "y": 0}, + {"label": "F2", "matrix": [0, 2], "x": 3, "y": 0}, + {"label": "F3", "matrix": [0, 3], "x": 4, "y": 0}, + {"label": "F4", "matrix": [0, 4], "x": 5, "y": 0}, + {"label": "F5", "matrix": [0, 5], "x": 6.5, "y": 0}, + {"label": "F6", "matrix": [0, 6], "x": 7.5, "y": 0}, + {"label": "F7", "matrix": [0, 7], "x": 8.5, "y": 0}, + {"label": "F8", "matrix": [6, 7], "x": 9.5, "y": 0}, + {"label": "F9", "matrix": [0, 8], "x": 11, "y": 0}, + {"label": "F10", "matrix": [0, 9], "x": 12, "y": 0}, + {"label": "F11", "matrix": [0, 10], "x": 13, "y": 0}, + {"label": "F12", "matrix": [6, 10], "x": 14, "y": 0}, + {"label": "PrtSc", "matrix": [0, 11], "x": 15.25, "y": 0}, + {"label": "ScrLK", "matrix": [0, 12], "x": 16.25, "y": 0}, + {"label": "Pause", "matrix": [6, 12], "x": 17.25, "y": 0}, + {"label": "En1", "matrix": [0, 14], "x": 20.75, "y": 0}, + {"label": "En2", "matrix": [0, 15], "x": 21.75, "y": 0}, - {"label": "~", "matrix": [1, 0], "x": 0, "y": 1.25}, - {"label": "1", "matrix": [1, 1], "x": 1, "y": 1.25}, - {"label": "2", "matrix": [1, 2], "x": 2, "y": 1.25}, - {"label": "3", "matrix": [1, 3], "x": 3, "y": 1.25}, - {"label": "4", "matrix": [1, 4], "x": 4, "y": 1.25}, - {"label": "5", "matrix": [1, 5], "x": 5, "y": 1.25}, - {"label": "6", "matrix": [1, 6], "x": 6, "y": 1.25}, - {"label": "7", "matrix": [1, 7], "x": 7, "y": 1.25}, - {"label": "8", "matrix": [1, 8], "x": 8, "y": 1.25}, - {"label": "9", "matrix": [1, 9], "x": 9, "y": 1.25}, - {"label": "0", "matrix": [1, 10], "x": 10, "y": 1.25}, - {"label": "-_", "matrix": [6, 3], "x": 11, "y": 1.25}, - {"label": "=+", "matrix": [6, 4], "x": 12, "y": 1.25}, - {"label": "BS", "matrix": [1, 11], "x": 13, "y": 1.25, "w": 2}, - {"label": "NumLk", "matrix": [1, 12], "x": 15.5, "y": 1.25}, - {"label": "P/", "matrix": [1, 13], "x": 16.5, "y": 1.25}, - {"label": "P*", "matrix": [1, 14], "x": 17.5, "y": 1.25}, - {"label": "P-", "matrix": [6, 14], "x": 18.5, "y": 1.25}, + {"label": "~", "matrix": [1, 0], "x": 0, "y": 1.5}, + {"label": "1", "matrix": [1, 1], "x": 1, "y": 1.5}, + {"label": "2", "matrix": [1, 2], "x": 2, "y": 1.5}, + {"label": "3", "matrix": [6, 2], "x": 3, "y": 1.5}, + {"label": "4", "matrix": [1, 3], "x": 4, "y": 1.5}, + {"label": "5", "matrix": [1, 4], "x": 5, "y": 1.5}, + {"label": "6", "matrix": [1, 5], "x": 6, "y": 1.5}, + {"label": "7", "matrix": [1, 6], "x": 7, "y": 1.5}, + {"label": "8", "matrix": [6, 6], "x": 8, "y": 1.5}, + {"label": "9", "matrix": [1, 7], "x": 9, "y": 1.5}, + {"label": "0", "matrix": [1, 8], "x": 10, "y": 1.5}, + {"label": "-_", "matrix": [6, 8], "x": 11, "y": 1.5}, + {"label": "=+", "matrix": [1, 9], "x": 12, "y": 1.5}, + {"label": "BS", "matrix": [1, 10], "x": 13, "y": 1.5, "w": 2}, + {"label": "INS", "matrix": [1, 11], "x": 15.25, "y": 1.5}, + {"label": "HOME", "matrix": [1, 12], "x": 16.25, "y": 1.5}, + {"label": "PgUp", "matrix": [3, 12], "x": 17.25, "y": 1.5}, + {"label": "NumLk", "matrix": [1, 13], "x": 18.75, "y": 1.5}, + {"label": "P/", "matrix": [1, 14], "x": 19.75, "y": 1.5}, + {"label": "P*", "matrix": [4, 14], "x": 20.75, "y": 1.5}, + {"label": "P-", "matrix": [1, 15], "x": 21.75, "y": 1.5}, - {"label": "Tab", "matrix": [2, 0], "x": 0, "y": 2.25, "w": 1.5}, - {"label": "Q", "matrix": [2, 1], "x": 1.5, "y": 2.25}, - {"label": "W", "matrix": [2, 2], "x": 2.5, "y": 2.25}, - {"label": "E", "matrix": [2, 3], "x": 3.5, "y": 2.25}, - {"label": "R", "matrix": [2, 4], "x": 4.5, "y": 2.25}, - {"label": "T", "matrix": [2, 5], "x": 5.5, "y": 2.25}, - {"label": "Y", "matrix": [2, 6], "x": 6.5, "y": 2.25}, - {"label": "U", "matrix": [2, 7], "x": 7.5, "y": 2.25}, - {"label": "I", "matrix": [2, 8], "x": 8.5, "y": 2.25}, - {"label": "O", "matrix": [2, 9], "x": 9.5, "y": 2.25}, - {"label": "P", "matrix": [2, 10], "x": 10.5, "y": 2.25}, - {"label": "[", "matrix": [6, 5], "x": 11.5, "y": 2.25}, - {"label": "]", "matrix": [6, 6], "x": 12.5, "y": 2.25}, - {"label": "|", "matrix": [2, 11], "x": 13.5, "y": 2.25, "w": 1.5}, - {"label": "P7", "matrix": [2, 12], "x": 15.5, "y": 2.25}, - {"label": "P8", "matrix": [2, 13], "x": 16.5, "y": 2.25}, - {"label": "P9", "matrix": [2, 14], "x": 17.5, "y": 2.25}, - {"label": "P+", "matrix": [6, 11], "x": 18.5, "y": 2.25, "h": 2.0}, + {"label": "Tab", "matrix": [2, 0], "x": 0, "y": 2.5, "w": 1.5}, + {"label": "Q", "matrix": [2, 1], "x": 1.5, "y": 2.5}, + {"label": "W", "matrix": [2, 2], "x": 2.5, "y": 2.5}, + {"label": "E", "matrix": [5, 2], "x": 3.5, "y": 2.5}, + {"label": "R", "matrix": [2, 3], "x": 4.5, "y": 2.5}, + {"label": "T", "matrix": [2, 4], "x": 5.5, "y": 2.5}, + {"label": "Y", "matrix": [2, 5], "x": 6.5, "y": 2.5}, + {"label": "U", "matrix": [2, 6], "x": 7.5, "y": 2.5}, + {"label": "I", "matrix": [5, 6], "x": 8.5, "y": 2.5}, + {"label": "O", "matrix": [2, 7], "x": 9.5, "y": 2.5}, + {"label": "P", "matrix": [2, 8], "x": 10.5, "y": 2.5}, + {"label": "[", "matrix": [2, 9], "x": 11.5, "y": 2.5}, + {"label": "]", "matrix": [6, 9], "x": 12.5, "y": 2.5}, + {"label": "|", "matrix": [2, 10], "x": 13.5, "y": 2.5, "w": 1.5}, + {"label": "DEL", "matrix": [2, 11], "x": 15.25, "y": 2.5}, + {"label": "END", "matrix": [3, 11], "x": 16.25, "y": 2.5}, + {"label": "PgDn", "matrix": [2, 12], "x": 17.25, "y": 2.5}, + {"label": "P7", "matrix": [2, 13], "x": 18.75, "y": 2.5}, + {"label": "P8", "matrix": [2, 14], "x": 19.75, "y": 2.5}, + {"label": "P9", "matrix": [5, 14], "x": 20.75, "y": 2.5}, + {"label": "P+", "matrix": [2, 15], "x": 21.75, "y": 2.5, "h": 2.0}, - {"label": "Cap", "matrix": [3, 0], "x": 0, "y": 3.25, "w": 1.75}, - {"label": "A", "matrix": [3, 1], "x": 1.75, "y": 3.25}, - {"label": "S", "matrix": [3, 2], "x": 2.75, "y": 3.25}, - {"label": "D", "matrix": [3, 3], "x": 3.75, "y": 3.25}, - {"label": "F", "matrix": [3, 4], "x": 4.75, "y": 3.25}, - {"label": "G", "matrix": [3, 5], "x": 5.75, "y": 3.25}, - {"label": "H", "matrix": [3, 6], "x": 6.75, "y": 3.25}, - {"label": "J", "matrix": [3, 7], "x": 7.75, "y": 3.25}, - {"label": "K", "matrix": [3, 8], "x": 8.75, "y": 3.25}, - {"label": "L", "matrix": [3, 9], "x": 9.75, "y": 3.25}, - {"label": ";", "matrix": [3, 10], "x": 10.75, "y": 3.25}, - {"label": "'", "matrix": [6, 7], "x": 11.75, "y": 3.25}, - {"label": "Ent", "matrix": [3, 11], "x": 12.75, "y": 3.25, "w": 2.25}, - {"label": "P4", "matrix": [3, 12], "x": 15.5, "y": 3.25}, - {"label": "P5", "matrix": [3, 13], "x": 16.5, "y": 3.25}, - {"label": "P6", "matrix": [3, 14], "x": 17.5, "y": 3.25}, + {"label": "Cap", "matrix": [3, 0], "x": 0, "y": 3.5, "w": 1.75}, + {"label": "A", "matrix": [3, 1], "x": 1.75, "y": 3.5}, + {"label": "S", "matrix": [3, 2], "x": 2.75, "y": 3.5}, + {"label": "D", "matrix": [4, 2], "x": 3.75, "y": 3.5}, + {"label": "F", "matrix": [3, 3], "x": 4.75, "y": 3.5}, + {"label": "G", "matrix": [3, 4], "x": 5.75, "y": 3.5}, + {"label": "H", "matrix": [3, 5], "x": 6.75, "y": 3.5}, + {"label": "J", "matrix": [6, 5], "x": 7.75, "y": 3.5}, + {"label": "K", "matrix": [3, 6], "x": 8.75, "y": 3.5}, + {"label": "L", "matrix": [3, 7], "x": 9.75, "y": 3.5}, + {"label": ";", "matrix": [3, 8], "x": 10.75, "y": 3.5}, + {"label": "'", "matrix": [3, 9], "x": 11.75, "y": 3.5}, + {"label": "Ent", "matrix": [3, 10], "x": 12.75, "y": 3.5, "w": 2.25}, + {"label": "P4", "matrix": [3, 13], "x": 18.75, "y": 3.5}, + {"label": "P5", "matrix": [3, 14], "x": 19.75, "y": 3.5}, + {"label": "P6", "matrix": [3, 15], "x": 20.75, "y": 3.5}, - {"label": "Shift", "matrix": [4, 0], "x": 0, "y": 4.25, "w": 2.25}, - {"label": "Z", "matrix": [4, 1], "x": 2.25, "y": 4.25}, - {"label": "X", "matrix": [4, 2], "x": 3.25, "y": 4.25}, - {"label": "C", "matrix": [4, 3], "x": 4.25, "y": 4.25}, - {"label": "V", "matrix": [4, 4], "x": 5.25, "y": 4.25}, - {"label": "B", "matrix": [4, 5], "x": 6.25, "y": 4.25}, - {"label": "N", "matrix": [4, 6], "x": 7.25, "y": 4.25}, - {"label": "M", "matrix": [4, 7], "x": 8.25, "y": 4.25}, - {"label": ",", "matrix": [4, 8], "x": 9.25, "y": 4.25}, - {"label": ".", "matrix": [4, 9], "x": 10.25, "y": 4.25}, - {"label": "?", "matrix": [4, 10], "x": 11.25, "y": 4.25}, - {"label": "Shift", "matrix": [6, 8], "x": 12.25, "y": 4.25, "w": 1.75}, - {"label": "Up", "matrix": [4, 11], "x": 14.25, "y": 4.5}, - {"label": "P1", "matrix": [4, 12], "x": 15.5, "y": 4.25}, - {"label": "P2", "matrix": [4, 13], "x": 16.5, "y": 4.25}, - {"label": "P3", "matrix": [4, 14], "x": 17.5, "y": 4.25}, - {"label": "PENT", "matrix": [6, 12], "x": 18.5, "y": 4.25, "h": 2.0}, + {"label": "Shift", "matrix": [4, 0], "x": 0, "y": 4.5, "w": 2.25}, + {"label": "Z", "matrix": [4, 1], "x": 2.25, "y": 4.5}, + {"label": "X", "matrix": [6, 1], "x": 3.25, "y": 4.5}, + {"label": "C", "matrix": [4, 3], "x": 4.25, "y": 4.5}, + {"label": "V", "matrix": [6, 3], "x": 5.25, "y": 4.5}, + {"label": "B", "matrix": [4, 4], "x": 6.25, "y": 4.5}, + {"label": "N", "matrix": [6, 4], "x": 7.25, "y": 4.5}, + {"label": "M", "matrix": [4, 5], "x": 8.25, "y": 4.5}, + {"label": ",", "matrix": [4, 6], "x": 9.25, "y": 4.5}, + {"label": ".", "matrix": [4, 7], "x": 10.25, "y": 4.5}, + {"label": "?", "matrix": [4, 8], "x": 11.25, "y": 4.5}, + {"label": "Shift", "matrix": [4, 10], "x": 12.25, "y": 4.5, "w": 2.75}, + {"label": "Up", "matrix": [4, 11], "x": 16.25, "y": 4.5}, + {"label": "P1", "matrix": [4, 13], "x": 18.75, "y": 4.5}, + {"label": "P2", "matrix": [6, 13], "x": 19.75, "y": 4.5}, + {"label": "P3", "matrix": [4, 15], "x": 20.75, "y": 4.5}, + {"label": "PENT", "matrix": [6, 15], "x": 21.75, "y": 4.5, "h": 2.0}, - {"label": "Ctrl", "matrix": [5, 0], "x": 0, "y": 5.25, "w": 1.25}, - {"label": "Com", "matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25}, - {"label": "Alt", "matrix": [6, 1], "x": 2.5, "y": 5.25, "w": 1.25}, - {"label": "SPAC1", "matrix": [6, 0], "x": 3.75, "y": 5.25, "w": 3.125}, - {"label": "SPAC2", "matrix": [5, 6], "x": 6.875, "y": 5.25, "w": 3.125}, - {"label": "Alt", "matrix": [5, 9], "x": 10, "y": 5.25}, - {"label": "Fn", "matrix": [5, 7], "x": 11, "y": 5.25}, - {"label": "Menu", "matrix": [5, 10], "x": 12, "y": 5.25}, - {"label": "Left", "matrix": [6, 9], "x": 13.25, "y": 5.5}, - {"label": "Down", "matrix": [5, 11], "x": 14.25, "y": 5.5}, - {"label": "Right", "matrix": [5, 12], "x": 15.25, "y": 5.5}, - {"label": "P0", "matrix": [5, 13], "x": 16.5, "y": 5.25}, - {"label": "PDOT", "matrix": [5, 14], "x": 17.5, "y": 5.25} + {"label": "Ctrl", "matrix": [5, 0], "x": 0, "y": 5.5, "w": 1.25}, + {"label": "Com", "matrix": [6, 0], "x": 1.25, "y": 5.5, "w": 1.25}, + {"label": "Alt", "matrix": [5, 1], "x": 2.5, "y": 5.5, "w": 1.25}, + {"label": "SPAC1", "matrix": [5, 3], "x": 3.75, "y": 5.5, "w": 3.125}, + {"label": "SPAC2", "matrix": [5, 5], "x": 6.875, "y": 5.5, "w": 3.125}, + {"label": "Alt", "matrix": [5, 7], "x": 10, "y": 5.5, "w": 1.25}, + {"label": "Fn", "matrix": [5, 8], "x": 11.25, "y": 5.5, "w": 1.25}, + {"label": "Menu", "matrix": [5, 9], "x": 12.5, "y": 5.5, "w": 1.25}, + {"label": "Ctrl", "matrix": [5, 10], "x": 13.75, "y": 5.5, "w": 1.25}, + {"label": "Left", "matrix": [5, 11], "x": 15.25, "y": 5.5}, + {"label": "Down", "matrix": [6, 11], "x": 16.25, "y": 5.5}, + {"label": "Right", "matrix": [4, 12], "x": 17.25, "y": 5.5}, + {"label": "P0", "matrix": [5, 13], "x": 18.75, "y": 5.5, "w": 2}, + {"label": "PDOT", "matrix": [5, 15], "x": 20.75, "y": 5.5} ] } diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c index 37020ff1e48..cbf59a9a2c3 100644 --- a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c @@ -1,12 +1,7 @@ -// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// Copyright 2023 NaturalZh (@NaturalZh) // SPDX-License-Identifier: GPL-2.0-or-later #include QMK_KEYBOARD_H -int FN_WIN = 0; -int FN_MAC = 0; -int L_WIN = 0; -int L_MAC = 0; - enum layer_names { _WIN, _MAC, @@ -16,48 +11,54 @@ enum layer_names { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_WIN] = LAYOUT_all( - 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_MUTE, KC_DEL, KC_PGUP, KC_PGDN, KC_PSCR, - 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_NUM, KC_PSLS, KC_PAST, KC_PMNS, - 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_P7, KC_P8, KC_P9, KC_PPLS, - 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_P4, KC_P5, KC_P6, - 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_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_WIN_INDEX), KC_APP, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + 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_SCRL, KC_PAUS, KC_MUTE, RGB_TOG, + 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_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + 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_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + 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_P4, KC_P5, KC_P6, + 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_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_WIN_INDEX), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), [_MAC] = LAYOUT_all( - KC_ESC, KC_F14, KC_F15, C(KC_UP), G(KC_D), G(KC_SPC), LAG(KC_EJCT), KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_DEL, KC_PGUP, KC_PGDN, KC_PSCR, - 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_NUM, KC_PSLS, KC_PAST, KC_PMNS, - 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_P7, KC_P8, KC_P9, KC_PPLS, - 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_P4, KC_P5, KC_P6, - 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_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RCMD, MO(_MAC_INDEX), KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + KC_ESC, KC_F14, KC_F15, C(KC_UP), G(KC_D), G(KC_SPC), LAG(KC_EJCT), KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_SCRL, KC_PAUS, KC_MUTE, RGB_TOG, + 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_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + 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_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + 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_P4, KC_P5, KC_P6, + 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_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RCMD, MO(_MAC_INDEX), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), [_WIN_INDEX] = LAYOUT_all( - _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_HOME, KC_END, - _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LGUI, KC_LALT, _______, _______, _______, KC_RALT, _______, KC_APP, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT + _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_MUTE, RGB_TOG, + _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, _______, _______, _______, KC_RALT, _______, KC_APP, _______, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT ), [_MAC_INDEX] = LAYOUT_all( - _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_HOME, KC_END, - _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LALT, KC_LGUI, _______, _______, _______, KC_RCMD, _______, KC_RALT, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_MUTE, RGB_TOG, + _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LALT, KC_LGUI, _______, _______, _______, KC_RCMD, _______, KC_RALT, _______, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT ) }; #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { - [_WIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, - [_MAC] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, - [_WIN_INDEX] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, - [_MAC_INDEX] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))} + [_WIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL))}, + [_MAC] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL))}, + [_WIN_INDEX] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL))}, + [_MAC_INDEX] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL))} +}; +#endif + +#if defined(DIP_SWITCH_MAP_ENABLE) +const uint16_t PROGMEM dip_switch_map[NUM_DIP_SWITCHES][NUM_DIP_STATES] = { + DIP_SWITCH_OFF_ON(TO(0), TO(1)), }; #endif @@ -77,32 +78,6 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { } } break; - case 0:{ - if (L_WIN) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - }else{ - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - } - } - } break; - - case 1:{ - if (L_MAC) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - } - }else{ - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - } - } break; - default:{ if (!rgb_matrix_get_flags()) { RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); @@ -112,62 +87,3 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { } return true; } - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { -# ifdef RGB_MATRIX_ENABLE - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } break; - default: { - rgb_matrix_set_flags(LED_FLAG_ALL); - } break; - } - } - return false; - case RGB_VAI: - rgb_matrix_set_flags(LED_FLAG_ALL); - return true; -# endif - case TO(0): - if (record->event.pressed) { - L_WIN = 1; - set_single_persistent_default_layer(0); // Save default layer 0 to eeprom - } else { - L_WIN = 0; - } - return true; // continue all further processing of this key - - case MO(2): - if (record->event.pressed) { - FN_WIN = 1; - } else { - FN_WIN = 0; - } - return true; // continue all further processing of this key - - case TO(1): - if (record->event.pressed) { - L_MAC = 1; - set_single_persistent_default_layer(1); //Save default layer 1 to eeprom - } else { - L_MAC = 0; - } - return true; // continue all further processing of this key - - case MO(3): - if (record->event.pressed) { - FN_MAC = 1; - } else { - FN_MAC = 0; - } - return true; // continue all further processing of this key - default: - return true; - } -} - diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk new file mode 100644 index 00000000000..d64aefdfb83 --- /dev/null +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/rules.mk @@ -0,0 +1,2 @@ +ENCODER_MAP_ENABLE = yes +DIP_SWITCH_MAP_ENABLE = yes diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c index 40949bbfdde..ce5958cb9c3 100644 --- a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c @@ -1,12 +1,7 @@ -// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// Copyright 2023 NaturalZh (@NaturalZh) // SPDX-License-Identifier: GPL-2.0-or-later #include QMK_KEYBOARD_H -int FN_WIN = 0; -int FN_MAC = 0; -int L_WIN = 0; -int L_MAC = 0; - enum layer_names { _WIN, _MAC, @@ -16,48 +11,54 @@ enum layer_names { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_WIN] = LAYOUT_all( - 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_MUTE, KC_DEL, KC_PGUP, KC_PGDN, KC_PSCR, - 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_NUM, KC_PSLS, KC_PAST, KC_PMNS, - 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_P7, KC_P8, KC_P9, KC_PPLS, - 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_P4, KC_P5, KC_P6, - 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_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_WIN_INDEX), KC_APP, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + 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_SCRL, KC_PAUS, RGB_TOG, KC_MUTE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + 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_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + 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_P4, KC_P5, KC_P6, + 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_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_WIN_INDEX), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), [_MAC] = LAYOUT_all( - KC_ESC, KC_F14, KC_F15, C(KC_UP), G(KC_D), G(KC_SPC), LAG(KC_EJCT), KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_DEL, KC_PGUP, KC_PGDN, KC_PSCR, - 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_NUM, KC_PSLS, KC_PAST, KC_PMNS, - 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_P7, KC_P8, KC_P9, KC_PPLS, - 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_P4, KC_P5, KC_P6, - 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_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RCMD, MO(_MAC_INDEX), KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + KC_ESC, KC_F14, KC_F15, C(KC_UP), G(KC_D), G(KC_SPC), LAG(KC_EJCT), KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_SCRL, KC_PAUS, RGB_TOG, KC_MUTE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + 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_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + 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_P4, KC_P5, KC_P6, + 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_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RCMD, MO(_MAC_INDEX), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), [_WIN_INDEX] = LAYOUT_all( - _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_HOME, KC_END, - _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LGUI, KC_LALT, _______, _______, _______, KC_RALT, _______, KC_APP, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT + _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), RGB_TOG, KC_MUTE, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, _______, _______, _______, KC_RALT, _______, KC_APP, _______, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT ), [_MAC_INDEX] = LAYOUT_all( - _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_HOME, KC_END, - _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LALT, KC_LGUI, _______, _______, _______, KC_RCMD, _______, KC_RALT, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), RGB_TOG, KC_MUTE, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LALT, KC_LGUI, _______, _______, _______, KC_RCMD, _______, KC_RALT, _______, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT ) }; #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { - [_WIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, - [_MAC] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, - [_WIN_INDEX] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))}, - [_MAC_INDEX] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(G(KC_MINS), G(KC_EQL)), ENCODER_CCW_CW(RGB_SPD, RGB_SPI),ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(C(KC_WH_D), C(KC_WH_U))} + [_WIN] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [_MAC] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [_WIN_INDEX] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [_MAC_INDEX] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(KC_VOLD, KC_VOLU)} +}; +#endif + +#if defined(DIP_SWITCH_MAP_ENABLE) +const uint16_t PROGMEM dip_switch_map[NUM_DIP_SWITCHES][NUM_DIP_STATES] = { + DIP_SWITCH_OFF_ON(TO(0), TO(1)), }; #endif @@ -77,32 +78,6 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { } } break; - case 0:{ - if (L_WIN) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - }else{ - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - } - } - } break; - - case 1:{ - if (L_MAC) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - } - }else{ - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - } - } break; - default:{ if (!rgb_matrix_get_flags()) { RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); @@ -113,63 +88,3 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { return true; } -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { - return false; - } - switch (keycode) { -# ifdef RGB_MATRIX_ENABLE - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } break; - default: { - rgb_matrix_set_flags(LED_FLAG_ALL); - } break; - } - } - return false; - case RGB_VAI: - rgb_matrix_set_flags(LED_FLAG_ALL); - return true; -# endif - case TO(0): - if (record->event.pressed) { - L_WIN = 1; - set_single_persistent_default_layer(0); // Save default layer 0 to eeprom - } else { - L_WIN = 0; - } - return true; // continue all further processing of this key - - case MO(2): - if (record->event.pressed) { - FN_WIN = 1; - } else { - FN_WIN = 0; - } - return true; // continue all further processing of this key - - case TO(1): - if (record->event.pressed) { - L_MAC = 1; - set_single_persistent_default_layer(1); //Save default layer 1 to eeprom - } else { - L_MAC = 0; - } - return true; // continue all further processing of this key - - case MO(3): - if (record->event.pressed) { - FN_MAC = 1; - } else { - FN_MAC = 0; - } - return true; // continue all further processing of this key - default: - return true; - } -} diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk index f1adcab005e..8dfffa9d795 100644 --- a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk @@ -1,2 +1,3 @@ -VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes +DIP_SWITCH_MAP_ENABLE = yes +VIA_ENABLE = yes diff --git a/keyboards/skyloong/gk104/q1/ansi/rules.mk b/keyboards/skyloong/gk104/q1/ansi/rules.mk index 6aebeff05a8..d663cb4a00b 100644 --- a/keyboards/skyloong/gk104/q1/ansi/rules.mk +++ b/keyboards/skyloong/gk104/q1/ansi/rules.mk @@ -1,2 +1,3 @@ CUSTOM_MATRIX = lite SRC += matrix.c + DIP_SWITCH_ENABLE = yes diff --git a/keyboards/skyloong/gk104/q1/config.h b/keyboards/skyloong/gk104/q1/config.h index 8f970378d58..3f40bec097b 100644 --- a/keyboards/skyloong/gk104/q1/config.h +++ b/keyboards/skyloong/gk104/q1/config.h @@ -4,12 +4,13 @@ #pragma once #define MAC_PIN C13 -#define DEBOUNCE 10 #ifdef ENCODER_ENABLE # define ENCODER_MAP_KEY_DELAY 20 #endif +#define DIP_SWITCH_PINS {A4} + #ifdef RGB_MATRIX_ENABLE # define AW20216S_CS_PIN_1 B12 # define AW20216S_CS_PIN_2 B11 @@ -17,34 +18,15 @@ # define AW20216S_EN_PIN_1 B5 # define AW20216S_EN_PIN_2 B5 -# define NUM_LOCK_INDEX 31 -# define WIN_MOD_INDEX 23 -# define MAC_MOD_INDEX 24 -# define WIN_LOCK_INDEX 75 -# define CAPS_LOCK_INDEX 35 +# define NUM_LOCK_INDEX 33 +# define WIN_MOD_INDEX 22 +# define MAC_MOD_INDEX 23 +# define WIN_LOCK_INDEX 93 +# define CAPS_LOCK_INDEX 58 # define SCR_LOCK_INDEX 14 # define SDB B5 # define RGB_MATRIX_KEYPRESSES # define RGB_MATRIX_FRAMEBUFFER_EFFECTS #endif // RGB_MATRIX_ENABLE -/* - *LED display driver.74HC595 Serial to parallel control LED field on/off. - * data(default):1-on/0-off - * bit0 --- MAC layer indicator - * bit1 --- Win layer indicator - * bit2 --- CAPS indicator - * bit3 --- NUM indicator - * bit4 --- SCR indicator - * bit7 --- Skyloong LOGO display - */ - - -#define MAC_ON 0b00000001 -#define WIN_ON 0b00000010 -#define CAPS_ON 0b00000100 -#define NUM_ON 0b00001000 -#define SCR_ON 0b00010000 -#define SKYLOONG 0b10000000 - diff --git a/keyboards/skyloong/gk104/q1/info.json b/keyboards/skyloong/gk104/q1/info.json index 22acc9db18c..3cee867b480 100644 --- a/keyboards/skyloong/gk104/q1/info.json +++ b/keyboards/skyloong/gk104/q1/info.json @@ -2,6 +2,7 @@ "manufacturer": "skyloong", "maintainer": "NaturalZh", "bootloader": "stm32duino", + "debounce": 10, "build": { "debounce_type": "asym_eager_defer_pk" }, @@ -13,10 +14,7 @@ "encoder": { "rotary": [ {"pin_a": "A1", "pin_b": "A0", "resolution": 2}, - {"pin_a": "A3", "pin_b": "A2", "resolution": 2}, - {"pin_a": "A4", "pin_b": "B0", "resolution": 2}, - {"pin_a": "B3", "pin_b": "B1", "resolution": 2}, - {"pin_a": "B10", "pin_b": "B4", "resolution": 2} + {"pin_a": "A3", "pin_b": "A2", "resolution": 2} ] }, "features": { @@ -35,7 +33,7 @@ "caps_lock": "C14" }, "matrix_pins": { - "cols": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null], + "cols": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,null], "rows": ["A8", "A9", "A10", "A15", "B6", "B7","B9"] }, "processor": "STM32F103", @@ -63,7 +61,7 @@ "splash": true, "typing_heatmap": true }, - "driver": "aw20216", + "driver": "aw20216s", "hue_steps": 20, "max_brightness": 200, "sat_steps": 20, diff --git a/keyboards/skyloong/gk104/q1/led_hc595.c b/keyboards/skyloong/gk104/q1/led_hc595.c index ff701305bdb..f2458d2a442 100644 --- a/keyboards/skyloong/gk104/q1/led_hc595.c +++ b/keyboards/skyloong/gk104/q1/led_hc595.c @@ -14,50 +14,26 @@ # error hc595: no serial data input pins defined! #endif -/** - * 74HC595 Skyloong LED display Driver - * data(default):1-on/0-off - * bit0 --- MAC layer indicator - * bit1 --- Win layer indicator - * bit2 --- CAPS indicator - * bit3 --- NUM indicator - * bit4 --- SCR indicator - * bit7 --- Skyloong LOGO display - * -**/ -#ifndef ClockTime -# define ClockTime 15 -#endif +/* + *LED display driver.74HC595 Serial to parallel control LED field on/off. + * data(default):1-on/0-off (left low bit) + * bit0 --- NUM indicator + * bit1 --- CAPS indicator + * bit2 --- SCR indicator + * bit3 --- WinLock indicator + * bit4 --- Skyloong LOGO display + * bit5 --- Win layer indicator + * bit6 --- MAC layer indicator + */ +#define NUM_ON 0b10000000 +#define CAPS_ON 0b01000000 +#define SCR_ON 0b00100000 +#define WINLK_ON 0b00010000 +#define SKYLOONG 0b00001000 +#define WIN_ON 0b00000010 +#define MAC_ON 0b00000100 -//enable mac layer indicator on LED diaplay -#ifndef MAC_ON -# define MAC_ON 0b00000001 -#endif - -//enable win layer indicator on LED diaplay -#ifndef WIN_ON -# define WIN_ON 0b00000010 -#endif - -//enable caps lock indicator on LED diaplay -#ifndef CAPS_ON -# define CAPS_ON 0b00000100 -#endif - -//enable number lock indicator on LED diaplay -#ifndef NUM_ON -# define NUM_ON 0b00001000 -#endif - -//enable scroll lock indicator on LED diaplay -#ifndef SCR_ON -# define SCR_ON 0b00010000 -#endif - -//Skyloong LOGO display on -#ifndef SKYLOONG -# define SKYLOONG 0b10000000 -#endif +# define ClockTime 15 static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { diff --git a/keyboards/skyloong/gk104/q1/q1.c b/keyboards/skyloong/gk104/q1/q1.c index f488ff3bee3..5cd61c40887 100644 --- a/keyboards/skyloong/gk104/q1/q1.c +++ b/keyboards/skyloong/gk104/q1/q1.c @@ -2,23 +2,15 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "quantum.h" -/** - * 74HC595 Skyloong LED display Driver - * data(default):1-on/0-off - * bit0 --- MAC layer indicator - * bit1 --- Win layer indicator - * bit2 --- CAPS indicator - * bit3 --- NUM indicator - * bit4 --- SCR indicator - * bit7 --- Skyloong LOGO display - * -**/ -#define HC595_ST_PIN A6 //74HC595 storage register clock input -#define HC595_SH_PIN A5 //74HC595 shift register clock input -#define HC595_DS A7 // 74HC595 serial data input +#define HC595_ST_PIN B1 //74HC595 storage register clock input +#define HC595_SH_PIN B0 //74HC595 shift register clock input +#define HC595_DS B3 // 74HC595 serial data input #include "led_hc595.c" uint8_t IND = 0; //buffer of LED Display +int FN_ON = 0; +_Bool WIN_LOCK = 0; + #if defined(RGB_MATRIX_ENABLE) /*&& defined(CAPS_LOCK_INDEX)*/ const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT] = { /* Each AW20216 channel is controlled by a register at some offset between 0x00 @@ -30,117 +22,205 @@ const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT] = { * | | G location * | | | B location * | | | | */ - {0, CS1_SW1, CS2_SW1, CS3_SW1}, - {0, CS1_SW3, CS2_SW3, CS3_SW3}, - {0, CS1_SW4, CS2_SW4, CS3_SW4}, - {0, CS1_SW5, CS2_SW5, CS3_SW5}, - {0, CS1_SW6, CS2_SW6, CS3_SW6}, - {0, CS1_SW7, CS2_SW7, CS3_SW7}, - {0, CS1_SW8, CS2_SW8, CS3_SW8}, - {0, CS1_SW9, CS2_SW9, CS3_SW9}, - {0, CS1_SW10, CS2_SW10, CS3_SW10}, - {0, CS1_SW11, CS2_SW11, CS3_SW11}, - {0, CS1_SW12, CS2_SW12, CS3_SW12}, - {0, CS10_SW2, CS11_SW2, CS12_SW2}, - {0, CS10_SW3, CS11_SW3, CS12_SW3}, - //encoder no led - {0, CS10_SW5, CS11_SW5, CS12_SW5}, - {0, CS10_SW6, CS11_SW6, CS12_SW6}, - {0, CS10_SW7, CS11_SW7, CS12_SW7}, - {0, CS10_SW8, CS11_SW8, CS12_SW8}, + {0, SW1_CS1, SW1_CS2, SW1_CS3}, //ESC + {0, SW3_CS1, SW3_CS2, SW3_CS3}, //F1 + {0, SW4_CS1, SW4_CS2, SW4_CS3}, + {0, SW5_CS1, SW5_CS2, SW5_CS3}, //F3 + {0, SW6_CS1, SW6_CS2, SW6_CS3}, + {0, SW7_CS1, SW7_CS2, SW7_CS3}, //F5 + {0, SW8_CS1, SW8_CS2, SW8_CS3}, + {0, SW9_CS1, SW9_CS2, SW9_CS3}, //F7 + {0, SW10_CS1, SW10_CS2, SW10_CS3}, + {0, SW11_CS1, SW11_CS2, SW11_CS3}, //F9 + {0, SW12_CS1, SW12_CS2, SW12_CS3}, //F10 + {0, SW2_CS10, SW2_CS11, SW2_CS12}, + {0, SW3_CS10, SW3_CS11, SW3_CS12}, //F12 + {0, SW4_CS10, SW4_CS11, SW4_CS12}, //PrtSc + {0, SW5_CS10, SW5_CS11, SW5_CS12}, //Scroll + {0, SW6_CS10, SW6_CS11, SW6_CS12}, //Pause + //encoder no led + //encoder no led - {0, CS4_SW1, CS5_SW1, CS6_SW1}, - {0, CS4_SW2, CS5_SW2, CS6_SW2}, - {0, CS4_SW3, CS5_SW3, CS6_SW3}, - {0, CS4_SW4, CS5_SW4, CS6_SW4}, - {0, CS4_SW5, CS5_SW5, CS6_SW5}, - {0, CS4_SW6, CS5_SW6, CS6_SW6}, - {0, CS4_SW7, CS5_SW7, CS6_SW7}, - {0, CS4_SW8, CS5_SW8, CS6_SW8}, - {0, CS4_SW9, CS5_SW9, CS6_SW9}, - {0, CS4_SW10, CS5_SW10, CS6_SW10}, - {0, CS4_SW11, CS5_SW11, CS6_SW11}, - {0, CS4_SW12, CS5_SW12, CS6_SW12}, - {0, CS13_SW2, CS14_SW2, CS15_SW2}, - {0, CS13_SW3, CS14_SW3, CS15_SW3}, - {0, CS13_SW4, CS14_SW4, CS15_SW4}, - {0, CS13_SW5, CS14_SW5, CS15_SW5}, - {0, CS13_SW6, CS14_SW6, CS15_SW6}, - {0, CS13_SW7, CS14_SW7, CS15_SW7}, + {0, SW1_CS4, SW1_CS5, SW1_CS6}, //`~ + {0, SW2_CS4, SW2_CS5, SW2_CS6}, //1 + {0, SW3_CS4, SW3_CS5, SW3_CS6}, //2 + {0, SW4_CS4, SW4_CS5, SW4_CS6}, + {0, SW5_CS4, SW5_CS5, SW5_CS6}, //4 + {0, SW6_CS4, SW6_CS5, SW6_CS6}, + {0, SW7_CS4, SW7_CS5, SW7_CS6}, //6 + {0, SW8_CS4, SW8_CS5, SW8_CS6}, + {0, SW9_CS4, SW9_CS5, SW9_CS6}, //8 + {0, SW10_CS4, SW10_CS5, SW10_CS6}, + {0, SW11_CS4, SW11_CS5, SW11_CS6}, //0 + {0, SW12_CS4, SW12_CS5, SW12_CS6}, //-_ + {0, SW2_CS13, CS14_SW2, CS15_SW2}, //=+ + {0, SW3_CS13, SW3_CS14, SW3_CS15}, //BS + {0, SW4_CS13, SW4_CS14, SW4_CS15}, //INS + {0, SW5_CS13, SW5_CS14, SW5_CS15}, //Home + {0, SW6_CS13, SW6_CS14, SW6_CS15}, //PgUp + {0, SW7_CS13, SW7_CS14, SW7_CS15}, //NumLK + {0, SW8_CS13, SW8_CS14, SW8_CS15}, //P/ + {0, SW9_CS13, SW9_CS14, SW9_CS15}, //P* + {0, SW10_CS13, SW10_CS14, SW10_CS15}, //P- - {0, CS7_SW1, CS8_SW1, CS9_SW1}, - {0, CS7_SW2, CS8_SW2, CS9_SW2}, - {0, CS7_SW3, CS8_SW3, CS9_SW3}, - {0, CS7_SW4, CS8_SW4, CS9_SW4}, - {0, CS7_SW5, CS8_SW5, CS9_SW5}, - {0, CS7_SW6, CS8_SW6, CS9_SW6}, - {0, CS7_SW7, CS8_SW7, CS9_SW7}, - {0, CS7_SW8, CS8_SW8, CS9_SW8}, - {0, CS7_SW9, CS8_SW9, CS9_SW9}, - {0, CS7_SW10, CS8_SW10, CS9_SW10}, - {0, CS7_SW11, CS8_SW11, CS9_SW11}, - {0, CS7_SW12, CS8_SW12, CS9_SW12}, - {0, CS16_SW2, CS17_SW2, CS18_SW2}, - {0, CS16_SW3, CS17_SW3, CS18_SW3}, - {0, CS16_SW4, CS17_SW4, CS18_SW4}, - {0, CS16_SW5, CS17_SW5, CS18_SW5}, - {0, CS16_SW6, CS17_SW6, CS18_SW6}, - {0, CS16_SW7, CS17_SW7, CS18_SW7}, + {0, SW1_CS7, SW1_CS8, SW1_CS9}, //Tab + {0, SW2_CS7, SW2_CS8, SW2_CS9}, //Q + {0, SW3_CS7, SW3_CS8, SW3_CS9}, //W + {0, SW4_CS7, SW4_CS8, SW4_CS9}, //E + {0, SW5_CS7, SW5_CS8, SW5_CS9}, //R + {0, SW6_CS7, SW6_CS8, SW6_CS9}, //T + {0, SW7_CS7, SW7_CS8, SW7_CS9}, //Y + {0, SW8_CS7, SW8_CS8, SW8_CS9}, //U + {0, SW9_CS7, SW9_CS8, SW9_CS9}, //I + {0, SW10_CS7, SW10_CS8, SW10_CS9}, //O + {0, SW11_CS7, SW11_CS8, SW11_CS9}, //P + {0, SW12_CS7, SW12_CS8, SW12_CS9}, //[ + {0, SW2_CS16, SW2_CS17, SW2_CS18}, //] + {0, SW3_CS16, SW3_CS17, SW3_CS18}, //| + {0, SW4_CS16, SW4_CS17, SW4_CS18}, //DEL + {0, SW5_CS16, SW5_CS17, SW5_CS18}, //END + {0, SW6_CS16, SW6_CS17, SW6_CS18}, //PgDn + {0, SW7_CS16, SW7_CS17, SW7_CS18}, //P7 + {0, SW8_CS16, SW8_CS17, SW8_CS18}, //P8 + {0, SW9_CS16, SW9_CS17, SW9_CS18}, //P9 + {0, SW10_CS16, SW10_CS17, SW10_CS18}, //P+ + + {1, SW1_CS1, SW1_CS2, SW1_CS3}, //Cap + {1, SW2_CS1, SW2_CS2, SW2_CS3}, //A + {1, SW3_CS1, SW3_CS2, SW3_CS3}, //S + {1, SW4_CS1, SW4_CS2, SW4_CS3}, //D + {1, SW5_CS1, SW5_CS2, SW5_CS3}, //F + {1, SW6_CS1, SW6_CS2, SW6_CS3}, //G + {1, SW7_CS1, SW7_CS2, SW7_CS3}, //H + {1, SW8_CS1, SW8_CS2, SW8_CS3}, //J + {1, SW9_CS1, SW9_CS2, SW9_CS3}, //K + {1, SW10_CS1, SW10_CS2, SW10_CS3}, //L + {1, SW11_CS1, SW11_CS2, SW11_CS3}, //; + {1, SW12_CS1, SW12_CS2, SW12_CS3}, //. + {1, SW2_CS10, SW2_CS11, SW2_CS12}, //Ent + {1, SW5_CS10, SW5_CS11, SW5_CS12}, //P4 + {1, SW6_CS10, SW6_CS11, SW6_CS12}, //P5 + {1, SW7_CS10, SW7_CS11, SW7_CS12}, //P6 + + {1, SW1_CS4, SW1_CS5, SW1_CS6}, //Shift + {1, SW2_CS4, SW2_CS5, SW2_CS6}, //Z + {1, SW3_CS4, SW3_CS5, SW3_CS6}, //X + {1, SW4_CS4, SW4_CS5, SW4_CS6}, //C + {1, SW5_CS4, SW5_CS5, SW5_CS6}, //V + {1, SW6_CS4, SW6_CS5, SW6_CS6}, //B + {1, SW7_CS4, SW7_CS5, SW7_CS6}, //N + {1, SW8_CS4, SW8_CS5, SW8_CS6}, //M + {1, SW9_CS4, SW9_CS5, SW9_CS6}, //, + {1, SW10_CS4, SW10_CS5, SW10_CS6}, //. + {1, SW11_CS4, SW11_CS5, SW11_CS6}, //? + {1, SW2_CS13, SW2_CS14, SW2_CS15}, //Shift + {1, SW3_CS10, SW3_CS11, SW3_CS12}, //Up + {1, SW5_CS13, SW5_CS14, SW5_CS15}, //P1 + {1, SW6_CS13, SW6_CS14, SW6_CS15}, //P2 + {1, SW7_CS13, SW7_CS14, SW7_CS15}, //P3 + {1, SW7_CS16, SW7_CS17, SW7_CS18}, //PENT - {1, CS1_SW1, CS2_SW1, CS3_SW1}, - {1, CS1_SW2, CS2_SW2, CS3_SW2}, - {1, CS1_SW3, CS2_SW3, CS3_SW3}, - {1, CS1_SW4, CS2_SW4, CS3_SW4}, - {1, CS1_SW5, CS2_SW5, CS3_SW5}, - {1, CS1_SW6, CS2_SW6, CS3_SW6}, - {1, CS1_SW7, CS2_SW7, CS3_SW7}, - {1, CS1_SW8, CS2_SW8, CS3_SW8}, - {1, CS1_SW9, CS2_SW9, CS3_SW9}, - {1, CS1_SW10, CS2_SW10, CS3_SW10}, - {1, CS1_SW11, CS2_SW11, CS3_SW11}, - {1, CS1_SW12, CS2_SW12, CS3_SW12}, - {1, CS10_SW3, CS11_SW3, CS12_SW3}, - {1, CS10_SW4, CS11_SW4, CS12_SW4}, - {1, CS10_SW5, CS11_SW5, CS12_SW5}, - {1, CS10_SW6, CS11_SW6, CS12_SW6}, - - {1, CS4_SW1, CS5_SW1, CS6_SW1}, - {1, CS4_SW2, CS5_SW2, CS6_SW2}, - {1, CS4_SW3, CS5_SW3, CS6_SW3}, - {1, CS4_SW4, CS5_SW4, CS6_SW4}, - {1, CS4_SW5, CS5_SW5, CS6_SW5}, - {1, CS4_SW6, CS5_SW6, CS6_SW6}, - {1, CS4_SW7, CS5_SW7, CS6_SW7}, - {1, CS4_SW8, CS5_SW8, CS6_SW8}, - {1, CS4_SW9, CS5_SW9, CS6_SW9}, - {1, CS4_SW10, CS5_SW10, CS6_SW10}, - {1, CS4_SW11, CS5_SW11, CS6_SW11}, - {1, CS13_SW2, CS14_SW2, CS15_SW2}, - {1, CS13_SW3, CS14_SW3, CS15_SW3}, - {1, CS13_SW4, CS14_SW4, CS15_SW4}, - {1, CS13_SW5, CS14_SW5, CS15_SW5}, - {1, CS13_SW6, CS14_SW6, CS15_SW6}, - {1, CS13_SW7, CS14_SW7, CS15_SW7}, - - - {1, CS7_SW1, CS8_SW1, CS9_SW1}, - {1, CS7_SW2, CS8_SW2, CS9_SW2}, - {1, CS7_SW3, CS8_SW3, CS9_SW3}, - {1, CS7_SW5, CS8_SW5, CS9_SW5}, - {1, CS7_SW6, CS8_SW6, CS9_SW6}, - {1, CS7_SW8, CS8_SW8, CS9_SW8}, - {1, CS7_SW10, CS8_SW10, CS9_SW10}, - {1, CS7_SW11, CS8_SW11, CS9_SW11}, - {1, CS7_SW12, CS8_SW12, CS9_SW12}, - {1, CS16_SW2, CS17_SW2, CS18_SW2}, - {1, CS16_SW3, CS17_SW3, CS18_SW3}, - {1, CS16_SW4, CS17_SW4, CS18_SW4}, - {1, CS16_SW5, CS17_SW5, CS18_SW5}, - {1, CS16_SW6, CS17_SW6, CS18_SW6} + {1, SW1_CS7, SW1_CS8, SW1_CS9}, //Ctrl + {1, SW2_CS7, SW2_CS8, SW2_CS9}, //Com + {1, SW3_CS7, SW3_CS8, SW3_CS9}, //Alt + {1, SW4_CS7, SW4_CS8, SW4_CS9}, //SPAC1 + {1, SW6_CS7, SW6_CS8, SW6_CS9}, //SPAC + {1, SW8_CS7, SW8_CS8, SW8_CS9}, //SPAC2 + {1, SW10_CS7, SW10_CS8, SW10_CS9}, //Alt + {1, SW11_CS7, SW11_CS8, SW11_CS9}, //Fn + {1, SW12_CS7, SW12_CS8, SW12_CS9}, //Menu + {1, SW2_CS16, SW2_CS17, SW2_CS18}, //Ctrl + {1, SW3_CS16, SW3_CS17, SW3_CS18}, //Left + {1, SW3_CS13, SW3_CS14, SW3_CS15}, //Down + {1, SW4_CS16, SW4_CS17, SW4_CS18}, //Right + {1, SW5_CS16, SW5_CS17, SW5_CS18}, //P0 + {1, SW6_CS16, SW6_CS17, SW6_CS18} //PDot }; #endif + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + switch (keycode) { +# ifdef RGB_MATRIX_ENABLE + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + } break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + } break; + } + } + return false; + case RGB_VAI: + rgb_matrix_set_flags(LED_FLAG_ALL); + return true; +# endif + + case MO(1): + if (record->event.pressed) { + FN_ON = 1; + } else { + FN_ON = 0; + } + return true; + + case MO(2): + if (record->event.pressed) { + FN_ON = 1; + } else { + FN_ON = 0; + } + return true; + + case MO(3): + if (record->event.pressed) { + FN_ON = 1; + } else { + FN_ON = 0; + } + return true; + + case KC_LGUI: + if (FN_ON){ + if ( record->event.pressed){ + WIN_LOCK = !WIN_LOCK ; //change win lock state + } + if (!WIN_LOCK) { + IND = IND & (~WINLK_ON); //Close win lock display + s_serial_to_parallel(IND); + return false; //windows key locked do nothing + } + s_serial_to_parallel(IND); + } + if (WIN_LOCK) { + IND = IND | WINLK_ON; //Open win lock display + s_serial_to_parallel(IND); + return false; //windows key locked do nothing + } + return true; // continue all further processing of this key + + case TO(0): + set_single_persistent_default_layer(0); + return true; + + case TO(1): + set_single_persistent_default_layer(1); + return true; + + default: + return true; + } + s_serial_to_parallel(IND); +} + void suspend_power_down_kb() { # ifdef RGB_MATRIX_ENABLE writePinLow(SDB); @@ -161,7 +241,7 @@ void suspend_wakeup_init_kb() { bool shutdown_kb(bool jump_to_bootloader) { writePinLow(SDB); s_serial_to_parallel(0); - return shutdown_user(jump_to_bootloader); + return true; } layer_state_t default_layer_state_set_kb(layer_state_t state) { @@ -188,6 +268,7 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { return false; } + //caps lock display if (host_keyboard_led_state().caps_lock) { RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 255, 255, 255); @@ -219,6 +300,37 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { IND = IND & (~SCR_ON); } + switch (get_highest_layer(layer_state)) { + case 0:{ + if (FN_ON) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + } + } + } break; + + case 1:{ + if (FN_ON) { + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } + } break; + + default:{ + if (!rgb_matrix_get_flags()) { + RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); + RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); + } + } + + return true; + } + s_serial_to_parallel(IND); return true; } @@ -233,6 +345,7 @@ void board_init(void) { # endif setPinOutput(MAC_PIN); writePinHigh(MAC_PIN); - s_serial_to_parallel(SKYLOONG); + s_serial_to_parallel(0xFF); + IND = SKYLOONG; } From 265cc536bd64ae94b74d99710564b3e058bc5286 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Sat, 9 Mar 2024 17:29:29 +0800 Subject: [PATCH 04/31] update GK104 Q1 keyboard encoder setting --- keyboards/skyloong/gk104/q1/config.h | 2 +- keyboards/skyloong/gk104/q1/info.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/config.h b/keyboards/skyloong/gk104/q1/config.h index 3f40bec097b..786f29018db 100644 --- a/keyboards/skyloong/gk104/q1/config.h +++ b/keyboards/skyloong/gk104/q1/config.h @@ -6,7 +6,7 @@ #define MAC_PIN C13 #ifdef ENCODER_ENABLE -# define ENCODER_MAP_KEY_DELAY 20 +# define ENCODER_MAP_KEY_DELAY 10 #endif #define DIP_SWITCH_PINS {A4} diff --git a/keyboards/skyloong/gk104/q1/info.json b/keyboards/skyloong/gk104/q1/info.json index 3cee867b480..42100a61bb0 100644 --- a/keyboards/skyloong/gk104/q1/info.json +++ b/keyboards/skyloong/gk104/q1/info.json @@ -13,8 +13,8 @@ }, "encoder": { "rotary": [ - {"pin_a": "A1", "pin_b": "A0", "resolution": 2}, - {"pin_a": "A3", "pin_b": "A2", "resolution": 2} + {"pin_a": "A1", "pin_b": "A0", "resolution": 4}, + {"pin_a": "A3", "pin_b": "A2", "resolution": 4} ] }, "features": { From 52cff32dcb827ca99c1826b1d8c068b7e384d11f Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:07:55 +0800 Subject: [PATCH 05/31] Update keyboards/skyloong/gk104/q1/ansi/rules.mk OK, Thank you. Co-authored-by: Joel Challis --- keyboards/skyloong/gk104/q1/ansi/rules.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/skyloong/gk104/q1/ansi/rules.mk b/keyboards/skyloong/gk104/q1/ansi/rules.mk index d663cb4a00b..6aebeff05a8 100644 --- a/keyboards/skyloong/gk104/q1/ansi/rules.mk +++ b/keyboards/skyloong/gk104/q1/ansi/rules.mk @@ -1,3 +1,2 @@ CUSTOM_MATRIX = lite SRC += matrix.c - DIP_SWITCH_ENABLE = yes From 27c0890cf80bd31637fd4755fecc287f80ac8d60 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:10:37 +0800 Subject: [PATCH 06/31] Update keyboards/skyloong/gk104/q1/info.json OK, Thank you. Co-authored-by: Joel Challis --- keyboards/skyloong/gk104/q1/info.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/info.json b/keyboards/skyloong/gk104/q1/info.json index 42100a61bb0..055e30308dd 100644 --- a/keyboards/skyloong/gk104/q1/info.json +++ b/keyboards/skyloong/gk104/q1/info.json @@ -13,8 +13,8 @@ }, "encoder": { "rotary": [ - {"pin_a": "A1", "pin_b": "A0", "resolution": 4}, - {"pin_a": "A3", "pin_b": "A2", "resolution": 4} + {"pin_a": "A1", "pin_b": "A0"}, + {"pin_a": "A3", "pin_b": "A2"} ] }, "features": { From bf8b3207a16263f8480706cee7d4fd2e6a0273e5 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:11:10 +0800 Subject: [PATCH 07/31] Update keyboards/skyloong/gk104/q1/config.h OK, I see. Co-authored-by: Joel Challis --- keyboards/skyloong/gk104/q1/config.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/config.h b/keyboards/skyloong/gk104/q1/config.h index 786f29018db..6ba11b90c87 100644 --- a/keyboards/skyloong/gk104/q1/config.h +++ b/keyboards/skyloong/gk104/q1/config.h @@ -15,8 +15,7 @@ # define AW20216S_CS_PIN_1 B12 # define AW20216S_CS_PIN_2 B11 // Hardware enable lines may be connected to the same pin -# define AW20216S_EN_PIN_1 B5 -# define AW20216S_EN_PIN_2 B5 +# define AW20216S_EN_PIN B5 # define NUM_LOCK_INDEX 33 # define WIN_MOD_INDEX 22 From 03e93ea4f1f919c131d945b3bbf43629c03a1c56 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:11:36 +0800 Subject: [PATCH 08/31] Update keyboards/skyloong/gk104/q1/config.h OK, I see. Co-authored-by: Joel Challis --- keyboards/skyloong/gk104/q1/config.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/config.h b/keyboards/skyloong/gk104/q1/config.h index 6ba11b90c87..2e9b0122e95 100644 --- a/keyboards/skyloong/gk104/q1/config.h +++ b/keyboards/skyloong/gk104/q1/config.h @@ -24,8 +24,6 @@ # define CAPS_LOCK_INDEX 58 # define SCR_LOCK_INDEX 14 # define SDB B5 -# define RGB_MATRIX_KEYPRESSES -# define RGB_MATRIX_FRAMEBUFFER_EFFECTS #endif // RGB_MATRIX_ENABLE From 8aa6b64cccac72b50434475191d640669f452923 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:12:03 +0800 Subject: [PATCH 09/31] Update keyboards/skyloong/gk104/q1/info.json OK, Thank you. Co-authored-by: Joel Challis --- keyboards/skyloong/gk104/q1/info.json | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/skyloong/gk104/q1/info.json b/keyboards/skyloong/gk104/q1/info.json index 055e30308dd..fd54e1f9ddc 100644 --- a/keyboards/skyloong/gk104/q1/info.json +++ b/keyboards/skyloong/gk104/q1/info.json @@ -21,6 +21,7 @@ "bootmagic": true, "command": true, "console": false, + "dip_switch": true, "encoder": true, "extrakey": true, "mousekey": true, From 1f6a3e9b36075cd877f8c7bcda940063adbbd591 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:14:04 +0800 Subject: [PATCH 10/31] Update keyboards/skyloong/gk104/q1/matrix.c OK, Thank you. Co-authored-by: Joel Challis --- keyboards/skyloong/gk104/q1/matrix.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/matrix.c b/keyboards/skyloong/gk104/q1/matrix.c index 12e7d6c5dc0..8737c3e6d7c 100644 --- a/keyboards/skyloong/gk104/q1/matrix.c +++ b/keyboards/skyloong/gk104/q1/matrix.c @@ -135,17 +135,7 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[] } void matrix_init_custom(void) { - - // initialize key pins matrix_init_pins(); - - // initialize matrix state: all keys off - memset(matrix, 0, sizeof(matrix)); - memset(raw_matrix, 0, sizeof(raw_matrix)); - - debounce_init(MATRIX_ROWS); - - matrix_init_kb(); } bool matrix_scan_custom(matrix_row_t current_matrix[]) { From 809414da30f07d58ef1c4474df4fa278b9ee3249 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:19:42 +0800 Subject: [PATCH 11/31] Update keyboards/skyloong/gk104/q1/matrix.c OK, I see. Thank you very much. Co-authored-by: Joel Challis --- keyboards/skyloong/gk104/q1/matrix.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/matrix.c b/keyboards/skyloong/gk104/q1/matrix.c index 8737c3e6d7c..81141e7c446 100644 --- a/keyboards/skyloong/gk104/q1/matrix.c +++ b/keyboards/skyloong/gk104/q1/matrix.c @@ -139,18 +139,16 @@ void matrix_init_custom(void) { } bool matrix_scan_custom(matrix_row_t current_matrix[]) { - matrix_row_t curr_matrix[MATRIX_ROWS] = {0}; + matrix_row_t temp_matrix[MATRIX_ROWS] = {0}; // Set col, read rows matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) { - matrix_read_rows_on_col(curr_matrix, current_col, row_shifter); + matrix_read_rows_on_col(temp_matrix, current_col, row_shifter); } - bool changed = memcmp(raw_matrix, curr_matrix, sizeof(curr_matrix)) != 0; - if (changed) memcpy(raw_matrix, curr_matrix, sizeof(curr_matrix)); + bool changed = memcmp(temp_matrix, current_matrix, sizeof(temp_matrix)) != 0; + if (changed) memcpy(temp_matrix, current_matrix, sizeof(temp_matrix)); - changed = debounce(raw_matrix, matrix, MATRIX_ROWS, changed); - matrix_scan_kb(); - return (uint8_t)changed; + return changed; } From 004542d6ad650af9f334c0511f142ad90b1cfd8b Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:21:31 +0800 Subject: [PATCH 12/31] Update keyboards/skyloong/gk104/q1/mcuconf.h Yes, SPI1 didn`t be used. Thank you. Co-authored-by: Joel Challis --- keyboards/skyloong/gk104/q1/mcuconf.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/mcuconf.h b/keyboards/skyloong/gk104/q1/mcuconf.h index af06d34b273..49455f9c3d7 100644 --- a/keyboards/skyloong/gk104/q1/mcuconf.h +++ b/keyboards/skyloong/gk104/q1/mcuconf.h @@ -10,7 +10,3 @@ #undef STM32_SPI_USE_DMA #define STM32_SPI_USE_DMA TRUE -#undef STM32_SPI_USE_SPI1 -#define STM32_SPI_USE_SPI1 TRUE - - From 509fcdc65cb6c2bfed21cec966501cdb8e9b5bb1 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Wed, 13 Mar 2024 09:38:59 +0800 Subject: [PATCH 13/31] update skyloong/gk104/q1 keyboard dip switch define --- keyboards/skyloong/gk104/q1/config.h | 2 -- keyboards/skyloong/gk104/q1/info.json | 3 +++ keyboards/skyloong/gk104/q1/matrix.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/config.h b/keyboards/skyloong/gk104/q1/config.h index 2e9b0122e95..03fca19584b 100644 --- a/keyboards/skyloong/gk104/q1/config.h +++ b/keyboards/skyloong/gk104/q1/config.h @@ -9,8 +9,6 @@ # define ENCODER_MAP_KEY_DELAY 10 #endif -#define DIP_SWITCH_PINS {A4} - #ifdef RGB_MATRIX_ENABLE # define AW20216S_CS_PIN_1 B12 # define AW20216S_CS_PIN_2 B11 diff --git a/keyboards/skyloong/gk104/q1/info.json b/keyboards/skyloong/gk104/q1/info.json index fd54e1f9ddc..47a79b5a557 100644 --- a/keyboards/skyloong/gk104/q1/info.json +++ b/keyboards/skyloong/gk104/q1/info.json @@ -33,6 +33,9 @@ "on_state": 1, "caps_lock": "C14" }, + "dip_switch":{ + "pins":["A4"] + }, "matrix_pins": { "cols": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,null], "rows": ["A8", "A9", "A10", "A15", "B6", "B7","B9"] diff --git a/keyboards/skyloong/gk104/q1/matrix.c b/keyboards/skyloong/gk104/q1/matrix.c index 81141e7c446..5c8c5c6c170 100644 --- a/keyboards/skyloong/gk104/q1/matrix.c +++ b/keyboards/skyloong/gk104/q1/matrix.c @@ -147,8 +147,8 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { matrix_read_rows_on_col(temp_matrix, current_col, row_shifter); } - bool changed = memcmp(temp_matrix, current_matrix, sizeof(temp_matrix)) != 0; - if (changed) memcpy(temp_matrix, current_matrix, sizeof(temp_matrix)); + bool changed = memcmp(raw_matrix, temp_matrix, sizeof(temp_matrix)) != 0; + if (changed) memcpy(raw_matrix, temp_matrix, sizeof(temp_matrix)); return changed; } From ce713759a8eff7722bf0d2d02fb78fc1a4408a2e Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Thu, 14 Mar 2024 16:37:25 +0800 Subject: [PATCH 14/31] Update readme.md --- keyboards/skyloong/gk104/q1/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/readme.md b/keyboards/skyloong/gk104/q1/readme.md index e4922897f18..84ec961fcdc 100644 --- a/keyboards/skyloong/gk104/q1/readme.md +++ b/keyboards/skyloong/gk104/q1/readme.md @@ -1,6 +1,6 @@ -# GK104 Q1 LED Display Keyboard +# GK104 Q1 Digital Indicator Keyboard -![GK104 Q1](https://i.imgur.com/TYx22dhh.jpg) +![GK104 Q1](https://i.imgur.com/EPuSVUAh.jpeg) ## The PCB features: * QMK & VIA compatibility From 8851b89c274356a5d997f5e3cd32006eea9a3171 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Thu, 14 Mar 2024 10:07:11 +0800 Subject: [PATCH 15/31] cancel RGB matrix indicator --- .../skyloong/gk104/q1/ansi/keymaps/via/keymap.c | 4 ++-- keyboards/skyloong/gk104/q1/q1.c | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c index ce5958cb9c3..2745cdae933 100644 --- a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c @@ -61,7 +61,7 @@ const uint16_t PROGMEM dip_switch_map[NUM_DIP_SWITCHES][NUM_DIP_STATES] = { DIP_SWITCH_OFF_ON(TO(0), TO(1)), }; #endif - +/* bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { switch (get_highest_layer(layer_state)) { @@ -87,4 +87,4 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { } return true; } - +*/ diff --git a/keyboards/skyloong/gk104/q1/q1.c b/keyboards/skyloong/gk104/q1/q1.c index 5cd61c40887..20de9b3f486 100644 --- a/keyboards/skyloong/gk104/q1/q1.c +++ b/keyboards/skyloong/gk104/q1/q1.c @@ -271,35 +271,41 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { //caps lock display if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 255, 255, 255); + // RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 255, 255, 255); IND = IND | CAPS_ON; } else { + /* if (!rgb_matrix_get_flags()) { RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 0, 0, 0); } + */ IND = IND & (~CAPS_ON); } //number lock display if (host_keyboard_led_state().num_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 255, 255, 255); + // RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 255, 255, 255); IND = IND | NUM_ON; } else { + /* if (!rgb_matrix_get_flags()) { RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 0, 0, 0); } + */ IND = IND & (~NUM_ON); } //scroll lock display if (host_keyboard_led_state().scroll_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(SCR_LOCK_INDEX, 255, 255, 255); + // RGB_MATRIX_INDICATOR_SET_COLOR(SCR_LOCK_INDEX, 255, 255, 255); IND = IND | SCR_ON; } else { + /* if (!rgb_matrix_get_flags()) { RGB_MATRIX_INDICATOR_SET_COLOR(SCR_LOCK_INDEX, 0, 0, 0); } + */ IND = IND & (~SCR_ON); } - + /* switch (get_highest_layer(layer_state)) { case 0:{ if (FN_ON) { @@ -330,7 +336,7 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { return true; } - + */ s_serial_to_parallel(IND); return true; } From 6b1c2620c05685c358135b01b52e007767599bc9 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:17:07 +0800 Subject: [PATCH 16/31] Update keyboards/skyloong/gk104/q1/led_hc595.c OK, Thank you. Co-authored-by: Drashna Jaelre --- keyboards/skyloong/gk104/q1/led_hc595.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/skyloong/gk104/q1/led_hc595.c b/keyboards/skyloong/gk104/q1/led_hc595.c index f2458d2a442..96721b4df4c 100644 --- a/keyboards/skyloong/gk104/q1/led_hc595.c +++ b/keyboards/skyloong/gk104/q1/led_hc595.c @@ -33,7 +33,7 @@ #define WIN_ON 0b00000010 #define MAC_ON 0b00000100 -# define ClockTime 15 +#define CLOCK_TIME 15 static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { From 7cc5749f0f7861aeb8642d65655f1fad5c477fd7 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:17:42 +0800 Subject: [PATCH 17/31] Update keyboards/skyloong/gk104/q1/led_hc595.c OK, Thank you. Co-authored-by: Drashna Jaelre --- keyboards/skyloong/gk104/q1/led_hc595.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/skyloong/gk104/q1/led_hc595.c b/keyboards/skyloong/gk104/q1/led_hc595.c index 96721b4df4c..a8b16be089a 100644 --- a/keyboards/skyloong/gk104/q1/led_hc595.c +++ b/keyboards/skyloong/gk104/q1/led_hc595.c @@ -73,7 +73,7 @@ static void s_serial_to_parallel(uint8_t data) { // Serial port to parallel port }else{ writePinLow(HC595_DS); } - clockPulse(ClockTime); + clockPulse(CLOCK_TIME); data >>= 1; // Move the data one digit to the right } } From 58ee8f83e5f10a18cd7839f2bc7125426ce89e59 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Fri, 15 Mar 2024 11:43:33 +0800 Subject: [PATCH 18/31] Corrected the definition of the variable in matrix.c . --- keyboards/skyloong/gk104/q1/matrix.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/matrix.c b/keyboards/skyloong/gk104/q1/matrix.c index 5c8c5c6c170..7f1405f49c0 100644 --- a/keyboards/skyloong/gk104/q1/matrix.c +++ b/keyboards/skyloong/gk104/q1/matrix.c @@ -5,8 +5,7 @@ #include "quantum.h" #include "debounce.h" -#define ReadDelayTime 120 -#define ClockTime 15 +#define ClOCK_TIME 15 #define MATRIX_INPUT_PRESSED_STATE 0 #define HC595_ST_PIN A6 @@ -75,7 +74,7 @@ static bool select_col(uint8_t col) { }else{ writePinHigh(HC595_DS_PIN); } - clockPulse(ClockTime); + clockPulse(ClOCK_TIME); } return true; @@ -85,7 +84,7 @@ static void unselect_col(uint8_t col) { uint8_t x = (MATRIX_COLS - col); setPinOutput_writeHigh(HC595_DS_PIN); for (uint8_t y = 0; y < x ; y++) { - clockPulse(ClockTime); + clockPulse(ClOCK_TIME); } } @@ -94,7 +93,7 @@ static void unselect_cols(void) { setPinOutput_writeLow(HC595_ST_PIN); setPinOutput_writeHigh(HC595_DS_PIN); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - clockPulse(ClockTime); + clockPulse(ClOCK_TIME); } } From 498a809b160a72b1079f5cca88db7c857c902c0d Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Fri, 15 Mar 2024 15:45:24 +0800 Subject: [PATCH 19/31] Update skyloong/gk104/q1/readme.md --- keyboards/skyloong/gk104/q1/readme.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/readme.md b/keyboards/skyloong/gk104/q1/readme.md index 84ec961fcdc..dc0414f5952 100644 --- a/keyboards/skyloong/gk104/q1/readme.md +++ b/keyboards/skyloong/gk104/q1/readme.md @@ -1,6 +1,7 @@ # GK104 Q1 Digital Indicator Keyboard -![GK104 Q1](https://i.imgur.com/EPuSVUAh.jpeg) +![GK104 Q1 PCBAS](https://i.imgur.com/EPuSVUAh.jpeg) +![GK104 Q1 keyboard](https://i.imgur.com/fuswwLph.png) ## The PCB features: * QMK & VIA compatibility @@ -8,7 +9,7 @@ * Mechanical switches Keyboard with LED display. -The following is the QMK Firmware for the Destop 87% keylayout - designed by Dongguan Jizhi Electronic Technology Co., Ltd +The following is the QMK Firmware for the Destop 100% keylayout - designed by Dongguan Jizhi Electronic Technology Co., Ltd * Keyboard Maintainer: [NaturalZh](https://github.com/NaturalZh) * Hardware Supported: DestopPCB for Skyloong keylayout 100%, STM32F103C8T6 From c4edd104645bfc25830c144fc1aad45c927c9599 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Sat, 30 Mar 2024 13:21:53 +0800 Subject: [PATCH 20/31] update skyloong/gk104/q1/matrix.c. --- keyboards/skyloong/gk104/q1/matrix.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/matrix.c b/keyboards/skyloong/gk104/q1/matrix.c index 7f1405f49c0..222b56affca 100644 --- a/keyboards/skyloong/gk104/q1/matrix.c +++ b/keyboards/skyloong/gk104/q1/matrix.c @@ -30,27 +30,27 @@ static inline void select_delay(uint16_t n) { static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return (readPin(pin) == MATRIX_INPUT_PRESSED_STATE) ? 0 : 1; + return (gpio_read_pin(pin) == MATRIX_INPUT_PRESSED_STATE) ? 0 : 1; } else { return 1; } @@ -70,9 +70,9 @@ static bool select_col(uint8_t col) { setPinOutput_writeHigh(HC595_DS_PIN); for (uint8_t m = 0; m <= col; m++) { if(m == 0){ - writePinLow(HC595_DS_PIN); + gpio_write_pin_low(HC595_DS_PIN); }else{ - writePinHigh(HC595_DS_PIN); + gpio_write_pin_high(HC595_DS_PIN); } clockPulse(ClOCK_TIME); } From 822dbcd654a18672a1c3613cae9536831831d76b Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Wed, 3 Apr 2024 16:54:33 +0800 Subject: [PATCH 21/31] update skyloong/gk104/q1 --- .../gk104/q1/ansi/{info.json => keyboard.json} | 0 keyboards/skyloong/gk104/q1/matrix.c | 11 ++++++----- 2 files changed, 6 insertions(+), 5 deletions(-) rename keyboards/skyloong/gk104/q1/ansi/{info.json => keyboard.json} (100%) diff --git a/keyboards/skyloong/gk104/q1/ansi/info.json b/keyboards/skyloong/gk104/q1/ansi/keyboard.json similarity index 100% rename from keyboards/skyloong/gk104/q1/ansi/info.json rename to keyboards/skyloong/gk104/q1/ansi/keyboard.json diff --git a/keyboards/skyloong/gk104/q1/matrix.c b/keyboards/skyloong/gk104/q1/matrix.c index 222b56affca..ac28c1c8cb0 100644 --- a/keyboards/skyloong/gk104/q1/matrix.c +++ b/keyboards/skyloong/gk104/q1/matrix.c @@ -2,7 +2,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later //Matrix read rows set col:DIODE_DIRECTION == ROW2COL -#include "quantum.h" +#include +#include "atomic_util.h" #include "debounce.h" #define ClOCK_TIME 15 @@ -57,11 +58,11 @@ static inline uint8_t readMatrixPin(pin_t pin) { } static inline void clockPulse(uint16_t n) { - writePinHigh(HC595_SH_PIN); - writePinHigh(HC595_ST_PIN); + gpio_write_pin_high(HC595_SH_PIN); + gpio_write_pin_high(HC595_ST_PIN); select_delay(n); - writePinLow(HC595_SH_PIN); - writePinLow(HC595_ST_PIN); + gpio_write_pin_low(HC595_SH_PIN); + gpio_write_pin_low(HC595_ST_PIN); } // matrix code From a2337b750966f0232e85403ab66216403ca01e90 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Wed, 3 Apr 2024 17:17:00 +0800 Subject: [PATCH 22/31] update skyloong/gk104/q1/q1.c and config.h --- keyboards/skyloong/gk104/q1/config.h | 1 - keyboards/skyloong/gk104/q1/q1.c | 42 ---------------------------- 2 files changed, 43 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/config.h b/keyboards/skyloong/gk104/q1/config.h index 03fca19584b..b12220ac42d 100644 --- a/keyboards/skyloong/gk104/q1/config.h +++ b/keyboards/skyloong/gk104/q1/config.h @@ -21,7 +21,6 @@ # define WIN_LOCK_INDEX 93 # define CAPS_LOCK_INDEX 58 # define SCR_LOCK_INDEX 14 -# define SDB B5 #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/skyloong/gk104/q1/q1.c b/keyboards/skyloong/gk104/q1/q1.c index 20de9b3f486..06aa50d5773 100644 --- a/keyboards/skyloong/gk104/q1/q1.c +++ b/keyboards/skyloong/gk104/q1/q1.c @@ -222,24 +222,17 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } void suspend_power_down_kb() { -# ifdef RGB_MATRIX_ENABLE - writePinLow(SDB); -# endif writePinLow(MAC_PIN); s_serial_to_parallel(0); suspend_power_down_user(); } void suspend_wakeup_init_kb() { -# ifdef RGB_MATRIX_ENABLE - writePinHigh(SDB); -# endif s_serial_to_parallel(IND); suspend_wakeup_init_user(); } bool shutdown_kb(bool jump_to_bootloader) { - writePinLow(SDB); s_serial_to_parallel(0); return true; } @@ -305,38 +298,7 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { */ IND = IND & (~SCR_ON); } - /* - switch (get_highest_layer(layer_state)) { - case 0:{ - if (FN_ON) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - } - } - } break; - case 1:{ - if (FN_ON) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - } - } break; - - default:{ - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - } - - return true; - } - */ s_serial_to_parallel(IND); return true; } @@ -345,10 +307,6 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { void board_init(void) { // JTAG-DP Disabled and SW-DP Disabled AFIO->MAPR = (AFIO->MAPR & ~AFIO_MAPR_SWJ_CFG_Msk) | AFIO_MAPR_SWJ_CFG_DISABLE; -# ifdef RGB_MATRIX_ENABLE - setPinOutput(SDB); - writePinHigh(SDB); -# endif setPinOutput(MAC_PIN); writePinHigh(MAC_PIN); s_serial_to_parallel(0xFF); From fa8e8ddd5d3b30dca99882a3d08667d0268afecb Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Fri, 17 May 2024 19:33:41 +0800 Subject: [PATCH 23/31] update skyloong/gk104/q1/q1.c --- keyboards/skyloong/gk104/q1/q1.c | 212 +++++++++++++++---------------- 1 file changed, 106 insertions(+), 106 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/q1.c b/keyboards/skyloong/gk104/q1/q1.c index 06aa50d5773..2859d9af2da 100644 --- a/keyboards/skyloong/gk104/q1/q1.c +++ b/keyboards/skyloong/gk104/q1/q1.c @@ -22,120 +22,120 @@ const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT] = { * | | G location * | | | B location * | | | | */ - {0, SW1_CS1, SW1_CS2, SW1_CS3}, //ESC - {0, SW3_CS1, SW3_CS2, SW3_CS3}, //F1 - {0, SW4_CS1, SW4_CS2, SW4_CS3}, - {0, SW5_CS1, SW5_CS2, SW5_CS3}, //F3 - {0, SW6_CS1, SW6_CS2, SW6_CS3}, - {0, SW7_CS1, SW7_CS2, SW7_CS3}, //F5 - {0, SW8_CS1, SW8_CS2, SW8_CS3}, - {0, SW9_CS1, SW9_CS2, SW9_CS3}, //F7 - {0, SW10_CS1, SW10_CS2, SW10_CS3}, - {0, SW11_CS1, SW11_CS2, SW11_CS3}, //F9 - {0, SW12_CS1, SW12_CS2, SW12_CS3}, //F10 - {0, SW2_CS10, SW2_CS11, SW2_CS12}, - {0, SW3_CS10, SW3_CS11, SW3_CS12}, //F12 - {0, SW4_CS10, SW4_CS11, SW4_CS12}, //PrtSc - {0, SW5_CS10, SW5_CS11, SW5_CS12}, //Scroll - {0, SW6_CS10, SW6_CS11, SW6_CS12}, //Pause + {0, CS1_SW1, CS2_SW1, CS3_SW1}, //ESC + {0, CS1_SW3, CS2_SW3, CS3_SW3}, //F1 + {0, CS1_SW4, CS2_SW4, CS3_SW4}, + {0, CS1_SW5, CS2_SW5, CS3_SW5}, //F3 + {0, CS1_SW6, CS2_SW6, CS3_SW6}, + {0, CS1_SW7, CS2_SW7, CS3_SW7}, //F5 + {0, CS1_SW8, CS2_SW8, CS3_SW8}, + {0, CS1_SW9, CS2_SW9, CS3_SW9}, //F7 + {0, CS1_SW10, CS2_SW10, CS3_SW10}, + {0, CS1_SW11, CS2_SW11, CS3_SW11}, //F9 + {0, CS1_SW12, CS2_SW12, CS3_SW12}, //F10 + {0, CS10_SW2, CS11_SW2, CS12_SW2}, + {0, CS10_SW3, CS11_SW3, CS12_SW3}, //F12 + {0, CS10_SW4, CS11_SW4, CS12_SW4}, //PrtSc + {0, CS10_SW5, CS11_SW5, CS12_SW5}, //Scroll + {0, CS10_SW6, CS11_SW6, CS12_SW6}, //Pause //encoder no led //encoder no led - {0, SW1_CS4, SW1_CS5, SW1_CS6}, //`~ - {0, SW2_CS4, SW2_CS5, SW2_CS6}, //1 - {0, SW3_CS4, SW3_CS5, SW3_CS6}, //2 - {0, SW4_CS4, SW4_CS5, SW4_CS6}, - {0, SW5_CS4, SW5_CS5, SW5_CS6}, //4 - {0, SW6_CS4, SW6_CS5, SW6_CS6}, - {0, SW7_CS4, SW7_CS5, SW7_CS6}, //6 - {0, SW8_CS4, SW8_CS5, SW8_CS6}, - {0, SW9_CS4, SW9_CS5, SW9_CS6}, //8 - {0, SW10_CS4, SW10_CS5, SW10_CS6}, - {0, SW11_CS4, SW11_CS5, SW11_CS6}, //0 - {0, SW12_CS4, SW12_CS5, SW12_CS6}, //-_ - {0, SW2_CS13, CS14_SW2, CS15_SW2}, //=+ - {0, SW3_CS13, SW3_CS14, SW3_CS15}, //BS - {0, SW4_CS13, SW4_CS14, SW4_CS15}, //INS - {0, SW5_CS13, SW5_CS14, SW5_CS15}, //Home - {0, SW6_CS13, SW6_CS14, SW6_CS15}, //PgUp - {0, SW7_CS13, SW7_CS14, SW7_CS15}, //NumLK - {0, SW8_CS13, SW8_CS14, SW8_CS15}, //P/ - {0, SW9_CS13, SW9_CS14, SW9_CS15}, //P* - {0, SW10_CS13, SW10_CS14, SW10_CS15}, //P- + {0, CS4_SW1, CS5_SW1, CS6_SW1}, //`~ + {0, CS4_SW2, CS5_SW2, CS6_SW2}, //1 + {0, CS4_SW3, CS5_SW3, CS6_SW3}, //2 + {0, CS4_SW4, CS5_SW4, CS6_SW4}, + {0, CS4_SW5, CS5_SW5, CS6_SW5}, //4 + {0, CS4_SW6, CS5_SW6, CS6_SW6}, + {0, CS4_SW7, CS5_SW7, CS6_SW7}, //6 + {0, CS4_SW8, CS5_SW8, CS6_SW8}, + {0, CS4_SW9, CS5_SW9, CS6_SW9}, //8 + {0, CS4_SW10, CS5_SW10, CS6_SW10}, + {0, CS4_SW11, CS5_SW11, CS6_SW11}, //0 + {0, CS4_SW12, CS5_SW12, CS6_SW12}, //-_ + {0, CS13_SW2, CS14_SW2, CS15_SW2}, //=+ + {0, CS13_SW3, CS14_SW3, CS15_SW3}, //BS + {0, CS13_SW4, CS14_SW4, CS15_SW4}, //INS + {0, CS13_SW5, CS14_SW5, CS15_SW5}, //Home + {0, CS13_SW6, CS14_SW6, CS15_SW6}, //PgUp + {0, CS13_SW7, CS14_SW7, CS15_SW7}, //NumLK + {0, CS13_SW8, CS14_SW8, CS15_SW8}, //P/ + {0, CS13_SW9, CS14_SW9, CS15_SW9}, //P* + {0, CS13_SW10, CS14_SW10, CS15_SW10}, //P- - {0, SW1_CS7, SW1_CS8, SW1_CS9}, //Tab - {0, SW2_CS7, SW2_CS8, SW2_CS9}, //Q - {0, SW3_CS7, SW3_CS8, SW3_CS9}, //W - {0, SW4_CS7, SW4_CS8, SW4_CS9}, //E - {0, SW5_CS7, SW5_CS8, SW5_CS9}, //R - {0, SW6_CS7, SW6_CS8, SW6_CS9}, //T - {0, SW7_CS7, SW7_CS8, SW7_CS9}, //Y - {0, SW8_CS7, SW8_CS8, SW8_CS9}, //U - {0, SW9_CS7, SW9_CS8, SW9_CS9}, //I - {0, SW10_CS7, SW10_CS8, SW10_CS9}, //O - {0, SW11_CS7, SW11_CS8, SW11_CS9}, //P - {0, SW12_CS7, SW12_CS8, SW12_CS9}, //[ - {0, SW2_CS16, SW2_CS17, SW2_CS18}, //] - {0, SW3_CS16, SW3_CS17, SW3_CS18}, //| - {0, SW4_CS16, SW4_CS17, SW4_CS18}, //DEL - {0, SW5_CS16, SW5_CS17, SW5_CS18}, //END - {0, SW6_CS16, SW6_CS17, SW6_CS18}, //PgDn - {0, SW7_CS16, SW7_CS17, SW7_CS18}, //P7 - {0, SW8_CS16, SW8_CS17, SW8_CS18}, //P8 - {0, SW9_CS16, SW9_CS17, SW9_CS18}, //P9 - {0, SW10_CS16, SW10_CS17, SW10_CS18}, //P+ + {0, CS7_SW1, CS8_SW1, CS9_SW1}, //Tab + {0, CS7_SW2, CS8_SW2, CS9_SW2}, //Q + {0, CS7_SW3, CS8_SW3, CS9_SW3}, //W + {0, CS7_SW4, CS8_SW4, CS9_SW4}, //E + {0, CS7_SW5, CS8_SW5, CS9_SW5}, //R + {0, CS7_SW6, CS8_SW6, CS9_SW6}, //T + {0, CS7_SW7, CS8_SW7, CS9_SW7}, //Y + {0, CS7_SW8, CS8_SW8, CS9_SW8}, //U + {0, CS7_SW9, CS8_SW9, CS9_SW9}, //I + {0, CS7_SW10, CS8_SW10, CS9_SW10}, //O + {0, CS7_SW11, CS8_SW11, CS9_SW11}, //P + {0, CS7_SW12, CS8_SW12, CS9_SW12}, //[ + {0, CS16_SW2, CS17_SW2, CS18_SW2}, //] + {0, CS16_SW3, CS17_SW3, CS18_SW3}, //| + {0, CS16_SW4, CS17_SW4, CS18_SW4}, //DEL + {0, CS16_SW5, CS17_SW5, CS18_SW5}, //END + {0, CS16_SW6, CS17_SW6, CS18_SW6}, //PgDn + {0, CS16_SW7, CS17_SW7, CS18_SW7}, //P7 + {0, CS16_SW8, CS17_SW8, CS18_SW8}, //P8 + {0, CS16_SW9, CS17_SW9, CS18_SW9}, //P9 + {0, CS16_SW10, CS17_SW10, CS18_SW10}, //P+ - {1, SW1_CS1, SW1_CS2, SW1_CS3}, //Cap - {1, SW2_CS1, SW2_CS2, SW2_CS3}, //A - {1, SW3_CS1, SW3_CS2, SW3_CS3}, //S - {1, SW4_CS1, SW4_CS2, SW4_CS3}, //D - {1, SW5_CS1, SW5_CS2, SW5_CS3}, //F - {1, SW6_CS1, SW6_CS2, SW6_CS3}, //G - {1, SW7_CS1, SW7_CS2, SW7_CS3}, //H - {1, SW8_CS1, SW8_CS2, SW8_CS3}, //J - {1, SW9_CS1, SW9_CS2, SW9_CS3}, //K - {1, SW10_CS1, SW10_CS2, SW10_CS3}, //L - {1, SW11_CS1, SW11_CS2, SW11_CS3}, //; - {1, SW12_CS1, SW12_CS2, SW12_CS3}, //. - {1, SW2_CS10, SW2_CS11, SW2_CS12}, //Ent - {1, SW5_CS10, SW5_CS11, SW5_CS12}, //P4 - {1, SW6_CS10, SW6_CS11, SW6_CS12}, //P5 - {1, SW7_CS10, SW7_CS11, SW7_CS12}, //P6 + {1, CS1_SW1, CS2_SW1, CS3_SW1}, //Cap + {1, CS1_SW2, CS2_SW2, CS3_SW2}, //A + {1, CS1_SW3, CS2_SW3, CS3_SW3}, //S + {1, CS1_SW4, CS2_SW4, CS3_SW4}, //D + {1, CS1_SW5, CS2_SW5, CS3_SW5}, //F + {1, CS1_SW6, CS2_SW6, CS3_SW6}, //G + {1, CS1_SW7, CS2_SW7, CS3_SW7}, //H + {1, CS1_SW8, CS2_SW8, CS3_SW8}, //J + {1, CS1_SW9, CS2_SW9, CS3_SW9}, //K + {1, CS1_SW10, CS2_SW10, CS3_SW10}, //L + {1, CS1_SW11, CS2_SW11, CS3_SW11}, //; + {1, CS1_SW12, CS2_SW12, CS3_SW12}, //. + {1, CS10_SW2, CS11_SW2, CS12_SW2}, //Ent + {1, CS10_SW5, CS11_SW5, CS12_SW5}, //P4 + {1, CS10_SW6, CS11_SW6, CS12_SW6}, //P5 + {1, CS10_SW7, CS11_SW7, CS12_SW7}, //P6 - {1, SW1_CS4, SW1_CS5, SW1_CS6}, //Shift - {1, SW2_CS4, SW2_CS5, SW2_CS6}, //Z - {1, SW3_CS4, SW3_CS5, SW3_CS6}, //X - {1, SW4_CS4, SW4_CS5, SW4_CS6}, //C - {1, SW5_CS4, SW5_CS5, SW5_CS6}, //V - {1, SW6_CS4, SW6_CS5, SW6_CS6}, //B - {1, SW7_CS4, SW7_CS5, SW7_CS6}, //N - {1, SW8_CS4, SW8_CS5, SW8_CS6}, //M - {1, SW9_CS4, SW9_CS5, SW9_CS6}, //, - {1, SW10_CS4, SW10_CS5, SW10_CS6}, //. - {1, SW11_CS4, SW11_CS5, SW11_CS6}, //? - {1, SW2_CS13, SW2_CS14, SW2_CS15}, //Shift - {1, SW3_CS10, SW3_CS11, SW3_CS12}, //Up - {1, SW5_CS13, SW5_CS14, SW5_CS15}, //P1 - {1, SW6_CS13, SW6_CS14, SW6_CS15}, //P2 - {1, SW7_CS13, SW7_CS14, SW7_CS15}, //P3 - {1, SW7_CS16, SW7_CS17, SW7_CS18}, //PENT + {1, CS4_SW1, CS5_SW1, CS6_SW1}, //Shift + {1, CS4_SW2, CS5_SW2, CS6_SW2}, //Z + {1, CS4_SW3, CS5_SW3, CS6_SW3}, //X + {1, CS4_SW4, CS5_SW4, CS6_SW4}, //C + {1, CS4_SW5, CS5_SW5, CS6_SW5}, //V + {1, CS4_SW6, CS5_SW6, CS6_SW6}, //B + {1, CS4_SW7, CS5_SW7, CS6_SW7}, //N + {1, CS4_SW8, CS5_SW8, CS6_SW8}, //M + {1, CS4_SW9, CS5_SW9, CS6_SW9}, //, + {1, CS4_SW10, CS5_SW10, CS6_SW10}, //. + {1, CS4_SW11, CS5_SW11, CS6_SW11}, //? + {1, CS13_SW2, CS14_SW2, CS15_SW2}, //Shift + {1, CS10_SW3, CS11_SW3, CS12_SW3}, //Up + {1, CS13_SW5, CS14_SW5, CS15_SW5}, //P1 + {1, CS13_SW6, CS14_SW6, CS15_SW6}, //P2 + {1, CS13_SW7, CS14_SW7, CS15_SW7}, //P3 + {1, CS16_SW7, CS17_SW7, CS18_SW7}, //PENT - {1, SW1_CS7, SW1_CS8, SW1_CS9}, //Ctrl - {1, SW2_CS7, SW2_CS8, SW2_CS9}, //Com - {1, SW3_CS7, SW3_CS8, SW3_CS9}, //Alt - {1, SW4_CS7, SW4_CS8, SW4_CS9}, //SPAC1 - {1, SW6_CS7, SW6_CS8, SW6_CS9}, //SPAC - {1, SW8_CS7, SW8_CS8, SW8_CS9}, //SPAC2 - {1, SW10_CS7, SW10_CS8, SW10_CS9}, //Alt - {1, SW11_CS7, SW11_CS8, SW11_CS9}, //Fn - {1, SW12_CS7, SW12_CS8, SW12_CS9}, //Menu - {1, SW2_CS16, SW2_CS17, SW2_CS18}, //Ctrl - {1, SW3_CS16, SW3_CS17, SW3_CS18}, //Left - {1, SW3_CS13, SW3_CS14, SW3_CS15}, //Down - {1, SW4_CS16, SW4_CS17, SW4_CS18}, //Right - {1, SW5_CS16, SW5_CS17, SW5_CS18}, //P0 - {1, SW6_CS16, SW6_CS17, SW6_CS18} //PDot + {1, CS7_SW1, CS8_SW1, CS9_SW1}, //Ctrl + {1, CS7_SW2, CS8_SW2, CS9_SW2}, //Com + {1, CS7_SW3, CS8_SW3, CS9_SW3}, //Alt + {1, CS7_SW4, CS8_SW4, CS9_SW4}, //SPAC1 + {1, CS7_SW6, CS8_SW6, CS9_SW6}, //SPAC + {1, CS7_SW8, CS8_SW8, CS9_SW8}, //SPAC2 + {1, CS7_SW10, CS8_SW10, CS9_SW10}, //Alt + {1, CS7_SW11, CS8_SW11, CS9_SW11}, //Fn + {1, CS7_SW12, CS8_SW12, CS9_SW12}, //Menu + {1, CS16_SW2, CS17_SW2, CS18_SW2}, //Ctrl + {1, CS16_SW3, CS17_SW3, CS18_SW3}, //Left + {1, CS13_SW3, CS14_SW3, CS15_SW3}, //Down + {1, CS16_SW4, CS17_SW4, CS18_SW4}, //Right + {1, CS16_SW5, CS17_SW5, CS18_SW5}, //P0 + {1, CS16_SW6, CS17_SW6, CS18_SW6} //PDot }; #endif From 2c01d314468925f4789c06b99f61520924f8c5f9 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Tue, 16 Jul 2024 19:13:33 +0800 Subject: [PATCH 24/31] update skyloong/gk104/q1 about gpio command --- keyboards/skyloong/gk104/q1/led_hc595.c | 30 ++++++++++++------------- keyboards/skyloong/gk104/q1/matrix.c | 30 ++++++++++++------------- keyboards/skyloong/gk104/q1/q1.c | 10 ++++----- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/led_hc595.c b/keyboards/skyloong/gk104/q1/led_hc595.c index a8b16be089a..27a10d4d147 100644 --- a/keyboards/skyloong/gk104/q1/led_hc595.c +++ b/keyboards/skyloong/gk104/q1/led_hc595.c @@ -35,17 +35,17 @@ #define CLOCK_TIME 15 -static inline void setPinOutput_writeLow(pin_t pin) { +static inline void gpio_set_pin_output_write_low(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } -static inline void setPinOutput_writeHigh(pin_t pin) { +static inline void gpio_set_pin_output_write_high(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } @@ -56,22 +56,22 @@ static inline void select_delay(uint16_t n) { } static inline void clockPulse(uint16_t n) { - writePinHigh(HC595_SH_PIN); - writePinHigh(HC595_ST_PIN); + gpio_write_pin_high(HC595_SH_PIN); + gpio_write_pin_high(HC595_ST_PIN); select_delay(n); - writePinLow(HC595_SH_PIN); - writePinLow(HC595_ST_PIN); + gpio_write_pin_low(HC595_SH_PIN); + gpio_write_pin_low(HC595_ST_PIN); } static void s_serial_to_parallel(uint8_t data) { // Serial port to parallel port function - setPinOutput_writeLow(HC595_DS); - setPinOutput_writeLow(HC595_SH_PIN); - setPinOutput_writeLow(HC595_ST_PIN); + gpio_set_pin_output_write_low(HC595_DS); + gpio_set_pin_output_write_low(HC595_SH_PIN); + gpio_set_pin_output_write_low(HC595_ST_PIN); for(uint8_t i = 0; i < 8; i++) { if(data & 0x01){ - writePinHigh(HC595_DS); + gpio_write_pin_high(HC595_DS); }else{ - writePinLow(HC595_DS); + gpio_write_pin_low(HC595_DS); } clockPulse(CLOCK_TIME); data >>= 1; // Move the data one digit to the right diff --git a/keyboards/skyloong/gk104/q1/matrix.c b/keyboards/skyloong/gk104/q1/matrix.c index ac28c1c8cb0..3f73afbb9f2 100644 --- a/keyboards/skyloong/gk104/q1/matrix.c +++ b/keyboards/skyloong/gk104/q1/matrix.c @@ -29,27 +29,27 @@ static inline void select_delay(uint16_t n) { }; } -static inline void setPinOutput_writeLow(pin_t pin) { +static inline void gpio_set_pin_output_write_low(pin_t pin) { ATOMIC_BLOCK_FORCEON { gpio_set_pin_output(pin); gpio_write_pin_low(pin); } } -static inline void setPinOutput_writeHigh(pin_t pin) { +static inline void gpio_set_pin_output_write_high(pin_t pin) { ATOMIC_BLOCK_FORCEON { gpio_set_pin_output(pin); gpio_write_pin_high(pin); } } -static inline void setPinInputHigh_atomic(pin_t pin) { +static inline void gpio_set_pin_input_high_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { gpio_set_pin_input_high(pin); } } -static inline uint8_t readMatrixPin(pin_t pin) { +static inline uint8_t read_matrix_pin(pin_t pin) { if (pin != NO_PIN) { return (gpio_read_pin(pin) == MATRIX_INPUT_PRESSED_STATE) ? 0 : 1; } else { @@ -57,7 +57,7 @@ static inline uint8_t readMatrixPin(pin_t pin) { } } -static inline void clockPulse(uint16_t n) { +static inline void clock_pulse(uint16_t n) { gpio_write_pin_high(HC595_SH_PIN); gpio_write_pin_high(HC595_ST_PIN); select_delay(n); @@ -68,14 +68,14 @@ static inline void clockPulse(uint16_t n) { // matrix code static bool select_col(uint8_t col) { - setPinOutput_writeHigh(HC595_DS_PIN); + gpio_set_pin_output_write_high(HC595_DS_PIN); for (uint8_t m = 0; m <= col; m++) { if(m == 0){ gpio_write_pin_low(HC595_DS_PIN); }else{ gpio_write_pin_high(HC595_DS_PIN); } - clockPulse(ClOCK_TIME); + clock_pulse(ClOCK_TIME); } return true; @@ -83,18 +83,18 @@ static bool select_col(uint8_t col) { static void unselect_col(uint8_t col) { uint8_t x = (MATRIX_COLS - col); - setPinOutput_writeHigh(HC595_DS_PIN); + gpio_set_pin_output_write_high(HC595_DS_PIN); for (uint8_t y = 0; y < x ; y++) { - clockPulse(ClOCK_TIME); + clock_pulse(ClOCK_TIME); } } static void unselect_cols(void) { - setPinOutput_writeLow(HC595_SH_PIN); - setPinOutput_writeLow(HC595_ST_PIN); - setPinOutput_writeHigh(HC595_DS_PIN); + gpio_set_pin_output_write_low(HC595_SH_PIN); + gpio_set_pin_output_write_low(HC595_ST_PIN); + gpio_set_pin_output_write_high(HC595_DS_PIN); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - clockPulse(ClOCK_TIME); + clock_pulse(ClOCK_TIME); } } @@ -102,7 +102,7 @@ __attribute__((weak)) void matrix_init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { if (row_pins[x] != NO_PIN) { - setPinInputHigh_atomic(row_pins[x]); + gpio_set_pin_input_high_atomic(row_pins[x]); } } } @@ -119,7 +119,7 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[] // For each row... for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { // Check row pin state - if (readMatrixPin(row_pins[row_index]) == 0) { + if (read_matrix_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= row_shifter; key_pressed = true; diff --git a/keyboards/skyloong/gk104/q1/q1.c b/keyboards/skyloong/gk104/q1/q1.c index 2859d9af2da..22d8580dfd7 100644 --- a/keyboards/skyloong/gk104/q1/q1.c +++ b/keyboards/skyloong/gk104/q1/q1.c @@ -222,7 +222,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } void suspend_power_down_kb() { - writePinLow(MAC_PIN); + gpio_write_pin_low(MAC_PIN); s_serial_to_parallel(0); suspend_power_down_user(); } @@ -240,13 +240,13 @@ bool shutdown_kb(bool jump_to_bootloader) { layer_state_t default_layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case 0: - writePinLow(MAC_PIN); + gpio_write_pin_low(MAC_PIN); //switch to win layer display IND = IND & (~MAC_ON); IND = IND | WIN_ON; break; case 1: - writePinHigh(MAC_PIN); + gpio_write_pin_high(MAC_PIN); //switch to mac layer display IND = IND & (~WIN_ON); IND = IND | MAC_ON; @@ -307,8 +307,8 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { void board_init(void) { // JTAG-DP Disabled and SW-DP Disabled AFIO->MAPR = (AFIO->MAPR & ~AFIO_MAPR_SWJ_CFG_Msk) | AFIO_MAPR_SWJ_CFG_DISABLE; - setPinOutput(MAC_PIN); - writePinHigh(MAC_PIN); + gpio_set_pin_output(MAC_PIN); + gpio_write_pin_high(MAC_PIN); s_serial_to_parallel(0xFF); IND = SKYLOONG; } From ee2d3a8c2858901c27de887df58bf40f63267c84 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Wed, 17 Jul 2024 10:57:33 +0800 Subject: [PATCH 25/31] update skyloong/gk104/q1/ansi/keyboard.json about rgb matrix layout location --- .../skyloong/gk104/q1/ansi/keyboard.json | 194 +++++++++--------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/ansi/keyboard.json b/keyboards/skyloong/gk104/q1/ansi/keyboard.json index b65102f4cbc..0bfd81e7158 100644 --- a/keyboards/skyloong/gk104/q1/ansi/keyboard.json +++ b/keyboards/skyloong/gk104/q1/ansi/keyboard.json @@ -4,117 +4,117 @@ "rgb_matrix": { "layout": [ {"matrix": [0, 0],"x": 0, "y": 0, "flags": 4}, - {"matrix": [0, 1], "x": 20.6, "y": 0, "flags": 4}, - {"matrix": [0, 2], "x": 30.9, "y": 0, "flags": 4}, - {"matrix": [0, 3], "x": 41.2, "y": 0, "flags": 4}, - {"matrix": [0, 4], "x": 51.5, "y": 0, "flags": 4}, - {"matrix": [0, 5], "x": 66.9, "y": 0, "flags": 4}, - {"matrix": [0, 6], "x": 77.2, "y": 0, "flags": 4}, - {"matrix": [0, 7], "x": 87.5, "y": 0, "flags": 4}, - {"matrix": [6, 7], "x": 97.8, "y": 0, "flags": 4}, - {"matrix": [0, 8], "x": 113.3, "y": 0, "flags": 4}, - {"matrix": [0, 9], "x": 123.6, "y": 0, "flags": 4}, - {"matrix": [0, 10], "x": 133.9, "y": 0, "flags": 4}, - {"matrix": [6, 10], "x": 144.2, "y": 0, "flags": 4}, - {"matrix": [0, 11], "x": 157.1, "y": 0, "flags": 4}, - {"matrix": [0, 12], "x": 167.4, "y": 0, "flags": 4}, - {"matrix": [6, 12], "x": 177.7, "y": 0, "flags": 4}, + {"matrix": [0, 1], "x": 21, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 31, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 41, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 52, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 67, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 77, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 88, "y": 0, "flags": 4}, + {"matrix": [6, 7], "x": 98, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 113, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 124, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 134, "y": 0, "flags": 4}, + {"matrix": [6, 10], "x": 144, "y": 0, "flags": 4}, + {"matrix": [0, 11], "x": 157, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 167, "y": 0, "flags": 4}, + {"matrix": [6, 12], "x": 178, "y": 0, "flags": 4}, - {"matrix": [1, 0], "x": 0, "y": 17.5, "flags": 4}, - {"matrix": [1, 1], "x": 10.3, "y": 17.5, "flags": 4}, - {"matrix": [1, 2], "x": 20.6, "y": 17.5, "flags": 4}, - {"matrix": [6, 2], "x": 30.9, "y": 17.5, "flags": 4}, - {"matrix": [1, 3], "x": 41.2, "y": 17.5, "flags": 4}, - {"matrix": [1, 4], "x": 51.5, "y": 17.5, "flags": 4}, - {"matrix": [1, 5], "x": 61.8, "y": 17.5, "flags": 4}, - {"matrix": [1, 6], "x": 72.1, "y": 17.5, "flags": 4}, - {"matrix": [6, 6], "x": 82.4, "y": 17.5, "flags": 4}, - {"matrix": [1, 7], "x": 92.7, "y": 17.5, "flags": 4}, - {"matrix": [1, 8], "x": 103, "y": 17.5, "flags": 4}, - {"matrix": [6, 8], "x": 113.3, "y": 17.5, "flags": 4}, - {"matrix": [1, 9], "x": 123.6, "y": 17.5, "flags": 4}, - {"matrix": [1, 10], "x": 143, "y": 17.5, "flags": 4}, - {"matrix": [1, 11], "x": 157.1, "y": 17.5, "flags": 4}, - {"matrix": [1, 12], "x": 167.4, "y": 17.5, "flags": 4}, - {"matrix": [3, 12], "x": 177.7, "y": 17.5, "flags": 4}, - {"matrix": [1, 13], "x": 193.1, "y": 17.5, "flags": 4}, - {"matrix": [1, 14], "x": 203.4, "y": 17.5, "flags": 4}, - {"matrix": [4, 14], "x": 213.7, "y": 17.5, "flags": 4}, - {"matrix": [1, 15], "x": 224, "y": 17.5, "flags": 4}, + {"matrix": [1, 0], "x": 0, "y": 18, "flags": 4}, + {"matrix": [1, 1], "x": 10, "y": 18, "flags": 4}, + {"matrix": [1, 2], "x": 21, "y": 18, "flags": 4}, + {"matrix": [6, 2], "x": 31, "y": 18, "flags": 4}, + {"matrix": [1, 3], "x": 41, "y": 18, "flags": 4}, + {"matrix": [1, 4], "x": 52, "y": 18, "flags": 4}, + {"matrix": [1, 5], "x": 62, "y": 18, "flags": 4}, + {"matrix": [1, 6], "x": 72, "y": 18, "flags": 4}, + {"matrix": [6, 6], "x": 82, "y": 18, "flags": 4}, + {"matrix": [1, 7], "x": 93, "y": 18, "flags": 4}, + {"matrix": [1, 8], "x": 103, "y": 18, "flags": 4}, + {"matrix": [6, 8], "x": 113, "y": 18, "flags": 4}, + {"matrix": [1, 9], "x": 124, "y": 18, "flags": 4}, + {"matrix": [1, 10], "x": 143, "y": 18, "flags": 4}, + {"matrix": [1, 11], "x": 157, "y": 18, "flags": 4}, + {"matrix": [1, 12], "x": 167, "y": 18, "flags": 4}, + {"matrix": [3, 12], "x": 178, "y": 18, "flags": 4}, + {"matrix": [1, 13], "x": 193, "y": 18, "flags": 4}, + {"matrix": [1, 14], "x": 203, "y": 18, "flags": 4}, + {"matrix": [4, 14], "x": 214, "y": 18, "flags": 4}, + {"matrix": [1, 15], "x": 224, "y": 18, "flags": 4}, - {"matrix": [2, 0], "x": 3, "y": 29.1, "flags": 4}, - {"matrix": [2, 1], "x": 15.4, "y": 29.1, "flags": 4}, - {"matrix": [2, 2], "x": 25.7, "y": 29.1, "flags": 4}, - {"matrix": [5, 2], "x": 36, "y": 29.1, "flags": 4}, - {"matrix": [2, 3], "x": 46.3, "y": 29.1, "flags": 4}, - {"matrix": [2, 4], "x": 56.6, "y": 29.1, "flags": 4}, - {"matrix": [2, 5], "x": 66.9, "y": 29.1, "flags": 4}, - {"matrix": [2, 6], "x": 77.2, "y": 29.1, "flags": 4}, - {"matrix": [5, 6], "x": 87.5, "y": 29.1, "flags": 4}, - {"matrix": [2, 7], "x": 97.8, "y": 29.1, "flags": 4}, - {"matrix": [2, 8], "x": 108.1, "y": 29.1, "flags": 4}, - {"matrix": [2, 9], "x": 118.4, "y": 29.1, "flags": 4}, - {"matrix": [6, 9], "x": 128.7, "y": 29.1, "flags": 4}, - {"matrix": [2, 10], "x": 142, "y": 29.1, "flags": 4}, - {"matrix": [2, 11], "x": 157.1, "y": 29.1, "flags": 4}, - {"matrix": [3, 11], "x": 167.4, "y": 29.1, "flags": 4}, - {"matrix": [2, 12], "x": 177.7, "y": 29.1, "flags": 4}, - {"matrix": [2, 13], "x": 193.1, "y": 29.1, "flags": 4}, - {"matrix": [2, 14], "x": 203.4, "y": 29.1, "flags": 4}, - {"matrix": [5, 14], "x": 213.7, "y": 29.1, "flags": 4}, + {"matrix": [2, 0], "x": 3, "y": 29, "flags": 4}, + {"matrix": [2, 1], "x": 15, "y": 29, "flags": 4}, + {"matrix": [2, 2], "x": 26, "y": 29, "flags": 4}, + {"matrix": [5, 2], "x": 36, "y": 29, "flags": 4}, + {"matrix": [2, 3], "x": 46, "y": 29, "flags": 4}, + {"matrix": [2, 4], "x": 57, "y": 29, "flags": 4}, + {"matrix": [2, 5], "x": 67, "y": 29, "flags": 4}, + {"matrix": [2, 6], "x": 77, "y": 29, "flags": 4}, + {"matrix": [5, 6], "x": 88, "y": 29, "flags": 4}, + {"matrix": [2, 7], "x": 98, "y": 29, "flags": 4}, + {"matrix": [2, 8], "x": 108, "y": 29, "flags": 4}, + {"matrix": [2, 9], "x": 118, "y": 29, "flags": 4}, + {"matrix": [6, 9], "x": 129, "y": 29, "flags": 4}, + {"matrix": [2, 10], "x": 142, "y": 29, "flags": 4}, + {"matrix": [2, 11], "x": 157, "y": 29, "flags": 4}, + {"matrix": [3, 11], "x": 167, "y": 29, "flags": 4}, + {"matrix": [2, 12], "x": 178, "y": 29, "flags": 4}, + {"matrix": [2, 13], "x": 193, "y": 29, "flags": 4}, + {"matrix": [2, 14], "x": 203, "y": 29, "flags": 4}, + {"matrix": [5, 14], "x": 214, "y": 29, "flags": 4}, {"matrix": [2, 15], "x": 224, "y": 34, "flags": 4}, - {"matrix": [3, 0], "x": 5, "y": 40.7, "flags": 4}, - {"matrix": [3, 1], "x": 18, "y": 40.7, "flags": 4}, - {"matrix": [3, 2], "x": 28.3, "y": 40.7, "flags": 4}, - {"matrix": [4, 2], "x": 38.6, "y": 40.7, "flags": 4}, - {"matrix": [3, 3], "x": 48.9, "y": 40.7, "flags": 4}, - {"matrix": [3, 4], "x": 59.2, "y": 40.7, "flags": 4}, - {"matrix": [3, 5], "x": 69.5, "y": 40.7, "flags": 4}, - {"matrix": [6, 5], "x": 79.8, "y": 40.7, "flags": 4}, - {"matrix": [3, 6], "x": 90.1, "y": 40.7, "flags": 4}, - {"matrix": [3, 7], "x": 100.4, "y": 40.7, "flags": 4}, - {"matrix": [3, 8], "x": 110.7, "y": 40.7, "flags": 4}, - {"matrix": [3, 9], "x": 121, "y": 40.7, "flags": 4}, - {"matrix": [3, 10], "x": 131.3, "y": 40.7, "flags": 4}, - {"matrix": [3, 13], "x": 193.1, "y": 40.7, "flags": 4}, - {"matrix": [3, 14], "x": 203.4, "y": 40.7, "flags": 4}, - {"matrix": [3, 15], "x": 213.7, "y": 40.7, "flags": 4}, + {"matrix": [3, 0], "x": 5, "y": 41, "flags": 4}, + {"matrix": [3, 1], "x": 18, "y": 41, "flags": 4}, + {"matrix": [3, 2], "x": 28, "y": 41, "flags": 4}, + {"matrix": [4, 2], "x": 39, "y": 41, "flags": 4}, + {"matrix": [3, 3], "x": 49, "y": 41, "flags": 4}, + {"matrix": [3, 4], "x": 59, "y": 41, "flags": 4}, + {"matrix": [3, 5], "x": 70, "y": 41, "flags": 4}, + {"matrix": [6, 5], "x": 80, "y": 41, "flags": 4}, + {"matrix": [3, 6], "x": 90, "y": 41, "flags": 4}, + {"matrix": [3, 7], "x": 100, "y": 41, "flags": 4}, + {"matrix": [3, 8], "x": 111, "y": 41, "flags": 4}, + {"matrix": [3, 9], "x": 121, "y": 41, "flags": 4}, + {"matrix": [3, 10], "x": 131, "y": 41, "flags": 4}, + {"matrix": [3, 13], "x": 193, "y": 41, "flags": 4}, + {"matrix": [3, 14], "x": 203, "y": 41, "flags": 4}, + {"matrix": [3, 15], "x": 214, "y": 41, "flags": 4}, - {"matrix": [4, 0], "x": 10, "y": 52.4, "flags": 4}, - {"matrix": [4, 1], "x": 23.2, "y": 52.4, "flags": 4}, - {"matrix": [6, 1], "x": 33.5, "y": 52.4, "flags": 4}, - {"matrix": [4, 3], "x": 43.8, "y": 52.4, "flags": 4}, - {"matrix": [6, 3], "x": 54.1, "y": 52.4, "flags": 4}, - {"matrix": [4, 4], "x": 64.4, "y": 52.4, "flags": 4}, - {"matrix": [6, 4], "x": 74.7, "y": 52.4, "flags": 4}, - {"matrix": [4, 5], "x": 85, "y": 52.4, "flags": 4}, - {"matrix": [4, 6], "x": 95.3, "y": 52.4, "flags": 4}, - {"matrix": [4, 7], "x": 105.6, "y": 52.4, "flags": 4}, - {"matrix": [4, 8], "x": 115.9, "y": 52.4, "flags": 4}, - {"matrix": [4, 10], "x": 136, "y": 52.4, "flags": 4}, - {"matrix": [4, 11], "x": 167.4, "y": 52.4, "flags": 4}, - {"matrix": [4, 13], "x": 193.1, "y": 52.4, "flags": 4}, - {"matrix": [6, 13], "x": 203.4, "y": 52.4, "flags": 4}, - {"matrix": [4, 15], "x": 213.7, "y": 52.4, "flags": 4}, + {"matrix": [4, 0], "x": 10, "y": 52, "flags": 4}, + {"matrix": [4, 1], "x": 23, "y": 52, "flags": 4}, + {"matrix": [6, 1], "x": 34, "y": 52, "flags": 4}, + {"matrix": [4, 3], "x": 44, "y": 52, "flags": 4}, + {"matrix": [6, 3], "x": 54, "y": 52, "flags": 4}, + {"matrix": [4, 4], "x": 64, "y": 52, "flags": 4}, + {"matrix": [6, 4], "x": 75, "y": 52, "flags": 4}, + {"matrix": [4, 5], "x": 85, "y": 52, "flags": 4}, + {"matrix": [4, 6], "x": 95, "y": 52, "flags": 4}, + {"matrix": [4, 7], "x": 106, "y": 52, "flags": 4}, + {"matrix": [4, 8], "x": 116, "y": 52, "flags": 4}, + {"matrix": [4, 10], "x": 136, "y": 52, "flags": 4}, + {"matrix": [4, 11], "x": 168, "y": 52, "flags": 4}, + {"matrix": [4, 13], "x": 193, "y": 52, "flags": 4}, + {"matrix": [6, 13], "x": 203, "y": 52, "flags": 4}, + {"matrix": [4, 15], "x": 214, "y": 52, "flags": 4}, {"matrix": [6, 15], "x": 224, "y": 57, "flags": 4}, {"matrix": [5, 0], "x": 0, "y": 64, "flags": 4}, - {"matrix": [6, 0], "x": 12.9, "y": 64, "flags": 4}, - {"matrix": [5, 1], "x": 25.7, "y": 64, "flags": 4}, + {"matrix": [6, 0], "x": 13, "y": 64, "flags": 4}, + {"matrix": [5, 1], "x": 26, "y": 64, "flags": 4}, {"matrix": [5, 3], "x": 54, "y": 64, "flags": 4}, {"matrix": [5, 4], "x": 72, "y": 64, "flags": 4}, {"matrix": [5, 5], "x": 87, "y": 64, "flags": 4}, {"matrix": [5, 7], "x": 103, "y": 64, "flags": 4}, - {"matrix": [5, 8], "x": 115.9, "y": 64, "flags": 4}, - {"matrix": [5, 9], "x": 128.7, "y": 64, "flags": 4}, - {"matrix": [5, 10], "x": 141.6, "y": 64, "flags": 4}, - {"matrix": [5, 11], "x": 157.1, "y": 64, "flags": 4}, - {"matrix": [6, 11], "x": 167.4, "y": 64, "flags": 4}, - {"matrix": [4, 12], "x": 177.7, "y": 64, "flags": 4}, + {"matrix": [5, 8], "x": 116, "y": 64, "flags": 4}, + {"matrix": [5, 9], "x": 129, "y": 64, "flags": 4}, + {"matrix": [5, 10], "x": 142, "y": 64, "flags": 4}, + {"matrix": [5, 11], "x": 157, "y": 64, "flags": 4}, + {"matrix": [6, 11], "x": 167, "y": 64, "flags": 4}, + {"matrix": [4, 12], "x": 178, "y": 64, "flags": 4}, {"matrix": [5, 13], "x": 198, "y": 64, "flags": 4}, - {"matrix": [5, 15], "x": 213.7, "y": 64, "flags": 4} + {"matrix": [5, 15], "x": 214, "y": 64, "flags": 4} ] }, "usb": { From 1742362c0b6ec9fa3d2e751293f584601379704a Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Tue, 23 Jul 2024 16:04:02 +0800 Subject: [PATCH 26/31] delete skyloong/gk104/q1/readme.md and add skyloong/gk104/q1/ansi/readme.md. --- keyboards/skyloong/gk104/q1/{ => ansi}/readme.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename keyboards/skyloong/gk104/q1/{ => ansi}/readme.md (100%) diff --git a/keyboards/skyloong/gk104/q1/readme.md b/keyboards/skyloong/gk104/q1/ansi/readme.md similarity index 100% rename from keyboards/skyloong/gk104/q1/readme.md rename to keyboards/skyloong/gk104/q1/ansi/readme.md From 99d5cbe7e346afe99305fb6388e2f95ce027d2f0 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Wed, 24 Jul 2024 16:23:29 +0800 Subject: [PATCH 27/31] update skyloong/gk104/q1 about layer switch. --- keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c | 2 +- keyboards/skyloong/gk104/q1/q1.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c index 2745cdae933..b5469112fdf 100644 --- a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c @@ -58,7 +58,7 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { #if defined(DIP_SWITCH_MAP_ENABLE) const uint16_t PROGMEM dip_switch_map[NUM_DIP_SWITCHES][NUM_DIP_STATES] = { - DIP_SWITCH_OFF_ON(TO(0), TO(1)), + DIP_SWITCH_OFF_ON(DF(0), DF(1)), }; #endif /* diff --git a/keyboards/skyloong/gk104/q1/q1.c b/keyboards/skyloong/gk104/q1/q1.c index 22d8580dfd7..69eec7aa2a9 100644 --- a/keyboards/skyloong/gk104/q1/q1.c +++ b/keyboards/skyloong/gk104/q1/q1.c @@ -207,11 +207,11 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } return true; // continue all further processing of this key - case TO(0): + case DF(0): set_single_persistent_default_layer(0); return true; - case TO(1): + case DF(1): set_single_persistent_default_layer(1); return true; From 1c1c8a4102c0c2a4671f1f8e13b6d489218187f0 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Fri, 30 Aug 2024 19:02:38 +0800 Subject: [PATCH 28/31] Delete skyloong/gk104/q1/ansi/keymaps/via --- .../gk104/q1/ansi/keymaps/via/keymap.c | 90 ------------------- .../gk104/q1/ansi/keymaps/via/rules.mk | 3 - 2 files changed, 93 deletions(-) delete mode 100644 keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c delete mode 100644 keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c deleted file mode 100644 index b5469112fdf..00000000000 --- a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/keymap.c +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2023 NaturalZh (@NaturalZh) -// SPDX-License-Identifier: GPL-2.0-or-later - -#include QMK_KEYBOARD_H -enum layer_names { - _WIN, - _MAC, - _WIN_INDEX, - _MAC_INDEX -}; -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - [_WIN] = LAYOUT_all( - 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_SCRL, KC_PAUS, RGB_TOG, KC_MUTE, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - 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_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, - 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_P4, KC_P5, KC_P6, - 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_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_WIN_INDEX), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT - ), - - [_MAC] = LAYOUT_all( - KC_ESC, KC_F14, KC_F15, C(KC_UP), G(KC_D), G(KC_SPC), LAG(KC_EJCT), KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_SCRL, KC_PAUS, RGB_TOG, KC_MUTE, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - 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_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, - 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_P4, KC_P5, KC_P6, - 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_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RCMD, MO(_MAC_INDEX), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT - ), - - [_WIN_INDEX] = LAYOUT_all( - _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), RGB_TOG, KC_MUTE, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LGUI, KC_LALT, _______, _______, _______, KC_RALT, _______, KC_APP, _______, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT - ), - - [_MAC_INDEX] = LAYOUT_all( - _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), RGB_TOG, KC_MUTE, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LALT, KC_LGUI, _______, _______, _______, KC_RCMD, _______, KC_RALT, _______, RGB_SPD, RGB_VAD, RGB_SPI, KC_P0, KC_PDOT - ) -}; - -#if defined(ENCODER_MAP_ENABLE) -const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { - [_WIN] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [_MAC] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [_WIN_INDEX] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [_MAC_INDEX] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(KC_VOLD, KC_VOLU)} -}; -#endif - -#if defined(DIP_SWITCH_MAP_ENABLE) -const uint16_t PROGMEM dip_switch_map[NUM_DIP_SWITCHES][NUM_DIP_STATES] = { - DIP_SWITCH_OFF_ON(DF(0), DF(1)), -}; -#endif -/* -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - - switch (get_highest_layer(layer_state)) { - case 2:{ - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - } break; - case 3:{ - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255); - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - } - } break; - - default:{ - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0); - RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0); - } - } - } - return true; -} -*/ diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk b/keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk deleted file mode 100644 index 8dfffa9d795..00000000000 --- a/keyboards/skyloong/gk104/q1/ansi/keymaps/via/rules.mk +++ /dev/null @@ -1,3 +0,0 @@ -ENCODER_MAP_ENABLE = yes -DIP_SWITCH_MAP_ENABLE = yes -VIA_ENABLE = yes From 930e25adf49f26b7c6430d8e043b928407e98365 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Fri, 18 Oct 2024 16:10:40 +0800 Subject: [PATCH 29/31] update skyloong/gk104/q1 --- keyboards/skyloong/gk104/q1/config.h | 4 ++++ keyboards/skyloong/gk104/q1/info.json | 5 ----- keyboards/skyloong/gk104/q1/matrix.c | 1 - keyboards/skyloong/gk104/q1/q1.c | 18 ------------------ 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/keyboards/skyloong/gk104/q1/config.h b/keyboards/skyloong/gk104/q1/config.h index b12220ac42d..28bf2350b71 100644 --- a/keyboards/skyloong/gk104/q1/config.h +++ b/keyboards/skyloong/gk104/q1/config.h @@ -5,6 +5,10 @@ #define MAC_PIN C13 +#define MATRIX_ROWS 7 +#define MATRIX_COLS 16 +#define MATRIX_ROW_PINS {A8, A9, A10, A15, B6, B7, B9} + #ifdef ENCODER_ENABLE # define ENCODER_MAP_KEY_DELAY 10 #endif diff --git a/keyboards/skyloong/gk104/q1/info.json b/keyboards/skyloong/gk104/q1/info.json index 47a79b5a557..061cfe44a65 100644 --- a/keyboards/skyloong/gk104/q1/info.json +++ b/keyboards/skyloong/gk104/q1/info.json @@ -30,16 +30,11 @@ }, "indicators": { "num_lock": "C15", - "on_state": 1, "caps_lock": "C14" }, "dip_switch":{ "pins":["A4"] }, - "matrix_pins": { - "cols": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,null], - "rows": ["A8", "A9", "A10", "A15", "B6", "B7","B9"] - }, "processor": "STM32F103", "rgb_matrix": { "animations": { diff --git a/keyboards/skyloong/gk104/q1/matrix.c b/keyboards/skyloong/gk104/q1/matrix.c index 3f73afbb9f2..fa547fd9aa1 100644 --- a/keyboards/skyloong/gk104/q1/matrix.c +++ b/keyboards/skyloong/gk104/q1/matrix.c @@ -18,7 +18,6 @@ extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; // user-defined overridable functions __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter); diff --git a/keyboards/skyloong/gk104/q1/q1.c b/keyboards/skyloong/gk104/q1/q1.c index 69eec7aa2a9..6af7e149ad4 100644 --- a/keyboards/skyloong/gk104/q1/q1.c +++ b/keyboards/skyloong/gk104/q1/q1.c @@ -264,38 +264,20 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { //caps lock display if (host_keyboard_led_state().caps_lock) { - // RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 255, 255, 255); IND = IND | CAPS_ON; } else { - /* - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 0, 0, 0); - } - */ IND = IND & (~CAPS_ON); } //number lock display if (host_keyboard_led_state().num_lock) { - // RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 255, 255, 255); IND = IND | NUM_ON; } else { - /* - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 0, 0, 0); - } - */ IND = IND & (~NUM_ON); } //scroll lock display if (host_keyboard_led_state().scroll_lock) { - // RGB_MATRIX_INDICATOR_SET_COLOR(SCR_LOCK_INDEX, 255, 255, 255); IND = IND | SCR_ON; } else { - /* - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(SCR_LOCK_INDEX, 0, 0, 0); - } - */ IND = IND & (~SCR_ON); } From 302e03710e2148c6736414b11195e1eac56956c0 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Sat, 26 Oct 2024 16:15:41 +0800 Subject: [PATCH 30/31] update skyloong/gk104/q1 --- .../gk104/q1/ansi/keymaps/default/keymap.c | 6 ++-- keyboards/skyloong/gk104/q1/ansi/rules.mk | 1 + keyboards/skyloong/gk104/q1/led_hc595.c | 24 ++------------ keyboards/skyloong/gk104/q1/led_hc595.h | 31 +++++++++++++++++++ keyboards/skyloong/gk104/q1/q1.c | 7 ++--- 5 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 keyboards/skyloong/gk104/q1/led_hc595.h diff --git a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c index cbf59a9a2c3..0c6c5215a71 100644 --- a/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c +++ b/keyboards/skyloong/gk104/q1/ansi/keymaps/default/keymap.c @@ -30,7 +30,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_WIN_INDEX] = LAYOUT_all( _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_MUTE, RGB_TOG, - _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, DF(_WIN), DF(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, @@ -39,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_MAC_INDEX] = LAYOUT_all( _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_MUTE, RGB_TOG, - _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + _______, _______, _______, _______, _______, _______, DF(_WIN), DF(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, @@ -58,7 +58,7 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { #if defined(DIP_SWITCH_MAP_ENABLE) const uint16_t PROGMEM dip_switch_map[NUM_DIP_SWITCHES][NUM_DIP_STATES] = { - DIP_SWITCH_OFF_ON(TO(0), TO(1)), + DIP_SWITCH_OFF_ON(DF(_WIN), DF(_MAC)), }; #endif diff --git a/keyboards/skyloong/gk104/q1/ansi/rules.mk b/keyboards/skyloong/gk104/q1/ansi/rules.mk index 6aebeff05a8..a937045e0d0 100644 --- a/keyboards/skyloong/gk104/q1/ansi/rules.mk +++ b/keyboards/skyloong/gk104/q1/ansi/rules.mk @@ -1,2 +1,3 @@ CUSTOM_MATRIX = lite SRC += matrix.c + SRC += led_hc595.c diff --git a/keyboards/skyloong/gk104/q1/led_hc595.c b/keyboards/skyloong/gk104/q1/led_hc595.c index 27a10d4d147..0a68b4e0f1a 100644 --- a/keyboards/skyloong/gk104/q1/led_hc595.c +++ b/keyboards/skyloong/gk104/q1/led_hc595.c @@ -1,6 +1,6 @@ // Copyright 2023 NaturalZh (@NaturalZh) // SPDX-License-Identifier: GPL-2.0-or-later -#include "quantum.h" +#include "led_hc595.h" #ifndef HC595_ST_PIN # error hc595: no storage register clock pins defined! @@ -14,25 +14,6 @@ # error hc595: no serial data input pins defined! #endif -/* - *LED display driver.74HC595 Serial to parallel control LED field on/off. - * data(default):1-on/0-off (left low bit) - * bit0 --- NUM indicator - * bit1 --- CAPS indicator - * bit2 --- SCR indicator - * bit3 --- WinLock indicator - * bit4 --- Skyloong LOGO display - * bit5 --- Win layer indicator - * bit6 --- MAC layer indicator - */ -#define NUM_ON 0b10000000 -#define CAPS_ON 0b01000000 -#define SCR_ON 0b00100000 -#define WINLK_ON 0b00010000 -#define SKYLOONG 0b00001000 -#define WIN_ON 0b00000010 -#define MAC_ON 0b00000100 - #define CLOCK_TIME 15 static inline void gpio_set_pin_output_write_low(pin_t pin) { @@ -63,7 +44,8 @@ static inline void clockPulse(uint16_t n) { gpio_write_pin_low(HC595_ST_PIN); } -static void s_serial_to_parallel(uint8_t data) { // Serial port to parallel port function +void s_serial_to_parallel(uint8_t data) __attribute__((unused)); +void s_serial_to_parallel(uint8_t data) { // Serial port to parallel port function gpio_set_pin_output_write_low(HC595_DS); gpio_set_pin_output_write_low(HC595_SH_PIN); gpio_set_pin_output_write_low(HC595_ST_PIN); diff --git a/keyboards/skyloong/gk104/q1/led_hc595.h b/keyboards/skyloong/gk104/q1/led_hc595.h new file mode 100644 index 00000000000..9e47f41a4e9 --- /dev/null +++ b/keyboards/skyloong/gk104/q1/led_hc595.h @@ -0,0 +1,31 @@ +// Copyright 2023 NaturalZh (@NaturalZh) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once +//#include "quantum.h" +#include "atomic_util.h" +#include "gpio.h" + +#define HC595_ST_PIN B1 //74HC595 storage register clock input +#define HC595_SH_PIN B0 //74HC595 shift register clock input +#define HC595_DS B3 // 74HC595 serial data input + +/* + *LED display driver.74HC595 Serial to parallel control LED field on/off. + * data(default):1-on/0-off (left low bit) + * bit0 --- NUM indicator + * bit1 --- CAPS indicator + * bit2 --- SCR indicator + * bit3 --- WinLock indicator + * bit4 --- Skyloong LOGO display + * bit5 --- Win layer indicator + * bit6 --- MAC layer indicator + */ +#define NUM_ON 0b10000000 +#define CAPS_ON 0b01000000 +#define SCR_ON 0b00100000 +#define WINLK_ON 0b00010000 +#define SKYLOONG 0b00001000 +#define WIN_ON 0b00000010 +#define MAC_ON 0b00000100 + +void s_serial_to_parallel(uint8_t data); diff --git a/keyboards/skyloong/gk104/q1/q1.c b/keyboards/skyloong/gk104/q1/q1.c index 6af7e149ad4..bf9d55b278f 100644 --- a/keyboards/skyloong/gk104/q1/q1.c +++ b/keyboards/skyloong/gk104/q1/q1.c @@ -1,15 +1,12 @@ // Copyright 2023 NaturalZh (@NaturalZh) // SPDX-License-Identifier: GPL-2.0-or-later #include "quantum.h" +#include "led_hc595.h" -#define HC595_ST_PIN B1 //74HC595 storage register clock input -#define HC595_SH_PIN B0 //74HC595 shift register clock input -#define HC595_DS B3 // 74HC595 serial data input -#include "led_hc595.c" uint8_t IND = 0; //buffer of LED Display int FN_ON = 0; -_Bool WIN_LOCK = 0; +bool WIN_LOCK = 0; #if defined(RGB_MATRIX_ENABLE) /*&& defined(CAPS_LOCK_INDEX)*/ const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT] = { From 024736fbfb4bd7e4175384f4d1cb7b8ea67f5ca5 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Sat, 26 Oct 2024 16:25:41 +0800 Subject: [PATCH 31/31] update skyloong/gk104/q1/ansi/readme.md --- keyboards/skyloong/gk104/q1/ansi/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/skyloong/gk104/q1/ansi/readme.md b/keyboards/skyloong/gk104/q1/ansi/readme.md index dc0414f5952..9557167919c 100644 --- a/keyboards/skyloong/gk104/q1/ansi/readme.md +++ b/keyboards/skyloong/gk104/q1/ansi/readme.md @@ -13,7 +13,7 @@ The following is the QMK Firmware for the Destop 100% keylayout - designed by D * Keyboard Maintainer: [NaturalZh](https://github.com/NaturalZh) * Hardware Supported: DestopPCB for Skyloong keylayout 100%, STM32F103C8T6 -* Hardware Availability: http://www.skyloong.com.cn https://skyloong.vip +* Hardware Availability: [Skyloong CN](http://www.skyloong.com.cn) & [Skyloong HK](https://skyloongtech.com/product-category/keyboards/qmkvia-keyboard/) Make example for this keyboard (after setting up your build environment):