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