Merge branch 'main' into advantage360

This commit is contained in:
ReFil 2023-05-23 12:16:52 +01:00
commit abf32a69dd
26 changed files with 1801 additions and 1446 deletions

View file

@ -39,8 +39,8 @@ jobs:
- name: Fetch Build Matrix - name: Fetch Build Matrix
run: | run: |
echo "build_matrix=$(yaml2json ${{ inputs.build_matrix_path }} | jq -c .)" >> $GITHUB_ENV echo "build_matrix=$(yaml2json '${{ inputs.build_matrix_path }}' | jq -c .)" >> $GITHUB_ENV
yaml2json ${{ inputs.build_matrix_path }} | jq yaml2json "${{ inputs.build_matrix_path }}" | jq
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -54,18 +54,13 @@ jobs:
steps: steps:
- name: Prepare variables - name: Prepare variables
shell: sh -x {0} shell: sh -x {0}
env:
shield: ${{ matrix.shield }}
run: | 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 "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 - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -89,7 +84,7 @@ jobs:
${{ runner.os }}- ${{ runner.os }}-
- name: West Init - name: West Init
run: west init -l ${{ inputs.config_path }} run: west init -l "${{ inputs.config_path }}"
- name: West Update - name: West Update
run: west update run: west update
@ -99,7 +94,7 @@ jobs:
- name: West Build (${{ env.display_name }}) - name: West Build (${{ env.display_name }})
shell: sh -x {0} 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 - name: ${{ env.display_name }} Kconfig file
run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort 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" cp build/zephyr/zmk.uf2 "build/artifacts/${{ env.artifact_name }}.uf2"
elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ] elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ]
then 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 fi
- name: Archive (${{ env.display_name }}) - 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", "*.overlay": "dts",
"*.keymap": "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 { &i2c0 {
compatible = "nordic,nrf-twim"; compatible = "nordic,nrf-twi";
pinctrl-0 = <&i2c0_default>; pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>; pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep"; pinctrl-names = "default", "sleep";
@ -71,6 +71,7 @@
&uart0 { &uart0 {
compatible = "nordic,nrf-uarte"; compatible = "nordic,nrf-uarte";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>; pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>; pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep"; pinctrl-names = "default", "sleep";

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -91,7 +91,8 @@ int zmk_display_is_initialized() { return initialized; }
static void initialize_theme() { static void initialize_theme() {
#if IS_ENABLED(CONFIG_LV_USE_THEME_MONO) #if IS_ENABLED(CONFIG_LV_USE_THEME_MONO)
lv_disp_t *disp = lv_disp_get_default(); 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; theme->font_small = CONFIG_ZMK_LV_FONT_DEFAULT_SMALL;
disp->theme = theme; disp->theme = theme;

View file

@ -17,12 +17,15 @@ Definition files:
| Config | Type | Description | Default | | Config | Type | Description | Default |
| -------------------------------------------------- | ---- | -------------------------------------------------------------- | ------- | | -------------------------------------------------- | ---- | -------------------------------------------------------------- | ------- |
| `CONFIG_ZMK_DISPLAY` | bool | Enable support for displays | n | | `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_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` | 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_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_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 | | `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. 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 | | Config | Description |

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. 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 Setting `CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS=0` for eager debouncing would be similar to QMK's `asym_eager_defer_pk`.
to QMK's (unimplemented as of this writing) `asym_eager_defer_pk`.
See [QMK's Debounce API documentation](https://beta.docs.qmk.fm/using-qmk/software-features/feature_debounce_type) See [QMK's Debounce API documentation](https://docs.qmk.fm/#/feature_debounce_type) for more information.
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" "typecheck": "tsc"
}, },
"dependencies": { "dependencies": {
"@docusaurus/core": "^2.1.0", "@docusaurus/core": "^2.4.0",
"@docusaurus/preset-classic": "^2.1.0", "@docusaurus/preset-classic": "^2.4.0",
"@fortawesome/fontawesome-svg-core": "^1.2.32", "@fortawesome/fontawesome-svg-core": "^6.4.0",
"@fortawesome/free-solid-svg-icons": "^5.15.3", "@fortawesome/free-solid-svg-icons": "^6.4.0",
"@fortawesome/react-fontawesome": "^0.1.18", "@fortawesome/react-fontawesome": "^0.2.0",
"@mdx-js/react": "^1.6.22", "@mdx-js/react": "^1.6.22",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
@ -28,7 +28,7 @@
"react-copy-to-clipboard": "^5.0.3", "react-copy-to-clipboard": "^5.0.3",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-toastify": "^7.0.4", "react-toastify": "^7.0.4",
"web-tree-sitter": "^0.19.4" "web-tree-sitter": "^0.20.8"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [
@ -43,24 +43,24 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@docusaurus/module-type-aliases": "^2.1.0", "@docusaurus/module-type-aliases": "^2.4.0",
"@docusaurus/types": "^2.1.0", "@docusaurus/types": "^2.4.0",
"@tsconfig/docusaurus": "^1.0.5", "@tsconfig/docusaurus": "^1.0.7",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@types/react": "^17.0.3", "@types/react": "^17.0.58",
"@types/react-helmet": "^6.1.5", "@types/react-helmet": "^6.1.6",
"@types/react-router-dom": "^5.1.7", "@types/react-router-dom": "^5.1.7",
"eslint": "^8.0.0", "eslint": "^8.39.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.8.0",
"eslint-plugin-mdx": "^2.0.5", "eslint-plugin-mdx": "^2.0.5",
"eslint-plugin-react": "^7.30.0", "eslint-plugin-react": "^7.32.2",
"json-schema-to-typescript": "^10.1.5", "json-schema-to-typescript": "^12.0.0",
"mustache": "^4.2.0", "mustache": "^4.2.0",
"null-loader": "^4.0.0", "null-loader": "^4.0.0",
"prebuild-webpack-plugin": "^1.1.1", "prebuild-webpack-plugin": "^1.1.1",
"prettier": "^2.8.7", "prettier": "^2.8.7",
"string-replace-loader": "^3.1.0", "string-replace-loader": "^3.1.0",
"typescript": "^4.6.3", "typescript": "^5.0.4",
"webpack": "^5.72.1" "webpack": "^5.80.0"
} }
} }

View file

@ -16,36 +16,6 @@ module.exports = function () {
test: /web-tree-sitter/, test: /web-tree-sitter/,
loader: "null-loader", 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 { return {

View file

@ -2,10 +2,23 @@ import Parser from "web-tree-sitter";
import { Codes, Behaviors } from "./data/keymap-upgrade"; 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; let Devicetree;
export async function initParser() { 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"); Devicetree = await Parser.Language.load("/tree-sitter-devicetree.wasm");
} }

Binary file not shown.

View file

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