From a857b26336faf5bb026911460e3c5a829fa4f9eb Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Fri, 10 May 2024 14:17:20 +0800 Subject: [PATCH 01/18] Create gk87_bl_pro backlight and digital screen keyboard --- .../skyloong/gk87/bl_pro/ansi/keyboard.json | 295 ++++++++++++++++++ .../gk87/bl_pro/ansi/keymaps/default/keymap.c | 63 ++++ .../gk87/bl_pro/ansi/keymaps/default/rules.mk | 2 + .../gk87/bl_pro/ansi/keymaps/via/keymap.c | 64 ++++ .../gk87/bl_pro/ansi/keymaps/via/rules.mk | 3 + keyboards/skyloong/gk87/bl_pro/ansi/rules.mk | 2 + keyboards/skyloong/gk87/bl_pro/bl_pro.c | 182 +++++++++++ keyboards/skyloong/gk87/bl_pro/config.h | 12 + keyboards/skyloong/gk87/bl_pro/halconf.h | 6 + keyboards/skyloong/gk87/bl_pro/info.json | 59 ++++ keyboards/skyloong/gk87/bl_pro/led_hc595.c | 80 +++++ keyboards/skyloong/gk87/bl_pro/matrix.c | 154 +++++++++ keyboards/skyloong/gk87/bl_pro/mcuconf.h | 10 + keyboards/skyloong/gk87/bl_pro/readme.md | 34 ++ 14 files changed, 966 insertions(+) create mode 100644 keyboards/skyloong/gk87/bl_pro/ansi/keyboard.json create mode 100644 keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c create mode 100644 keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/rules.mk create mode 100644 keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c create mode 100644 keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/rules.mk create mode 100644 keyboards/skyloong/gk87/bl_pro/ansi/rules.mk create mode 100644 keyboards/skyloong/gk87/bl_pro/bl_pro.c create mode 100644 keyboards/skyloong/gk87/bl_pro/config.h create mode 100644 keyboards/skyloong/gk87/bl_pro/halconf.h create mode 100644 keyboards/skyloong/gk87/bl_pro/info.json create mode 100644 keyboards/skyloong/gk87/bl_pro/led_hc595.c create mode 100644 keyboards/skyloong/gk87/bl_pro/matrix.c create mode 100644 keyboards/skyloong/gk87/bl_pro/mcuconf.h create mode 100644 keyboards/skyloong/gk87/bl_pro/readme.md diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/keyboard.json b/keyboards/skyloong/gk87/bl_pro/ansi/keyboard.json new file mode 100644 index 00000000000..bad3b7f3f51 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/ansi/keyboard.json @@ -0,0 +1,295 @@ +{ + "keyboard_name": "GK87_BL_Pro_ANSI_1.0.0", + "usb": { + "device_version": "1.0.0", + "pid": "0x6A8A" + }, + "community_layouts": ["tkl_ansi"], + "layouts": { + "LAYOUT_all": { + "layout": [ + {"label": "ESC", "matrix": [0, 0], "x": 0, "y": 0}, + {"label": "F1", "matrix": [0, 2], "x": 2, "y": 0}, + {"label": "F2", "matrix": [0, 3], "x": 3, "y": 0}, + {"label": "F3", "matrix": [0, 4], "x": 4, "y": 0}, + {"label": "F4", "matrix": [0, 5], "x": 5, "y": 0}, + {"label": "F5", "matrix": [0, 6], "x": 6.5, "y": 0}, + {"label": "F6", "matrix": [0, 7], "x": 7.5, "y": 0}, + {"label": "F7", "matrix": [0, 8], "x": 8.5, "y": 0}, + {"label": "F8", "matrix": [0, 9], "x": 9.5, "y": 0}, + {"label": "F9", "matrix": [0, 10], "x": 11, "y": 0}, + {"label": "F10", "matrix": [0, 11], "x": 12, "y": 0}, + {"label": "F11", "matrix": [0, 12], "x": 13, "y": 0}, + {"label": "F12", "matrix": [0, 13], "x": 14, "y": 0}, + {"label": "Mute", "matrix": [0, 14], "x": 15.25, "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": [1, 11], "x": 11, "y": 1.25}, + {"label": "=+", "matrix": [1, 12], "x": 12, "y": 1.25}, + {"label": "BS", "matrix": [1, 13], "x": 13, "y": 1.25, "w": 2}, + {"label": "Ins", "matrix": [1, 14], "x": 15.25, "y": 1.25}, + {"label": "Home", "matrix": [1, 15], "x": 16.25, "y": 1.25}, + {"label": "PgUp", "matrix": [3, 15], "x": 17.25, "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": [2, 11], "x": 11.5, "y": 2.25}, + {"label": "]", "matrix": [2, 12], "x": 12.5, "y": 2.25}, + {"label": "|", "matrix": [2, 13], "x": 13.5, "y": 2.25, "w": 1.5}, + {"label": "Del", "matrix": [2, 14], "x": 15.25, "y": 2.25}, + {"label": "End", "matrix": [2, 15], "x": 16.25, "y": 2.25}, + {"label": "PgDn", "matrix": [4, 15], "x": 17.25, "y": 2.25}, + + {"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": [3, 11], "x": 11.75, "y": 3.25}, + {"label": "Ent", "matrix": [3, 12], "x": 12.75, "y": 3.25, "w": 2.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": [4, 12], "x": 12.25, "y": 4.25, "w": 2.75}, + {"label": "Up", "matrix": [4, 14], "x": 16.25, "y": 4.25}, + + {"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": [5, 2], "x": 2.5, "y": 5.25, "w": 1.25}, + {"label": "SPAC1", "matrix": [5, 4], "x": 3.75, "y": 5.25, "w": 2.5}, + {"label": "SPAC", "matrix": [5, 5], "x": 6.25, "y": 5.25, "w": 1.25}, + {"label": "SPAC2", "matrix": [5, 8], "x": 7.5, "y": 5.25, "w": 2.5}, + {"label": "Alt", "matrix": [5, 9], "x": 10, "y": 5.25, "w": 1.25}, + {"label": "Menu", "matrix": [5, 10], "x": 11.25, "y": 5.25, "w": 1.25}, + {"label": "Ctrl", "matrix": [5, 11], "x": 12.5, "y": 5.25, "w": 1.25}, + {"label": "Fn", "matrix": [5, 12], "x": 13.75, "y": 5.25, "w": 1.25}, + {"label": "Left", "matrix": [5, 13], "x": 15.25, "y": 5.25}, + {"label": "Down", "matrix": [5, 14], "x": 16.25, "y": 5.25}, + {"label": "Right", "matrix": [5, 15], "x": 17.25, "y": 5.25} + ] + }, + "LAYOUT_tkl_ansi": { + "layout": [ + {"label": "ESC", "matrix": [0, 0], "x": 0, "y": 0}, + {"label": "F1", "matrix": [0, 2], "x": 2, "y": 0}, + {"label": "F2", "matrix": [0, 3], "x": 3, "y": 0}, + {"label": "F3", "matrix": [0, 4], "x": 4, "y": 0}, + {"label": "F4", "matrix": [0, 5], "x": 5, "y": 0}, + {"label": "F5", "matrix": [0, 6], "x": 6.5, "y": 0}, + {"label": "F6", "matrix": [0, 7], "x": 7.5, "y": 0}, + {"label": "F7", "matrix": [0, 8], "x": 8.5, "y": 0}, + {"label": "F8", "matrix": [0, 9], "x": 9.5, "y": 0}, + {"label": "F9", "matrix": [0, 10], "x": 11, "y": 0}, + {"label": "F10", "matrix": [0, 11], "x": 12, "y": 0}, + {"label": "F11", "matrix": [0, 12], "x": 13, "y": 0}, + {"label": "F12", "matrix": [0, 13], "x": 14, "y": 0}, + {"label": "PrtSc", "matrix": [0, 14], "x": 15.25, "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": [1, 11], "x": 11, "y": 1.25}, + {"label": "=+", "matrix": [1, 12], "x": 12, "y": 1.25}, + {"label": "BS", "matrix": [1, 13], "x": 13, "y": 1.25, "w": 2}, + {"label": "Ins", "matrix": [1, 14], "x": 15.25, "y": 1.25}, + {"label": "Home", "matrix": [1, 15], "x": 16.25, "y": 1.25}, + {"label": "PgUp", "matrix": [3, 15], "x": 17.25, "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": [2, 11], "x": 11.5, "y": 2.25}, + {"label": "]", "matrix": [2, 12], "x": 12.5, "y": 2.25}, + {"label": "|", "matrix": [2, 13], "x": 13.5, "y": 2.25, "w": 1.5}, + {"label": "Del", "matrix": [2, 14], "x": 15.25, "y": 2.25}, + {"label": "End", "matrix": [2, 15], "x": 16.25, "y": 2.25}, + {"label": "PgDn", "matrix": [4, 15], "x": 17.25, "y": 2.25}, + + {"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": [3, 11], "x": 11.75, "y": 3.25}, + {"label": "Ent", "matrix": [3, 12], "x": 12.75, "y": 3.25, "w": 2.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": [4, 12], "x": 12.25, "y": 4.25, "w": 2.75}, + {"label": "Up", "matrix": [4, 14], "x": 16.25, "y": 4.25}, + + {"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": [5, 2], "x": 2.5, "y": 5.25, "w": 1.25}, + {"label": "SPAC", "matrix": [5, 5], "x": 3.75, "y": 5.25, "w": 6.25}, + {"label": "Alt", "matrix": [5, 9], "x": 10, "y": 5.25, "w": 1.25}, + {"label": "Menu", "matrix": [5, 10], "x": 11.25, "y": 5.25, "w": 1.25}, + {"label": "Ctrl", "matrix": [5, 11], "x": 12.5, "y": 5.25, "w": 1.25}, + {"label": "Fn", "matrix": [5, 12], "x": 13.75, "y": 5.25, "w": 1.25}, + {"label": "Left", "matrix": [5, 13], "x": 15.25, "y": 5.25}, + {"label": "Down", "matrix": [5, 14], "x": 16.25, "y": 5.25}, + {"label": "Right", "matrix": [5, 15], "x": 17.25, "y": 5.25} + ] + }, + "LAYOUT_ansi_split_space": { + "layout": [ + {"label": "ESC", "matrix": [0, 0], "x": 0, "y": 0}, + {"label": "F1", "matrix": [0, 2], "x": 2, "y": 0}, + {"label": "F2", "matrix": [0, 3], "x": 3, "y": 0}, + {"label": "F3", "matrix": [0, 4], "x": 4, "y": 0}, + {"label": "F4", "matrix": [0, 5], "x": 5, "y": 0}, + {"label": "F5", "matrix": [0, 6], "x": 6.5, "y": 0}, + {"label": "F6", "matrix": [0, 7], "x": 7.5, "y": 0}, + {"label": "F7", "matrix": [0, 8], "x": 8.5, "y": 0}, + {"label": "F8", "matrix": [0, 9], "x": 9.5, "y": 0}, + {"label": "F9", "matrix": [0, 10], "x": 11, "y": 0}, + {"label": "F10", "matrix": [0, 11], "x": 12, "y": 0}, + {"label": "F11", "matrix": [0, 12], "x": 13, "y": 0}, + {"label": "F12", "matrix": [0, 13], "x": 14, "y": 0}, + {"label": "Mute", "matrix": [0, 14], "x": 15.25, "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": [1, 11], "x": 11, "y": 1.25}, + {"label": "=+", "matrix": [1, 12], "x": 12, "y": 1.25}, + {"label": "BS", "matrix": [1, 13], "x": 13, "y": 1.25, "w": 2}, + {"label": "Ins", "matrix": [1, 14], "x": 15.25, "y": 1.25}, + {"label": "Home", "matrix": [1, 15], "x": 16.25, "y": 1.25}, + {"label": "PgUp", "matrix": [3, 15], "x": 17.25, "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": [2, 11], "x": 11.5, "y": 2.25}, + {"label": "]", "matrix": [2, 12], "x": 12.5, "y": 2.25}, + {"label": "|", "matrix": [2, 13], "x": 13.5, "y": 2.25, "w": 1.5}, + {"label": "Del", "matrix": [2, 14], "x": 15.25, "y": 2.25}, + {"label": "End", "matrix": [2, 15], "x": 16.25, "y": 2.25}, + {"label": "PgDn", "matrix": [4, 15], "x": 17.25, "y": 2.25}, + + {"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": [3, 11], "x": 11.75, "y": 3.25}, + {"label": "Ent", "matrix": [3, 12], "x": 12.75, "y": 3.25, "w": 2.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": [4, 12], "x": 12.25, "y": 4.25, "w": 2.75}, + {"label": "Up", "matrix": [4, 14], "x": 16.25, "y": 4.25}, + + {"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": [5, 2], "x": 2.5, "y": 5.25, "w": 1.25}, + {"label": "SPAC1", "matrix": [5, 4], "x": 3.75, "y": 5.25, "w": 3.25}, + {"label": "SPAC2", "matrix": [5, 8], "x": 7, "y": 5.25, "w": 3}, + {"label": "Alt", "matrix": [5, 9], "x": 10, "y": 5.25, "w": 1.25}, + {"label": "Menu", "matrix": [5, 10], "x": 11.25, "y": 5.25, "w": 1.25}, + {"label": "Ctrl", "matrix": [5, 11], "x": 12.5, "y": 5.25, "w": 1.25}, + {"label": "Fn", "matrix": [5, 12], "x": 13.75, "y": 5.25, "w": 1.25}, + {"label": "Left", "matrix": [5, 13], "x": 15.25, "y": 5.25}, + {"label": "Down", "matrix": [5, 14], "x": 16.25, "y": 5.25}, + {"label": "Right", "matrix": [5, 15], "x": 17.25, "y": 5.25} + ] + } + } +} diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c new file mode 100644 index 00000000000..561b30551a3 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c @@ -0,0 +1,63 @@ +// 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_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_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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_WIN_INDEX), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + [_MAC] = LAYOUT_all( + _______, 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_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_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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RCMD, MO(_MAC_INDEX), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + [_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, KC_PSCR, + _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_UP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_OFF, BL_DOWN, BL_ON + ), + + [_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, KC_PSCR, + _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_UP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_OFF, BL_DOWN, BL_ON + ) +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [_WIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [_MAC] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [_WIN_INDEX] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI)}, + [_MAC_INDEX] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI)} +}; +#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 + diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/rules.mk b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/rules.mk new file mode 100644 index 00000000000..d64aefdfb83 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/rules.mk @@ -0,0 +1,2 @@ +ENCODER_MAP_ENABLE = yes +DIP_SWITCH_MAP_ENABLE = yes diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c new file mode 100644 index 00000000000..4501f9b7f86 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c @@ -0,0 +1,64 @@ +// 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_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_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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_WIN_INDEX), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + [_MAC] = LAYOUT_all( + _______, 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_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_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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RCMD, MO(_MAC_INDEX), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + [_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, BL_TOGG, + _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_UP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, BL_DOWN, KC_RGHT + ), + + [_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, BL_TOGG, + _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_UP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, BL_DOWN, KC_RGHT + ) +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [_WIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [_MAC] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [_WIN_INDEX] = { ENCODER_CCW_CW(BL_DOWN, BL_UP)}, + [_MAC_INDEX] = { ENCODER_CCW_CW(BL_DOWN, BL_UP)} +}; +#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 + diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/rules.mk b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/rules.mk new file mode 100644 index 00000000000..8dfffa9d795 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/rules.mk @@ -0,0 +1,3 @@ +ENCODER_MAP_ENABLE = yes +DIP_SWITCH_MAP_ENABLE = yes +VIA_ENABLE = yes diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/rules.mk b/keyboards/skyloong/gk87/bl_pro/ansi/rules.mk new file mode 100644 index 00000000000..6aebeff05a8 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/ansi/rules.mk @@ -0,0 +1,2 @@ + CUSTOM_MATRIX = lite + SRC += matrix.c diff --git a/keyboards/skyloong/gk87/bl_pro/bl_pro.c b/keyboards/skyloong/gk87/bl_pro/bl_pro.c new file mode 100644 index 00000000000..8af16b98510 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/bl_pro.c @@ -0,0 +1,182 @@ +// Copyright 2023 NaturalZh (@NaturalZh) +// SPDX-License-Identifier: GPL-2.0-or-later +#include "quantum.h" + +#define HC595_ST_PIN B5 //74HC595 storage register clock input +#define HC595_SH_PIN B4 //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 DIS_BRETH = 0; + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + switch (keycode) { + 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); + gpio_write_pin_high(WIN_LOCK_PIN); + 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); + gpio_write_pin_low(WIN_LOCK_PIN); + 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; + + case BL_TOGG: + if (record->event.pressed){ + if(is_backlight_breathing()) { + backlight_disable_breathing(); + DIS_BRETH = 1; + + }else if(DIS_BRETH && !(is_backlight_enabled())){ + backlight_enable_breathing(); + DIS_BRETH = 0; + } + } + return true; + + case BL_BRTG: + if (record->event.pressed){ + if(DIS_BRETH || !(is_backlight_enabled())) { + return false; + } + } + return true; + + case BL_UP: + DIS_BRETH = 0; + return true; + + case BL_DOWN: + if (record->event.pressed){ + if(DIS_BRETH || !(is_backlight_enabled())) { + return false; + } + } + return true; + + default: + return true; + } + s_serial_to_parallel(IND); +} + +void suspend_power_down_kb() { + gpio_write_pin_high(WIN_LOCK_PIN); + s_serial_to_parallel(0); + suspend_power_down_user(); +} + +void suspend_wakeup_init_kb() { + s_serial_to_parallel(IND); + suspend_wakeup_init_user(); +} + +bool shutdown_kb(bool jump_to_bootloader) { + gpio_write_pin_high(WIN_LOCK_PIN); + s_serial_to_parallel(0); + return true; +} + +layer_state_t default_layer_state_set_kb(layer_state_t state) { + switch (get_highest_layer(state)) { + case 0: + //switch to win layer display + IND = IND & (~MAC_ON); + IND = IND | WIN_ON; + break; + case 1: + //switch to mac layer display + IND = IND & (~WIN_ON); + IND = IND | MAC_ON; + break; + } + s_serial_to_parallel(IND); + return state; +} + + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { + //caps lock display + if (led_state.caps_lock) { + IND = IND | CAPS_ON; + } else { + IND = IND & (~CAPS_ON); + } + //number lock display + if (led_state.num_lock) { + IND = IND | NUM_ON; + } else { + IND = IND & (~NUM_ON); + } + //scroll lock display + if (led_state.scroll_lock) { + IND = IND | SCR_ON; + } else { + IND = IND & (~SCR_ON); + } + } + s_serial_to_parallel(IND); + return true; +} + + +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; + gpio_set_pin_output(WIN_LOCK_PIN); + gpio_write_pin_high(WIN_LOCK_PIN); + s_serial_to_parallel(0xFF); + IND = SKYLOONG; +} + diff --git a/keyboards/skyloong/gk87/bl_pro/config.h b/keyboards/skyloong/gk87/bl_pro/config.h new file mode 100644 index 00000000000..440438337d1 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/config.h @@ -0,0 +1,12 @@ +// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define WIN_LOCK_PIN C13 + +#ifdef ENCODER_ENABLE +# define ENCODER_MAP_KEY_DELAY 10 +#endif + + diff --git a/keyboards/skyloong/gk87/bl_pro/halconf.h b/keyboards/skyloong/gk87/bl_pro/halconf.h new file mode 100644 index 00000000000..8dbffbf1b22 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/halconf.h @@ -0,0 +1,6 @@ +// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#define HAL_USE_PWM TRUE +#include_next diff --git a/keyboards/skyloong/gk87/bl_pro/info.json b/keyboards/skyloong/gk87/bl_pro/info.json new file mode 100644 index 00000000000..ee36aa7800b --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/info.json @@ -0,0 +1,59 @@ +{ + "manufacturer": "skyloong", + "maintainer": "NaturalZh", + "bootloader": "stm32duino", + "debounce": 10, + "build": { + "debounce_type": "asym_eager_defer_pk" + }, + "eeprom": { + "wear_leveling": { + "backing_size": 4096 + } + }, + "encoder": { + "rotary": [ + {"pin_a": "B6", "pin_b": "B7"} + ] + }, + "features": { + "bootmagic": true, + "command": true, + "dip_switch": true, + "encoder": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "backlight": true + }, + "indicators": { + "scroll_lock": "C14", + "on_state": 0, + "caps_lock": "C15" + }, + "dip_switch":{ + "pins":["A15"] + }, + "matrix_pins": { + "cols": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,null], + "rows": ["A0", "A1", "A2", "A3", "A4", "B0"] + }, + "backlight": { + "breathing": true, + "breathing_period": 5, + "default": { + "breathing": false + }, + "driver": "pwm", + "levels": 20, + "on_state": 1, + "pin": "B8" + }, + "processor": "STM32F103", + "url": "https://www.skyloong.vip", + "usb": { + "max_power": 380, + "vid": "0x1EA7" + } + +} diff --git a/keyboards/skyloong/gk87/bl_pro/led_hc595.c b/keyboards/skyloong/gk87/bl_pro/led_hc595.c new file mode 100644 index 00000000000..a8b16be089a --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/led_hc595.c @@ -0,0 +1,80 @@ +// 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 + +/* + *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 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(CLOCK_TIME); + data >>= 1; // Move the data one digit to the right + } +} + diff --git a/keyboards/skyloong/gk87/bl_pro/matrix.c b/keyboards/skyloong/gk87/bl_pro/matrix.c new file mode 100644 index 00000000000..ac28c1c8cb0 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/matrix.c @@ -0,0 +1,154 @@ +// Copyright 2023 NaturaZh (@NaturalZh) +// SPDX-License-Identifier: GPL-2.0-or-later +//Matrix read rows set col:DIODE_DIRECTION == ROW2COL + +#include +#include "atomic_util.h" +#include "debounce.h" + +#define ClOCK_TIME 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 { + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); + } +} + +static inline void setPinOutput_writeHigh(pin_t pin) { + ATOMIC_BLOCK_FORCEON { + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); + } +} + +static inline void setPinInputHigh_atomic(pin_t pin) { + ATOMIC_BLOCK_FORCEON { + gpio_set_pin_input_high(pin); + } +} + +static inline uint8_t readMatrixPin(pin_t pin) { + if (pin != NO_PIN) { + return (gpio_read_pin(pin) == MATRIX_INPUT_PRESSED_STATE) ? 0 : 1; + } else { + return 1; + } +} + +static inline void clockPulse(uint16_t n) { + gpio_write_pin_high(HC595_SH_PIN); + gpio_write_pin_high(HC595_ST_PIN); + select_delay(n); + gpio_write_pin_low(HC595_SH_PIN); + gpio_write_pin_low(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){ + gpio_write_pin_low(HC595_DS_PIN); + }else{ + gpio_write_pin_high(HC595_DS_PIN); + } + clockPulse(ClOCK_TIME); + } + 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(ClOCK_TIME); + } +} + +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(ClOCK_TIME); + } +} + +__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) { + matrix_init_pins(); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + 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(temp_matrix, current_col, row_shifter); + } + + bool changed = memcmp(raw_matrix, temp_matrix, sizeof(temp_matrix)) != 0; + if (changed) memcpy(raw_matrix, temp_matrix, sizeof(temp_matrix)); + + return changed; +} diff --git a/keyboards/skyloong/gk87/bl_pro/mcuconf.h b/keyboards/skyloong/gk87/bl_pro/mcuconf.h new file mode 100644 index 00000000000..d5a0f2ca135 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/mcuconf.h @@ -0,0 +1,10 @@ +// Copyright 2023 JZ-Skyloong (@JZ-Skyloong) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#include_next + +#undef STM32_PWM_USE_TIM4 +#define STM32_PWM_USE_TIM4 TRUE + + diff --git a/keyboards/skyloong/gk87/bl_pro/readme.md b/keyboards/skyloong/gk87/bl_pro/readme.md new file mode 100644 index 00000000000..dc0414f5952 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/readme.md @@ -0,0 +1,34 @@ +# GK104 Q1 Digital Indicator Keyboard + +![GK104 Q1 PCBAS](https://i.imgur.com/EPuSVUAh.jpeg) +![GK104 Q1 keyboard](https://i.imgur.com/fuswwLph.png) + +## The PCB features: +* QMK & VIA compatibility +* RGB Matrix backlight +* Mechanical switches Keyboard with LED display. + + +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 +* Hardware Availability: http://www.skyloong.com.cn https://skyloong.vip + +Make example for this keyboard (after setting up your build environment): + + make skyloong/gk104/q1/ansi:default + +Flashing example for this keyboard: + + 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). + +## 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 45aeb6a9eb1557b062dc0bd8c139eab7203c9748 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Fri, 10 May 2024 16:02:31 +0800 Subject: [PATCH 02/18] modified keyboards/skyloong/gk87/bl_pro/bl_pro.c --- keyboards/skyloong/gk87/bl_pro/bl_pro.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/keyboards/skyloong/gk87/bl_pro/bl_pro.c b/keyboards/skyloong/gk87/bl_pro/bl_pro.c index 8af16b98510..9fe44e30ce5 100644 --- a/keyboards/skyloong/gk87/bl_pro/bl_pro.c +++ b/keyboards/skyloong/gk87/bl_pro/bl_pro.c @@ -147,6 +147,8 @@ layer_state_t default_layer_state_set_kb(layer_state_t state) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { + gpio_write_pin(C15, !led_state.caps_lock); + gpio_write_pin(C14, !led_state.scroll_lock); //caps lock display if (led_state.caps_lock) { IND = IND | CAPS_ON; @@ -167,7 +169,7 @@ bool led_update_kb(led_t led_state) { } } s_serial_to_parallel(IND); - return true; + return res; } From 5e55eadce5f73e5635d64508b4504f90e37dd8ab Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Mon, 13 May 2024 14:56:31 +0800 Subject: [PATCH 03/18] update skyloong/gk87/bl_pro/bl.c to Correct indicators when suspended --- keyboards/skyloong/gk87/bl_pro/bl_pro.c | 27 +++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/keyboards/skyloong/gk87/bl_pro/bl_pro.c b/keyboards/skyloong/gk87/bl_pro/bl_pro.c index 9fe44e30ce5..71b565deacc 100644 --- a/keyboards/skyloong/gk87/bl_pro/bl_pro.c +++ b/keyboards/skyloong/gk87/bl_pro/bl_pro.c @@ -11,6 +11,7 @@ uint8_t IND = 0; //buffer of LED Display int FN_ON = 0; bool WIN_LOCK = 0; bool DIS_BRETH = 0; +bool SLEEP = 0; bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if (!process_record_user(keycode, record)) { @@ -110,19 +111,21 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } void suspend_power_down_kb() { - gpio_write_pin_high(WIN_LOCK_PIN); - s_serial_to_parallel(0); + SLEEP = 1; suspend_power_down_user(); } void suspend_wakeup_init_kb() { + SLEEP = 0; + gpio_write_pin(LED_CAPS_LOCK_PIN, !host_keyboard_led_state().caps_lock); + gpio_write_pin(LED_SCROLL_LOCK_PIN, !host_keyboard_led_state().scroll_lock); + gpio_write_pin(WIN_LOCK_PIN, !WIN_LOCK); s_serial_to_parallel(IND); suspend_wakeup_init_user(); } bool shutdown_kb(bool jump_to_bootloader) { - gpio_write_pin_high(WIN_LOCK_PIN); - s_serial_to_parallel(0); + SLEEP = 1; return true; } @@ -143,17 +146,23 @@ layer_state_t default_layer_state_set_kb(layer_state_t state) { return state; } - bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); + if(SLEEP){ + gpio_write_pin_high(LED_CAPS_LOCK_PIN); + gpio_write_pin_high(LED_SCROLL_LOCK_PIN); + gpio_write_pin_high(WIN_LOCK_PIN); + s_serial_to_parallel(0); + return false; + } if(res) { - gpio_write_pin(C15, !led_state.caps_lock); - gpio_write_pin(C14, !led_state.scroll_lock); //caps lock display if (led_state.caps_lock) { IND = IND | CAPS_ON; + gpio_write_pin_low(LED_CAPS_LOCK_PIN); } else { IND = IND & (~CAPS_ON); + gpio_write_pin_high(LED_CAPS_LOCK_PIN); } //number lock display if (led_state.num_lock) { @@ -164,15 +173,16 @@ bool led_update_kb(led_t led_state) { //scroll lock display if (led_state.scroll_lock) { IND = IND | SCR_ON; + gpio_write_pin_low(LED_SCROLL_LOCK_PIN); } else { IND = IND & (~SCR_ON); + gpio_write_pin_high(LED_SCROLL_LOCK_PIN); } } s_serial_to_parallel(IND); return res; } - 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; @@ -180,5 +190,6 @@ void board_init(void) { gpio_write_pin_high(WIN_LOCK_PIN); s_serial_to_parallel(0xFF); IND = SKYLOONG; + SLEEP = 0; } From 6384035d1016b5effeaf56fa452a6a2f6f046e18 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Tue, 28 May 2024 18:59:27 +0800 Subject: [PATCH 04/18] modified skyloong/gk87/bl_pro/readme.md --- keyboards/skyloong/gk87/bl_pro/readme.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/keyboards/skyloong/gk87/bl_pro/readme.md b/keyboards/skyloong/gk87/bl_pro/readme.md index dc0414f5952..6503e0dbad3 100644 --- a/keyboards/skyloong/gk87/bl_pro/readme.md +++ b/keyboards/skyloong/gk87/bl_pro/readme.md @@ -1,7 +1,6 @@ -# GK104 Q1 Digital Indicator Keyboard +# GK87 backlight Digital Indicator Keyboard -![GK104 Q1 PCBAS](https://i.imgur.com/EPuSVUAh.jpeg) -![GK104 Q1 keyboard](https://i.imgur.com/fuswwLph.png) +![GK87 BL Pro PCBAS](https://i.imgur.com/Z9wxLYh.jpg) ## The PCB features: * QMK & VIA compatibility @@ -9,19 +8,19 @@ * Mechanical switches Keyboard with LED display. -The following is the QMK Firmware for the Destop 100% keylayout - designed by Dongguan Jizhi Electronic Technology Co., Ltd +The following is the QMK Firmware for the Destop 85% keylayout - designed by Dongguan Jizhi Electronic Technology Co., Ltd * Keyboard Maintainer: [NaturalZh](https://github.com/NaturalZh) -* Hardware Supported: DestopPCB for Skyloong keylayout 100%, STM32F103C8T6 +* 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/gk104/q1/ansi:default + make skyloong/gk87/bl_pro/ansi:default Flashing example for this keyboard: - make skyloong/gk104/q1/ansi:default:flash + make skyloong/gk87/bl_pro/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 fc4952f8b8b214176fccaf70b97e30004e3cc719 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Sat, 13 Jul 2024 15:57:08 +0800 Subject: [PATCH 05/18] update skyloong/gk87/bl_pro/led_hc595.c --- keyboards/skyloong/gk87/bl_pro/led_hc595.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/keyboards/skyloong/gk87/bl_pro/led_hc595.c b/keyboards/skyloong/gk87/bl_pro/led_hc595.c index a8b16be089a..bb45a9d822c 100644 --- a/keyboards/skyloong/gk87/bl_pro/led_hc595.c +++ b/keyboards/skyloong/gk87/bl_pro/led_hc595.c @@ -37,15 +37,15 @@ 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); } } @@ -56,11 +56,11 @@ 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 @@ -69,9 +69,9 @@ static void s_serial_to_parallel(uint8_t data) { // Serial port to parallel port setPinOutput_writeLow(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 From 22e59a56a91cef2d2f67d04dd980fed1e5c574ea Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Sat, 13 Jul 2024 17:23:23 +0800 Subject: [PATCH 06/18] update skyloong/gk87/bl_pro/ansi --- .../skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c | 6 +++--- keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c index 561b30551a3..a9119bf8430 100644 --- a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c +++ b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c @@ -29,7 +29,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, KC_PSCR, - _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_UP, @@ -38,7 +38,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, KC_PSCR, - _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_UP, @@ -57,7 +57,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/gk87/bl_pro/ansi/keymaps/via/keymap.c b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c index 4501f9b7f86..4c8a2257bcc 100644 --- a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c +++ b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/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, BL_TOGG, - _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_UP, @@ -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, BL_TOGG, - _______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_UP, @@ -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 From 71cf1d0e94a838790ca8ddd1cd1e378635041b52 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Mon, 15 Jul 2024 15:46:46 +0800 Subject: [PATCH 07/18] update skyloong/gk87/bl_pro/led_hc595.c --- keyboards/skyloong/gk87/bl_pro/led_hc595.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/keyboards/skyloong/gk87/bl_pro/led_hc595.c b/keyboards/skyloong/gk87/bl_pro/led_hc595.c index bb45a9d822c..27a10d4d147 100644 --- a/keyboards/skyloong/gk87/bl_pro/led_hc595.c +++ b/keyboards/skyloong/gk87/bl_pro/led_hc595.c @@ -35,14 +35,14 @@ #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 { 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); @@ -64,9 +64,9 @@ static inline void clockPulse(uint16_t n) { } 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){ gpio_write_pin_high(HC595_DS); From d85b81ae5a50086351e465b3eaffdd7d2989d395 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Thu, 8 Aug 2024 10:44:50 +0800 Subject: [PATCH 08/18] movied skyloong/gk87/bl_pro/readme.md to skyloong/gk87/bl_pro/ansi folder --- keyboards/skyloong/gk87/bl_pro/{ => ansi}/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename keyboards/skyloong/gk87/bl_pro/{ => ansi}/readme.md (95%) diff --git a/keyboards/skyloong/gk87/bl_pro/readme.md b/keyboards/skyloong/gk87/bl_pro/ansi/readme.md similarity index 95% rename from keyboards/skyloong/gk87/bl_pro/readme.md rename to keyboards/skyloong/gk87/bl_pro/ansi/readme.md index 6503e0dbad3..b01150c176a 100644 --- a/keyboards/skyloong/gk87/bl_pro/readme.md +++ b/keyboards/skyloong/gk87/bl_pro/ansi/readme.md @@ -1,6 +1,6 @@ # GK87 backlight Digital Indicator Keyboard -![GK87 BL Pro PCBAS](https://i.imgur.com/Z9wxLYh.jpg) +![GK87 BL Pro ansi PCBAS](https://i.imgur.com/Z9wxLYh.jpg) ## The PCB features: * QMK & VIA compatibility From 79cde131e9b48f7eb5e19515b7bebb1870aead67 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Mon, 28 Oct 2024 17:03:47 +0800 Subject: [PATCH 09/18] update skyloong/gk87/bl_pro --- .../gk87/bl_pro/ansi/keymaps/via/keymap.c | 64 ------------------- .../gk87/bl_pro/ansi/keymaps/via/rules.mk | 3 - keyboards/skyloong/gk87/bl_pro/ansi/readme.md | 2 +- keyboards/skyloong/gk87/bl_pro/ansi/rules.mk | 1 + keyboards/skyloong/gk87/bl_pro/bl_pro.c | 5 +- keyboards/skyloong/gk87/bl_pro/config.h | 4 +- keyboards/skyloong/gk87/bl_pro/info.json | 4 -- keyboards/skyloong/gk87/bl_pro/led_hc595.c | 24 +------ keyboards/skyloong/gk87/bl_pro/led_hc595.h | 31 +++++++++ keyboards/skyloong/gk87/bl_pro/matrix.c | 1 - 10 files changed, 40 insertions(+), 99 deletions(-) delete mode 100644 keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c delete mode 100644 keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/rules.mk create mode 100644 keyboards/skyloong/gk87/bl_pro/led_hc595.h diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c deleted file mode 100644 index 4c8a2257bcc..00000000000 --- a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/keymap.c +++ /dev/null @@ -1,64 +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_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_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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_WIN_INDEX), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT - ), - - [_MAC] = LAYOUT_all( - _______, 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_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_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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RCMD, MO(_MAC_INDEX), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT - ), - - [_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, BL_TOGG, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_UP, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, BL_DOWN, KC_RGHT - ), - - [_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, BL_TOGG, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_BRTG, BL_BRTG, KC_DEL, KC_INS, KC_HOME, KC_PGUP, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_UP, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, BL_DOWN, KC_RGHT - ) -}; - -#if defined(ENCODER_MAP_ENABLE) -const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { - [_WIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [_MAC] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [_WIN_INDEX] = { ENCODER_CCW_CW(BL_DOWN, BL_UP)}, - [_MAC_INDEX] = { ENCODER_CCW_CW(BL_DOWN, BL_UP)} -}; -#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 - diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/rules.mk b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/rules.mk deleted file mode 100644 index 8dfffa9d795..00000000000 --- a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/via/rules.mk +++ /dev/null @@ -1,3 +0,0 @@ -ENCODER_MAP_ENABLE = yes -DIP_SWITCH_MAP_ENABLE = yes -VIA_ENABLE = yes diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/readme.md b/keyboards/skyloong/gk87/bl_pro/ansi/readme.md index b01150c176a..a8e88b55438 100644 --- a/keyboards/skyloong/gk87/bl_pro/ansi/readme.md +++ b/keyboards/skyloong/gk87/bl_pro/ansi/readme.md @@ -12,7 +12,7 @@ The following is the QMK Firmware for the Destop 85% keylayout - designed by Do * Keyboard Maintainer: [NaturalZh](https://github.com/NaturalZh) * Hardware Supported: DestopPCB for Skyloong keylayout 85%, 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) Make example for this keyboard (after setting up your build environment): diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/rules.mk b/keyboards/skyloong/gk87/bl_pro/ansi/rules.mk index 6aebeff05a8..a937045e0d0 100644 --- a/keyboards/skyloong/gk87/bl_pro/ansi/rules.mk +++ b/keyboards/skyloong/gk87/bl_pro/ansi/rules.mk @@ -1,2 +1,3 @@ CUSTOM_MATRIX = lite SRC += matrix.c + SRC += led_hc595.c diff --git a/keyboards/skyloong/gk87/bl_pro/bl_pro.c b/keyboards/skyloong/gk87/bl_pro/bl_pro.c index 71b565deacc..dc7e1c55b81 100644 --- a/keyboards/skyloong/gk87/bl_pro/bl_pro.c +++ b/keyboards/skyloong/gk87/bl_pro/bl_pro.c @@ -1,11 +1,8 @@ // Copyright 2023 NaturalZh (@NaturalZh) // SPDX-License-Identifier: GPL-2.0-or-later #include "quantum.h" +#include "led_hc595.h" -#define HC595_ST_PIN B5 //74HC595 storage register clock input -#define HC595_SH_PIN B4 //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; diff --git a/keyboards/skyloong/gk87/bl_pro/config.h b/keyboards/skyloong/gk87/bl_pro/config.h index 440438337d1..613399ac40c 100644 --- a/keyboards/skyloong/gk87/bl_pro/config.h +++ b/keyboards/skyloong/gk87/bl_pro/config.h @@ -9,4 +9,6 @@ # define ENCODER_MAP_KEY_DELAY 10 #endif - +#define MATRIX_ROWS 6 +#define MATRIX_COLS 16 +#define MATRIX_ROW_PINS {A0, A1, A2, A3, A4, B0} diff --git a/keyboards/skyloong/gk87/bl_pro/info.json b/keyboards/skyloong/gk87/bl_pro/info.json index ee36aa7800b..9ae829a3900 100644 --- a/keyboards/skyloong/gk87/bl_pro/info.json +++ b/keyboards/skyloong/gk87/bl_pro/info.json @@ -34,10 +34,6 @@ "dip_switch":{ "pins":["A15"] }, - "matrix_pins": { - "cols": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,null], - "rows": ["A0", "A1", "A2", "A3", "A4", "B0"] - }, "backlight": { "breathing": true, "breathing_period": 5, diff --git a/keyboards/skyloong/gk87/bl_pro/led_hc595.c b/keyboards/skyloong/gk87/bl_pro/led_hc595.c index 27a10d4d147..0a68b4e0f1a 100644 --- a/keyboards/skyloong/gk87/bl_pro/led_hc595.c +++ b/keyboards/skyloong/gk87/bl_pro/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/gk87/bl_pro/led_hc595.h b/keyboards/skyloong/gk87/bl_pro/led_hc595.h new file mode 100644 index 00000000000..9e47f41a4e9 --- /dev/null +++ b/keyboards/skyloong/gk87/bl_pro/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/gk87/bl_pro/matrix.c b/keyboards/skyloong/gk87/bl_pro/matrix.c index ac28c1c8cb0..6515b1c39a5 100644 --- a/keyboards/skyloong/gk87/bl_pro/matrix.c +++ b/keyboards/skyloong/gk87/bl_pro/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); From 4c291dba9339730c56546e9c542f67fa7fc948b6 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Mon, 28 Oct 2024 20:02:06 +0800 Subject: [PATCH 10/18] update skyloong/gk87/bl_pro/ansi/keyboard.json --- .../skyloong/gk87/bl_pro/ansi/keyboard.json | 95 ------------------- 1 file changed, 95 deletions(-) diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/keyboard.json b/keyboards/skyloong/gk87/bl_pro/ansi/keyboard.json index bad3b7f3f51..135bd44800b 100644 --- a/keyboards/skyloong/gk87/bl_pro/ansi/keyboard.json +++ b/keyboards/skyloong/gk87/bl_pro/ansi/keyboard.json @@ -4,7 +4,6 @@ "device_version": "1.0.0", "pid": "0x6A8A" }, - "community_layouts": ["tkl_ansi"], "layouts": { "LAYOUT_all": { "layout": [ @@ -102,100 +101,6 @@ {"label": "Right", "matrix": [5, 15], "x": 17.25, "y": 5.25} ] }, - "LAYOUT_tkl_ansi": { - "layout": [ - {"label": "ESC", "matrix": [0, 0], "x": 0, "y": 0}, - {"label": "F1", "matrix": [0, 2], "x": 2, "y": 0}, - {"label": "F2", "matrix": [0, 3], "x": 3, "y": 0}, - {"label": "F3", "matrix": [0, 4], "x": 4, "y": 0}, - {"label": "F4", "matrix": [0, 5], "x": 5, "y": 0}, - {"label": "F5", "matrix": [0, 6], "x": 6.5, "y": 0}, - {"label": "F6", "matrix": [0, 7], "x": 7.5, "y": 0}, - {"label": "F7", "matrix": [0, 8], "x": 8.5, "y": 0}, - {"label": "F8", "matrix": [0, 9], "x": 9.5, "y": 0}, - {"label": "F9", "matrix": [0, 10], "x": 11, "y": 0}, - {"label": "F10", "matrix": [0, 11], "x": 12, "y": 0}, - {"label": "F11", "matrix": [0, 12], "x": 13, "y": 0}, - {"label": "F12", "matrix": [0, 13], "x": 14, "y": 0}, - {"label": "PrtSc", "matrix": [0, 14], "x": 15.25, "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": [1, 11], "x": 11, "y": 1.25}, - {"label": "=+", "matrix": [1, 12], "x": 12, "y": 1.25}, - {"label": "BS", "matrix": [1, 13], "x": 13, "y": 1.25, "w": 2}, - {"label": "Ins", "matrix": [1, 14], "x": 15.25, "y": 1.25}, - {"label": "Home", "matrix": [1, 15], "x": 16.25, "y": 1.25}, - {"label": "PgUp", "matrix": [3, 15], "x": 17.25, "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": [2, 11], "x": 11.5, "y": 2.25}, - {"label": "]", "matrix": [2, 12], "x": 12.5, "y": 2.25}, - {"label": "|", "matrix": [2, 13], "x": 13.5, "y": 2.25, "w": 1.5}, - {"label": "Del", "matrix": [2, 14], "x": 15.25, "y": 2.25}, - {"label": "End", "matrix": [2, 15], "x": 16.25, "y": 2.25}, - {"label": "PgDn", "matrix": [4, 15], "x": 17.25, "y": 2.25}, - - {"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": [3, 11], "x": 11.75, "y": 3.25}, - {"label": "Ent", "matrix": [3, 12], "x": 12.75, "y": 3.25, "w": 2.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": [4, 12], "x": 12.25, "y": 4.25, "w": 2.75}, - {"label": "Up", "matrix": [4, 14], "x": 16.25, "y": 4.25}, - - {"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": [5, 2], "x": 2.5, "y": 5.25, "w": 1.25}, - {"label": "SPAC", "matrix": [5, 5], "x": 3.75, "y": 5.25, "w": 6.25}, - {"label": "Alt", "matrix": [5, 9], "x": 10, "y": 5.25, "w": 1.25}, - {"label": "Menu", "matrix": [5, 10], "x": 11.25, "y": 5.25, "w": 1.25}, - {"label": "Ctrl", "matrix": [5, 11], "x": 12.5, "y": 5.25, "w": 1.25}, - {"label": "Fn", "matrix": [5, 12], "x": 13.75, "y": 5.25, "w": 1.25}, - {"label": "Left", "matrix": [5, 13], "x": 15.25, "y": 5.25}, - {"label": "Down", "matrix": [5, 14], "x": 16.25, "y": 5.25}, - {"label": "Right", "matrix": [5, 15], "x": 17.25, "y": 5.25} - ] - }, "LAYOUT_ansi_split_space": { "layout": [ {"label": "ESC", "matrix": [0, 0], "x": 0, "y": 0}, From 0086ead3ee38898ec5cf20db5d6bf3666fdfd1c3 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:46:19 +0800 Subject: [PATCH 11/18] Update keyboards/skyloong/gk87/bl_pro/ansi/readme.md Thank you for correcting "desktop" word. Co-authored-by: 9R --- keyboards/skyloong/gk87/bl_pro/ansi/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/readme.md b/keyboards/skyloong/gk87/bl_pro/ansi/readme.md index a8e88b55438..32d5429a830 100644 --- a/keyboards/skyloong/gk87/bl_pro/ansi/readme.md +++ b/keyboards/skyloong/gk87/bl_pro/ansi/readme.md @@ -8,7 +8,7 @@ * Mechanical switches Keyboard with LED display. -The following is the QMK Firmware for the Destop 85% keylayout - designed by Dongguan Jizhi Electronic Technology Co., Ltd +The following is the QMK Firmware for the Desktop 85% keylayout - designed by Dongguan Jizhi Electronic Technology Co., Ltd * Keyboard Maintainer: [NaturalZh](https://github.com/NaturalZh) * Hardware Supported: DestopPCB for Skyloong keylayout 85%, STM32F103C8T6 From 9fdff453d54e00e22eb5189b4f69e49eed59b3a9 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:46:47 +0800 Subject: [PATCH 12/18] Update keyboards/skyloong/gk87/bl_pro/ansi/readme.md OK, Thank you. Co-authored-by: 9R --- keyboards/skyloong/gk87/bl_pro/ansi/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/readme.md b/keyboards/skyloong/gk87/bl_pro/ansi/readme.md index 32d5429a830..fcebcdf9ee0 100644 --- a/keyboards/skyloong/gk87/bl_pro/ansi/readme.md +++ b/keyboards/skyloong/gk87/bl_pro/ansi/readme.md @@ -11,7 +11,7 @@ The following is the QMK Firmware for the Desktop 85% keylayout - designed by Dongguan Jizhi Electronic Technology Co., Ltd * Keyboard Maintainer: [NaturalZh](https://github.com/NaturalZh) -* Hardware Supported: DestopPCB for Skyloong keylayout 85%, STM32F103C8T6 +* Hardware Supported: DesktopPCB for Skyloong keylayout 85%, STM32F103C8T6 * Hardware Availability: [Skyloong CN](http://www.skyloong.com.cn) & [Skyloong HK](https://skyloongtech.com) Make example for this keyboard (after setting up your build environment): From 6dffbba5c71a434c987ccc81e0760a4df977c277 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Tue, 26 Nov 2024 15:19:04 +0800 Subject: [PATCH 13/18] update skyloong/gk87/bl_pro --- .../skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c | 6 +++--- keyboards/skyloong/gk87/bl_pro/led_hc595.h | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c index a9119bf8430..89249d21f55 100644 --- a/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c +++ b/keyboards/skyloong/gk87/bl_pro/ansi/keymaps/default/keymap.c @@ -50,14 +50,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [_WIN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, [_MAC] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [_WIN_INDEX] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI)}, - [_MAC_INDEX] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI)} + [_WIN_INDEX] = { ENCODER_CCW_CW(BL_DOWN, BL_UP)}, + [_MAC_INDEX] = { ENCODER_CCW_CW(BL_DOWN, BL_UP)} }; #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)), + DIP_SWITCH_OFF_ON(DF(0), DF(1)) }; #endif diff --git a/keyboards/skyloong/gk87/bl_pro/led_hc595.h b/keyboards/skyloong/gk87/bl_pro/led_hc595.h index 9e47f41a4e9..e15ea30bcfe 100644 --- a/keyboards/skyloong/gk87/bl_pro/led_hc595.h +++ b/keyboards/skyloong/gk87/bl_pro/led_hc595.h @@ -1,12 +1,10 @@ // 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_ST_PIN B5 //74HC595 storage register clock input +#define HC595_SH_PIN B4 //74HC595 shift register clock input #define HC595_DS B3 // 74HC595 serial data input /* From 9e4a02993d90c85d1a9c27288240ebaa5f422da5 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Mon, 13 Jan 2025 10:27:44 +0800 Subject: [PATCH 14/18] update skyloong/gk87/bl_pro/bl_pro.c --- keyboards/skyloong/gk87/bl_pro/bl_pro.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keyboards/skyloong/gk87/bl_pro/bl_pro.c b/keyboards/skyloong/gk87/bl_pro/bl_pro.c index dc7e1c55b81..22f8cf07329 100644 --- a/keyboards/skyloong/gk87/bl_pro/bl_pro.c +++ b/keyboards/skyloong/gk87/bl_pro/bl_pro.c @@ -60,11 +60,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; @@ -140,7 +140,7 @@ layer_state_t default_layer_state_set_kb(layer_state_t state) { break; } s_serial_to_parallel(IND); - return state; + return default_layer_state_set_user(state); } bool led_update_kb(led_t led_state) { From 927d80bec89b42b422b05ec8e425f31196b4099e Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Mon, 28 Apr 2025 19:24:57 +0800 Subject: [PATCH 15/18] Update keyboards/skyloong/gk87/bl_pro/bl_pro.c Ok, I get it. Thank you. Co-authored-by: Drashna Jaelre --- keyboards/skyloong/gk87/bl_pro/bl_pro.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/keyboards/skyloong/gk87/bl_pro/bl_pro.c b/keyboards/skyloong/gk87/bl_pro/bl_pro.c index 22f8cf07329..9c49506e330 100644 --- a/keyboards/skyloong/gk87/bl_pro/bl_pro.c +++ b/keyboards/skyloong/gk87/bl_pro/bl_pro.c @@ -60,14 +60,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } return true; // continue all further processing of this key - case DF(0): - set_single_persistent_default_layer(0); - return true; - - case DF(1): - set_single_persistent_default_layer(1); - return true; - case BL_TOGG: if (record->event.pressed){ if(is_backlight_breathing()) { From 4037318809e6d5ee8891d96046812bb78ff62d48 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Mon, 28 Apr 2025 19:26:07 +0800 Subject: [PATCH 16/18] Update keyboards/skyloong/gk87/bl_pro/bl_pro.c OK, I get it. Thanks. Co-authored-by: Drashna Jaelre --- keyboards/skyloong/gk87/bl_pro/bl_pro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/skyloong/gk87/bl_pro/bl_pro.c b/keyboards/skyloong/gk87/bl_pro/bl_pro.c index 9c49506e330..9b820f99f6b 100644 --- a/keyboards/skyloong/gk87/bl_pro/bl_pro.c +++ b/keyboards/skyloong/gk87/bl_pro/bl_pro.c @@ -108,7 +108,7 @@ void suspend_wakeup_init_kb() { SLEEP = 0; gpio_write_pin(LED_CAPS_LOCK_PIN, !host_keyboard_led_state().caps_lock); gpio_write_pin(LED_SCROLL_LOCK_PIN, !host_keyboard_led_state().scroll_lock); - gpio_write_pin(WIN_LOCK_PIN, !WIN_LOCK); + gpio_write_pin(WIN_LOCK_PIN, !keycode_config.no_gui); s_serial_to_parallel(IND); suspend_wakeup_init_user(); } From a4a3a6d7d3ed846ac51c18391e45ab84d20dd2e0 Mon Sep 17 00:00:00 2001 From: JIKEDINGZHI <52481939+NaturalZh@users.noreply.github.com> Date: Mon, 28 Apr 2025 19:29:09 +0800 Subject: [PATCH 17/18] Update keyboards/skyloong/gk87/bl_pro/bl_pro.c OK, I agree with you. Thank you for your advice. Co-authored-by: Drashna Jaelre --- keyboards/skyloong/gk87/bl_pro/bl_pro.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keyboards/skyloong/gk87/bl_pro/bl_pro.c b/keyboards/skyloong/gk87/bl_pro/bl_pro.c index 9b820f99f6b..5c62eeb39b0 100644 --- a/keyboards/skyloong/gk87/bl_pro/bl_pro.c +++ b/keyboards/skyloong/gk87/bl_pro/bl_pro.c @@ -119,6 +119,7 @@ bool shutdown_kb(bool jump_to_bootloader) { } layer_state_t default_layer_state_set_kb(layer_state_t state) { + state = default_layer_state_set_user(state); switch (get_highest_layer(state)) { case 0: //switch to win layer display @@ -132,7 +133,7 @@ layer_state_t default_layer_state_set_kb(layer_state_t state) { break; } s_serial_to_parallel(IND); - return default_layer_state_set_user(state); + return state; } bool led_update_kb(led_t led_state) { From dc2a22fbda8e4932e537c7cfc8ca842485805e18 Mon Sep 17 00:00:00 2001 From: NaturalZh Date: Wed, 7 May 2025 15:28:29 +0800 Subject: [PATCH 18/18] update skyloong/gk87/bl_pro --- keyboards/skyloong/gk87/bl_pro/bl_pro.c | 32 ++++------------------ keyboards/skyloong/gk87/bl_pro/led_hc595.c | 24 ++++++++-------- keyboards/skyloong/gk87/bl_pro/led_hc595.h | 6 ++-- keyboards/skyloong/gk87/bl_pro/matrix.c | 28 +++++++++---------- 4 files changed, 35 insertions(+), 55 deletions(-) diff --git a/keyboards/skyloong/gk87/bl_pro/bl_pro.c b/keyboards/skyloong/gk87/bl_pro/bl_pro.c index 5c62eeb39b0..6fcec122422 100644 --- a/keyboards/skyloong/gk87/bl_pro/bl_pro.c +++ b/keyboards/skyloong/gk87/bl_pro/bl_pro.c @@ -10,37 +10,17 @@ bool WIN_LOCK = 0; bool DIS_BRETH = 0; bool SLEEP = 0; +static bool is_function_layer_on(void) { + return (layer_state_is(2) || layer_state_is(3)); +} + bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if (!process_record_user(keycode, record)) { return false; } switch (keycode) { - 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 (is_function_layer_on() ){ if ( record->event.pressed){ WIN_LOCK = !WIN_LOCK ; //change win lock state } @@ -108,7 +88,7 @@ void suspend_wakeup_init_kb() { SLEEP = 0; gpio_write_pin(LED_CAPS_LOCK_PIN, !host_keyboard_led_state().caps_lock); gpio_write_pin(LED_SCROLL_LOCK_PIN, !host_keyboard_led_state().scroll_lock); - gpio_write_pin(WIN_LOCK_PIN, !keycode_config.no_gui); + gpio_write_pin(WIN_LOCK_PIN, !WIN_LOCK); s_serial_to_parallel(IND); suspend_wakeup_init_user(); } diff --git a/keyboards/skyloong/gk87/bl_pro/led_hc595.c b/keyboards/skyloong/gk87/bl_pro/led_hc595.c index 0a68b4e0f1a..eac8f21454a 100644 --- a/keyboards/skyloong/gk87/bl_pro/led_hc595.c +++ b/keyboards/skyloong/gk87/bl_pro/led_hc595.c @@ -2,15 +2,15 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "led_hc595.h" -#ifndef HC595_ST_PIN +#ifndef LED_HC595_ST_PIN # error hc595: no storage register clock pins defined! #endif -#ifndef HC595_SH_PIN +#ifndef LED_HC595_SH_PIN # error hc595: no shift register clock pins defined! #endif -#ifndef HC595_DS +#ifndef LED_HC595_DS_PIN # error hc595: no serial data input pins defined! #endif @@ -37,23 +37,23 @@ static inline void select_delay(uint16_t n) { } static inline void clockPulse(uint16_t n) { - gpio_write_pin_high(HC595_SH_PIN); - gpio_write_pin_high(HC595_ST_PIN); + gpio_write_pin_high(LED_HC595_SH_PIN); + gpio_write_pin_high(LED_HC595_ST_PIN); select_delay(n); - gpio_write_pin_low(HC595_SH_PIN); - gpio_write_pin_low(HC595_ST_PIN); + gpio_write_pin_low(LED_HC595_SH_PIN); + gpio_write_pin_low(LED_HC595_ST_PIN); } 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); + gpio_set_pin_output_write_low(LED_HC595_DS_PIN); + gpio_set_pin_output_write_low(LED_HC595_SH_PIN); + gpio_set_pin_output_write_low(LED_HC595_ST_PIN); for(uint8_t i = 0; i < 8; i++) { if(data & 0x01){ - gpio_write_pin_high(HC595_DS); + gpio_write_pin_high(LED_HC595_DS_PIN); }else{ - gpio_write_pin_low(HC595_DS); + gpio_write_pin_low(LED_HC595_DS_PIN); } clockPulse(CLOCK_TIME); data >>= 1; // Move the data one digit to the right diff --git a/keyboards/skyloong/gk87/bl_pro/led_hc595.h b/keyboards/skyloong/gk87/bl_pro/led_hc595.h index e15ea30bcfe..f205f3e9731 100644 --- a/keyboards/skyloong/gk87/bl_pro/led_hc595.h +++ b/keyboards/skyloong/gk87/bl_pro/led_hc595.h @@ -3,9 +3,9 @@ #include "atomic_util.h" #include "gpio.h" -#define HC595_ST_PIN B5 //74HC595 storage register clock input -#define HC595_SH_PIN B4 //74HC595 shift register clock input -#define HC595_DS B3 // 74HC595 serial data input +#define LED_HC595_ST_PIN B5 //74HC595 storage register clock input +#define LED_HC595_SH_PIN B4 //74HC595 shift register clock input +#define LED_HC595_DS_PIN B3 // 74HC595 serial data input /* *LED display driver.74HC595 Serial to parallel control LED field on/off. diff --git a/keyboards/skyloong/gk87/bl_pro/matrix.c b/keyboards/skyloong/gk87/bl_pro/matrix.c index 6515b1c39a5..7448ce86a55 100644 --- a/keyboards/skyloong/gk87/bl_pro/matrix.c +++ b/keyboards/skyloong/gk87/bl_pro/matrix.c @@ -9,9 +9,9 @@ #define ClOCK_TIME 15 #define MATRIX_INPUT_PRESSED_STATE 0 -#define HC595_ST_PIN A6 -#define HC595_SH_PIN A5 -#define HC595_DS_PIN A7 //定义74HC595的串口数据输入端 +#define MATRIX_HC595_ST_PIN A6 +#define MATRIX_HC595_SH_PIN A5 +#define MATRIX_HC595_DS_PIN A7 //定义74HC595的串口数据输入端 /* matrix state(1:on, 0:off) */ extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values @@ -57,22 +57,22 @@ static inline uint8_t readMatrixPin(pin_t pin) { } static inline void clockPulse(uint16_t n) { - gpio_write_pin_high(HC595_SH_PIN); - gpio_write_pin_high(HC595_ST_PIN); + gpio_write_pin_high(MATRIX_HC595_SH_PIN); + gpio_write_pin_high(MATRIX_HC595_ST_PIN); select_delay(n); - gpio_write_pin_low(HC595_SH_PIN); - gpio_write_pin_low(HC595_ST_PIN); + gpio_write_pin_low(MATRIX_HC595_SH_PIN); + gpio_write_pin_low(MATRIX_HC595_ST_PIN); } // matrix code static bool select_col(uint8_t col) { - setPinOutput_writeHigh(HC595_DS_PIN); + setPinOutput_writeHigh(MATRIX_HC595_DS_PIN); for (uint8_t m = 0; m <= col; m++) { if(m == 0){ - gpio_write_pin_low(HC595_DS_PIN); + gpio_write_pin_low(MATRIX_HC595_DS_PIN); }else{ - gpio_write_pin_high(HC595_DS_PIN); + gpio_write_pin_high(MATRIX_HC595_DS_PIN); } clockPulse(ClOCK_TIME); } @@ -82,16 +82,16 @@ 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); + setPinOutput_writeHigh(MATRIX_HC595_DS_PIN); for (uint8_t y = 0; y < x ; y++) { clockPulse(ClOCK_TIME); } } static void unselect_cols(void) { - setPinOutput_writeLow(HC595_SH_PIN); - setPinOutput_writeLow(HC595_ST_PIN); - setPinOutput_writeHigh(HC595_DS_PIN); + setPinOutput_writeLow(MATRIX_HC595_SH_PIN); + setPinOutput_writeLow(MATRIX_HC595_ST_PIN); + setPinOutput_writeHigh(MATRIX_HC595_DS_PIN); for (uint8_t x = 0; x < MATRIX_COLS; x++) { clockPulse(ClOCK_TIME); }