From ec4c12501ce8ca4184689e114d8e3465c8f1daf2 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 09:31:12 -0400 Subject: Fix up the keymap docs after the DT refactor. --- docs/docs/feature/keymaps.md | 50 ++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'docs') diff --git a/docs/docs/feature/keymaps.md b/docs/docs/feature/keymaps.md index 3eee145..133ce93 100644 --- a/docs/docs/feature/keymaps.md +++ b/docs/docs/feature/keymaps.md @@ -102,24 +102,39 @@ ALl the remaining keymap nodes will be nested inside of the root devicetree node }; ``` +### Keymap Node + +Nested under the devicetree root, is the keymap node. The node _name_ itself is not critical, but the node **MUST** have a property +`compatible = "zmk,keymap"` in order to be used by ZMK. + +``` + keymap { + compatible = "zmk,keymap"; + + // Layer nodes go here! + }; +``` + ### Layers +Each layer of your keymap will be nested under the keymap node. Here is a sample +that defines just one layer for this keymap: + ``` - layers { - compatible = "zmk,layers"; + keymap { + compatible = "zmk,keymap"; - default: layer_0 { - label = "DEFAULT"; + default_layer { // --------------------------------------------------------------------------------------------------------------------------------- // | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ | // | TAB | A | S | D | F | G | | H | J | K | L | ; | ' | // | SHIFT | Z | X | C | V | B | L SHIFT | L SHIFT | | L SHIFT | L SHIFT | N | M | , | . | / | CTRL | // | GUI | DEL | RET | SPACE | ESC | | RET | SPACE | TAB | BSPC | R-ALT | bindings = < - &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH - &kp TAB &kp A &kp S &mt MOD_LCTL D &mt MOD_LSFT F &kp G &kp H &mt MOD_LSFT J &mt MOD_LCTL K &kp L &kp SCLN &kp QUOT - &kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp LSFT &kp LSFT &kp LSFT &kp LSFT &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RCTL - &kp LGUI &kp DEL &kp RET &kp SPC &mo 1 &mo 2 &kp SPC &kp RET &kp BKSP &kp RALT + &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH + &kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT + &kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp LSFT &kp LSFT &kp LSFT &kp LSFT &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RCTL + &kp LGUI &kp DEL &kp RET &kp SPC &kp ESC &kp RET &kp SPC &kp TAB &kp BKSP &kp RALT >; sensor-bindings = <&inc_dec_cp M_VOLU M_VOLD &inc_dec_kp PGUP PGDN>; @@ -127,23 +142,12 @@ ALl the remaining keymap nodes will be nested inside of the root devicetree node }; ``` -### Keymap +Each layer should have: -``` - keymap0: keymap { - compatible = "zmk,keymap"; - label ="Default Kyria Keymap"; - layers = <&default>; - }; -``` - -### Chosen Keymap +1. A `bindings` property this will be a list of behaviour bindings, one for each key position for the keyboard. +1. (Optional) A `sensor-bindings` property that will be a list of behavior bindings for each sensor on the keyboard. (Currently, only encoders are supported as sensor hardware, but in the future devices like trackpoints would be supported the same way) -``` - chosen { - zmk,keymap = &keymap0; - }; -``` +For the full set of possible behaviors, start at the [Key Press](/docs/behavior/key-press) behavior. ### Complete Example -- cgit v1.2.3 From 5c10517c29696fdc4ba7b7574fbde0e7a68a4589 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 09:36:48 -0400 Subject: Show the complete keymap example inline. --- docs/docs/feature/keymaps.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/docs/feature/keymaps.md b/docs/docs/feature/keymaps.md index 133ce93..3b8ebb8 100644 --- a/docs/docs/feature/keymaps.md +++ b/docs/docs/feature/keymaps.md @@ -151,4 +151,31 @@ For the full set of possible behaviors, start at the [Key Press](/docs/behavior/ ### Complete Example -You can see a complete example if you see the [stock Kyria keymap](https://github.com/zmkfirmware/zmk/blob/main/app/boards/shields/kyria/kyria.keymap). +Putting this all together, a complete [`kyria.keymap`](https://github.com/zmkfirmware/zmk/blob/main/app/boards/shields/kyria/kyria.keymap) looks like: + +``` +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { +// --------------------------------------------------------------------------------------------------------------------------------- +// | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ | +// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' | +// | SHIFT | Z | X | C | V | B | L SHIFT | L SHIFT | | L SHIFT | L SHIFT | N | M | , | . | / | CTRL | +// | GUI | DEL | RET | SPACE | ESC | | RET | SPACE | TAB | BSPC | R-ALT | + bindings = < + &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH + &kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT + &kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp LSFT &kp LSFT &kp LSFT &kp LSFT &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RCTL + &kp LGUI &kp DEL &kp RET &kp SPC &kp ESC &kp RET &kp SPC &kp TAB &kp BKSP &kp RALT + >; + + sensor-bindings = <&inc_dec_cp M_VOLU M_VOLD &inc_dec_kp PGUP PGDN>; + }; + }; +}; +``` -- cgit v1.2.3 From ccb9b9309a37f55e0aca3c79aa1d78214a42f701 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 10:02:44 -0400 Subject: Script fixes, ability to prepopulate a keymap. * Use read w/ -i for initial default values. * Prompt for fetching keymap for customization, and grab latest from `main` if opted in. * Don't copy `prj.conf` from the template, pull the `.conf` from `main` also. --- docs/static/setup.sh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 23ab42b..a122994 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -7,6 +7,7 @@ title="ZMK Config Setup:" # TODO: Check for git being installed +# TODO: Check for curl being installed # TODO: Check for user.name and user.email git configs being set prompt="Pick an MCU board:" @@ -41,7 +42,7 @@ options=("Kyria" "Lily58") PS3="$prompt " # TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos. # select opt in "${options[@]}" "Other" "Quit"; do -select opt in "${options[@]}" "Other" "Quit"; do +select opt in "${options[@]}" "Quit"; do case "$REPLY" in @@ -56,12 +57,16 @@ select opt in "${options[@]}" "Other" "Quit"; do esac done -read -p "GitHub Username (leave empty to skip GitHub repo creation): " github_user +read -e -p "Copy in the stock keymap for customization? [Yn]: " copy_keymap + +if [ -z "$copy_keymap" ] || [ "$copy_keymap" == "Y" ] || [ "$copy_keymap" == "y" ]; then copy_keymap="yes"; fi + +read -e -p "GitHub Username (leave empty to skip GitHub repo creation): " github_user if [ -n "$github_user" ]; then - read -p "GitHub Repo Name [zmk-config]: " repo_name + read -e -i "zmk-config" -p "GitHub Repo Name: " repo_name if [ -z "$repo_name" ]; then repo_name="zmk-config"; fi - read -p "GitHub Repo [https://github.com/${github_user}/${repo_name}.git]: " github_repo + read -e -i "https://github.com/${github_user}/${repo_name}.git" -p "GitHub Repo: " github_repo if [ -z "$github_repo" ]; then github_repo="https://github.com/${github_user}/${repo_name}.git"; fi else @@ -72,6 +77,11 @@ echo "" echo "Preparing a user config for:" echo "* MCU Board: ${board}" echo "* Shield: ${shield}" +if [ "$copy_keymap" == "yes" ]; then + echo "* Copy Keymap?: ✓" +else + echo "* Copy Keymap?: ❌" +fi if [ -n "$github_repo" ]; then echo "* GitHub Repo To Push (please create this in GH first!): ${github_repo}" fi @@ -87,14 +97,22 @@ fi git clone --single-branch $repo_path ${repo_name} cd ${repo_name} +pushd config + +curl -O "https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${shield}/${shield}.conf" + +if [ "$copy_keymap" == "yes" ]; then + curl -O "https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${shield}/${shield}.keymap" +fi + +popd + sed -i \ -e "s/BOARD_NAME/$board/" \ -e "s/SHIELD_NAME/$shield/" \ -e "s/KEYBOARD_TITLE/$shield_title/" \ .github/workflows/build.yml -mv config/prj.conf "config/${shield}.conf" - rm -rf .git git init . git add . -- cgit v1.2.3 From 14eef91da1d2f9f93ba66d9728408b1a12d37758 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 15:05:20 -0400 Subject: Better user setup docs. --- docs/docs/assets/user-setup/firmware-archive.png | Bin 0 -> 13312 bytes .../docs/assets/user-setup/github-actions-link.png | Bin 0 -> 10573 bytes docs/docs/user-setup.md | 65 +++++++++++++++++++-- docs/sidebars.js | 2 +- 4 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 docs/docs/assets/user-setup/firmware-archive.png create mode 100644 docs/docs/assets/user-setup/github-actions-link.png (limited to 'docs') diff --git a/docs/docs/assets/user-setup/firmware-archive.png b/docs/docs/assets/user-setup/firmware-archive.png new file mode 100644 index 0000000..9cb6f7d Binary files /dev/null and b/docs/docs/assets/user-setup/firmware-archive.png differ diff --git a/docs/docs/assets/user-setup/github-actions-link.png b/docs/docs/assets/user-setup/github-actions-link.png new file mode 100644 index 0000000..c12483b Binary files /dev/null and b/docs/docs/assets/user-setup/github-actions-link.png differ diff --git a/docs/docs/user-setup.md b/docs/docs/user-setup.md index e90bef8..90886dc 100644 --- a/docs/docs/user-setup.md +++ b/docs/docs/user-setup.md @@ -6,6 +6,7 @@ sidebar_label: Installing ZMK import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import Image from '@theme/IdealImage'; Unlike other keyboard firmwares, ZMK Firmware has been built from the ground up to allow users to manage their own keyboard configurations, including keymaps, specific hardware details, etc. all outside of the @@ -41,6 +42,10 @@ The remainder of this guide assumes the following prequisites: 1. You have an active, working [GitHub](https://github.com/) account. 1. You have installed and configured the [`git`](https://git-scm.com/) version control tool. +:::note +If you need to, a quick read of [Learn The Basics Of Git In Under 10 Minutes](https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/) will help you get started. +::: + ## GitHub Repo Before running the setup script, you will first need to create a new GitHub repository to host the config. @@ -101,6 +106,18 @@ Keyboard Shield Selection: Pick an keyboard: ``` +### Keymap Customization + +At the next prompt, you have an opportunity to decide if you want the stock keymap file copied in +for further customization: + +``` +Copy in the stock keymap for customization? [Yn]: +``` + +Hit `Enter` or type `yes`/`y` to accept this. If you want to keep the stock keymap, or write a keymap +from scratch, type in `no`/`n`. + ### GitHub Details In order to have your new configuration automatically pushed, and then built using GitHub Actions, enter @@ -108,8 +125,8 @@ some information about your particular GitHub info: ``` GitHub Username (leave empty to skip GitHub repo creation): petejohanson -GitHub Repo Name [zmk-config]: -GitHub Repo [https://github.com/petejohanson/zmk-config.git]: +GitHub Repo Name: zmk-config +GitHub Repo: https://github.com/petejohanson/zmk-config.git ``` Only the GitHub username is required; if you are happy with the defaults offered in the square brackets, you can simply hit `Enter`. @@ -137,11 +154,49 @@ push the initial commit. ::: -## Accessing Built Firmware +## Installing The Firmware + +### Download The Archive Once the setup script is complete and the new user config repository has been pushed, GitHub will automatically run the action to build your keyboard firmware files. You can view the actions by clicking on the "Actions" tab on your GitHub repository. -## Keymap Changes +![](./assets/user-setup/github-actions-link.png) + +Once you have loaded the Actions tab, select the top build from the list. Once you load it, the right side panel will include +a link to download the `firmware` upload: + +![](./assets/user-setup/firmware-archive.png) + +Once downloaded, extract the zip and you can verify it should contain one or more `uf2` files, which will be copied to +your keyboard. -TODO: Document how to add your own keymap! +### Installing UF2 Files + +To flash the firmware, first put your board into bootloader mode by double clicking the reset button (either on the MCU board itself, +or the one that is part of your keyboard). The controller should appear in your OS as a new USB storage device. + +Once this happens, copy the correct UF2 file (e.g. left or right if working on a split), and paste it onto the root of that USB mass +storage device. One the flash is complete, the controller should automatically restart, and load your newfly flashed firmware. + +## Customization + +### Configuration Changes + +The setup script creates a `config/.conf` file that allows you to add additional configuration options to +control what features and options are built into your firmware. Opening that file with your text editor you should see +various config settings that can be commented/uncommented to modify how your firmware is built. + +### Keymap + +Once you have the basic user config completed, you can find the file in `config/.keymap` and customize from there. +Refer to the [Keymap](/docs/feature/keymaps) documentation to learn more. + +### Publishing + +After making any changes you want, you should commit the changes and then push them to GitHub. That will trigger a new +GitHub Actions job to build your firmware which you can download once it completes. + +:::note +If you need to, a review of [Learn The Basics Of Git In Under 10 Minutes](https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/) will help you get these steps right. +::: diff --git a/docs/sidebars.js b/docs/sidebars.js index f625672..43d4ea7 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -1,6 +1,6 @@ module.exports = { someSidebar: { - "Getting Started": ["intro", "hardware", "user-setup", "faq"], + "Getting Started": ["intro", "hardware", "faq", "user-setup"], Features: [ "feature/keymaps", "feature/displays", -- cgit v1.2.3 From 5418918e138650273435c8d8ec93259722dcc982 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 15:15:04 -0400 Subject: Explicitly use bash. --- docs/docs/user-setup.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/docs/user-setup.md b/docs/docs/user-setup.md index 90886dc..11b47f6 100644 --- a/docs/docs/user-setup.md +++ b/docs/docs/user-setup.md @@ -69,14 +69,14 @@ values={[ ``` -sh -c "$(curl -fsSL https://zmkfirmware.dev/setup.sh)" +bash -c "$(curl -fsSL https://zmkfirmware.dev/setup.sh)" ``` ``` -sh -c "$(wget https://zmkfirmware.dev/setup.sh -O -)" +bash -c "$(wget https://zmkfirmware.dev/setup.sh -O -)" ``` -- cgit v1.2.3 From 4b310abb3de8fed1080ced9d0466a21a4955463a Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 15:30:37 -0400 Subject: Remove broken import. --- docs/docs/user-setup.md | 1 - 1 file changed, 1 deletion(-) (limited to 'docs') diff --git a/docs/docs/user-setup.md b/docs/docs/user-setup.md index 11b47f6..a279020 100644 --- a/docs/docs/user-setup.md +++ b/docs/docs/user-setup.md @@ -6,7 +6,6 @@ sidebar_label: Installing ZMK import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -import Image from '@theme/IdealImage'; Unlike other keyboard firmwares, ZMK Firmware has been built from the ground up to allow users to manage their own keyboard configurations, including keymaps, specific hardware details, etc. all outside of the -- cgit v1.2.3 From 3b841c65bb264ec4a512ac564a0c4d0daa636cee Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 15:58:09 -0400 Subject: Typo fix (thanks @Nicell). --- docs/docs/user-setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/docs/user-setup.md b/docs/docs/user-setup.md index a279020..b79b573 100644 --- a/docs/docs/user-setup.md +++ b/docs/docs/user-setup.md @@ -176,7 +176,7 @@ To flash the firmware, first put your board into bootloader mode by double click or the one that is part of your keyboard). The controller should appear in your OS as a new USB storage device. Once this happens, copy the correct UF2 file (e.g. left or right if working on a split), and paste it onto the root of that USB mass -storage device. One the flash is complete, the controller should automatically restart, and load your newfly flashed firmware. +storage device. Once the flash is complete, the controller should automatically restart, and load your newfly flashed firmware. ## Customization -- cgit v1.2.3 From dd8deceed02b9d439eca3bc10fdde5b5d0fb9c6e Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 16:29:52 -0400 Subject: Add basic layer behavior docs. --- docs/docs/behavior/layers.md | 41 +++++++++++++++++++++++++++++++++++++++++ docs/sidebars.js | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 docs/docs/behavior/layers.md (limited to 'docs') diff --git a/docs/docs/behavior/layers.md b/docs/docs/behavior/layers.md new file mode 100644 index 0000000..2388caf --- /dev/null +++ b/docs/docs/behavior/layers.md @@ -0,0 +1,41 @@ +--- +title: Layers +--- + +## Summary + +Often, you may want a certain key position to alter which layers are enabled, change the default layer, etc. +Some of those behaviors are still in the works; the ones that are working now are documented here. + +## Defines To Refer To Layers + +When working with layers, you may have several different key positions with bindings that enable/disable those layers. +To make it easier to refer to those layers in your key bindings, and to change which layers are where later, you can +add a set of `#define`s at the top of your keymap file, and use those layer in your keymap. + +For example, if you have three layers, you can add the following to the top of your keymap: + +``` +#define DEFAULT 0 +#define LOWER 1 +#define RAISE 2 +``` + +This allows you to use those defines, e.g. `LOWER` later in your keymap. + +## Momentary Layer + +The "momentary layer" behavior allows you to enable a layer while a certain key is pressed. Immediately upon +activation of the key, the layer is enabled, and immediately open release of the key, the layer is disabled +again. + +### Behavior Binding + +- Reference: `&mo` +- Parameter: The layer number to enable/disable, e.g. `1` + +Example: + +``` +&mo LOWER +``` diff --git a/docs/sidebars.js b/docs/sidebars.js index 43d4ea7..7b04864 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -7,7 +7,7 @@ module.exports = { "feature/encoders", "feature/underglow", ], - Behaviors: ["behavior/key-press"], + Behaviors: ["behavior/key-press", "behavior/layers"], Development: [ "dev-clean-room", "dev-setup", -- cgit v1.2.3 From b25133cbefbeecbdde0ba6206d9cd54d7f2c1a12 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 16:45:11 -0400 Subject: Add a layer diagram. * Original diagram from Thomas Baart, used with permission. --- docs/docs/assets/features/keymaps/layer-diagram.png | Bin 0 -> 53975 bytes docs/docs/feature/keymaps.md | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 docs/docs/assets/features/keymaps/layer-diagram.png (limited to 'docs') diff --git a/docs/docs/assets/features/keymaps/layer-diagram.png b/docs/docs/assets/features/keymaps/layer-diagram.png new file mode 100644 index 0000000..7b42daa Binary files /dev/null and b/docs/docs/assets/features/keymaps/layer-diagram.png differ diff --git a/docs/docs/feature/keymaps.md b/docs/docs/feature/keymaps.md index 3b8ebb8..020df17 100644 --- a/docs/docs/feature/keymaps.md +++ b/docs/docs/feature/keymaps.md @@ -39,11 +39,13 @@ Like many mechanical keyboard firmwares, ZMK keymaps are composed of a collectio minimum of at least one layer that is the default, usually near the bottom of the "stack". Each layer in ZMK contains a set of bindings that bind a certain behavior to a certain key position in that layer. +| ![Diagram of three layers](../assets/features/keymaps/layer-diagram.png) | +| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | +| _A simplified diagram showing three layers. The layout of each layer is the same (they all contain four keys), but the behavior bindings within each layer can be different._ | + In addition to the base default layer (which can be changed), certain bound behaviors may also enable/disable additional layers "on top" of the default layer. -**TODO**: A diagram to help visualize layers - When a key location is pressed/released, the stack of all active layers from "top to bottom" is used, and the event is sent to the behavior bound at that position in each layer, for it to perform whatever actions it wants to in reaction to the event. Those behaviors can choose to "handle" the event, and stop -- cgit v1.2.3 From 5039a508311bcd74c1aaef7542c3b6e1c6a01929 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 23:35:48 -0400 Subject: Tweak git usage for backwards compatibility. * Closes #76 --- docs/static/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index a122994..1a72224 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -120,7 +120,7 @@ git commit -m "Initial User Config." if [ -n "$github_repo" ]; then git remote add origin "$github_repo" - git push --set-upstream origin $(git branch --show-current) + git push --set-upstream origin $(git symbolic-ref --short HEAD) # TODO: Support determing the actions URL when non-https:// repo URL is used. if [ "${github_repo}" != "${github_repo#https://}" ]; then -- cgit v1.2.3 From 85d35c7ff987f58c2f43ae6eae0387d923124d4a Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sat, 8 Aug 2020 12:25:54 -0400 Subject: Tweak the pip PATH callouts. --- docs/docs/dev-setup.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/docs/dev-setup.md b/docs/docs/dev-setup.md index 9e4d939..016b14c 100644 --- a/docs/docs/dev-setup.md +++ b/docs/docs/dev-setup.md @@ -188,7 +188,7 @@ West can be installed by using the `pip` python package manager. pip3 install --user -U west ``` -:::tip pip user packages +:::danger pip user packages If you haven't done so yet, you may need to add the Python Pip user package directory to your `PATH`, e.g.: ``` @@ -306,7 +306,7 @@ cd zmk west init -l app/ ``` -:::note +:::caution Command Not Found? If you encounter errors like `command not found: west` then your `PATH` environment variable is likely missing the Python 3 user packages directory. See the [West Build Command](#west-build-command) section again for links to how to do this -- cgit v1.2.3 From 483530e0ad8c882d4c29f397f620e578efd5ee9d Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sat, 8 Aug 2020 17:10:12 -0400 Subject: Basic key press/consumer press behavior docs. --- docs/docs/behavior/key-press.md | 58 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/docs/behavior/key-press.md b/docs/docs/behavior/key-press.md index 8a69c4f..08296bb 100644 --- a/docs/docs/behavior/key-press.md +++ b/docs/docs/behavior/key-press.md @@ -2,4 +2,60 @@ title: Key Presses --- -TODO: Docs on key press behavior +## Summary + +The most basic of behaiors, is the ability to send certain keycode presses and releases in response to activating +a certain key. + +For reference on keycode values, see the [USB HID Usage Tables](https://www.usb.org/document-library/hid-usage-tables-12). + +## Keycode Defines + +To make it easier to encode the HID keycode numeric values, most keymaps include +the [`dt-bindings/zmk/keys.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/keys.h) header +provided by ZMK near the top: + +``` +#include +``` + +Doing so makes a set of defines such as `A`, `NUM_1`, etc. available for use with these behaviors + +:::note +There is an [open issue](https://github.com/zmkfirmware/zmk/issues/21) to provide a more comprehensive, and +complete set of defines for the full keypad and consumer usage pages in the future for ZMK. +::: + +## Keypad Key Press + +The "keypad key press" behavior sends standard keypad keycodes on press/release. + +### Behavior Binding + +- Reference: `&kp` +- Parameter: The keycode usage ID from the keypad usage page, e.g. `4` or `A` + +Example: + +``` +&kp A +``` + +## Consumer Key Press + +The "consumer key press" behavior allows you to send "consumer" usage page keycodes on press/release. +These are mostly used for media and power related keycodes, such as sending "Pause", "Scan Track Next", +"Scan Track Previous", etc. + +There are a subset of the full consumer usage IDs found in the `keys.h` include, prefixed with `M_`, e.g. `M_PREV`. + +### Behavior Binding + +- Reference: `&cp` +- Parameter: The keycode usage ID from the consumer usage page, e.g. `M_PREV` or `M_EJCT` + +Example: + +``` +&cp M_PREV +``` -- cgit v1.2.3 From e2848c66c305442badd2b21a414c1a8fe89cd4fd Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sat, 8 Aug 2020 17:28:00 -0400 Subject: Fix to archive the .hex files for proton-c build. * Closes #77. --- docs/static/setup.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 1a72224..327fc84 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -113,6 +113,11 @@ sed -i \ -e "s/KEYBOARD_TITLE/$shield_title/" \ .github/workflows/build.yml +if [ "$board" == "proton_c" ]; then + # Proton-C board still fa + sed -i -e "s/uf2/hex/g" .github/workflows/build.yml +fi + rm -rf .git git init . git add . -- cgit v1.2.3 From c92f114efe14e1ad7f7fafbb2f3cc402cefa1bbe Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 8 Aug 2020 17:23:11 -0500 Subject: Add lighting behavior docs --- docs/docs/behavior/lighting.md | 50 ++++++++++++++++++++++++++++++++++++++++++ docs/sidebars.js | 6 ++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 docs/docs/behavior/lighting.md (limited to 'docs') diff --git a/docs/docs/behavior/lighting.md b/docs/docs/behavior/lighting.md new file mode 100644 index 0000000..432960e --- /dev/null +++ b/docs/docs/behavior/lighting.md @@ -0,0 +1,50 @@ +--- +title: Lighting +--- + +## Summary + +Lighting is often used for either aesthetics or for the practical purposes of lighting up keys in the dark. +Currently ZMK supports RGB underglow, which can be changed and configured using its behavior. + +## RGB Action Defines + +RGB actions defines are provided through the [`dt-bindings/zmk/rgb.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/rgb.h) header, +which is added at the top of the keymap file: + +``` +#include +``` + +This will allow you to reference the actions defined in this header such as `RGB_TOG`. + +Here is a table describing the action for each define: + +| Define | Action | +|-----------|-----------------------------------------------------------| +| `RGB_TOG` | Toggles the RGB feature on and off | +| `RGB_HUI` | Increases the hue of the RGB feature | +| `RGB_HUD` | Decreases the hue of the RGB feature | +| `RGB_SAI` | Increases the saturation of the RGB feature | +| `RGB_SAD` | Decreases the saturation of the RGB feature | +| `RGB_BRI` | Increases the brightness of the RGB feature | +| `RGB_BRD` | Decreases the brightness of the RGB feature | +| `RGB_SPI` | Increases the speed of the RGB feature effect's animation | +| `RGB_SPD` | Decreases the speed of the RGB feature effect's animation | +| `RGB_EFF` | Cycles the RGB feature's effect forwards | +| `RGB_EFR` | Cycles the RGB feature's effect reverse | + +## RGB Underglow + +The "RGB underglow" behavior completes an RGB action given on press. + +### Behavior Binding + +- Reference: `&rgb_ug` +- Parameter: The RGB action define, e.g. `RGB_TOG` or `RGB_BRI` + +Example: + +``` +&rgb_ug RGB_TOG +``` \ No newline at end of file diff --git a/docs/sidebars.js b/docs/sidebars.js index 7b04864..1bd0358 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -7,7 +7,11 @@ module.exports = { "feature/encoders", "feature/underglow", ], - Behaviors: ["behavior/key-press", "behavior/layers"], + Behaviors: [ + "behavior/key-press", + "behavior/layers", + "behavior/lighting", + ], Development: [ "dev-clean-room", "dev-setup", -- cgit v1.2.3 From d901a0061dec7abe5d5cd29c616abcda110df9b1 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 8 Aug 2020 19:02:00 -0500 Subject: Add underglow feature docs + DT fixes --- docs/docs/feature/underglow.md | 116 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/docs/feature/underglow.md b/docs/docs/feature/underglow.md index 0bf9a8d..02aac5d 100644 --- a/docs/docs/feature/underglow.md +++ b/docs/docs/feature/underglow.md @@ -1,5 +1,119 @@ --- title: RGB Underglow +sidebar_label: RGB Underglow --- -TODO: Documentation on RGB underglow. +RGB underglow is a feature used to control "strips" of RGB LEDs. Most of the time this is called underglow and creates a glow underneath the board using a ring of LEDs around the edge, hence the name. However, this can be extended to be used to control anything from a single LED to a long string of LEDs anywhere on the keyboard. + +ZMK supports all the RGB LEDs supported by Zephyr. Here's the current list supported: + +- WS2812-ish (WS2812B, WS2813, SK6812, or compatible) +- APA102 +- LPD880x (LPD8803, LPD8806, or compatible) + +Of the compatible types, the WS2812 LED family is by far the most popular type. Currently each of these types of LEDs are expected to be run using SPI with a couple of exceptions. + +Here you can see the RGB underglow feature in action using WS2812 LEDs. + + + +## Enabling RGB Underglow + +To enable RGB underglow on your board or shield, simply enable the `ZMK_RGB_UNDERGLOW` configuration value in the `.conf` file of your user config directory as such: + +``` +CONFIG_ZMK_RGB_UNDERGLOW=y +``` + +If your board or shield does not have RGB underglow configured, refer to [Adding RGB Underglow to a Board](#adding-rgb-underglow-to-a-board). + +## Configuring RGB Underglow + +There are various Kconfig options used to configure the RGB underglow feature. These can all be set in the `.conf` file. + +| Option | Description | Default | +| ---------------------------- | ---------------------------------------------- | ------- | +| `ZMK_RGB_UNDERGLOW_HUE_STEP` | Hue step in degrees of 360 used by RGB actions | `10` | +| `ZMK_RGB_UNDERGLOW_SAT_STEP` | Saturation step in percent used by RGB actions | `10` | +| `ZMK_RGB_UNDERGLOW_BRT_STEP` | Brightness step in percent used by RGB actions | `10` | + +## Adding RGB Underglow to a Board + +RGB underglow is always added to a board, not a shield. This is a consequence of needing to configure SPI to control the LEDs. +If you have a shield with RGB underglow, you must add a `boards/` directory within your shield folder to define the RGB underglow individually for each board that supports the shield. +Inside the `boards/` folder, you define a `.overlay` for each different board. +For example, the Kyria shield has a `boards/nice_nano.overlay` file that defines the RGB underglow for the `nice_nano` board specifically. + +The first step to adding support for underglow is to select you SPI output. With nRF52 boards, you can just use `&spi1` and define the pins you want to use. +For other boards, you must select an SPI definition that has the `MOSI` pin as your data pin going to your LED strip. + +Here's an example of an nRF52 SPI definition: + +``` +&spi1 { + compatible = "nordic,nrf-spi"; + status = "okay"; + mosi-pin = <6>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <5>; + miso-pin = <7>; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + label = "WS2812"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <10>; /* number of LEDs */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; +``` + +:::info + +If you are configuring SPI for an nRF52840 (or other nRF52) based board, double check that you are using pins that aren't restricted to low frequency I/O. +Ignoring these restrictions may result in poor wireless performance. You can find the list of low frequency I/O pins [here](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fpin.html&cp=4_0_0_6_0). + +::: + +Here's another example for a non-nRF52 board on `spi1`: + +``` +&spi1 { + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + label = "WS2812"; + + /* SPI */ + reg = <0>; + spi-max-frequency = <5250000>; + + /* WS2812 */ + chain-length = <10>; /* number of LEDs */ + spi-one-frame = <0x70>; /* make sure to configure this properly for your SOC */ + spi-zero-frame = <0x40>; /* make sure to configure this properly for your SOC */ + }; +}; +``` + +Once you have your `led_strip` properly defined you need to add it to the root devicetree node `chosen` element: + +``` +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; +``` + +Finally you need to enable the `ZMK_RGB_UNDERGLOW` configuration value in the `.conf` file of your board (or set a default in the `Kconfig.defconfig`): + +``` +CONFIG_ZMK_RGB_UNDERGLOW=y +``` -- cgit v1.2.3 From fd77fdb63d5fe8a031f0adfa1a4f5964e6f339ef Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 8 Aug 2020 19:10:10 -0500 Subject: Fix video container size --- docs/docs/feature/underglow.md | 4 +++- docs/src/css/custom.css | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/docs/feature/underglow.md b/docs/docs/feature/underglow.md index 02aac5d..780845a 100644 --- a/docs/docs/feature/underglow.md +++ b/docs/docs/feature/underglow.md @@ -15,7 +15,9 @@ Of the compatible types, the WS2812 LED family is by far the most popular type. Here you can see the RGB underglow feature in action using WS2812 LEDs. - +
+ +
## Enabling RGB Underglow diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css index f46a565..d9cddb8 100644 --- a/docs/src/css/custom.css +++ b/docs/src/css/custom.css @@ -23,3 +23,21 @@ margin: 0 calc(-1 * var(--ifm-pre-padding)); padding: 0 var(--ifm-pre-padding); } + +.video-container { + height: 0; + margin: 0; + margin-bottom: 30px; + overflow: hidden; + padding-bottom: 56.25%; + padding-top: 30px; + position: relative; +} + +.video-container iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} -- cgit v1.2.3 From 851d54ad960cbcb914cef83c9d1f7fcec49ecf21 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 10 Aug 2020 12:37:05 -0400 Subject: Add Corne to setup.sh script. --- docs/static/setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 327fc84..4208943 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -37,7 +37,7 @@ echo "" echo "Keyboard Shield Selection:" prompt="Pick an keyboard:" -options=("Kyria" "Lily58") +options=("Kyria" "Lily58" "Corne") PS3="$prompt " # TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos. @@ -48,6 +48,7 @@ select opt in "${options[@]}" "Quit"; do 1 ) shield_title="Kyria" shield="kyria"; split="y"; break;; 2 ) shield_title="Lily58" shield="lily58"; split="y"; break;; + 3 ) shield_title="Corne" shield="corne"; split="y"; break;; # Add link to docs on adding your own custom shield in your ZMK config! # $(( ${#options[@]}+1 )) ) echo "Other!"; break;; -- cgit v1.2.3 From 3f748143796c96468bc3626b6b77397d5fa31eef Mon Sep 17 00:00:00 2001 From: CrossR Date: Mon, 10 Aug 2020 17:43:57 +0100 Subject: Quick doc update. --- docs/docs/dev-boards-shields-keymaps.md | 6 +++--- docs/docs/dev-guide-new-shield.md | 12 ++++++------ docs/docs/dev-posix-board.md | 6 +++--- docs/docs/dev-setup.md | 19 ++++++++++++++----- docs/docs/user-setup.md | 2 +- 5 files changed, 27 insertions(+), 18 deletions(-) (limited to 'docs') diff --git a/docs/docs/dev-boards-shields-keymaps.md b/docs/docs/dev-boards-shields-keymaps.md index bda7d9f..cfe5252 100644 --- a/docs/docs/dev-boards-shields-keymaps.md +++ b/docs/docs/dev-boards-shields-keymaps.md @@ -8,11 +8,11 @@ title: Boards, Shields, and Keymaps The foundational elements needed to get a specific keyboard working with ZMK can be broken down into: - A [KSCAN driver](https://docs.zephyrproject.org/2.3.0/reference/peripherals/kscan.html), which uses `compatible="zmk,kscan-gpio-matrix"` for GPIO matrix based keyboards, or uses `compatible="zmk,kscan-gpio-direct"` for small direct wires. -- An optional matrix transform, which defines how the KSCAN row/column events are translated into logical "key positions". This is required for non-rectangular keyboards/matrixes, where the key positions don't naturally follow the row/columns from the GPIO matrix. +- An optional matrix transform, which defines how the KSCAN row/column events are translated into logical "key positions". This is required for non-rectangular keyboards/matrices, where the key positions don't naturally follow the row/columns from the GPIO matrix. - A keymap, which binds each key position to a behavior, e.g. key press, mod-tap, momentary layer, in a set of layers. -These three core architectural elements are defined per-keyboard, and _where_ they are defined depeneds on the specifics of how that -keyboard works. For an overview on the general concepts of boards and shields, please see the [FAQs on boards and sheilds](/docs/faq#why-boards-and-shields--why-not-just-keyboard). +These three core architectural elements are defined per-keyboard, and _where_ they are defined depends on the specifics of how that +keyboard works. For an overview on the general concepts of boards and shields, please see the [FAQs on boards and shields](/docs/faq#why-boards-and-shields--why-not-just-keyboard). ## Self-Contained Keyboard diff --git a/docs/docs/dev-guide-new-shield.md b/docs/docs/dev-guide-new-shield.md index d562033..1119806 100644 --- a/docs/docs/dev-guide-new-shield.md +++ b/docs/docs/dev-guide-new-shield.md @@ -11,14 +11,14 @@ The high level steps are: - Create a new shield directory. - Add the base Kconfig files. - Add the shield overlay file to define the [KSCAN driver]() for detecting key press/release. -- (Optional) Add the mateix transform for mapping KSCAN row/coluk values to sane key positions. This is needed for non-rectangular keyboards, or where the underlying row/column pin arrangement does not map one to one with logical locations on the keyboard. +- (Optional) Add the matrix transform for mapping KSCAN row/column values to sane key positions. This is needed for non-rectangular keyboards, or where the underlying row/column pin arrangement does not map one to one with logical locations on the keyboard. - Add a default keymap, which users can override in their own configs as needed. It may be helpful to review the upstream [shields documentation](https://docs.zephyrproject.org/2.3.0/guides/porting/shields.html#shields) to get a proper understanding of the underlying system before continuing. ## New Shield Directory -Shields for Zephyr applications go into the `boards/shields/` directory; since ZMK's Zephyr appliction linves in the `app/` subdirectory of the repository, that means the new shield directory should be: +Shields for Zephyr applications go into the `boards/shields/` directory; since ZMK's Zephyr application lives in the `app/` subdirectory of the repository, that means the new shield directory should be: ```bash mkdir app/boards/shields/ @@ -60,7 +60,7 @@ endif ## Shield Overlay -The `.overlay` is the devicetree description of the keyboard shield that is merged with the primary board devicetree description before the build. For ZMK, this file at a minumum should include the [chosen]() node named `zmk,kscan` that refernces a KSCAN driver instance. For a simple 3x3 macropad matrix, +The `.overlay` is the devicetree description of the keyboard shield that is merged with the primary board devicetree description before the build. For ZMK, this file at a minimum should include the [chosen]() node named `zmk,kscan` that references a KSCAN driver instance. For a simple 3x3 macropad matrix, this might look something like: ``` @@ -97,7 +97,7 @@ Internally ZMK translates all row/column events into "key position" events to ma 1. For non rectangular keyboards with thumb clusters, non `1u` locations, etc. A "key position" is the numeric index (zero-based) of a given key, which identifies -the logical key location as percieved by the end user. All _keymap_ mappings actually bind behaviors to _key positions_, not to row/column values. +the logical key location as perceived by the end user. All _keymap_ mappings actually bind behaviors to _key positions_, not to row/column values. _Without_ a matrix transform, that intentionally map each key position to the row/column pair that position corresponds to, the default equation to determine that is: @@ -141,13 +141,13 @@ RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7 Some important things to note: -- The `#include ` is critical. The `RC` macro is used to generate the interanl storage in the matrix transform, and is actually replaced by a C preprocessor before the final devicetree is compiled into ZMK. +- The `#include ` is critical. The `RC` macro is used to generate the internal storage in the matrix transform, and is actually replaced by a C preprocessor before the final devicetree is compiled into ZMK. - `RC(row, column)` is placed sequentially to define what row and column values that position corresponds to. - If you have a keyboard with options for `2u` keys in certain positions, or break away portions, it is a good idea to set the chosen `zmk,matrix_transform` to the default arrangement, and include _other_ possible matrix transform nodes in the devicetree that users can select in their user config by overriding the chosen node. ## Default Keymap -Each keyboard should provide an OOTB default keymap to be used when building the firmware, which can be overriden and customized by user configs. For "shield keyboards", this should be placed in the `app/boards/shields//keymap/keymap.overlay` file. The keymap is configured as an additional devicetree overlay that includes the following: +Each keyboard should provide an OOTB default keymap to be used when building the firmware, which can be overridden and customized by user configs. For "shield keyboards", this should be placed in the `app/boards/shields//keymap/keymap.overlay` file. The keymap is configured as an additional devicetree overlay that includes the following: - A node with `compatible="zmk,layers"` where each child node is a layer with a `bindings` array that binds each key position to a given behavior (e.g. key press, momentarily layer, etc). - A node with `compatible="zmk,keymap"` that references the layers with a `layers` phandle-array property. diff --git a/docs/docs/dev-posix-board.md b/docs/docs/dev-posix-board.md index dc33ea0..e146bf1 100644 --- a/docs/docs/dev-posix-board.md +++ b/docs/docs/dev-posix-board.md @@ -10,7 +10,7 @@ flowing into the handler functions. ## Prerequisites -In order to build targetting the `native_posix` board, you need to setup your system +In order to build targeting the `native_posix` board, you need to setup your system with a compiler that can target 32-bit POSIX. On Debian, you can do this with: @@ -21,7 +21,7 @@ apt install -y gcc-multilib ## Building -To do this, you can build ZMK targetting the +To do this, you can build ZMK targeting the `native_posix` board. ``` @@ -36,4 +36,4 @@ Once built, you can run the firmware locally: ## Virtual Key Events -The virtual key presses are hardcoded in `boards/native_posix.overlay` file. should you want to change the sequence to test various actions like Mod-Tap, etc. +The virtual key presses are hardcoded in `boards/native_posix.overlay` file, should you want to change the sequence to test various actions like Mod-Tap, etc. diff --git a/docs/docs/dev-setup.md b/docs/docs/dev-setup.md index 016b14c..56b9adc 100644 --- a/docs/docs/dev-setup.md +++ b/docs/docs/dev-setup.md @@ -34,7 +34,7 @@ A unix-like environment with the following base packages installed: -On Debian and Ubuntu, we'll use apt to install our base dependencies: +On Debian and Ubuntu, we'll use `apt` to install our base dependencies: First, if you haven't updated recently, or if this is a new install, you should update to get the latest package information: @@ -200,7 +200,7 @@ source ~/.bashrc ### Toolchain Installation -The toolchain provides the compiler, linker, etc necessary to build for the target +The toolchain provides the compiler, linker, etc., necessary to build for the target platform. @@ -217,7 +217,7 @@ wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_ rm "zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" ``` -The installation will prompt with several questions about installation location, and creating a default `~/.zephyrrc` for you with various variables. The defaults shouldn normally work as expected. +The installation will prompt with several questions about installation location, and creating a default `~/.zephyrrc` for you with various variables. The defaults should normally work as expected. @@ -252,11 +252,20 @@ wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_ rm "zephyr-toolchain-arm-\${ZSDK_VERSION}-setup.run" ``` -The installation will prompt with several questions about installation location, and creating a default `~/.zephyrrc` for you with various variables. The defaults shouldn normally work as expected. +The installation will prompt with several questions about installation location, and creating a default `~/.zephyrrc` for you with various variables. The defaults should normally work as expected. +:::note +If you intend to build firmware straight away, make sure to correctly setup the current shell. + +Notes on setting this up can be found in the [Environment Variables](#environment-variables) section. +The transient instructions can be used to setup the current shell, and the automatic instructions can setup any newly made shells automatically. + +The transient instructions must be run to build firmware using the current shell. +::: + #### GNU ARM Embedded Since the Zephyr™ SDK is not available for Windows, we recommending following the steps to install the [GNU ARM Embedded](https://docs.zephyrproject.org/latest/getting_started/toolchain_3rd_party_x_compilers.html#gnu-arm-embedded). @@ -275,7 +284,7 @@ wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_ rm "zephyr-toolchain-arm-\${ZSDK_VERSION}-setup.run" ``` -The installation will prompt with several questions about installation location, and creating a default `~/.zephyrrc` for you with various variables. The defaults shouldn normally work as expected. +The installation will prompt with several questions about installation location, and creating a default `~/.zephyrrc` for you with various variables. The defaults should normally work as expected. diff --git a/docs/docs/user-setup.md b/docs/docs/user-setup.md index b79b573..be230d2 100644 --- a/docs/docs/user-setup.md +++ b/docs/docs/user-setup.md @@ -36,7 +36,7 @@ Following the steps in this guide, you will: ## Prerequisites -The remainder of this guide assumes the following prequisites: +The remainder of this guide assumes the following prerequisites: 1. You have an active, working [GitHub](https://github.com/) account. 1. You have installed and configured the [`git`](https://git-scm.com/) version control tool. -- cgit v1.2.3 From 03a945d4234f009db9e6ac95441c45eec8463198 Mon Sep 17 00:00:00 2001 From: CrossR Date: Mon, 10 Aug 2020 17:51:54 +0100 Subject: Move to correct location. --- docs/docs/dev-setup.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'docs') diff --git a/docs/docs/dev-setup.md b/docs/docs/dev-setup.md index 56b9adc..5cceb73 100644 --- a/docs/docs/dev-setup.md +++ b/docs/docs/dev-setup.md @@ -257,15 +257,6 @@ The installation will prompt with several questions about installation location, -:::note -If you intend to build firmware straight away, make sure to correctly setup the current shell. - -Notes on setting this up can be found in the [Environment Variables](#environment-variables) section. -The transient instructions can be used to setup the current shell, and the automatic instructions can setup any newly made shells automatically. - -The transient instructions must be run to build firmware using the current shell. -::: - #### GNU ARM Embedded Since the Zephyr™ SDK is not available for Windows, we recommending following the steps to install the [GNU ARM Embedded](https://docs.zephyrproject.org/latest/getting_started/toolchain_3rd_party_x_compilers.html#gnu-arm-embedded). @@ -289,6 +280,15 @@ The installation will prompt with several questions about installation location, +:::note +If you intend to build firmware straight away, make sure to correctly setup the current shell. + +Notes on setting this up can be found in the [Environment Variables](#environment-variables) section. +The transient instructions can be used to setup the current shell, and the automatic instructions can setup any newly made shells automatically. + +The transient instructions must be run to build firmware using the current shell. +::: + ### Source Code Next, you'll need to clone the ZMK source repository if you haven't already: -- cgit v1.2.3 From 4da2070a5b896fa2c28d77f0dde8508c739d0deb Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 10 Aug 2020 12:54:34 -0400 Subject: Add Corne to hardware list. --- docs/docs/hardware.md | 1 + 1 file changed, 1 insertion(+) (limited to 'docs') diff --git a/docs/docs/hardware.md b/docs/docs/hardware.md index 015b21d..951cee0 100644 --- a/docs/docs/hardware.md +++ b/docs/docs/hardware.md @@ -22,6 +22,7 @@ That being said, there are currently only a few specific [boards](/docs/faq#what ## Keyboard Shields - [Kyria](https://splitkb.com/products/kyria-pcb-kit) (`kyria_left` and `kyria_right`) +- [Corne](https://github.com/foostan/crkbd) (`corne_left` and `corne_right`) - [Lily58](https://github.com/kata0510/Lily58) (`lily58_left` and `lily58_right`) ## Other Hardware -- cgit v1.2.3 From b0c648ad57d138c462fac538c7ea25f88b03e443 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 10 Aug 2020 22:47:18 -0400 Subject: Revert usage of `read -i` for macOS compat. --- docs/static/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 4208943..ce2fe25 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -64,10 +64,10 @@ if [ -z "$copy_keymap" ] || [ "$copy_keymap" == "Y" ] || [ "$copy_keymap" == "y" read -e -p "GitHub Username (leave empty to skip GitHub repo creation): " github_user if [ -n "$github_user" ]; then - read -e -i "zmk-config" -p "GitHub Repo Name: " repo_name + read -p "GitHub Repo Name [zmk-config]: " repo_name if [ -z "$repo_name" ]; then repo_name="zmk-config"; fi - read -e -i "https://github.com/${github_user}/${repo_name}.git" -p "GitHub Repo: " github_repo + read -p "GitHub Repo [https://github.com/${github_user}/${repo_name}.git]: " github_repo if [ -z "$github_repo" ]; then github_repo="https://github.com/${github_user}/${repo_name}.git"; fi else -- cgit v1.2.3 From 47dbba21849a136797014f4691c999de28073bf3 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Tue, 11 Aug 2020 08:40:13 -0400 Subject: Fix sed -i usage on macOS, accept 'Y'. --- docs/static/setup.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index ce2fe25..27dcb0b 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -90,7 +90,7 @@ fi echo "" read -p "Continue? [Yn]: " do_it -if [ -n "$do_it" ] && [ "$do_it" != "y" ]; then +if [ -n "$do_it" ] && [ "$do_it" != "y" ] && [ "$do_it" != "Y" ]; then echo "Aborting..." exit fi @@ -108,7 +108,7 @@ fi popd -sed -i \ +sed -i'.orig' \ -e "s/BOARD_NAME/$board/" \ -e "s/SHIELD_NAME/$shield/" \ -e "s/KEYBOARD_TITLE/$shield_title/" \ @@ -116,9 +116,11 @@ sed -i \ if [ "$board" == "proton_c" ]; then # Proton-C board still fa - sed -i -e "s/uf2/hex/g" .github/workflows/build.yml + sed -i'.orig' -e "s/uf2/hex/g" .github/workflows/build.yml fi +rm .github/workflows/*.yml.orig + rm -rf .git git init . git add . -- cgit v1.2.3 From a6ef1cddecda77e0e374a59fb76266df6d00f2bd Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Tue, 11 Aug 2020 16:55:36 -0400 Subject: Add analytics. --- docs/docusaurus.config.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs') diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 44acd69..2c3622f 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -7,6 +7,10 @@ module.exports = { organizationName: "zmkfirmware", // Usually your GitHub org/user name. projectName: "zmk", // Usually your repo name. themeConfig: { + googleAnalytics: { + trackingID: "UA-145201102-2", + anonymizeIP: true, + }, // sidebarCollapsible: false, navbar: { title: "ZMK Firmware", -- cgit v1.2.3 From 0624c6c54a3292571229727b3e19088bb155e482 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 12 Aug 2020 10:20:51 -0400 Subject: State Of The Firmware #1. --- docs/blog/2020-05-24-wip.md | 2 +- docs/blog/2020-08-12-zmk-sotf-1.md | 52 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 docs/blog/2020-08-12-zmk-sotf-1.md (limited to 'docs') diff --git a/docs/blog/2020-05-24-wip.md b/docs/blog/2020-05-24-wip.md index 2ec2956..eaf2b79 100644 --- a/docs/blog/2020-05-24-wip.md +++ b/docs/blog/2020-05-24-wip.md @@ -5,7 +5,7 @@ author: Pete Johanson author_title: Project Creator author_url: https://gitlab.com/petejohanson author_image_url: https://www.gravatar.com/avatar/2001ceff7e9dc753cf96fcb2e6f41110 -tags: [keyboards, firmeware, oss, ble] +tags: [keyboards, firmware, oss, ble] --- This blog is a work-in-progress as I work on basic docs + blog on this nascent keyboard firmware. diff --git a/docs/blog/2020-08-12-zmk-sotf-1.md b/docs/blog/2020-08-12-zmk-sotf-1.md new file mode 100644 index 0000000..2b69535 --- /dev/null +++ b/docs/blog/2020-08-12-zmk-sotf-1.md @@ -0,0 +1,52 @@ +--- +title: ZMK State Of The Firmware \#1 +author: Pete Johanson +author_title: Project Creator +author_url: https://gitlab.com/petejohanson +author_image_url: https://www.gravatar.com/avatar/2001ceff7e9dc753cf96fcb2e6f41110 +tags: [SOTF, keyboards, firmware, oss, ble] +--- + +Welcome to the first ZMK "State Of The Firmware"! + +With interest and Discord activity growing, it seemed important to lay out the progress made recently, current major bugs/showstoppers, and planned next steps. + +## Recent Activity + +There's been lots of various activity in ZMK land! + +- [Nicell](https://github.com/Nicell) (nice!nano creator) contributed initial [RGB Underglow](/docs/feature/underglow) ([#64](https://github.com/zmkfirmware/zmk/pull/64)) support to ZMK. +- Tons of [documentation](/docs) work. +- Refactoring ([#73](https://github.com/zmkfirmware/zmk/pull/73), [#74](https://github.com/zmkfirmware/zmk/pull/74)) of [keymaps](/docs/feature/keymaps) to make them simpler for users. +- Mod-Tap Behavior (docs coming!) is much improved ([#69](https://github.com/zmkfirmware/zmk/pull/69)) and usable now. +- An initial [`setup.sh`](http://localhost:3000/docs/user-setup#user-config-setup-script) script was created, allowing users to quickly bootstrap a "user config" setup and push it to GitHub, where GitHub Actions will build the firmware for you. +- Corne shield ([#80](https://github.com/zmkfirmware/zmk/pull/80)) shield definition was added. +- Initial [encoder](/docs/feature/encoders) support ([#61](https://github.com/zmkfirmware/zmk/pull/61)) was added. + +## Bugs and Showstoppers + +Despite the flurry of activity, there are still some serious bugs and show stoppers that potential ZMK users should be aware of: + +- [Bluetooth Related](https://github.com/zmkfirmware/zmk/issues/58) - There are several key bugs and fixes needed, including one complete show stopper: + - Fully working split wireless is not working. In particular, both split halves can properly pair, but once they do so, pairing with the _central_ host will not work. Workaround: You can currently have both halves pair, and use USB on the central side (Left side right now for Kyria, Corne, Lily58) and receive HID events over USB. + - BT bond information is not currently stored to the devices, so after powering off or restarting your device, users need to re-pair +- USB - There is one important USB related bug which is a showstopper: + - The Zephyr USB stack does not have a built in queue for endpoint data being written. As a result, HID events sent by ZMK are sometimes [dropped, or lost](https://github.com/zmkfirmware/zmk/issues/84). + +## Next Steps + +There's plenty of places to go next! To help keep folks in the loop for what's next, I've created a [Core Functionality](https://github.com/zmkfirmware/zmk/projects/1) project/kanban board in GitHub, where users should be able to get some visibility into items being focused on. + +Of course, at the top of that list currently is the above bugs/showstoppers, and then from there, I hope to: + +- Work on power management. +- Improve our documentation on various aspects of the system, mostly around: + - End user documentation for understanding how to use ZMK, better installation docs, etc. + - Developer focused documentation, so interested contributors can start building out more behaviors and ZMK functionality. +- Implement true "hold" detection, useful for several behaviors such as Mod-Tap and Layer-Tap. +- Hopefully acquire a proper and official USB Product ID for use for the project. +- Fun things that come up along the way! + +## Thanks! + +A big thanks for everyone who has shown interest in the project, tested things, asked questions, and contributed PRs ([Nicell](https://github.com/Nicell), [CrossR](https://github.com/CrossR), [careyk007](https://github.com/careyk007)). -- cgit v1.2.3 From c3b4525d2574bcd0cd03d91b069bd090c01292da Mon Sep 17 00:00:00 2001 From: Cody McGinnis Date: Thu, 13 Aug 2020 00:19:59 -0400 Subject: Fix edit url links for the website. --- docs/docusaurus.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 2c3622f..64f9a45 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -105,12 +105,12 @@ module.exports = { homePageId: "intro", sidebarPath: require.resolve("./sidebars.js"), // Please change this to your repo. - editUrl: "https://githlab.com/zmkproject/zmk/edit/main/docs/", + editUrl: "https://github.com/zmkfirmware/zmk/edit/main/docs/", }, blog: { showReadingTime: true, // Please change this to your repo. - editUrl: "https://gitlab.com/zmkproject/zmk/edit/main/docs/blog/", + editUrl: "https://github.com/zmkfirmware/zmk/edit/main/docs/", }, theme: { customCss: require.resolve("./src/css/custom.css"), -- cgit v1.2.3 From aa4ae90fb7cd7d7e295f9f5d4af8ad63d9bc9715 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 14 Aug 2020 21:31:18 -0500 Subject: Add missing configuration values for RGB underglow --- docs/docs/feature/underglow.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/docs/feature/underglow.md b/docs/docs/feature/underglow.md index 780845a..4be752f 100644 --- a/docs/docs/feature/underglow.md +++ b/docs/docs/feature/underglow.md @@ -21,10 +21,12 @@ Here you can see the RGB underglow feature in action using WS2812 LEDs. ## Enabling RGB Underglow -To enable RGB underglow on your board or shield, simply enable the `ZMK_RGB_UNDERGLOW` configuration value in the `.conf` file of your user config directory as such: +To enable RGB underglow on your board or shield, simply enable the `ZMK_RGB_UNDERGLOW` and `CONFIG_X_STRIP` configuration values in the `.conf` file of your user config directory as such: ``` CONFIG_ZMK_RGB_UNDERGLOW=y +# Use the STRIP config specific tot he LEDs you're using +CONFIG_WS2812_STRIP=y ``` If your board or shield does not have RGB underglow configured, refer to [Adding RGB Underglow to a Board](#adding-rgb-underglow-to-a-board). @@ -114,8 +116,10 @@ Once you have your `led_strip` properly defined you need to add it to the root d }; ``` -Finally you need to enable the `ZMK_RGB_UNDERGLOW` configuration value in the `.conf` file of your board (or set a default in the `Kconfig.defconfig`): +Finally you need to enable the `ZMK_RGB_UNDERGLOW` and `CONFIG_X_STRIP` STRIP configuration values in the `.conf` file of your board (or set a default in the `Kconfig.defconfig`): ``` CONFIG_ZMK_RGB_UNDERGLOW=y +# Use the STRIP config specific tot he LEDs you're using +CONFIG_WS2812_STRIP=y ``` -- cgit v1.2.3 From 2863f150063bc4a31cc819efe973b59b45a10d10 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 14 Aug 2020 21:36:11 -0500 Subject: Fix docs typos --- docs/docs/feature/underglow.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/docs/feature/underglow.md b/docs/docs/feature/underglow.md index 4be752f..c6517ce 100644 --- a/docs/docs/feature/underglow.md +++ b/docs/docs/feature/underglow.md @@ -21,11 +21,11 @@ Here you can see the RGB underglow feature in action using WS2812 LEDs. ## Enabling RGB Underglow -To enable RGB underglow on your board or shield, simply enable the `ZMK_RGB_UNDERGLOW` and `CONFIG_X_STRIP` configuration values in the `.conf` file of your user config directory as such: +To enable RGB underglow on your board or shield, simply enable the `ZMK_RGB_UNDERGLOW` and `X_STRIP` configuration values in the `.conf` file of your user config directory as such: ``` CONFIG_ZMK_RGB_UNDERGLOW=y -# Use the STRIP config specific tot he LEDs you're using +# Use the STRIP config specific to the LEDs you're using CONFIG_WS2812_STRIP=y ``` @@ -116,10 +116,10 @@ Once you have your `led_strip` properly defined you need to add it to the root d }; ``` -Finally you need to enable the `ZMK_RGB_UNDERGLOW` and `CONFIG_X_STRIP` STRIP configuration values in the `.conf` file of your board (or set a default in the `Kconfig.defconfig`): +Finally you need to enable the `ZMK_RGB_UNDERGLOW` and `X_STRIP` configuration values in the `.conf` file of your board (or set a default in the `Kconfig.defconfig`): ``` CONFIG_ZMK_RGB_UNDERGLOW=y -# Use the STRIP config specific tot he LEDs you're using +# Use the STRIP config specific to the LEDs you're using CONFIG_WS2812_STRIP=y ``` -- cgit v1.2.3 From 7e1942867b0c7c19f6bd78e6f8a15227fbfc323b Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sat, 15 Aug 2020 20:20:19 -0400 Subject: Doc fixes for keymaps. --- docs/docs/dev-guide-new-shield.md | 47 ++++++++++++++------------------------- 1 file changed, 17 insertions(+), 30 deletions(-) (limited to 'docs') diff --git a/docs/docs/dev-guide-new-shield.md b/docs/docs/dev-guide-new-shield.md index 1119806..963a723 100644 --- a/docs/docs/dev-guide-new-shield.md +++ b/docs/docs/dev-guide-new-shield.md @@ -147,51 +147,38 @@ Some important things to note: ## Default Keymap -Each keyboard should provide an OOTB default keymap to be used when building the firmware, which can be overridden and customized by user configs. For "shield keyboards", this should be placed in the `app/boards/shields//keymap/keymap.overlay` file. The keymap is configured as an additional devicetree overlay that includes the following: +Each keyboard should provide an OOTB default keymap to be used when building the firmware, which can be overridden and customized by user configs. For "shield keyboards", this should be placed in the `app/boards/shields//.keymap` file. The keymap is configured as an additional devicetree overlay that includes the following: -- A node with `compatible="zmk,layers"` where each child node is a layer with a `bindings` array that binds each key position to a given behavior (e.g. key press, momentarily layer, etc). -- A node with `compatible="zmk,keymap"` that references the layers with a `layers` phandle-array property. -- A chosen node named `zmk,keymap` that references the defined keymap. +- A node with `compatible="zmk,keymap"` where each child node is a layer with a `bindings` array that binds each key position to a given behavior (e.g. key press, momentarily layer, etc). -Here is an example simple keymap for the nice60, with only one layer: +Here is an example simple keymap for the Kyria, with only one layer: ``` #include #include / { - chosen { - zmk,keymap = &keymap0; - }; - - keymap0: keymap { + keymap { compatible = "zmk,keymap"; - label ="Default nice!60 Keymap"; - layers = <&default>; - }; - layers { - compatible = "zmk,layers"; - - default: layer_0 { - label = "DEFAULT"; -// ------------------------------------------------------------------------------------------ -// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | -// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | "|" | -// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | -// | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | -// | CTL | WIN | ALT | SPACE | ALT | WIN | MENU | CTL | -// ------------------------------------------------------------------------------------------ + default_layer { +// --------------------------------------------------------------------------------------------------------------------------------- +// | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ | +// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' | +// | SHIFT | Z | X | C | V | B | L SHIFT | L SHIFT | | L SHIFT | L SHIFT | N | M | , | . | / | CTRL | +// | GUI | DEL | RET | SPACE | ESC | | RET | SPACE | TAB | BSPC | R-ALT | bindings = < - &kp ESC &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &kp MINUS &kp EQL &kp BKSP - &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH - &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT &kp RET - &kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RSFT - &kp LCTL &kp LGUI &kp LALT &kp SPC &kp RALT &kp RGUI &kp GUI &kp RCTL + &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH + &kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT + &kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp LSFT &kp LSFT &kp LSFT &kp LSFT &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RCTL + &kp LGUI &kp DEL &kp RET &kp SPC &kp ESC &kp RET &kp SPC &kp TAB &kp BKSP &kp RALT >; + + sensor-bindings = <&inc_dec_cp M_VOLU M_VOLD &inc_dec_kp PGUP PGDN>; }; }; }; + ``` :::note -- cgit v1.2.3 From ee5900686bdb921beccf87566cb1ba4977059f99 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sat, 15 Aug 2020 21:13:50 -0400 Subject: Fix the active/pull down flags for the example. --- docs/docs/dev-guide-new-shield.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/docs/dev-guide-new-shield.md b/docs/docs/dev-guide-new-shield.md index 963a723..8556623 100644 --- a/docs/docs/dev-guide-new-shield.md +++ b/docs/docs/dev-guide-new-shield.md @@ -81,9 +81,9 @@ this might look something like: ; row-gpios - = <&pro_micro_a 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&pro_micro_a 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&pro_micro_a 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + = <&pro_micro_a 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_a 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_a 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> ; }; }; -- cgit v1.2.3