From 77bb907feeb17f5a97544276d8a2e1b9cb512038 Mon Sep 17 00:00:00 2001 From: Albert Engelbrecht Date: Fri, 24 Sep 2021 02:30:52 -0500 Subject: [PATCH] [Keyboard] Added A. Dux keyboard configurations (#14320) Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- keyboards/a_dux/a_dux.c | 16 +++ keyboards/a_dux/a_dux.h | 47 +++++++ keyboards/a_dux/config.h | 76 ++++++++++++ keyboards/a_dux/info.json | 52 ++++++++ keyboards/a_dux/keymaps/default/config.h | 39 ++++++ keyboards/a_dux/keymaps/default/keymap.json | 106 ++++++++++++++++ keyboards/a_dux/keymaps/default/readme.md | 122 ++++++++++++++++++ keyboards/a_dux/keymaps/jcmkk3/keymap.c | 130 ++++++++++++++++++++ keyboards/a_dux/keymaps/jcmkk3/oneshot.c | 72 +++++++++++ keyboards/a_dux/keymaps/jcmkk3/oneshot.h | 46 +++++++ keyboards/a_dux/keymaps/jcmkk3/rules.mk | 1 + keyboards/a_dux/readme.md | 38 ++++++ keyboards/a_dux/rules.mk | 23 ++++ 13 files changed, 768 insertions(+) create mode 100644 keyboards/a_dux/a_dux.c create mode 100644 keyboards/a_dux/a_dux.h create mode 100644 keyboards/a_dux/config.h create mode 100644 keyboards/a_dux/info.json create mode 100644 keyboards/a_dux/keymaps/default/config.h create mode 100644 keyboards/a_dux/keymaps/default/keymap.json create mode 100644 keyboards/a_dux/keymaps/default/readme.md create mode 100644 keyboards/a_dux/keymaps/jcmkk3/keymap.c create mode 100644 keyboards/a_dux/keymaps/jcmkk3/oneshot.c create mode 100644 keyboards/a_dux/keymaps/jcmkk3/oneshot.h create mode 100644 keyboards/a_dux/keymaps/jcmkk3/rules.mk create mode 100644 keyboards/a_dux/readme.md create mode 100644 keyboards/a_dux/rules.mk diff --git a/keyboards/a_dux/a_dux.c b/keyboards/a_dux/a_dux.c new file mode 100644 index 0000000000..69eae44285 --- /dev/null +++ b/keyboards/a_dux/a_dux.c @@ -0,0 +1,16 @@ +/* Copyright 2018-2020 ENDO Katsuhiro David Philip Barr <@davidphilipbarr> Pierre Chevalier + * + * 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 "a_dux.h" diff --git a/keyboards/a_dux/a_dux.h b/keyboards/a_dux/a_dux.h new file mode 100644 index 0000000000..1edea40332 --- /dev/null +++ b/keyboards/a_dux/a_dux.h @@ -0,0 +1,47 @@ +/* Copyright 2018-2020 ENDO Katsuhiro David Philip Barr <@davidphilipbarr> Pierre Chevalier + * + * 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" + +/* This a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ + +// readability +#define ___ KC_NO + +#define LAYOUT( \ + L01, L02, L03, L04, L05, R01, R02, R03, R04, R05, \ + L06, L07, L08, L09, L10, R06, R07, R08, R09, R10, \ + L11, L12, L13, L14, L15, R11, R12, R13, R14, R15, \ + L16, L17, R16, R17 \ + ) \ + { \ + { L01, L02, L03, L04, L05 }, \ + { L06, L07, L08, L09, L10 }, \ + { L11, L12, L13, L14, L15 }, \ + { L16, L17, ___, ___ , ___}, \ + { R01, R02, R03, R04, R05 }, \ + { R06, R07, R08, R09, R10 }, \ + { R11, R12, R13, R14, R15 }, \ + { R16, R17, ___, ___, ___ } \ + } + diff --git a/keyboards/a_dux/config.h b/keyboards/a_dux/config.h new file mode 100644 index 0000000000..bacc4f14c1 --- /dev/null +++ b/keyboards/a_dux/config.h @@ -0,0 +1,76 @@ +/* Copyright 2018-2020 ENDO Katsuhiro David Philip Barr <@davidphilipbarr> Pierre Chevalier + +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 0xC2AB +#define PRODUCT_ID 0x3939 +#define DEVICE_VER 0x0001 +#define MANUFACTURER tapioki +#define PRODUCT Architeuthis dux + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 5 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * NO_DIODE = switches are directly connected to AVR pins + * +*/ +#define DIRECT_PINS { \ + { C6, D2, F7, B2, F4 }, \ + { D7, D0, F6, B3, F5 }, \ + { E6, D4, D3, B1, B6 }, \ + { B4, B5, NO_PIN, NO_PIN, NO_PIN } \ +} + +#define DIRECT_PINS_RIGHT { \ + { F4, B2, F7, D2, C6 }, \ + { F5, B3, F6, D0, D7 }, \ + { B6, B1, D3, D4, E6 }, \ + { B5, B4, NO_PIN, NO_PIN, NO_PIN } \ +} + + + +#define UNUSED_PINS + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE + +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* Serial settings */ +#define USE_SERIAL + +/* serial.c configuration for split keyboard */ +#define SOFT_SERIAL_PIN D1 + +#define EE_HANDS diff --git a/keyboards/a_dux/info.json b/keyboards/a_dux/info.json new file mode 100644 index 0000000000..e52895a58f --- /dev/null +++ b/keyboards/a_dux/info.json @@ -0,0 +1,52 @@ +{ + "keyboard_name": "Architeuthis dux", + "url": "https://github.com/tapioki/cephalopoda", + "maintainer": "@tapioki", + "layouts": { + "LAYOUT": { + "layout": [ + {"x": 0, "y": 0.93}, + {"x": 1, "y": 0.31}, + {"x": 2, "y": 0}, + {"x": 3, "y": 0.28}, + {"x": 4, "y": 0.42}, + + {"x": 7, "y": 0.42}, + {"x": 8, "y": 0.28}, + {"x": 9, "y": 0}, + {"x": 10, "y": 0.31}, + {"x": 11, "y": 0.93}, + + {"x": 0, "y": 1.93}, + {"x": 1, "y": 1.31}, + {"x": 2, "y": 1}, + {"x": 3, "y": 1.28}, + {"x": 4, "y": 1.42}, + + {"x": 7, "y": 1.42}, + {"x": 8, "y": 1.28}, + {"x": 9, "y": 1}, + {"x": 10, "y": 1.31}, + {"x": 11, "y": 1.93}, + + {"x": 0, "y": 2.93}, + {"x": 1, "y": 2.31}, + {"x": 2, "y": 2}, + {"x": 3, "y": 2.28}, + {"x": 4, "y": 2.42}, + + {"x": 7, "y": 2.42}, + {"x": 8, "y": 2.28}, + {"x": 9, "y": 2}, + {"x": 10, "y": 2.31}, + {"x": 11, "y": 2.93}, + + {"x": 3.5, "y": 3.75}, + {"x": 4.5, "y": 4}, + + {"x": 6.5, "y": 4}, + {"x": 7.5, "y": 3.75} + ] + } + } +} diff --git a/keyboards/a_dux/keymaps/default/config.h b/keyboards/a_dux/keymaps/default/config.h new file mode 100644 index 0000000000..cf0fb7478e --- /dev/null +++ b/keyboards/a_dux/keymaps/default/config.h @@ -0,0 +1,39 @@ +/* +Copyright 2020 Pierre Chevalier + +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 +// Set the mouse settings to a comfortable speed/accuracy trade-off, +// assuming a screen refresh rate of 60 Htz or higher +// The default is 50. This makes the mouse ~3 times faster and more accurate +#define MOUSEKEY_INTERVAL 16 +// The default is 20. Since we made the mouse about 3 times faster with the previous setting, +// give it more time to accelerate to max speed to retain precise control over short distances. +#define MOUSEKEY_TIME_TO_MAX 40 +// The default is 300. Let's try and make this as low as possible while keeping the cursor responsive +#define MOUSEKEY_DELAY 100 +// It makes sense to use the same delay for the mouseweel +#define MOUSEKEY_WHEEL_DELAY 100 +// The default is 100 +#define MOUSEKEY_WHEEL_INTERVAL 50 +// The default is 40 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 100 + +// Pick good defaults for enabling homerow modifiers +#define TAPPING_TERM 200 +#define PERMISSIVE_HOLD +#define IGNORE_MOD_TAP_INTERRUPT +#define TAPPING_FORCE_HOLD diff --git a/keyboards/a_dux/keymaps/default/keymap.json b/keyboards/a_dux/keymaps/default/keymap.json new file mode 100644 index 0000000000..555a86c0b0 --- /dev/null +++ b/keyboards/a_dux/keymaps/default/keymap.json @@ -0,0 +1,106 @@ +{ "version": 1, + "notes": "My awesome keymap", + "documentation": "\"This file is a QMK Configurator export. You can import this at . It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: \n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", + "keyboard": "a_dux", + "keymap": "default", + "layout": "LAYOUT", + "layers": [ + ["KC_Q" , "KC_W" , "KC_E" , "KC_R" , "KC_T", + "KC_Y" , "KC_U" , "KC_I" , "KC_O" , "KC_P", + + "LSFT_T(KC_A)", "LT(5,KC_S)" , "LT(1,KC_D)" , "LT(3,KC_F)" , "KC_G", + "KC_H" , "LT(4,KC_J)" , "LT(2,KC_K)" , "LT(6,KC_L)" , "LSFT_T(KC_SCLN)", + + "KC_Z" , "LCTL_T(KC_X)", "LALT_T(KC_C)" , "KC_V" , "KC_B", + "KC_N" , "KC_M" , "LALT_T(KC_COMM)", "LCTL_T(KC_DOT)", "KC_SLSH", + + "KC_P0" , "KC_BSPC", + "LT(7,KC_SPC)", "KC_P1" + ], + ["KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_BTN1" , "KC_WH_U" , "KC_BTN2" , "KC_TRNS", + + "KC_TRNS" , "KC_BTN2" , "KC_NO" , "KC_BTN1" , "KC_TRNS", + "KC_TRNS" , "KC_MS_L" , "KC_MS_D" , "KC_MS_U" , "KC_MS_R", + + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_WH_L" , "KC_WH_D" , "KC_WH_R" , "KC_TRNS", + + "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" + ], + ["KC_TRNS" , "KC_TRNS" , "KC_PGUP" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_LEFT" , "KC_UP" , "KC_DOWN" , "KC_RGHT" , "KC_TRNS", + "KC_TRNS" , "KC_LGUI" , "KC_NO" , "LCTL(KC_LALT)" , "LCA(KC_LSFT)", + + "KC_TRNS" , "KC_HOME" , "KC_PGDN" , "KC_END" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" + ], + ["KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_UNDS" , "KC_PIPE" , "KC_QUOT" , "KC_TRNS", + + "KC_CIRC" , "KC_ASTR" , "KC_AMPR" , "KC_NO" , "KC_TRNS", + "KC_HASH" , "KC_TILD" , "KC_SLSH" , "KC_DQUO" , "KC_DLR", + + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_MINS" , "KC_BSLS" , "KC_GRV" , "KC_TRNS", + + "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" + ], + ["KC_TRNS" , "KC_COLN" , "KC_LT" , "KC_GT" , "KC_SCLN", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_LCBR" , "KC_RCBR" , "KC_LPRN" , "KC_RPRN" , "KC_AT", + "KC_TRNS" , "KC_NO" , "KC_EQL" , "KC_PLUS" , "KC_PERC", + + "KC_TRNS" , "KC_EXLM" , "KC_LBRC" , "KC_RBRC" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_VOLD" , "KC_TRNS", + "KC_TRNS" , "KC_VOLU" + ], + ["KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_F7" , "KC_F8" , "KC_F9" , "KC_F10", + + "KC_TRNS" , "KC_NO" , "LCTL(KC_LALT)" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_F4" , "KC_F5" , "KC_F6" , "KC_F11", + + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_F1" , "KC_F2" , "KC_F3" , "KC_F12", + + "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" + ], + ["KC_PSLS" , "KC_7" , "KC_8" , "KC_9" , "KC_PPLS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_0" , "KC_1" , "KC_2" , "KC_3" , "KC_PMNS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_NO" , "KC_TRNS", + + "KC_PAST" , "KC_4" , "KC_5" , "KC_6" , "KC_PEQL", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" + ], + ["KC_TRNS" , "KC_TRNS" , "KC_COLN" , "KC_ESC" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_DEL", + + "KC_TRNS" , "KC_PERC" , "KC_SLSH" , "KC_ENT" , "KC_TRNS", + "DF(1)" , "KC_LGUI" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_EXLM" , "KC_TRNS", + "DF(0)" , "KC_TRNS" , "RALT_T(KC_COMM)", "RCTL_T(KC_DOT)", "RESET", + + "KC_TRNS" , "KC_TAB", + "KC_NO" , "KC_TRNS" + ] + ], + "author": "@pierrec83" +} diff --git a/keyboards/a_dux/keymaps/default/readme.md b/keyboards/a_dux/keymaps/default/readme.md new file mode 100644 index 0000000000..5f67a69cb2 --- /dev/null +++ b/keyboards/a_dux/keymaps/default/readme.md @@ -0,0 +1,122 @@ +A usable default keymap for the A. Dux keyboard +=============================================== + +Keymaps in general are quite personal, so it is difficult to come up with a default that will suit every user. + +This keymap makes heavy use of keys behaving differently when tapped and held, so that all the keys one may need remain accessible despite the low number of thumb keys. + +It comes with a number of layers to give access to most of the keys one may need on a keyboard. It is not meant to be the best possible keymap, but rather a good base on which to build a keymap that works for you. + +This is not the only way to make 34 keys a comfortable typing experience, but it is one way to do so. If you don't already know of a better way, this may be as good a starting point as any :) + +Note that this keymap was built from the perspective that it is OK to take a steep learning curve if it results in a keymap that is easier to use in the long run. This means that it may take more effort to learn this keymap than some alternatives. "Easy to use" was assessed against the workflow of the author, so your mileage may vary on some of the details. + +What do all these layers do? +---------------------------- + +### Layer 0: Base layer + +![Layer 0](https://i.imgur.com/HjNHUPL.png) + +On tapping the keys, our base layer is qwerty with space on the right homing thumb and backspace on the left homing thumb. + +In this layer, the non-homing-thumb positions have 0 and 1. I recommend modifying this to some frequently accessed shortcut such as copy/paste, previous/next tab or anything that makes most sense in your own workflow. O and 1 are place-holders and make it easy to troubleshoot that all keys are working properly before soldering in the switches. +The reason I recommend convenience shortcuts instead of more commonly used keys like tab or meta is that unhoming of the thumbs was a frequent source of typos for me when I used more than one thumb key frequently in the context of typing. + +Despite being missing on this layer, "meta", "tab", "esc" and such are accessible from any other layer: see Layer 7. + +The behaviour of some keys differ when held: +* Both homing pinkies behave as shift. +* Both bottom-row ring fingers behave as ctrl. +* Both bottom-row middle fingers behave as alt. + +* The homing left ring finger gives access to the Function keys layer +* The homing right ring finger gives access to the Numbers layer +* The homing left middle finger gives access to the Mouse layer +* The homing right middle finger gives access to the Navigation layer +* The homing left index finger gives access to the Right symbols layer +* The homing right index finger gives access to the Left symbols layer +* The homing right thumb gives access to the Always accessible layer + +### Layer 1: Mouse + +![Layer 1](https://i.imgur.com/0fvTuB9.png) + +Layer 1 is a mouse layer: it can be used one-handed or two-handed. The most common way to use it is two handed, with left and right click on the homerow of the left hand and directions on the homerow of the right hand. +Scrolling is available on the right hand with mid finger up and down for vertical scroll and index and ring finger down for horizontal scroll. +On the right hand, left click and right click are also available with index and ring finger up to allow one handed operation. This can be particularly handy when enabling the mouse layer permanently (no need to hold the left middle finger), which can be done from Layer 7. + +Note that thanks to the transparency, shift, ctrl and alt are all accessible on the left hand while operating the mouse. + +### Layer 2: Navigation + +![Layer 2](https://i.imgur.com/ZquQJRq.png) + +The navigation layer somewhat mirrors the mouse layer. It is accessed by holding the right middle finger and gives access to arrow keys on the left homerow. Page up and down, Home and End mirror the vertical scrolling and horizontal scrolling on the mouse layer. + +On the right hand, in addition to ctrl and alt which are available through transparency, ctrl + alt, ctrl + alt + shift and meta are accessible on the homerow to enable common shortcuts in some window managers. This part is quite workflow dependent, so make sure to adapt it to your own workflow as appropriate. + +### Layer 3: Right symbols + +![Layer 3](https://i.imgur.com/9tLAUqG.png) + +When holding down the left index, one may access about half of the symbols. The pinkies store `^` and `$` symbols that represent begin and end in vim. The left homerow hosts `*` and `&`, symbols which are related in the way that they represent some form of indirection in programming languages such as rust. On the right hand, most symbols used when navigating the command line are stored together, organized by columns of related symbols. + +### Layer 4: Left symbols + +![Layer 4](https://i.imgur.com/CkjUSW6.png) + +When holding down the right index, one may access the other symbols. On the left hand, most of the different brackets are laid out. The most frequent ones (round brackets and curly brackets) get a spot on the homerow. The rest of the layer hosts the remaining symbols that are easier to access here than on any other layers. + +### Layer 5: Function keys + +![Layer 5](https://i.imgur.com/fWgVqc4.png) + +By holding down the left ring finger, one may access the function keys, roughly in a numpad layout. +This means that alt+F4 is easy to type, with F4 being on the homerow. +There is a shortcut for ctrl+alt on the left hand to enable convenient switching between virtual terminals on Linux. + +### Layer 6: Numbers + +![Layer 6](https://i.imgur.com/S8gq9Kj.png) + +The number layer is accessed by holding the right ring finger. It hosts the numbers and some duplicated symbols that are commonly accessed next to numbers, such as mathematical operators. +The number are layed out similarly to a numpad, but with the middle row and the homerow swapped so that the most used numbers: 0, 1, 2 and 3 are all available in homing positions. + +### Layer 7: Always accessible + +![Layer 7](https://i.imgur.com/twqBeBb.png) + +Layer 7 is accessed by holding the right homing thumb down. Because this position is left transparent from every other layer, this layer is always accessible. +It gives access to some essential keys that would typically be accessed on a thumb cluster or pinkies, such as meta, enter, tab, esc and delete. + +As the layer hosting esc, we duplicated some symbols here to allow for fast navigation in vim. For instance, esc, :, w, q can be done in a single roll. + +Where is the keymap.c? +---------------------- + +The keymap.c file is not published to the repository. It is generated from `keymap.json` by the build system. + +This avoids duplicating information and allow users to edit their keymap from the qmk configurator web interface. + +How do I edit and update the keymap? +------------------------------------ + +The `keymap.json` file is generated from the qmk configurator interface and formatted for better readability in the context of the A. Dux keyboard. + +To edit it, you may: +* Edit it directly from a text editor. +* Edit it from the qmk configurator. + +If you decide to use the latter workflow, here are the steps to follow: + +* From the qmk configurator, hit the "import QMK keymap json file" button (it has a drawing with an up arrow on it). +* Browse to the location of your keymap (for example, `/keyboards/a_dux/keymaps/default/keymap.json`) +* Perform any modification to the keymap in the web UI +* Export the keymap to your downloads folder, by hitting the "Export QMK keymap json file" button (it has a drawing with a down arrow on it) +* Override your original keymap with the output of formatting the exported keymap by running a command such as this one from the root of your qmk repo: + ``` + ./keyboards/a_dux/keymaps/json2crab.py --input /default.json > ./keyboards/a_dux/keymaps/default/keymap.json + ``` + Note that you may first need to make json2crab executable by using `chmod +x` on it. + Also note that you may then want to remove the exported keymap from your dowload directory. diff --git a/keyboards/a_dux/keymaps/jcmkk3/keymap.c b/keyboards/a_dux/keymaps/jcmkk3/keymap.c new file mode 100644 index 0000000000..608e0c522e --- /dev/null +++ b/keyboards/a_dux/keymaps/jcmkk3/keymap.c @@ -0,0 +1,130 @@ +/* Copyright 2021 @jcmkk3 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include QMK_KEYBOARD_H + +#include "oneshot.h" + +#define LA_UPP OSL(UPP) +#define LA_SYM OSL(SYM) +#define LA_NAV MO(NAV) + +enum layers { + DEF, + UPP, + SYM, + NAV, + NUM, +}; + +enum keycodes { + // Custom oneshot mod implementation with no timers. + OS_SHFT = SAFE_RANGE, + OS_CTRL, + OS_ALT, + OS_GUI, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [DEF] = LAYOUT( + KC_Y, KC_C, KC_L, KC_M, KC_K, KC_Z, KC_F, KC_U, KC_QUOT, KC_DQUO, + KC_I, KC_S, KC_R, KC_T, KC_G, KC_P, KC_N, KC_E, KC_A, KC_O, + KC_Q, KC_V, KC_W, KC_D, KC_J, KC_B, KC_H, KC_COMM, KC_DOT, KC_X, + LA_NAV, KC_SPC, LA_UPP, LA_SYM + ), + + [UPP] = LAYOUT( + S(KC_Y), S(KC_C), S(KC_L), S(KC_M), S(KC_K), S(KC_Z), S(KC_F), S(KC_U), KC_EXLM, KC_QUES, + S(KC_I), S(KC_S), S(KC_R), S(KC_T), S(KC_G), S(KC_P), S(KC_N), S(KC_E), S(KC_A), S(KC_O), + S(KC_Q), S(KC_V), S(KC_W), S(KC_D), S(KC_J), S(KC_B), S(KC_H), KC_SCLN, KC_COLN, S(KC_X), + _______, _______, _______, _______ + ), + + [SYM] = LAYOUT( + KC_LABK, KC_LCBR, KC_LBRC, KC_LPRN, KC_CIRC, KC_DLR, KC_RPRN, KC_RBRC, KC_RCBR, KC_RABK, + KC_HASH, KC_UNDS, KC_EQL, KC_MINS, KC_PLUS, KC_AMPR, OS_CTRL, OS_SHFT, OS_ALT, OS_GUI, + KC_PERC, KC_GRV, KC_TILD, KC_SLSH, KC_ASTR, KC_PIPE, KC_BSLS, KC_SCLN, KC_COLN, KC_AT, + _______, _______, _______, _______ + ), + + [NAV] = LAYOUT( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_TAB, KC_UP, KC_ENT, KC_DEL, + OS_GUI, OS_ALT, OS_SHFT, OS_CTRL, XXXXXXX, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, + C(KC_Z), C(KC_X), C(KC_C), C(KC_V), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, _______, KC_BSPC, _______ + ), + + [NUM] = LAYOUT( + KC_7, KC_5, KC_3, KC_1, KC_9, KC_8, KC_0, KC_2, KC_4, KC_6, + OS_GUI, OS_ALT, OS_SHFT, OS_CTRL, XXXXXXX, XXXXXXX, OS_CTRL, OS_SHFT, OS_ALT, OS_GUI, + XXXXXXX, XXXXXXX, XXXXXXX, KC_MINS, XXXXXXX, XXXXXXX, XXXXXXX, KC_COMM, KC_DOT, KC_SLSH, + _______, _______, KC_BSPC, _______ + ), +}; + +bool is_oneshot_cancel_key(uint16_t keycode) { + switch (keycode) { + case LA_SYM: + case LA_NAV: + return true; + default: + return false; + } +} + +bool is_oneshot_ignored_key(uint16_t keycode) { + switch (keycode) { + case LA_SYM: + case LA_NAV: + case KC_LSFT: + case OS_SHFT: + case OS_CTRL: + case OS_ALT: + case OS_GUI: + return true; + default: + return false; + } +} + +oneshot_state os_shft_state = os_up_unqueued; +oneshot_state os_ctrl_state = os_up_unqueued; +oneshot_state os_alt_state = os_up_unqueued; +oneshot_state os_gui_state = os_up_unqueued; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + update_oneshot( + &os_shft_state, KC_LSFT, OS_SHFT, + keycode, record + ); + update_oneshot( + &os_ctrl_state, KC_LCTL, OS_CTRL, + keycode, record + ); + update_oneshot( + &os_alt_state, KC_LALT, OS_ALT, + keycode, record + ); + update_oneshot( + &os_gui_state, KC_LGUI, OS_GUI, + keycode, record + ); + + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, SYM, NAV, NUM); +} diff --git a/keyboards/a_dux/keymaps/jcmkk3/oneshot.c b/keyboards/a_dux/keymaps/jcmkk3/oneshot.c new file mode 100644 index 0000000000..e84b5a7b1d --- /dev/null +++ b/keyboards/a_dux/keymaps/jcmkk3/oneshot.c @@ -0,0 +1,72 @@ +/* Copyright 2021 @jcmkk3 + * + * 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 "oneshot.h" + +void update_oneshot( + oneshot_state *state, + uint16_t mod, + uint16_t trigger, + uint16_t keycode, + keyrecord_t *record +) { + if (keycode == trigger) { + if (record->event.pressed) { + // Trigger keydown + if (*state == os_up_unqueued) { + register_code(mod); + } + *state = os_down_unused; + } else { + // Trigger keyup + switch (*state) { + case os_down_unused: + // If we didn't use the mod while trigger was held, queue it. + *state = os_up_queued; + break; + case os_down_used: + // If we did use the mod while trigger was held, unregister it. + *state = os_up_unqueued; + unregister_code(mod); + break; + default: + break; + } + } + } else { + if (record->event.pressed) { + if (is_oneshot_cancel_key(keycode) && *state != os_up_unqueued) { + // Cancel oneshot on designated cancel keydown. + *state = os_up_unqueued; + unregister_code(mod); + } + } else { + if (!is_oneshot_ignored_key(keycode)) { + // On non-ignored keyup, consider the oneshot used. + switch (*state) { + case os_down_unused: + *state = os_down_used; + break; + case os_up_queued: + *state = os_up_unqueued; + unregister_code(mod); + break; + default: + break; + } + } + } + } +} diff --git a/keyboards/a_dux/keymaps/jcmkk3/oneshot.h b/keyboards/a_dux/keymaps/jcmkk3/oneshot.h new file mode 100644 index 0000000000..b88e68d1d5 --- /dev/null +++ b/keyboards/a_dux/keymaps/jcmkk3/oneshot.h @@ -0,0 +1,46 @@ +/* Copyright 2021 @jcmkk3 + * + * 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 QMK_KEYBOARD_H + +// Represents the four states a oneshot key can be in +typedef enum { + os_up_unqueued, + os_up_queued, + os_down_unused, + os_down_used, +} oneshot_state; + +// Custom oneshot mod implementation that doesn't rely on timers. If a mod is +// used while it is held it will be unregistered on keyup as normal, otherwise +// it will be queued and only released after the next non-mod keyup. +void update_oneshot( + oneshot_state *state, + uint16_t mod, + uint16_t trigger, + uint16_t keycode, + keyrecord_t *record +); + +// To be implemented by the consumer. Defines keys to cancel oneshot mods. +bool is_oneshot_cancel_key(uint16_t keycode); + +// To be implemented by the consumer. Defines keys to ignore when determining +// whether a oneshot mod has been used. Setting this to modifiers and layer +// change keys allows stacking multiple oneshot modifiers, and carrying them +// between layers. +bool is_oneshot_ignored_key(uint16_t keycode); diff --git a/keyboards/a_dux/keymaps/jcmkk3/rules.mk b/keyboards/a_dux/keymaps/jcmkk3/rules.mk new file mode 100644 index 0000000000..b7dcd87b1e --- /dev/null +++ b/keyboards/a_dux/keymaps/jcmkk3/rules.mk @@ -0,0 +1 @@ +SRC += oneshot.c diff --git a/keyboards/a_dux/readme.md b/keyboards/a_dux/readme.md new file mode 100644 index 0000000000..7d9956f1ef --- /dev/null +++ b/keyboards/a_dux/readme.md @@ -0,0 +1,38 @@ +# Architeuthis Dux + +![Architeuthis Dux](https://raw.githubusercontent.com/tapioki/cephalopoda/main/Images/architeuthis_dux.png) + +AKA A. dux, A.D., "Giant squid" + +34 keys, same stagger as [D. gigas](https://github.com/tapioki/cephalopoda/tree/main/Dosidicus%20gigas), but with two thumb keys included. Pinky, ring, index, and inner columns splayed at 15, 5, 0, -5, -5 degrees. SplitKB Tenting Puck support. All PCB files are available on the [project's github page](https://github.com/tapioki/cephalopoda/tree/main/Architeuthis%20dux) + +Thank you [Perce](https://madebyperce.com/) for the logo. + +## Cases can be found here: + +* [Flat Case](https://github.com/madebyperce/aduxcase) +* [Tented Case](https://github.com/jdart/adux-tent) +* [Case with Plates](https://github.com/sadekbaroudi/cephalopoda/tree/main/Architeuthis%20dux/case) + +## Keyboard Info + +* Keyboard Maintainer: [tapioki](https://github.com/tapioki) +* Hardware Supported: Architeuthis Dux +* Hardware Availability: [GitHub](https://github.com/tapioki/cephalopoda/tree/main/Architeuthis%20dux) + +Make examples for this keyboard (after setting up your build environment): + + make a_dux:default + + make a_dux:default:avrdude-split-left + make a_dux:default:avrdude-split-right + +## 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**: Briefly short the RST and GND pins on the microcontroller using tweezers, a paperclip, or any other conductive material. +* **Keycode in layout**: Press the key mapped to `RESET` if it is available + +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). diff --git a/keyboards/a_dux/rules.mk b/keyboards/a_dux/rules.mk new file mode 100644 index 0000000000..d7671a17b3 --- /dev/null +++ b/keyboards/a_dux/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +UNICODE_ENABLE = yes +SPLIT_KEYBOARD = yes