From ec78acae690ae8b6122132b810ce663604cd8b9b Mon Sep 17 00:00:00 2001 From: Islam Sharabash Date: Sun, 9 Jan 2022 11:57:08 -0800 Subject: [PATCH] [Keyboard] Adding Dygma Raise (#13543) Co-authored-by: Joel Challis Co-authored-by: Ryan Co-authored-by: Drashna Jaelre --- keyboards/handwired/dygma/raise/ansi/ansi.c | 81 ++ .../handwired/dygma/raise/ansi/info.json | 1115 +++++++++++++++++ keyboards/handwired/dygma/raise/ansi/rules.mk | 0 keyboards/handwired/dygma/raise/config.h | 34 + keyboards/handwired/dygma/raise/halconf.h | 21 + keyboards/handwired/dygma/raise/iso/info.json | 1115 +++++++++++++++++ keyboards/handwired/dygma/raise/iso/iso.c | 79 ++ keyboards/handwired/dygma/raise/iso/rules.mk | 0 .../dygma/raise/keymaps/ansi/keymap.c | 43 + .../dygma/raise/keymaps/ansi/readme.md | 1 + .../dygma/raise/keymaps/default/keymap.c | 43 + .../dygma/raise/keymaps/default/readme.md | 1 + .../dygma/raise/keymaps/iso/keymap.c | 43 + .../dygma/raise/keymaps/iso/readme.md | 1 + keyboards/handwired/dygma/raise/leds.c | 101 ++ keyboards/handwired/dygma/raise/leds.h | 25 + keyboards/handwired/dygma/raise/matrix.c | 104 ++ keyboards/handwired/dygma/raise/mcuconf.h | 25 + keyboards/handwired/dygma/raise/raise.c | 22 + keyboards/handwired/dygma/raise/raise.h | 83 ++ keyboards/handwired/dygma/raise/readme.md | 55 + keyboards/handwired/dygma/raise/rules.mk | 30 + .../dygma/raise/wire-protocol-constants.h | 51 + 23 files changed, 3073 insertions(+) create mode 100644 keyboards/handwired/dygma/raise/ansi/ansi.c create mode 100644 keyboards/handwired/dygma/raise/ansi/info.json create mode 100644 keyboards/handwired/dygma/raise/ansi/rules.mk create mode 100644 keyboards/handwired/dygma/raise/config.h create mode 100644 keyboards/handwired/dygma/raise/halconf.h create mode 100644 keyboards/handwired/dygma/raise/iso/info.json create mode 100644 keyboards/handwired/dygma/raise/iso/iso.c create mode 100644 keyboards/handwired/dygma/raise/iso/rules.mk create mode 100644 keyboards/handwired/dygma/raise/keymaps/ansi/keymap.c create mode 100644 keyboards/handwired/dygma/raise/keymaps/ansi/readme.md create mode 100644 keyboards/handwired/dygma/raise/keymaps/default/keymap.c create mode 100644 keyboards/handwired/dygma/raise/keymaps/default/readme.md create mode 100644 keyboards/handwired/dygma/raise/keymaps/iso/keymap.c create mode 100644 keyboards/handwired/dygma/raise/keymaps/iso/readme.md create mode 100644 keyboards/handwired/dygma/raise/leds.c create mode 100644 keyboards/handwired/dygma/raise/leds.h create mode 100644 keyboards/handwired/dygma/raise/matrix.c create mode 100644 keyboards/handwired/dygma/raise/mcuconf.h create mode 100644 keyboards/handwired/dygma/raise/raise.c create mode 100644 keyboards/handwired/dygma/raise/raise.h create mode 100644 keyboards/handwired/dygma/raise/readme.md create mode 100644 keyboards/handwired/dygma/raise/rules.mk create mode 100644 keyboards/handwired/dygma/raise/wire-protocol-constants.h diff --git a/keyboards/handwired/dygma/raise/ansi/ansi.c b/keyboards/handwired/dygma/raise/ansi/ansi.c new file mode 100644 index 0000000000..652b6551d2 --- /dev/null +++ b/keyboards/handwired/dygma/raise/ansi/ansi.c @@ -0,0 +1,81 @@ +/* Copyright 2018-2021 James Laird-Wah, Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +// "led_map" is taken from kaleidoscope +// LHK = Left Hand Keys +// LPH = "Leds per hand", which isn't _actually_ the number of leds, but instead +// is just used for indexing +#define LHK 33 +#define LPH 72 + +const uint8_t led_map[DRIVER_LED_TOTAL] = { + // left side - 32 keys includes LP: key 19 is missing for ANSI layout + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 0xff, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 68, 69, + + // right side - 36 keys includes LP + 0 + LPH, 1 + LPH, 2 + LPH, 3 + LPH, 4 + LPH, 5 + LPH, 6 + LPH, 15 + LPH, 8 + LPH, 9 + LPH, 10 + LPH, 11 + LPH, 12 + LPH, 13 + LPH, 14 + LPH, 7 + LPH, 16 + LPH, 17 + LPH, 18 + LPH, 19 + LPH, + 20 + LPH, 21 + LPH, 22 + LPH, 23 + LPH, 24 + LPH, 25 + LPH, 26 + LPH, 27 + LPH, 28 + LPH, 29 + LPH, 30 + LPH, 31 + LPH, 32 + LPH, 33 + LPH, 68 + LPH, 69 + LPH, + + // left under glow - 30 + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + + // right underglow - 32 + 34 + LPH, 35 + LPH, 36 + LPH, 37 + LPH, 38 + LPH, 39 + LPH, 40 + LPH, 41 + LPH, 42 + LPH, 43 + LPH, 44 + LPH, 45 + LPH, 46 + LPH, 47 + LPH, 48 + LPH, 49 + LPH, 50 + LPH, 51 + LPH, + 52 + LPH, 53 + LPH, 54 + LPH, 55 + LPH, 56 + LPH, 57 + LPH, 58 + LPH, 59 + LPH, 60 + LPH, 61 + LPH, 62 + LPH, 63 + LPH, 64 + LPH, 65 + LPH, 0xff +}; + +// taken from "key_led_map" and reformatted +// ISO & ANSI (ANSI has no LED at 20, but this key can never be pressed so we can have just one map). +led_config_t g_led_config = { { + // left hand + { 0 , 1 , 2 , 3 , 4 , 5 , 6 , NO_LED } , + { 7 , 8 , 9 , 10 , 11 , 12 , NO_LED , NO_LED } , + { 13 , 14 , 15 , 16 , 17 , 18 , NO_LED , NO_LED } , + { 19 , 20 , 21 , 22 , 23 , 24 , 25 , NO_LED } , + { 26 , 27 , 28 , 29 , 30 , NO_LED , 31 , 32 } , + + // right hand + { NO_LED , 6 + LHK , 5 + LHK , 4 + LHK , 3 + LHK , 2 + LHK , 1 + LHK , 0 + LHK } , + { 14 + LHK , 13 + LHK , 12 + LHK , 11 + LHK , 10 + LHK , 9 + LHK , 8 + LHK , 7 + LHK } , + { NO_LED , 21 + LHK , 20 + LHK , 19 + LHK , 18 + LHK , 17 + LHK , 16 + LHK , 15 + LHK } , + { NO_LED , NO_LED , 27 + LHK , 26 + LHK , 25 + LHK , 24 + LHK , 23 + LHK , 22 + LHK } , + { 35 + LHK , 34 + LHK , 33 + LHK , 32 + LHK , 31 + LHK , 30 + LHK , 29 + LHK , 28 + LHK } + }, { + // generated from the svg image of the keyboard, see create-led-config.js + {82, 3}, {88, 3}, {94, 3}, {100, 3}, {106, 3}, {112, 3}, {118, 3}, {84, 10}, {91, 10}, {97, 10}, {103, 10}, {109, 10}, + {115, 10}, {84, 16}, {92, 16}, {98, 16}, {104, 16}, {110, 16}, {116, 16}, {85, 22}, + {0, 0}, + {94, 22}, {100, 22}, {106, 22}, {112, 22}, {118, 22}, {83, 28}, {90, 28}, {98, 28}, {106, 28}, {116, 28}, {111, 34}, + {118, 34}, {168, 3}, {159, 3}, {153, 3}, {147, 3}, {141, 3}, {135, 3}, {129, 3}, {168, 16}, {162, 10}, {156, 10}, + {150, 10}, {144, 10}, {139, 10}, {133, 10}, {127, 10}, {170, 10}, {159, 16}, {153, 16}, {147, 16}, {141, 16}, {135, 16}, + {129, 16}, {166, 22}, {154, 22}, {148, 22}, {142, 22}, {136, 22}, {130, 22}, {170, 28}, {163, 28}, {156, 28}, {149, 28}, + {140, 28}, {131, 28}, {136, 34}, {128, 34}, {78, 13}, {78, 6}, {80, 0}, {87, 0}, {95, 0}, {103, 0}, {111, 0}, {119, 0}, + {122, 3}, {121, 9}, {120, 15}, {122, 21}, {123, 27}, {123, 33}, {120, 38}, {116, 42}, {114, 48}, {112, 55}, {109, 61}, + {103, 64}, {96, 64}, {88, 64}, {81, 63}, {76, 60}, {75, 52}, {75, 46}, {74, 38}, {74, 32}, {75, 27}, {77, 21}, {175, 10}, + {175, 4}, {172, 0}, {164, 0}, {157, 0}, {149, 0}, {142, 0}, {134, 0}, {127, 0}, {123, 3}, {122, 8}, {122, 15}, {124, 21}, + {124, 27}, {124, 33}, {126, 38}, {131, 42}, {134, 48}, {135, 55}, {137, 61}, {143, 63}, {150, 63}, {158, 63}, {166, 63}, + {173, 63}, {177, 59}, {178, 49}, {179, 40}, {179, 31}, {177, 25}, {175, 20}, {175, 15}, {123, 54} + }, { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4 + } +}; diff --git a/keyboards/handwired/dygma/raise/ansi/info.json b/keyboards/handwired/dygma/raise/ansi/info.json new file mode 100644 index 0000000000..f7f9a07c1c --- /dev/null +++ b/keyboards/handwired/dygma/raise/ansi/info.json @@ -0,0 +1,1115 @@ +{ + "keyboard_name": "Dygma Raise", + "url": "https://github.com/qmk/qmk_firmware/tree/master/keyboards/dygma/raise", + "maintainer": "ibash", + "layouts": { + "LAYOUT_all": { + "layout": [ + { + "label": "esc", + "x": 0, + "y": 0 + }, + { + "label": "1", + "x": 1, + "y": 0 + }, + { + "label": "2", + "x": 2, + "y": 0 + }, + { + "label": "3", + "x": 3, + "y": 0 + }, + { + "label": "4", + "x": 4, + "y": 0 + }, + { + "label": "5", + "x": 5, + "y": 0 + }, + { + "label": "6", + "x": 6, + "y": 0 + }, + { + "label": "7", + "x": 8.75, + "y": 0 + }, + { + "label": "8", + "x": 9.75, + "y": 0 + }, + { + "label": "9", + "x": 10.75, + "y": 0 + }, + { + "label": "0", + "x": 11.75, + "y": 0 + }, + { + "label": "-", + "x": 12.75, + "y": 0 + }, + { + "label": "+", + "x": 13.75, + "y": 0 + }, + { + "label": "backspace", + "w": 2, + "x": 14.75, + "y": 0 + }, + { + "label": "tab", + "w": 1.5, + "x": 0, + "y": 1 + }, + { + "label": "Q", + "x": 1.5, + "y": 1 + }, + { + "label": "W", + "x": 2.5, + "y": 1 + }, + { + "label": "E", + "x": 3.5, + "y": 1 + }, + { + "label": "R", + "x": 4.5, + "y": 1 + }, + { + "label": "T", + "x": 5.5, + "y": 1 + }, + { + "label": "Y", + "x": 8.25, + "y": 1 + }, + { + "label": "U", + "x": 9.25, + "y": 1 + }, + { + "label": "I", + "x": 10.25, + "y": 1 + }, + { + "label": "O", + "x": 11.25, + "y": 1 + }, + { + "label": "P", + "x": 12.25, + "y": 1 + }, + { + "label": "[", + "x": 13.25, + "y": 1 + }, + { + "label": "]", + "x": 14.25, + "y": 1 + }, + { + "label": "enter", + "h": 2, + "w": 1.25, + "x": 15.5, + "y": 1 + }, + { + "label": "caps", + "w": 1.75, + "x": 0, + "y": 2 + }, + { + "label": "A", + "x": 1.75, + "y": 2 + }, + { + "label": "S", + "x": 2.75, + "y": 2 + }, + { + "label": "D", + "x": 3.75, + "y": 2 + }, + { + "label": "F", + "x": 4.75, + "y": 2 + }, + { + "label": "G", + "x": 5.75, + "y": 2 + }, + { + "label": "H", + "x": 8.5, + "y": 2 + }, + { + "label": "J", + "x": 9.5, + "y": 2 + }, + { + "label": "K", + "x": 10.5, + "y": 2 + }, + { + "label": "L", + "x": 11.5, + "y": 2 + }, + { + "label": ";", + "x": 12.5, + "y": 2 + }, + { + "label": "'", + "x": 13.5, + "y": 2 + }, + { + "label": "#", + "x": 14.5, + "y": 2 + }, + { + "label": "shift", + "w": 1.25, + "x": 0, + "y": 3 + }, + { + "label": "\\", + "x": 1.25, + "y": 3 + }, + { + "label": "Z", + "x": 2.25, + "y": 3 + }, + { + "label": "X", + "x": 3.25, + "y": 3 + }, + { + "label": "C", + "x": 4.25, + "y": 3 + }, + { + "label": "V", + "x": 5.25, + "y": 3 + }, + { + "label": "B", + "x": 6.25, + "y": 3 + }, + { + "label": "N", + "x": 9, + "y": 3 + }, + { + "label": "M", + "x": 10, + "y": 3 + }, + { + "label": ",", + "x": 11, + "y": 3 + }, + { + "label": ".", + "x": 12, + "y": 3 + }, + { + "label": "/", + "x": 13, + "y": 3 + }, + { + "label": "shift", + "w": 2.75, + "x": 14, + "y": 3 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 0, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 1.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 2.5, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 3.75, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 5.25, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 8.75, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 10.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 11.75, + "y": 4 + }, + { + "label": "fn", + "w": 1.25, + "x": 13, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 14.25, + "y": 4 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 15.5, + "y": 4 + }, + { + "label": "..", + "w": 1.5, + "x": 3.75, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 5.25, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 8.75, + "y": 5 + }, + { + "label": "..", + "w": 1.5, + "x": 10.25, + "y": 5 + } + ] + }, + "LAYOUT_ansi": { + "layout": [ + { + "label": "esc", + "x": 0, + "y": 0 + }, + { + "label": "1", + "x": 1, + "y": 0 + }, + { + "label": "2", + "x": 2, + "y": 0 + }, + { + "label": "3", + "x": 3, + "y": 0 + }, + { + "label": "4", + "x": 4, + "y": 0 + }, + { + "label": "5", + "x": 5, + "y": 0 + }, + { + "label": "6", + "x": 6, + "y": 0 + }, + { + "label": "7", + "x": 8.75, + "y": 0 + }, + { + "label": "8", + "x": 9.75, + "y": 0 + }, + { + "label": "9", + "x": 10.75, + "y": 0 + }, + { + "label": "0", + "x": 11.75, + "y": 0 + }, + { + "label": "-", + "x": 12.75, + "y": 0 + }, + { + "label": "+", + "x": 13.75, + "y": 0 + }, + { + "label": "backspace", + "w": 2, + "x": 14.75, + "y": 0 + }, + { + "label": "tab", + "w": 1.5, + "x": 0, + "y": 1 + }, + { + "label": "Q", + "x": 1.5, + "y": 1 + }, + { + "label": "W", + "x": 2.5, + "y": 1 + }, + { + "label": "E", + "x": 3.5, + "y": 1 + }, + { + "label": "R", + "x": 4.5, + "y": 1 + }, + { + "label": "T", + "x": 5.5, + "y": 1 + }, + { + "label": "Y", + "x": 8.25, + "y": 1 + }, + { + "label": "U", + "x": 9.25, + "y": 1 + }, + { + "label": "I", + "x": 10.25, + "y": 1 + }, + { + "label": "O", + "x": 11.25, + "y": 1 + }, + { + "label": "P", + "x": 12.25, + "y": 1 + }, + { + "label": "{", + "x": 13.25, + "y": 1 + }, + { + "label": "}", + "x": 14.25, + "y": 1 + }, + { + "label": "\\", + "w": 1.5, + "x": 15.25, + "y": 1 + }, + { + "label": "caps", + "w": 1.75, + "x": 0, + "y": 2 + }, + { + "label": "A", + "x": 1.75, + "y": 2 + }, + { + "label": "S", + "x": 2.75, + "y": 2 + }, + { + "label": "D", + "x": 3.75, + "y": 2 + }, + { + "label": "F", + "x": 4.75, + "y": 2 + }, + { + "label": "G", + "x": 5.75, + "y": 2 + }, + { + "label": "H", + "x": 8.5, + "y": 2 + }, + { + "label": "J", + "x": 9.5, + "y": 2 + }, + { + "label": "K", + "x": 10.5, + "y": 2 + }, + { + "label": "L", + "x": 11.5, + "y": 2 + }, + { + "label": ";", + "x": 12.5, + "y": 2 + }, + { + "label": "'", + "x": 13.5, + "y": 2 + }, + { + "label": "enter", + "w": 2.25, + "x": 14.5, + "y": 2 + }, + { + "label": "shift", + "w": 2.25, + "x": 0, + "y": 3 + }, + { + "label": "Z", + "x": 2.25, + "y": 3 + }, + { + "label": "X", + "x": 3.25, + "y": 3 + }, + { + "label": "C", + "x": 4.25, + "y": 3 + }, + { + "label": "V", + "x": 5.25, + "y": 3 + }, + { + "label": "B", + "x": 6.25, + "y": 3 + }, + { + "label": "N", + "x": 9, + "y": 3 + }, + { + "label": "M", + "x": 10, + "y": 3 + }, + { + "label": ",", + "x": 11, + "y": 3 + }, + { + "label": ".", + "x": 12, + "y": 3 + }, + { + "label": "/", + "x": 13, + "y": 3 + }, + { + "label": "shift", + "w": 2.75, + "x": 14, + "y": 3 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 0, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 1.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 2.5, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 3.75, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 5.25, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 8.75, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 10.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 11.75, + "y": 4 + }, + { + "label": "fn", + "w": 1.25, + "x": 13, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 14.25, + "y": 4 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 15.5, + "y": 4 + }, + { + "label": "..", + "w": 1.5, + "x": 3.75, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 5.25, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 8.75, + "y": 5 + }, + { + "label": "..", + "w": 1.5, + "x": 10.25, + "y": 5 + } + ] + }, + "LAYOUT_iso": { + "layout": [ + { + "label": "esc", + "x": 0, + "y": 0 + }, + { + "label": "1", + "x": 1, + "y": 0 + }, + { + "label": "2", + "x": 2, + "y": 0 + }, + { + "label": "3", + "x": 3, + "y": 0 + }, + { + "label": "4", + "x": 4, + "y": 0 + }, + { + "label": "5", + "x": 5, + "y": 0 + }, + { + "label": "6", + "x": 6, + "y": 0 + }, + { + "label": "7", + "x": 8.75, + "y": 0 + }, + { + "label": "8", + "x": 9.75, + "y": 0 + }, + { + "label": "9", + "x": 10.75, + "y": 0 + }, + { + "label": "0", + "x": 11.75, + "y": 0 + }, + { + "label": "-", + "x": 12.75, + "y": 0 + }, + { + "label": "+", + "x": 13.75, + "y": 0 + }, + { + "label": "backspace", + "w": 2, + "x": 14.75, + "y": 0 + }, + { + "label": "tab", + "w": 1.5, + "x": 0, + "y": 1 + }, + { + "label": "Q", + "x": 1.5, + "y": 1 + }, + { + "label": "W", + "x": 2.5, + "y": 1 + }, + { + "label": "E", + "x": 3.5, + "y": 1 + }, + { + "label": "R", + "x": 4.5, + "y": 1 + }, + { + "label": "T", + "x": 5.5, + "y": 1 + }, + { + "label": "Y", + "x": 8.25, + "y": 1 + }, + { + "label": "U", + "x": 9.25, + "y": 1 + }, + { + "label": "I", + "x": 10.25, + "y": 1 + }, + { + "label": "O", + "x": 11.25, + "y": 1 + }, + { + "label": "P", + "x": 12.25, + "y": 1 + }, + { + "label": "[", + "x": 13.25, + "y": 1 + }, + { + "label": "]", + "x": 14.25, + "y": 1 + }, + { + "label": "enter", + "h": 2, + "w": 1.25, + "x": 15.5, + "y": 1 + }, + { + "label": "caps", + "w": 1.75, + "x": 0, + "y": 2 + }, + { + "label": "A", + "x": 1.75, + "y": 2 + }, + { + "label": "S", + "x": 2.75, + "y": 2 + }, + { + "label": "D", + "x": 3.75, + "y": 2 + }, + { + "label": "F", + "x": 4.75, + "y": 2 + }, + { + "label": "G", + "x": 5.75, + "y": 2 + }, + { + "label": "H", + "x": 8.5, + "y": 2 + }, + { + "label": "J", + "x": 9.5, + "y": 2 + }, + { + "label": "K", + "x": 10.5, + "y": 2 + }, + { + "label": "L", + "x": 11.5, + "y": 2 + }, + { + "label": ";", + "x": 12.5, + "y": 2 + }, + { + "label": "'", + "x": 13.5, + "y": 2 + }, + { + "label": "#", + "x": 14.5, + "y": 2 + }, + { + "label": "shift", + "w": 1.25, + "x": 0, + "y": 3 + }, + { + "label": "\\", + "x": 1.25, + "y": 3 + }, + { + "label": "Z", + "x": 2.25, + "y": 3 + }, + { + "label": "X", + "x": 3.25, + "y": 3 + }, + { + "label": "C", + "x": 4.25, + "y": 3 + }, + { + "label": "V", + "x": 5.25, + "y": 3 + }, + { + "label": "B", + "x": 6.25, + "y": 3 + }, + { + "label": "N", + "x": 9, + "y": 3 + }, + { + "label": "M", + "x": 10, + "y": 3 + }, + { + "label": ",", + "x": 11, + "y": 3 + }, + { + "label": ".", + "x": 12, + "y": 3 + }, + { + "label": "/", + "x": 13, + "y": 3 + }, + { + "label": "shift", + "w": 2.75, + "x": 14, + "y": 3 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 0, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 1.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 2.5, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 3.75, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 5.25, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 8.75, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 10.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 11.75, + "y": 4 + }, + { + "label": "fn", + "w": 1.25, + "x": 13, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 14.25, + "y": 4 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 15.5, + "y": 4 + }, + { + "label": "..", + "w": 1.5, + "x": 3.75, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 5.25, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 8.75, + "y": 5 + }, + { + "label": "..", + "w": 1.5, + "x": 10.25, + "y": 5 + } + ] + } + } +} diff --git a/keyboards/handwired/dygma/raise/ansi/rules.mk b/keyboards/handwired/dygma/raise/ansi/rules.mk new file mode 100644 index 0000000000..e69de29bb2 diff --git a/keyboards/handwired/dygma/raise/config.h b/keyboards/handwired/dygma/raise/config.h new file mode 100644 index 0000000000..674fd592cf --- /dev/null +++ b/keyboards/handwired/dygma/raise/config.h @@ -0,0 +1,34 @@ +/* Copyright 2021 Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x1209 +#define PRODUCT_ID 0x2201 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Dygma +#define PRODUCT Raise + +/* key matrix size */ +// rows are doubled for split +#define MATRIX_ROWS 10 +#define MATRIX_COLS 8 +/* The scanners already debounce for us */ +#define DEBOUNCE 0 + +#define DRIVER_LED_TOTAL 132 diff --git a/keyboards/handwired/dygma/raise/halconf.h b/keyboards/handwired/dygma/raise/halconf.h new file mode 100644 index 0000000000..ebe78c3bec --- /dev/null +++ b/keyboards/handwired/dygma/raise/halconf.h @@ -0,0 +1,21 @@ +/* Copyright (C) 2021 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/handwired/dygma/raise/iso/info.json b/keyboards/handwired/dygma/raise/iso/info.json new file mode 100644 index 0000000000..f7f9a07c1c --- /dev/null +++ b/keyboards/handwired/dygma/raise/iso/info.json @@ -0,0 +1,1115 @@ +{ + "keyboard_name": "Dygma Raise", + "url": "https://github.com/qmk/qmk_firmware/tree/master/keyboards/dygma/raise", + "maintainer": "ibash", + "layouts": { + "LAYOUT_all": { + "layout": [ + { + "label": "esc", + "x": 0, + "y": 0 + }, + { + "label": "1", + "x": 1, + "y": 0 + }, + { + "label": "2", + "x": 2, + "y": 0 + }, + { + "label": "3", + "x": 3, + "y": 0 + }, + { + "label": "4", + "x": 4, + "y": 0 + }, + { + "label": "5", + "x": 5, + "y": 0 + }, + { + "label": "6", + "x": 6, + "y": 0 + }, + { + "label": "7", + "x": 8.75, + "y": 0 + }, + { + "label": "8", + "x": 9.75, + "y": 0 + }, + { + "label": "9", + "x": 10.75, + "y": 0 + }, + { + "label": "0", + "x": 11.75, + "y": 0 + }, + { + "label": "-", + "x": 12.75, + "y": 0 + }, + { + "label": "+", + "x": 13.75, + "y": 0 + }, + { + "label": "backspace", + "w": 2, + "x": 14.75, + "y": 0 + }, + { + "label": "tab", + "w": 1.5, + "x": 0, + "y": 1 + }, + { + "label": "Q", + "x": 1.5, + "y": 1 + }, + { + "label": "W", + "x": 2.5, + "y": 1 + }, + { + "label": "E", + "x": 3.5, + "y": 1 + }, + { + "label": "R", + "x": 4.5, + "y": 1 + }, + { + "label": "T", + "x": 5.5, + "y": 1 + }, + { + "label": "Y", + "x": 8.25, + "y": 1 + }, + { + "label": "U", + "x": 9.25, + "y": 1 + }, + { + "label": "I", + "x": 10.25, + "y": 1 + }, + { + "label": "O", + "x": 11.25, + "y": 1 + }, + { + "label": "P", + "x": 12.25, + "y": 1 + }, + { + "label": "[", + "x": 13.25, + "y": 1 + }, + { + "label": "]", + "x": 14.25, + "y": 1 + }, + { + "label": "enter", + "h": 2, + "w": 1.25, + "x": 15.5, + "y": 1 + }, + { + "label": "caps", + "w": 1.75, + "x": 0, + "y": 2 + }, + { + "label": "A", + "x": 1.75, + "y": 2 + }, + { + "label": "S", + "x": 2.75, + "y": 2 + }, + { + "label": "D", + "x": 3.75, + "y": 2 + }, + { + "label": "F", + "x": 4.75, + "y": 2 + }, + { + "label": "G", + "x": 5.75, + "y": 2 + }, + { + "label": "H", + "x": 8.5, + "y": 2 + }, + { + "label": "J", + "x": 9.5, + "y": 2 + }, + { + "label": "K", + "x": 10.5, + "y": 2 + }, + { + "label": "L", + "x": 11.5, + "y": 2 + }, + { + "label": ";", + "x": 12.5, + "y": 2 + }, + { + "label": "'", + "x": 13.5, + "y": 2 + }, + { + "label": "#", + "x": 14.5, + "y": 2 + }, + { + "label": "shift", + "w": 1.25, + "x": 0, + "y": 3 + }, + { + "label": "\\", + "x": 1.25, + "y": 3 + }, + { + "label": "Z", + "x": 2.25, + "y": 3 + }, + { + "label": "X", + "x": 3.25, + "y": 3 + }, + { + "label": "C", + "x": 4.25, + "y": 3 + }, + { + "label": "V", + "x": 5.25, + "y": 3 + }, + { + "label": "B", + "x": 6.25, + "y": 3 + }, + { + "label": "N", + "x": 9, + "y": 3 + }, + { + "label": "M", + "x": 10, + "y": 3 + }, + { + "label": ",", + "x": 11, + "y": 3 + }, + { + "label": ".", + "x": 12, + "y": 3 + }, + { + "label": "/", + "x": 13, + "y": 3 + }, + { + "label": "shift", + "w": 2.75, + "x": 14, + "y": 3 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 0, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 1.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 2.5, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 3.75, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 5.25, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 8.75, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 10.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 11.75, + "y": 4 + }, + { + "label": "fn", + "w": 1.25, + "x": 13, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 14.25, + "y": 4 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 15.5, + "y": 4 + }, + { + "label": "..", + "w": 1.5, + "x": 3.75, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 5.25, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 8.75, + "y": 5 + }, + { + "label": "..", + "w": 1.5, + "x": 10.25, + "y": 5 + } + ] + }, + "LAYOUT_ansi": { + "layout": [ + { + "label": "esc", + "x": 0, + "y": 0 + }, + { + "label": "1", + "x": 1, + "y": 0 + }, + { + "label": "2", + "x": 2, + "y": 0 + }, + { + "label": "3", + "x": 3, + "y": 0 + }, + { + "label": "4", + "x": 4, + "y": 0 + }, + { + "label": "5", + "x": 5, + "y": 0 + }, + { + "label": "6", + "x": 6, + "y": 0 + }, + { + "label": "7", + "x": 8.75, + "y": 0 + }, + { + "label": "8", + "x": 9.75, + "y": 0 + }, + { + "label": "9", + "x": 10.75, + "y": 0 + }, + { + "label": "0", + "x": 11.75, + "y": 0 + }, + { + "label": "-", + "x": 12.75, + "y": 0 + }, + { + "label": "+", + "x": 13.75, + "y": 0 + }, + { + "label": "backspace", + "w": 2, + "x": 14.75, + "y": 0 + }, + { + "label": "tab", + "w": 1.5, + "x": 0, + "y": 1 + }, + { + "label": "Q", + "x": 1.5, + "y": 1 + }, + { + "label": "W", + "x": 2.5, + "y": 1 + }, + { + "label": "E", + "x": 3.5, + "y": 1 + }, + { + "label": "R", + "x": 4.5, + "y": 1 + }, + { + "label": "T", + "x": 5.5, + "y": 1 + }, + { + "label": "Y", + "x": 8.25, + "y": 1 + }, + { + "label": "U", + "x": 9.25, + "y": 1 + }, + { + "label": "I", + "x": 10.25, + "y": 1 + }, + { + "label": "O", + "x": 11.25, + "y": 1 + }, + { + "label": "P", + "x": 12.25, + "y": 1 + }, + { + "label": "{", + "x": 13.25, + "y": 1 + }, + { + "label": "}", + "x": 14.25, + "y": 1 + }, + { + "label": "\\", + "w": 1.5, + "x": 15.25, + "y": 1 + }, + { + "label": "caps", + "w": 1.75, + "x": 0, + "y": 2 + }, + { + "label": "A", + "x": 1.75, + "y": 2 + }, + { + "label": "S", + "x": 2.75, + "y": 2 + }, + { + "label": "D", + "x": 3.75, + "y": 2 + }, + { + "label": "F", + "x": 4.75, + "y": 2 + }, + { + "label": "G", + "x": 5.75, + "y": 2 + }, + { + "label": "H", + "x": 8.5, + "y": 2 + }, + { + "label": "J", + "x": 9.5, + "y": 2 + }, + { + "label": "K", + "x": 10.5, + "y": 2 + }, + { + "label": "L", + "x": 11.5, + "y": 2 + }, + { + "label": ";", + "x": 12.5, + "y": 2 + }, + { + "label": "'", + "x": 13.5, + "y": 2 + }, + { + "label": "enter", + "w": 2.25, + "x": 14.5, + "y": 2 + }, + { + "label": "shift", + "w": 2.25, + "x": 0, + "y": 3 + }, + { + "label": "Z", + "x": 2.25, + "y": 3 + }, + { + "label": "X", + "x": 3.25, + "y": 3 + }, + { + "label": "C", + "x": 4.25, + "y": 3 + }, + { + "label": "V", + "x": 5.25, + "y": 3 + }, + { + "label": "B", + "x": 6.25, + "y": 3 + }, + { + "label": "N", + "x": 9, + "y": 3 + }, + { + "label": "M", + "x": 10, + "y": 3 + }, + { + "label": ",", + "x": 11, + "y": 3 + }, + { + "label": ".", + "x": 12, + "y": 3 + }, + { + "label": "/", + "x": 13, + "y": 3 + }, + { + "label": "shift", + "w": 2.75, + "x": 14, + "y": 3 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 0, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 1.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 2.5, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 3.75, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 5.25, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 8.75, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 10.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 11.75, + "y": 4 + }, + { + "label": "fn", + "w": 1.25, + "x": 13, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 14.25, + "y": 4 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 15.5, + "y": 4 + }, + { + "label": "..", + "w": 1.5, + "x": 3.75, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 5.25, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 8.75, + "y": 5 + }, + { + "label": "..", + "w": 1.5, + "x": 10.25, + "y": 5 + } + ] + }, + "LAYOUT_iso": { + "layout": [ + { + "label": "esc", + "x": 0, + "y": 0 + }, + { + "label": "1", + "x": 1, + "y": 0 + }, + { + "label": "2", + "x": 2, + "y": 0 + }, + { + "label": "3", + "x": 3, + "y": 0 + }, + { + "label": "4", + "x": 4, + "y": 0 + }, + { + "label": "5", + "x": 5, + "y": 0 + }, + { + "label": "6", + "x": 6, + "y": 0 + }, + { + "label": "7", + "x": 8.75, + "y": 0 + }, + { + "label": "8", + "x": 9.75, + "y": 0 + }, + { + "label": "9", + "x": 10.75, + "y": 0 + }, + { + "label": "0", + "x": 11.75, + "y": 0 + }, + { + "label": "-", + "x": 12.75, + "y": 0 + }, + { + "label": "+", + "x": 13.75, + "y": 0 + }, + { + "label": "backspace", + "w": 2, + "x": 14.75, + "y": 0 + }, + { + "label": "tab", + "w": 1.5, + "x": 0, + "y": 1 + }, + { + "label": "Q", + "x": 1.5, + "y": 1 + }, + { + "label": "W", + "x": 2.5, + "y": 1 + }, + { + "label": "E", + "x": 3.5, + "y": 1 + }, + { + "label": "R", + "x": 4.5, + "y": 1 + }, + { + "label": "T", + "x": 5.5, + "y": 1 + }, + { + "label": "Y", + "x": 8.25, + "y": 1 + }, + { + "label": "U", + "x": 9.25, + "y": 1 + }, + { + "label": "I", + "x": 10.25, + "y": 1 + }, + { + "label": "O", + "x": 11.25, + "y": 1 + }, + { + "label": "P", + "x": 12.25, + "y": 1 + }, + { + "label": "[", + "x": 13.25, + "y": 1 + }, + { + "label": "]", + "x": 14.25, + "y": 1 + }, + { + "label": "enter", + "h": 2, + "w": 1.25, + "x": 15.5, + "y": 1 + }, + { + "label": "caps", + "w": 1.75, + "x": 0, + "y": 2 + }, + { + "label": "A", + "x": 1.75, + "y": 2 + }, + { + "label": "S", + "x": 2.75, + "y": 2 + }, + { + "label": "D", + "x": 3.75, + "y": 2 + }, + { + "label": "F", + "x": 4.75, + "y": 2 + }, + { + "label": "G", + "x": 5.75, + "y": 2 + }, + { + "label": "H", + "x": 8.5, + "y": 2 + }, + { + "label": "J", + "x": 9.5, + "y": 2 + }, + { + "label": "K", + "x": 10.5, + "y": 2 + }, + { + "label": "L", + "x": 11.5, + "y": 2 + }, + { + "label": ";", + "x": 12.5, + "y": 2 + }, + { + "label": "'", + "x": 13.5, + "y": 2 + }, + { + "label": "#", + "x": 14.5, + "y": 2 + }, + { + "label": "shift", + "w": 1.25, + "x": 0, + "y": 3 + }, + { + "label": "\\", + "x": 1.25, + "y": 3 + }, + { + "label": "Z", + "x": 2.25, + "y": 3 + }, + { + "label": "X", + "x": 3.25, + "y": 3 + }, + { + "label": "C", + "x": 4.25, + "y": 3 + }, + { + "label": "V", + "x": 5.25, + "y": 3 + }, + { + "label": "B", + "x": 6.25, + "y": 3 + }, + { + "label": "N", + "x": 9, + "y": 3 + }, + { + "label": "M", + "x": 10, + "y": 3 + }, + { + "label": ",", + "x": 11, + "y": 3 + }, + { + "label": ".", + "x": 12, + "y": 3 + }, + { + "label": "/", + "x": 13, + "y": 3 + }, + { + "label": "shift", + "w": 2.75, + "x": 14, + "y": 3 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 0, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 1.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 2.5, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 3.75, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 5.25, + "y": 4 + }, + { + "label": "\u2014", + "w": 1.5, + "x": 8.75, + "y": 4 + }, + { + "label": "...", + "w": 1.5, + "x": 10.25, + "y": 4 + }, + { + "label": "alt", + "w": 1.25, + "x": 11.75, + "y": 4 + }, + { + "label": "fn", + "w": 1.25, + "x": 13, + "y": 4 + }, + { + "label": "os", + "w": 1.25, + "x": 14.25, + "y": 4 + }, + { + "label": "ctrl", + "w": 1.25, + "x": 15.5, + "y": 4 + }, + { + "label": "..", + "w": 1.5, + "x": 3.75, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 5.25, + "y": 5 + }, + { + "label": ".", + "w": 1.5, + "x": 8.75, + "y": 5 + }, + { + "label": "..", + "w": 1.5, + "x": 10.25, + "y": 5 + } + ] + } + } +} diff --git a/keyboards/handwired/dygma/raise/iso/iso.c b/keyboards/handwired/dygma/raise/iso/iso.c new file mode 100644 index 0000000000..ec2607d06c --- /dev/null +++ b/keyboards/handwired/dygma/raise/iso/iso.c @@ -0,0 +1,79 @@ +/* Copyright 2018-2021 James Laird-Wah, Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +// "led_map" is taken from kaleidoscope +// LHK = Left Hand Keys +// LPH = "Leds per hand", which isn't _actually_ the number of leds, but instead +// is just used for indexing +#define LHK 33 +#define LPH 72 + +const uint8_t led_map[DRIVER_LED_TOTAL] = { + // left side - 33 keys + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 68, 69, + + // right side - 36 keys + 0 + LPH, 1 + LPH, 2 + LPH, 3 + LPH, 4 + LPH, 5 + LPH, 6 + LPH, 15 + LPH, 8 + LPH, 9 + LPH, 10 + LPH, 11 + LPH, 12 + LPH, 13 + LPH, 14 + LPH, 7 + LPH, 16 + LPH, 17 + LPH, 18 + LPH, 19 + LPH, + 20 + LPH, 21 + LPH, 22 + LPH, 23 + LPH, 24 + LPH, 25 + LPH, 26 + LPH, 27 + LPH, 28 + LPH, 29 + LPH, 30 + LPH, 31 + LPH, 32 + LPH, 33 + LPH, 68 + LPH, 69 + LPH, + + // left under glow - 30 keys + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + + // right underglow - 32 keys + 34 + LPH, 35 + LPH, 36 + LPH, 37 + LPH, 38 + LPH, 39 + LPH, 40 + LPH, 41 + LPH, 42 + LPH, 43 + LPH, 44 + LPH, 45 + LPH, 46 + LPH, 47 + LPH, 48 + LPH, 49 + LPH, 50 + LPH, 51 + LPH, + 52 + LPH, 53 + LPH, 54 + LPH, 55 + LPH, 56 + LPH, 57 + LPH, 58 + LPH, 59 + LPH, 60 + LPH, 61 + LPH, 62 + LPH, 63 + LPH, 64 + LPH, 65 + LPH, 0xff +}; + +// taken from "key_led_map" and reformatted +// ISO & ANSI (ANSI has no LED at 20, but this key can never be pressed so we can have just one map). +led_config_t g_led_config = { { + // left hand + { 0 , 1 , 2 , 3 , 4 , 5 , 6 , NO_LED } , + { 7 , 8 , 9 , 10 , 11 , 12 , NO_LED , NO_LED } , + { 13 , 14 , 15 , 16 , 17 , 18 , NO_LED , NO_LED } , + { 19 , 20 , 21 , 22 , 23 , 24 , 25 , NO_LED } , + { 26 , 27 , 28 , 29 , 30 , NO_LED , 31 , 32 } , + + // right hand + { NO_LED , 6 + LHK , 5 + LHK , 4 + LHK , 3 + LHK , 2 + LHK , 1 + LHK , 0 + LHK } , + { 14 + LHK , 13 + LHK , 12 + LHK , 11 + LHK , 10 + LHK , 9 + LHK , 8 + LHK , 7 + LHK } , + { NO_LED , 21 + LHK , 20 + LHK , 19 + LHK , 18 + LHK , 17 + LHK , 16 + LHK , 15 + LHK } , + { NO_LED , NO_LED , 27 + LHK , 26 + LHK , 25 + LHK , 24 + LHK , 23 + LHK , 22 + LHK } , + { 35 + LHK , 34 + LHK , 33 + LHK , 32 + LHK , 31 + LHK , 30 + LHK , 29 + LHK , 28 + LHK } + }, { + // generated from the svg image of the keyboard, see create-led-config.js + {82, 3}, {88, 3}, {94, 3}, {100, 3}, {106, 3}, {112, 3}, {118, 3}, {84, 10}, {91, 10}, {97, 10}, {103, 10}, {109, 10}, + {115, 10}, {84, 16}, {92, 16}, {98, 16}, {104, 16}, {110, 16}, {116, 16}, {82, 22}, {88, 22}, {94, 22}, {100, 22}, + {106, 22}, {112, 22}, {118, 22}, {83, 28}, {90, 28}, {98, 28}, {106, 28}, {116, 28}, {111, 34}, {118, 34}, {168, 3}, + {159, 3}, {153, 3}, {147, 3}, {141, 3}, {135, 3}, {129, 3}, {170, 13}, {162, 10}, {156, 10}, {150, 10}, {144, 10}, + {139, 10}, {133, 10}, {127, 10}, {164, 16}, {158, 16}, {152, 16}, {146, 16}, {140, 16}, {134, 16}, {128, 16}, {166, 22}, + {154, 22}, {148, 22}, {142, 22}, {136, 22}, {130, 22}, {170, 28}, {163, 28}, {156, 28}, {149, 28}, {140, 28}, {131, 28}, + {136, 34}, {128, 34}, {78, 13}, {78, 6}, {80, 0}, {87, 0}, {95, 0}, {103, 0}, {111, 0}, {119, 0}, {122, 3}, {121, 9}, + {120, 15}, {122, 21}, {123, 27}, {123, 33}, {120, 38}, {116, 42}, {114, 48}, {112, 55}, {109, 61}, {103, 64}, {96, 64}, + {88, 64}, {81, 63}, {76, 60}, {75, 52}, {75, 46}, {74, 38}, {74, 32}, {75, 27}, {77, 21}, {175, 10}, {175, 4}, {172, 0}, + {164, 0}, {157, 0}, {149, 0}, {142, 0}, {134, 0}, {127, 0}, {123, 3}, {122, 8}, {122, 15}, {124, 21}, {124, 27}, {124, 33}, + {126, 38}, {131, 42}, {134, 48}, {135, 55}, {137, 61}, {143, 63}, {150, 63}, {158, 63}, {166, 63}, {173, 63}, {177, 59}, + {178, 49}, {179, 40}, {179, 31}, {177, 25}, {175, 20}, {175, 15}, {123, 54} + + }, { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4 + } +}; diff --git a/keyboards/handwired/dygma/raise/iso/rules.mk b/keyboards/handwired/dygma/raise/iso/rules.mk new file mode 100644 index 0000000000..e69de29bb2 diff --git a/keyboards/handwired/dygma/raise/keymaps/ansi/keymap.c b/keyboards/handwired/dygma/raise/keymaps/ansi/keymap.c new file mode 100644 index 0000000000..427b9ddb14 --- /dev/null +++ b/keyboards/handwired/dygma/raise/keymaps/ansi/keymap.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2021 Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum { + QWERTY, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[QWERTY] = LAYOUT_ansi( + KC_ESC, 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_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_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_LCTL, RGB_MOD, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, + KC_BSPC, KC_ENT, KC_NO, KC_DEL +) +}; + +/* template for new layouts: +LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______ +) +*/ diff --git a/keyboards/handwired/dygma/raise/keymaps/ansi/readme.md b/keyboards/handwired/dygma/raise/keymaps/ansi/readme.md new file mode 100644 index 0000000000..ceafd78f41 --- /dev/null +++ b/keyboards/handwired/dygma/raise/keymaps/ansi/readme.md @@ -0,0 +1 @@ +# The ansi keymap for Dygma's Raise diff --git a/keyboards/handwired/dygma/raise/keymaps/default/keymap.c b/keyboards/handwired/dygma/raise/keymaps/default/keymap.c new file mode 100644 index 0000000000..c766fb7203 --- /dev/null +++ b/keyboards/handwired/dygma/raise/keymaps/default/keymap.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2021 Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum { + QWERTY, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[QWERTY] = LAYOUT_all( + KC_ESC, 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_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_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LCTL, RGB_MOD, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, + KC_BSPC, KC_ENT, KC_NO, KC_DEL +) +}; + +/* template for new layouts: +LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______ +) +*/ diff --git a/keyboards/handwired/dygma/raise/keymaps/default/readme.md b/keyboards/handwired/dygma/raise/keymaps/default/readme.md new file mode 100644 index 0000000000..1103cb349b --- /dev/null +++ b/keyboards/handwired/dygma/raise/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for Dygma's Raise diff --git a/keyboards/handwired/dygma/raise/keymaps/iso/keymap.c b/keyboards/handwired/dygma/raise/keymaps/iso/keymap.c new file mode 100644 index 0000000000..2fd0b49b0b --- /dev/null +++ b/keyboards/handwired/dygma/raise/keymaps/iso/keymap.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2021 Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum { + QWERTY, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[QWERTY] = LAYOUT_iso( + KC_ESC, 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_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_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LCTL, RGB_MOD, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, + KC_BSPC, KC_ENT, KC_NO, KC_DEL +) +}; + +/* template for new layouts: +LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______ +) +*/ diff --git a/keyboards/handwired/dygma/raise/keymaps/iso/readme.md b/keyboards/handwired/dygma/raise/keymaps/iso/readme.md new file mode 100644 index 0000000000..5f8924ae2c --- /dev/null +++ b/keyboards/handwired/dygma/raise/keymaps/iso/readme.md @@ -0,0 +1 @@ +# The iso keymap for Dygma's Raise diff --git a/keyboards/handwired/dygma/raise/leds.c b/keyboards/handwired/dygma/raise/leds.c new file mode 100644 index 0000000000..3f6037cbfa --- /dev/null +++ b/keyboards/handwired/dygma/raise/leds.c @@ -0,0 +1,101 @@ +/* Copyright 2018-2021 James Laird-Wah, Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" +#include "i2c_master.h" +#include "led_tables.h" +#include "rgb_matrix.h" +#include +#include "raise.h" +#include "wire-protocol-constants.h" +#include "print.h" +#include "leds.h" + +struct __attribute__((packed)) cRGB { + uint8_t r; + uint8_t g; + uint8_t b; +}; + +#define LEDS_PER_HAND 72 +#define LED_BANKS 9 +#define LEDS_PER_BANK 8 +#define LED_BYTES_PER_BANK (sizeof(cRGB) * LEDS_PER_BANK) + +// shifting << 1 is because drivers/chibios/i2c_master.h expects the address +// shifted. +// 0x58 and 0x59 are the addresses defined in dygma/raise/Hand.h +#define I2C_ADDR_LEFT (0x58 << 1) +#define I2C_ADDR_RIGHT (0x59 << 1) +#define I2C_ADDR(hand) ((hand) ? I2C_ADDR_RIGHT : I2C_ADDR_LEFT) +#define LEFT 0 +#define RIGHT 1 + +static cRGB led_state[2 * LEDS_PER_HAND]; + +void set_all_leds_to(uint8_t r, uint8_t g, uint8_t b) { + uint8_t buf[] = {TWI_CMD_LED_SET_ALL_TO, b, g, r}; + i2c_transmit(I2C_ADDR(LEFT), buf, sizeof(buf), I2C_TIMEOUT); + wait_us(10); + i2c_transmit(I2C_ADDR(RIGHT), buf, sizeof(buf), I2C_TIMEOUT); + wait_us(10); +} + +void set_led_to(int led, uint8_t r, uint8_t g, uint8_t b) { + int sled = led_map[led]; + uint8_t buf[] = {TWI_CMD_LED_SET_ONE_TO, sled & 0x1f, b, g, r}; + int hand = (sled >= LEDS_PER_HAND) ? RIGHT : LEFT; + i2c_transmit(I2C_ADDR(hand), buf, sizeof(buf), I2C_TIMEOUT); + wait_us(10); +} + +static void set_color(int index, uint8_t r, uint8_t g, uint8_t b) { + int sled = led_map[index]; + + led_state[sled].r = r; + led_state[sled].g = g; + led_state[sled].b = b; +} + +static void set_color_all(uint8_t r, uint8_t g, uint8_t b) { + for (int i = 0; i < DRIVER_LED_TOTAL; i++) set_color(i, r, g, b); +} + +static void init(void) {} + +static void flush(void) { + uint8_t command[1 + LED_BYTES_PER_BANK]; + + // SUBTLE(ibash) alternate hands when transmitting led data, otherwise the + // mcu in the hand seems to have trouble keeping up with the i2c + // transmission + for (int bank = 0; bank < LED_BANKS; bank++) { + for (int hand = 0; hand < 2; hand++) { + int addr = I2C_ADDR(hand); + int i = (hand * LEDS_PER_HAND) + (bank * LEDS_PER_BANK); + uint8_t *bank_data = (uint8_t *)&led_state[i]; + + command[0] = TWI_CMD_LED_BASE + bank; + memcpy(&command[1], bank_data, LED_BYTES_PER_BANK); + i2c_transmit(addr, command, sizeof(command), I2C_TIMEOUT); + + // delay to prevent issues with the i2c bus + wait_us(10); + } + } +} + +const rgb_matrix_driver_t rgb_matrix_driver = {.init = init, .flush = flush, .set_color = set_color, .set_color_all = set_color_all}; diff --git a/keyboards/handwired/dygma/raise/leds.h b/keyboards/handwired/dygma/raise/leds.h new file mode 100644 index 0000000000..8d70ed70b2 --- /dev/null +++ b/keyboards/handwired/dygma/raise/leds.h @@ -0,0 +1,25 @@ +/* Copyright 2018-2021 James Laird-Wah, Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "quantum.h" +#include "rgb_matrix.h" + +extern const uint8_t led_map[DRIVER_LED_TOTAL]; + +void set_all_leds_to(uint8_t r, uint8_t g, uint8_t b); +void set_led_to(int led, uint8_t r, uint8_t g, uint8_t b); diff --git a/keyboards/handwired/dygma/raise/matrix.c b/keyboards/handwired/dygma/raise/matrix.c new file mode 100644 index 0000000000..bbcf697a59 --- /dev/null +++ b/keyboards/handwired/dygma/raise/matrix.c @@ -0,0 +1,104 @@ +/* Copyright 2018-2021 James Laird-Wah, Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "quantum.h" +#include "i2c_master.h" +#include +#include "wire-protocol-constants.h" + +// shifting << 1 is because drivers/chibios/i2c_master.h expects the address +// shifted. +// 0x58 and 0x59 are the addresses defined in dygma/raise/Hand.h +#define I2C_ADDR_LEFT (0x58 << 1) +#define I2C_ADDR_RIGHT (0x59 << 1) +#define I2C_ADDR(hand) ((hand) ? I2C_ADDR_RIGHT : I2C_ADDR_LEFT) +#define LEFT 0 +#define RIGHT 1 + +/* If no key events have occurred, the scanners will time out on reads. + * So we don't want to be too permissive here. */ +// TODO(ibash) not convinced this is needed... +#define MY_I2C_TIMEOUT 10 +#define ROWS_PER_HAND (MATRIX_ROWS / 2) + +typedef enum { CHANGED, OFFLINE, UNCHANGED } read_hand_t; + +static read_hand_t last_state[2] = {OFFLINE, OFFLINE}; + +static read_hand_t i2c_read_hand(int hand, matrix_row_t current_matrix[]) { + // dygma raise firmware says online is true iff we get the number of + // expected bytes (e.g. 6 bytes or ROWS_PER_HAND + 1). + // In the case where no keys are pressed the keyscanner will send the same 0 + // byte over and over. -- so this case is set. + // + // On the stm32 side if we don't get as many bytes as expecetd the + // i2c_receive times out -- so online can be defined as getting + // "I2C_STATUS_SUCCESS". + + uint8_t buf[ROWS_PER_HAND + 1]; + i2c_status_t ret = i2c_receive(I2C_ADDR(hand), buf, sizeof(buf), MY_I2C_TIMEOUT); + if (ret != I2C_STATUS_SUCCESS) { + return OFFLINE; + } + + if (buf[0] != TWI_REPLY_KEYDATA) { + return UNCHANGED; + } + + int start_row = hand ? ROWS_PER_HAND : 0; + matrix_row_t *out = ¤t_matrix[start_row]; + memcpy(out, &buf[1], ROWS_PER_HAND); + + return CHANGED; +} + +static int i2c_set_keyscan_interval(int hand, int delay) { + uint8_t buf[] = {TWI_CMD_KEYSCAN_INTERVAL, delay}; + i2c_status_t ret = i2c_transmit(I2C_ADDR(hand), buf, sizeof(buf), MY_I2C_TIMEOUT); + return ret; +} + +void matrix_init_custom(void) { + i2c_init(); + + // ref: https://github.com/Dygmalab/Kaleidoscope/blob/7bac53de106c42ffda889e6854abc06cf43a3c6f/src/kaleidoscope/device/dygma/Raise.cpp#L83 + // ref: https://github.com/Dygmalab/Kaleidoscope/blob/7bac53de106c42ffda889e6854abc06cf43a3c6f/src/kaleidoscope/device/dygma/raise/Hand.cpp#L73 + i2c_set_keyscan_interval(LEFT, 50); + i2c_set_keyscan_interval(RIGHT, 50); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + // HACK(ibash) without the delay between the two calls to i2c_read_hand, the + // second call to i2c_read_hand breaks. I observed that the i2s start isn't + // sent, or maybe it is, but the address matcher in the attiny can't recognize + // it. In any case, a short delay fixes it. + read_hand_t left_state = i2c_read_hand(LEFT, current_matrix); + wait_us(10); + read_hand_t right_state = i2c_read_hand(RIGHT, current_matrix); + + + if ((last_state[LEFT] == OFFLINE && left_state != OFFLINE) || (last_state[RIGHT] == OFFLINE && right_state != OFFLINE)) { + // reinitialize both sides + i2c_set_keyscan_interval(LEFT, 50); + i2c_set_keyscan_interval(RIGHT, 50); + } + + last_state[LEFT] = left_state; + last_state[RIGHT] = right_state; + + bool matrix_has_changed = left_state == CHANGED || right_state == CHANGED; + + return matrix_has_changed; +} diff --git a/keyboards/handwired/dygma/raise/mcuconf.h b/keyboards/handwired/dygma/raise/mcuconf.h new file mode 100644 index 0000000000..fba1cace28 --- /dev/null +++ b/keyboards/handwired/dygma/raise/mcuconf.h @@ -0,0 +1,25 @@ +/* Copyright 2021 Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + +#undef STM32_I2C_BUSY_TIMEOUT +#define STM32_I2C_BUSY_TIMEOUT 5 diff --git a/keyboards/handwired/dygma/raise/raise.c b/keyboards/handwired/dygma/raise/raise.c new file mode 100644 index 0000000000..d9023093b5 --- /dev/null +++ b/keyboards/handwired/dygma/raise/raise.c @@ -0,0 +1,22 @@ +/* Copyright 2018-2021 James Laird-Wah, Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "raise.h" + +void keyboard_post_init_kb(void) { + set_all_leds_to(0, 0, 0); + keyboard_post_init_user(); +} diff --git a/keyboards/handwired/dygma/raise/raise.h b/keyboards/handwired/dygma/raise/raise.h new file mode 100644 index 0000000000..6310fc3d08 --- /dev/null +++ b/keyboards/handwired/dygma/raise/raise.h @@ -0,0 +1,83 @@ +/* Copyright 2018-2021 James Laird-Wah, Islam Sharabash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "quantum.h" + +#include "leds.h" + +#define XXX KC_NO + +#define LAYOUT_all( \ + L00, L01, L02, L03, L04, L05, L06, R06, R05, R04, R03, R02, R01, R00, \ + L10, L11, L12, L13, L14, L15, R17, R16, R15, R14, R13, R12, R11, R10, \ + L20, L21, L22, L23, L24, L25, R26, R25, R24, R23, R22, R21, R20, \ + L30, L31, L32, L33, L34, L35, L36, R35, R34, R33, R32, R31, R30, \ + L40, L41, L42, L43, L44, R45, R44, R43, R42, R41, R40, \ + L46, L47, R47, R46 \ +) { \ + { L00, L01, L02, L03, L04, L05, L06, XXX }, \ + { L10, L11, L12, L13, L14, L15, XXX, XXX }, \ + { L20, L21, L22, L23, L24, L25, XXX, XXX }, \ + { L30, L31, L32, L33, L34, L35, L36, XXX }, \ + { L40, L41, L42, L43, L44, XXX, L46, L47 }, \ + { R00, R01, R02, R03, R04, R05, R06, XXX }, \ + { R10, R11, R12, R13, R14, R15, R16, R17 }, \ + { R20, R21, R22, R23, R24, R25, R26, XXX }, \ + { R30, R31, R32, R33, R34, R35, XXX, XXX }, \ + { R40, R41, R42, R43, R44, R45, R46, R47 } \ +} + +#define LAYOUT_ansi( \ + L00, L01, L02, L03, L04, L05, L06, R06, R05, R04, R03, R02, R01, R00, \ + L10, L11, L12, L13, L14, L15, R17, R16, R15, R14, R13, R12, R11, R10, \ + L20, L21, L22, L23, L24, L25, R26, R25, R24, R23, R22, R21, R20, \ + L31 , L32, L33, L34, L35, L36, R35, R34, R33, R32, R31, R30, \ + L40, L41, L42, L43, L44, R45, R44, R43, R42, R41, R40, \ + L46, L47, R47, R46 \ +) { \ + { L00, L01, L02, L03, L04, L05, L06, XXX }, \ + { L10, L11, L12, L13, L14, L15, XXX, XXX }, \ + { L20, L21, L22, L23, L24, L25, XXX, XXX }, \ + { XXX, L31, L32, L33, L34, L35, L36, XXX }, \ + { L40, L41, L42, L43, L44, XXX, L46, L47 }, \ + { R00, R01, R02, R03, R04, R05, R06, XXX }, \ + { R10, R11, R12, R13, R14, R15, R16, R17 }, \ + { R20, R21, R22, R23, R24, R25, R26, XXX }, \ + { R30, R31, R32, R33, R34, R35, XXX, XXX }, \ + { R40, R41, R42, R43, R44, R45, R46, R47 } \ +} + +#define LAYOUT_iso( \ + L00, L01, L02, L03, L04, L05, L06, R06, R05, R04, R03, R02, R01, R00, \ + L10, L11, L12, L13, L14, L15, R17, R16, R15, R14, R13, R12, R11, R10, \ + L20, L21, L22, L23, L24, L25, R26, R25, R24, R23, R22, R21, R20, \ + L30, L31, L32, L33, L34, L35, L36, R35, R34, R33, R32, R31, R30, \ + L40, L41, L42, L43, L44, R45, R44, R43, R42, R41, R40, \ + L46, L47, R47, R46 \ +) { \ + { L00, L01, L02, L03, L04, L05, L06, XXX }, \ + { L10, L11, L12, L13, L14, L15, XXX, XXX }, \ + { L20, L21, L22, L23, L24, L25, XXX, XXX }, \ + { L30, L31, L32, L33, L34, L35, L36, XXX }, \ + { L40, L41, L42, L43, L44, XXX, L46, L47 }, \ + { R00, R01, R02, R03, R04, R05, R06, XXX }, \ + { R10, R11, R12, R13, R14, R15, R16, R17 }, \ + { R20, R21, R22, R23, R24, R25, R26, XXX }, \ + { R30, R31, R32, R33, R34, R35, XXX, XXX }, \ + { R40, R41, R42, R43, R44, R45, R46, R47 } \ +} diff --git a/keyboards/handwired/dygma/raise/readme.md b/keyboards/handwired/dygma/raise/readme.md new file mode 100644 index 0000000000..219ea5f3c9 --- /dev/null +++ b/keyboards/handwired/dygma/raise/readme.md @@ -0,0 +1,55 @@ +# Raise + +![](https://cdn.shopify.com/s/files/1/0374/9448/9228/files/Dygma-Raise-Hero2.png) + +* Keyboard Maintainer: [ibash](https://github.com/ibash) +* Hardware Supported: [F411 Blackpill](https://github.com/WeActTC/MiniSTM32F4x1) with the [Dygma Raise](http://www.dygma.com) +* Hardware Availability: See below + + +Make example for this keyboard (after setting up your build environment): + + make handwired/dygma/raise/ansi:default + +Flashing example for this keyboard: + + make handwired/dygma/raise/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). + +## Hardware + +QMK does not currently support the [Dygma Neuron](https://dygma.com/products/neuron-black) because QMK does not support SAMD21 which the Neuron has. +Instead this code uses a [STM32 Blackpill](https://github.com/WeActTC/MiniSTM32F4x1) to create a Neuron replacement. + +## Required Hardware + +1. [STM32 Blackpill from WeAct Studio](https://github.com/WeActTC/MiniSTM32F4x1) (via [aliexpress](https://www.aliexpress.com/item/1005001456186625.html) or [adafruit](https://www.adafruit.com/product/4877)). + +2. 2x USB-C breakouts (via [keeb](https://keeb.io/collections/diy-parts/products/usb-c-breakout-board) or [adafruit](https://www.adafruit.com/product/4090)). + +3. 2x 2.7KΩ resistors (via [digikey](https://www.digikey.com/en/products/detail/yageo/CFR-25JB-52-2K7/684)). + +4. Breadboard or PCB proto board, wires, solder, etc. + +## Wiring + +Briefly each raise hand uses I2C to communicate with the Neuron: + +1. USB D+ is the I2C clock line. +2. USB D- is the I2C data line. +3. The resistors are pullup resistors for the I2C lines. +4. Each hand draws power from the USB port. + +![](https://i.imgur.com/ai9rcHal.png) + +

+ + +

+ +We are also prototyping a [custom pcb](https://www.reddit.com/r/DygmaLab/comments/ojgm95/pcb_for_running_qmk_on_the_raise/?utm_source=share&utm_medium=web2x&context=3). + +

+ +

diff --git a/keyboards/handwired/dygma/raise/rules.mk b/keyboards/handwired/dygma/raise/rules.mk new file mode 100644 index 0000000000..a316e1af17 --- /dev/null +++ b/keyboards/handwired/dygma/raise/rules.mk @@ -0,0 +1,30 @@ +# MCU name +MCU = STM32F411 + +# Bootloader selection +BOOTLOADER = stm32-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = no # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = custom +CUSTOM_MATRIX = lite + +# TODO(ibash) we don't actually need to enable raw, but there's some side effect +# in the usb driver this triggers that allows mousekeys to work. The same side +# effect happens if console or midi is enabled -- so something to do with +# alternate usb endpoints. +RAW_ENABLE = yes + +QUANTUM_LIB_SRC += i2c_master.c +SRC += leds.c matrix.c diff --git a/keyboards/handwired/dygma/raise/wire-protocol-constants.h b/keyboards/handwired/dygma/raise/wire-protocol-constants.h new file mode 100644 index 0000000000..67c4ca0b23 --- /dev/null +++ b/keyboards/handwired/dygma/raise/wire-protocol-constants.h @@ -0,0 +1,51 @@ +/* KeyboardioScanner + * Copyright (C) 2015-2018 Keyboard.io, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#pragma once + +#define TWI_CMD_NONE 0x00 +#define TWI_CMD_VERSION 0x01 +#define TWI_CMD_KEYSCAN_INTERVAL 0x02 +#define TWI_CMD_LED_SET_ALL_TO 0x03 +#define TWI_CMD_LED_SET_ONE_TO 0x04 +#define TWI_CMD_COLS_USE_PULLUPS 0x05 +#define TWI_CMD_LED_SPI_FREQUENCY 0x06 + +#define LED_SPI_FREQUENCY_4MHZ 0x07 +#define LED_SPI_FREQUENCY_2MHZ 0x06 +#define LED_SPI_FREQUENCY_1MHZ 0x05 +#define LED_SPI_FREQUENCY_512KHZ 0x04 +#define LED_SPI_FREQUENCY_256KHZ 0x03 +#define LED_SPI_FREQUENCY_128KHZ 0x02 +#define LED_SPI_FREQUENCY_64KHZ 0x01 +#define LED_SPI_OFF 0x00 + + +// 512KHZ seems to be the sweet spot in early testing +// so make it the default +#define LED_SPI_FREQUENCY_DEFAULT LED_SPI_FREQUENCY_512KHZ + + +#define TWI_CMD_LED_BASE 0x80 + +#define TWI_REPLY_NONE 0x00 +#define TWI_REPLY_KEYDATA 0x01