Merge branch 'main' into settings-reset-bootloader

This commit is contained in:
ReFil 2023-05-30 18:17:02 +01:00
commit 7c29c35915
74 changed files with 3728 additions and 1616 deletions

View file

@ -39,8 +39,8 @@ jobs:
- name: Fetch Build Matrix
run: |
echo "build_matrix=$(yaml2json ${{ inputs.build_matrix_path }} | jq -c .)" >> $GITHUB_ENV
yaml2json ${{ inputs.build_matrix_path }} | jq
echo "build_matrix=$(yaml2json '${{ inputs.build_matrix_path }}' | jq -c .)" >> $GITHUB_ENV
yaml2json "${{ inputs.build_matrix_path }}" | jq
build:
runs-on: ubuntu-latest
@ -54,18 +54,13 @@ jobs:
steps:
- name: Prepare variables
shell: sh -x {0}
env:
shield: ${{ matrix.shield }}
run: |
if [ -n "${{ matrix.shield }}" ]
then
echo "extra_cmake_args=-DSHIELD=\"${{ matrix.shield }}\"" >> $GITHUB_ENV
echo "artifact_name=${{ matrix.shield }}-${{ matrix.board }}-zmk" >> $GITHUB_ENV
echo "display_name=${{ matrix.shield }} - ${{ matrix.board }}" >> $GITHUB_ENV
else
echo "extra_cmake_args=" >> $GITHUB_ENV
echo "artifact_name=${{ matrix.board }}-zmk" >> $GITHUB_ENV
echo "display_name=${{ matrix.board }}" >> $GITHUB_ENV
fi
echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
echo "extra_cmake_args=${shield:+-DSHIELD=\"$shield\"}" >> $GITHUB_ENV
echo "display_name=${shield:+$shield - }${{ matrix.board }}" >> $GITHUB_ENV
echo "artifact_name=${shield:+$shield-}${{ matrix.board }}-zmk" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
@ -89,7 +84,7 @@ jobs:
${{ runner.os }}-
- name: West Init
run: west init -l ${{ inputs.config_path }}
run: west init -l "${{ inputs.config_path }}"
- name: West Update
run: west update
@ -99,7 +94,7 @@ jobs:
- name: West Build (${{ env.display_name }})
shell: sh -x {0}
run: west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
run: west build -s zmk/app -b "${{ matrix.board }}" -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/${{ inputs.config_path }}" ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
- name: ${{ env.display_name }} Kconfig file
run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort
@ -113,7 +108,7 @@ jobs:
cp build/zephyr/zmk.uf2 "build/artifacts/${{ env.artifact_name }}.uf2"
elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ]
then
cp build/zephyr/zmk.${{ inputs.fallback_binary }} "build/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}"
cp "build/zephyr/zmk.${{ inputs.fallback_binary }}" "build/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}"
fi
- name: Archive (${{ env.display_name }})

9
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,9 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"ms-python.python",
"ms-vscode.cpptools",
"plorefice.devicetree",
"twxs.cmake"
]
}

17
.vscode/settings.json vendored
View file

@ -3,5 +3,20 @@
"*.overlay": "dts",
"*.keymap": "dts"
},
"python.formatting.provider": "black"
"python.formatting.provider": "black",
"[c]": {
"editor.formatOnSave": true
},
"[javascript][javascriptreact][typescript][typescriptreact]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-python.python"
},
"[css][json][jsonc][html][markdown][yaml]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

View file

@ -63,7 +63,7 @@
};
&i2c0 {
compatible = "nordic,nrf-twim";
compatible = "nordic,nrf-twi";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
@ -71,6 +71,7 @@
&uart0 {
compatible = "nordic,nrf-uarte";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";

View file

@ -0,0 +1,8 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on BOARD_BT60_V2 || BOARD_BT65_V1 || BOARD_BT75_V1

View file

@ -0,0 +1,16 @@
# CKP boards configuration
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
config BOARD_BT60_V2
bool "bt60_v2"
depends on SOC_NRF52840_QIAA
config BOARD_BT65_V1
bool "bt65_v1"
depends on SOC_NRF52840_QIAA
config BOARD_BT75_V1
bool "bt75_v1"
depends on SOC_NRF52840_QIAA

View file

@ -0,0 +1,34 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
config BOARD
default "bt60_v2" if BOARD_BT60_V2
default "bt65_v1" if BOARD_BT65_V1
default "bt75_v1" if BOARD_BT75_V1
config ZMK_KEYBOARD_NAME
default "BT60 V2" if BOARD_BT60_V2
default "BT65" if BOARD_BT65_V1
default "BT75" if BOARD_BT75_V1
if BOARD_BT60_V2 || BOARD_BT65_V1 || BOARD_BT75_V1
if USB
config USB_NRFX
default y
config USB_DEVICE_STACK
default y
endif # USB
config BT_CTLR
default BT
config ZMK_BLE
default y
config ZMK_USB
default y
endif # BOARD_BT60_V2 || BOARD_BT65_V1 || BOARD_BT75_V1

View file

@ -0,0 +1,4 @@
# SPDX-License-Identifier: MIT
board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include "ckp.dtsi"
/ {
model = "BT60_V2";
compatible = "polarityworks,bt60_v2";
chosen {
zmk,matrix_transform = &ansi_transform;
};
ansi_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <15>;
rows = <5>;
map = <
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(1,12) RC(1,13)
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(2,12) RC(2,13)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13)
RC(4,0) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,10) RC(5,11) RC(5,12) RC(5,13)
>;
};
iso_transform: keymap_transform_1 {
compatible = "zmk,matrix-transform";
columns = <15>;
rows = <5>;
map = <
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(1,12) RC(1,13)
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(2,12)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,12) RC(3,13)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,10) RC(5,11) RC(5,12) RC(5,13)
>;
};
all_1u_transform: keymap_transform_2 {
compatible = "zmk,matrix-transform";
columns = <15>;
rows = <5>;
map = <
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(1,12) RC(1,13) RC(1,14)
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(2,12) RC(2,13)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,13) RC(4,14)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,10) RC(5,11) RC(5,12) RC(5,13) RC(5,14)
>;
};
hhkb_transform: keymap_transform_3 {
compatible = "zmk,matrix-transform";
columns = <15>;
rows = <5>;
map = <
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(1,12) RC(1,13)
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(2,12) RC(2,13)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13)
RC(4,0) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,11) RC(5,12) RC(5,13)
>;
};
};

View file

@ -0,0 +1,177 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/rgb.h>
#include <dt-bindings/zmk/backlight.h>
#define ANSI
//#define ISO
//#define ALL_1U
//#define HHKB
/ {
chosen {
#ifdef ANSI
zmk,matrix_transform = &ansi_transform;
#elif defined(ISO)
zmk,matrix_transform = &iso_transform;
#elif defined(ALL_1U)
zmk,matrix_transform = &all_1u_transform;
#elif defined(HHKB)
zmk,matrix_transform = &hhkb_transform;
#else
#error "Layout not defined, please define a layout by uncommenting the appropriate line in bt60_v2.keymap"
#endif
};
keymap {
compatible = "zmk,keymap";
#ifdef ANSI
default_layer {
// ------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER |
// | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT |
// | CTL | WIN | ALT | SPACE | ALT | 1 | MENU | CTRL |
// ------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH
&kp CAPS &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp K_CMENU &kp RCTRL
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// ------------------------------------------------------------------------------------------
// |GRAVE| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL |
// | TAB | Q | UP | E | HUI | HUD | Y | U | INS | O |PSCRN| SLCK| P_B | RGB_TOG|
// | CAPS | LEFT| DOWN|RIGHT| BRI | BRD | H | J | K | L | HOME| PGUP| BOOT |
// | SHIFT |VOLDN|VOLUP| MUTE|BLINC|BLDEC| N | M | , | END | PGDN | BL_TOG |
// | BT_PRV| BT_NXT| ALT | SPACE | ALT | 1 | RESET | BT_CLR |
// ------------------------------------------------------------------------------------------
bindings = <
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp DEL
&trans &trans &kp UP &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &kp INS &trans &kp PSCRN &kp SLCK &kp PAUSE_BREAK &rgb_ug RGB_TOG
&trans &kp LEFT &kp DOWN &kp RIGHT &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &kp HOME &kp PG_UP &bootloader
&trans &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &kp END &kp PG_DN &bl BL_TOG
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &sys_reset &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#elif defined(ISO)
default_layer {
// ------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | # | ENTER |
// | SHIFT | \ | Z | X | C | V | B | N | M | , | . | / | SHIFT |
// | CTL | WIN | ALT | SPACE | ALT | 1 | MENU | CTRL |
// ------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT
&kp CAPS &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp NON_US_HASH &kp RET
&kp LSHFT &kp NON_US_BSLH &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp K_CMENU &kp RCTRL
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// ------------------------------------------------------------------------------------------
// |GRAVE| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL |
// | TAB | Q | UP | E | HUI | HUD | Y | U | INS | O |PSCRN| SLCK| P_B | |
// | CAPS | LEFT| DOWN|RIGHT| BRI | BRD | H | J | K | L | HOME| PGUP|RGB_TOG| BOOT |
// | SHIFT |VOLDN|VOLUP| MUTE|BLINC|BLDEC| B | N | M | , | END | PGDN | BL_TOG |
// | BT_PRV| BT_NXT| ALT | SPACE | ALT | 1 | RESET |BT_CLR |
// ------------------------------------------------------------------------------------------
bindings = <
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp DEL
&trans &trans &kp UP &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &kp INS &trans &kp PSCRN &kp SLCK &kp PAUSE_BREAK
&trans &kp LEFT &kp DOWN &kp RIGHT &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &kp HOME &kp PG_UP &rgb_ug RGB_TOG &bootloader
&trans &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &trans &kp END &kp PG_DN &bl BL_TOG
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &sys_reset &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#elif defined(ALL_1U)
default_layer {
// ------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BKSP | DEL |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER |
// | SHFT |NONE| Z | X | C | V | B | N | M | , | . | / | SHFT | UP | 1 |
// | CTL | WIN | ALT | SPACE | RALT| CTRL | LEFT | DOWN | RIGHT |
// ------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &kp DEL
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET
&kp LSHFT &none &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp UP &mo 1
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// ------------------------------------------------------------------------------------------
// |GRAVE| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |BKSP | DEL |
// | TAB | Q | W | E | HUI | HUD | Y | U | INS | O |PSCRN| SLCK| P_B | RGB_TOG |
// | CAPS | A | S | D | BRI | BRD | H | J | K | L | HOME| PGUP| BOOT |
// | SHFT |NONE|VOLDN|VOLUP|MUTE|BLINC|BLDEC| N | M | , | END | PGDN | SHFT|BL_TOG| 1 |
// | BT_PRV| BT_NXT| ALT | SPACE | RALT| CTRL | LEFT |RESET| BT_CLR |
// ------------------------------------------------------------------------------------------
bindings = <
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &trans &trans
&trans &trans &trans &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &kp INS &trans &kp PSCRN &kp SLCK &kp PAUSE_BREAK &rgb_ug RGB_TOG
&trans &trans &trans &trans &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &kp HOME &kp PG_UP &bootloader
&trans &none &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &kp END &kp PG_DN &trans &bl BL_TOG &trans
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &sys_reset &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#elif defined(HHKB)
default_layer {
// ------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER |
// | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT |
// | CTL | WIN | ALT | SPACE | ALT | 1 | CTRL |
// ------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH
&kp CAPS &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp RCTRL
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// ------------------------------------------------------------------------------------------
// |GRAVE| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL |
// | TAB | Q | UP | E | HUI | HUD | Y | U | INS | O |PSCRN| SLCK| P_B | RGB_TOG|
// | CAPS | LEFT| DOWN|RIGHT| BRI | BRD | H | J | K | L | HOME| PGUP| BOOT |
// | SHFT |VOLDN|VOLUP| MUTE|BLINC|BLDEC| N | M | , | END | PGDN | BL_TOG |
// | BT_PRV | BT_NXT | ALT | SPACE | RESET | 1 | BT_CLR |
// ------------------------------------------------------------------------------------------
bindings = <
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp DEL
&trans &trans &kp UP &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &kp INS &trans &kp PSCRN &kp SLCK &kp PAUSE_BREAK &rgb_ug RGB_TOG
&trans &kp LEFT &kp DOWN &kp RIGHT &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &kp HOME &kp PG_UP &bootloader
&trans &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &kp END &kp PG_DN &bl BL_TOG
&bt BT_PRV &bt BT_NXT &trans &trans &sys_reset &trans &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#else
#error "Layout not defined, please define a layout by uncommenting the appropriate line in bt60_v2.keymap"
#endif
};
};

View file

@ -0,0 +1,15 @@
identifier: bt60_v2
name: BT60 V2
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog

View file

@ -0,0 +1,14 @@
file_format: "1"
id: bt60_v2
name: BT60 V2
type: board
arch: arm
features:
- keys
- encoder
- underglow
- backlight
outputs:
- usb
- ble
url: https://polarityworks.com/btckp

View file

@ -0,0 +1,38 @@
# SPDX-License-Identifier: MIT
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_BT60_V2=y
# Enable MPU
CONFIG_ARM_MPU=y
# enable GPIO
CONFIG_GPIO=y
CONFIG_PINCTRL=y
# encoder
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_PWM=y
CONFIG_LED_PWM=y
CONFIG_ZMK_BACKLIGHT=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_ZMK_RGB_UNDERGLOW=y
CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=y
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=y
CONFIG_ZMK_RGB_UNDERGLOW_HUE_START=262
CONFIG_WS2812_STRIP=y
CONFIG_SPI=y
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include "ckp.dtsi"
/ {
model = "BT65_V1";
compatible = "polarityworks,bt65_v1";
chosen {
zmk,matrix_transform = &ansi_transform;
};
ansi_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <16>;
rows = <5>;
map = <
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(1,12) RC(1,13) RC(1,15)
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(2,12) RC(2,13) RC(2,15)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13) RC(3,15)
RC(4,0) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,14) RC(4,15)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,10) RC(5,11) RC(5,12) RC(5,13) RC(5,14) RC(5,15)
>;
};
iso_transform: keymap_transform_1 {
compatible = "zmk,matrix-transform";
columns = <16>;
rows = <5>;
map = <
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(1,12) RC(1,13) RC(1,15)
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(2,12) RC(2,15)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,12) RC(3,13) RC(3,15)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,14) RC(4,15)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,10) RC(5,11) RC(5,12) RC(5,13) RC(5,14) RC(5,15)
>;
};
all_1u_transform: keymap_transform_2 {
compatible = "zmk,matrix-transform";
columns = <16>;
rows = <5>;
map = <
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(1,12) RC(1,13) RC(1,14) RC(1,15)
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(2,12) RC(2,13) RC(2,15)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13) RC(3,15)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,13) RC(4,14) RC(4,15)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,10) RC(5,11) RC(5,12) RC(5,13) RC(5,14) RC(5,15)
>;
};
hhkb_transform: keymap_transform_3 {
compatible = "zmk,matrix-transform";
columns = <16>;
rows = <5>;
map = <
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(1,12) RC(1,13) RC(1,15)
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(2,12) RC(2,13) RC(2,15)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13) RC(3,15)
RC(4,0) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,15)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,11) RC(5,12) RC(5,13) RC(5,15)
>;
};
};

View file

@ -0,0 +1,177 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/rgb.h>
#include <dt-bindings/zmk/backlight.h>
#define ANSI
//#define ISO
//#define ALL_1U
//#define HHKB
/ {
chosen {
#ifdef ANSI
zmk,matrix_transform = &ansi_transform;
#elif defined(ISO)
zmk,matrix_transform = &iso_transform;
#elif defined(ALL_1U)
zmk,matrix_transform = &all_1u_transform;
#elif defined(HHKB)
zmk,matrix_transform = &hhkb_transform;
#else
#error "Layout not defined, please define a layout by uncommenting the appropriate line in bt65_v1.keymap"
#endif
};
keymap {
compatible = "zmk,keymap";
#ifdef ANSI
default_layer {
// ------------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | DEL |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | INS |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | PGUP|
// | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | UP | PGDN|
// | CTL | WIN | ALT | SPACE | ALT | 1 |RCTRL| LEFT| DOWN|RIGHT|
// ------------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BKSP &kp DEL
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH &kp INS
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET &kp PG_UP
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp UP &kp PG_DN
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// --------------------------------------------------------------------------------------------------
// |GRAVE| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | BL_TOG |RGB_TOG|
// | TAB | Q | W | E | HUI | HUD | Y | U | I | O | P | SLCK| ] | RESET | PSCRN|
// | CAPS | A | S | D | BRI | BRD | H | J | K | L | ; | ' | BOOT | P_BRK|
// | SHIFT |VOLDN|VOLUP| MUTE|BLINC|BLDEC| N | M | , | . | / | SHIFT | HOME | END |
// | BT_PRV| BT_NXT| ALT | SPACE | ALT | 1 | CTRL | LEFT | DOWN |BT_CLR|
// --------------------------------------------------------------------------------------------------
bindings = <
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &bl BL_TOG &rgb_ug RGB_TOG
&trans &trans &trans &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &trans &trans &trans &kp SLCK &trans &sys_reset &kp PSCRN
&trans &trans &trans &trans &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &trans &trans &bootloader &kp PAUSE_BREAK
&trans &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &trans &trans &trans &kp HOME &kp END
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#elif defined(ISO)
default_layer {
// ------------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | DEL |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | | INS |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | # | ENTER | PGUP|
// |SHIFT | \ | Z | X | C | V | B | N | M | , | . | / | SHIFT | UP | PGDN|
// | CTL | WIN | ALT | SPACE | ALT | 1 |RCTRL| LEFT| DOWN|RIGHT|
// ------------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BKSP &kp DEL
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp INS
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp NON_US_HASH &kp RET &kp PG_UP
&kp LSHFT &kp NON_US_BSLH &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp UP &kp PG_DN
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// --------------------------------------------------------------------------------------------------
// |GRAVE| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | BL_TOG |RGB_TOG|
// | TAB | Q | W | E | HUI | HUD | Y | U | I | O | P | SLCK| ] | | PSCRN|
// | CAPS | A | S | D | BRI | BRD | H | J | K | L | ; | ' |RESET| BOOT | P_BRK|
// |SHIFT |VOLDN|VOLUP| MUTE|BLINC|BLDEC| B | N | M | , | . | / | SHIFT | HOME | END |
// | BT_PRV| BT_NXT| ALT | SPACE | ALT | 1 | CTRL | LEFT | DOWN |BT_CLR|
// --------------------------------------------------------------------------------------------------
bindings = <
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &bl BL_TOG &rgb_ug RGB_TOG
&trans &trans &trans &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &trans &trans &trans &kp SLCK &trans &kp PSCRN
&trans &trans &trans &trans &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &trans &trans &sys_reset &bootloader &kp PAUSE_BREAK
&trans &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &trans &trans &trans &trans &kp HOME &kp END
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#elif defined(ALL_1U)
default_layer {
// -------------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BKSP | DEL | HOME|
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | END |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | PGUP|
// |SHIFT|NONE | Z | X | C | V | B | N | M | , | . | / |SHIFT|NONE | UP | PGDN|
// | CTL | WIN | ALT | SPACE | ALT | 1 |RCTRL| LEFT| DOWN|RIGHT|
// -------------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &kp DEL &kp HOME
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH &kp END
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET &kp PG_UP
&kp LSHFT &none &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &none &kp UP &kp PG_DN
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp LALT &mo 1 &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// --------------------------------------------------------------------------------------------------
// |GRAVE| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |BL_TOG|RGB_TOG|HOME|
// | TAB | Q | W | E | HUI | HUD | Y | U | I | O | P | SLCK| ] | RESET | PSCRN|
// | CAPS | A | S | D | BRI | BRD | H | J | K | L | ; | ' | BOOT | P_BRK|
// |SHIFT| NONE|VOLDN|VOLUP| MUTE|BLINC|BLDEC| N | M | , | . | / |SHIFT| NONE| UP | INS |
// | BT_PRV| BT_NXT| ALT | SPACE | ALT | 1 | CTRL| LEFT| DOWN |BT_CLR|
// --------------------------------------------------------------------------------------------------
bindings = <
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &bl BL_TOG &rgb_ug RGB_TOG &trans
&trans &trans &trans &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &trans &trans &trans &kp SLCK &trans &sys_reset &kp PSCRN
&trans &trans &trans &trans &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &trans &trans &bootloader &kp PAUSE_BREAK
&trans &none &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &trans &trans &trans &trans &trans &kp INS
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#elif defined(HHKB)
default_layer {
// ------------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | DEL |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | HOME|
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | END |
// | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | PGUP|
// | CTL | WIN | ALT | SPACE | ALT | 1 | CTRL | PGDN|
// ------------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BKSP &kp DEL
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH &kp HOME
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET &kp END
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp PG_UP
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp RCTRL &kp PG_DN
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// --------------------------------------------------------------------------------------------------
// |GRAVE| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | BL_TOG |RGB_TOG|
// | TAB | Q | UP | E | HUI | HUD | Y | U | I | O | P | SLCK| ] | RESET | PSCRN|
// | CAPS | LEFT| DOWN|RIGHT| BRI | BRD | H | J | K | L | ; | ' | BOOT | P_BRK|
// | SHIFT |VOLDN|VOLUP| MUTE|BLINC|BLDEC| N | M | , | . | / | SHIFT | INS |
// | BT_PRV | BT_NXT | ALT | SPACE | ALT | 1 | CTRL |BT_CLR|
// --------------------------------------------------------------------------------------------------
bindings = <
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &bl BL_TOG &rgb_ug RGB_TOG
&trans &trans &kp UP &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &trans &trans &trans &kp SLCK &trans &sys_reset &kp PSCRN
&trans &kp LEFT &kp DOWN &kp RIGHT &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &trans &trans &bootloader &kp PAUSE_BREAK
&trans &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &trans &trans &trans &kp INS
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#else
#error "Layout not defined, please define a layout by uncommenting the appropriate line in bt65_v1.keymap"
#endif
};
};

View file

@ -0,0 +1,15 @@
identifier: bt65_v1
name: BT65_V1
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog

View file

@ -0,0 +1,14 @@
file_format: "1"
id: bt65_v1
name: BT65
type: board
arch: arm
features:
- keys
- encoder
- underglow
- backlight
outputs:
- usb
- ble
url: https://polarityworks.com/btckp

View file

@ -0,0 +1,38 @@
# SPDX-License-Identifier: MIT
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_BT65_V1=y
# Enable MPU
CONFIG_ARM_MPU=y
# enable GPIO
CONFIG_GPIO=y
CONFIG_PINCTRL=y
# encoder
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_PWM=y
CONFIG_LED_PWM=y
CONFIG_ZMK_BACKLIGHT=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_ZMK_RGB_UNDERGLOW=y
CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=y
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=y
CONFIG_ZMK_RGB_UNDERGLOW_HUE_START=262
CONFIG_WS2812_STRIP=y
CONFIG_SPI=y
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

View file

@ -0,0 +1,61 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include "ckp.dtsi"
/ {
model = "BT75_V1";
compatible = "polarityworks,bt75_v1";
chosen {
zmk,matrix_transform = &ansi_transform;
};
ansi_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <16>;
rows = <6>;
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(0,12) RC(0,13) RC(0,14) RC(0,15)
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(1,12) RC(1,13) RC(1,15)
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(2,12) RC(2,13) RC(2,15)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13) RC(3,15)
RC(4,0) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,14) RC(4,15)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,10) RC(5,11) RC(5,12) RC(5,13) RC(5,14) RC(5,15)
>;
};
iso_transform: keymap_transform_1 {
compatible = "zmk,matrix-transform";
columns = <16>;
rows = <6>;
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(0,12) RC(0,13) RC(0,14) RC(0,15)
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(1,12) RC(1,13) RC(1,15)
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(2,12) RC(2,15)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,12) RC(3,13) RC(3,15)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,14) RC(4,15)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,10) RC(5,11) RC(5,12) RC(5,13) RC(5,14) RC(5,15)
>;
};
all_1u_transform: keymap_transform_2 {
compatible = "zmk,matrix-transform";
columns = <16>;
rows = <6>;
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(0,12) RC(0,13) RC(0,14) RC(0,15)
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(1,12) RC(1,13) RC(1,14) RC(1,15)
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(2,12) RC(2,13) RC(2,15)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13) RC(3,15)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,13) RC(4,14) RC(4,15)
RC(5,0) RC(5,1) RC(5,2) RC(5,6) RC(5,10) RC(5,11) RC(5,12) RC(5,13) RC(5,14) RC(5,15)
>;
};
};

View file

@ -0,0 +1,148 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/rgb.h>
#include <dt-bindings/zmk/backlight.h>
#define ANSI
//#define ISO
//#define ALL_1U
/ {
chosen {
#ifdef ANSI
zmk,matrix_transform = &ansi_transform;
#elif defined(ISO)
zmk,matrix_transform = &iso_transform;
#elif defined(ALL_1U)
zmk,matrix_transform = &all_1u_transform;
#else
#error "Layout not defined, please define a layout using by uncommenting the appropriate line in bt75_v1.keymap"
#endif
};
keymap {
compatible = "zmk,keymap";
#ifdef ANSI
default_layer {
// ------------------------------------------------------------------------------------------------
// | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F9 | F9 | F10 | F11 | F12 |PSCRN|HOME| END |
// |GRAVE| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | DEL |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | INS |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | PGUP|
// | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | UP | PGDN|
// | CTL | WIN | ALT | SPACE | ALT | 1 |RCTRL| LEFT| DOWN|RIGHT|
// ------------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp PSCRN &kp HOME &kp END
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BKSP &kp DEL
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH &kp INS
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET &kp PG_UP
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp UP &kp PG_DN
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// --------------------------------------------------------------------------------------------------
// | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F9 | F9 | F10 | F11 | F12 |PSCRN| HOME| END |
// |GRAVE| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BL_TOG |RGB_TOG|
// | TAB | Q | W | E | HUI | HUD | Y | U | I | O | P | SLCK| ] | RESET | P_BRK|
// | CAPS | A | S | D | BRI | BRD | H | J | K | L | ; | ' | BOOT | PG_UP|
// | SHIFT |VOLDN|VOLUP| MUTE|BLINC|BLDEC| N | M | , | . | / | SHIFT | UP | PG_DN|
// | BT_PRV| BT_NXT| ALT | SPACE | ALT | 1 | CTRL | LEFT | DOWN |BT_CLR|
// --------------------------------------------------------------------------------------------------
bindings = <
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &bl BL_TOG &rgb_ug RGB_TOG
&trans &trans &trans &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &trans &trans &trans &kp SLCK &trans &sys_reset &kp PAUSE_BREAK
&trans &trans &trans &trans &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &trans &trans &bootloader &trans
&trans &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#elif defined(ISO)
default_layer {
// ------------------------------------------------------------------------------------------------
// | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F9 | F9 | F10 | F11 | F12 |PSCRN|HOME| END |
// |GRAVE| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | DEL |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | | INS |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | # | ENTER | PGUP|
// |SHIFT | \ | Z | X | C | V | B | N | M | , | . | / | SHIFT | UP | PGDN|
// | CTL | WIN | ALT | SPACE | ALT | 1 |RCTRL| LEFT| DOWN|RIGHT|
// ------------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp PSCRN &kp HOME &kp END
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BKSP &kp DEL
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp INS
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp NON_US_HASH &kp RET &kp PG_UP
&kp LSHFT &kp NON_US_BSLH &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp UP &kp PG_DN
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// --------------------------------------------------------------------------------------------------
// | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F9 | F9 | F10 | F11 | F12 |PSCRN|HOME| END |
// |GRAVE| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BL_TOG |RGB_TOG|
// | TAB | Q | W | E | HUI | HUD | Y | U | I | O | P | SLCK| ] | | P_BRK|
// | CAPS | A | S | D | BRI | BRD | H | J | K | L | ; | ' |RESET| BOOT | PG_UP|
// |SHIFT | \ |VOLDN|VOLUP| MUTE|BLINC|BLDEC| N | M | , | . | / | SHIFT | UP | PG_DN|
// | BT_PRV| BT_NXT| ALT | SPACE | ALT | 1 | CTRL | LEFT | DOWN |BT_CLR|
// --------------------------------------------------------------------------------------------------
bindings = <
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &bl BL_TOG &rgb_ug RGB_TOG
&trans &trans &trans &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &trans &trans &trans &kp SLCK &trans &kp PAUSE_BREAK
&trans &trans &trans &trans &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &trans &trans &sys_reset &bootloader &trans
&trans &trans &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#elif defined(ALL_1U)
default_layer {
// -------------------------------------------------------------------------------------------------
// | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F9 | F9 | F10 | F11 | F12 |PSCRN| P_B | INS |
// |GRAVE| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BKSP | DEL | HOME|
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | END |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | PGUP|
// |SHIFT|NONE | Z | X | C | V | B | N | M | , | . | / |SHIFT|NONE | UP | PGDN|
// | CTL | WIN | ALT | SPACE | ALT | 1 |RCTRL| LEFT| DOWN|RIGHT|
// -------------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp PSCRN &kp PAUSE_BREAK &kp INS
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &kp DEL &kp HOME
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH &kp END
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET &kp PG_UP
&kp LSHFT &none &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &none &kp UP &kp PG_DN
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp LALT &mo 1 &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
// --------------------------------------------------------------------------------------------------
// | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F9 | F9 | F10 | F11 | F12 |PSCRN| P_B | INS |
// |GRAVE| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BL_TOG|RGB_TOG|HOME|
// | TAB | Q | W | E | HUI | HUD | Y | U | I | O | P | SLCK| ] | RESET | END |
// | CAPS | A | S | D | BRI | BRD | H | J | K | L | ; | ' | BOOT | PGUP |
// |SHIFT| NONE|VOLDN|VOLUP| MUTE|BLINC|BLDEC| N | M | , | . | / |SHIFT| NONE| UP | PGDN |
// | BT_PRV| BT_NXT| ALT | SPACE | ALT | 1 | CTRL| LEFT| DOWN |BT_CLR|
// --------------------------------------------------------------------------------------------------
bindings = <
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &bl BL_TOG &rgb_ug RGB_TOG &trans
&trans &trans &trans &trans &rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &trans &trans &trans &kp SLCK &trans &sys_reset &trans
&trans &trans &trans &trans &rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &trans &trans &bootloader &trans
&trans &trans &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
#else
#error "Layout not defined, please define a layout by uncommenting the appropriate line in bt75.keymap"
#endif
};
};

View file

@ -0,0 +1,15 @@
identifier: bt75_v1
name: BT75_V1
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog

View file

@ -0,0 +1,14 @@
file_format: "1"
id: bt75_v1
name: BT75_V1
type: board
arch: arm
features:
- keys
- encoder
- underglow
- backlight
outputs:
- usb
- ble
url: https://polarityworks.com/btckp

View file

@ -0,0 +1,38 @@
# SPDX-License-Identifier: MIT
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_BT75_V1=y
# Enable MPU
CONFIG_ARM_MPU=y
# enable GPIO
CONFIG_GPIO=y
CONFIG_PINCTRL=y
# encoder
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_PWM=y
CONFIG_LED_PWM=y
CONFIG_ZMK_BACKLIGHT=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_ZMK_RGB_UNDERGLOW=y
CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=y
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=y
CONFIG_ZMK_RGB_UNDERGLOW_HUE_START=262
CONFIG_WS2812_STRIP=y
CONFIG_SPI=y
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2022 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/
&pinctrl {
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 20)>;
};
};
spi3_sleep: spi3_sleep {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 20)>;
low-power-enable;
};
};
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 17)>;
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 17)>;
low-power-enable;
};
};
};

217
app/boards/arm/ckp/ckp.dtsi Normal file
View file

@ -0,0 +1,217 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include <dt-bindings/led/led.h>
#include <dt-bindings/zmk/matrix_transform.h>
#include "ckp-pinctrl.dtsi"
/ {
model = "CKP";
compatible = "polarityworks,ckp";
chosen {
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,kscan = &kscan0;
zmk,underglow = &led_strip;
zmk,backlight = &backlight;
zmk,battery = &vbatt;
};
sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder_1>;
};
kscan0: kscan_0 {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
col-gpios
= <&gpio1 11 GPIO_ACTIVE_HIGH>
, <&gpio1 10 GPIO_ACTIVE_HIGH>
, <&gpio1 13 GPIO_ACTIVE_HIGH>
, <&gpio1 15 GPIO_ACTIVE_HIGH>
, <&gpio0 3 GPIO_ACTIVE_HIGH>
, <&gpio0 2 GPIO_ACTIVE_HIGH>
, <&gpio0 28 GPIO_ACTIVE_HIGH>
, <&gpio0 29 GPIO_ACTIVE_HIGH>
, <&gpio0 30 GPIO_ACTIVE_HIGH>
, <&gpio0 31 GPIO_ACTIVE_HIGH>
, <&gpio0 5 GPIO_ACTIVE_HIGH>
, <&gpio0 7 GPIO_ACTIVE_HIGH>
, <&gpio1 9 GPIO_ACTIVE_HIGH>
, <&gpio0 12 GPIO_ACTIVE_HIGH>
, <&gpio0 23 GPIO_ACTIVE_HIGH>
, <&gpio1 6 GPIO_ACTIVE_HIGH>
;
row-gpios
= <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
ext-power {
compatible = "zmk,ext-power-generic";
label = "EXT_POWER";
control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
};
encoder_1: encoder_1 {
compatible = "alps,ec11";
label = "ENCODER_ONE";
a-gpios = <&gpio0 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio0 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "okay";
};
encoder_2: encoder_2 {
compatible = "alps,ec11";
label = "ENCODER_TWO";
a-gpios = <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio0 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "okay";
};
encoder_3: encoder_3 {
compatible = "alps,ec11";
label = "encoder_3";
a-gpios = <&gpio0 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio0 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "okay";
};
backlight: pwmleds {
compatible = "pwm-leds";
label = "Backlight LEDs";
pwm_led_0 {
pwms = <&pwm0 0 10000 PWM_POLARITY_NORMAL>;
};
};
leds {
compatible = "gpio-leds";
blue_led: led_0 {
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};
vbatt: vbatt {
compatible = "zmk,battery-voltage-divider";
label = "VBATT";
io-channels = <&adc 2>;
output-ohms = <100000>;
full-ohms = <(100000 + 100000)>;
};
};
&adc {
status = "okay";
};
&pwm0 {
status = "okay";
pinctrl-0 = <&pwm0_default>;
pinctrl-1 = <&pwm0_sleep>;
pinctrl-names = "default", "sleep";
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&usbd {
status = "okay";
};
&flash0 {
/*
* For more information, see:
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
sd_partition: partition@0 {
label = "softdevice";
reg = <0x00000000 0x00026000>;
};
code_partition: partition@26000 {
label = "code_partition";
reg = <0x00026000 0x000c6000>;
};
/*
* The flash starting at 0x000ec000 and ending at
* 0x000f3fff is reserved for use by the application.
*/
/*
* Storage partition will be used by FCB/LittleFS/NVS
* if enabled.
*/
storage_partition: partition@ec000 {
label = "storage";
reg = <0x000ec000 0x00008000>;
};
boot_partition: partition@f4000 {
label = "adafruit_boot";
reg = <0x000f4000 0x0000c000>;
};
};
};
&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";
led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
label = "WS2812";
/* SPI */
reg = <0>;
spi-max-frequency = <4000000>;
/* WS2812 */
chain-length = <12>; /* number of LEDs */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
color-mapping = <LED_COLOR_ID_GREEN
LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>;
};
};

View file

@ -47,7 +47,7 @@ if(CONFIG_ZMK_DISPLAY)
zephyr_library_sources(widgets/icons/layers.c)
zephyr_library_sources(widgets/icons/layers2.c)
endif()
if(CONFIG_BOARD_CORNEISH_ZEN_V2_RIGHT)
if(NOT CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
zephyr_library_sources(widgets/icons/zenlogo.c)
endif()
endif()

View file

@ -0,0 +1,10 @@
#
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
config BOARD_CORNEISH_ZEN_LEFT
bool
config BOARD_CORNEISH_ZEN_RIGHT
bool

View file

@ -3,10 +3,22 @@
# SPDX-License-Identifier: MIT
#
config BOARD_CORNEISH_ZEN_V1_LEFT
bool "corneish zen left v1"
depends on SOC_NRF52840_QIAA
select BOARD_CORNEISH_ZEN_LEFT
config BOARD_CORNEISH_ZEN_V1_RIGHT
bool "corneish zen right v1"
depends on SOC_NRF52840_QIAA
select BOARD_CORNEISH_ZEN_RIGHT
config BOARD_CORNEISH_ZEN_V2_LEFT
bool "corneish zen left v2"
depends on SOC_NRF52840_QIAA
select BOARD_CORNEISH_ZEN_LEFT
config BOARD_CORNEISH_ZEN_V2_RIGHT
bool "corneish zen right v2"
depends on SOC_NRF52840_QIAA
select BOARD_CORNEISH_ZEN_RIGHT

View file

@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT
#
if BOARD_CORNEISH_ZEN_V2_LEFT
if BOARD_CORNEISH_ZEN_LEFT
config ZMK_KEYBOARD_NAME
default "Corne-ish Zen"
@ -11,10 +11,10 @@ config ZMK_KEYBOARD_NAME
config ZMK_SPLIT_ROLE_CENTRAL
default y
endif # BOARD_CORNEISH_ZEN_V2_LEFT
endif # BOARD_CORNEISH_ZEN_LEFT
if BOARD_CORNEISH_ZEN_V2_LEFT || BOARD_CORNEISH_ZEN_V2_RIGHT
if BOARD_CORNEISH_ZEN_LEFT || BOARD_CORNEISH_ZEN_RIGHT
config BOARD
default "corneish_zen"
@ -44,7 +44,6 @@ endif # USB
config ZMK_DISPLAY
select LV_USE_CONT
select LV_FONT_MONTSERRAT_26
select LV_FONT_MONTSERRAT_20
select LV_FONT_MONTSERRAT_16
select LV_USE_LABEL
select LV_USE_IMG
@ -78,4 +77,11 @@ menuconfig CUSTOM_WIDGET_LAYER_STATUS
menuconfig CUSTOM_WIDGET_PERIPHERAL_STATUS
bool "custom peripheral status widget"
endif # BOARD_CORNEISH_ZEN_V2_LEFT || BOARD_CORNEISH_ZEN_V2_RIGHT
endif # BOARD_CORNEISH_ZEN_LEFT || BOARD_CORNEISH_ZEN_RIGHT
if BOARD_CORNEISH_ZEN_V1_LEFT || BOARD_CORNEISH_ZEN_V1_RIGHT
config BQ274XX
default y
endif # BOARD_CORNEISH_ZEN_V1_LEFT || BOARD_CORNEISH_ZEN_V1_RIGHT

View file

@ -11,8 +11,8 @@
#include <dt-bindings/zmk/matrix_transform.h>
/ {
model = "corneish_zen_v2";
compatible = "corneish_zen_v2";
model = "Corne-ish Zen";
compatible = "corneish_zen";
chosen {
zephyr,code-partition = &code_partition;
@ -20,8 +20,8 @@
zephyr,flash = &flash0;
zmk,kscan = &kscan0;
zmk,display = &epd;
zmk,battery = &vbatt;
zephyr,console = &cdc_acm_uart;
zmk,matrix_transform = &default_transform;
};
default_transform: keymap_transform_0 {
@ -60,7 +60,6 @@
};
&adc {
status = "okay";
};

View file

@ -22,7 +22,7 @@
default_layer {
label = "QWERTY";
// -----------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// | TAB | Q | W | E | R | T | | Y | U | I | O | P | BKSP |
// | CTRL | A | S | D | F | G | | H | J | K | L | ; | ' |
// | SHFT | Z | X | C | V | B | | N | M | , | . | / | ESC |
@ -34,6 +34,7 @@
&kp LGUI &mo 1 &kp SPACE &kp RET &mo 2 &kp RALT
>;
};
lower_layer {
label = "NUMBER";
// -----------------------------------------------------------------------------------------

View file

@ -0,0 +1,15 @@
file_format: "1"
id: corneish_zen_v1
name: Corneish Zen v1
url: https://lowprokb.ca/collections/keyboards/products/corne-ish-zen
type: board
arch: arm
features:
- keys
- display
outputs:
- usb
- ble
siblings:
- corneish_zen_v1_left
- corneish_zen_v1_right

View file

@ -0,0 +1,123 @@
/*
*
* Copyright (c) 2021 Darryl deHaan
* SPDX-License-Identifier: MIT
*
*/
#include "corneish_zen.dtsi"
/{
chosen {
zephyr,display = &epd;
zmk,battery = &fuelgauge;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
row-gpios
= <&gpio0 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 31 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 30 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-gpios
= <&gpio0 21 GPIO_ACTIVE_HIGH>
, <&gpio0 23 GPIO_ACTIVE_HIGH>
, <&gpio0 12 GPIO_ACTIVE_HIGH>
, <&gpio1 9 GPIO_ACTIVE_HIGH>
, <&gpio0 7 GPIO_ACTIVE_HIGH>
, <&gpio0 5 GPIO_ACTIVE_HIGH>
;
};
leds {
compatible = "gpio-leds";
blue_led: led_0 {
gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};
};
&pinctrl {
spi2_default: spi2_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
<NRF_PSEL(SPIM_MOSI, 0, 8)>,
<NRF_PSEL(SPIM_MISO, 0, 22)>;
};
};
spi2_sleep: spi2_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
<NRF_PSEL(SPIM_MOSI, 0, 8)>,
<NRF_PSEL(SPIM_MISO, 0, 22)>;
low-power-enable;
};
};
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 6)>,
<NRF_PSEL(TWIM_SCL, 0, 26)>;
};
};
i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 6)>,
<NRF_PSEL(TWIM_SCL, 0, 26)>;
low-power-enable;
};
};
};
&i2c0 {
status = "okay";
compatible = "nordic,nrf-twim";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
clock-frequency = <100000>;
fuelgauge: bq274xx@55 {
compatible = "ti,bq274xx";
label = "BATTERY";
reg = <0x55>;
design-voltage = <3700>; //Battery Design Volatge in mV
design-capacity = <180>; //Battery Design Capacity in mAh
taper-current = <2>; //Battery Taper current in mAh
terminate-voltage = <2750>; //Battery Terminate Voltage in mV
int-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
};
};
&spi2 {
status = "okay";
compatible = "nordic,nrf-spim";
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
epd: il0323@0 {
compatible = "gooddisplay,il0323";
reg = <0>;
label = "DISPLAY";
width = <80>;
height = <128>;
spi-max-frequency = <4000000>;
dc-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
busy-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
reset-gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
pwr = [03 00 26 26];
cdi = <0xd2>;
tcon = <0x22>;
};
};

View file

@ -0,0 +1,76 @@
#
# Copyright (c) 2022 Darryl deHaan
# SPDX-License-Identifier: MIT
#
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_CORNEISH_ZEN_V1_LEFT=y
CONFIG_ZMK_SLEEP=y
CONFIG_ZMK_DISPLAY=y
# Enable MPU
CONFIG_ARM_MPU=y
# enable pinctrl
CONFIG_PINCTRL=y
# enable GPIO
CONFIG_GPIO=y
# Enable I2C
CONFIG_I2C=y
CONFIG_I2C_NRFX=y
# Enable SPI
CONFIG_SPI_NRFX=y
# Enable writing to flash
CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
# Enable 32kHz crystal
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y
# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
CONFIG_LV_Z_BITS_PER_PIXEL=1
CONFIG_LV_COLOR_DEPTH_1=y
CONFIG_LV_DPI_DEF=145
CONFIG_LV_Z_VDB_SIZE=100
CONFIG_LV_USE_THEME_MONO=y
CONFIG_LV_COLOR_CHROMA_KEY_HEX=0x00FF00
CONFIG_ZMK_LV_FONT_DEFAULT_SMALL_MONTSERRAT_16=y
CONFIG_LV_FONT_MONTSERRAT_26=y
CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26=y
# custom status screens
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_CUSTOM=y
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN=n
CONFIG_CUSTOM_WIDGET_BATTERY_STATUS=y
CONFIG_ZMK_WIDGET_BATTERY_STATUS=n
CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS=y
CONFIG_ZMK_WIDGET_OUTPUT_STATUS=n
CONFIG_CUSTOM_WIDGET_LAYER_STATUS=y
CONFIG_ZMK_WIDGET_LAYER_STATUS=n
# Turn on logging, and set ZMK logging to debug output
#CONFIG_LOG=y
#CONFIG_ZMK_USB_LOGGING=y
#CONFIG_ZMK_LOG_LEVEL_DBG=y
#CONFIG_LOG_BUFFER_SIZE=65536
#CONFIG_LOG_STRDUP_BUF_COUNT=160
#CONFIG_I2C_LOG_LEVEL_DBG=y
#CONFIG_SPI_LOG_LEVEL_DBG=y
#CONFIG_DISPLAY_LOG_LEVEL_DBG=y
#CONFIG_LVGL_LOG_LEVEL_DBG=y
#CONFIG_LVGL_USE_DEBUG=y
#CONFIG_SENSOR_LOG_LEVEL_DBG=y

View file

@ -0,0 +1,131 @@
/*
*
* Copyright (c) 2021 Darryl deHaan
* SPDX-License-Identifier: MIT
*
*/
#include "corneish_zen.dtsi"
/{
chosen {
zephyr,display = &epd;
zmk,battery = &fuelgauge;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
row-gpios
= <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-gpios
= <&gpio0 19 GPIO_ACTIVE_HIGH>
, <&gpio0 21 GPIO_ACTIVE_HIGH>
, <&gpio0 23 GPIO_ACTIVE_HIGH>
, <&gpio0 12 GPIO_ACTIVE_HIGH>
, <&gpio1 9 GPIO_ACTIVE_HIGH>
, <&gpio0 7 GPIO_ACTIVE_HIGH>
;
};
leds {
compatible = "gpio-leds";
blue_led: led_0 {
gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};
};
&default_transform {
col-offset = <6>;
};
&five_column_transform {
col-offset = <6>;
};
&pinctrl {
spi2_default: spi2_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 20)>,
<NRF_PSEL(SPIM_MOSI, 0, 24)>,
<NRF_PSEL(SPIM_MISO, 0, 27)>;
};
};
spi2_sleep: spi2_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 20)>,
<NRF_PSEL(SPIM_MOSI, 0, 24)>,
<NRF_PSEL(SPIM_MISO, 0, 27)>;
low-power-enable;
};
};
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 16)>,
<NRF_PSEL(TWIM_SCL, 0, 13)>;
};
};
i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 16)>,
<NRF_PSEL(TWIM_SCL, 0, 13)>;
low-power-enable;
};
};
};
&i2c0 {
status = "okay";
compatible = "nordic,nrf-twim";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
clock-frequency = <100000>;
fuelgauge: bq274xx@55 {
compatible = "ti,bq274xx";
label = "BATTERY";
reg = <0x55>;
design-voltage = <3700>; //Battery Design Volatge in mV
design-capacity = <180>; //Battery Design Capacity in mAh
taper-current = <2>; //Battery Taper current in mAh 2.1
terminate-voltage = <2750>; //Battery Terminate Voltage in mV
int-gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
};
};
&spi2 {
status = "okay";
compatible = "nordic,nrf-spim";
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
epd: il0323@0 {
compatible = "gooddisplay,il0323";
reg = <0>;
label = "DISPLAY";
width = <80>;
height = <128>;
spi-max-frequency = <4000000>;
dc-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
busy-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
reset-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
pwr = [03 00 26 26];
cdi = <0xd2>;
tcon = <0x22>;
};
};

View file

@ -0,0 +1,75 @@
#
# Copyright (c) 2022 Darryl deHaan
# SPDX-License-Identifier: MIT
#
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_CORNEISH_ZEN_V1_RIGHT=y
CONFIG_ZMK_SLEEP=y
CONFIG_ZMK_DISPLAY=y
# Enable MPU
CONFIG_ARM_MPU=y
# enable pinctrl
CONFIG_PINCTRL=y
# enable GPIO
CONFIG_GPIO=y
# Enable I2C
CONFIG_I2C=y
CONFIG_I2C_NRFX=y
# Enable SPI
CONFIG_SPI_NRFX=y
# Enable writing to flash
CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
# Enable 32kHz crystal
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y
# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
CONFIG_LV_Z_BITS_PER_PIXEL=1
CONFIG_LV_COLOR_DEPTH_1=y
CONFIG_LV_DPI_DEF=145
CONFIG_LV_Z_VDB_SIZE=100
CONFIG_LV_USE_THEME_MONO=y
CONFIG_LV_COLOR_CHROMA_KEY_HEX=0x00FF00
CONFIG_ZMK_LV_FONT_DEFAULT_SMALL_MONTSERRAT_16=y
CONFIG_LV_FONT_MONTSERRAT_26=y
CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26=y
# custom status screens
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_CUSTOM=y
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN=n
CONFIG_CUSTOM_WIDGET_BATTERY_STATUS=y
CONFIG_ZMK_WIDGET_BATTERY_STATUS=n
CONFIG_CUSTOM_WIDGET_PERIPHERAL_STATUS=y
CONFIG_ZMK_WIDGET_PERIPHERAL_STATUS=n
# Turn on logging, and set ZMK logging to debug output
#CONFIG_LOG=y
#CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=8000
#CONFIG_ZMK_USB_LOGGING=y
#CONFIG_ZMK_LOG_LEVEL_DBG=y
#CONFIG_LOG_BUFFER_SIZE=20000
#CONFIG_LOG_STRDUP_BUF_COUNT=60
#CONFIG_I2C_LOG_LEVEL_DBG=y
#CONFIG_SPI_LOG_LEVEL_DBG=y
#CONFIG_DISPLAY_LOG_LEVEL_DBG=y
#CONFIG_LVGL_LOG_LEVEL_DBG=y
#CONFIG_LVGL_USE_DEBUG=y
#CONFIG_SENSOR_LOG_LEVEL_DBG=y

View file

@ -6,7 +6,6 @@
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_CORNEISH_ZEN_V2_LEFT=y
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SLEEP=y
CONFIG_ZMK_DISPLAY=y
@ -20,7 +19,6 @@ CONFIG_PINCTRL=y
CONFIG_GPIO=y
# Enable SPI
CONFIG_SPI=y
CONFIG_SPI_NRFX=y
# Enable writing to flash
@ -40,8 +38,6 @@ CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y
# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
CONFIG_SSD1306=n
CONFIG_IL0323=y
CONFIG_LV_Z_BITS_PER_PIXEL=1
CONFIG_LV_COLOR_DEPTH_1=y
CONFIG_LV_DPI_DEF=145

View file

@ -33,7 +33,6 @@
, <&gpio1 9 GPIO_ACTIVE_HIGH>
, <&gpio0 7 GPIO_ACTIVE_HIGH>
;
};
leds {
@ -56,6 +55,7 @@
&default_transform {
col-offset = <6>;
};
&five_column_transform {
col-offset = <6>;
};
@ -98,7 +98,6 @@
busy-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
reset-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
pwr = [03 00 26 26];
//softstart = [17 17 17 17];
cdi = <0xd2>;
tcon = <0x22>;
};

View file

@ -6,7 +6,6 @@
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_CORNEISH_ZEN_V2_RIGHT=y
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SLEEP=y
CONFIG_ZMK_DISPLAY=y
@ -20,7 +19,6 @@ CONFIG_PINCTRL=y
CONFIG_GPIO=y
# Enable SPI
CONFIG_SPI=y
CONFIG_SPI_NRFX=y
# Enable writing to flash
@ -40,8 +38,6 @@ CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y
# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
CONFIG_SSD1306=n
CONFIG_IL0323=y
CONFIG_LV_Z_BITS_PER_PIXEL=1
CONFIG_LV_COLOR_DEPTH_1=y
CONFIG_LV_DPI_DEF=145

View file

@ -0,0 +1,6 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: Apache-2.0
config BOARD_KBDFANS_TOFU65_V2
bool "KBDfans Tofu65 2.0"
depends on SOC_RP2040

View file

@ -0,0 +1,15 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
if BOARD_KBDFANS_TOFU65_V2
config ZMK_KEYBOARD_NAME
default "kbdfans tofu65"
config RP2_FLASH_W25Q080
default y
config ZMK_USB
default y
endif # BOARD_KBDFANS_TOFU65_V2

View file

@ -0,0 +1,125 @@
/*
* Copyright (c) 2023 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include <rpi_pico/rp2040.dtsi>
#include <dt-bindings/zmk/matrix_transform.h>
/ {
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zephyr,shell-uart = &cdc_acm_uart;
zephyr,code-partition = &code_partition;
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
xtal_clk: xtal-clk {
compatible = "fixed-clock";
clock-frequency = <12000000>;
#clock-cells = <0>;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <15>;
rows = <5>;
// ------- Switch Matrix ----------
//
// Column 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
// ==========================================================================================
// Row 0 || S0 | S1 | S2 | S3 | S4 | S5 | S6 | S7 | S8 | S9 | S10 | S11 | S12 | S13 | S14 |
// Row 1 || S0 | S1 | S2 | S3 | S4 | S5 | S6 | S7 | S8 | S9 | S10 | S11 | S12 | S13 | S14 |
// Row 2 || S0 | S1 | S2 | S3 | S4 | S5 | S6 | S7 | S8 | S9 | S10 | S11 | S12 | | S13 |
// Row 3 || S0 | S1 | S2 | S3 | S4 | S5 | S6 | S7 | S8 | S9 | S10 | S11 | | S12 | S13 |
// Row 4 || S0 | S1 | S2 | | | | S3 | | S4 | S5 | S6 | | S7 | S8 | S9 |
// -----------------------------------------------------------------------------------
//
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(0,12) RC(0,13) RC(0,14)
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(1,12) RC(1,13) RC(1,14)
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(2,12) RC(2,14)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13) RC(3,14)
RC(4,0) RC(4,1) RC(4,2) RC(4,6) RC(4,8) RC(4,9) RC(4,10) RC(4,12) RC(4,13) RC(4,14)
>;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
row-gpios
= <&gpio0 29 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 28 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 27 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-gpios
= <&gpio0 25 GPIO_ACTIVE_HIGH>
, <&gpio0 24 GPIO_ACTIVE_HIGH>
, <&gpio0 23 GPIO_ACTIVE_HIGH>
, <&gpio0 1 GPIO_ACTIVE_HIGH>
, <&gpio0 7 GPIO_ACTIVE_HIGH>
, <&gpio0 21 GPIO_ACTIVE_HIGH>
, <&gpio0 20 GPIO_ACTIVE_HIGH>
, <&gpio0 19 GPIO_ACTIVE_HIGH>
, <&gpio0 18 GPIO_ACTIVE_HIGH>
, <&gpio0 17 GPIO_ACTIVE_HIGH>
, <&gpio0 16 GPIO_ACTIVE_HIGH>
, <&gpio0 15 GPIO_ACTIVE_HIGH>
, <&gpio0 14 GPIO_ACTIVE_HIGH>
, <&gpio0 13 GPIO_ACTIVE_HIGH>
, <&gpio0 12 GPIO_ACTIVE_HIGH>
;
};
};
&flash0 {
reg = <0x10000000 DT_SIZE_M(16)>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* Reserved memory for the second stage bootloader */
second_stage_bootloader: partition@0 {
label = "second_stage_bootloader";
reg = <0x00000000 0x100>;
read-only;
};
/*
* Usable flash. Starts at 0x100, after the bootloader. The partition
* size is 16MB minus the 0x100 bytes taken by the bootloader.
*/
code_partition: partition@100 {
label = "code";
reg = <0x100 (DT_SIZE_M(16) - 0x100)>;
read-only;
};
};
};
&usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&gpio0 {
status = "okay";
};

View file

@ -0,0 +1,97 @@
// Copyright (c) 2023 The ZMK Contributors
// SPDX-License-Identifier: MIT
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#define BASE 0
#define FUNC 1
//
// ---------- Tofu65 2.0 key switch positions ----------
//
// -------------------------------------------------------------------------------------------------
// | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
// -------------------------------------------------------------------------------------------------
// | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 24 | 26 | 27 | 28 | 29 |
// -------------------------------------------------------------------------------------------------
// | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
// -------------------------------------------------------------------------------------------------
// | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
// -------------------------------------------------------------------------------------------------
// | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |
// -------------------------------------------------------------------------------------------------
//
/ {
combos {
compatible = "zmk,combos";
// BACKSPACE + LCTRL + LALT = &sys_reset
combo_bootloader {
timeout-ms = <100>;
key-positions = <13 58 60>;
bindings = <&sys_reset>;
};
// RETURN + LCTRL + LALT = &bootloader
combo_sys_reset {
timeout-ms = <100>;
key-positions = <42 58 60>;
bindings = <&bootloader>;
};
};
keymap {
compatible = "zmk,keymap";
base {
// --------- Default QWERTY Layout ---------
// Layer 0 BASE
// -------------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BSPC | HME |
// -------------------------------------------------------------------------------------------------
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | PGU |
// -------------------------------------------------------------------------------------------------
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | PGD |
// -------------------------------------------------------------------------------------------------
// | LSHIFT | Z | X | C | V | B | N | M | , | . | / | RSHFT | ↑ | END |
// -------------------------------------------------------------------------------------------------
// | LCTL | LGUI | LALT | SPACE | RALT | RGUI | RCTL | <- | ↓ | -> |
// -------------------------------------------------------------------------------------------------
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &kp HOME
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH &kp PG_UP
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp ENTER &kp PG_DN
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp UP &kp END
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &lt FUNC K_APP &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
};
func {
// --------- Default QWERTY Layout ---------
// Layer 1 FUNC
// ---------------------------------------------------------------------------------------------------
// | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL | HME |
// ---------------------------------------------------------------------------------------------------
// | --- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | scroll lock | pause | --- | PGU |
// ---------------------------------------------------------------------------------------------------
// | CAPS | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | --- | PGD |
// ---------------------------------------------------------------------------------------------------
// | LSHIFT | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | ----- | VOL UP | MUTE |
// ---------------------------------------------------------------------------------------------------
// | ---- | ---- | ---- | ---- | -- | MO 1 | -- | PREV | VOL DN | NEXT |
// ---------------------------------------------------------------------------------------------------
bindings = <
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp DEL &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp SLCK &kp PAUSE_BREAK &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp C_VOL_UP &kp C_MUTE
&trans &trans &trans &trans &trans &trans &trans &kp C_PREV &kp C_VOL_DN &kp C_NEXT
>;
};
};
};

View file

@ -0,0 +1,15 @@
identifier: kbdfans_tofu65_v2
name: KBDfans Tofu65 2.0
type: mcu
arch: arm
flash: 16384
ram: 264
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- gpio
- usb_device
- hwinfo
- pwm

View file

@ -0,0 +1,10 @@
file_format: "1"
id: kbdfans_tofu65_v2
name: KBDfans Tofu65 2.0
type: board
arch: arm
features:
- keys
outputs:
- usb
url: https://kbdfans.com/collections/tofu65-2-0/products/tofu65-2-0

View file

@ -0,0 +1,20 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
CONFIG_SOC_SERIES_RP2XXX=y
CONFIG_SOC_RP2040=y
CONFIG_BOARD_KBDFANS_TOFU65_V2=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000
# Enable USB CDC ACM logging for debugging
# CONFIG_ZMK_USB_LOGGING=y
# Enable reset by default
CONFIG_RESET=y
# Code partition needed to target the correct flash range
CONFIG_USE_DT_CODE_PARTITION=y
# Output UF2 by default, native bootloader supports it.
CONFIG_BUILD_OUTPUT_UF2=y

View file

@ -48,7 +48,7 @@
};
&i2c0 {
compatible = "nordic,nrf-twim";
compatible = "nordic,nrf-twi";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
@ -56,6 +56,7 @@
&uart0 {
compatible = "nordic,nrf-uarte";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";

View file

@ -48,7 +48,7 @@
};
&i2c0 {
compatible = "nordic,nrf-twim";
compatible = "nordic,nrf-twi";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
@ -56,6 +56,7 @@
&uart0 {
compatible = "nordic,nrf-uarte";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";

View file

@ -61,7 +61,7 @@
};
&i2c0 {
compatible = "nordic,nrf-twim";
compatible = "nordic,nrf-twi";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
@ -69,6 +69,7 @@
&uart0 {
compatible = "nordic,nrf-uarte";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";

View file

@ -61,7 +61,7 @@
};
&i2c0 {
compatible = "nordic,nrf-twim";
compatible = "nordic,nrf-twi";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
@ -69,6 +69,7 @@
&uart0 {
compatible = "nordic,nrf-uarte";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";

View file

@ -5,6 +5,7 @@ zephyr_library_named(zmk__drivers__kscan)
zephyr_library_include_directories(${CMAKE_SOURCE_DIR}/include)
zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DRIVER debounce.c)
zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DRIVER kscan_gpio.c)
zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_MATRIX kscan_gpio_matrix.c)
zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DIRECT kscan_gpio_direct.c)
zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DEMUX kscan_gpio_demux.c)

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "kscan_gpio.h"
#include <stdlib.h>
static int compare_ports(const void *a, const void *b) {
const struct kscan_gpio *gpio_a = a;
const struct kscan_gpio *gpio_b = b;
return gpio_a->spec.port - gpio_b->spec.port;
}
void kscan_gpio_list_sort_by_port(struct kscan_gpio_list *list) {
qsort(list->gpios, list->len, sizeof(list->gpios[0]), compare_ports);
}
int kscan_gpio_pin_get(const struct kscan_gpio *gpio, struct kscan_gpio_port_state *state) {
if (gpio->spec.port != state->port) {
state->port = gpio->spec.port;
const int err = gpio_port_get(state->port, &state->value);
if (err) {
return err;
}
}
return (state->value & BIT(gpio->spec.pin)) != 0;
}

View file

@ -0,0 +1,61 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/sys/util.h>
struct kscan_gpio {
struct gpio_dt_spec spec;
/** The index of the GPIO in the devicetree *-gpios array. */
size_t index;
};
/** GPIO_DT_SPEC_GET_BY_IDX(), but for a struct kscan_gpio. */
#define KSCAN_GPIO_GET_BY_IDX(node_id, prop, idx) \
((struct kscan_gpio){.spec = GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, idx), .index = idx})
struct kscan_gpio_list {
struct kscan_gpio *gpios;
size_t len;
};
/** Define a kscan_gpio_list from a compile-time GPIO array. */
#define KSCAN_GPIO_LIST(gpio_array) \
((struct kscan_gpio_list){.gpios = gpio_array, .len = ARRAY_SIZE(gpio_array)})
struct kscan_gpio_port_state {
const struct device *port;
gpio_port_value_t value;
};
/**
* Sorts a GPIO list by port so it can be used with kscan_gpio_pin_get().
*/
void kscan_gpio_list_sort_by_port(struct kscan_gpio_list *list);
/**
* Get logical level of an input pin.
*
* This is equivalent to gpio_pin_get() except that, when iterating through the
* pins in a list which is sorted by kscan_gpio_list_sort_by_port(), it only
* performs one read per port instead of one read per pin.
*
* @param gpio The input pin to read.
* @param state An object to track state between reads. Must be zero-initialized before the first
* use.
*
* @retval 1 If pin logical value is 1 / active.
* @retval 0 If pin logical value is 0 / inactive.
* @retval -EIO I/O error when accessing an external GPIO chip.
* @retval -EWOULDBLOCK if operation would block.
*/
int kscan_gpio_pin_get(const struct kscan_gpio *gpio, struct kscan_gpio_port_state *state);

View file

@ -5,6 +5,7 @@
*/
#include "debounce.h"
#include "kscan_gpio.h"
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
@ -41,7 +42,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#define INST_INPUTS_LEN(n) DT_INST_PROP_LEN(n, input_gpios)
#define KSCAN_DIRECT_INPUT_CFG_INIT(idx, inst_idx) \
GPIO_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst_idx), input_gpios, idx)
KSCAN_GPIO_GET_BY_IDX(DT_DRV_INST(inst_idx), input_gpios, idx)
struct kscan_direct_irq_callback {
const struct device *dev;
@ -50,6 +51,7 @@ struct kscan_direct_irq_callback {
struct kscan_direct_data {
const struct device *dev;
struct kscan_gpio_list inputs;
kscan_callback_t callback;
struct k_work_delayable work;
#if USE_INTERRUPTS
@ -62,17 +64,7 @@ struct kscan_direct_data {
struct debounce_state *pin_state;
};
struct kscan_gpio_list {
const struct gpio_dt_spec *gpios;
size_t len;
};
/** Define a kscan_gpio_list from a compile-time GPIO array. */
#define KSCAN_GPIO_LIST(gpio_array) \
((struct kscan_gpio_list){.gpios = gpio_array, .len = ARRAY_SIZE(gpio_array)})
struct kscan_direct_config {
struct kscan_gpio_list inputs;
struct debounce_config debounce_config;
int32_t debounce_scan_period_ms;
int32_t poll_period_ms;
@ -81,10 +73,10 @@ struct kscan_direct_config {
#if USE_INTERRUPTS
static int kscan_direct_interrupt_configure(const struct device *dev, const gpio_flags_t flags) {
const struct kscan_direct_config *config = dev->config;
const struct kscan_direct_data *data = dev->data;
for (int i = 0; i < config->inputs.len; i++) {
const struct gpio_dt_spec *gpio = &config->inputs.gpios[i];
for (int i = 0; i < data->inputs.len; i++) {
const struct gpio_dt_spec *gpio = &data->inputs.gpios[i].spec;
int err = gpio_pin_interrupt_configure_dt(gpio, flags);
if (err) {
@ -134,16 +126,16 @@ static gpio_flags_t kscan_gpio_get_extra_flags(const struct gpio_dt_spec *gpio,
static int kscan_inputs_set_flags(const struct kscan_gpio_list *inputs,
const struct gpio_dt_spec *active_gpio) {
gpio_flags_t extra_flags;
for (int i = 0; i < inputs->len; i++) {
extra_flags = GPIO_INPUT | kscan_gpio_get_extra_flags(&inputs->gpios[i],
&inputs->gpios[i] == active_gpio);
const bool active = &inputs->gpios[i].spec == active_gpio;
const gpio_flags_t extra_flags =
GPIO_INPUT | kscan_gpio_get_extra_flags(&inputs->gpios[i].spec, active);
LOG_DBG("Extra flags equal to: %d", extra_flags);
int err = gpio_pin_configure_dt(&inputs->gpios[i], extra_flags);
int err = gpio_pin_configure_dt(&inputs->gpios[i].spec, extra_flags);
if (err) {
LOG_ERR("Unable to configure flags on pin %d on %s", inputs->gpios[i].pin,
inputs->gpios[i].port->name);
LOG_ERR("Unable to configure flags on pin %d on %s", inputs->gpios[i].spec.pin,
inputs->gpios[i].spec.port->name);
return err;
}
}
@ -179,28 +171,35 @@ static int kscan_direct_read(const struct device *dev) {
const struct kscan_direct_config *config = dev->config;
// Read the inputs.
for (int i = 0; i < config->inputs.len; i++) {
const struct gpio_dt_spec *gpio = &config->inputs.gpios[i];
struct kscan_gpio_port_state state = {0};
const bool active = gpio_pin_get_dt(gpio);
for (int i = 0; i < data->inputs.len; i++) {
const struct kscan_gpio *gpio = &data->inputs.gpios[i];
debounce_update(&data->pin_state[i], active, config->debounce_scan_period_ms,
const int active = kscan_gpio_pin_get(gpio, &state);
if (active < 0) {
LOG_ERR("Failed to read port %s: %i", gpio->spec.port->name, active);
return active;
}
debounce_update(&data->pin_state[gpio->index], active, config->debounce_scan_period_ms,
&config->debounce_config);
}
// Process the new state.
bool continue_scan = false;
for (int i = 0; i < config->inputs.len; i++) {
struct debounce_state *state = &data->pin_state[i];
for (int i = 0; i < data->inputs.len; i++) {
const struct kscan_gpio *gpio = &data->inputs.gpios[i];
struct debounce_state *state = &data->pin_state[gpio->index];
if (debounce_get_changed(state)) {
const bool pressed = debounce_is_pressed(state);
LOG_DBG("Sending event at 0,%i state %s", i, pressed ? "on" : "off");
data->callback(dev, 0, i, pressed);
LOG_DBG("Sending event at 0,%i state %s", gpio->index, pressed ? "on" : "off");
data->callback(dev, 0, gpio->index, pressed);
if (config->toggle_mode && pressed) {
kscan_inputs_set_flags(&config->inputs, &config->inputs.gpios[i]);
kscan_inputs_set_flags(&data->inputs, &gpio->spec);
}
}
@ -289,10 +288,11 @@ static int kscan_direct_init_input_inst(const struct device *dev, const struct g
}
static int kscan_direct_init_inputs(const struct device *dev) {
const struct kscan_direct_data *data = dev->data;
const struct kscan_direct_config *config = dev->config;
for (int i = 0; i < config->inputs.len; i++) {
const struct gpio_dt_spec *gpio = &config->inputs.gpios[i];
for (int i = 0; i < data->inputs.len; i++) {
const struct gpio_dt_spec *gpio = &data->inputs.gpios[i].spec;
int err = kscan_direct_init_input_inst(dev, gpio, i, config->toggle_mode);
if (err) {
return err;
@ -307,6 +307,9 @@ static int kscan_direct_init(const struct device *dev) {
data->dev = dev;
// Sort inputs by port so we can read each port just once per scan.
kscan_gpio_list_sort_by_port(&data->inputs);
kscan_direct_init_inputs(dev);
k_work_init_delayable(&data->work, kscan_direct_work_handler);
@ -326,7 +329,7 @@ static const struct kscan_driver_api kscan_direct_api = {
BUILD_ASSERT(INST_DEBOUNCE_RELEASE_MS(n) <= DEBOUNCE_COUNTER_MAX, \
"ZMK_KSCAN_DEBOUNCE_RELEASE_MS or debounce-release-ms is too large"); \
\
static const struct gpio_dt_spec kscan_direct_inputs_##n[] = { \
static struct kscan_gpio kscan_direct_inputs_##n[] = { \
LISTIFY(INST_INPUTS_LEN(n), KSCAN_DIRECT_INPUT_CFG_INIT, (, ), n)}; \
\
static struct debounce_state kscan_direct_state_##n[INST_INPUTS_LEN(n)]; \
@ -335,10 +338,11 @@ static const struct kscan_driver_api kscan_direct_api = {
(static struct kscan_direct_irq_callback kscan_direct_irqs_##n[INST_INPUTS_LEN(n)];)) \
\
static struct kscan_direct_data kscan_direct_data_##n = { \
.pin_state = kscan_direct_state_##n, COND_INTERRUPTS((.irqs = kscan_direct_irqs_##n, ))}; \
.inputs = KSCAN_GPIO_LIST(kscan_direct_inputs_##n), \
.pin_state = kscan_direct_state_##n, \
COND_INTERRUPTS((.irqs = kscan_direct_irqs_##n, ))}; \
\
static struct kscan_direct_config kscan_direct_config_##n = { \
.inputs = KSCAN_GPIO_LIST(kscan_direct_inputs_##n), \
.debounce_config = \
{ \
.debounce_press_ms = INST_DEBOUNCE_PRESS_MS(n), \

View file

@ -5,6 +5,7 @@
*/
#include "debounce.h"
#include "kscan_gpio.h"
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
@ -50,9 +51,9 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, pollcode, intcode)
#define KSCAN_GPIO_ROW_CFG_INIT(idx, inst_idx) \
GPIO_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst_idx), row_gpios, idx)
KSCAN_GPIO_GET_BY_IDX(DT_DRV_INST(inst_idx), row_gpios, idx)
#define KSCAN_GPIO_COL_CFG_INIT(idx, inst_idx) \
GPIO_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst_idx), col_gpios, idx)
KSCAN_GPIO_GET_BY_IDX(DT_DRV_INST(inst_idx), col_gpios, idx)
enum kscan_diode_direction {
KSCAN_ROW2COL,
@ -66,6 +67,7 @@ struct kscan_matrix_irq_callback {
struct kscan_matrix_data {
const struct device *dev;
struct kscan_gpio_list inputs;
kscan_callback_t callback;
struct k_work_delayable work;
#if USE_INTERRUPTS
@ -76,26 +78,16 @@ struct kscan_matrix_data {
int64_t scan_time;
/**
* Current state of the matrix as a flattened 2D array of length
* (config->rows.len * config->cols.len)
* (config->rows * config->cols)
*/
struct debounce_state *matrix_state;
};
struct kscan_gpio_list {
const struct gpio_dt_spec *gpios;
size_t len;
};
/** Define a kscan_gpio_list from a compile-time GPIO array. */
#define KSCAN_GPIO_LIST(gpio_array) \
((struct kscan_gpio_list){.gpios = gpio_array, .len = ARRAY_SIZE(gpio_array)})
struct kscan_matrix_config {
struct kscan_gpio_list rows;
struct kscan_gpio_list cols;
struct kscan_gpio_list inputs;
struct kscan_gpio_list outputs;
struct debounce_config debounce_config;
size_t rows;
size_t cols;
int32_t debounce_scan_period_ms;
int32_t poll_period_ms;
enum kscan_diode_direction diode_direction;
@ -105,10 +97,10 @@ struct kscan_matrix_config {
* Get the index into a matrix state array from a row and column.
*/
static int state_index_rc(const struct kscan_matrix_config *config, const int row, const int col) {
__ASSERT(row < config->rows.len, "Invalid row %i", row);
__ASSERT(col < config->cols.len, "Invalid column %i", col);
__ASSERT(row < config->rows, "Invalid row %i", row);
__ASSERT(col < config->cols, "Invalid column %i", col);
return (col * config->rows.len) + row;
return (col * config->rows) + row;
}
/**
@ -125,7 +117,7 @@ static int kscan_matrix_set_all_outputs(const struct device *dev, const int valu
const struct kscan_matrix_config *config = dev->config;
for (int i = 0; i < config->outputs.len; i++) {
const struct gpio_dt_spec *gpio = &config->outputs.gpios[i];
const struct gpio_dt_spec *gpio = &config->outputs.gpios[i].spec;
int err = gpio_pin_set_dt(gpio, value);
if (err) {
@ -139,10 +131,10 @@ static int kscan_matrix_set_all_outputs(const struct device *dev, const int valu
#if USE_INTERRUPTS
static int kscan_matrix_interrupt_configure(const struct device *dev, const gpio_flags_t flags) {
const struct kscan_matrix_config *config = dev->config;
const struct kscan_matrix_data *data = dev->data;
for (int i = 0; i < config->inputs.len; i++) {
const struct gpio_dt_spec *gpio = &config->inputs.gpios[i];
for (int i = 0; i < data->inputs.len; i++) {
const struct gpio_dt_spec *gpio = &data->inputs.gpios[i].spec;
int err = gpio_pin_interrupt_configure_dt(gpio, flags);
if (err) {
@ -226,32 +218,37 @@ static int kscan_matrix_read(const struct device *dev) {
const struct kscan_matrix_config *config = dev->config;
// Scan the matrix.
for (int o = 0; o < config->outputs.len; o++) {
const struct gpio_dt_spec *out_gpio = &config->outputs.gpios[o];
for (int i = 0; i < config->outputs.len; i++) {
const struct kscan_gpio *out_gpio = &config->outputs.gpios[i];
int err = gpio_pin_set_dt(out_gpio, 1);
int err = gpio_pin_set_dt(&out_gpio->spec, 1);
if (err) {
LOG_ERR("Failed to set output %i active: %i", o, err);
LOG_ERR("Failed to set output %i active: %i", out_gpio->index, err);
return err;
}
#if CONFIG_ZMK_KSCAN_MATRIX_WAIT_BEFORE_INPUTS > 0
k_busy_wait(CONFIG_ZMK_KSCAN_MATRIX_WAIT_BEFORE_INPUTS);
#endif
struct kscan_gpio_port_state state = {0};
for (int i = 0; i < config->inputs.len; i++) {
const struct gpio_dt_spec *in_gpio = &config->inputs.gpios[i];
for (int j = 0; j < data->inputs.len; j++) {
const struct kscan_gpio *in_gpio = &data->inputs.gpios[j];
const int index = state_index_io(config, i, o);
const bool active = gpio_pin_get_dt(in_gpio);
const int index = state_index_io(config, in_gpio->index, out_gpio->index);
const int active = kscan_gpio_pin_get(in_gpio, &state);
if (active < 0) {
LOG_ERR("Failed to read port %s: %i", in_gpio->spec.port->name, active);
return active;
}
debounce_update(&data->matrix_state[index], active, config->debounce_scan_period_ms,
&config->debounce_config);
}
err = gpio_pin_set_dt(out_gpio, 0);
err = gpio_pin_set_dt(&out_gpio->spec, 0);
if (err) {
LOG_ERR("Failed to set output %i inactive: %i", o, err);
LOG_ERR("Failed to set output %i inactive: %i", out_gpio->index, err);
return err;
}
@ -263,8 +260,8 @@ static int kscan_matrix_read(const struct device *dev) {
// Process the new state.
bool continue_scan = false;
for (int r = 0; r < config->rows.len; r++) {
for (int c = 0; c < config->cols.len; c++) {
for (int r = 0; r < config->rows; r++) {
for (int c = 0; c < config->cols; c++) {
const int index = state_index_rc(config, r, c);
struct debounce_state *state = &data->matrix_state[index];
@ -329,28 +326,28 @@ static int kscan_matrix_disable(const struct device *dev) {
#endif
}
static int kscan_matrix_init_input_inst(const struct device *dev, const struct gpio_dt_spec *gpio,
const int index) {
if (!device_is_ready(gpio->port)) {
LOG_ERR("GPIO is not ready: %s", gpio->port->name);
static int kscan_matrix_init_input_inst(const struct device *dev, const struct kscan_gpio *gpio) {
if (!device_is_ready(gpio->spec.port)) {
LOG_ERR("GPIO is not ready: %s", gpio->spec.port->name);
return -ENODEV;
}
int err = gpio_pin_configure_dt(gpio, GPIO_INPUT);
int err = gpio_pin_configure_dt(&gpio->spec, GPIO_INPUT);
if (err) {
LOG_ERR("Unable to configure pin %u on %s for input", gpio->pin, gpio->port->name);
LOG_ERR("Unable to configure pin %u on %s for input", gpio->spec.pin,
gpio->spec.port->name);
return err;
}
LOG_DBG("Configured pin %u on %s for input", gpio->pin, gpio->port->name);
LOG_DBG("Configured pin %u on %s for input", gpio->spec.pin, gpio->spec.port->name);
#if USE_INTERRUPTS
struct kscan_matrix_data *data = dev->data;
struct kscan_matrix_irq_callback *irq = &data->irqs[index];
struct kscan_matrix_irq_callback *irq = &data->irqs[gpio->index];
irq->dev = dev;
gpio_init_callback(&irq->callback, kscan_matrix_irq_callback_handler, BIT(gpio->pin));
err = gpio_add_callback(gpio->port, &irq->callback);
gpio_init_callback(&irq->callback, kscan_matrix_irq_callback_handler, BIT(gpio->spec.pin));
err = gpio_add_callback(gpio->spec.port, &irq->callback);
if (err) {
LOG_ERR("Error adding the callback to the input device: %i", err);
return err;
@ -361,11 +358,11 @@ static int kscan_matrix_init_input_inst(const struct device *dev, const struct g
}
static int kscan_matrix_init_inputs(const struct device *dev) {
const struct kscan_matrix_config *config = dev->config;
const struct kscan_matrix_data *data = dev->data;
for (int i = 0; i < config->inputs.len; i++) {
const struct gpio_dt_spec *gpio = &config->inputs.gpios[i];
int err = kscan_matrix_init_input_inst(dev, gpio, i);
for (int i = 0; i < data->inputs.len; i++) {
const struct kscan_gpio *gpio = &data->inputs.gpios[i];
int err = kscan_matrix_init_input_inst(dev, gpio);
if (err) {
return err;
}
@ -396,7 +393,7 @@ static int kscan_matrix_init_outputs(const struct device *dev) {
const struct kscan_matrix_config *config = dev->config;
for (int i = 0; i < config->outputs.len; i++) {
const struct gpio_dt_spec *gpio = &config->outputs.gpios[i];
const struct gpio_dt_spec *gpio = &config->outputs.gpios[i].spec;
int err = kscan_matrix_init_output_inst(dev, gpio);
if (err) {
return err;
@ -411,6 +408,9 @@ static int kscan_matrix_init(const struct device *dev) {
data->dev = dev;
// Sort inputs by port so we can read each port just once per scan.
kscan_gpio_list_sort_by_port(&data->inputs);
kscan_matrix_init_inputs(dev);
kscan_matrix_init_outputs(dev);
kscan_matrix_set_all_outputs(dev, 0);
@ -432,10 +432,10 @@ static const struct kscan_driver_api kscan_matrix_api = {
BUILD_ASSERT(INST_DEBOUNCE_RELEASE_MS(n) <= DEBOUNCE_COUNTER_MAX, \
"ZMK_KSCAN_DEBOUNCE_RELEASE_MS or debounce-release-ms is too large"); \
\
static const struct gpio_dt_spec kscan_matrix_rows_##n[] = { \
static struct kscan_gpio kscan_matrix_rows_##n[] = { \
LISTIFY(INST_ROWS_LEN(n), KSCAN_GPIO_ROW_CFG_INIT, (, ), n)}; \
\
static const struct gpio_dt_spec kscan_matrix_cols_##n[] = { \
static struct kscan_gpio kscan_matrix_cols_##n[] = { \
LISTIFY(INST_COLS_LEN(n), KSCAN_GPIO_COL_CFG_INIT, (, ), n)}; \
\
static struct debounce_state kscan_matrix_state_##n[INST_MATRIX_LEN(n)]; \
@ -444,14 +444,14 @@ static const struct kscan_driver_api kscan_matrix_api = {
(static struct kscan_matrix_irq_callback kscan_matrix_irqs_##n[INST_INPUTS_LEN(n)];)) \
\
static struct kscan_matrix_data kscan_matrix_data_##n = { \
.inputs = \
KSCAN_GPIO_LIST(COND_DIODE_DIR(n, (kscan_matrix_cols_##n), (kscan_matrix_rows_##n))), \
.matrix_state = kscan_matrix_state_##n, \
COND_INTERRUPTS((.irqs = kscan_matrix_irqs_##n, ))}; \
\
static struct kscan_matrix_config kscan_matrix_config_##n = { \
.rows = KSCAN_GPIO_LIST(kscan_matrix_rows_##n), \
.cols = KSCAN_GPIO_LIST(kscan_matrix_cols_##n), \
.inputs = \
KSCAN_GPIO_LIST(COND_DIODE_DIR(n, (kscan_matrix_cols_##n), (kscan_matrix_rows_##n))), \
.rows = ARRAY_SIZE(kscan_matrix_rows_##n), \
.cols = ARRAY_SIZE(kscan_matrix_cols_##n), \
.outputs = \
KSCAN_GPIO_LIST(COND_DIODE_DIR(n, (kscan_matrix_rows_##n), (kscan_matrix_cols_##n))), \
.debounce_config = \

View file

@ -15,7 +15,7 @@
#if ZMK_BLE_IS_CENTRAL
#define ZMK_BLE_PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1)
#define ZMK_BLE_SPLIT_PERIPHERAL_COUNT 1
#define ZMK_SPLIT_BLE_PERIPHERAL_COUNT 1
#else
#define ZMK_BLE_PROFILE_COUNT CONFIG_BT_MAX_PAIRED
#endif

View file

@ -122,6 +122,7 @@ void set_profile_address(uint8_t index, const bt_addr_le_t *addr) {
bool zmk_ble_active_profile_is_connected() {
struct bt_conn *conn;
struct bt_conn_info info;
bt_addr_le_t *addr = zmk_ble_active_profile_addr();
if (!bt_addr_le_cmp(addr, BT_ADDR_LE_ANY)) {
return false;
@ -129,9 +130,11 @@ bool zmk_ble_active_profile_is_connected() {
return false;
}
bt_conn_get_info(conn, &info);
bt_conn_unref(conn);
return true;
return info.state == BT_CONN_STATE_CONNECTED;
}
#define CHECKED_ADV_STOP() \

View file

@ -6,9 +6,8 @@ menuconfig ZMK_DISPLAY
default n
select DISPLAY
select LVGL
select LV_THEMES
select LV_THEME_MONO
select LV_CONF_MINIMAL
imply LV_USE_THEME_MONO
if ZMK_DISPLAY
@ -16,6 +15,13 @@ config ZMK_DISPLAY_BLANK_ON_IDLE
bool "Blank display on idle"
default y if SSD1306
if LV_USE_THEME_MONO
config ZMK_DISPLAY_INVERT
bool "Invert display colors"
endif
choice LV_TXT_ENC
default LV_TXT_ENC_UTF8

View file

@ -91,7 +91,8 @@ int zmk_display_is_initialized() { return initialized; }
static void initialize_theme() {
#if IS_ENABLED(CONFIG_LV_USE_THEME_MONO)
lv_disp_t *disp = lv_disp_get_default();
lv_theme_t *theme = lv_theme_mono_init(disp, false, CONFIG_LV_FONT_DEFAULT);
lv_theme_t *theme =
lv_theme_mono_init(disp, IS_ENABLED(CONFIG_ZMK_DISPLAY_INVERT), CONFIG_LV_FONT_DEFAULT);
theme->font_small = CONFIG_ZMK_LV_FONT_DEFAULT_SMALL;
disp->theme = theme;

View file

@ -218,7 +218,7 @@ int zmk_keymap_apply_position_state(uint8_t source, int layer, uint32_t position
#endif
case BEHAVIOR_LOCALITY_GLOBAL:
#if ZMK_BLE_IS_CENTRAL
for (int i = 0; i < ZMK_BLE_SPLIT_PERIPHERAL_COUNT; i++) {
for (int i = 0; i < ZMK_SPLIT_BLE_PERIPHERAL_COUNT; i++) {
zmk_split_bt_invoke_behavior(i, &binding, event, pressed);
}
#endif

View file

@ -190,7 +190,10 @@ static void zmk_rgb_underglow_tick(struct k_work *work) {
break;
}
led_strip_update_rgb(led_strip, pixels, STRIP_NUM_PIXELS);
int err = led_strip_update_rgb(led_strip, pixels, STRIP_NUM_PIXELS);
if (err < 0) {
LOG_ERR("Failed to update the RGB strip (%d)", err);
}
}
K_WORK_DEFINE(underglow_work, zmk_rgb_underglow_tick);

View file

@ -21,11 +21,11 @@ config ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE
int "Max number of key position state events to queue when received from peripherals"
default 5
config ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_STACK_SIZE
config ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE
int "BLE split central write thread stack size"
default 512
config ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_QUEUE_SIZE
config ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_QUEUE_SIZE
int "Max number of behavior run events to queue to send to the peripheral(s)"
default 5

View file

@ -47,7 +47,7 @@ struct peripheral_slot {
uint8_t changed_positions[POSITION_STATE_DATA_LEN];
};
static struct peripheral_slot peripherals[ZMK_BLE_SPLIT_PERIPHERAL_COUNT];
static struct peripheral_slot peripherals[ZMK_SPLIT_BLE_PERIPHERAL_COUNT];
static const struct bt_uuid_128 split_service_uuid = BT_UUID_INIT_128(ZMK_SPLIT_BT_SERVICE_UUID);
@ -65,7 +65,7 @@ void peripheral_event_work_callback(struct k_work *work) {
K_WORK_DEFINE(peripheral_event_work, peripheral_event_work_callback);
int peripheral_slot_index_for_conn(struct bt_conn *conn) {
for (int i = 0; i < ZMK_BLE_SPLIT_PERIPHERAL_COUNT; i++) {
for (int i = 0; i < ZMK_SPLIT_BLE_PERIPHERAL_COUNT; i++) {
if (peripherals[i].conn == conn) {
return i;
}
@ -84,7 +84,7 @@ struct peripheral_slot *peripheral_slot_for_conn(struct bt_conn *conn) {
}
int release_peripheral_slot(int index) {
if (index < 0 || index >= ZMK_BLE_SPLIT_PERIPHERAL_COUNT) {
if (index < 0 || index >= ZMK_SPLIT_BLE_PERIPHERAL_COUNT) {
return -EINVAL;
}
@ -131,7 +131,7 @@ int release_peripheral_slot(int index) {
}
int reserve_peripheral_slot() {
for (int i = 0; i < ZMK_BLE_SPLIT_PERIPHERAL_COUNT; i++) {
for (int i = 0; i < ZMK_SPLIT_BLE_PERIPHERAL_COUNT; i++) {
if (peripherals[i].state == PERIPHERAL_SLOT_STATE_OPEN) {
// Be sure the slot is fully reinitialized.
release_peripheral_slot(i);
@ -504,7 +504,7 @@ static struct bt_conn_cb conn_callbacks = {
};
K_THREAD_STACK_DEFINE(split_central_split_run_q_stack,
CONFIG_ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_STACK_SIZE);
CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE);
struct k_work_q split_central_split_run_q;
@ -515,7 +515,7 @@ struct zmk_split_run_behavior_payload_wrapper {
K_MSGQ_DEFINE(zmk_split_central_split_run_msgq,
sizeof(struct zmk_split_run_behavior_payload_wrapper),
CONFIG_ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_QUEUE_SIZE, 4);
CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_QUEUE_SIZE, 4);
void split_central_split_run_callback(struct k_work *work) {
struct zmk_split_run_behavior_payload_wrapper payload_wrapper;

View file

@ -17,12 +17,15 @@ Definition files:
| Config | Type | Description | Default |
| -------------------------------------------------- | ---- | -------------------------------------------------------------- | ------- |
| `CONFIG_ZMK_DISPLAY` | bool | Enable support for displays | n |
| `CONFIG_ZMK_DISPLAY_INVERT` | bool | Invert display colors from black-on-white to white-on-black | n |
| `CONFIG_ZMK_WIDGET_LAYER_STATUS` | bool | Enable a widget to show the highest, active layer | y |
| `CONFIG_ZMK_WIDGET_BATTERY_STATUS` | bool | Enable a widget to show battery charge information | y |
| `CONFIG_ZMK_WIDGET_BATTERY_STATUS_SHOW_PERCENTAGE` | bool | If battery widget is enabled, show percentage instead of icons | n |
| `CONFIG_ZMK_WIDGET_OUTPUT_STATUS` | bool | Enable a widget to show the current output (USB/BLE) | y |
| `CONFIG_ZMK_WIDGET_WPM_STATUS` | bool | Enable a widget to show words per minute | n |
Note that `CONFIG_ZMK_DISPLAY_INVERT` setting might not work as expected with custom status screens that utilize images.
If `CONFIG_ZMK_DISPLAY` is enabled, exactly zero or one of the following options must be set to `y`. The first option is used if none are set.
| Config | Description |

View file

@ -97,8 +97,8 @@ Following split keyboard settings are defined in [zmk/app/src/split/Kconfig](htt
| `CONFIG_ZMK_SPLIT_BLE` | bool | Use BLE to communicate between split keyboard halves | y |
| `CONFIG_ZMK_SPLIT_ROLE_CENTRAL` | bool | `y` for central device, `n` for peripheral | |
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue when received from peripherals | 5 |
| `CONFIG_ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_STACK_SIZE` | int | Stack size of the BLE split central write thread | 512 |
| `CONFIG_ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_QUEUE_SIZE` | int | Max number of behavior run events to queue to send to the peripheral(s) | 5 |
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE` | int | Stack size of the BLE split central write thread | 512 |
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_QUEUE_SIZE` | int | Max number of behavior run events to queue to send to the peripheral(s) | 5 |
| `CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE` | int | Stack size of the BLE split peripheral notify thread | 650 |
| `CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_PRIORITY` | int | Priority of the BLE split peripheral notify thread | 5 |
| `CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue to send to the central | 10 |

View file

@ -99,8 +99,6 @@ one millisecond of latency but protects against short noise spikes.
ZMK's default debouncing is similar to QMK's `sym_defer_pk` algorithm.
Setting `CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS=0` for eager debouncing would be similar
to QMK's (unimplemented as of this writing) `asym_eager_defer_pk`.
Setting `CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS=0` for eager debouncing would be similar to QMK's `asym_eager_defer_pk`.
See [QMK's Debounce API documentation](https://beta.docs.qmk.fm/using-qmk/software-features/feature_debounce_type)
for more information.
See [QMK's Debounce API documentation](https://docs.qmk.fm/#/feature_debounce_type) for more information.

2785
docs/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,11 +15,11 @@
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "^2.1.0",
"@docusaurus/preset-classic": "^2.1.0",
"@fortawesome/fontawesome-svg-core": "^1.2.32",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.18",
"@docusaurus/core": "^2.4.0",
"@docusaurus/preset-classic": "^2.4.0",
"@fortawesome/fontawesome-svg-core": "^6.4.0",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@mdx-js/react": "^1.6.22",
"classnames": "^2.2.6",
"js-yaml": "^4.1.0",
@ -28,7 +28,7 @@
"react-copy-to-clipboard": "^5.0.3",
"react-dom": "^17.0.2",
"react-toastify": "^7.0.4",
"web-tree-sitter": "^0.19.4"
"web-tree-sitter": "^0.20.8"
},
"browserslist": {
"production": [
@ -43,24 +43,24 @@
]
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.1.0",
"@docusaurus/types": "^2.1.0",
"@tsconfig/docusaurus": "^1.0.5",
"@docusaurus/module-type-aliases": "^2.4.0",
"@docusaurus/types": "^2.4.0",
"@tsconfig/docusaurus": "^1.0.7",
"@types/js-yaml": "^4.0.5",
"@types/react": "^17.0.3",
"@types/react-helmet": "^6.1.5",
"@types/react": "^17.0.58",
"@types/react-helmet": "^6.1.6",
"@types/react-router-dom": "^5.1.7",
"eslint": "^8.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-mdx": "^2.0.5",
"eslint-plugin-react": "^7.30.0",
"json-schema-to-typescript": "^10.1.5",
"eslint-plugin-react": "^7.32.2",
"json-schema-to-typescript": "^12.0.0",
"mustache": "^4.2.0",
"null-loader": "^4.0.0",
"prebuild-webpack-plugin": "^1.1.1",
"prettier": "^2.8.7",
"string-replace-loader": "^3.1.0",
"typescript": "^4.6.3",
"webpack": "^5.72.1"
"typescript": "^5.0.4",
"webpack": "^5.80.0"
}
}

View file

@ -15,7 +15,7 @@ function mapInterconnect(interconnect: Interconnect) {
let imageUrl = require(`@site/docs/assets/interconnects/${interconnect.id}/pinout.png`);
return (
<TabItem value={interconnect.id}>
<TabItem value={interconnect.id} key={interconnect.id}>
<img src={imageUrl.default} />
<content.default />

View file

@ -16,36 +16,6 @@ module.exports = function () {
test: /web-tree-sitter/,
loader: "null-loader",
});
} else {
// The way web-tree-sitter loads tree-sitter.wasm isn't something that
// Docusaurus/Webpack identify as an asset. There is currently no way to
// set location of the file other than patching web-tree-sitter.
// (see https://github.com/tree-sitter/tree-sitter/issues/559)
rules.push({
test: /tree-sitter\.js$/,
loader: "string-replace-loader",
options: {
multiple: [
// Replace the path to tree-sitter.wasm with a "new URL()" to clue
// Webpack in that it is an asset.
{
search: '"tree-sitter.wasm"',
replace: '(new URL("tree-sitter.wasm", import.meta.url)).href',
strict: true,
},
// Webpack replaces "new URL()" with the full URL to the asset, but
// web-tree-sitter will still add a prefix to it unless there is a
// Module.locateFile() function.
{
search: "var Module=void 0!==Module?Module:{};",
replace: `var Module = {
locateFile: (path, prefix) => path.startsWith('http') ? path : prefix + path,
};`,
strict: true,
},
],
},
});
}
return {

View file

@ -2,10 +2,23 @@ import Parser from "web-tree-sitter";
import { Codes, Behaviors } from "./data/keymap-upgrade";
const TREE_SITTER_WASM_URL = new URL(
"/node_modules/web-tree-sitter/tree-sitter.wasm",
import.meta.url
);
let Devicetree;
export async function initParser() {
await Parser.init();
await Parser.init({
locateFile: (path, prefix) => {
// When locating tree-sitter.wasm, use a path that Webpack can map to the correct URL.
if (path == "tree-sitter.wasm") {
return TREE_SITTER_WASM_URL.href;
}
return prefix + path;
},
});
Devicetree = await Parser.Language.load("/tree-sitter-devicetree.wasm");
}

Binary file not shown.

View file

@ -3,7 +3,7 @@
"include": ["src/"],
"compilerOptions": {
"types": ["node", "@docusaurus/theme-classic"],
"moduleResolution": "Node",
"moduleResolution": "Node16",
"esModuleInterop": true,
"resolveJsonModule": true,
"strict": true,