summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/blog/2020-05-24-wip.md2
-rw-r--r--docs/blog/2020-08-12-zmk-sotf-1.md52
-rw-r--r--docs/docs/assets/features/keymaps/layer-diagram.pngbin0 -> 53975 bytes
-rw-r--r--docs/docs/assets/user-setup/firmware-archive.pngbin0 -> 13312 bytes
-rw-r--r--docs/docs/assets/user-setup/github-actions-link.pngbin0 -> 10573 bytes
-rw-r--r--docs/docs/behavior/key-press.md58
-rw-r--r--docs/docs/behavior/layers.md41
-rw-r--r--docs/docs/behavior/lighting.md50
-rw-r--r--docs/docs/dev-boards-shields-keymaps.md6
-rw-r--r--docs/docs/dev-guide-new-shield.md63
-rw-r--r--docs/docs/dev-posix-board.md6
-rw-r--r--docs/docs/dev-setup.md23
-rw-r--r--docs/docs/feature/keymaps.md81
-rw-r--r--docs/docs/feature/underglow.md122
-rw-r--r--docs/docs/hardware.md1
-rw-r--r--docs/docs/user-setup.md70
-rw-r--r--docs/docusaurus.config.js8
-rw-r--r--docs/sidebars.js8
-rw-r--r--docs/src/css/custom.css18
-rw-r--r--docs/static/setup.sh40
20 files changed, 552 insertions, 97 deletions
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)).
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
--- /dev/null
+++ b/docs/docs/assets/features/keymaps/layer-diagram.png
Binary files differ
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
--- /dev/null
+++ b/docs/docs/assets/user-setup/firmware-archive.png
Binary files 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
--- /dev/null
+++ b/docs/docs/assets/user-setup/github-actions-link.png
Binary files differ
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 <dt-bindings/zmk/keys.h>
+```
+
+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
+```
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/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 <dt-bindings/zmk/rgb.h>
+```
+
+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/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..8556623 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/<keyboard_name>
@@ -60,7 +60,7 @@ endif
## Shield Overlay
-The `<shield_name>.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 `<shield_name>.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:
```
@@ -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)>
;
};
};
@@ -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,57 +141,44 @@ RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7
Some important things to note:
-- The `#include <dt-bindings/zmk/matrix-transform.h>` 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 <dt-bindings/zmk/matrix-transform.h>` 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/<shield_name>/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/<shield_name>/<shield_name>.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 <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
/ {
- 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
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 9e4d939..5cceb73 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:
<OsTabs>
<TabItem value="debian">
-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:
@@ -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.:
```
@@ -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.
<OsTabs>
@@ -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.
</TabItem>
<TabItem value="raspberryos">
@@ -252,7 +252,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.
</TabItem>
<TabItem value="win">
@@ -275,11 +275,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.
</TabItem>
</OsTabs>
+:::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:
@@ -306,7 +315,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
diff --git a/docs/docs/feature/keymaps.md b/docs/docs/feature/keymaps.md
index 3eee145..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
@@ -102,24 +104,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,24 +144,40 @@ ALl the remaining keymap nodes will be nested inside of the root devicetree node
};
```
-### Keymap
+Each layer should have:
+
+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)
+
+For the full set of possible behaviors, start at the [Key Press](/docs/behavior/key-press) behavior.
+
+### Complete Example
+
+Putting this all together, a complete [`kyria.keymap`](https://github.com/zmkfirmware/zmk/blob/main/app/boards/shields/kyria/kyria.keymap) looks like:
```
- keymap0: keymap {
+#include <behaviors.dtsi>
+#include <dt-bindings/zmk/keys.h>
+
+/ {
+ keymap {
compatible = "zmk,keymap";
- label ="Default Kyria Keymap";
- layers = <&default>;
- };
-```
-### Chosen 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
+ >;
-```
- chosen {
- zmk,keymap = &keymap0;
+ sensor-bindings = <&inc_dec_cp M_VOLU M_VOLD &inc_dec_kp PGUP PGDN>;
+ };
};
+};
```
-
-### 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).
diff --git a/docs/docs/feature/underglow.md b/docs/docs/feature/underglow.md
index 0bf9a8d..c6517ce 100644
--- a/docs/docs/feature/underglow.md
+++ b/docs/docs/feature/underglow.md
@@ -1,5 +1,125 @@
---
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.
+
+<figure class="video-container">
+ <iframe src="//www.youtube.com/embed/2KJkq8ssDU0" frameborder="0" allowfullscreen width="100%"></iframe>
+</figure>
+
+## Enabling RGB Underglow
+
+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 to the 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).
+
+## 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 `<board>.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` 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 to the LEDs you're using
+CONFIG_WS2812_STRIP=y
+```
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
diff --git a/docs/docs/user-setup.md b/docs/docs/user-setup.md
index e90bef8..be230d2 100644
--- a/docs/docs/user-setup.md
+++ b/docs/docs/user-setup.md
@@ -36,11 +36,15 @@ 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.
+:::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.
@@ -64,14 +68,14 @@ values={[
<TabItem value="curl">
```
-sh -c "$(curl -fsSL https://zmkfirmware.dev/setup.sh)"
+bash -c "$(curl -fsSL https://zmkfirmware.dev/setup.sh)"
```
</TabItem>
<TabItem value="wget">
```
-sh -c "$(wget https://zmkfirmware.dev/setup.sh -O -)"
+bash -c "$(wget https://zmkfirmware.dev/setup.sh -O -)"
```
</TabItem>
@@ -101,6 +105,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 +124,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 +153,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. Once the flash is complete, the controller should automatically restart, and load your newfly flashed firmware.
+
+## Customization
+
+### Configuration Changes
+
+The setup script creates a `config/<shield>.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/<shield>.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/docusaurus.config.js b/docs/docusaurus.config.js
index 44acd69..64f9a45 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",
@@ -101,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"),
diff --git a/docs/sidebars.js b/docs/sidebars.js
index f625672..1bd0358 100644
--- a/docs/sidebars.js
+++ b/docs/sidebars.js
@@ -1,13 +1,17 @@
module.exports = {
someSidebar: {
- "Getting Started": ["intro", "hardware", "user-setup", "faq"],
+ "Getting Started": ["intro", "hardware", "faq", "user-setup"],
Features: [
"feature/keymaps",
"feature/displays",
"feature/encoders",
"feature/underglow",
],
- Behaviors: ["behavior/key-press"],
+ Behaviors: [
+ "behavior/key-press",
+ "behavior/layers",
+ "behavior/lighting",
+ ],
Development: [
"dev-clean-room",
"dev-setup",
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%;
+}
diff --git a/docs/static/setup.sh b/docs/static/setup.sh
index 23ab42b..27dcb0b 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:"
@@ -36,17 +37,18 @@ 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.
# select opt in "${options[@]}" "Other" "Quit"; do
-select opt in "${options[@]}" "Other" "Quit"; do
+select opt in "${options[@]}" "Quit"; do
case "$REPLY" in
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;;
@@ -56,7 +58,11 @@ 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
if [ -z "$repo_name" ]; then repo_name="zmk-config"; fi
@@ -72,6 +78,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
@@ -79,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
@@ -87,13 +98,28 @@ fi
git clone --single-branch $repo_path ${repo_name}
cd ${repo_name}
-sed -i \
+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'.orig' \
-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"
+if [ "$board" == "proton_c" ]; then
+ # Proton-C board still fa
+ sed -i'.orig' -e "s/uf2/hex/g" .github/workflows/build.yml
+fi
+
+rm .github/workflows/*.yml.orig
rm -rf .git
git init .
@@ -102,7 +128,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