Oh god what have i done
This commit is contained in:
parent
23d455ed44
commit
b067b75061
198 changed files with 2573 additions and 1045 deletions
|
@ -1,9 +1,13 @@
|
||||||
FROM zmkfirmware/zephyr-west-action-arm
|
FROM zmkfirmware/zephyr-west-action-arm
|
||||||
|
|
||||||
|
ENV LC_ALL=C
|
||||||
|
|
||||||
RUN apt-get -y update && \
|
RUN apt-get -y update && \
|
||||||
apt-get -y upgrade && \
|
apt-get -y upgrade && \
|
||||||
apt-get install --no-install-recommends -y \
|
apt-get install --no-install-recommends -y \
|
||||||
ssh \
|
ssh \
|
||||||
|
nano \
|
||||||
|
locales \
|
||||||
gpg && \
|
gpg && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,8 @@
|
||||||
"settings": {
|
"settings": {
|
||||||
"terminal.integrated.shell.linux": "/bin/bash"
|
"terminal.integrated.shell.linux": "/bin/bash"
|
||||||
},
|
},
|
||||||
|
"mounts": [
|
||||||
|
"type=volume,source=zmk-config,target=/workspaces/zmk-config"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
35
.github/workflows/build.yml
vendored
35
.github/workflows/build.yml
vendored
|
@ -1,17 +1,18 @@
|
||||||
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
|
- ".github/workflows/build.yml"
|
||||||
- "app/**"
|
- "app/**"
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
|
- ".github/workflows/build.yml"
|
||||||
- "app/**"
|
- "app/**"
|
||||||
|
|
||||||
name: Build
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Build Test
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
board: [proton_c, nice_nano, bluemicro840_v1, nrfmicro_13]
|
board: [proton_c, nice_nano, bluemicro840_v1, nrfmicro_13]
|
||||||
|
@ -25,6 +26,10 @@ jobs:
|
||||||
- lily58_right
|
- lily58_right
|
||||||
- iris_left
|
- iris_left
|
||||||
- iris_right
|
- iris_right
|
||||||
|
- jorne_left
|
||||||
|
- jorne_right
|
||||||
|
- jian_left
|
||||||
|
- jian_right
|
||||||
- reviung41
|
- reviung41
|
||||||
- romac
|
- romac
|
||||||
- romac_plus
|
- romac_plus
|
||||||
|
@ -42,8 +47,6 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Cache west modules
|
- name: Cache west modules
|
||||||
timeout-minutes: 2
|
|
||||||
continue-on-error: true
|
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
env:
|
env:
|
||||||
cache-name: cache-zephyr-modules
|
cache-name: cache-zephyr-modules
|
||||||
|
@ -53,37 +56,39 @@ jobs:
|
||||||
tools/
|
tools/
|
||||||
zephyr/
|
zephyr/
|
||||||
bootloader/
|
bootloader/
|
||||||
key: 2-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
key: 3-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
2-${{ runner.os }}-build-${{ env.cache-name }}-
|
3-${{ runner.os }}-build-${{ env.cache-name }}-
|
||||||
2-${{ runner.os }}-build-
|
3-${{ runner.os }}-build-
|
||||||
2-${{ runner.os }}-
|
3-${{ runner.os }}-
|
||||||
- name: West Init
|
timeout-minutes: 2
|
||||||
|
continue-on-error: true
|
||||||
|
- name: West init
|
||||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||||
id: west-init
|
id: west-init
|
||||||
with:
|
with:
|
||||||
args: 'init "-l app"'
|
args: 'init "-l app"'
|
||||||
- name: West Update
|
- name: West update
|
||||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||||
id: west-update
|
id: west-update
|
||||||
with:
|
with:
|
||||||
args: "update"
|
args: "update"
|
||||||
- name: West Config Zephyr Base
|
- name: West config Zephyr base
|
||||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||||
id: west-config
|
id: west-config
|
||||||
with:
|
with:
|
||||||
args: 'config "--global zephyr.base-prefer configfile"'
|
args: 'config "--global zephyr.base-prefer configfile"'
|
||||||
- name: West Zephyr Export
|
- name: West Zephyr export
|
||||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||||
id: west-zephyr-export
|
id: west-zephyr-export
|
||||||
with:
|
with:
|
||||||
args: "zephyr-export"
|
args: "zephyr-export"
|
||||||
- name: West Build
|
- name: West build
|
||||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||||
id: west-build
|
id: west-build
|
||||||
with:
|
with:
|
||||||
args: 'build "-s app -b ${{ matrix.board }} -- -DSHIELD=${{ matrix.shield }}"'
|
args: 'build "-s app -b ${{ matrix.board }} -- -DSHIELD=${{ matrix.shield }}"'
|
||||||
- name: Archive Build
|
- name: Archive build
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
if: ${{ matrix.board != 'proton_c' }}
|
if: ${{ matrix.board != 'proton_c' }}
|
||||||
with:
|
with:
|
||||||
|
|
6
.github/workflows/clang-format-lint.yml
vendored
6
.github/workflows/clang-format-lint.yml
vendored
|
@ -1,8 +1,9 @@
|
||||||
name: clang-format-lint
|
name: Clang Format
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
|
- ".github/workflows/clang-format-lint.yml"
|
||||||
- "app/boards/**/*.c"
|
- "app/boards/**/*.c"
|
||||||
- "app/include/**/*.h"
|
- "app/include/**/*.h"
|
||||||
- "app/src/**"
|
- "app/src/**"
|
||||||
|
@ -10,6 +11,7 @@ on:
|
||||||
- "app/drivers/**/*.h"
|
- "app/drivers/**/*.h"
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
|
- ".github/workflows/clang-format-lint.yml"
|
||||||
- "app/boards/**/*.c"
|
- "app/boards/**/*.c"
|
||||||
- "app/include/**/*.h"
|
- "app/include/**/*.h"
|
||||||
- "app/src/**"
|
- "app/src/**"
|
||||||
|
@ -19,8 +21,6 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: clang-format lint
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: DoozyX/clang-format-lint-action@v0.9
|
- uses: DoozyX/clang-format-lint-action@v0.9
|
||||||
|
|
9
.github/workflows/doc-checks.yml
vendored
9
.github/workflows/doc-checks.yml
vendored
|
@ -1,18 +1,18 @@
|
||||||
name: doc-checks
|
name: Docs Checks
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
|
- ".github/workflows/doc-checks.yml"
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
|
- ".github/workflows/doc-checks.yml"
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: ESLint
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: bahmutov/npm-install@v1
|
- uses: bahmutov/npm-install@v1
|
||||||
|
@ -24,12 +24,11 @@ jobs:
|
||||||
prettier:
|
prettier:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Prettier
|
name: Prettier
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: bahmutov/npm-install@v1
|
- uses: bahmutov/npm-install@v1
|
||||||
with:
|
with:
|
||||||
working-directory: docs
|
working-directory: docs
|
||||||
- name: Prettier Check
|
- name: Prettier check
|
||||||
run: npm run prettier:check
|
run: npm run prettier:check
|
||||||
working-directory: docs
|
working-directory: docs
|
||||||
|
|
33
.github/workflows/test.yml
vendored
33
.github/workflows/test.yml
vendored
|
@ -1,27 +1,26 @@
|
||||||
|
name: Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
|
- ".github/workflows/test.yml"
|
||||||
- "app/tests/**"
|
- "app/tests/**"
|
||||||
- "app/src/**"
|
- "app/src/**"
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
|
- ".github/workflows/test.yml"
|
||||||
- "app/tests/**"
|
- "app/tests/**"
|
||||||
- "app/src/**"
|
- "app/src/**"
|
||||||
|
|
||||||
name: Test
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
integration_test:
|
integration_test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Integration Tests
|
|
||||||
steps:
|
steps:
|
||||||
# To use this repository's private action,
|
# To use this repository's private action,
|
||||||
# you must check out the repository
|
# you must check out the repository
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Cache west modules
|
- name: Cache west modules
|
||||||
timeout-minutes: 2
|
|
||||||
continue-on-error: true
|
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
env:
|
env:
|
||||||
cache-name: cache-zephyr-modules
|
cache-name: cache-zephyr-modules
|
||||||
|
@ -31,38 +30,40 @@ jobs:
|
||||||
tools/
|
tools/
|
||||||
zephyr/
|
zephyr/
|
||||||
bootloader/
|
bootloader/
|
||||||
key: 2-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
key: 3-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
2-${{ runner.os }}-build-${{ env.cache-name }}-
|
3-${{ runner.os }}-build-${{ env.cache-name }}-
|
||||||
2-${{ runner.os }}-build-
|
3-${{ runner.os }}-build-
|
||||||
2-${{ runner.os }}-
|
3-${{ runner.os }}-
|
||||||
- name: West Init
|
timeout-minutes: 2
|
||||||
|
continue-on-error: true
|
||||||
|
- name: West init
|
||||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||||
id: west-init
|
id: west-init
|
||||||
with:
|
with:
|
||||||
args: 'init "-l app"'
|
args: 'init "-l app"'
|
||||||
- name: West Update
|
- name: West update
|
||||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||||
id: west-update
|
id: west-update
|
||||||
with:
|
with:
|
||||||
args: "update"
|
args: "update"
|
||||||
- name: West Config Zephyr Base
|
- name: West config Zephyr base
|
||||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||||
id: west-config
|
id: west-config
|
||||||
with:
|
with:
|
||||||
args: 'config "--global zephyr.base-prefer configfile"'
|
args: 'config "--global zephyr.base-prefer configfile"'
|
||||||
- name: West Zephyr Export
|
- name: West Zephyr export
|
||||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||||
id: west-zephyr-export
|
id: west-zephyr-export
|
||||||
with:
|
with:
|
||||||
args: "zephyr-export"
|
args: "zephyr-export"
|
||||||
- name: Test All
|
- name: Test all
|
||||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||||
id: west-build
|
id: west-build
|
||||||
with:
|
with:
|
||||||
entrypoint: /bin/bash
|
entrypoint: /bin/bash
|
||||||
args: '-c "cd app && ./run-test.sh all"'
|
args: '-c "west test"'
|
||||||
- name: Archive Build
|
- name: Archive build
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@
|
||||||
/zmk-config
|
/zmk-config
|
||||||
/build
|
/build
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
|
__pycache__
|
1
AUTHORS
1
AUTHORS
|
@ -9,3 +9,4 @@ Cody McGinnis (@BrainWart)
|
||||||
Kurtis Lew (@kurtis-lew)
|
Kurtis Lew (@kurtis-lew)
|
||||||
Richard Jones (@bmcgavin)
|
Richard Jones (@bmcgavin)
|
||||||
Kevin Chen (@chenkevinh)
|
Kevin Chen (@chenkevinh)
|
||||||
|
Joel Spadin (@joelspadin)
|
||||||
|
|
|
@ -4,11 +4,10 @@
|
||||||
[](https://github.com/zmkfirmware/zmk/actions)
|
[](https://github.com/zmkfirmware/zmk/actions)
|
||||||
[](CODE_OF_CONDUCT.md)
|
[](CODE_OF_CONDUCT.md)
|
||||||
|
|
||||||
This project is a complete work in progress, with only basic things functioning. The goal is to explore a new MK firmware
|
[ZMK Firmware](https://zmkfirmware.dev/) is an open source (MIT) keyboard firmware built on the [Zephyr™ Project](https://www.zephyrproject.org/) Real Time Operating System (RTOS). ZMK's goal is to provide a modern, wireless, and powerful firmware free of licensing issues.
|
||||||
with a less restrictive license and better BLE support, built on top of the [Zephyr™ Project](https://www.zephyrproject.org/)
|
|
||||||
|
|
||||||
Check out the website to learn more: https://zmkfirmware.dev/
|
Check out the website to learn more: https://zmkfirmware.dev/
|
||||||
|
|
||||||
You can also come join our [ZMK Discord Server](https://zmkfirmware.dev/community/discord/invite)
|
You can also come join our [ZMK Discord Server](https://zmkfirmware.dev/community/discord/invite)
|
||||||
|
|
||||||
To review planned features, check out the [enhancement label](https://github.com/zmkfirmware/zmk/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement) in GitHub. Please feel free to add 👍 to the issue description of any requests to upvote the feature.
|
To review features, check out the [feature overview](https://zmkfirmware.dev/docs/). ZMK is under active development, and new features are listed with the [enhancement label](https://github.com/zmkfirmware/zmk/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement) in GitHub. Please feel free to add 👍 to the issue description of any requests to upvote the feature.
|
||||||
|
|
|
@ -30,7 +30,6 @@ target_sources(app PRIVATE src/hid.c)
|
||||||
target_sources(app PRIVATE src/sensors.c)
|
target_sources(app PRIVATE src/sensors.c)
|
||||||
target_sources_ifdef(CONFIG_ZMK_DISPLAY app PRIVATE src/display.c)
|
target_sources_ifdef(CONFIG_ZMK_DISPLAY app PRIVATE src/display.c)
|
||||||
target_sources(app PRIVATE src/event_manager.c)
|
target_sources(app PRIVATE src/event_manager.c)
|
||||||
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble_unpair_combo.c)
|
|
||||||
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/ext_power_generic.c)
|
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/ext_power_generic.c)
|
||||||
target_sources(app PRIVATE src/events/position_state_changed.c)
|
target_sources(app PRIVATE src/events/position_state_changed.c)
|
||||||
target_sources(app PRIVATE src/events/keycode_state_changed.c)
|
target_sources(app PRIVATE src/events/keycode_state_changed.c)
|
||||||
|
@ -42,6 +41,7 @@ if (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
|
target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_reset.c)
|
target_sources(app PRIVATE src/behaviors/behavior_reset.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
|
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
|
||||||
|
target_sources(app PRIVATE src/behaviors/behavior_sticky_key.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_momentary_layer.c)
|
target_sources(app PRIVATE src/behaviors/behavior_momentary_layer.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_outputs.c)
|
target_sources(app PRIVATE src/behaviors/behavior_outputs.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_toggle_layer.c)
|
target_sources(app PRIVATE src/behaviors/behavior_toggle_layer.c)
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# Copyright (c) 2020 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
mainmenu "ZMK Firmware"
|
mainmenu "ZMK Firmware"
|
||||||
|
|
||||||
menu "ZMK"
|
menu "ZMK"
|
||||||
|
@ -184,6 +187,10 @@ if ZMK_RGB_UNDERGLOW
|
||||||
config SPI
|
config SPI
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
config ZMK_RGB_UNDERGLOW_EXT_POWER
|
||||||
|
bool "RGB underglow toggling also controls external power"
|
||||||
|
default y
|
||||||
|
|
||||||
config ZMK_RGB_UNDERGLOW_HUE_STEP
|
config ZMK_RGB_UNDERGLOW_HUE_STEP
|
||||||
int "RGB underglow hue step in degrees of 360"
|
int "RGB underglow hue step in degrees of 360"
|
||||||
default 10
|
default 10
|
||||||
|
@ -217,7 +224,7 @@ config ZMK_RGB_UNDERGLOW_EFF_START
|
||||||
default 0
|
default 0
|
||||||
|
|
||||||
config ZMK_RGB_UNDERGLOW_ON_START
|
config ZMK_RGB_UNDERGLOW_ON_START
|
||||||
bool "Whether RGB underglow starts on by default"
|
bool "RGB underglow starts on by default"
|
||||||
default y
|
default y
|
||||||
|
|
||||||
#ZMK_RGB_UNDERGLOW
|
#ZMK_RGB_UNDERGLOW
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
|
# Copyright (c) 2020 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
rsource "shields/*/Kconfig.shield"
|
rsource "shields/*/Kconfig.shield"
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
|
|
||||||
chosen {
|
chosen {
|
||||||
zephyr,code-partition = &code_partition;
|
zephyr,code-partition = &code_partition;
|
||||||
// zephyr,console = &uart0;
|
|
||||||
//zephyr,bt-mon-uart = &uart0;
|
|
||||||
//zephyr,bt-c2h-uart = &uart0;
|
|
||||||
zephyr,sram = &sram0;
|
zephyr,sram = &sram0;
|
||||||
zephyr,flash = &flash0;
|
zephyr,flash = &flash0;
|
||||||
};
|
};
|
||||||
|
@ -29,6 +26,12 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ext-power {
|
||||||
|
compatible = "zmk,ext-power-generic";
|
||||||
|
label = "EXT_POWER";
|
||||||
|
control-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
||||||
|
};
|
||||||
|
|
||||||
vbatt {
|
vbatt {
|
||||||
compatible = "zmk,battery-voltage-divider";
|
compatible = "zmk,battery-voltage-divider";
|
||||||
label = "BATTERY";
|
label = "BATTERY";
|
||||||
|
@ -43,6 +46,10 @@
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&gpiote {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
&gpio0 {
|
&gpio0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
@ -61,10 +68,10 @@
|
||||||
compatible = "nordic,nrf-uarte";
|
compatible = "nordic,nrf-uarte";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
current-speed = <115200>;
|
current-speed = <115200>;
|
||||||
tx-pin = <39>;
|
tx-pin = <19>;
|
||||||
rx-pin = <34>;
|
rx-pin = <21>;
|
||||||
rts-pin = <33>;
|
rts-pin = <23>;
|
||||||
cts-pin = <12>;
|
cts-pin = <25>;
|
||||||
};
|
};
|
||||||
|
|
||||||
&usbd {
|
&usbd {
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
|
|
||||||
chosen {
|
chosen {
|
||||||
zephyr,code-partition = &code_partition;
|
zephyr,code-partition = &code_partition;
|
||||||
// zephyr,console = &uart0;
|
|
||||||
//zephyr,bt-mon-uart = &uart0;
|
|
||||||
//zephyr,bt-c2h-uart = &uart0;
|
|
||||||
zephyr,sram = &sram0;
|
zephyr,sram = &sram0;
|
||||||
zephyr,flash = &flash0;
|
zephyr,flash = &flash0;
|
||||||
};
|
};
|
||||||
|
@ -70,10 +67,10 @@
|
||||||
compatible = "nordic,nrf-uarte";
|
compatible = "nordic,nrf-uarte";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
current-speed = <115200>;
|
current-speed = <115200>;
|
||||||
tx-pin = <39>;
|
tx-pin = <19>;
|
||||||
rx-pin = <34>;
|
rx-pin = <21>;
|
||||||
rts-pin = <33>;
|
rts-pin = <23>;
|
||||||
cts-pin = <12>;
|
cts-pin = <25>;
|
||||||
};
|
};
|
||||||
|
|
||||||
&usbd {
|
&usbd {
|
||||||
|
|
|
@ -12,9 +12,6 @@
|
||||||
|
|
||||||
chosen {
|
chosen {
|
||||||
zephyr,code-partition = &code_partition;
|
zephyr,code-partition = &code_partition;
|
||||||
//zephyr,console = &uart0;
|
|
||||||
//zephyr,bt-mon-uart = &uart0;
|
|
||||||
//zephyr,bt-c2h-uart = &uart0;
|
|
||||||
zephyr,sram = &sram0;
|
zephyr,sram = &sram0;
|
||||||
zephyr,flash = &flash0;
|
zephyr,flash = &flash0;
|
||||||
};
|
};
|
||||||
|
@ -37,6 +34,14 @@
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&adc {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&gpiote {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
&gpio0 {
|
&gpio0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
@ -46,13 +51,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
&uart0 {
|
&uart0 {
|
||||||
compatible = "nordic,nrf-uart";
|
compatible = "nordic,nrf-uarte";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
current-speed = <115200>;
|
current-speed = <115200>;
|
||||||
tx-pin = <16>;
|
tx-pin = <19>;
|
||||||
rx-pin = <15>;
|
rx-pin = <21>;
|
||||||
rts-pin = <14>;
|
rts-pin = <23>;
|
||||||
cts-pin = <13>;
|
cts-pin = <25>;
|
||||||
};
|
};
|
||||||
|
|
||||||
&usbd {
|
&usbd {
|
||||||
|
|
|
@ -33,6 +33,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&gpiote {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
&gpio0 {
|
&gpio0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
@ -51,10 +55,10 @@
|
||||||
compatible = "nordic,nrf-uarte";
|
compatible = "nordic,nrf-uarte";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
current-speed = <115200>;
|
current-speed = <115200>;
|
||||||
tx-pin = <39>;
|
tx-pin = <19>;
|
||||||
rx-pin = <34>;
|
rx-pin = <21>;
|
||||||
rts-pin = <33>;
|
rts-pin = <23>;
|
||||||
cts-pin = <12>;
|
cts-pin = <25>;
|
||||||
};
|
};
|
||||||
|
|
||||||
&usbd {
|
&usbd {
|
||||||
|
|
|
@ -33,6 +33,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&gpiote {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
&gpio0 {
|
&gpio0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
@ -51,10 +55,10 @@
|
||||||
compatible = "nordic,nrf-uarte";
|
compatible = "nordic,nrf-uarte";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
current-speed = <115200>;
|
current-speed = <115200>;
|
||||||
tx-pin = <39>;
|
tx-pin = <19>;
|
||||||
rx-pin = <34>;
|
rx-pin = <21>;
|
||||||
rts-pin = <33>;
|
rts-pin = <23>;
|
||||||
cts-pin = <12>;
|
cts-pin = <25>;
|
||||||
};
|
};
|
||||||
|
|
||||||
&usbd {
|
&usbd {
|
||||||
|
|
|
@ -45,6 +45,10 @@
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&gpiote {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
&gpio0 {
|
&gpio0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
@ -63,10 +67,10 @@
|
||||||
compatible = "nordic,nrf-uarte";
|
compatible = "nordic,nrf-uarte";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
current-speed = <115200>;
|
current-speed = <115200>;
|
||||||
tx-pin = <39>;
|
tx-pin = <19>;
|
||||||
rx-pin = <34>;
|
rx-pin = <21>;
|
||||||
rts-pin = <33>;
|
rts-pin = <23>;
|
||||||
cts-pin = <12>;
|
cts-pin = <25>;
|
||||||
};
|
};
|
||||||
|
|
||||||
&usbd {
|
&usbd {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
&spi1 {
|
&spi1 {
|
||||||
compatible = "nordic,nrf-spi";
|
compatible = "nordic,nrf-spim";
|
||||||
/* Cannot be used together with i2c0. */
|
/* Cannot be used together with i2c0. */
|
||||||
status = "okay";
|
status = "okay";
|
||||||
mosi-pin = <6>;
|
mosi-pin = <6>;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Uncomment the following lines to enable the Corne RGB Underglow
|
# Uncomment the following lines to enable the Corne RGB Underglow
|
||||||
# ZMK_RGB_UNDERGLOW=y
|
# CONFIG_ZMK_RGB_UNDERGLOW=y
|
||||||
# CONFIG_WS2812_STRIP=y
|
# CONFIG_WS2812_STRIP=y
|
||||||
|
|
||||||
# Uncomment the following line to enable the Corne OLED Display
|
# Uncomment the following line to enable the Corne OLED Display
|
||||||
|
|
|
@ -58,10 +58,6 @@ RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bt_unpair_combo: bt_unpair_combo {
|
|
||||||
compatible = "zmk,bt-unpair-combo";
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: per-key RGB node(s)?
|
// TODO: per-key RGB node(s)?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,3 @@
|
||||||
, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
|
, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
&bt_unpair_combo {
|
|
||||||
key-positions = <0 38>;
|
|
||||||
};
|
|
||||||
|
|
|
@ -20,7 +20,3 @@
|
||||||
, <&pro_micro_a 3 GPIO_ACTIVE_HIGH>
|
, <&pro_micro_a 3 GPIO_ACTIVE_HIGH>
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
&bt_unpair_combo {
|
|
||||||
key-positions = <11 39>;
|
|
||||||
};
|
|
||||||
|
|
|
@ -44,8 +44,4 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,2) RC(4,9) RC(3,6) RC(3,7)
|
||||||
;
|
;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bt_unpair_combo: bt_unpair_combo {
|
|
||||||
compatible = "zmk,bt-unpair-combo";
|
|
||||||
};
|
|
||||||
};
|
};
|
|
@ -16,7 +16,3 @@
|
||||||
, <&pro_micro_d 10 GPIO_ACTIVE_HIGH>
|
, <&pro_micro_d 10 GPIO_ACTIVE_HIGH>
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
&bt_unpair_combo {
|
|
||||||
key-positions = <0 42>;
|
|
||||||
};
|
|
||||||
|
|
|
@ -20,7 +20,3 @@
|
||||||
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
&bt_unpair_combo {
|
|
||||||
key-positions = <11 43>;
|
|
||||||
};
|
|
||||||
|
|
23
app/boards/shields/jian/Kconfig.defconfig
Normal file
23
app/boards/shields/jian/Kconfig.defconfig
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
if SHIELD_JIAN_LEFT
|
||||||
|
|
||||||
|
config ZMK_KEYBOARD_NAME
|
||||||
|
default "Jian Left"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
if SHIELD_JIAN_RIGHT
|
||||||
|
|
||||||
|
config ZMK_KEYBOARD_NAME
|
||||||
|
default "Jian Right"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
if SHIELD_JIAN_LEFT || SHIELD_JIAN_RIGHT
|
||||||
|
|
||||||
|
config ZMK_SPLIT
|
||||||
|
default y
|
||||||
|
|
||||||
|
|
||||||
|
endif
|
8
app/boards/shields/jian/Kconfig.shield
Normal file
8
app/boards/shields/jian/Kconfig.shield
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Copyright (c) 2020 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
config SHIELD_JIAN_LEFT
|
||||||
|
def_bool $(shields_list_contains,jian_left)
|
||||||
|
|
||||||
|
config SHIELD_JIAN_RIGHT
|
||||||
|
def_bool $(shields_list_contains,jian_right)
|
76
app/boards/shields/jian/jian.dtsi
Normal file
76
app/boards/shields/jian/jian.dtsi
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dt-bindings/zmk/matrix-transform.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zmk,kscan = &kscan0;
|
||||||
|
zmk,matrix_transform = &default_transform;
|
||||||
|
};
|
||||||
|
|
||||||
|
default_transform: keymap_transform_0 {
|
||||||
|
compatible = "zmk,matrix-transform";
|
||||||
|
columns = <12>;
|
||||||
|
rows = <4>;
|
||||||
|
// | SW0 | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | SW0 |
|
||||||
|
// | | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 |
|
||||||
|
// | | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 |
|
||||||
|
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
|
||||||
|
map = <
|
||||||
|
RC(2,0) RC(0,0) RC(0,1) RC(1,2) RC(0,2) RC(0,3) RC(0,4) RC(0,7) RC(0,8) RC(0,9) RC(1,9) RC(0,10) RC(0,11) RC(2,11)
|
||||||
|
RC(1,0) RC(1,1) RC(2,2) RC(1,3) RC(1,4) RC(0,5) RC(0,6) RC(1,7) RC(1,8) RC(2,9) RC(1,10) RC(1,11)
|
||||||
|
RC(2,1) RC(3,2) RC(3,3) RC(2,3) RC(2,4) RC(1,5) RC(1,6) RC(2,7) RC(2,8) RC(3,8) RC(3,9) RC(2,10)
|
||||||
|
RC(3,4) RC(2,5) RC(3,5) RC(3,6) RC(2,6) RC(3,7)
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
crkbd_transform: keymap_transform_1 {
|
||||||
|
compatible = "zmk,matrix-transform";
|
||||||
|
columns = <12>;
|
||||||
|
rows = <4>;
|
||||||
|
// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 |
|
||||||
|
// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 |
|
||||||
|
// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 |
|
||||||
|
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
|
||||||
|
map = <
|
||||||
|
RC(0,0) RC(0,1) RC(1,2) RC(0,2) RC(0,3) RC(0,4) RC(0,7) RC(0,8) RC(0,9) RC(1,9) RC(0,10) RC(0,11)
|
||||||
|
RC(1,0) RC(1,1) RC(2,2) RC(1,3) RC(1,4) RC(0,5) RC(0,6) RC(1,7) RC(1,8) RC(2,9) RC(1,10) RC(1,11)
|
||||||
|
RC(2,1) RC(3,2) RC(3,3) RC(2,3) RC(2,4) RC(1,5) RC(1,6) RC(2,7) RC(2,8) RC(3,8) RC(3,9) RC(2,10)
|
||||||
|
RC(3,4) RC(2,5) RC(3,5) RC(3,6) RC(2,6) RC(3,7)
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
five_column_transform: keymap_transform_2 {
|
||||||
|
compatible = "zmk,matrix-transform";
|
||||||
|
columns = <10>;
|
||||||
|
rows = <4>;
|
||||||
|
// | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 |
|
||||||
|
// | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 |
|
||||||
|
// | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 |
|
||||||
|
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
|
||||||
|
map = <
|
||||||
|
RC(0,1) RC(1,2) RC(0,2) RC(0,3) RC(0,4) RC(0,7) RC(0,8) RC(0,9) RC(1,9) RC(0,10)
|
||||||
|
RC(1,1) RC(2,2) RC(1,3) RC(1,4) RC(0,5) RC(0,6) RC(1,7) RC(1,8) RC(2,9) RC(1,10)
|
||||||
|
RC(3,2) RC(3,3) RC(2,3) RC(2,4) RC(1,5) RC(1,6) RC(2,7) RC(2,8) RC(3,8) RC(3,9)
|
||||||
|
RC(3,4) RC(2,5) RC(3,5) RC(3,6) RC(2,6) RC(3,7)
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
kscan0: kscan {
|
||||||
|
compatible = "zmk,kscan-gpio-matrix";
|
||||||
|
label = "KSCAN";
|
||||||
|
|
||||||
|
diode-direction = "col2row";
|
||||||
|
row-gpios
|
||||||
|
= <&pro_micro_a 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&pro_micro_a 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&pro_micro_d 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&pro_micro_d 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
;
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
74
app/boards/shields/jian/jian.keymap
Normal file
74
app/boards/shields/jian/jian.keymap
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <behaviors.dtsi>
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
#include <dt-bindings/zmk/bt.h>
|
||||||
|
|
||||||
|
#define DEF 0
|
||||||
|
#define LWR 1
|
||||||
|
#define RSE 2
|
||||||
|
#define ADJ 3
|
||||||
|
|
||||||
|
/ {
|
||||||
|
keymap {
|
||||||
|
compatible = "zmk,keymap";
|
||||||
|
|
||||||
|
default_layer {
|
||||||
|
// -----------------------------------------------------------------------------------------
|
||||||
|
// | GUI | ~ | Q | W | E | R | T | | Y | U | I | O | P | [ | GUI/] |
|
||||||
|
// | CTRL | A | S | D | F | G | | H | J | K | L | ; |CTRL/'|
|
||||||
|
// | LALT | Z | X | C | V | B | | N | M | , | . | / | RALT |
|
||||||
|
// | RSE | SPC | LWR | | LWR | BKSP | RSE |
|
||||||
|
bindings = <
|
||||||
|
&kp LWIN &kp GRAVE &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &mt RWIN RBKT
|
||||||
|
&kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &mt RCTRL QUOT
|
||||||
|
&kp LALT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp BSLH
|
||||||
|
< RSE TAB &mt LSHFT SPC < LWR RET < LWR ESC &mt RSHFT BSPC < RSE DEL
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
lower_layer {
|
||||||
|
// -----------------------------------------------------------------------------------------
|
||||||
|
// | | _ | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
|
||||||
|
// | + | ! | @ | # | $ | % | | ^ | & | * | ( | ) | - |
|
||||||
|
// | = | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | |
|
||||||
|
// | GUI | | SPC | | ENT | | ALT |
|
||||||
|
bindings = <
|
||||||
|
&trans &kp UNDER &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &mt RGUI F12
|
||||||
|
&mt LCTRL PLUS &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CRRT &kp AMPS &kp STAR &kp LPAR &kp RPAR &mt RCTRL MINUS
|
||||||
|
&mt LALT EQUAL &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &trans
|
||||||
|
< ADJ TAB &trans &trans &trans &trans < ADJ DEL
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
raise_layer {
|
||||||
|
// -----------------------------------------------------------------------------------------
|
||||||
|
// | | NMLK | / | 7 | 8 | 9 | - | | VOLU| HOME| PRSC| PGUP| SCLK| CLCK| |
|
||||||
|
// | CTRL | * | 4 | 5 | 6 | + | | MUT | LEFT| UP | RGHT| INS | APP |
|
||||||
|
// | | 0 | 1 | 2 | 3 | . | | VOLD| END | DOWN| PGDN| PAUS| |
|
||||||
|
// | | | ADJ | | ADJ | | |
|
||||||
|
bindings = <
|
||||||
|
&trans &kp KP_NUM &kp KP_SLASH &kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_MINUS &kp C_VOL_UP &kp HOME &kp PSCRN &kp PG_UP &kp SLCK &kp CAPS &trans
|
||||||
|
&mt LCTRL EQL &kp KP_MULTIPLY &kp KP_N4 &kp KP_N5 &kp KP_N6 &kp KP_PLUS &kp C_MUTE &kp LEFT &kp UP &kp RIGHT &kp INS &mt RCTRL K_APP
|
||||||
|
&trans &kp KP_N0 &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_DOT &kp C_VOL_DN &kp END &kp DOWN &kp PG_DN &kp PAUS &trans
|
||||||
|
&trans &trans < ADJ RET < ADJ ESC &trans &trans
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
adjust_layer {
|
||||||
|
// -----------------------------------------------------------------------------------------
|
||||||
|
// | RST | BLDR | | | | | | | | | | | | BLDR | RST |
|
||||||
|
// | BTCLR| BT0 | BT1 | BT2 | BT3 | BT4 | | BT4 | BT3 | BT2 | BT1 | BT0 | BTCLR|
|
||||||
|
// | | | | | | | | | | | | | |
|
||||||
|
// | | | | | | | |
|
||||||
|
bindings = <
|
||||||
|
&reset &bootloader &none &none &none &none &none &none &none &none &none &none &bootloader &reset
|
||||||
|
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &bt BT_SEL 4 &bt BT_SEL 3 &bt BT_SEL 2 &bt BT_SEL 1 &bt BT_SEL 0 &bt BT_CLR
|
||||||
|
&none &none &none &none &none &none &none &none &none &none &none &none
|
||||||
|
&trans &none &trans &trans &none &trans
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
2
app/boards/shields/jian/jian_left.conf
Normal file
2
app/boards/shields/jian/jian_left.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
CONFIG_ZMK_SPLIT=y
|
||||||
|
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
|
18
app/boards/shields/jian/jian_left.overlay
Normal file
18
app/boards/shields/jian/jian_left.overlay
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "jian.dtsi"
|
||||||
|
|
||||||
|
&kscan0 {
|
||||||
|
col-gpios
|
||||||
|
= <&pro_micro_d 1 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_d 0 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_d 8 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_d 16 GPIO_ACTIVE_HIGH>
|
||||||
|
;
|
||||||
|
};
|
2
app/boards/shields/jian/jian_right.conf
Normal file
2
app/boards/shields/jian/jian_right.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
CONFIG_ZMK_SPLIT=y
|
||||||
|
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
|
22
app/boards/shields/jian/jian_right.overlay
Normal file
22
app/boards/shields/jian/jian_right.overlay
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "jian.dtsi"
|
||||||
|
|
||||||
|
&default_transform {
|
||||||
|
col-offset = <6>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&kscan0 {
|
||||||
|
col-gpios
|
||||||
|
= <&pro_micro_d 16 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_d 8 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_d 0 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_d 1 GPIO_ACTIVE_HIGH>
|
||||||
|
;
|
||||||
|
};
|
58
app/boards/shields/jorne/Kconfig.defconfig
Normal file
58
app/boards/shields/jorne/Kconfig.defconfig
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
|
||||||
|
if SHIELD_JORNE_LEFT
|
||||||
|
|
||||||
|
config ZMK_KEYBOARD_NAME
|
||||||
|
default "Jorne Left"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
if SHIELD_JORNE_RIGHT
|
||||||
|
|
||||||
|
config ZMK_KEYBOARD_NAME
|
||||||
|
default "Jorne Right"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
if SHIELD_JORNE_LEFT || SHIELD_JORNE_RIGHT
|
||||||
|
|
||||||
|
config ZMK_SPLIT
|
||||||
|
default y
|
||||||
|
|
||||||
|
if ZMK_DISPLAY
|
||||||
|
|
||||||
|
config I2C
|
||||||
|
default y
|
||||||
|
|
||||||
|
config SSD1306
|
||||||
|
default y
|
||||||
|
|
||||||
|
config SSD1306_REVERSE_MODE
|
||||||
|
default y
|
||||||
|
|
||||||
|
endif # ZMK_DISPLAY
|
||||||
|
|
||||||
|
if LVGL
|
||||||
|
|
||||||
|
config LVGL_HOR_RES
|
||||||
|
default 128
|
||||||
|
|
||||||
|
config LVGL_VER_RES
|
||||||
|
default 32
|
||||||
|
|
||||||
|
config LVGL_VDB_SIZE
|
||||||
|
default 64
|
||||||
|
|
||||||
|
config LVGL_DPI
|
||||||
|
default 148
|
||||||
|
|
||||||
|
config LVGL_BITS_PER_PIXEL
|
||||||
|
default 1
|
||||||
|
|
||||||
|
choice LVGL_COLOR_DEPTH
|
||||||
|
default LVGL_COLOR_DEPTH_1
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
endif # LVGL
|
||||||
|
|
||||||
|
endif
|
8
app/boards/shields/jorne/Kconfig.shield
Normal file
8
app/boards/shields/jorne/Kconfig.shield
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Copyright (c) 2020 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
config SHIELD_JORNE_LEFT
|
||||||
|
def_bool $(shields_list_contains,jorne_left)
|
||||||
|
|
||||||
|
config SHIELD_JORNE_RIGHT
|
||||||
|
def_bool $(shields_list_contains,jorne_right)
|
29
app/boards/shields/jorne/boards/nice_nano.overlay
Normal file
29
app/boards/shields/jorne/boards/nice_nano.overlay
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
&spi1 {
|
||||||
|
compatible = "nordic,nrf-spim";
|
||||||
|
/* Cannot be used together with i2c0. */
|
||||||
|
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 = <6>; /* There are per-key RGB, but the first 6 are underglow */
|
||||||
|
spi-one-frame = <0x70>;
|
||||||
|
spi-zero-frame = <0x40>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zmk,underglow = &led_strip;
|
||||||
|
};
|
||||||
|
};
|
6
app/boards/shields/jorne/jorne.conf
Normal file
6
app/boards/shields/jorne/jorne.conf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Uncomment the following lines to enable the Jorne RGB Underglow
|
||||||
|
# CONFIG_ZMK_RGB_UNDERGLOW=y
|
||||||
|
# CONFIG_WS2812_STRIP=y
|
||||||
|
|
||||||
|
# Uncomment the following line to enable the Jorne OLED Display
|
||||||
|
# CONFIG_ZMK_DISPLAY=y
|
98
app/boards/shields/jorne/jorne.dtsi
Normal file
98
app/boards/shields/jorne/jorne.dtsi
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dt-bindings/zmk/matrix-transform.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zmk,kscan = &kscan0;
|
||||||
|
zmk,matrix_transform = &default_transform;
|
||||||
|
};
|
||||||
|
|
||||||
|
default_transform: keymap_transform_0 {
|
||||||
|
compatible = "zmk,matrix-transform";
|
||||||
|
columns = <12>;
|
||||||
|
rows = <4>;
|
||||||
|
// | SW0 | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | SW0 |
|
||||||
|
// | | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 |
|
||||||
|
// | | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 |
|
||||||
|
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
|
||||||
|
map = <
|
||||||
|
RC(3,0) RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11) RC(3,11)
|
||||||
|
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11)
|
||||||
|
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11)
|
||||||
|
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
crkbd_transform: keymap_transform_1 {
|
||||||
|
compatible = "zmk,matrix-transform";
|
||||||
|
columns = <12>;
|
||||||
|
rows = <4>;
|
||||||
|
// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 |
|
||||||
|
// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 |
|
||||||
|
// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 |
|
||||||
|
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
|
||||||
|
map = <
|
||||||
|
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11)
|
||||||
|
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11)
|
||||||
|
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11)
|
||||||
|
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
five_column_transform: keymap_transform_2 {
|
||||||
|
compatible = "zmk,matrix-transform";
|
||||||
|
columns = <10>;
|
||||||
|
rows = <4>;
|
||||||
|
// | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 |
|
||||||
|
// | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 |
|
||||||
|
// | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 |
|
||||||
|
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
|
||||||
|
map = <
|
||||||
|
RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10)
|
||||||
|
RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10)
|
||||||
|
RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10)
|
||||||
|
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
kscan0: kscan {
|
||||||
|
compatible = "zmk,kscan-gpio-matrix";
|
||||||
|
label = "KSCAN";
|
||||||
|
|
||||||
|
diode-direction = "col2row";
|
||||||
|
row-gpios
|
||||||
|
= <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: per-key RGB node(s)?
|
||||||
|
};
|
||||||
|
|
||||||
|
&pro_micro_i2c {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
oled: ssd1306@3c {
|
||||||
|
compatible = "solomon,ssd1306fb";
|
||||||
|
reg = <0x3c>;
|
||||||
|
label = "DISPLAY";
|
||||||
|
width = <128>;
|
||||||
|
height = <32>;
|
||||||
|
segment-offset = <0>;
|
||||||
|
page-offset = <0>;
|
||||||
|
display-offset = <0>;
|
||||||
|
multiplex-ratio = <31>;
|
||||||
|
segment-remap;
|
||||||
|
com-invdir;
|
||||||
|
com-sequential;
|
||||||
|
prechargep = <0x22>;
|
||||||
|
};
|
||||||
|
};
|
74
app/boards/shields/jorne/jorne.keymap
Normal file
74
app/boards/shields/jorne/jorne.keymap
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <behaviors.dtsi>
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
#include <dt-bindings/zmk/bt.h>
|
||||||
|
|
||||||
|
#define DEF 0
|
||||||
|
#define LWR 1
|
||||||
|
#define RSE 2
|
||||||
|
#define ADJ 3
|
||||||
|
|
||||||
|
/ {
|
||||||
|
keymap {
|
||||||
|
compatible = "zmk,keymap";
|
||||||
|
|
||||||
|
default_layer {
|
||||||
|
// -----------------------------------------------------------------------------------------
|
||||||
|
// | GUI | ~ | Q | W | E | R | T | | Y | U | I | O | P | [ | GUI/] |
|
||||||
|
// | CTRL | A | S | D | F | G | | H | J | K | L | ; |CTRL/'|
|
||||||
|
// | LALT | Z | X | C | V | B | | N | M | , | . | / | RALT |
|
||||||
|
// | RSE | SPC | LWR | | LWR | BKSP | RSE |
|
||||||
|
bindings = <
|
||||||
|
&kp LWIN &kp GRAVE &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &mt RWIN RBKT
|
||||||
|
&kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &mt RCTRL QUOT
|
||||||
|
&kp LALT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp BSLH
|
||||||
|
< RSE TAB &mt LSHFT SPC < LWR RET < LWR ESC &mt RSHFT BSPC < RSE DEL
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
lower_layer {
|
||||||
|
// -----------------------------------------------------------------------------------------
|
||||||
|
// | | _ | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
|
||||||
|
// | + | ! | @ | # | $ | % | | ^ | & | * | ( | ) | - |
|
||||||
|
// | = | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | |
|
||||||
|
// | GUI | | SPC | | ENT | | ALT |
|
||||||
|
bindings = <
|
||||||
|
&trans &kp UNDER &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &mt RGUI F12
|
||||||
|
&mt LCTRL PLUS &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CRRT &kp AMPS &kp STAR &kp LPAR &kp RPAR &mt RCTRL MINUS
|
||||||
|
&mt LALT EQUAL &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &trans
|
||||||
|
< ADJ TAB &trans &trans &trans &trans < ADJ DEL
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
raise_layer {
|
||||||
|
// -----------------------------------------------------------------------------------------
|
||||||
|
// | | NMLK | / | 7 | 8 | 9 | - | | VOLU| HOME| PRSC| PGUP| SCLK| CLCK| |
|
||||||
|
// | CTRL | * | 4 | 5 | 6 | + | | MUT | LEFT| UP | RGHT| INS | APP |
|
||||||
|
// | | 0 | 1 | 2 | 3 | . | | VOLD| END | DOWN| PGDN| PAUS| |
|
||||||
|
// | | | ADJ | | ADJ | | |
|
||||||
|
bindings = <
|
||||||
|
&trans &kp KP_NUM &kp KP_SLASH &kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_MINUS &kp C_VOL_UP &kp HOME &kp PSCRN &kp PG_UP &kp SLCK &kp CAPS &trans
|
||||||
|
&mt LCTRL EQL &kp KP_MULTIPLY &kp KP_N4 &kp KP_N5 &kp KP_N6 &kp KP_PLUS &kp C_MUTE &kp LEFT &kp UP &kp RIGHT &kp INS &mt RCTRL K_APP
|
||||||
|
&trans &kp KP_N0 &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_DOT &kp C_VOL_DN &kp END &kp DOWN &kp PG_DN &kp PAUS &trans
|
||||||
|
&trans &trans < ADJ RET < ADJ ESC &trans &trans
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
adjust_layer {
|
||||||
|
// -----------------------------------------------------------------------------------------
|
||||||
|
// | RST | BLDR | | | | | | | | | | | | BLDR | RST |
|
||||||
|
// | BTCLR| BT0 | BT1 | BT2 | BT3 | BT4 | | BT4 | BT3 | BT2 | BT1 | BT0 | BTCLR|
|
||||||
|
// | | | | | | | | | | | | | |
|
||||||
|
// | | | | | | | |
|
||||||
|
bindings = <
|
||||||
|
&reset &bootloader &none &none &none &none &none &none &none &none &none &none &bootloader &reset
|
||||||
|
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &bt BT_SEL 4 &bt BT_SEL 3 &bt BT_SEL 2 &bt BT_SEL 1 &bt BT_SEL 0 &bt BT_CLR
|
||||||
|
&none &none &none &none &none &none &none &none &none &none &none &none
|
||||||
|
&trans &none &trans &trans &none &trans
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
2
app/boards/shields/jorne/jorne_left.conf
Normal file
2
app/boards/shields/jorne/jorne_left.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
CONFIG_ZMK_SPLIT=y
|
||||||
|
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
|
18
app/boards/shields/jorne/jorne_left.overlay
Normal file
18
app/boards/shields/jorne/jorne_left.overlay
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "jorne.dtsi"
|
||||||
|
|
||||||
|
&kscan0 {
|
||||||
|
col-gpios
|
||||||
|
= <&pro_micro_a 3 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 2 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
|
||||||
|
;
|
||||||
|
};
|
2
app/boards/shields/jorne/jorne_right.conf
Normal file
2
app/boards/shields/jorne/jorne_right.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
CONFIG_ZMK_SPLIT=y
|
||||||
|
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
|
22
app/boards/shields/jorne/jorne_right.overlay
Normal file
22
app/boards/shields/jorne/jorne_right.overlay
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "jorne.dtsi"
|
||||||
|
|
||||||
|
&default_transform {
|
||||||
|
col-offset = <6>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&kscan0 {
|
||||||
|
col-gpios
|
||||||
|
= <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 2 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro_a 3 GPIO_ACTIVE_HIGH>
|
||||||
|
;
|
||||||
|
};
|
|
@ -1,5 +1,5 @@
|
||||||
&spi1 {
|
&spi1 {
|
||||||
compatible = "nordic,nrf-spi";
|
compatible = "nordic,nrf-spim";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
mosi-pin = <6>;
|
mosi-pin = <6>;
|
||||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
&spi1 {
|
&spi1 {
|
||||||
compatible = "nordic,nrf-spi";
|
compatible = "nordic,nrf-spim";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
mosi-pin = <6>;
|
mosi-pin = <6>;
|
||||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
&spi1 {
|
&spi1 {
|
||||||
compatible = "nordic,nrf-spi";
|
compatible = "nordic,nrf-spim";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
mosi-pin = <6>;
|
mosi-pin = <6>;
|
||||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
&spi1 {
|
&spi1 {
|
||||||
compatible = "nordic,nrf-spi";
|
compatible = "nordic,nrf-spim";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
mosi-pin = <6>;
|
mosi-pin = <6>;
|
||||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||||
|
|
|
@ -81,10 +81,6 @@ RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9)
|
||||||
sensors = <&left_encoder &right_encoder>;
|
sensors = <&left_encoder &right_encoder>;
|
||||||
};
|
};
|
||||||
|
|
||||||
bt_unpair_combo: bt_unpair_combo {
|
|
||||||
compatible = "zmk,bt-unpair-combo";
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: RGB node(s)
|
// TODO: RGB node(s)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,3 @@
|
||||||
&left_encoder {
|
&left_encoder {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
&bt_unpair_combo {
|
|
||||||
key-positions = <0 44>;
|
|
||||||
};
|
|
|
@ -27,7 +27,3 @@
|
||||||
&right_encoder {
|
&right_encoder {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
&bt_unpair_combo {
|
|
||||||
key-positions = <11 45>;
|
|
||||||
};
|
|
|
@ -57,10 +57,6 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7)
|
||||||
compatible = "zmk,keymap-sensors";
|
compatible = "zmk,keymap-sensors";
|
||||||
sensors = <&left_encoder>;
|
sensors = <&left_encoder>;
|
||||||
};
|
};
|
||||||
|
|
||||||
bt_unpair_combo: bt_unpair_combo {
|
|
||||||
compatible = "zmk,bt-unpair-combo";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
&pro_micro_i2c {
|
&pro_micro_i2c {
|
||||||
|
|
|
@ -20,7 +20,3 @@
|
||||||
&left_encoder {
|
&left_encoder {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
&bt_unpair_combo {
|
|
||||||
key-positions = <0 53>;
|
|
||||||
};
|
|
||||||
|
|
|
@ -20,7 +20,3 @@
|
||||||
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
&bt_unpair_combo {
|
|
||||||
key-positions = <11 54>;
|
|
||||||
};
|
|
||||||
|
|
|
@ -56,11 +56,5 @@ RC(6,4) RC(6,3) RC(6,2) RC(6,1) RC(6,0) RC(5,7) RC(5,6) RC(5,5) RC(5,4) RC
|
||||||
RC(6,5) RC(6,6) RC(6,7) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4)
|
RC(6,5) RC(6,6) RC(6,7) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4)
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
|
|
||||||
bt_unpair_combo: bt_unpair_combo {
|
|
||||||
compatible = "zmk,bt-unpair-combo";
|
|
||||||
key-positions = <0 53>;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
&spi1 {
|
&spi1 {
|
||||||
compatible = "nordic,nrf-spi";
|
compatible = "nordic,nrf-spim";
|
||||||
/* Cannot be used together with i2c0. */
|
/* Cannot be used together with i2c0. */
|
||||||
status = "okay";
|
status = "okay";
|
||||||
mosi-pin = <6>;
|
mosi-pin = <6>;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Uncomment the following lines to enable the Corne RGB Underglow
|
# Uncomment the following lines to enable the Microdox RGB Underglow
|
||||||
# ZMK_RGB_UNDERGLOW=y
|
# CONFIG_ZMK_RGB_UNDERGLOW=y
|
||||||
# CONFIG_WS2812_STRIP=y
|
# CONFIG_WS2812_STRIP=y
|
||||||
|
|
||||||
# Uncomment the following line to enable the Corne OLED Display
|
# Uncomment the following line to enable the Microdox OLED Display
|
||||||
# CONFIG_ZMK_DISPLAY=y
|
# CONFIG_ZMK_DISPLAY=y
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
};
|
};
|
||||||
num_sym {
|
num_sym {
|
||||||
bindings = <
|
bindings = <
|
||||||
&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 N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0
|
||||||
&trans &trans &trans &trans &trans &trans &trans &trans &kp EQL &kp MINUS
|
&trans &trans &trans &trans &trans &trans &trans &trans &kp EQL &kp MINUS
|
||||||
&kp DEL &none &none &none &none &none &none &none &kp DOT
|
&kp DEL &none &none &none &none &none &none &none &kp DOT
|
||||||
&bootloader &reset &none &trans &trans &kp RET &trans &kp FSLH
|
&bootloader &reset &none &trans &trans &kp RET &trans &kp FSLH
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
&spi1 {
|
&spi1 {
|
||||||
compatible = "nordic,nrf-spi";
|
compatible = "nordic,nrf-spim";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
mosi-pin = <6>;
|
mosi-pin = <6>;
|
||||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||||
|
|
|
@ -30,11 +30,5 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bt_unpair_combo: bt_unpair_combo {
|
|
||||||
compatible = "zmk,bt-unpair-combo";
|
|
||||||
key-positions = <0 11>;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
&spi1 {
|
&spi1 {
|
||||||
compatible = "nordic,nrf-spi";
|
compatible = "nordic,nrf-spim";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
mosi-pin = <6>;
|
mosi-pin = <6>;
|
||||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||||
|
|
|
@ -66,10 +66,6 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7)
|
||||||
compatible = "zmk,keymap-sensors";
|
compatible = "zmk,keymap-sensors";
|
||||||
sensors = <&left_encoder &right_encoder>;
|
sensors = <&left_encoder &right_encoder>;
|
||||||
};
|
};
|
||||||
|
|
||||||
bt_unpair_combo: bt_unpair_combo {
|
|
||||||
compatible = "zmk,bt-unpair-combo";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
&pro_micro_i2c {
|
&pro_micro_i2c {
|
||||||
|
|
|
@ -20,7 +20,3 @@
|
||||||
&left_encoder {
|
&left_encoder {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
&bt_unpair_combo {
|
|
||||||
key-positions = <0 54>;
|
|
||||||
};
|
|
||||||
|
|
|
@ -24,7 +24,3 @@
|
||||||
&right_encoder {
|
&right_encoder {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
&bt_unpair_combo {
|
|
||||||
key-positions = <11 55>;
|
|
||||||
};
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
# * single overlay,
|
# * single overlay,
|
||||||
# * or per board/shield.
|
# * or per board/shield.
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
get_property(cached_user_config_value CACHE ZMK_CONFIG PROPERTY VALUE)
|
get_property(cached_user_config_value CACHE ZMK_CONFIG PROPERTY VALUE)
|
||||||
|
|
||||||
set(user_config_cli_argument ${cached_user_config_value}) # Either new or old
|
set(user_config_cli_argument ${cached_user_config_value}) # Either new or old
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# Copyright (c) 2020 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
config ZMK_KSCAN_GPIO_DRIVER
|
config ZMK_KSCAN_GPIO_DRIVER
|
||||||
bool "Enable GPIO kscan driver to simulate key presses"
|
bool "Enable GPIO kscan driver to simulate key presses"
|
||||||
default y
|
default y
|
||||||
|
|
|
@ -205,8 +205,8 @@ static const struct bvd_config bvd_cfg = {
|
||||||
.power_gpios =
|
.power_gpios =
|
||||||
{
|
{
|
||||||
DT_INST_GPIO_LABEL(0, power_gpios),
|
DT_INST_GPIO_LABEL(0, power_gpios),
|
||||||
DT_INST_PIN(0, power_gpios),
|
DT_INST_GPIO_PIN(0, power_gpios),
|
||||||
DT_INST_FLAGS(0, power_gpios),
|
DT_INST_GPIO_FLAGS(0, power_gpios),
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
.output_ohm = DT_INST_PROP(0, output_ohms),
|
.output_ohm = DT_INST_PROP(0, output_ohms),
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <behaviors/none.dtsi>
|
#include <behaviors/none.dtsi>
|
||||||
#include <behaviors/mod_tap.dtsi>
|
#include <behaviors/mod_tap.dtsi>
|
||||||
#include <behaviors/layer_tap.dtsi>
|
#include <behaviors/layer_tap.dtsi>
|
||||||
|
#include <behaviors/sticky_key.dtsi>
|
||||||
#include <behaviors/momentary_layer.dtsi>
|
#include <behaviors/momentary_layer.dtsi>
|
||||||
#include <behaviors/toggle_layer.dtsi>
|
#include <behaviors/toggle_layer.dtsi>
|
||||||
#include <behaviors/reset.dtsi>
|
#include <behaviors/reset.dtsi>
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
behaviors {
|
behaviors {
|
||||||
bt: behavior_bluetooth {
|
bt: behavior_bluetooth {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
behaviors {
|
behaviors {
|
||||||
ext_power: behavior_ext_power {
|
ext_power: behavior_ext_power {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
/*
|
||||||
#include <dt-bindings/zmk/hid_usage_pages.h>
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
behaviors {
|
behaviors {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
behaviors {
|
behaviors {
|
||||||
lt: behavior_layer_tap {
|
lt: behavior_layer_tap {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
behaviors {
|
behaviors {
|
||||||
mt: behavior_mod_tap {
|
mt: behavior_mod_tap {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
behaviors {
|
behaviors {
|
||||||
mo: behavior_momentary_layer {
|
mo: behavior_momentary_layer {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 Pete Johanson
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
behaviors {
|
behaviors {
|
||||||
out: behavior_outputs {
|
out: behavior_outputs {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
#include <dt-bindings/zmk/reset.h>
|
#include <dt-bindings/zmk/reset.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
behaviors {
|
behaviors {
|
||||||
rgb_ug: behavior_rgb_underglow {
|
rgb_ug: behavior_rgb_underglow {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
/*
|
||||||
#include <dt-bindings/zmk/hid_usage_pages.h>
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
behaviors {
|
behaviors {
|
||||||
|
|
26
app/dts/behaviors/sticky_key.dtsi
Normal file
26
app/dts/behaviors/sticky_key.dtsi
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/ {
|
||||||
|
behaviors {
|
||||||
|
sk: behavior_sticky_key {
|
||||||
|
compatible = "zmk,behavior-sticky-key";
|
||||||
|
label = "STICKY_KEY";
|
||||||
|
#binding-cells = <1>;
|
||||||
|
release-after-ms = <1000>;
|
||||||
|
bindings = <&kp>;
|
||||||
|
};
|
||||||
|
sl: behavior_sticky_layer {
|
||||||
|
compatible = "zmk,behavior-sticky-key";
|
||||||
|
label = "STICKY_LAYER";
|
||||||
|
#binding-cells = <1>;
|
||||||
|
release-after-ms = <1000>;
|
||||||
|
bindings = <&mo>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
behaviors {
|
behaviors {
|
||||||
trans: behavior_transparent {
|
trans: behavior_transparent {
|
||||||
|
|
15
app/dts/bindings/behaviors/zmk,behavior-sticky-key.yaml
Normal file
15
app/dts/bindings/behaviors/zmk,behavior-sticky-key.yaml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Copyright (c) 2020 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
description: Sticky key behavior
|
||||||
|
|
||||||
|
compatible: "zmk,behavior-sticky-key"
|
||||||
|
|
||||||
|
include: one_param.yaml
|
||||||
|
|
||||||
|
properties:
|
||||||
|
bindings:
|
||||||
|
type: phandles
|
||||||
|
required: true
|
||||||
|
release-after-ms:
|
||||||
|
type: int
|
|
@ -1,12 +0,0 @@
|
||||||
# Copyright (c) 2020, Pete Johanson
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
description: |
|
|
||||||
Defines a set of key positions that will unpair all BT devices if held on startup.
|
|
||||||
|
|
||||||
compatible: "zmk,bt-unpair-combo"
|
|
||||||
|
|
||||||
properties:
|
|
||||||
key-positions:
|
|
||||||
type: array
|
|
||||||
required: true
|
|
|
@ -23,7 +23,7 @@
|
||||||
typedef int (*behavior_keymap_binding_callback_t)(struct zmk_behavior_binding *binding,
|
typedef int (*behavior_keymap_binding_callback_t)(struct zmk_behavior_binding *binding,
|
||||||
struct zmk_behavior_binding_event event);
|
struct zmk_behavior_binding_event event);
|
||||||
typedef int (*behavior_sensor_keymap_binding_callback_t)(struct zmk_behavior_binding *binding,
|
typedef int (*behavior_sensor_keymap_binding_callback_t)(struct zmk_behavior_binding *binding,
|
||||||
struct device *sensor);
|
struct device *sensor, s64_t timestamp);
|
||||||
|
|
||||||
__subsystem struct behavior_driver_api {
|
__subsystem struct behavior_driver_api {
|
||||||
behavior_keymap_binding_callback_t binding_pressed;
|
behavior_keymap_binding_callback_t binding_pressed;
|
||||||
|
@ -92,11 +92,11 @@ static inline int z_impl_behavior_keymap_binding_released(struct zmk_behavior_bi
|
||||||
* @retval Negative errno code if failure.
|
* @retval Negative errno code if failure.
|
||||||
*/
|
*/
|
||||||
__syscall int behavior_sensor_keymap_binding_triggered(struct zmk_behavior_binding *binding,
|
__syscall int behavior_sensor_keymap_binding_triggered(struct zmk_behavior_binding *binding,
|
||||||
struct device *sensor);
|
struct device *sensor, s64_t timestamp);
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
z_impl_behavior_sensor_keymap_binding_triggered(struct zmk_behavior_binding *binding,
|
z_impl_behavior_sensor_keymap_binding_triggered(struct zmk_behavior_binding *binding,
|
||||||
struct device *sensor) {
|
struct device *sensor, s64_t timestamp) {
|
||||||
struct device *dev = device_get_binding(binding->behavior_dev);
|
struct device *dev = device_get_binding(binding->behavior_dev);
|
||||||
const struct behavior_driver_api *api = (const struct behavior_driver_api *)dev->driver_api;
|
const struct behavior_driver_api *api = (const struct behavior_driver_api *)dev->driver_api;
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ z_impl_behavior_sensor_keymap_binding_triggered(struct zmk_behavior_binding *bin
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
return api->sensor_binding_triggered(binding, sensor);
|
return api->sensor_binding_triggered(binding, sensor, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define HID_EXT_USAGE(page, id) ((page << 16) | id)
|
#define HID_USAGE(page, id) ((page << 16) | id)
|
||||||
#define HID_EXT_USAGE_ID(ext) (ext & 0xFFFF)
|
#define HID_USAGE_ID(usage) (usage & 0xFFFF)
|
||||||
#define HID_EXT_USAGE_PAGE(ext) (ext >> 16)
|
#define HID_USAGE_PAGE(usage) (usage >> 16)
|
||||||
|
|
||||||
/* WARNING: DEPRECATED from dt-bindings/zmk/keys.h */
|
/* WARNING: DEPRECATED from dt-bindings/zmk/keys.h */
|
||||||
#define USAGE_KEYPAD (0x07) // WARNING: DEPRECATED (DO NOT USE)
|
#define USAGE_KEYPAD (0x07) // WARNING: DEPRECATED (DO NOT USE)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,14 +18,15 @@ struct keycode_state_changed {
|
||||||
u32_t keycode;
|
u32_t keycode;
|
||||||
u8_t implicit_modifiers;
|
u8_t implicit_modifiers;
|
||||||
bool state;
|
bool state;
|
||||||
|
s64_t timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
ZMK_EVENT_DECLARE(keycode_state_changed);
|
ZMK_EVENT_DECLARE(keycode_state_changed);
|
||||||
|
|
||||||
static inline struct keycode_state_changed *keycode_state_changed_from_encoded(u32_t encoded,
|
static inline struct keycode_state_changed *
|
||||||
bool pressed) {
|
keycode_state_changed_from_encoded(u32_t encoded, bool pressed, s64_t timestamp) {
|
||||||
u16_t page = HID_EXT_USAGE_PAGE(encoded) & 0xFF;
|
u16_t page = HID_USAGE_PAGE(encoded) & 0xFF;
|
||||||
u16_t id = HID_EXT_USAGE_ID(encoded);
|
u16_t id = HID_USAGE_ID(encoded);
|
||||||
zmk_mod_flags implicit_mods = SELECT_MODS(encoded);
|
zmk_mod_flags implicit_mods = SELECT_MODS(encoded);
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
|
@ -37,5 +38,6 @@ static inline struct keycode_state_changed *keycode_state_changed_from_encoded(u
|
||||||
ev->keycode = id;
|
ev->keycode = id;
|
||||||
ev->implicit_modifiers = implicit_mods;
|
ev->implicit_modifiers = implicit_mods;
|
||||||
ev->state = pressed;
|
ev->state = pressed;
|
||||||
|
ev->timestamp = timestamp;
|
||||||
return ev;
|
return ev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ struct sensor_event {
|
||||||
struct zmk_event_header header;
|
struct zmk_event_header header;
|
||||||
u8_t sensor_number;
|
u8_t sensor_number;
|
||||||
struct device *sensor;
|
struct device *sensor;
|
||||||
|
s64_t timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
ZMK_EVENT_DECLARE(sensor_event);
|
ZMK_EVENT_DECLARE(sensor_event);
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#define COLLECTION_REPORT 0x03
|
#define COLLECTION_REPORT 0x03
|
||||||
|
|
||||||
#define ZMK_HID_KEYPAD_NKRO_SIZE 6
|
#define ZMK_HID_KEYBOARD_NKRO_SIZE 6
|
||||||
|
|
||||||
#define ZMK_HID_CONSUMER_NKRO_SIZE 6
|
#define ZMK_HID_CONSUMER_NKRO_SIZE 6
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@ static const u8_t zmk_hid_report_desc[] = {
|
||||||
HID_USAGE_KEY,
|
HID_USAGE_KEY,
|
||||||
/* USAGE_MINIMUM (Keyboard LeftControl) */
|
/* USAGE_MINIMUM (Keyboard LeftControl) */
|
||||||
HID_LI_USAGE_MIN(1),
|
HID_LI_USAGE_MIN(1),
|
||||||
0xE0,
|
HID_USAGE_KEY_KEYBOARD_LEFTCONTROL,
|
||||||
/* USAGE_MAXIMUM (Keyboard Right GUI) */
|
/* USAGE_MAXIMUM (Keyboard Right GUI) */
|
||||||
HID_LI_USAGE_MAX(1),
|
HID_LI_USAGE_MAX(1),
|
||||||
0xE7,
|
HID_USAGE_KEY_KEYBOARD_RIGHT_GUI,
|
||||||
/* LOGICAL_MINIMUM (0) */
|
/* LOGICAL_MINIMUM (0) */
|
||||||
HID_GI_LOGICAL_MIN(1),
|
HID_GI_LOGICAL_MIN(1),
|
||||||
0x00,
|
0x00,
|
||||||
|
@ -89,9 +89,9 @@ static const u8_t zmk_hid_report_desc[] = {
|
||||||
/* REPORT_SIZE (1) */
|
/* REPORT_SIZE (1) */
|
||||||
HID_GI_REPORT_SIZE,
|
HID_GI_REPORT_SIZE,
|
||||||
0x08,
|
0x08,
|
||||||
/* REPORT_COUNT (ZMK_HID_KEYPAD_NKRO_SIZE) */
|
/* REPORT_COUNT (ZMK_HID_KEYBOARD_NKRO_SIZE) */
|
||||||
HID_GI_REPORT_COUNT,
|
HID_GI_REPORT_COUNT,
|
||||||
ZMK_HID_KEYPAD_NKRO_SIZE,
|
ZMK_HID_KEYBOARD_NKRO_SIZE,
|
||||||
/* INPUT (Data,Ary,Abs) */
|
/* INPUT (Data,Ary,Abs) */
|
||||||
HID_MI_INPUT,
|
HID_MI_INPUT,
|
||||||
0x00,
|
0x00,
|
||||||
|
@ -146,15 +146,15 @@ static const u8_t zmk_hid_report_desc[] = {
|
||||||
// u8_t keys[6];
|
// u8_t keys[6];
|
||||||
// } __packed;
|
// } __packed;
|
||||||
|
|
||||||
struct zmk_hid_keypad_report_body {
|
struct zmk_hid_keyboard_report_body {
|
||||||
zmk_mod_flags modifiers;
|
zmk_mod_flags modifiers;
|
||||||
u8_t _reserved;
|
u8_t _reserved;
|
||||||
u8_t keys[ZMK_HID_KEYPAD_NKRO_SIZE];
|
u8_t keys[ZMK_HID_KEYBOARD_NKRO_SIZE];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct zmk_hid_keypad_report {
|
struct zmk_hid_keyboard_report {
|
||||||
u8_t report_id;
|
u8_t report_id;
|
||||||
struct zmk_hid_keypad_report_body body;
|
struct zmk_hid_keyboard_report_body body;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct zmk_hid_consumer_report_body {
|
struct zmk_hid_consumer_report_body {
|
||||||
|
@ -170,13 +170,13 @@ int zmk_hid_register_mod(zmk_mod modifier);
|
||||||
int zmk_hid_unregister_mod(zmk_mod modifier);
|
int zmk_hid_unregister_mod(zmk_mod modifier);
|
||||||
int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers);
|
int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers);
|
||||||
int zmk_hid_implicit_modifiers_release();
|
int zmk_hid_implicit_modifiers_release();
|
||||||
int zmk_hid_keypad_press(zmk_key key);
|
int zmk_hid_keyboard_press(zmk_key key);
|
||||||
int zmk_hid_keypad_release(zmk_key key);
|
int zmk_hid_keyboard_release(zmk_key key);
|
||||||
void zmk_hid_keypad_clear();
|
void zmk_hid_keyboard_clear();
|
||||||
|
|
||||||
int zmk_hid_consumer_press(zmk_key key);
|
int zmk_hid_consumer_press(zmk_key key);
|
||||||
int zmk_hid_consumer_release(zmk_key key);
|
int zmk_hid_consumer_release(zmk_key key);
|
||||||
void zmk_hid_consumer_clear();
|
void zmk_hid_consumer_clear();
|
||||||
|
|
||||||
struct zmk_hid_keypad_report *zmk_hid_get_keypad_report();
|
struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report();
|
||||||
struct zmk_hid_consumer_report *zmk_hid_get_consumer_report();
|
struct zmk_hid_consumer_report *zmk_hid_get_consumer_report();
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
|
|
||||||
int zmk_hog_init();
|
int zmk_hog_init();
|
||||||
|
|
||||||
int zmk_hog_send_keypad_report(struct zmk_hid_keypad_report_body *body);
|
int zmk_hog_send_keyboard_report(struct zmk_hid_keyboard_report_body *body);
|
||||||
int zmk_hog_send_consumer_report(struct zmk_hid_consumer_report_body *body);
|
int zmk_hog_send_consumer_report(struct zmk_hid_consumer_report_body *body);
|
||||||
|
|
|
@ -4,19 +4,27 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Usage: ./run-test.sh <path to testcase>"
|
echo "Usage: ./run-test.sh <path to testcase>"
|
||||||
exit 1
|
exit 1
|
||||||
elif [ "$1" = "all" ]; then
|
fi
|
||||||
|
|
||||||
|
path="$1"
|
||||||
|
if [ $path = "all" ]; then
|
||||||
|
path="tests"
|
||||||
|
fi
|
||||||
|
|
||||||
|
testcases=$(find $path -name native_posix.keymap -exec dirname \{\} \;)
|
||||||
|
num_cases=$(echo "$testcases" | wc -l)
|
||||||
|
if [ $num_cases -gt 1 ]; then
|
||||||
echo "" > ./build/tests/pass-fail.log
|
echo "" > ./build/tests/pass-fail.log
|
||||||
find tests -name native_posix.keymap -exec dirname \{\} \; | xargs -l -P 4 ./run-test.sh
|
echo "$testcases" | xargs -l -P 4 ./run-test.sh
|
||||||
err=$?
|
err=$?
|
||||||
sort -k2 ./build/tests/pass-fail.log
|
sort -k2 ./build/tests/pass-fail.log
|
||||||
exit $err
|
exit $err
|
||||||
fi
|
fi
|
||||||
|
|
||||||
testcase="$1"
|
testcase="$path"
|
||||||
echo "Running $testcase:"
|
echo "Running $testcase:"
|
||||||
|
|
||||||
west build -d build/$testcase -b native_posix -- -DZMK_CONFIG=$testcase > /dev/null 2>&1
|
west build -d build/$testcase -b native_posix -- -DZMK_CONFIG=$testcase > /dev/null 2>&1
|
||||||
|
|
9
app/scripts/west-commands.yml
Normal file
9
app/scripts/west-commands.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Copyright (c) 2020, ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
west-commands:
|
||||||
|
- file: scripts/west_commands/test.py
|
||||||
|
commands:
|
||||||
|
- name: test
|
||||||
|
class: Test
|
||||||
|
help: run ZMK testsuite
|
33
app/scripts/west_commands/test.py
Normal file
33
app/scripts/west_commands/test.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# Copyright (c) 2020 The ZMK Contributors
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
'''Test runner for ZMK.'''
|
||||||
|
|
||||||
|
import os
|
||||||
|
from textwrap import dedent # just for nicer code indentation
|
||||||
|
|
||||||
|
from west.commands import WestCommand
|
||||||
|
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.'''))
|
||||||
|
|
||||||
|
def do_add_parser(self, parser_adder):
|
||||||
|
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
|
||||||
|
|
||||||
|
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')
|
||||||
|
exit(os.system(f'{self.topdir}/app/run-test.sh {args.test_path}'))
|
|
@ -21,15 +21,15 @@ static int behavior_key_press_init(struct device *dev) { return 0; };
|
||||||
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||||
struct zmk_behavior_binding_event event) {
|
struct zmk_behavior_binding_event event) {
|
||||||
LOG_DBG("position %d keycode 0x%02X", event.position, binding->param1);
|
LOG_DBG("position %d keycode 0x%02X", event.position, binding->param1);
|
||||||
|
return ZMK_EVENT_RAISE(
|
||||||
return ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(binding->param1, true));
|
keycode_state_changed_from_encoded(binding->param1, true, event.timestamp));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
|
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
|
||||||
struct zmk_behavior_binding_event event) {
|
struct zmk_behavior_binding_event event) {
|
||||||
LOG_DBG("position %d keycode 0x%02X", event.position, binding->param1);
|
LOG_DBG("position %d keycode 0x%02X", event.position, binding->param1);
|
||||||
|
return ZMK_EVENT_RAISE(
|
||||||
return ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(binding->param1, false));
|
keycode_state_changed_from_encoded(binding->param1, false, event.timestamp));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct behavior_driver_api behavior_key_press_driver_api = {
|
static const struct behavior_driver_api behavior_key_press_driver_api = {
|
||||||
|
|
|
@ -48,8 +48,14 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
|
||||||
|
struct zmk_behavior_binding_event event) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct behavior_driver_api behavior_rgb_underglow_driver_api = {
|
static const struct behavior_driver_api behavior_rgb_underglow_driver_api = {
|
||||||
.binding_pressed = on_keymap_binding_pressed,
|
.binding_pressed = on_keymap_binding_pressed,
|
||||||
|
.binding_released = on_keymap_binding_released,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(behavior_rgb_underglow, DT_INST_LABEL(0), behavior_rgb_underglow_init, NULL,
|
DEVICE_AND_API_INIT(behavior_rgb_underglow, DT_INST_LABEL(0), behavior_rgb_underglow_init, NULL,
|
||||||
|
|
|
@ -18,8 +18,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
|
|
||||||
static int behavior_sensor_rotate_key_press_init(struct device *dev) { return 0; };
|
static int behavior_sensor_rotate_key_press_init(struct device *dev) { return 0; };
|
||||||
|
|
||||||
static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding,
|
static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding, struct device *sensor,
|
||||||
struct device *sensor) {
|
s64_t timestamp) {
|
||||||
struct sensor_value value;
|
struct sensor_value value;
|
||||||
int err;
|
int err;
|
||||||
u32_t keycode;
|
u32_t keycode;
|
||||||
|
@ -45,12 +45,12 @@ static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding,
|
||||||
|
|
||||||
LOG_DBG("SEND %d", keycode);
|
LOG_DBG("SEND %d", keycode);
|
||||||
|
|
||||||
ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(keycode, true));
|
ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(keycode, true, timestamp));
|
||||||
|
|
||||||
// TODO: Better way to do this?
|
// TODO: Better way to do this?
|
||||||
k_msleep(5);
|
k_msleep(5);
|
||||||
|
|
||||||
return ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(keycode, false));
|
return ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(keycode, false, timestamp));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct behavior_driver_api behavior_sensor_rotate_key_press_driver_api = {
|
static const struct behavior_driver_api behavior_sensor_rotate_key_press_driver_api = {
|
||||||
|
|
274
app/src/behaviors/behavior_sticky_key.c
Normal file
274
app/src/behaviors/behavior_sticky_key.c
Normal file
|
@ -0,0 +1,274 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DT_DRV_COMPAT zmk_behavior_sticky_key
|
||||||
|
|
||||||
|
#include <device.h>
|
||||||
|
#include <drivers/behavior.h>
|
||||||
|
#include <logging/log.h>
|
||||||
|
#include <zmk/behavior.h>
|
||||||
|
|
||||||
|
#include <zmk/matrix.h>
|
||||||
|
#include <zmk/endpoints.h>
|
||||||
|
#include <zmk/event-manager.h>
|
||||||
|
#include <zmk/events/position-state-changed.h>
|
||||||
|
#include <zmk/events/keycode-state-changed.h>
|
||||||
|
#include <zmk/events/modifiers-state-changed.h>
|
||||||
|
#include <zmk/hid.h>
|
||||||
|
|
||||||
|
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
|
|
||||||
|
#if DT_NODE_EXISTS(DT_DRV_INST(0))
|
||||||
|
|
||||||
|
#define ZMK_BHV_STICKY_KEY_MAX_HELD 10
|
||||||
|
|
||||||
|
// increase this if you need more keys in the board
|
||||||
|
#define ZMK_BHV_STICKY_KEY_POSITION_NOT_USED ULONG_MAX
|
||||||
|
|
||||||
|
struct behavior_sticky_key_config {
|
||||||
|
u32_t release_after_ms;
|
||||||
|
struct zmk_behavior_binding behavior;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct active_sticky_key {
|
||||||
|
u32_t position;
|
||||||
|
u32_t param1;
|
||||||
|
u32_t param2;
|
||||||
|
const struct behavior_sticky_key_config *config;
|
||||||
|
// timer data.
|
||||||
|
bool timer_started;
|
||||||
|
s64_t release_at;
|
||||||
|
struct k_delayed_work release_timer;
|
||||||
|
bool timer_is_cancelled;
|
||||||
|
// usage page and keycode for the key that is being modified by this sticky key
|
||||||
|
u8_t modified_key_usage_page;
|
||||||
|
u32_t modified_key_keycode;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct active_sticky_key active_sticky_keys[ZMK_BHV_STICKY_KEY_MAX_HELD] = {};
|
||||||
|
|
||||||
|
static struct active_sticky_key *store_sticky_key(u32_t position, u32_t param1, u32_t param2,
|
||||||
|
const struct behavior_sticky_key_config *config) {
|
||||||
|
for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) {
|
||||||
|
if (active_sticky_keys[i].position != ZMK_BHV_STICKY_KEY_POSITION_NOT_USED) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
active_sticky_keys[i].position = position;
|
||||||
|
active_sticky_keys[i].param1 = param1;
|
||||||
|
active_sticky_keys[i].param2 = param2;
|
||||||
|
active_sticky_keys[i].config = config;
|
||||||
|
active_sticky_keys[i].release_at = 0;
|
||||||
|
active_sticky_keys[i].timer_is_cancelled = false;
|
||||||
|
active_sticky_keys[i].timer_started = false;
|
||||||
|
active_sticky_keys[i].modified_key_usage_page = 0;
|
||||||
|
active_sticky_keys[i].modified_key_keycode = 0;
|
||||||
|
return &active_sticky_keys[i];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void clear_sticky_key(struct active_sticky_key *sticky_key) {
|
||||||
|
sticky_key->position = ZMK_BHV_STICKY_KEY_POSITION_NOT_USED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct active_sticky_key *find_sticky_key(u32_t position) {
|
||||||
|
for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) {
|
||||||
|
if (active_sticky_keys[i].position == position) {
|
||||||
|
return &active_sticky_keys[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int press_sticky_key_behavior(struct active_sticky_key *sticky_key, s64_t timestamp) {
|
||||||
|
struct zmk_behavior_binding binding = {
|
||||||
|
.behavior_dev = sticky_key->config->behavior.behavior_dev,
|
||||||
|
.param1 = sticky_key->param1,
|
||||||
|
.param2 = sticky_key->param2,
|
||||||
|
};
|
||||||
|
struct zmk_behavior_binding_event event = {
|
||||||
|
.position = sticky_key->position,
|
||||||
|
.timestamp = timestamp,
|
||||||
|
};
|
||||||
|
return behavior_keymap_binding_pressed(&binding, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int release_sticky_key_behavior(struct active_sticky_key *sticky_key,
|
||||||
|
s64_t timestamp) {
|
||||||
|
struct zmk_behavior_binding binding = {
|
||||||
|
.behavior_dev = sticky_key->config->behavior.behavior_dev,
|
||||||
|
.param1 = sticky_key->param1,
|
||||||
|
.param2 = sticky_key->param2,
|
||||||
|
};
|
||||||
|
struct zmk_behavior_binding_event event = {
|
||||||
|
.position = sticky_key->position,
|
||||||
|
.timestamp = timestamp,
|
||||||
|
};
|
||||||
|
return behavior_keymap_binding_released(&binding, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int stop_timer(struct active_sticky_key *sticky_key) {
|
||||||
|
int timer_cancel_result = k_delayed_work_cancel(&sticky_key->release_timer);
|
||||||
|
if (timer_cancel_result == -EINPROGRESS) {
|
||||||
|
// too late to cancel, we'll let the timer handler clear up.
|
||||||
|
sticky_key->timer_is_cancelled = true;
|
||||||
|
}
|
||||||
|
return timer_cancel_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int on_sticky_key_binding_pressed(struct zmk_behavior_binding *binding,
|
||||||
|
struct zmk_behavior_binding_event event) {
|
||||||
|
struct device *dev = device_get_binding(binding->behavior_dev);
|
||||||
|
const struct behavior_sticky_key_config *cfg = dev->config_info;
|
||||||
|
|
||||||
|
struct active_sticky_key *sticky_key =
|
||||||
|
store_sticky_key(event.position, binding->param1, binding->param2, cfg);
|
||||||
|
if (sticky_key == NULL) {
|
||||||
|
LOG_ERR("unable to store sticky key, did you press more than %d sticky_key?",
|
||||||
|
ZMK_BHV_STICKY_KEY_MAX_HELD);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
press_sticky_key_behavior(sticky_key, event.timestamp);
|
||||||
|
LOG_DBG("%d new sticky_key", event.position);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int on_sticky_key_binding_released(struct zmk_behavior_binding *binding,
|
||||||
|
struct zmk_behavior_binding_event event) {
|
||||||
|
struct active_sticky_key *sticky_key = find_sticky_key(event.position);
|
||||||
|
if (sticky_key == NULL) {
|
||||||
|
LOG_ERR("ACTIVE STICKY KEY CLEARED TOO EARLY");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sticky_key->modified_key_usage_page != 0 && sticky_key->modified_key_keycode != 0) {
|
||||||
|
LOG_DBG("Another key was pressed while the sticky key was pressed. Act like a normal key.");
|
||||||
|
int retval = release_sticky_key_behavior(sticky_key, event.timestamp);
|
||||||
|
clear_sticky_key(sticky_key);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No other key was pressed. Start the timer.
|
||||||
|
sticky_key->timer_started = true;
|
||||||
|
sticky_key->release_at = event.timestamp + sticky_key->config->release_after_ms;
|
||||||
|
// adjust timer in case this behavior was queued by a hold-tap
|
||||||
|
s32_t ms_left = sticky_key->release_at - k_uptime_get();
|
||||||
|
if (ms_left > 0) {
|
||||||
|
k_delayed_work_submit(&sticky_key->release_timer, K_MSEC(ms_left));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct behavior_driver_api behavior_sticky_key_driver_api = {
|
||||||
|
.binding_pressed = on_sticky_key_binding_pressed,
|
||||||
|
.binding_released = on_sticky_key_binding_released,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int sticky_key_keycode_state_changed_listener(const struct zmk_event_header *eh) {
|
||||||
|
if (!is_keycode_state_changed(eh)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
struct keycode_state_changed *ev = cast_keycode_state_changed(eh);
|
||||||
|
for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) {
|
||||||
|
struct active_sticky_key *sticky_key = &active_sticky_keys[i];
|
||||||
|
if (sticky_key->position == ZMK_BHV_STICKY_KEY_POSITION_NOT_USED) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(sticky_key->config->behavior.behavior_dev, "KEY_PRESS") == 0 &&
|
||||||
|
HID_USAGE_ID(sticky_key->param1) == ev->keycode &&
|
||||||
|
HID_USAGE_PAGE(sticky_key->param1) == ev->usage_page &&
|
||||||
|
SELECT_MODS(sticky_key->param1) == ev->implicit_modifiers) {
|
||||||
|
// don't catch key down events generated by the sticky key behavior itself
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If events were queued, the timer event may be queued late or not at all.
|
||||||
|
// Release the sticky key if the timer should've run out in the meantime.
|
||||||
|
if (sticky_key->release_at != 0 && ev->timestamp > sticky_key->release_at) {
|
||||||
|
release_sticky_key_behavior(sticky_key, sticky_key->release_at);
|
||||||
|
if (stop_timer(sticky_key)) {
|
||||||
|
clear_sticky_key(sticky_key);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ev->state) { // key down
|
||||||
|
if (sticky_key->modified_key_usage_page != 0 || sticky_key->modified_key_keycode != 0) {
|
||||||
|
// this sticky key is already in use for a keycode
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (sticky_key->timer_started) {
|
||||||
|
stop_timer(sticky_key);
|
||||||
|
}
|
||||||
|
sticky_key->modified_key_usage_page = ev->usage_page;
|
||||||
|
sticky_key->modified_key_keycode = ev->keycode;
|
||||||
|
|
||||||
|
} else { // key up
|
||||||
|
if (sticky_key->timer_started &&
|
||||||
|
sticky_key->modified_key_usage_page == ev->usage_page &&
|
||||||
|
sticky_key->modified_key_keycode == ev->keycode) {
|
||||||
|
release_sticky_key_behavior(sticky_key, ev->timestamp);
|
||||||
|
stop_timer(sticky_key);
|
||||||
|
clear_sticky_key(sticky_key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZMK_LISTENER(behavior_sticky_key, sticky_key_keycode_state_changed_listener);
|
||||||
|
ZMK_SUBSCRIPTION(behavior_sticky_key, keycode_state_changed);
|
||||||
|
|
||||||
|
void behavior_sticky_key_timer_handler(struct k_work *item) {
|
||||||
|
struct active_sticky_key *sticky_key =
|
||||||
|
CONTAINER_OF(item, struct active_sticky_key, release_timer);
|
||||||
|
if (sticky_key->position == ZMK_BHV_STICKY_KEY_POSITION_NOT_USED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!sticky_key->timer_is_cancelled) {
|
||||||
|
release_sticky_key_behavior(sticky_key, k_uptime_get());
|
||||||
|
}
|
||||||
|
clear_sticky_key(sticky_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int behavior_sticky_key_init(struct device *dev) {
|
||||||
|
static bool init_first_run = true;
|
||||||
|
if (init_first_run) {
|
||||||
|
for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) {
|
||||||
|
k_delayed_work_init(&active_sticky_keys[i].release_timer,
|
||||||
|
behavior_sticky_key_timer_handler);
|
||||||
|
active_sticky_keys[i].position = ZMK_BHV_STICKY_KEY_POSITION_NOT_USED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init_first_run = false;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct behavior_sticky_key_data {};
|
||||||
|
static struct behavior_sticky_key_data behavior_sticky_key_data;
|
||||||
|
|
||||||
|
#define _TRANSFORM_ENTRY(idx, node) \
|
||||||
|
{ \
|
||||||
|
.behavior_dev = DT_LABEL(DT_INST_PHANDLE_BY_IDX(node, bindings, idx)), \
|
||||||
|
.param1 = COND_CODE_0(DT_INST_PHA_HAS_CELL_AT_IDX(node, bindings, idx, param1), (0), \
|
||||||
|
(DT_INST_PHA_BY_IDX(node, bindings, idx, param1))), \
|
||||||
|
.param2 = COND_CODE_0(DT_INST_PHA_HAS_CELL_AT_IDX(node, bindings, idx, param2), (0), \
|
||||||
|
(DT_INST_PHA_BY_IDX(node, bindings, idx, param2))), \
|
||||||
|
},
|
||||||
|
|
||||||
|
#define KP_INST(n) \
|
||||||
|
static struct behavior_sticky_key_config behavior_sticky_key_config_##n = { \
|
||||||
|
.behavior = _TRANSFORM_ENTRY(0, n).release_after_ms = DT_INST_PROP(n, release_after_ms), \
|
||||||
|
}; \
|
||||||
|
DEVICE_AND_API_INIT(behavior_sticky_key_##n, DT_INST_LABEL(n), behavior_sticky_key_init, \
|
||||||
|
&behavior_sticky_key_data, &behavior_sticky_key_config_##n, APPLICATION, \
|
||||||
|
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_sticky_key_driver_api);
|
||||||
|
|
||||||
|
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
|
||||||
|
|
||||||
|
#endif
|
|
@ -404,6 +404,7 @@ static struct bt_conn_cb conn_callbacks = {
|
||||||
.security_changed = security_changed,
|
.security_changed = security_changed,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) {
|
static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) {
|
||||||
char addr[BT_ADDR_LE_STR_LEN];
|
char addr[BT_ADDR_LE_STR_LEN];
|
||||||
|
|
||||||
|
@ -411,6 +412,7 @@ static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) {
|
||||||
|
|
||||||
LOG_DBG("Passkey for %s: %06u", log_strdup(addr), passkey);
|
LOG_DBG("Passkey for %s: %06u", log_strdup(addr), passkey);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY
|
#ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue