diff --git a/.vscode/settings.json b/.vscode/settings.json index 3642d280..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/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) 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 { 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 { diff --git a/app/run-test.sh b/app/run-test.sh index b39f2db2..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 "FAIL: $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 "PEND: $testcase" >> ./build/tests/pass-fail.log - exit 0 - else - echo "FAIL: $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 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) 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. 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: 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,