Merge branch 'main' into dev_branch

This commit is contained in:
kien242 2022-01-17 09:35:53 +07:00 committed by GitHub
commit dce5db4d2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 99 additions and 83 deletions

View file

@ -2,5 +2,6 @@
"files.associations": { "files.associations": {
"*.overlay": "dts", "*.overlay": "dts",
"*.keymap": "dts" "*.keymap": "dts"
} },
"python.formatting.provider": "black"
} }

View file

@ -3,5 +3,5 @@
board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse") board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse")
board_runner_args(jlink "--device=STM32F303CC" "--speed=4000") 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) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

View file

@ -29,7 +29,8 @@
ext-power { ext-power {
compatible = "zmk,ext-power-generic"; compatible = "zmk,ext-power-generic";
label = "EXT_POWER"; label = "EXT_POWER";
control-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
init-delay-ms = <50>;
}; };
vbatt { vbatt {

View file

@ -12,7 +12,7 @@
compatible = "zmk,ext-power-generic"; compatible = "zmk,ext-power-generic";
label = "EXT_POWER"; label = "EXT_POWER";
control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
init-delay-ms = <10>; init-delay-ms = <50>;
}; };
vbatt { vbatt {

View file

@ -28,21 +28,20 @@ echo "Running $testcase:"
west build -d build/$testcase -b native_posix -- -DZMK_CONFIG="$(pwd)/$testcase" > /dev/null 2>&1 west build -d build/$testcase -b native_posix -- -DZMK_CONFIG="$(pwd)/$testcase" > /dev/null 2>&1
if [ $? -gt 0 ]; then 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 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
exit 0
fi
fi 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

View file

@ -1,15 +1,13 @@
# Copyright (c) 2021 The ZMK Contributors # Copyright (c) 2021 The ZMK Contributors
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
'''Metadata command for ZMK.''' """Metadata command for ZMK."""
from functools import cached_property from functools import cached_property
import glob import glob
import json import json
from jsonschema import validate, ValidationError import jsonschema
import os
import sys import sys
import yaml import yaml
from textwrap import dedent # just for nicer code indentation
from west.commands import WestCommand from west.commands import WestCommand
from west import log # use this for user output from west import log # use this for user output
@ -18,42 +16,49 @@ from west import log # use this for user output
class Metadata(WestCommand): class Metadata(WestCommand):
def __init__(self): def __init__(self):
super().__init__( super().__init__(
'metadata', # gets stored as self.name name="metadata",
'ZMK hardware metadata commands', # self.help help="ZMK hardware metadata commands",
# self.description: description="Operate on the board/shield metadata.",
dedent('''Operate on the board/shield metadata.''')) )
def do_add_parser(self, parser_adder): def do_add_parser(self, parser_adder):
parser = parser_adder.add_parser(self.name, parser = parser_adder.add_parser(
help=self.help, self.name, help=self.help, description=self.description
description=self.description) )
parser.add_argument('subcommand', default="check", parser.add_argument(
help='The subcommand to run. Defaults to "check".', nargs="?") "subcommand",
default="check",
help='The subcommand to run. Defaults to "check".',
nargs="?",
)
return parser # gets stored as self.parser return parser # gets stored as self.parser
@cached_property @cached_property
def schema(self): def schema(self):
return json.load( return json.load(open("../schema/hardware-metadata.schema.json", "r"))
open("../schema/hardware-metadata.schema.json", 'r'))
def validate_file(self, file): def validate_file(self, file):
print("Validating: " + file) print("Validating: " + file)
with open(file, 'r') as stream: with open(file, "r") as stream:
try: try:
validate(yaml.safe_load(stream), self.schema) jsonschema.validate(yaml.safe_load(stream), self.schema)
except yaml.YAMLError as exc: except yaml.YAMLError as exc:
print("Failed loading metadata yaml: " + file) print("Failed loading metadata yaml: " + file)
print(exc) print(exc)
return False return False
except ValidationError as vexc: except jsonschema.ValidationError as vexc:
print("Failed validation of: " + file) print("Failed validation of: " + file)
print(vexc) print(vexc)
return False return False
return True return True
def do_run(self, args, unknown_args): def do_run(self, args, unknown_args):
status = all([self.validate_file(f) for f in glob.glob( status = all(
"boards/**/*.zmk.yml", recursive=True)]) [
self.validate_file(f)
for f in glob.glob("boards/**/*.zmk.yml", recursive=True)
]
)
sys.exit(0 if status else 1) sys.exit(0 if status else 1)

View file

@ -1,10 +1,9 @@
# Copyright (c) 2020 The ZMK Contributors # Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
'''Test runner for ZMK.''' """Test runner for ZMK."""
import os import os
import subprocess import subprocess
from textwrap import dedent # just for nicer code indentation
from west.commands import WestCommand from west.commands import WestCommand
from west import log # use this for user output from west import log # use this for user output
@ -13,23 +12,30 @@ from west import log # use this for user output
class Test(WestCommand): class Test(WestCommand):
def __init__(self): def __init__(self):
super().__init__( super().__init__(
'test', # gets stored as self.name name="test",
'run ZMK testsuite', # self.help help="run ZMK testsuite",
# self.description: description="Run the ZMK testsuite.",
dedent('''Run the ZMK testsuite.''')) )
def do_add_parser(self, parser_adder): def do_add_parser(self, parser_adder):
parser = parser_adder.add_parser(self.name, parser = parser_adder.add_parser(
self.name,
help=self.help, help=self.help,
description=self.description) description=self.description,
)
parser.add_argument('test_path', default="all", parser.add_argument(
help='The path to the test. Defaults to "all".', nargs="?") "test_path",
return parser # gets stored as self.parser default="all",
help='The path to the test. Defaults to "all".',
nargs="?",
)
return parser
def do_run(self, args, unknown_args): def do_run(self, args, unknown_args):
# the run-test script assumes the app directory is the current dir. # 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( 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) exit(completed_process.returncode)

View file

@ -26,7 +26,7 @@ From here on, building and flashing ZMK should all be done from the `app/` subdi
cd app 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. an onboard MCU, or one that uses an MCU board addon.
### Keyboard (Shield) + MCU Board ### Keyboard (Shield) + MCU Board

View file

@ -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 `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 ```yaml
id: corne id: corne

View file

@ -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: 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. - `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. - `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. - `mt` is the "mod-tap" behavior, and takes two binding arguments, the modifier to use if held, and the keycode to send if tapped.

View file

@ -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). - 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. - 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. - 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. - 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. - Long term support (LTS) with security updates.
@ -23,7 +23,7 @@ Thats an excellent question! There are already great keyboard firmwares avail
- Zephyr™ - Zephyr™
- See [Why Zephyr™?](#why-zephyr) - See [Why Zephyr™?](#why-zephyr)
- Licensing - 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 doesnt 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 doesnt have this limitation.
- Wireless First - 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™. - 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™.

View file

@ -128,7 +128,7 @@ that defines just one layer for this keymap:
Each layer should have: 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) 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. For the full set of possible behaviors, start at the [Key Press](../behaviors/key-press.md) behavior.

View file

@ -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`. 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 ### Confirming Selections
The setup script will confirm all of your selections one last time, before performing the setup: The setup script will confirm all of your selections one last time, before performing the setup:

View file

@ -2664,7 +2664,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=86", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=86",
os: { os: {
windows: null, windows: true,
linux: true, linux: true,
android: true, android: true,
macos: true, macos: true,
@ -4265,7 +4265,7 @@ export default [
documentation: documentation:
"https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07", "https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: true, android: true,
macos: false, macos: false,
@ -4287,7 +4287,7 @@ export default [
documentation: documentation:
"https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07", "https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: true, android: true,
macos: false, macos: false,
@ -4309,7 +4309,7 @@ export default [
documentation: documentation:
"https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07", "https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: true, android: true,
macos: false, macos: false,
@ -4331,7 +4331,7 @@ export default [
documentation: documentation:
"https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07", "https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: true, android: true,
macos: false, macos: false,
@ -4507,7 +4507,7 @@ export default [
documentation: documentation:
"https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07", "https://source.android.com/devices/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: true, android: true,
macos: false, macos: false,
@ -5001,7 +5001,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=134", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=134",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: true, android: true,
macos: null, macos: null,
@ -5022,7 +5022,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=134", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=134",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: null, android: null,
macos: null, macos: null,
@ -5778,7 +5778,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: true,
linux: true, linux: true,
android: true, android: true,
macos: null, macos: null,
@ -5799,7 +5799,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: true,
linux: true, linux: true,
android: true, android: true,
macos: null, macos: null,
@ -5820,7 +5820,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: true, android: true,
macos: null, macos: null,
@ -5841,7 +5841,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: true,
linux: true, linux: true,
android: true, android: true,
macos: null, macos: null,
@ -5862,7 +5862,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: true,
linux: true, linux: true,
android: true, android: true,
macos: null, macos: null,
@ -5883,7 +5883,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: true,
linux: true, linux: true,
android: true, android: true,
macos: true, macos: true,
@ -5904,7 +5904,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: true,
linux: true, linux: true,
android: true, android: true,
macos: true, macos: true,
@ -5925,7 +5925,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: true, android: true,
macos: null, macos: null,
@ -5967,7 +5967,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: false, android: false,
macos: null, macos: null,
@ -5988,7 +5988,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: false, android: false,
macos: null, macos: null,
@ -6009,7 +6009,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: null, android: null,
macos: null, macos: null,
@ -6051,7 +6051,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=137",
os: { os: {
windows: null, windows: true,
linux: true, linux: true,
android: true, android: true,
macos: true, macos: true,
@ -6177,7 +6177,7 @@ export default [
], ],
documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=141", documentation: "https://usb.org/sites/default/files/hut1_2.pdf#page=141",
os: { os: {
windows: null, windows: false,
linux: true, linux: true,
android: null, android: null,
macos: null, macos: null,