Revert "Merge branch 'main' into main"
This reverts commitba1ab1ab35
, reversing changes made to9134fdcfab
.
This commit is contained in:
parent
ba1ab1ab35
commit
f8a7fee9f6
199 changed files with 1251 additions and 2783 deletions
|
@ -1,13 +1,9 @@
|
|||
FROM zmkfirmware/zephyr-west-action-arm
|
||||
|
||||
ENV LC_ALL=C
|
||||
|
||||
RUN apt-get -y update && \
|
||||
apt-get -y upgrade && \
|
||||
apt-get install --no-install-recommends -y \
|
||||
ssh \
|
||||
nano \
|
||||
locales \
|
||||
gpg && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
"containerEnv": {"WORKSPACE_DIR": "${containerWorkspaceFolder}"},
|
||||
"settings": {
|
||||
"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,18 +1,17 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/workflows/build.yml"
|
||||
- "app/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/build.yml"
|
||||
- "app/**"
|
||||
|
||||
name: Build
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build Test
|
||||
strategy:
|
||||
matrix:
|
||||
board: [proton_c, nice_nano, bluemicro840_v1, nrfmicro_13]
|
||||
|
@ -26,10 +25,6 @@ jobs:
|
|||
- lily58_right
|
||||
- iris_left
|
||||
- iris_right
|
||||
- jorne_left
|
||||
- jorne_right
|
||||
- jian_left
|
||||
- jian_right
|
||||
- reviung41
|
||||
- romac
|
||||
- romac_plus
|
||||
|
@ -47,6 +42,8 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache west modules
|
||||
timeout-minutes: 2
|
||||
continue-on-error: true
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-zephyr-modules
|
||||
|
@ -56,39 +53,37 @@ jobs:
|
|||
tools/
|
||||
zephyr/
|
||||
bootloader/
|
||||
key: 3-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
||||
key: 2-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
||||
restore-keys: |
|
||||
3-${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
3-${{ runner.os }}-build-
|
||||
3-${{ runner.os }}-
|
||||
timeout-minutes: 2
|
||||
continue-on-error: true
|
||||
- name: West init
|
||||
2-${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
2-${{ runner.os }}-build-
|
||||
2-${{ runner.os }}-
|
||||
- name: West Init
|
||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||
id: west-init
|
||||
with:
|
||||
args: 'init "-l app"'
|
||||
- name: West update
|
||||
- name: West Update
|
||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||
id: west-update
|
||||
with:
|
||||
args: "update"
|
||||
- name: West config Zephyr base
|
||||
- name: West Config Zephyr Base
|
||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||
id: west-config
|
||||
with:
|
||||
args: 'config "--global zephyr.base-prefer configfile"'
|
||||
- name: West Zephyr export
|
||||
- name: West Zephyr Export
|
||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||
id: west-zephyr-export
|
||||
with:
|
||||
args: "zephyr-export"
|
||||
- name: West build
|
||||
- name: West Build
|
||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||
id: west-build
|
||||
with:
|
||||
args: 'build "-s app -b ${{ matrix.board }} -- -DSHIELD=${{ matrix.shield }}"'
|
||||
- name: Archive build
|
||||
- name: Archive Build
|
||||
uses: actions/upload-artifact@v2
|
||||
if: ${{ matrix.board != 'proton_c' }}
|
||||
with:
|
||||
|
|
6
.github/workflows/clang-format-lint.yml
vendored
6
.github/workflows/clang-format-lint.yml
vendored
|
@ -1,9 +1,8 @@
|
|||
name: Clang Format
|
||||
name: clang-format-lint
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/workflows/clang-format-lint.yml"
|
||||
- "app/boards/**/*.c"
|
||||
- "app/include/**/*.h"
|
||||
- "app/src/**"
|
||||
|
@ -11,7 +10,6 @@ on:
|
|||
- "app/drivers/**/*.h"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/clang-format-lint.yml"
|
||||
- "app/boards/**/*.c"
|
||||
- "app/include/**/*.h"
|
||||
- "app/src/**"
|
||||
|
@ -21,6 +19,8 @@ on:
|
|||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
name: clang-format lint
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- 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: Docs Checks
|
||||
name: doc-checks
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/workflows/doc-checks.yml"
|
||||
- "docs/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/doc-checks.yml"
|
||||
- "docs/**"
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
name: ESLint
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: bahmutov/npm-install@v1
|
||||
|
@ -24,11 +24,12 @@ jobs:
|
|||
prettier:
|
||||
runs-on: ubuntu-latest
|
||||
name: Prettier
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
working-directory: docs
|
||||
- name: Prettier check
|
||||
- name: Prettier Check
|
||||
run: npm run prettier:check
|
||||
working-directory: docs
|
||||
|
|
33
.github/workflows/test.yml
vendored
33
.github/workflows/test.yml
vendored
|
@ -1,26 +1,27 @@
|
|||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/workflows/test.yml"
|
||||
- "app/tests/**"
|
||||
- "app/src/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/test.yml"
|
||||
- "app/tests/**"
|
||||
- "app/src/**"
|
||||
|
||||
name: Test
|
||||
|
||||
jobs:
|
||||
integration_test:
|
||||
runs-on: ubuntu-latest
|
||||
name: Integration Tests
|
||||
steps:
|
||||
# To use this repository's private action,
|
||||
# you must check out the repository
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache west modules
|
||||
timeout-minutes: 2
|
||||
continue-on-error: true
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-zephyr-modules
|
||||
|
@ -30,40 +31,38 @@ jobs:
|
|||
tools/
|
||||
zephyr/
|
||||
bootloader/
|
||||
key: 3-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
||||
key: 2-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
||||
restore-keys: |
|
||||
3-${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
3-${{ runner.os }}-build-
|
||||
3-${{ runner.os }}-
|
||||
timeout-minutes: 2
|
||||
continue-on-error: true
|
||||
- name: West init
|
||||
2-${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
2-${{ runner.os }}-build-
|
||||
2-${{ runner.os }}-
|
||||
- name: West Init
|
||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||
id: west-init
|
||||
with:
|
||||
args: 'init "-l app"'
|
||||
- name: West update
|
||||
- name: West Update
|
||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||
id: west-update
|
||||
with:
|
||||
args: "update"
|
||||
- name: West config Zephyr base
|
||||
- name: West Config Zephyr Base
|
||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||
id: west-config
|
||||
with:
|
||||
args: 'config "--global zephyr.base-prefer configfile"'
|
||||
- name: West Zephyr export
|
||||
- name: West Zephyr Export
|
||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||
id: west-zephyr-export
|
||||
with:
|
||||
args: "zephyr-export"
|
||||
- name: Test all
|
||||
- name: Test All
|
||||
uses: "docker://zmkfirmware/zephyr-west-action-arm:latest"
|
||||
id: west-build
|
||||
with:
|
||||
entrypoint: /bin/bash
|
||||
args: '-c "west test"'
|
||||
- name: Archive build
|
||||
args: '-c "cd app && ./run-test.sh all"'
|
||||
- name: Archive Build
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,4 +6,3 @@
|
|||
/zmk-config
|
||||
/build
|
||||
*.DS_Store
|
||||
__pycache__
|
3
AUTHORS
3
AUTHORS
|
@ -8,5 +8,4 @@ Okke Formsma (@okke-formsma)
|
|||
Cody McGinnis (@BrainWart)
|
||||
Kurtis Lew (@kurtis-lew)
|
||||
Richard Jones (@bmcgavin)
|
||||
Kevin Chen (@chenkevinh)
|
||||
Joel Spadin (@joelspadin)
|
||||
Kevin Chen (@chenkevinh)
|
|
@ -4,10 +4,11 @@
|
|||
[](https://github.com/zmkfirmware/zmk/actions)
|
||||
[](CODE_OF_CONDUCT.md)
|
||||
|
||||
[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.
|
||||
This project is a complete work in progress, with only basic things functioning. The goal is to explore a new MK firmware
|
||||
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/
|
||||
|
||||
You can also come join our [ZMK Discord Server](https://zmkfirmware.dev/community/discord/invite)
|
||||
|
||||
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.
|
||||
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.
|
||||
|
|
|
@ -30,6 +30,7 @@ target_sources(app PRIVATE src/hid.c)
|
|||
target_sources(app PRIVATE src/sensors.c)
|
||||
target_sources_ifdef(CONFIG_ZMK_DISPLAY app PRIVATE src/display.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(app PRIVATE src/events/position_state_changed.c)
|
||||
target_sources(app PRIVATE src/events/keycode_state_changed.c)
|
||||
|
@ -41,7 +42,6 @@ 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_reset.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_outputs.c)
|
||||
target_sources(app PRIVATE src/behaviors/behavior_toggle_layer.c)
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
mainmenu "ZMK Firmware"
|
||||
|
||||
menu "ZMK"
|
||||
|
@ -187,10 +184,6 @@ if ZMK_RGB_UNDERGLOW
|
|||
config SPI
|
||||
default y
|
||||
|
||||
config ZMK_RGB_UNDERGLOW_EXT_POWER
|
||||
bool "RGB underglow toggling also controls external power"
|
||||
default y
|
||||
|
||||
config ZMK_RGB_UNDERGLOW_HUE_STEP
|
||||
int "RGB underglow hue step in degrees of 360"
|
||||
default 10
|
||||
|
@ -224,7 +217,7 @@ config ZMK_RGB_UNDERGLOW_EFF_START
|
|||
default 0
|
||||
|
||||
config ZMK_RGB_UNDERGLOW_ON_START
|
||||
bool "RGB underglow starts on by default"
|
||||
bool "Whether RGB underglow starts on by default"
|
||||
default y
|
||||
|
||||
#ZMK_RGB_UNDERGLOW
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
rsource "shields/*/Kconfig.shield"
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
|
||||
chosen {
|
||||
zephyr,code-partition = &code_partition;
|
||||
// zephyr,console = &uart0;
|
||||
//zephyr,bt-mon-uart = &uart0;
|
||||
//zephyr,bt-c2h-uart = &uart0;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
};
|
||||
|
@ -26,12 +29,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
ext-power {
|
||||
compatible = "zmk,ext-power-generic";
|
||||
label = "EXT_POWER";
|
||||
control-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
vbatt {
|
||||
compatible = "zmk,battery-voltage-divider";
|
||||
label = "BATTERY";
|
||||
|
@ -46,10 +43,6 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&gpiote {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
@ -68,10 +61,10 @@
|
|||
compatible = "nordic,nrf-uarte";
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
tx-pin = <19>;
|
||||
rx-pin = <21>;
|
||||
rts-pin = <23>;
|
||||
cts-pin = <25>;
|
||||
tx-pin = <39>;
|
||||
rx-pin = <34>;
|
||||
rts-pin = <33>;
|
||||
cts-pin = <12>;
|
||||
};
|
||||
|
||||
&usbd {
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
|
||||
chosen {
|
||||
zephyr,code-partition = &code_partition;
|
||||
// zephyr,console = &uart0;
|
||||
//zephyr,bt-mon-uart = &uart0;
|
||||
//zephyr,bt-c2h-uart = &uart0;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
};
|
||||
|
@ -67,10 +70,10 @@
|
|||
compatible = "nordic,nrf-uarte";
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
tx-pin = <19>;
|
||||
rx-pin = <21>;
|
||||
rts-pin = <23>;
|
||||
cts-pin = <25>;
|
||||
tx-pin = <39>;
|
||||
rx-pin = <34>;
|
||||
rts-pin = <33>;
|
||||
cts-pin = <12>;
|
||||
};
|
||||
|
||||
&usbd {
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
|
||||
chosen {
|
||||
zephyr,code-partition = &code_partition;
|
||||
//zephyr,console = &uart0;
|
||||
//zephyr,bt-mon-uart = &uart0;
|
||||
//zephyr,bt-c2h-uart = &uart0;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
};
|
||||
|
@ -34,14 +37,6 @@
|
|||
|
||||
};
|
||||
|
||||
&adc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpiote {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
@ -51,13 +46,13 @@
|
|||
};
|
||||
|
||||
&uart0 {
|
||||
compatible = "nordic,nrf-uarte";
|
||||
compatible = "nordic,nrf-uart";
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
tx-pin = <19>;
|
||||
rx-pin = <21>;
|
||||
rts-pin = <23>;
|
||||
cts-pin = <25>;
|
||||
tx-pin = <16>;
|
||||
rx-pin = <15>;
|
||||
rts-pin = <14>;
|
||||
cts-pin = <13>;
|
||||
};
|
||||
|
||||
&usbd {
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
&gpiote {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
@ -55,10 +51,10 @@
|
|||
compatible = "nordic,nrf-uarte";
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
tx-pin = <19>;
|
||||
rx-pin = <21>;
|
||||
rts-pin = <23>;
|
||||
cts-pin = <25>;
|
||||
tx-pin = <39>;
|
||||
rx-pin = <34>;
|
||||
rts-pin = <33>;
|
||||
cts-pin = <12>;
|
||||
};
|
||||
|
||||
&usbd {
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
&gpiote {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
@ -55,10 +51,10 @@
|
|||
compatible = "nordic,nrf-uarte";
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
tx-pin = <19>;
|
||||
rx-pin = <21>;
|
||||
rts-pin = <23>;
|
||||
cts-pin = <25>;
|
||||
tx-pin = <39>;
|
||||
rx-pin = <34>;
|
||||
rts-pin = <33>;
|
||||
cts-pin = <12>;
|
||||
};
|
||||
|
||||
&usbd {
|
||||
|
|
|
@ -45,10 +45,6 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&gpiote {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
@ -67,10 +63,10 @@
|
|||
compatible = "nordic,nrf-uarte";
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
tx-pin = <19>;
|
||||
rx-pin = <21>;
|
||||
rts-pin = <23>;
|
||||
cts-pin = <25>;
|
||||
tx-pin = <39>;
|
||||
rx-pin = <34>;
|
||||
rts-pin = <33>;
|
||||
cts-pin = <12>;
|
||||
};
|
||||
|
||||
&usbd {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
&spi1 {
|
||||
compatible = "nordic,nrf-spim";
|
||||
compatible = "nordic,nrf-spi";
|
||||
/* Cannot be used together with i2c0. */
|
||||
status = "okay";
|
||||
mosi-pin = <6>;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Uncomment the following lines to enable the Corne RGB Underglow
|
||||
# CONFIG_ZMK_RGB_UNDERGLOW=y
|
||||
# ZMK_RGB_UNDERGLOW=y
|
||||
# CONFIG_WS2812_STRIP=y
|
||||
|
||||
# Uncomment the following line to enable the Corne OLED Display
|
||||
|
|
|
@ -58,6 +58,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
|
|||
|
||||
};
|
||||
|
||||
bt_unpair_combo: bt_unpair_combo {
|
||||
compatible = "zmk,bt-unpair-combo";
|
||||
};
|
||||
|
||||
// TODO: per-key RGB node(s)?
|
||||
};
|
||||
|
||||
|
|
|
@ -16,3 +16,7 @@
|
|||
, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
|
||||
;
|
||||
};
|
||||
|
||||
&bt_unpair_combo {
|
||||
key-positions = <0 38>;
|
||||
};
|
||||
|
|
|
@ -20,3 +20,7 @@
|
|||
, <&pro_micro_a 3 GPIO_ACTIVE_HIGH>
|
||||
;
|
||||
};
|
||||
|
||||
&bt_unpair_combo {
|
||||
key-positions = <11 39>;
|
||||
};
|
||||
|
|
|
@ -44,4 +44,8 @@ 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,3 +16,7 @@
|
|||
, <&pro_micro_d 10 GPIO_ACTIVE_HIGH>
|
||||
;
|
||||
};
|
||||
|
||||
&bt_unpair_combo {
|
||||
key-positions = <0 42>;
|
||||
};
|
||||
|
|
|
@ -20,3 +20,7 @@
|
|||
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||
;
|
||||
};
|
||||
|
||||
&bt_unpair_combo {
|
||||
key-positions = <11 43>;
|
||||
};
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
|
||||
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
|
|
@ -1,8 +0,0 @@
|
|||
# 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)
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
* 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)>
|
||||
;
|
||||
|
||||
};
|
||||
};
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* 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
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
|
@ -1,2 +0,0 @@
|
|||
CONFIG_ZMK_SPLIT=y
|
||||
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* 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>
|
||||
;
|
||||
};
|
|
@ -1,2 +0,0 @@
|
|||
CONFIG_ZMK_SPLIT=y
|
||||
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* 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>
|
||||
;
|
||||
};
|
|
@ -1,58 +0,0 @@
|
|||
|
||||
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
|
|
@ -1,8 +0,0 @@
|
|||
# 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)
|
|
@ -1,29 +0,0 @@
|
|||
&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;
|
||||
};
|
||||
};
|
|
@ -1,6 +0,0 @@
|
|||
# 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
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* 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>;
|
||||
};
|
||||
};
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* 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
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
|
@ -1,2 +0,0 @@
|
|||
CONFIG_ZMK_SPLIT=y
|
||||
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* 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>
|
||||
;
|
||||
};
|
|
@ -1,2 +0,0 @@
|
|||
CONFIG_ZMK_SPLIT=y
|
||||
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* 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 {
|
||||
compatible = "nordic,nrf-spim";
|
||||
compatible = "nordic,nrf-spi";
|
||||
status = "okay";
|
||||
mosi-pin = <6>;
|
||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
&spi1 {
|
||||
compatible = "nordic,nrf-spim";
|
||||
compatible = "nordic,nrf-spi";
|
||||
status = "okay";
|
||||
mosi-pin = <6>;
|
||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
&spi1 {
|
||||
compatible = "nordic,nrf-spim";
|
||||
compatible = "nordic,nrf-spi";
|
||||
status = "okay";
|
||||
mosi-pin = <6>;
|
||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
&spi1 {
|
||||
compatible = "nordic,nrf-spim";
|
||||
compatible = "nordic,nrf-spi";
|
||||
status = "okay";
|
||||
mosi-pin = <6>;
|
||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||
|
|
|
@ -81,6 +81,10 @@ 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>;
|
||||
};
|
||||
|
||||
bt_unpair_combo: bt_unpair_combo {
|
||||
compatible = "zmk,bt-unpair-combo";
|
||||
};
|
||||
|
||||
// TODO: RGB node(s)
|
||||
};
|
||||
|
||||
|
|
|
@ -22,3 +22,7 @@
|
|||
&left_encoder {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&bt_unpair_combo {
|
||||
key-positions = <0 44>;
|
||||
};
|
|
@ -27,3 +27,7 @@
|
|||
&right_encoder {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&bt_unpair_combo {
|
||||
key-positions = <11 45>;
|
||||
};
|
|
@ -57,6 +57,10 @@ 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";
|
||||
sensors = <&left_encoder>;
|
||||
};
|
||||
|
||||
bt_unpair_combo: bt_unpair_combo {
|
||||
compatible = "zmk,bt-unpair-combo";
|
||||
};
|
||||
};
|
||||
|
||||
&pro_micro_i2c {
|
||||
|
|
|
@ -20,3 +20,7 @@
|
|||
&left_encoder {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&bt_unpair_combo {
|
||||
key-positions = <0 53>;
|
||||
};
|
||||
|
|
|
@ -20,3 +20,7 @@
|
|||
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||
;
|
||||
};
|
||||
|
||||
&bt_unpair_combo {
|
||||
key-positions = <11 54>;
|
||||
};
|
||||
|
|
|
@ -56,5 +56,11 @@ 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)
|
||||
>;
|
||||
};
|
||||
|
||||
bt_unpair_combo: bt_unpair_combo {
|
||||
compatible = "zmk,bt-unpair-combo";
|
||||
key-positions = <0 53>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
&spi1 {
|
||||
compatible = "nordic,nrf-spim";
|
||||
compatible = "nordic,nrf-spi";
|
||||
/* Cannot be used together with i2c0. */
|
||||
status = "okay";
|
||||
mosi-pin = <6>;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Uncomment the following lines to enable the Microdox RGB Underglow
|
||||
# CONFIG_ZMK_RGB_UNDERGLOW=y
|
||||
# Uncomment the following lines to enable the Corne RGB Underglow
|
||||
# ZMK_RGB_UNDERGLOW=y
|
||||
# CONFIG_WS2812_STRIP=y
|
||||
|
||||
# Uncomment the following line to enable the Microdox OLED Display
|
||||
# Uncomment the following line to enable the Corne OLED Display
|
||||
# CONFIG_ZMK_DISPLAY=y
|
||||
|
|
|
@ -31,27 +31,27 @@
|
|||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
|
||||
&hm LGUI A &hm LALT S &hm LCTL D &hm LSFT F &kp G &kp H &hm RSFT J &hm RCTL K &hm RALT L &hm RGUI RET
|
||||
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT
|
||||
&kp LSFT &kp LGUI &kp LALT < NAV RET < NUM_SYM SPC &kp COLN &kp QUOT &kp FSLH
|
||||
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
|
||||
&hm LGUI A &hm LALT S &hm LCTL D &hm LSFT F &kp G &kp H &hm RSFT J &hm RCTL K &hm RALT L &hm RGUI RET
|
||||
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT
|
||||
&kp LSFT &kp LGUI &kp LALT < NAV RET < NUM_SYM SPC &kp COLN &kp QUOT &kp FSLH
|
||||
>;
|
||||
};
|
||||
num_sym {
|
||||
bindings = <
|
||||
&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
|
||||
&kp DEL &none &none &none &none &none &none &none &kp DOT
|
||||
&bootloader &reset &none &trans &trans &kp RET &trans &kp FSLH
|
||||
&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
|
||||
&trans &trans &trans &trans &trans &trans &trans &trans &kp EQL &kp MINUS
|
||||
&kp DEL &none &none &none &none &none &none &none &kp DOT
|
||||
&bootloader &reset &none &trans &trans &kp RET &trans &kp FSLH
|
||||
>;
|
||||
};
|
||||
|
||||
nav {
|
||||
bindings = <
|
||||
&bt BT_CLR &bt BT_NXT &bt BT_PRV &none &none &none &none &kp UARW &none &kp BKSP
|
||||
&trans &trans &trans &trans &none &none &kp LARW &kp DARW &kp RARW &none
|
||||
&none &none &none &none &none &none &none &none &none
|
||||
&none &none &none &trans &trans &kp RET &trans &kp FSLH
|
||||
&bt BT_CLR &bt BT_NXT &bt BT_PRV &none &none &none &none &kp UARW &none &kp BKSP
|
||||
&trans &trans &trans &trans &none &none &kp LARW &kp DARW &kp RARW &none
|
||||
&none &none &none &none &none &none &none &none &none
|
||||
&none &none &none &trans &trans &kp RET &trans &kp FSLH
|
||||
>;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
&spi1 {
|
||||
compatible = "nordic,nrf-spim";
|
||||
compatible = "nordic,nrf-spi";
|
||||
status = "okay";
|
||||
mosi-pin = <6>;
|
||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||
|
|
|
@ -30,5 +30,11 @@
|
|||
;
|
||||
|
||||
};
|
||||
|
||||
bt_unpair_combo: bt_unpair_combo {
|
||||
compatible = "zmk,bt-unpair-combo";
|
||||
key-positions = <0 11>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
&spi1 {
|
||||
compatible = "nordic,nrf-spim";
|
||||
compatible = "nordic,nrf-spi";
|
||||
status = "okay";
|
||||
mosi-pin = <6>;
|
||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||
|
|
|
@ -66,6 +66,10 @@ 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";
|
||||
sensors = <&left_encoder &right_encoder>;
|
||||
};
|
||||
|
||||
bt_unpair_combo: bt_unpair_combo {
|
||||
compatible = "zmk,bt-unpair-combo";
|
||||
};
|
||||
};
|
||||
|
||||
&pro_micro_i2c {
|
||||
|
|
|
@ -20,3 +20,7 @@
|
|||
&left_encoder {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&bt_unpair_combo {
|
||||
key-positions = <0 54>;
|
||||
};
|
||||
|
|
|
@ -24,3 +24,7 @@
|
|||
&right_encoder {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&bt_unpair_combo {
|
||||
key-positions = <11 55>;
|
||||
};
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
# * single overlay,
|
||||
# * or per board/shield.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
get_property(cached_user_config_value CACHE ZMK_CONFIG PROPERTY VALUE)
|
||||
|
||||
set(user_config_cli_argument ${cached_user_config_value}) # Either new or old
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
config ZMK_KSCAN_GPIO_DRIVER
|
||||
bool "Enable GPIO kscan driver to simulate key presses"
|
||||
default y
|
||||
|
|
|
@ -205,8 +205,8 @@ static const struct bvd_config bvd_cfg = {
|
|||
.power_gpios =
|
||||
{
|
||||
DT_INST_GPIO_LABEL(0, power_gpios),
|
||||
DT_INST_GPIO_PIN(0, power_gpios),
|
||||
DT_INST_GPIO_FLAGS(0, power_gpios),
|
||||
DT_INST_PIN(0, power_gpios),
|
||||
DT_INST_FLAGS(0, power_gpios),
|
||||
},
|
||||
#endif
|
||||
.output_ohm = DT_INST_PROP(0, output_ohms),
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <behaviors/none.dtsi>
|
||||
#include <behaviors/mod_tap.dtsi>
|
||||
#include <behaviors/layer_tap.dtsi>
|
||||
#include <behaviors/sticky_key.dtsi>
|
||||
#include <behaviors/momentary_layer.dtsi>
|
||||
#include <behaviors/toggle_layer.dtsi>
|
||||
#include <behaviors/reset.dtsi>
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
bt: behavior_bluetooth {
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
ext_power: behavior_ext_power {
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <dt-bindings/zmk/hid_usage_pages.h>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
lt: behavior_layer_tap {
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
mt: behavior_mod_tap {
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
mo: behavior_momentary_layer {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
* Copyright (c) 2020 Pete Johanson
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
out: behavior_outputs {
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <dt-bindings/zmk/reset.h>
|
||||
|
||||
/ {
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
rgb_ug: behavior_rgb_underglow {
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <dt-bindings/zmk/hid_usage_pages.h>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* 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,9 +1,3 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
trans: behavior_transparent {
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
# 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
|
12
app/dts/bindings/zmk,bt-unpair-combo.yaml
Normal file
12
app/dts/bindings/zmk,bt-unpair-combo.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
# 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,
|
||||
struct zmk_behavior_binding_event event);
|
||||
typedef int (*behavior_sensor_keymap_binding_callback_t)(struct zmk_behavior_binding *binding,
|
||||
struct device *sensor, s64_t timestamp);
|
||||
struct device *sensor);
|
||||
|
||||
__subsystem struct behavior_driver_api {
|
||||
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.
|
||||
*/
|
||||
__syscall int behavior_sensor_keymap_binding_triggered(struct zmk_behavior_binding *binding,
|
||||
struct device *sensor, s64_t timestamp);
|
||||
struct device *sensor);
|
||||
|
||||
static inline int
|
||||
z_impl_behavior_sensor_keymap_binding_triggered(struct zmk_behavior_binding *binding,
|
||||
struct device *sensor, s64_t timestamp) {
|
||||
struct device *sensor) {
|
||||
struct device *dev = device_get_binding(binding->behavior_dev);
|
||||
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 api->sensor_binding_triggered(binding, sensor, timestamp);
|
||||
return api->sensor_binding_triggered(binding, sensor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define HID_USAGE(page, id) ((page << 16) | id)
|
||||
#define HID_USAGE_ID(usage) (usage & 0xFFFF)
|
||||
#define HID_USAGE_PAGE(usage) (usage >> 16)
|
||||
#define HID_EXT_USAGE(page, id) ((page << 16) | id)
|
||||
#define HID_EXT_USAGE_ID(ext) (ext & 0xFFFF)
|
||||
#define HID_EXT_USAGE_PAGE(ext) (ext >> 16)
|
||||
|
||||
/* WARNING: DEPRECATED from dt-bindings/zmk/keys.h */
|
||||
#define USAGE_KEYPAD (0x07) // WARNING: DEPRECATED (DO NOT USE)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,15 +18,14 @@ struct keycode_state_changed {
|
|||
u32_t keycode;
|
||||
u8_t implicit_modifiers;
|
||||
bool state;
|
||||
s64_t timestamp;
|
||||
};
|
||||
|
||||
ZMK_EVENT_DECLARE(keycode_state_changed);
|
||||
|
||||
static inline struct keycode_state_changed *
|
||||
keycode_state_changed_from_encoded(u32_t encoded, bool pressed, s64_t timestamp) {
|
||||
u16_t page = HID_USAGE_PAGE(encoded) & 0xFF;
|
||||
u16_t id = HID_USAGE_ID(encoded);
|
||||
static inline struct keycode_state_changed *keycode_state_changed_from_encoded(u32_t encoded,
|
||||
bool pressed) {
|
||||
u16_t page = HID_EXT_USAGE_PAGE(encoded) & 0xFF;
|
||||
u16_t id = HID_EXT_USAGE_ID(encoded);
|
||||
zmk_mod_flags implicit_mods = SELECT_MODS(encoded);
|
||||
|
||||
if (!page) {
|
||||
|
@ -38,6 +37,5 @@ keycode_state_changed_from_encoded(u32_t encoded, bool pressed, s64_t timestamp)
|
|||
ev->keycode = id;
|
||||
ev->implicit_modifiers = implicit_mods;
|
||||
ev->state = pressed;
|
||||
ev->timestamp = timestamp;
|
||||
return ev;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ struct sensor_event {
|
|||
struct zmk_event_header header;
|
||||
u8_t sensor_number;
|
||||
struct device *sensor;
|
||||
s64_t timestamp;
|
||||
};
|
||||
|
||||
ZMK_EVENT_DECLARE(sensor_event);
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#define COLLECTION_REPORT 0x03
|
||||
|
||||
#define ZMK_HID_KEYBOARD_NKRO_SIZE 6
|
||||
#define ZMK_HID_KEYPAD_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,
|
||||
/* USAGE_MINIMUM (Keyboard LeftControl) */
|
||||
HID_LI_USAGE_MIN(1),
|
||||
HID_USAGE_KEY_KEYBOARD_LEFTCONTROL,
|
||||
0xE0,
|
||||
/* USAGE_MAXIMUM (Keyboard Right GUI) */
|
||||
HID_LI_USAGE_MAX(1),
|
||||
HID_USAGE_KEY_KEYBOARD_RIGHT_GUI,
|
||||
0xE7,
|
||||
/* LOGICAL_MINIMUM (0) */
|
||||
HID_GI_LOGICAL_MIN(1),
|
||||
0x00,
|
||||
|
@ -89,9 +89,9 @@ static const u8_t zmk_hid_report_desc[] = {
|
|||
/* REPORT_SIZE (1) */
|
||||
HID_GI_REPORT_SIZE,
|
||||
0x08,
|
||||
/* REPORT_COUNT (ZMK_HID_KEYBOARD_NKRO_SIZE) */
|
||||
/* REPORT_COUNT (ZMK_HID_KEYPAD_NKRO_SIZE) */
|
||||
HID_GI_REPORT_COUNT,
|
||||
ZMK_HID_KEYBOARD_NKRO_SIZE,
|
||||
ZMK_HID_KEYPAD_NKRO_SIZE,
|
||||
/* INPUT (Data,Ary,Abs) */
|
||||
HID_MI_INPUT,
|
||||
0x00,
|
||||
|
@ -146,15 +146,15 @@ static const u8_t zmk_hid_report_desc[] = {
|
|||
// u8_t keys[6];
|
||||
// } __packed;
|
||||
|
||||
struct zmk_hid_keyboard_report_body {
|
||||
struct zmk_hid_keypad_report_body {
|
||||
zmk_mod_flags modifiers;
|
||||
u8_t _reserved;
|
||||
u8_t keys[ZMK_HID_KEYBOARD_NKRO_SIZE];
|
||||
u8_t keys[ZMK_HID_KEYPAD_NKRO_SIZE];
|
||||
} __packed;
|
||||
|
||||
struct zmk_hid_keyboard_report {
|
||||
struct zmk_hid_keypad_report {
|
||||
u8_t report_id;
|
||||
struct zmk_hid_keyboard_report_body body;
|
||||
struct zmk_hid_keypad_report_body body;
|
||||
} __packed;
|
||||
|
||||
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_implicit_modifiers_press(zmk_mod_flags implicit_modifiers);
|
||||
int zmk_hid_implicit_modifiers_release();
|
||||
int zmk_hid_keyboard_press(zmk_key key);
|
||||
int zmk_hid_keyboard_release(zmk_key key);
|
||||
void zmk_hid_keyboard_clear();
|
||||
int zmk_hid_keypad_press(zmk_key key);
|
||||
int zmk_hid_keypad_release(zmk_key key);
|
||||
void zmk_hid_keypad_clear();
|
||||
|
||||
int zmk_hid_consumer_press(zmk_key key);
|
||||
int zmk_hid_consumer_release(zmk_key key);
|
||||
void zmk_hid_consumer_clear();
|
||||
|
||||
struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report();
|
||||
struct zmk_hid_keypad_report *zmk_hid_get_keypad_report();
|
||||
struct zmk_hid_consumer_report *zmk_hid_get_consumer_report();
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
|
||||
int zmk_hog_init();
|
||||
|
||||
int zmk_hog_send_keyboard_report(struct zmk_hid_keyboard_report_body *body);
|
||||
int zmk_hog_send_keypad_report(struct zmk_hid_keypad_report_body *body);
|
||||
int zmk_hog_send_consumer_report(struct zmk_hid_consumer_report_body *body);
|
||||
|
|
|
@ -4,27 +4,19 @@
|
|||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ./run-test.sh <path to testcase>"
|
||||
exit 1
|
||||
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
|
||||
elif [ "$1" = "all" ]; then
|
||||
echo "" > ./build/tests/pass-fail.log
|
||||
echo "$testcases" | xargs -l -P 4 ./run-test.sh
|
||||
find tests -name native_posix.keymap -exec dirname \{\} \; | xargs -l -P 4 ./run-test.sh
|
||||
err=$?
|
||||
sort -k2 ./build/tests/pass-fail.log
|
||||
exit $err
|
||||
fi
|
||||
|
||||
testcase="$path"
|
||||
testcase="$1"
|
||||
echo "Running $testcase:"
|
||||
|
||||
west build -d build/$testcase -b native_posix -- -DZMK_CONFIG=$testcase > /dev/null 2>&1
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
# 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
|
|
@ -1,33 +0,0 @@
|
|||
# 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,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
LOG_DBG("position %d keycode 0x%02X", event.position, binding->param1);
|
||||
return ZMK_EVENT_RAISE(
|
||||
keycode_state_changed_from_encoded(binding->param1, true, event.timestamp));
|
||||
|
||||
return ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(binding->param1, true));
|
||||
}
|
||||
|
||||
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
LOG_DBG("position %d keycode 0x%02X", event.position, binding->param1);
|
||||
return ZMK_EVENT_RAISE(
|
||||
keycode_state_changed_from_encoded(binding->param1, false, event.timestamp));
|
||||
|
||||
return ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(binding->param1, false));
|
||||
}
|
||||
|
||||
static const struct behavior_driver_api behavior_key_press_driver_api = {
|
||||
|
|
|
@ -48,14 +48,8 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
|||
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 = {
|
||||
.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,
|
||||
|
|
|
@ -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 on_sensor_binding_triggered(struct zmk_behavior_binding *binding, struct device *sensor,
|
||||
s64_t timestamp) {
|
||||
static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding,
|
||||
struct device *sensor) {
|
||||
struct sensor_value value;
|
||||
int err;
|
||||
u32_t keycode;
|
||||
|
@ -45,12 +45,12 @@ static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding, str
|
|||
|
||||
LOG_DBG("SEND %d", keycode);
|
||||
|
||||
ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(keycode, true, timestamp));
|
||||
ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(keycode, true));
|
||||
|
||||
// TODO: Better way to do this?
|
||||
k_msleep(5);
|
||||
|
||||
return ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(keycode, false, timestamp));
|
||||
return ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(keycode, false));
|
||||
}
|
||||
|
||||
static const struct behavior_driver_api behavior_sensor_rotate_key_press_driver_api = {
|
||||
|
|
|
@ -1,274 +0,0 @@
|
|||
/*
|
||||
* 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,7 +404,6 @@ static struct bt_conn_cb conn_callbacks = {
|
|||
.security_changed = security_changed,
|
||||
};
|
||||
|
||||
/*
|
||||
static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) {
|
||||
char addr[BT_ADDR_LE_STR_LEN];
|
||||
|
||||
|
@ -412,7 +411,6 @@ static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) {
|
|||
|
||||
LOG_DBG("Passkey for %s: %06u", log_strdup(addr), passkey);
|
||||
}
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY
|
||||
|
||||
|
|
76
app/src/ble_unpair_combo.c
Normal file
76
app/src/ble_unpair_combo.c
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <device.h>
|
||||
#include <init.h>
|
||||
|
||||
#define DT_DRV_COMPAT zmk_bt_unpair_combo
|
||||
|
||||
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
|
||||
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
#include <zmk/ble.h>
|
||||
#include <zmk/event-manager.h>
|
||||
#include <zmk/events/position-state-changed.h>
|
||||
|
||||
static u8_t combo_state;
|
||||
|
||||
const u32_t key_positions[] = DT_INST_PROP(0, key_positions);
|
||||
#define KP_LEN DT_INST_PROP_LEN(0, key_positions)
|
||||
|
||||
int index_for_key_position(u32_t kp) {
|
||||
for (int i = 0; i < KP_LEN; i++) {
|
||||
if (key_positions[i] == kp) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int unpair_combo_listener(const struct zmk_event_header *eh) {
|
||||
if (is_position_state_changed(eh)) {
|
||||
const struct position_state_changed *psc = cast_position_state_changed(eh);
|
||||
|
||||
int kp_index = index_for_key_position(psc->position);
|
||||
if (kp_index < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE_BIT(combo_state, kp_index, psc->state);
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
void unpair_combo_work_handler(struct k_work *work) {
|
||||
for (int i = 0; i < KP_LEN; i++) {
|
||||
if (!(combo_state & BIT(i))) {
|
||||
LOG_DBG("Key position %d not held, skipping unpair combo", key_positions[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
zmk_ble_unpair_all();
|
||||
};
|
||||
|
||||
struct k_delayed_work unpair_combo_work;
|
||||
|
||||
int zmk_ble_unpair_combo_init(struct device *_unused) {
|
||||
k_delayed_work_init(&unpair_combo_work, unpair_combo_work_handler);
|
||||
k_delayed_work_submit(&unpair_combo_work, K_SECONDS(2));
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
ZMK_LISTENER(zmk_ble_unpair_combo, unpair_combo_listener);
|
||||
ZMK_SUBSCRIPTION(zmk_ble_unpair_combo, position_state_changed);
|
||||
|
||||
SYS_INIT(zmk_ble_unpair_combo_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
|
||||
|
||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue