From be343674de55bfa692cf943a06a11beb60be747f Mon Sep 17 00:00:00 2001 From: Evan Callicoat Date: Sun, 2 Jan 2022 04:34:21 -0600 Subject: [PATCH 1/9] docs: Fix typos and inconsistent spellings (#1079) --- docs/docs/development/build-flash.md | 2 +- docs/docs/development/hardware-metadata-files.md | 2 +- docs/docs/development/new-shield.md | 2 +- docs/docs/faq.md | 4 ++-- docs/docs/features/keymaps.md | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/development/build-flash.md b/docs/docs/development/build-flash.md index ac75b835..95719d92 100644 --- a/docs/docs/development/build-flash.md +++ b/docs/docs/development/build-flash.md @@ -26,7 +26,7 @@ From here on, building and flashing ZMK should all be done from the `app/` subdi cd app ``` -To build for your particular keyboard, the behaviour varies slightly depending on if you are building for a keyboard with +To build for your particular keyboard, the behavior varies slightly depending on if you are building for a keyboard with an onboard MCU, or one that uses an MCU board addon. ### Keyboard (Shield) + MCU Board diff --git a/docs/docs/development/hardware-metadata-files.md b/docs/docs/development/hardware-metadata-files.md index ffe896e2..5d4902dc 100644 --- a/docs/docs/development/hardware-metadata-files.md +++ b/docs/docs/development/hardware-metadata-files.md @@ -100,7 +100,7 @@ Boards and shields should document the sets of hardware features found on them u The `siblings` array is used to identify multiple hardware items designed to be used together as one logical device. Right now, that primarily is used to identify the two halves of a split keyboard, but future enhancements will include more complicated and flexible combinations. -The array should contrain the complete harware IDs of the siblings that combine in the logical device, e.g. with the `corne.zmk.yml` file: +The array should contain the complete hardware IDs of the siblings that combine in the logical device, e.g. with the `corne.zmk.yml` file: ```yaml id: corne diff --git a/docs/docs/development/new-shield.md b/docs/docs/development/new-shield.md index d8b41698..6f65d869 100644 --- a/docs/docs/development/new-shield.md +++ b/docs/docs/development/new-shield.md @@ -360,7 +360,7 @@ The two `#include` lines at the top of the keymap are required in order to bring Further documentation on behaviors and bindings is forthcoming, but a summary of the current behaviors you can bind to key positions is as follows: - `kp` is the "key press" behavior, and takes a single binding argument of the key code from the 'keyboard/keypad" HID usage table. -- `mo` is the "momentary layer" behaviour, and takes a single binding argument of the numeric ID of the layer to momentarily enable when that key is held. +- `mo` is the "momentary layer" behavior, and takes a single binding argument of the numeric ID of the layer to momentarily enable when that key is held. - `trans` is the "transparent" behavior, useful to be place in higher layers above `mo` bindings to be sure the key release is handled by the lower layer. No binding arguments are required. - `mt` is the "mod-tap" behavior, and takes two binding arguments, the modifier to use if held, and the keycode to send if tapped. diff --git a/docs/docs/faq.md b/docs/docs/faq.md index d335d11e..6a16f6f8 100644 --- a/docs/docs/faq.md +++ b/docs/docs/faq.md @@ -12,7 +12,7 @@ As a best-in-class RTOS, Zephyr™ brings many [benefits](https://www.zephyrproj - Powerful hardware abstraction and configuration using [DeviceTree](https://docs.zephyrproject.org/latest/guides/dts/index.html) and [Kconfig](https://docs.zephyrproject.org/latest/guides/kconfig/index.html). - A BLE stack that periodically obtains [qualification](https://docs.zephyrproject.org/latest/guides/bluetooth/bluetooth-qual.html) listings, making it easier for final products to obtain qualification from the Bluetooth® SIG. - Multi-processor support, which is critical for power efficiency in upcoming MCUs. -- Permissive licencing with its Apache 2.0 open source [license](https://www.apache.org/licenses/LICENSE-2.0). +- Permissive licensing with its Apache 2.0 open source [license](https://www.apache.org/licenses/LICENSE-2.0). - A buzzing developer [community](https://github.com/zephyrproject-rtos/zephyr) including many leading [embedded technology](https://www.zephyrproject.org/project-members) companies. - Long term support (LTS) with security updates. @@ -23,7 +23,7 @@ That’s an excellent question! There are already great keyboard firmwares avail - Zephyr™ - See [Why Zephyr™?](#why-zephyr) - Licensing - - Just like other open source firmware, ZMK is all about the free and the sharing. However, some other projects use the GPL licence which prevents integration of libraries and drivers whose licenses are not GPL-compatible (such as some embedded BLE drivers). ZMK uses the permissive [MIT](https://github.com/zmkfirmware/zmk/blob/main/LICENSE) license which doesn’t have this limitation. + - Just like other open source firmware, ZMK is all about the free and the sharing. However, some other projects use the GPL license which prevents integration of libraries and drivers whose licenses are not GPL-compatible (such as some embedded BLE drivers). ZMK uses the permissive [MIT](https://github.com/zmkfirmware/zmk/blob/main/LICENSE) license which doesn’t have this limitation. - Wireless First - ZMK is designed for the future, and we believe the future is wireless. So power efficiency plays a critical role in every design decision, just like in Zephyr™. diff --git a/docs/docs/features/keymaps.md b/docs/docs/features/keymaps.md index be0aa203..59577d8f 100644 --- a/docs/docs/features/keymaps.md +++ b/docs/docs/features/keymaps.md @@ -128,7 +128,7 @@ that defines just one layer for this 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. A `bindings` property this will be a list of behavior 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](../behaviors/key-press.md) behavior. From e7a52e2cee151bd22290cdc6228b66092d3f6268 Mon Sep 17 00:00:00 2001 From: KingCoinless <33333456+KingCoinless@users.noreply.github.com> Date: Sun, 2 Jan 2022 02:44:55 -0800 Subject: [PATCH 2/9] docs(codes): Windows Support: Media Controls Co-authored-by: Cem Aksoylar --- docs/src/data/hid.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/src/data/hid.js b/docs/src/data/hid.js index 774cf6c7..572ccb95 100644 --- a/docs/src/data/hid.js +++ b/docs/src/data/hid.js @@ -2664,7 +2664,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=86", os: { - windows: null, + windows: true, linux: true, android: true, macos: true, @@ -4265,7 +4265,7 @@ export default [ documentation: "https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07", os: { - windows: null, + windows: false, linux: true, android: true, macos: false, @@ -4287,7 +4287,7 @@ export default [ documentation: "https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07", os: { - windows: null, + windows: false, linux: true, android: true, macos: false, @@ -4309,7 +4309,7 @@ export default [ documentation: "https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07", os: { - windows: null, + windows: false, linux: true, android: true, macos: false, @@ -4331,7 +4331,7 @@ export default [ documentation: "https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07", os: { - windows: null, + windows: false, linux: true, android: true, macos: false, @@ -4507,7 +4507,7 @@ export default [ documentation: "https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07", os: { - windows: null, + windows: false, linux: true, android: true, macos: false, @@ -5001,7 +5001,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=134", os: { - windows: null, + windows: false, linux: true, android: true, macos: null, @@ -5022,7 +5022,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=134", os: { - windows: null, + windows: false, linux: true, android: null, macos: null, @@ -5778,7 +5778,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: true, linux: true, android: true, macos: null, @@ -5799,7 +5799,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: true, linux: true, android: true, macos: null, @@ -5820,7 +5820,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: false, linux: true, android: true, macos: null, @@ -5841,7 +5841,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: true, linux: true, android: true, macos: null, @@ -5862,7 +5862,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: true, linux: true, android: true, macos: null, @@ -5883,7 +5883,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: true, linux: true, android: true, macos: true, @@ -5904,7 +5904,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: true, linux: true, android: true, macos: true, @@ -5925,7 +5925,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: false, linux: true, android: true, macos: null, @@ -5967,7 +5967,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: false, linux: true, android: false, macos: null, @@ -5988,7 +5988,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: false, linux: true, android: false, macos: null, @@ -6009,7 +6009,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: false, linux: true, android: null, macos: null, @@ -6051,7 +6051,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", os: { - windows: null, + windows: true, linux: true, android: true, macos: true, @@ -6177,7 +6177,7 @@ export default [ ], documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=141", os: { - windows: null, + windows: false, linux: true, android: null, macos: null, From e0620f1a2d726bee1859b8618ea4ed24b6b2145e Mon Sep 17 00:00:00 2001 From: Midge 't Hoen Date: Mon, 3 Jan 2022 14:14:38 +0100 Subject: [PATCH 3/9] Bump init delay to 50ms for nico-nano --- app/boards/arm/nice_nano/nice_nano_v2.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/boards/arm/nice_nano/nice_nano_v2.dts b/app/boards/arm/nice_nano/nice_nano_v2.dts index b17f4787..8f72aad6 100644 --- a/app/boards/arm/nice_nano/nice_nano_v2.dts +++ b/app/boards/arm/nice_nano/nice_nano_v2.dts @@ -12,7 +12,7 @@ compatible = "zmk,ext-power-generic"; label = "EXT_POWER"; control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; - init-delay-ms = <10>; + init-delay-ms = <50>; }; vbatt { From f767abe13647d1bf6b05a1b67baf615f58fc046c Mon Sep 17 00:00:00 2001 From: okke Date: Sat, 11 Dec 2021 20:36:59 +0100 Subject: [PATCH 4/9] chore: make west scripts more pythonic and apply Black --- .vscode/settings.json | 3 +- app/scripts/west_commands/metadata.py | 49 +++++++++++++++------------ app/scripts/west_commands/test.py | 36 ++++++++++++-------- 3 files changed, 50 insertions(+), 38 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index eba95704..2730549a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,6 @@ "files.associations": { "*.overlay": "dts", "*.keymap": "dts" - } + }, + "python.formatting.provider": "black" } \ No newline at end of file diff --git a/app/scripts/west_commands/metadata.py b/app/scripts/west_commands/metadata.py index a06024c5..244fb9bf 100644 --- a/app/scripts/west_commands/metadata.py +++ b/app/scripts/west_commands/metadata.py @@ -1,59 +1,64 @@ # Copyright (c) 2021 The ZMK Contributors # SPDX-License-Identifier: MIT -'''Metadata command for ZMK.''' +"""Metadata command for ZMK.""" from functools import cached_property import glob import json -from jsonschema import validate, ValidationError -import os +import jsonschema import sys import yaml -from textwrap import dedent # just for nicer code indentation from west.commands import WestCommand -from west import log # use this for user output +from west import log # use this for user output class Metadata(WestCommand): def __init__(self): super().__init__( - 'metadata', # gets stored as self.name - 'ZMK hardware metadata commands', # self.help - # self.description: - dedent('''Operate on the board/shield metadata.''')) + name="metadata", + help="ZMK hardware metadata commands", + description="Operate on the board/shield metadata.", + ) def do_add_parser(self, parser_adder): - parser = parser_adder.add_parser(self.name, - help=self.help, - description=self.description) + parser = parser_adder.add_parser( + self.name, help=self.help, description=self.description + ) - parser.add_argument('subcommand', default="check", - help='The subcommand to run. Defaults to "check".', nargs="?") - return parser # gets stored as self.parser + parser.add_argument( + "subcommand", + default="check", + help='The subcommand to run. Defaults to "check".', + nargs="?", + ) + return parser # gets stored as self.parser @cached_property def schema(self): - return json.load( - open("../schema/hardware-metadata.schema.json", 'r')) + return json.load(open("../schema/hardware-metadata.schema.json", "r")) def validate_file(self, file): print("Validating: " + file) - with open(file, 'r') as stream: + with open(file, "r") as stream: try: - validate(yaml.safe_load(stream), self.schema) + jsonschema.validate(yaml.safe_load(stream), self.schema) except yaml.YAMLError as exc: print("Failed loading metadata yaml: " + file) print(exc) return False - except ValidationError as vexc: + except jsonschema.ValidationError as vexc: print("Failed validation of: " + file) print(vexc) return False return True def do_run(self, args, unknown_args): - status = all([self.validate_file(f) for f in glob.glob( - "boards/**/*.zmk.yml", recursive=True)]) + status = all( + [ + self.validate_file(f) + for f in glob.glob("boards/**/*.zmk.yml", recursive=True) + ] + ) sys.exit(0 if status else 1) diff --git a/app/scripts/west_commands/test.py b/app/scripts/west_commands/test.py index ac64bb6f..53133491 100644 --- a/app/scripts/west_commands/test.py +++ b/app/scripts/west_commands/test.py @@ -1,35 +1,41 @@ # Copyright (c) 2020 The ZMK Contributors # SPDX-License-Identifier: MIT -'''Test runner for ZMK.''' +"""Test runner for ZMK.""" import os import subprocess -from textwrap import dedent # just for nicer code indentation from west.commands import WestCommand -from west import log # use this for user output +from west import log # use this for user output class Test(WestCommand): def __init__(self): super().__init__( - 'test', # gets stored as self.name - 'run ZMK testsuite', # self.help - # self.description: - dedent('''Run the ZMK testsuite.''')) + name="test", + help="run ZMK testsuite", + description="Run the ZMK testsuite.", + ) def do_add_parser(self, parser_adder): - parser = parser_adder.add_parser(self.name, - help=self.help, - description=self.description) + parser = parser_adder.add_parser( + self.name, + help=self.help, + description=self.description, + ) - parser.add_argument('test_path', default="all", - help='The path to the test. Defaults to "all".', nargs="?") - return parser # gets stored as self.parser + parser.add_argument( + "test_path", + default="all", + help='The path to the test. Defaults to "all".', + nargs="?", + ) + return parser def do_run(self, args, unknown_args): # the run-test script assumes the app directory is the current dir. - os.chdir(f'{self.topdir}/app') + os.chdir(f"{self.topdir}/app") completed_process = subprocess.run( - [f'{self.topdir}/app/run-test.sh', args.test_path]) + [f"{self.topdir}/app/run-test.sh", args.test_path] + ) exit(completed_process.returncode) From d59797ba13f623b6654e81cd9ee65ffca272d2d9 Mon Sep 17 00:00:00 2001 From: okke Date: Sat, 11 Dec 2021 20:41:20 +0100 Subject: [PATCH 5/9] test: Change length of fail and pend messages This makes scanning the output from "west test" easier, as the different states get different output lengths. --- app/run-test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/run-test.sh b/app/run-test.sh index b39f2db2..cbc6fbbf 100755 --- a/app/run-test.sh +++ b/app/run-test.sh @@ -28,17 +28,17 @@ echo "Running $testcase:" west build -d build/$testcase -b native_posix -- -DZMK_CONFIG="$(pwd)/$testcase" > /dev/null 2>&1 if [ $? -gt 0 ]; then - echo "FAIL: $testcase did not build" >> ./build/tests/pass-fail.log + echo "FAILED: $testcase did not build" >> ./build/tests/pass-fail.log exit 1 else ./build/$testcase/zephyr/zmk.exe | sed -e "s/.*> //" | tee build/$testcase/keycode_events_full.log | sed -n -f $testcase/events.patterns > build/$testcase/keycode_events.log diff -au $testcase/keycode_events.snapshot build/$testcase/keycode_events.log if [ $? -gt 0 ]; then if [ -f $testcase/pending ]; then - echo "PEND: $testcase" >> ./build/tests/pass-fail.log + echo "PENDING: $testcase" >> ./build/tests/pass-fail.log exit 0 else - echo "FAIL: $testcase" >> ./build/tests/pass-fail.log + echo "FAILED: $testcase" >> ./build/tests/pass-fail.log exit 1 fi else From f692d64d0557f898ec08e26ec75320383d937337 Mon Sep 17 00:00:00 2001 From: okke Date: Sat, 11 Dec 2021 20:55:56 +0100 Subject: [PATCH 6/9] test: print test output immediately and decrease indenting --- app/run-test.sh | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/app/run-test.sh b/app/run-test.sh index cbc6fbbf..da4803d6 100755 --- a/app/run-test.sh +++ b/app/run-test.sh @@ -28,21 +28,20 @@ echo "Running $testcase:" west build -d build/$testcase -b native_posix -- -DZMK_CONFIG="$(pwd)/$testcase" > /dev/null 2>&1 if [ $? -gt 0 ]; then - echo "FAILED: $testcase did not build" >> ./build/tests/pass-fail.log + echo "FAILED: $testcase did not build" | tee -a ./build/tests/pass-fail.log exit 1 -else - ./build/$testcase/zephyr/zmk.exe | sed -e "s/.*> //" | tee build/$testcase/keycode_events_full.log | sed -n -f $testcase/events.patterns > build/$testcase/keycode_events.log - diff -au $testcase/keycode_events.snapshot build/$testcase/keycode_events.log - if [ $? -gt 0 ]; then - if [ -f $testcase/pending ]; then - echo "PENDING: $testcase" >> ./build/tests/pass-fail.log - exit 0 - else - echo "FAILED: $testcase" >> ./build/tests/pass-fail.log - exit 1 - fi - else - echo "PASS: $testcase" >> ./build/tests/pass-fail.log +fi + +./build/$testcase/zephyr/zmk.exe | sed -e "s/.*> //" | tee build/$testcase/keycode_events_full.log | sed -n -f $testcase/events.patterns > build/$testcase/keycode_events.log +diff -au $testcase/keycode_events.snapshot build/$testcase/keycode_events.log +if [ $? -gt 0 ]; then + if [ -f $testcase/pending ]; then + echo "PENDING: $testcase" | tee -a ./build/tests/pass-fail.log exit 0 fi + echo "FAILED: $testcase" | tee -a ./build/tests/pass-fail.log + exit 1 fi + +echo "PASS: $testcase" | tee -a ./build/tests/pass-fail.log +exit 0 From d29236141e1b425669e049bb4e5ae5b65903cd62 Mon Sep 17 00:00:00 2001 From: zhiayang <500236+zhiayang@users.noreply.github.com> Date: Wed, 12 Jan 2022 05:07:30 +0800 Subject: [PATCH 7/9] fix(boards): Proper active high and init delay for Mikoto ext-power --- app/boards/arm/mikoto/mikoto_520.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/boards/arm/mikoto/mikoto_520.dts b/app/boards/arm/mikoto/mikoto_520.dts index 20703e85..de831c54 100644 --- a/app/boards/arm/mikoto/mikoto_520.dts +++ b/app/boards/arm/mikoto/mikoto_520.dts @@ -29,7 +29,8 @@ ext-power { compatible = "zmk,ext-power-generic"; label = "EXT_POWER"; - control-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + init-delay-ms = <50>; }; vbatt { From 970e63bec6a63d498989ae5f358d60c8e538bf35 Mon Sep 17 00:00:00 2001 From: David Fiander Date: Wed, 12 Jan 2022 21:36:08 -0500 Subject: [PATCH 8/9] fix(boards): Properly use dfu-util to flash DZ60 --- app/boards/arm/dz60rgb/board.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/boards/arm/dz60rgb/board.cmake b/app/boards/arm/dz60rgb/board.cmake index 10f6e291..9da8ea91 100644 --- a/app/boards/arm/dz60rgb/board.cmake +++ b/app/boards/arm/dz60rgb/board.cmake @@ -3,5 +3,5 @@ board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse") board_runner_args(jlink "--device=STM32F303CC" "--speed=4000") -include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) From 2ad8f687c05dcbe2cc759a01174263d641554d16 Mon Sep 17 00:00:00 2001 From: Albert Y <76888457+filterpaper@users.noreply.github.com> Date: Thu, 13 Jan 2022 17:23:43 +0800 Subject: [PATCH 9/9] docs: Add a note for GitHub SSH scheme (#1089) Co-authored-by: Cem Aksoylar --- docs/docs/user-setup.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/docs/user-setup.md b/docs/docs/user-setup.md index 6c80f882..de47680f 100644 --- a/docs/docs/user-setup.md +++ b/docs/docs/user-setup.md @@ -143,6 +143,10 @@ 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`. +:::note +If you are using SSH keys for git push, change GitHub Repo field to the SSH scheme, e.g. `git@github.com:petejohanson/zmk-config.git`. +::: + ### Confirming Selections The setup script will confirm all of your selections one last time, before performing the setup: