diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c2d1992d..5a05bcac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,12 @@ on: schedule: - cron: "22 4 * * *" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'schedule' }} + cancel-in-progress: true + +permissions: {} + jobs: build: if: ${{ always() }} @@ -25,6 +31,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + persist-credentials: false - name: Cache west modules uses: actions/cache@v4 env: @@ -71,7 +79,7 @@ jobs: try { console.log(`::group::${{ matrix.board}} ${shieldArgs.shield} Build`) - const output = execSync(`west build -s app -p -b ${{ matrix.board }} -- ${shieldArgs.shield ? '-DSHIELD="' + shieldArgs.shield + '"' : ''} ${shieldArgs['cmake-args'] || ''}`); + const output = execSync(`west build -s app -p -b ${{ matrix.board }} ${shieldArgs.snippet ? '-S ' + shieldArgs.snippet : ''} -- ${shieldArgs.shield ? '-DSHIELD="' + shieldArgs.shield + '"' : ''} ${shieldArgs['cmake-args'] || ''}`); console.log(output.toString()); } catch (e) { @@ -131,7 +139,7 @@ jobs: throw new Error('Failed to build one or more configurations'); } compile-matrix: - if: ${{ always() }} + if: ${{ !cancelled() }} runs-on: ubuntu-latest needs: [core-coverage, board-changes, nightly] outputs: @@ -162,6 +170,7 @@ jobs: perBoard[configuration.board].push({ shield: configuration.shield, 'cmake-args': configuration['cmake-args'], + snippet: configuration.snippet, nickname: configuration.nickname }) } @@ -179,6 +188,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + persist-credentials: false - name: Use Node.js uses: actions/setup-node@v4 with: @@ -284,7 +295,7 @@ jobs: }); }))).flat(); nightly: - if: ${{ github.event_name == 'schedule' }} + if: ${{ github.event_name == 'schedule' && github.repository_owner == 'zmkfirmware' }} runs-on: ubuntu-latest needs: get-grouped-hardware outputs: @@ -335,6 +346,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + persist-credentials: false - name: Use Node.js uses: actions/setup-node@v4 with: @@ -413,7 +426,11 @@ jobs: board-changes: ${{ steps.board-changes.outputs.result }} core-changes: ${{ steps.core-changes.outputs.result }} steps: - - uses: tj-actions/changed-files@v42 + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: tj-actions/changed-files@v44 id: changed-files with: json: true diff --git a/.github/workflows/hardware-metadata-validation.yml b/.github/workflows/hardware-metadata-validation.yml index 716cd976..3e3faa0d 100644 --- a/.github/workflows/hardware-metadata-validation.yml +++ b/.github/workflows/hardware-metadata-validation.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install dependencies - run: pip install -r app/scripts/requirements.txt + run: pip install --break-system-packages -r app/scripts/requirements.txt - name: West init run: west init -l app - name: Update modules (west update) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 7a4c211e..cc9672f4 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -12,4 +12,4 @@ jobs: - uses: actions/setup-python@v5 with: python-version: 3.x - - uses: pre-commit/action@v3.0.0 + - uses: pre-commit/action@v3.0.1 diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 0819f71e..7a1eac2a 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,6 +4,7 @@ "ms-python.python", "ms-vscode.cpptools", "plorefice.devicetree", - "twxs.cmake" + "twxs.cmake", + "unifiedjs.vscode-mdx" ] } diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 7d7fa6b1..a5778e51 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -11,6 +11,10 @@ project(zmk) zephyr_linker_sources(SECTIONS include/linker/zmk-behaviors.ld) zephyr_linker_sources(RODATA include/linker/zmk-events.ld) +if(CONFIG_ZMK_BEHAVIOR_LOCAL_IDS) + zephyr_linker_sources(DATA_SECTIONS include/linker/zmk-behavior-local-id-map.ld) +endif() + zephyr_syscall_header(${APPLICATION_SOURCE_DIR}/include/drivers/behavior.h) zephyr_syscall_header(${APPLICATION_SOURCE_DIR}/include/drivers/ext_power.h) @@ -20,9 +24,9 @@ target_include_directories(app PRIVATE include) target_sources(app PRIVATE src/stdlib.c) target_sources(app PRIVATE src/activity.c) target_sources(app PRIVATE src/behavior.c) -target_sources(app PRIVATE src/kscan.c) target_sources_ifdef(CONFIG_ZMK_KSCAN_SIDEBAND_BEHAVIORS app PRIVATE src/kscan_sideband_behaviors.c) target_sources(app PRIVATE src/matrix_transform.c) +target_sources(app PRIVATE src/physical_layouts.c) target_sources(app PRIVATE src/sensors.c) target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/wpm.c) target_sources(app PRIVATE src/event_manager.c) @@ -43,8 +47,8 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL) target_sources_ifdef(CONFIG_ZMK_MOUSE app PRIVATE src/mouse.c) target_sources(app PRIVATE src/behaviors/behavior_key_press.c) target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_KEY_TOGGLE app PRIVATE src/behaviors/behavior_key_toggle.c) - target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c) - target_sources(app PRIVATE src/behaviors/behavior_sticky_key.c) + target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_HOLD_TAP app PRIVATE src/behaviors/behavior_hold_tap.c) + target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_STICKY_KEY app PRIVATE src/behaviors/behavior_sticky_key.c) target_sources(app PRIVATE src/behaviors/behavior_caps_word.c) target_sources(app PRIVATE src/behaviors/behavior_key_repeat.c) target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_MACRO app PRIVATE src/behaviors/behavior_macro.c) @@ -60,6 +64,7 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL) target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_SENSOR_ROTATE_VAR app PRIVATE src/behaviors/behavior_sensor_rotate_var.c) target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_SENSOR_ROTATE_COMMON app PRIVATE src/behaviors/behavior_sensor_rotate_common.c) target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_MOUSE_KEY_PRESS app PRIVATE src/behaviors/behavior_mouse_key_press.c) + target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_STUDIO_UNLOCK app PRIVATE src/behaviors/behavior_studio_unlock.c) target_sources(app PRIVATE src/combo.c) target_sources(app PRIVATE src/behaviors/behavior_tap_dance.c) target_sources(app PRIVATE src/behavior_queue.c) @@ -102,4 +107,27 @@ target_sources(app PRIVATE src/main.c) add_subdirectory(src/display/) add_subdirectory_ifdef(CONFIG_SETTINGS src/settings/) +if (CONFIG_ZMK_STUDIO_RPC) + # For some reason this is failing if run from a different sub-file. + list(APPEND CMAKE_MODULE_PATH ${ZEPHYR_BASE}/modules/nanopb) + + include(nanopb) + + # Turn off the default nanopb behavior + set(NANOPB_GENERATE_CPP_STANDALONE OFF) + + nanopb_generate_cpp(proto_srcs proto_hdrs RELPATH ${ZEPHYR_ZMK_STUDIO_MESSAGES_MODULE_DIR} + ${ZEPHYR_ZMK_STUDIO_MESSAGES_MODULE_DIR}/proto/zmk/studio.proto + ${ZEPHYR_ZMK_STUDIO_MESSAGES_MODULE_DIR}/proto/zmk/meta.proto + ${ZEPHYR_ZMK_STUDIO_MESSAGES_MODULE_DIR}/proto/zmk/core.proto + ${ZEPHYR_ZMK_STUDIO_MESSAGES_MODULE_DIR}/proto/zmk/behaviors.proto + ${ZEPHYR_ZMK_STUDIO_MESSAGES_MODULE_DIR}/proto/zmk/keymap.proto + ) + + target_include_directories(app PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) + target_sources(app PRIVATE ${proto_srcs} ${proto_hdrs}) + + add_subdirectory(src/studio) +endif() + zephyr_cc_option(-Wfatal-errors) diff --git a/app/Kconfig b/app/Kconfig index 8f2fe837..1189c654 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -113,6 +113,12 @@ config ZMK_HID_INDICATORS Enable HID indicators, used for detecting state of Caps/Scroll/Num Lock, Kata, and Compose. +config ZMK_HID_SEPARATE_MOD_RELEASE_REPORT + bool "Release Modifiers Separately" + help + Send a separate release event for the modifiers, to make sure the release + of the modifier doesn't get recognized before the actual key's release event. + menu "Output Types" config ZMK_USB @@ -157,7 +163,7 @@ config ZMK_BLE_EXPERIMENTAL_CONN bool "Experimental BLE connection changes" help Enables a combination of settings that are planned to be default in future versions of ZMK - to improve connection stability. This includes changes to timing on BLE pairing initation, + to improve connection stability. This includes changes to timing on BLE pairing initiation, restores use of the updated/new LLCP implementation, and disables 2M PHY support. config ZMK_BLE_EXPERIMENTAL_SEC @@ -252,12 +258,14 @@ rsource "src/split/Kconfig" #Basic Keyboard Setup endmenu +rsource "src/studio/Kconfig" + menu "Display/LED Options" rsource "src/display/Kconfig" menuconfig ZMK_RGB_UNDERGLOW - bool "RGB Adressable LED Underglow" + bool "RGB Addressable LED Underglow" select LED_STRIP select ZMK_LOW_PRIORITY_WORK_QUEUE @@ -490,7 +498,11 @@ if USB_DEVICE_STACK config ZMK_USB_INIT_PRIORITY int "USB Init Priority" - default 50 + default 94 + +config ZMK_USB_HID_INIT_PRIORITY + int "USB HID Init Priority" + default 95 #USB endif diff --git a/app/Kconfig.behaviors b/app/Kconfig.behaviors index c9754bf7..69419a2f 100644 --- a/app/Kconfig.behaviors +++ b/app/Kconfig.behaviors @@ -1,6 +1,68 @@ # Copyright (c) 2023 The ZMK Contributors # SPDX-License-Identifier: MIT +config ZMK_BEHAVIOR_METADATA + bool "Metadata" + help + Enabling this option adds APIs for documenting and fetching + metadata describing a behaviors name, and supported parameters. + +config ZMK_BEHAVIOR_LOCAL_IDS + bool "Local IDs" + +if ZMK_BEHAVIOR_LOCAL_IDS + +config ZMK_BEHAVIOR_LOCAL_IDS_IN_BINDINGS + bool "Track in behavior bindings" + +choice ZMK_BEHAVIOR_LOCAL_ID_TYPE + prompt "Local ID Type" + +config ZMK_BEHAVIOR_LOCAL_ID_TYPE_SETTINGS_TABLE + bool "Settings Table" + depends on SETTINGS + select ZMK_BEHAVIOR_LOCAL_IDS_IN_BINDINGS + help + Use persistent entries in the settings subsystem to identify + behaviors by local ID, which uses the device name to generate + a new settings entry tying a presistant local ID to that name. + This guarantees stable, colllision-free local IDs at the expense + of settings storage used. + +config ZMK_BEHAVIOR_LOCAL_ID_TYPE_CRC16 + bool "CRC16 Hash" + select CRC + help + Use the CRC16-ANSI hash of behavior device names to generate + stable behavior local IDs. This saves on settings storage at + the expense of (highly unlikely) risk of collisions. + +endchoice + +endif + + +config ZMK_BEHAVIOR_HOLD_TAP + bool + default y + depends on DT_HAS_ZMK_BEHAVIOR_HOLD_TAP_ENABLED + +if ZMK_BEHAVIOR_HOLD_TAP + +config ZMK_BEHAVIOR_HOLD_TAP_MAX_HELD + int "Hold Tap Max Held" + default 10 + help + Max number of simultaneously held hold-taps + +config ZMK_BEHAVIOR_HOLD_TAP_MAX_CAPTURED_EVENTS + int "Hold Tap Max Captured Events" + default 40 + help + Max number of captured system events while waiting to resolve hold taps + +endif + config ZMK_BEHAVIOR_KEY_TOGGLE bool default y @@ -12,6 +74,21 @@ config ZMK_BEHAVIOR_MOUSE_KEY_PRESS depends on DT_HAS_ZMK_BEHAVIOR_MOUSE_KEY_PRESS_ENABLED imply ZMK_MOUSE +config ZMK_BEHAVIOR_STICKY_KEY + bool + default y + depends on DT_HAS_ZMK_BEHAVIOR_STICKY_KEY_ENABLED + +if ZMK_BEHAVIOR_STICKY_KEY + +config ZMK_BEHAVIOR_STICKY_KEY_MAX_HELD + int "Sticky Key Max Held" + default 10 + help + Max number of simultaneously held sticky keys + +endif + config ZMK_BEHAVIOR_SOFT_OFF bool default y @@ -32,7 +109,12 @@ config ZMK_BEHAVIOR_SENSOR_ROTATE_VAR depends on DT_HAS_ZMK_BEHAVIOR_SENSOR_ROTATE_VAR_ENABLED select ZMK_BEHAVIOR_SENSOR_ROTATE_COMMON +config ZMK_BEHAVIOR_STUDIO_UNLOCK + bool + default y + depends on DT_HAS_ZMK_BEHAVIOR_STUDIO_UNLOCK_ENABLED && ZMK_STUDIO + config ZMK_BEHAVIOR_MACRO bool default y - depends on DT_HAS_ZMK_BEHAVIOR_MACRO_ENABLED || DT_HAS_ZMK_BEHAVIOR_MACRO_ONE_PARAM_ENABLED || DT_HAS_ZMK_BEHAVIOR_MACRO_TWO_PARAM_ENABLED \ No newline at end of file + depends on DT_HAS_ZMK_BEHAVIOR_MACRO_ENABLED || DT_HAS_ZMK_BEHAVIOR_MACRO_ONE_PARAM_ENABLED || DT_HAS_ZMK_BEHAVIOR_MACRO_TWO_PARAM_ENABLED diff --git a/app/boards/01space_rp2040_042lcd.overlay b/app/boards/01space_rp2040_042lcd.overlay index d89e53f4..b5d2cdb2 100644 --- a/app/boards/01space_rp2040_042lcd.overlay +++ b/app/boards/01space_rp2040_042lcd.overlay @@ -4,6 +4,4 @@ * SPDX-License-Identifier: MIT */ -#include "usb_console.dtsi" - &xiao_serial { status = "disabled"; }; diff --git a/app/boards/adafruit_kb2040.overlay b/app/boards/adafruit_kb2040.overlay index b14e0d04..72b3adca 100644 --- a/app/boards/adafruit_kb2040.overlay +++ b/app/boards/adafruit_kb2040.overlay @@ -4,6 +4,4 @@ * SPDX-License-Identifier: MIT */ -#include "usb_console.dtsi" - &pro_micro_serial { status = "disabled"; }; diff --git a/app/boards/adafruit_qt_py_rp2040.overlay b/app/boards/adafruit_qt_py_rp2040.overlay index d89e53f4..b5d2cdb2 100644 --- a/app/boards/adafruit_qt_py_rp2040.overlay +++ b/app/boards/adafruit_qt_py_rp2040.overlay @@ -4,6 +4,4 @@ * SPDX-License-Identifier: MIT */ -#include "usb_console.dtsi" - &xiao_serial { status = "disabled"; }; diff --git a/app/boards/arm/adv360pro/adv360pro.dtsi b/app/boards/arm/adv360pro/adv360pro.dtsi index c64d0d3f..ea68624b 100644 --- a/app/boards/arm/adv360pro/adv360pro.dtsi +++ b/app/boards/arm/adv360pro/adv360pro.dtsi @@ -21,7 +21,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,kscan = &kscan0; zmk,backlight = &backlight; zmk,battery = &vbatt; @@ -90,11 +89,8 @@ status = "okay"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; &flash0 { diff --git a/app/boards/arm/adv360pro/pre_dt_board.cmake b/app/boards/arm/adv360pro/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/adv360pro/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/bdn9/bdn9_rev2.dts b/app/boards/arm/bdn9/bdn9_rev2.dts index 6e15408a..12059c41 100644 --- a/app/boards/arm/bdn9/bdn9_rev2.dts +++ b/app/boards/arm/bdn9/bdn9_rev2.dts @@ -16,7 +16,6 @@ chosen { zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,kscan = &kscan; zmk,underglow = &led_strip; }; @@ -106,13 +105,13 @@ apb1-prescaler = <1>; }; -&usb { +zephyr_udc0: &usb { status = "okay"; pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; pinctrl-names = "default"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; + + // Overridden to lower RAM usage. + num-bidir-endpoints = <4>; }; &rtc { diff --git a/app/boards/arm/bdn9/bdn9_rev2_defconfig b/app/boards/arm/bdn9/bdn9_rev2_defconfig index 05087eeb..a59fa522 100644 --- a/app/boards/arm/bdn9/bdn9_rev2_defconfig +++ b/app/boards/arm/bdn9/bdn9_rev2_defconfig @@ -5,9 +5,6 @@ CONFIG_SOC_STM32F072XB=y # 72MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000 -# Floating Point Options -CONFIG_FPU=y - # enable GPIO CONFIG_GPIO=y @@ -17,10 +14,9 @@ CONFIG_PINCTRL=y # Poll to avoid interrupt overlap issues CONFIG_ZMK_KSCAN_DIRECT_POLLING=y -# Needed to reduce this to size that will fit on F072 -CONFIG_HEAP_MEM_POOL_SIZE=1024 +CONFIG_ISR_STACK_SIZE=1024 # clock configuration CONFIG_CLOCK_CONTROL=y -CONFIG_ZMK_USB=y \ No newline at end of file +CONFIG_ZMK_USB=y diff --git a/app/boards/arm/bluemicro840/arduino_pro_micro_pins.dtsi b/app/boards/arm/bluemicro840/arduino_pro_micro_pins.dtsi index cdb8fcdd..b2026b6f 100644 --- a/app/boards/arm/bluemicro840/arduino_pro_micro_pins.dtsi +++ b/app/boards/arm/bluemicro840/arduino_pro_micro_pins.dtsi @@ -53,5 +53,5 @@ pro_micro_d: &pro_micro {}; pro_micro_i2c: &i2c0 {}; -pro_micro_spi: &spi0 {}; +pro_micro_spi: &spi1 {}; pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/bluemicro840/bluemicro840_v1-pinctrl.dtsi b/app/boards/arm/bluemicro840/bluemicro840_v1-pinctrl.dtsi index 868d3c27..046c0346 100644 --- a/app/boards/arm/bluemicro840/bluemicro840_v1-pinctrl.dtsi +++ b/app/boards/arm/bluemicro840/bluemicro840_v1-pinctrl.dtsi @@ -36,4 +36,21 @@ low-power-enable; }; }; + + spi1_default: spi1_default { + group1 { + psels = , + , + ; + }; + }; + + spi1_sleep: spi1_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; }; diff --git a/app/boards/arm/bluemicro840/bluemicro840_v1.dts b/app/boards/arm/bluemicro840/bluemicro840_v1.dts index 408cca3b..84d3ebae 100644 --- a/app/boards/arm/bluemicro840/bluemicro840_v1.dts +++ b/app/boards/arm/bluemicro840/bluemicro840_v1.dts @@ -17,7 +17,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; }; @@ -67,6 +66,13 @@ pinctrl-names = "default", "sleep"; }; +&spi1 { + compatible = "nordic,nrf-spim"; + pinctrl-0 = <&spi1_default>; + pinctrl-1 = <&spi1_sleep>; + pinctrl-names = "default", "sleep"; +}; + &uart0 { compatible = "nordic,nrf-uarte"; current-speed = <115200>; @@ -75,11 +81,8 @@ pinctrl-names = "default", "sleep"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/bluemicro840/pre_dt_board.cmake b/app/boards/arm/bluemicro840/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/bluemicro840/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/bt60/bt60.dtsi b/app/boards/arm/bt60/bt60.dtsi index 655d2576..83ff3f04 100644 --- a/app/boards/arm/bt60/bt60.dtsi +++ b/app/boards/arm/bt60/bt60.dtsi @@ -16,7 +16,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; zmk,kscan = &kscan0; zmk,matrix-transform = &default_transform; @@ -70,11 +69,8 @@ status = "okay"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/bt60/pre_dt_board.cmake b/app/boards/arm/bt60/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/bt60/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/ckp/ckp.dtsi b/app/boards/arm/ckp/ckp.dtsi index 4142622a..b127cabc 100644 --- a/app/boards/arm/ckp/ckp.dtsi +++ b/app/boards/arm/ckp/ckp.dtsi @@ -142,7 +142,7 @@ status = "okay"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; }; diff --git a/app/boards/arm/ckp/pre_dt_board.cmake b/app/boards/arm/ckp/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/ckp/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/corneish_zen/corneish_zen.dtsi b/app/boards/arm/corneish_zen/corneish_zen.dtsi index 881fadb0..dbd6f93e 100644 --- a/app/boards/arm/corneish_zen/corneish_zen.dtsi +++ b/app/boards/arm/corneish_zen/corneish_zen.dtsi @@ -20,7 +20,6 @@ zephyr,flash = &flash0; zmk,kscan = &kscan0; zmk,display = &epd; - zephyr,console = &cdc_acm_uart; zmk,matrix-transform = &default_transform; }; @@ -76,11 +75,8 @@ status = "okay"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; &flash0 { diff --git a/app/boards/arm/corneish_zen/corneish_zen_v1_left.dts b/app/boards/arm/corneish_zen/corneish_zen_v1_left.dts index 2c77f01c..4230147e 100644 --- a/app/boards/arm/corneish_zen/corneish_zen_v1_left.dts +++ b/app/boards/arm/corneish_zen/corneish_zen_v1_left.dts @@ -88,7 +88,7 @@ fuelgauge: bq274xx@55 { compatible = "ti,bq274xx"; reg = <0x55>; - design-voltage = <3700>; //Battery Design Volatge in mV + design-voltage = <3700>; //Battery Design Voltage 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 diff --git a/app/boards/arm/corneish_zen/corneish_zen_v1_right.dts b/app/boards/arm/corneish_zen/corneish_zen_v1_right.dts index 536e46ea..820d3163 100644 --- a/app/boards/arm/corneish_zen/corneish_zen_v1_right.dts +++ b/app/boards/arm/corneish_zen/corneish_zen_v1_right.dts @@ -96,7 +96,7 @@ fuelgauge: bq274xx@55 { compatible = "ti,bq274xx"; reg = <0x55>; - design-voltage = <3700>; //Battery Design Volatge in mV + design-voltage = <3700>; //Battery Design Voltage 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 diff --git a/app/boards/arm/corneish_zen/pre_dt_board.cmake b/app/boards/arm/corneish_zen/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/corneish_zen/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/dz60rgb/dz60rgb_rev1.dts b/app/boards/arm/dz60rgb/dz60rgb_rev1.dts index 4e1d4b66..b8fac4e2 100644 --- a/app/boards/arm/dz60rgb/dz60rgb_rev1.dts +++ b/app/boards/arm/dz60rgb/dz60rgb_rev1.dts @@ -16,7 +16,6 @@ chosen { zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,kscan = &kscan0; zmk,matrix-transform = &default_transform; }; @@ -65,11 +64,8 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,5) RC( }; -&usb { +zephyr_udc0: &usb { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; &flash0 { diff --git a/app/boards/arm/ferris/ferris_rev02.dts b/app/boards/arm/ferris/ferris_rev02.dts index 4fecd280..a0e28f03 100644 --- a/app/boards/arm/ferris/ferris_rev02.dts +++ b/app/boards/arm/ferris/ferris_rev02.dts @@ -17,7 +17,6 @@ chosen { zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,kscan = &kscan; zmk,matrix-transform = &transform; /* TODO: Enable once we support the IC for underglow @@ -110,14 +109,11 @@ }; }; -&usb { +zephyr_udc0: &usb { status = "okay"; pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; pinctrl-names = "default"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; &clk_hsi { diff --git a/app/boards/arm/glove80/glove80.dtsi b/app/boards/arm/glove80/glove80.dtsi index 4803488b..d51a73ac 100644 --- a/app/boards/arm/glove80/glove80.dtsi +++ b/app/boards/arm/glove80/glove80.dtsi @@ -15,7 +15,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; }; default_transform: keymap_transform_0 { @@ -59,11 +58,8 @@ status = "okay"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; &flash0 { diff --git a/app/boards/arm/glove80/pre_dt_board.cmake b/app/boards/arm/glove80/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/glove80/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/kbdfans_tofu65/kbdfans_tofu65_v2.dts b/app/boards/arm/kbdfans_tofu65/kbdfans_tofu65_v2.dts index 18c92671..60ba1da0 100644 --- a/app/boards/arm/kbdfans_tofu65/kbdfans_tofu65_v2.dts +++ b/app/boards/arm/kbdfans_tofu65/kbdfans_tofu65_v2.dts @@ -13,8 +13,6 @@ 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; @@ -108,11 +106,8 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,6) RC(4,8) RC(4,9) }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/mikoto/Kconfig b/app/boards/arm/mikoto/Kconfig index 71ec9411..fab2218c 100644 --- a/app/boards/arm/mikoto/Kconfig +++ b/app/boards/arm/mikoto/Kconfig @@ -4,6 +4,12 @@ config BOARD_ENABLE_DCDC default y depends on (BOARD_MIKOTO_520) +config BOARD_ENABLE_DCDC_HV + bool "High voltage DCDC converter" + select SOC_DCDC_NRF52X_HV + default y + depends on (BOARD_MIKOTO_520) + choice BOARD_MIKOTO_CHARGER_CURRENT prompt "Charge current to supply to attached batteries" depends on (BOARD_MIKOTO_520) diff --git a/app/boards/arm/mikoto/arduino_pro_micro_pins.dtsi b/app/boards/arm/mikoto/arduino_pro_micro_pins.dtsi index ed6097ec..b2e2d6a3 100644 --- a/app/boards/arm/mikoto/arduino_pro_micro_pins.dtsi +++ b/app/boards/arm/mikoto/arduino_pro_micro_pins.dtsi @@ -55,5 +55,5 @@ pro_micro_d: &pro_micro {}; pro_micro_i2c: &i2c0 {}; -pro_micro_spi: &spi0 {}; +pro_micro_spi: &spi1 {}; pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/mikoto/mikoto_520-pinctrl.dtsi b/app/boards/arm/mikoto/mikoto_520-pinctrl.dtsi index df43c407..8cd1e0af 100644 --- a/app/boards/arm/mikoto/mikoto_520-pinctrl.dtsi +++ b/app/boards/arm/mikoto/mikoto_520-pinctrl.dtsi @@ -36,4 +36,21 @@ low-power-enable; }; }; + + spi1_default: spi1_default { + group1 { + psels = , + , + ; + }; + }; + + spi1_sleep: spi1_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; }; diff --git a/app/boards/arm/mikoto/mikoto_520.dts b/app/boards/arm/mikoto/mikoto_520.dts index 05ec72df..3ea48cd9 100644 --- a/app/boards/arm/mikoto/mikoto_520.dts +++ b/app/boards/arm/mikoto/mikoto_520.dts @@ -17,7 +17,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; }; @@ -66,6 +65,13 @@ pinctrl-names = "default", "sleep"; }; +&spi1 { + compatible = "nordic,nrf-spim"; + pinctrl-0 = <&spi1_default>; + pinctrl-1 = <&spi1_sleep>; + pinctrl-names = "default", "sleep"; +}; + &uart0 { compatible = "nordic,nrf-uarte"; current-speed = <115200>; @@ -74,11 +80,8 @@ pinctrl-names = "default", "sleep"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/mikoto/pre_dt_board.cmake b/app/boards/arm/mikoto/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/mikoto/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/nice60/nice60.dts b/app/boards/arm/nice60/nice60.dts index d1b9f992..4eefbb9d 100644 --- a/app/boards/arm/nice60/nice60.dts +++ b/app/boards/arm/nice60/nice60.dts @@ -20,7 +20,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; zmk,kscan = &kscan0; zmk,matrix-transform = &default_transform; @@ -129,11 +128,8 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,5) R }; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; &flash0 { diff --git a/app/boards/arm/nice60/pre_dt_board.cmake b/app/boards/arm/nice60/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/nice60/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/nice_nano/Kconfig b/app/boards/arm/nice_nano/Kconfig index ac6828a4..dbeb82cd 100644 --- a/app/boards/arm/nice_nano/Kconfig +++ b/app/boards/arm/nice_nano/Kconfig @@ -5,3 +5,9 @@ config BOARD_ENABLE_DCDC select SOC_DCDC_NRF52X default y depends on (BOARD_NICE_NANO || BOARD_NICE_NANO_V2) + +config BOARD_ENABLE_DCDC_HV + bool "High voltage DCDC converter" + select SOC_DCDC_NRF52X_HV + default y + depends on (BOARD_NICE_NANO_V2) diff --git a/app/boards/arm/nice_nano/arduino_pro_micro_pins.dtsi b/app/boards/arm/nice_nano/arduino_pro_micro_pins.dtsi index f1b569c0..2c257ef0 100644 --- a/app/boards/arm/nice_nano/arduino_pro_micro_pins.dtsi +++ b/app/boards/arm/nice_nano/arduino_pro_micro_pins.dtsi @@ -53,5 +53,5 @@ pro_micro_d: &pro_micro {}; pro_micro_i2c: &i2c0 {}; -pro_micro_spi: &spi0 {}; +pro_micro_spi: &spi1 {}; pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/nice_nano/nice_nano-pinctrl.dtsi b/app/boards/arm/nice_nano/nice_nano-pinctrl.dtsi index 15c48509..bcabf4ab 100644 --- a/app/boards/arm/nice_nano/nice_nano-pinctrl.dtsi +++ b/app/boards/arm/nice_nano/nice_nano-pinctrl.dtsi @@ -36,4 +36,21 @@ low-power-enable; }; }; + + spi1_default: spi1_default { + group1 { + psels = , + , + ; + }; + }; + + spi1_sleep: spi1_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; }; diff --git a/app/boards/arm/nice_nano/nice_nano.dtsi b/app/boards/arm/nice_nano/nice_nano.dtsi index 81f10906..839845c8 100644 --- a/app/boards/arm/nice_nano/nice_nano.dtsi +++ b/app/boards/arm/nice_nano/nice_nano.dtsi @@ -16,7 +16,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; }; leds { @@ -50,6 +49,13 @@ pinctrl-names = "default", "sleep"; }; +&spi1 { + compatible = "nordic,nrf-spim"; + pinctrl-0 = <&spi1_default>; + pinctrl-1 = <&spi1_sleep>; + pinctrl-names = "default", "sleep"; +}; + &uart0 { compatible = "nordic,nrf-uarte"; current-speed = <115200>; @@ -58,11 +64,8 @@ pinctrl-names = "default", "sleep"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/nice_nano/pre_dt_board.cmake b/app/boards/arm/nice_nano/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/nice_nano/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/nrf52840_m2/nrf52840_m2.dts b/app/boards/arm/nrf52840_m2/nrf52840_m2.dts index 85e9ce21..39569f0b 100644 --- a/app/boards/arm/nrf52840_m2/nrf52840_m2.dts +++ b/app/boards/arm/nrf52840_m2/nrf52840_m2.dts @@ -15,7 +15,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; }; @@ -57,12 +56,9 @@ status = "okay"; }; -&usbd { +zephyr_udc0: &usbd { compatible = "nordic,nrf-usbd"; status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/nrf52840_m2/pre_dt_board.cmake b/app/boards/arm/nrf52840_m2/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/nrf52840_m2/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/nrfmicro/arduino_pro_micro_pins.dtsi b/app/boards/arm/nrfmicro/arduino_pro_micro_pins.dtsi index 01e342c0..1f88a4eb 100644 --- a/app/boards/arm/nrfmicro/arduino_pro_micro_pins.dtsi +++ b/app/boards/arm/nrfmicro/arduino_pro_micro_pins.dtsi @@ -55,5 +55,5 @@ pro_micro_d: &pro_micro {}; pro_micro_i2c: &i2c0 {}; -pro_micro_spi: &spi0 {}; +pro_micro_spi: &spi1 {}; pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/nrfmicro/arduino_pro_micro_pins_52833.dtsi b/app/boards/arm/nrfmicro/arduino_pro_micro_pins_52833.dtsi index 76ece25f..b16465e6 100644 --- a/app/boards/arm/nrfmicro/arduino_pro_micro_pins_52833.dtsi +++ b/app/boards/arm/nrfmicro/arduino_pro_micro_pins_52833.dtsi @@ -55,5 +55,5 @@ pro_micro_d: &pro_micro {}; pro_micro_i2c: &i2c0 {}; -pro_micro_spi: &spi0 {}; +pro_micro_spi: &spi1 {}; pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/nrfmicro/arduino_pro_micro_pins_flipped.dtsi b/app/boards/arm/nrfmicro/arduino_pro_micro_pins_flipped.dtsi index 923efbbf..3ab31900 100644 --- a/app/boards/arm/nrfmicro/arduino_pro_micro_pins_flipped.dtsi +++ b/app/boards/arm/nrfmicro/arduino_pro_micro_pins_flipped.dtsi @@ -53,5 +53,5 @@ pro_micro_d: &pro_micro {}; pro_micro_i2c: &i2c0 {}; -pro_micro_spi: &spi0 {}; +pro_micro_spi: &spi1 {}; pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/nrfmicro/nrfmicro-flipped-pinctrl.dtsi b/app/boards/arm/nrfmicro/nrfmicro-flipped-pinctrl.dtsi index 22bc11d4..57e868a4 100644 --- a/app/boards/arm/nrfmicro/nrfmicro-flipped-pinctrl.dtsi +++ b/app/boards/arm/nrfmicro/nrfmicro-flipped-pinctrl.dtsi @@ -36,4 +36,21 @@ low-power-enable; }; }; + + spi1_default: spi1_default { + group1 { + psels = , + , + ; + }; + }; + + spi1_sleep: spi1_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; }; diff --git a/app/boards/arm/nrfmicro/nrfmicro-pinctrl.dtsi b/app/boards/arm/nrfmicro/nrfmicro-pinctrl.dtsi index 35a46e5a..c4b9f5a7 100644 --- a/app/boards/arm/nrfmicro/nrfmicro-pinctrl.dtsi +++ b/app/boards/arm/nrfmicro/nrfmicro-pinctrl.dtsi @@ -36,4 +36,21 @@ low-power-enable; }; }; + + spi1_default: spi1_default { + group1 { + psels = , + , + ; + }; + }; + + spi1_sleep: spi1_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; }; diff --git a/app/boards/arm/nrfmicro/nrfmicro_11.dts b/app/boards/arm/nrfmicro/nrfmicro_11.dts index 652df101..b80ed4c6 100644 --- a/app/boards/arm/nrfmicro/nrfmicro_11.dts +++ b/app/boards/arm/nrfmicro/nrfmicro_11.dts @@ -17,7 +17,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; }; leds { @@ -54,6 +53,13 @@ pinctrl-names = "default", "sleep"; }; +&spi1 { + compatible = "nordic,nrf-spim"; + pinctrl-0 = <&spi1_default>; + pinctrl-1 = <&spi1_sleep>; + pinctrl-names = "default", "sleep"; +}; + &uart0 { compatible = "nordic,nrf-uarte"; current-speed = <115200>; @@ -62,11 +68,8 @@ pinctrl-names = "default", "sleep"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts b/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts index 5095d648..7b89b62f 100644 --- a/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts +++ b/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts @@ -17,7 +17,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; }; leds { @@ -54,6 +53,13 @@ pinctrl-names = "default", "sleep"; }; +&spi1 { + compatible = "nordic,nrf-spim"; + pinctrl-0 = <&spi1_default>; + pinctrl-1 = <&spi1_sleep>; + pinctrl-names = "default", "sleep"; +}; + &uart0 { compatible = "nordic,nrf-uarte"; current-speed = <115200>; @@ -62,11 +68,8 @@ pinctrl-names = "default", "sleep"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/nrfmicro/nrfmicro_13.dts b/app/boards/arm/nrfmicro/nrfmicro_13.dts index 7a6a5d4d..0cb22e63 100644 --- a/app/boards/arm/nrfmicro/nrfmicro_13.dts +++ b/app/boards/arm/nrfmicro/nrfmicro_13.dts @@ -17,7 +17,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; }; @@ -66,6 +65,13 @@ pinctrl-names = "default", "sleep"; }; +&spi1 { + compatible = "nordic,nrf-spim"; + pinctrl-0 = <&spi1_default>; + pinctrl-1 = <&spi1_sleep>; + pinctrl-names = "default", "sleep"; +}; + &uart0 { compatible = "nordic,nrf-uarte"; current-speed = <115200>; @@ -74,11 +80,8 @@ pinctrl-names = "default", "sleep"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/nrfmicro/nrfmicro_13_52833.dts b/app/boards/arm/nrfmicro/nrfmicro_13_52833.dts index ff2e027f..866276bb 100644 --- a/app/boards/arm/nrfmicro/nrfmicro_13_52833.dts +++ b/app/boards/arm/nrfmicro/nrfmicro_13_52833.dts @@ -17,7 +17,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; }; @@ -66,6 +65,13 @@ pinctrl-names = "default", "sleep"; }; +&spi1 { + compatible = "nordic,nrf-spim"; + pinctrl-0 = <&spi1_default>; + pinctrl-1 = <&spi1_sleep>; + pinctrl-names = "default", "sleep"; +}; + &uart0 { compatible = "nordic,nrf-uarte"; current-speed = <115200>; @@ -74,11 +80,8 @@ pinctrl-names = "default", "sleep"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/nrfmicro/pre_dt_board.cmake b/app/boards/arm/nrfmicro/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/nrfmicro/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/pillbug/pillbug.dts b/app/boards/arm/pillbug/pillbug.dts index c30d306e..cf4f62fc 100644 --- a/app/boards/arm/pillbug/pillbug.dts +++ b/app/boards/arm/pillbug/pillbug.dts @@ -18,7 +18,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; }; @@ -83,11 +82,8 @@ pinctrl-names = "default", "sleep"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/pillbug/pre_dt_board.cmake b/app/boards/arm/pillbug/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/pillbug/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/planck/planck_rev6.dts b/app/boards/arm/planck/planck_rev6.dts index 5b8e16b2..85b75140 100644 --- a/app/boards/arm/planck/planck_rev6.dts +++ b/app/boards/arm/planck/planck_rev6.dts @@ -16,7 +16,6 @@ chosen { zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,kscan = &kscan0; zmk,matrix-transform = &layout_grid_transform; }; @@ -96,13 +95,10 @@ layout_2x2u_transform: }; }; -&usb { +zephyr_udc0: &usb { pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; pinctrl-names = "default"; status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; &clk_hse { diff --git a/app/boards/arm/preonic/preonic_rev3.dts b/app/boards/arm/preonic/preonic_rev3.dts index d14355da..79f88c33 100644 --- a/app/boards/arm/preonic/preonic_rev3.dts +++ b/app/boards/arm/preonic/preonic_rev3.dts @@ -17,7 +17,6 @@ chosen { zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,kscan = &kscan0; zmk,matrix-transform = &layout_grid_transform; }; @@ -90,13 +89,10 @@ }; }; -&usb { +zephyr_udc0: &usb { pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; pinctrl-names = "default"; status = "okay"; -cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; &clk_hse { diff --git a/app/boards/arm/proton_c/proton_c.dts b/app/boards/arm/proton_c/proton_c.dts index 3aad62c8..05872b25 100644 --- a/app/boards/arm/proton_c/proton_c.dts +++ b/app/boards/arm/proton_c/proton_c.dts @@ -16,7 +16,6 @@ chosen { zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart0; }; aliases { @@ -66,13 +65,10 @@ apb2-prescaler = <1>; }; -&usb { +zephyr_udc0: &usb { pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; pinctrl-names = "default"; status = "okay"; - cdc_acm_uart0: cdc_acm_uart0 { - compatible = "zephyr,cdc-acm-uart"; - }; }; &rtc { diff --git a/app/boards/arm/puchi_ble/pre_dt_board.cmake b/app/boards/arm/puchi_ble/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/puchi_ble/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/puchi_ble/puchi_ble_v1.dts b/app/boards/arm/puchi_ble/puchi_ble_v1.dts index 05aba8d3..9f3194e0 100644 --- a/app/boards/arm/puchi_ble/puchi_ble_v1.dts +++ b/app/boards/arm/puchi_ble/puchi_ble_v1.dts @@ -17,7 +17,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; }; @@ -72,11 +71,8 @@ pinctrl-names = "default", "sleep"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; diff --git a/app/boards/arm/s40nc/pre_dt_board.cmake b/app/boards/arm/s40nc/pre_dt_board.cmake new file mode 100644 index 00000000..05b0efe5 --- /dev/null +++ b/app/boards/arm/s40nc/pre_dt_board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") \ No newline at end of file diff --git a/app/boards/arm/s40nc/s40nc.dts b/app/boards/arm/s40nc/s40nc.dts index a2eb89ea..4c37030d 100644 --- a/app/boards/arm/s40nc/s40nc.dts +++ b/app/boards/arm/s40nc/s40nc.dts @@ -16,7 +16,6 @@ zephyr,code-partition = &code_partition; zephyr,sram = &sram0; zephyr,flash = &flash0; - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; zmk,kscan = &kscan0; zmk,matrix-transform = &default_transform; @@ -93,11 +92,8 @@ status = "okay"; }; -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; &flash0 { diff --git a/app/boards/boardsource_blok.overlay b/app/boards/boardsource_blok.overlay index b14e0d04..72b3adca 100644 --- a/app/boards/boardsource_blok.overlay +++ b/app/boards/boardsource_blok.overlay @@ -4,6 +4,4 @@ * SPDX-License-Identifier: MIT */ -#include "usb_console.dtsi" - &pro_micro_serial { status = "disabled"; }; diff --git a/app/boards/interconnects/seeed_xiao/seeed_xiao.zmk.yml b/app/boards/interconnects/seeed_xiao/seeed_xiao.zmk.yml index 48080c7f..e9b20507 100644 --- a/app/boards/interconnects/seeed_xiao/seeed_xiao.zmk.yml +++ b/app/boards/interconnects/seeed_xiao/seeed_xiao.zmk.yml @@ -5,7 +5,7 @@ type: interconnect url: https://wiki.seeedstudio.com/Seeeduino-XIAO/ manufacturer: Seeed description: | - The Seeed(uino) XIAO is a popular smaller format micro-controller, that has gained popularity as an alterative + The Seeed(uino) XIAO is a popular smaller format micro-controller, that has gained popularity as an alternative to the SparkFun Pro Micro. Since its creation, several pin compatible controllers, such as the Seeeduino XIAO BLE, Adafruit QT Py and Adafruit QT Py RP2040, have become available. node_labels: diff --git a/app/boards/rpi_pico.overlay b/app/boards/rpi_pico.overlay deleted file mode 100644 index efc8e080..00000000 --- a/app/boards/rpi_pico.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (c) 2023 The ZMK Contributors - * - * SPDX-License-Identifier: MIT - */ - -#include "usb_console.dtsi" - diff --git a/app/boards/seeeduino_xiao.overlay b/app/boards/seeeduino_xiao.overlay deleted file mode 100644 index 285ee4de..00000000 --- a/app/boards/seeeduino_xiao.overlay +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2022 The ZMK Contributors - * - * SPDX-License-Identifier: MIT - */ - -/ { - chosen { - zephyr,console = &cdc_acm_uart; - }; -}; - -&usb0 { - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; -}; - diff --git a/app/boards/seeeduino_xiao_ble.overlay b/app/boards/seeeduino_xiao_ble.overlay index e0934691..f6a60858 100644 --- a/app/boards/seeeduino_xiao_ble.overlay +++ b/app/boards/seeeduino_xiao_ble.overlay @@ -7,7 +7,6 @@ / { chosen { - zephyr,console = &cdc_acm_uart; zmk,battery = &vbatt; }; @@ -24,12 +23,6 @@ status = "okay"; }; -&usbd { - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; -}; - &qspi { status = "okay"; pinctrl-0 = <&qspi_default>; diff --git a/app/boards/seeeduino_xiao_rp2040.conf b/app/boards/seeeduino_xiao_rp2040.conf index 21c1893d..714e715c 100644 --- a/app/boards/seeeduino_xiao_rp2040.conf +++ b/app/boards/seeeduino_xiao_rp2040.conf @@ -2,3 +2,10 @@ CONFIG_CONSOLE=n CONFIG_SERIAL=n CONFIG_UART_CONSOLE=n CONFIG_ZMK_USB=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 diff --git a/app/boards/seeeduino_xiao_rp2040.overlay b/app/boards/seeeduino_xiao_rp2040.overlay index d89e53f4..e6ba8136 100644 --- a/app/boards/seeeduino_xiao_rp2040.overlay +++ b/app/boards/seeeduino_xiao_rp2040.overlay @@ -4,6 +4,19 @@ * SPDX-License-Identifier: MIT */ -#include "usb_console.dtsi" - &xiao_serial { status = "disabled"; }; + +&code_partition { + reg = <0x100 (DT_SIZE_M(2) - 0x100 - DT_SIZE_K(512))>; +}; + +&flash0 { + reg = <0x10000000 DT_SIZE_M(2)>; + + partitions { + storage_partition: partition@180000 { + reg = <0x180000 DT_SIZE_K(512)>; + read-only; + }; + }; +}; diff --git a/app/boards/shields/pancake/pancake.zmk.yml b/app/boards/shields/pancake/pancake.zmk.yml index 21cc5444..020d26c1 100644 --- a/app/boards/shields/pancake/pancake.zmk.yml +++ b/app/boards/shields/pancake/pancake.zmk.yml @@ -2,7 +2,7 @@ file_format: "1" id: pancake name: Pancake type: shield -url: https://mkultra.click/pancake-keyboard-kit +url: https://github.com/Spaceboards/SpaceboardsHardware/tree/master/Keyboards/Pancake/V1 requires: [pro_micro] features: - keys diff --git a/app/boards/shields/zmk_uno/zmk_uno.dtsi b/app/boards/shields/zmk_uno/zmk_uno.dtsi index e8ba79d6..9ea625a4 100644 --- a/app/boards/shields/zmk_uno/zmk_uno.dtsi +++ b/app/boards/shields/zmk_uno/zmk_uno.dtsi @@ -40,10 +40,8 @@ nice_view_spi: &arduino_spi { / { chosen { - zmk,kscan = &kscan_matrix; zmk,backlight = &backlight; zmk,underglow = &led_strip; - zmk,matrix-transform = &matrix_transform; }; // Commented out until we add more powerful power domain support @@ -109,7 +107,6 @@ nice_view_spi: &arduino_spi { kscan_direct: kscan_direct { compatible = "zmk,kscan-gpio-direct"; wakeup-source; - status = "disabled"; input-gpios = <&arduino_header 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> @@ -125,9 +122,9 @@ nice_view_spi: &arduino_spi { toggle-mode; input-gpios - = <&arduino_header 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&arduino_header 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&arduino_header 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + = <&arduino_header 4 GPIO_ACTIVE_LOW> + , <&arduino_header 3 GPIO_ACTIVE_LOW> + , <&arduino_header 2 GPIO_ACTIVE_LOW> ; }; diff --git a/app/boards/shields/zmk_uno/zmk_uno.keymap b/app/boards/shields/zmk_uno/zmk_uno.keymap index a7f6a267..186cdb60 100644 --- a/app/boards/shields/zmk_uno/zmk_uno.keymap +++ b/app/boards/shields/zmk_uno/zmk_uno.keymap @@ -13,13 +13,9 @@ // Uncomment the following lines if using the "Direct Wire" jumper to switch the matrix to a direct wire. -// &kscan_direct { status = "okay"; }; -// &kscan_matrix { status = "disabled"; }; - // / { // chosen { -// zmk,matrix-transform = &direct_matrix_transform; -// zmk,kscan = &kscan_direct; +// zmk,physical-layout = &direct_physical_layout; // }; // }; diff --git a/app/boards/shields/zmk_uno/zmk_uno.overlay b/app/boards/shields/zmk_uno/zmk_uno.overlay index 3d105abf..2a8eb266 100644 --- a/app/boards/shields/zmk_uno/zmk_uno.overlay +++ b/app/boards/shields/zmk_uno/zmk_uno.overlay @@ -7,13 +7,15 @@ #include "zmk_uno.dtsi" #include +#include #include #include / { chosen { - zmk,matrix-transform = &matrix_transform; + zmk,physical-layout = &matrix_physical_layout; }; + sensors: sensors { compatible = "zmk,keymap-sensors"; sensors = <&encoder>; @@ -38,6 +40,8 @@ endpoint_sideband_behaviors { compatible = "zmk,kscan-sideband-behaviors"; + + auto-enable; kscan = <&kscan_sp3t_toggle>; first_toggle_sideband: first_toggle_sideband { @@ -56,4 +60,35 @@ }; }; + matrix_physical_layout: matrix_physical_layout { + compatible = "zmk,physical-layout"; + display-name = "Matrix Layout"; + + kscan = <&kscan_matrix>; + transform = <&matrix_transform>; + + keys + = <&key_physical_attrs 100 100 0 0 0 0 0> + , <&key_physical_attrs 100 100 100 0 0 0 0> + , <&key_physical_attrs 100 100 0 100 0 0 0> + , <&key_physical_attrs 100 100 100 100 0 0 0> + ; + }; + + direct_physical_layout: direct_physical_layout { + compatible = "zmk,physical-layout"; + + display-name = "Direct Wire Layout"; + + kscan = <&kscan_direct>; + transform = <&direct_matrix_transform>; + + keys + = <&key_physical_attrs 100 100 0 0 0 0 0> + , <&key_physical_attrs 100 100 100 0 0 0 0> + , <&key_physical_attrs 100 100 0 100 0 0 0> + , <&key_physical_attrs 100 100 100 100 0 0 0> + ; + }; + }; diff --git a/app/boards/shields/zmk_uno/zmk_uno_split.dtsi b/app/boards/shields/zmk_uno/zmk_uno_split.dtsi index dac6fc3e..9afbf79a 100644 --- a/app/boards/shields/zmk_uno/zmk_uno_split.dtsi +++ b/app/boards/shields/zmk_uno/zmk_uno_split.dtsi @@ -6,13 +6,15 @@ #include "zmk_uno.dtsi" + #include + left_encoder: &encoder { status = "disabled"; }; / { chosen { - zmk,matrix-transform = &split_matrix_transform; + zmk,physical-layout = &matrix_physical_layout; }; split_matrix_transform: split_matrix_transform { @@ -31,18 +33,57 @@ split_direct_matrix_transform: split_direct_matrix_transform { compatible = "zmk,matrix-transform"; - rows = <3>; + rows = <2>; columns = <4>; map = < RC(0,0) RC(0,1) RC(0,2) RC(0,3) - RC(2,0) RC(2,1) - RC(2,2) RC(2,3) + RC(1,0) RC(1,1) + RC(1,2) RC(1,3) >; }; + matrix_physical_layout: matrix_physical_layout { + compatible = "zmk,physical-layout"; + display-name = "Matrix Layout"; + + kscan = <&kscan_matrix>; + transform = <&split_matrix_transform>; + + keys + = <&key_physical_attrs 100 100 0 0 0 0 0> + , <&key_physical_attrs 100 100 100 0 0 0 0> + , <&key_physical_attrs 100 100 0 100 0 0 0> + , <&key_physical_attrs 100 100 100 100 0 0 0> + , <&key_physical_attrs 100 100 0 200 0 0 0> + , <&key_physical_attrs 100 100 100 200 0 0 0> + , <&key_physical_attrs 100 100 0 300 0 0 0> + , <&key_physical_attrs 100 100 100 300 0 0 0> + ; + }; + + direct_physical_layout: direct_physical_layout { + compatible = "zmk,physical-layout"; + + display-name = "Direct Wire Layout"; + + kscan = <&kscan_direct>; + transform = <&split_direct_matrix_transform>; + + keys + = <&key_physical_attrs 100 100 0 0 0 0 0> + , <&key_physical_attrs 100 100 100 0 0 0 0> + , <&key_physical_attrs 100 100 0 100 0 0 0> + , <&key_physical_attrs 100 100 100 100 0 0 0> + , <&key_physical_attrs 100 100 0 200 0 0 0> + , <&key_physical_attrs 100 100 100 200 0 0 0> + , <&key_physical_attrs 100 100 0 300 0 0 0> + , <&key_physical_attrs 100 100 100 300 0 0 0> + ; + }; + right_encoder: right_encoder { steps = <80>; status = "disabled"; diff --git a/app/boards/shields/zmk_uno/zmk_uno_split.keymap b/app/boards/shields/zmk_uno/zmk_uno_split.keymap index 0e50a283..d2daa6ea 100644 --- a/app/boards/shields/zmk_uno/zmk_uno_split.keymap +++ b/app/boards/shields/zmk_uno/zmk_uno_split.keymap @@ -14,14 +14,9 @@ // Uncomment the following lines if using the "Direct Wire" jumper to switch the matrix to a direct wire. - -// &kscan_direct { status = "okay"; }; -// &kscan_matrix { status = "disabled"; }; - // / { // chosen { -// zmk,matrix-transform = &split_direct_matrix_transform; -// zmk,kscan = &kscan_direct; +// zmk,physical-layout = &direct_physical_layout; // }; // }; diff --git a/app/boards/shields/zmk_uno/zmk_uno_split_right.overlay b/app/boards/shields/zmk_uno/zmk_uno_split_right.overlay index 9c2e7d7f..acfad5a2 100644 --- a/app/boards/shields/zmk_uno/zmk_uno_split_right.overlay +++ b/app/boards/shields/zmk_uno/zmk_uno_split_right.overlay @@ -11,7 +11,7 @@ }; &split_direct_matrix_transform { - row-offset = <2>; + row-offset = <1>; }; &right_encoder { diff --git a/app/boards/sparkfun_pro_micro_rp2040.overlay b/app/boards/sparkfun_pro_micro_rp2040.overlay index b14e0d04..72b3adca 100644 --- a/app/boards/sparkfun_pro_micro_rp2040.overlay +++ b/app/boards/sparkfun_pro_micro_rp2040.overlay @@ -4,6 +4,4 @@ * SPDX-License-Identifier: MIT */ -#include "usb_console.dtsi" - &pro_micro_serial { status = "disabled"; }; diff --git a/app/boards/usb_console.dtsi b/app/boards/usb_console.dtsi deleted file mode 100644 index adf3bd19..00000000 --- a/app/boards/usb_console.dtsi +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2023 The ZMK Contributors - * - * SPDX-License-Identifier: MIT - */ - - -/ { - chosen { - zephyr,console = &cdc_acm_uart; - }; -}; - -&usbd { - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; -}; - diff --git a/app/core-coverage.yml b/app/core-coverage.yml index 4a60aad9..28a8788c 100644 --- a/app/core-coverage.yml +++ b/app/core-coverage.yml @@ -22,6 +22,13 @@ include: shield: kyria_left cmake-args: "-DCONFIG_ZMK_DISPLAY=y" nickname: "display" + - board: nice_nano_v2 + shield: kyria_left + cmake-args: "-DCONFIG_ZMK_MOUSE=y" + nickname: "mouse" + - board: sparkfun_pro_micro_rp2040 + shield: reviung41 + cmake-args: "-DSNIPPET='zmk-usb-logging'" - board: nice_nano_v2 shield: kyria_right cmake-args: "-DCONFIG_ZMK_DISPLAY=y" @@ -33,3 +40,32 @@ include: - board: nice_nano_v2 shield: lily58_left nice_view_adapter nice_view nickname: "niceview" + - board: bdn9_rev2 + snippet: studio-rpc-usb-uart + cmake-args: "-DCONFIG_ZMK_STUDIO=y" + nickname: "stm32-studio" + - board: nice_nano_v2 + shield: reviung41 + snippet: studio-rpc-usb-uart + cmake-args: "-DCONFIG_ZMK_STUDIO=y" + nickname: "nrf52-studio" + - board: nice_nano_v2 + shield: corne_left + snippet: studio-rpc-usb-uart + cmake-args: "-DCONFIG_ZMK_STUDIO=y" + nickname: "split-left-studio" + - board: nice_nano_v2 + shield: corne_right + snippet: studio-rpc-usb-uart + cmake-args: "-DCONFIG_ZMK_STUDIO=y" + nickname: "split-right-studio" + - board: sparkfun_pro_micro_rp2040 + shield: reviung41 + snippet: studio-rpc-usb-uart + cmake-args: "-DCONFIG_ZMK_STUDIO=y" + nickname: "rp2040-studio" + - board: seeeduino_xiao + shield: hummingbird + snippet: studio-rpc-usb-uart + cmake-args: "-DCONFIG_ZMK_STUDIO=y" + nickname: "samd21-studio" diff --git a/app/dts/behaviors.dtsi b/app/dts/behaviors.dtsi index 0899134c..26f9dc37 100644 --- a/app/dts/behaviors.dtsi +++ b/app/dts/behaviors.dtsi @@ -21,4 +21,5 @@ #include #include #include +#include #include diff --git a/app/dts/behaviors/backlight.dtsi b/app/dts/behaviors/backlight.dtsi index 54c83ff4..dd045eff 100644 --- a/app/dts/behaviors/backlight.dtsi +++ b/app/dts/behaviors/backlight.dtsi @@ -10,6 +10,7 @@ /omit-if-no-ref/ bl: bcklight { compatible = "zmk,behavior-backlight"; #binding-cells = <2>; + display-name = "Backlight"; }; }; }; diff --git a/app/dts/behaviors/bluetooth.dtsi b/app/dts/behaviors/bluetooth.dtsi index 40557b7a..bece156f 100644 --- a/app/dts/behaviors/bluetooth.dtsi +++ b/app/dts/behaviors/bluetooth.dtsi @@ -9,6 +9,7 @@ /omit-if-no-ref/ bt: bluetooth { compatible = "zmk,behavior-bluetooth"; #binding-cells = <2>; + display-name = "Bluetooth"; }; }; }; diff --git a/app/dts/behaviors/caps_word.dtsi b/app/dts/behaviors/caps_word.dtsi index 795fbc08..05431bd8 100644 --- a/app/dts/behaviors/caps_word.dtsi +++ b/app/dts/behaviors/caps_word.dtsi @@ -12,6 +12,7 @@ compatible = "zmk,behavior-caps-word"; #binding-cells = <0>; continue-list = ; + display-name = "Caps Word"; }; }; }; diff --git a/app/dts/behaviors/ext_power.dtsi b/app/dts/behaviors/ext_power.dtsi index 2ae1daf8..08113f94 100644 --- a/app/dts/behaviors/ext_power.dtsi +++ b/app/dts/behaviors/ext_power.dtsi @@ -10,6 +10,7 @@ ext_power: extpower { compatible = "zmk,behavior-ext-power"; #binding-cells = <1>; + display-name = "External Power"; }; }; }; diff --git a/app/dts/behaviors/gresc.dtsi b/app/dts/behaviors/gresc.dtsi index 59a73291..2643a383 100644 --- a/app/dts/behaviors/gresc.dtsi +++ b/app/dts/behaviors/gresc.dtsi @@ -13,6 +13,7 @@ #binding-cells = <0>; bindings = <&kp ESC>, <&kp GRAVE>; mods = <(MOD_LGUI|MOD_LSFT|MOD_RGUI|MOD_RSFT)>; + display-name = "Grave/Escape"; }; }; }; diff --git a/app/dts/behaviors/key_press.dtsi b/app/dts/behaviors/key_press.dtsi index ddaf7eed..2435699b 100644 --- a/app/dts/behaviors/key_press.dtsi +++ b/app/dts/behaviors/key_press.dtsi @@ -10,6 +10,7 @@ /omit-if-no-ref/ cp: kp: key_press { compatible = "zmk,behavior-key-press"; #binding-cells = <1>; + display-name = "Key Press"; }; }; }; diff --git a/app/dts/behaviors/key_repeat.dtsi b/app/dts/behaviors/key_repeat.dtsi index 88910f62..cd5d3771 100644 --- a/app/dts/behaviors/key_repeat.dtsi +++ b/app/dts/behaviors/key_repeat.dtsi @@ -12,6 +12,7 @@ compatible = "zmk,behavior-key-repeat"; #binding-cells = <0>; usage-pages = ; + display-name = "Key Repeat"; }; }; }; diff --git a/app/dts/behaviors/key_toggle.dtsi b/app/dts/behaviors/key_toggle.dtsi index a3e3f36f..a7b66aab 100644 --- a/app/dts/behaviors/key_toggle.dtsi +++ b/app/dts/behaviors/key_toggle.dtsi @@ -9,6 +9,7 @@ /omit-if-no-ref/ kt: key_toggle { compatible = "zmk,behavior-key-toggle"; #binding-cells = <1>; + display-name = "Key Toggle"; }; }; }; diff --git a/app/dts/behaviors/layer_tap.dtsi b/app/dts/behaviors/layer_tap.dtsi index dc953e93..2858bf17 100644 --- a/app/dts/behaviors/layer_tap.dtsi +++ b/app/dts/behaviors/layer_tap.dtsi @@ -12,6 +12,7 @@ flavor = "tap-preferred"; tapping-term-ms = <200>; bindings = <&mo>, <&kp>; + display-name = "Layer-Tap"; }; }; }; diff --git a/app/dts/behaviors/mod_tap.dtsi b/app/dts/behaviors/mod_tap.dtsi index 38bb34fe..0b46f77e 100644 --- a/app/dts/behaviors/mod_tap.dtsi +++ b/app/dts/behaviors/mod_tap.dtsi @@ -12,6 +12,7 @@ flavor = "hold-preferred"; tapping-term-ms = <200>; bindings = <&kp>, <&kp>; + display-name = "Mod-Tap"; }; }; }; diff --git a/app/dts/behaviors/momentary_layer.dtsi b/app/dts/behaviors/momentary_layer.dtsi index 6d85165d..cae08d5f 100644 --- a/app/dts/behaviors/momentary_layer.dtsi +++ b/app/dts/behaviors/momentary_layer.dtsi @@ -9,6 +9,7 @@ /omit-if-no-ref/ mo: momentary_layer { compatible = "zmk,behavior-momentary-layer"; #binding-cells = <1>; + display-name = "Momentary Layer"; }; }; }; diff --git a/app/dts/behaviors/none.dtsi b/app/dts/behaviors/none.dtsi index 13d056f0..a9a820c3 100644 --- a/app/dts/behaviors/none.dtsi +++ b/app/dts/behaviors/none.dtsi @@ -9,6 +9,7 @@ /omit-if-no-ref/ none: none { compatible = "zmk,behavior-none"; #binding-cells = <0>; + display-name = "None"; }; }; }; diff --git a/app/dts/behaviors/outputs.dtsi b/app/dts/behaviors/outputs.dtsi index f7737196..3047852a 100644 --- a/app/dts/behaviors/outputs.dtsi +++ b/app/dts/behaviors/outputs.dtsi @@ -9,6 +9,7 @@ /omit-if-no-ref/ out: outputs { compatible = "zmk,behavior-outputs"; #binding-cells = <1>; + display-name = "Output Selection"; }; }; }; diff --git a/app/dts/behaviors/reset.dtsi b/app/dts/behaviors/reset.dtsi index e407b107..2aa41d7d 100644 --- a/app/dts/behaviors/reset.dtsi +++ b/app/dts/behaviors/reset.dtsi @@ -12,6 +12,7 @@ sys_reset: sysreset { compatible = "zmk,behavior-reset"; #binding-cells = <0>; + display-name = "Reset"; }; // Behavior can be invoked on peripherals, so name must be <= 8 characters. @@ -19,6 +20,7 @@ compatible = "zmk,behavior-reset"; type = ; #binding-cells = <0>; + display-name = "Bootloader"; }; }; }; diff --git a/app/dts/behaviors/rgb_underglow.dtsi b/app/dts/behaviors/rgb_underglow.dtsi index 969518a6..07640058 100644 --- a/app/dts/behaviors/rgb_underglow.dtsi +++ b/app/dts/behaviors/rgb_underglow.dtsi @@ -10,6 +10,7 @@ rgb_ug: rgb_ug { compatible = "zmk,behavior-rgb-underglow"; #binding-cells = <2>; + display-name = "Underglow"; }; }; }; diff --git a/app/dts/behaviors/soft_off.dtsi b/app/dts/behaviors/soft_off.dtsi index 63c04b1d..a5c9d255 100644 --- a/app/dts/behaviors/soft_off.dtsi +++ b/app/dts/behaviors/soft_off.dtsi @@ -6,7 +6,7 @@ / { behaviors { - /omit-if-no-ref/ soft_off: keymap_soft_off { + /omit-if-no-ref/ soft_off: z_so_off { compatible = "zmk,behavior-soft-off"; #binding-cells = <0>; split-peripheral-off-on-press; diff --git a/app/dts/behaviors/sticky_key.dtsi b/app/dts/behaviors/sticky_key.dtsi index c8973d4d..382a7254 100644 --- a/app/dts/behaviors/sticky_key.dtsi +++ b/app/dts/behaviors/sticky_key.dtsi @@ -12,6 +12,7 @@ release-after-ms = <1000>; bindings = <&kp>; ignore-modifiers; + display-name = "Sticky Key"; }; /omit-if-no-ref/ sl: sticky_layer { compatible = "zmk,behavior-sticky-key"; @@ -19,6 +20,7 @@ release-after-ms = <1000>; bindings = <&mo>; quick-release; + display-name = "Sticky Layer"; }; }; diff --git a/app/dts/behaviors/studio_unlock.dtsi b/app/dts/behaviors/studio_unlock.dtsi new file mode 100644 index 00000000..2426662c --- /dev/null +++ b/app/dts/behaviors/studio_unlock.dtsi @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/ { + behaviors { + studio_unlock: studio_unlock { + compatible = "zmk,behavior-studio-unlock"; + #binding-cells = <0>; + display-name = "Studio Unlock"; + }; + }; +}; diff --git a/app/dts/behaviors/to_layer.dtsi b/app/dts/behaviors/to_layer.dtsi index 904f023d..3c740209 100644 --- a/app/dts/behaviors/to_layer.dtsi +++ b/app/dts/behaviors/to_layer.dtsi @@ -9,6 +9,7 @@ /omit-if-no-ref/ to: to_layer { compatible = "zmk,behavior-to-layer"; #binding-cells = <1>; + display-name = "To Layer"; }; }; }; diff --git a/app/dts/behaviors/toggle_layer.dtsi b/app/dts/behaviors/toggle_layer.dtsi index 05f2988e..ea9b25b7 100644 --- a/app/dts/behaviors/toggle_layer.dtsi +++ b/app/dts/behaviors/toggle_layer.dtsi @@ -9,6 +9,7 @@ /omit-if-no-ref/ tog: toggle_layer { compatible = "zmk,behavior-toggle-layer"; #binding-cells = <1>; + display-name = "Toggle Layer"; }; }; }; diff --git a/app/dts/behaviors/transparent.dtsi b/app/dts/behaviors/transparent.dtsi index 3586f02a..03ec36a6 100644 --- a/app/dts/behaviors/transparent.dtsi +++ b/app/dts/behaviors/transparent.dtsi @@ -9,6 +9,7 @@ /omit-if-no-ref/ trans: transparent { compatible = "zmk,behavior-transparent"; #binding-cells = <0>; + display-name = "Transparent"; }; }; }; diff --git a/app/dts/bindings/behaviors/behavior-metadata.yaml b/app/dts/bindings/behaviors/behavior-metadata.yaml new file mode 100644 index 00000000..3a758ba3 --- /dev/null +++ b/app/dts/bindings/behaviors/behavior-metadata.yaml @@ -0,0 +1,6 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT + +properties: + display-name: + type: string diff --git a/app/dts/bindings/behaviors/one_param.yaml b/app/dts/bindings/behaviors/one_param.yaml index 9a503e8a..fa4c2dc0 100644 --- a/app/dts/bindings/behaviors/one_param.yaml +++ b/app/dts/bindings/behaviors/one_param.yaml @@ -1,6 +1,8 @@ # Copyright (c) 2020 The ZMK Contributors # SPDX-License-Identifier: MIT +include: behavior-metadata.yaml + properties: label: type: string diff --git a/app/dts/bindings/behaviors/two_param.yaml b/app/dts/bindings/behaviors/two_param.yaml index 4f342301..af9618e1 100644 --- a/app/dts/bindings/behaviors/two_param.yaml +++ b/app/dts/bindings/behaviors/two_param.yaml @@ -1,6 +1,8 @@ # Copyright (c) 2020 The ZMK Contributors # SPDX-License-Identifier: MIT +include: behavior-metadata.yaml + properties: label: type: string diff --git a/app/dts/bindings/behaviors/zero_param.yaml b/app/dts/bindings/behaviors/zero_param.yaml index 79d0dcae..deed5a12 100644 --- a/app/dts/bindings/behaviors/zero_param.yaml +++ b/app/dts/bindings/behaviors/zero_param.yaml @@ -1,6 +1,8 @@ # Copyright (c) 2020 The ZMK Contributors # SPDX-License-Identifier: MIT +include: behavior-metadata.yaml + properties: label: type: string diff --git a/app/dts/bindings/behaviors/zmk,behavior-studio-unlock.yaml b/app/dts/bindings/behaviors/zmk,behavior-studio-unlock.yaml new file mode 100644 index 00000000..25942b94 --- /dev/null +++ b/app/dts/bindings/behaviors/zmk,behavior-studio-unlock.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT + +description: Studio Unlock Behavior + +compatible: "zmk,behavior-studio-unlock" + +include: zero_param.yaml diff --git a/app/dts/bindings/kscan/zmk,kscan-sideband-behaviors.yaml b/app/dts/bindings/kscan/zmk,kscan-sideband-behaviors.yaml index f3ed180d..e38beeb4 100644 --- a/app/dts/bindings/kscan/zmk,kscan-sideband-behaviors.yaml +++ b/app/dts/bindings/kscan/zmk,kscan-sideband-behaviors.yaml @@ -11,6 +11,9 @@ compatible: "zmk,kscan-sideband-behaviors" include: kscan.yaml properties: + auto-enable: + type: boolean + kscan: type: phandle required: true diff --git a/app/dts/bindings/zmk,key-physical-attrs.yaml b/app/dts/bindings/zmk,key-physical-attrs.yaml new file mode 100644 index 00000000..9ea070f8 --- /dev/null +++ b/app/dts/bindings/zmk,key-physical-attrs.yaml @@ -0,0 +1,24 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# +# SPDX-License-Identifier: MIT + +description: | + The physical attributes of a key, including size, location, and rotation + +compatible: "zmk,key-physical-attrs" + +properties: + "#key-cells": + type: int + required: true + const: 7 + +key-cells: + - width + - height + - x + - y + - r + - rx + - ry diff --git a/app/dts/bindings/zmk,physical-layout-position-map.yaml b/app/dts/bindings/zmk,physical-layout-position-map.yaml new file mode 100644 index 00000000..8647404b --- /dev/null +++ b/app/dts/bindings/zmk,physical-layout-position-map.yaml @@ -0,0 +1,23 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# +# SPDX-License-Identifier: MIT + +description: | + Describes how to correlate equivalent keys between layouts that don't have the exact same X,Y location. + +compatible: "zmk,physical-layout-position-map" + +properties: + complete: + type: boolean + description: If the mapping complete describes the key mapping, and no position based mapping should be used. + +child-binding: + properties: + physical-layout: + type: phandle + description: The physical layout that corresponds to this mapping entry. + positions: + type: array + description: Array of key positions that match the same array entry in the other sibling nodes. diff --git a/app/dts/bindings/zmk,physical-layout.yaml b/app/dts/bindings/zmk,physical-layout.yaml new file mode 100644 index 00000000..3f9b8c24 --- /dev/null +++ b/app/dts/bindings/zmk,physical-layout.yaml @@ -0,0 +1,26 @@ +# +# Copyright (c) 2024 The ZMK Contributors +# +# SPDX-License-Identifier: MIT + +description: | + Describe the physical layout of a keyboard, including deps like the transform and kscan + that are needed for that layout to work. + +compatible: "zmk,physical-layout" + +properties: + display-name: + type: string + required: true + description: The name of this layout to display in the UI + transform: + type: phandle + required: true + description: The matrix transform to use along with this layout. + kscan: + type: phandle + description: The kscan to use along with this layout. The `zmk,kscan` chosen will be used as a fallback if this property is omitted. + keys: + type: phandle-array + description: Array of key physical attributes. diff --git a/app/dts/common/arduino_uno_pro_micro_map.dtsi b/app/dts/common/arduino_uno_pro_micro_map.dtsi index a6b8d792..885661d4 100644 --- a/app/dts/common/arduino_uno_pro_micro_map.dtsi +++ b/app/dts/common/arduino_uno_pro_micro_map.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -/* This provies a mapping from Arduino Uno to Arduino Pro Micro pins for development */ +/* This provides a mapping from Arduino Uno to Arduino Pro Micro pins for development */ / { pro_micro_d: connector_d { diff --git a/app/dts/physical_layouts.dtsi b/app/dts/physical_layouts.dtsi new file mode 100644 index 00000000..1c8703ec --- /dev/null +++ b/app/dts/physical_layouts.dtsi @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/ { + key_physical_attrs: key_physical_attrs { + compatible = "zmk,key-physical-attrs"; + + #key-cells = <7>; + }; +}; \ No newline at end of file diff --git a/app/include/drivers/behavior.h b/app/include/drivers/behavior.h index 3936da5e..7c99f04e 100644 --- a/app/include/drivers/behavior.h +++ b/app/include/drivers/behavior.h @@ -23,6 +23,39 @@ * (Internal use only.) */ +struct behavior_parameter_value_metadata { + char *display_name; + + union { + uint32_t value; + struct { + int32_t min; + int32_t max; + } range; + }; + + enum { + BEHAVIOR_PARAMETER_VALUE_TYPE_NIL = 0, + BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE = 1, + BEHAVIOR_PARAMETER_VALUE_TYPE_RANGE = 2, + BEHAVIOR_PARAMETER_VALUE_TYPE_HID_USAGE = 3, + BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID = 4, + } type; +}; + +struct behavior_parameter_metadata_set { + size_t param1_values_len; + const struct behavior_parameter_value_metadata *param1_values; + + size_t param2_values_len; + const struct behavior_parameter_value_metadata *param2_values; +}; + +struct behavior_parameter_metadata { + size_t sets_len; + const struct behavior_parameter_metadata_set *sets; +}; + enum behavior_sensor_binding_process_mode { BEHAVIOR_SENSOR_BINDING_PROCESS_MODE_TRIGGER, BEHAVIOR_SENSOR_BINDING_PROCESS_MODE_DISCARD, @@ -37,6 +70,10 @@ typedef int (*behavior_sensor_keymap_binding_accept_data_callback_t)( struct zmk_behavior_binding *binding, struct zmk_behavior_binding_event event, const struct zmk_sensor_config *sensor_config, size_t channel_data_size, const struct zmk_sensor_channel_data channel_data[channel_data_size]); +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) +typedef int (*behavior_get_parameter_metadata_t)( + const struct device *behavior, struct behavior_parameter_metadata *param_metadata); +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) enum behavior_locality { BEHAVIOR_LOCALITY_CENTRAL, @@ -51,23 +88,71 @@ __subsystem struct behavior_driver_api { behavior_keymap_binding_callback_t binding_released; behavior_sensor_keymap_binding_accept_data_callback_t sensor_binding_accept_data; behavior_sensor_keymap_binding_process_callback_t sensor_binding_process; +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + behavior_get_parameter_metadata_t get_parameter_metadata; + const struct behavior_parameter_metadata *parameter_metadata; +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; /** * @endcond */ +struct zmk_behavior_metadata { +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + const char *display_name; +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) +}; + struct zmk_behavior_ref { const struct device *device; + const struct zmk_behavior_metadata metadata; }; +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_LOCAL_IDS) + +struct zmk_behavior_local_id_map { + const struct device *device; + zmk_behavior_local_id_t local_id; +}; + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_LOCAL_IDS) + +#define ZMK_BEHAVIOR_REF_DT_NAME(node_id) _CONCAT(zmk_behavior_, DEVICE_DT_NAME_GET(node_id)) + +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +#define ZMK_BEHAVIOR_METADATA_INITIALIZER(node_id) \ + { .display_name = DT_PROP_OR(node_id, display_name, DEVICE_DT_NAME(node_id)), } + +#else + +#define ZMK_BEHAVIOR_METADATA_INITIALIZER(node_id) \ + {} + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +#define ZMK_BEHAVIOR_REF_INITIALIZER(node_id, _dev) \ + { .device = _dev, .metadata = ZMK_BEHAVIOR_METADATA_INITIALIZER(node_id), } + +#define ZMK_BEHAVIOR_LOCAL_ID_MAP_INITIALIZER(node_id, _dev) \ + { .device = _dev, } + +#define ZMK_BEHAVIOR_REF_DEFINE(name, node_id, _dev) \ + static const STRUCT_SECTION_ITERABLE(zmk_behavior_ref, name) = \ + ZMK_BEHAVIOR_REF_INITIALIZER(node_id, _dev); \ + COND_CODE_1(IS_ENABLED(CONFIG_ZMK_BEHAVIOR_LOCAL_IDS), \ + (static const STRUCT_SECTION_ITERABLE(zmk_behavior_local_id_map, \ + _CONCAT(_zmk_behavior_local_id_map, name)) = \ + ZMK_BEHAVIOR_LOCAL_ID_MAP_INITIALIZER(node_id, _dev)), \ + ()); + +#define ZMK_BEHAVIOR_REF_DT_DEFINE(node_id) \ + ZMK_BEHAVIOR_REF_DEFINE(ZMK_BEHAVIOR_REF_DT_NAME(node_id), node_id, DEVICE_DT_GET(node_id)) + /** * Registers @p node_id as a behavior. */ -#define BEHAVIOR_DEFINE(node_id) \ - static const STRUCT_SECTION_ITERABLE(zmk_behavior_ref, \ - _CONCAT(zmk_behavior_, DEVICE_DT_NAME_GET(node_id))) = { \ - .device = DEVICE_DT_GET(node_id), \ - } +#define BEHAVIOR_DEFINE(node_id) ZMK_BEHAVIOR_REF_DT_DEFINE(node_id) /** * @brief Like DEVICE_DT_DEFINE(), but also registers the device as a behavior. @@ -89,6 +174,52 @@ struct zmk_behavior_ref { DEVICE_DT_INST_DEFINE(inst, __VA_ARGS__); \ BEHAVIOR_DEFINE(DT_DRV_INST(inst)) +/** + * @brief Validate a given behavior binding is valid, including parameter validation + * if the metadata feature is enablued. + * + * @param binding The behavior binding to validate. + * + * @retval 0 if the passed in binding is valid. + * @retval -ENODEV if the binding references a non-existant behavior. + * @retval -EINVAL if parameters are not valid for the behavior metadata. + */ +int zmk_behavior_validate_binding(const struct zmk_behavior_binding *binding); + +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +int zmk_behavior_get_empty_param_metadata(const struct device *dev, + struct behavior_parameter_metadata *metadata); + +/** + * @brief Validate a given behavior parameters match the behavior metadata. + * + * @param metadata The behavior metadata to validate against + * @param param1 The first parameter value + * @param param2 The second parameter value + * + * @retval 0 if the passed in parameters are valid. + * @retval -ENODEV if metadata is NULL. + * @retval -EINVAL if parameters are not valid for the metadata. + */ +int zmk_behavior_check_params_match_metadata(const struct behavior_parameter_metadata *metadata, + uint32_t param1, uint32_t param2); +/** + * @brief Validate a given behavior parameter matches the behavior metadata parameter values. + * + * @param values The values to validate against + * @param values_len How many values to check + * @param param The value to check. + * + * @retval 0 if the passed in parameter is valid. + * @retval -ENODEV if values is NULL. + * @retval -EINVAL if parameter is not valid for the value metadata. + */ +int zmk_behavior_validate_param_values(const struct behavior_parameter_value_metadata *values, + size_t values_len, uint32_t param); + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + /** * Syscall wrapper for zmk_behavior_get_binding(). * @@ -120,6 +251,40 @@ static inline int z_impl_behavior_keymap_binding_convert_central_state_dependent return api->binding_convert_central_state_dependent_params(binding, event); } +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +/** + * @brief Determine where the behavior should be run + * @param behavior Pointer to the device structure for the driver instance. + * + * @retval Zero if successful. + * @retval Negative errno code if failure. + */ +__syscall int behavior_get_parameter_metadata(const struct device *behavior, + struct behavior_parameter_metadata *param_metadata); + +static inline int +z_impl_behavior_get_parameter_metadata(const struct device *behavior, + struct behavior_parameter_metadata *param_metadata) { + if (behavior == NULL || param_metadata == NULL) { + return -EINVAL; + } + + const struct behavior_driver_api *api = (const struct behavior_driver_api *)behavior->api; + + if (api->get_parameter_metadata) { + return api->get_parameter_metadata(behavior, param_metadata); + } else if (api->parameter_metadata) { + *param_metadata = *api->parameter_metadata; + } else { + return -ENODEV; + } + + return 0; +} + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + /** * @brief Determine where the behavior should be run * @param behavior Pointer to the device structure for the driver instance. diff --git a/app/include/linker/zmk-behavior-local-id-map.ld b/app/include/linker/zmk-behavior-local-id-map.ld new file mode 100644 index 00000000..c91e64c4 --- /dev/null +++ b/app/include/linker/zmk-behavior-local-id-map.ld @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2023 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +ITERABLE_SECTION_RAM(zmk_behavior_local_id_map, 4) diff --git a/app/include/linker/zmk-rpc-event-mappers.ld b/app/include/linker/zmk-rpc-event-mappers.ld new file mode 100644 index 00000000..bc5a0eea --- /dev/null +++ b/app/include/linker/zmk-rpc-event-mappers.ld @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +ITERABLE_SECTION_ROM(zmk_rpc_event_mapper, 4) diff --git a/app/include/linker/zmk-rpc-subsystem-handlers.ld b/app/include/linker/zmk-rpc-subsystem-handlers.ld new file mode 100644 index 00000000..286af1e4 --- /dev/null +++ b/app/include/linker/zmk-rpc-subsystem-handlers.ld @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +ITERABLE_SECTION_ROM(zmk_rpc_subsystem_handler, 4) diff --git a/app/include/linker/zmk-rpc-subsystems.ld b/app/include/linker/zmk-rpc-subsystems.ld new file mode 100644 index 00000000..9373154f --- /dev/null +++ b/app/include/linker/zmk-rpc-subsystems.ld @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +ITERABLE_SECTION_RAM(zmk_rpc_subsystem, 4) diff --git a/app/include/linker/zmk-rpc-transport.ld b/app/include/linker/zmk-rpc-transport.ld new file mode 100644 index 00000000..d5178c3d --- /dev/null +++ b/app/include/linker/zmk-rpc-transport.ld @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +ITERABLE_SECTION_ROM(zmk_rpc_transport, 4) diff --git a/app/include/zmk/behavior.h b/app/include/zmk/behavior.h index ab95fd8e..d45bbfff 100644 --- a/app/include/zmk/behavior.h +++ b/app/include/zmk/behavior.h @@ -11,8 +11,13 @@ #define ZMK_BEHAVIOR_OPAQUE 0 #define ZMK_BEHAVIOR_TRANSPARENT 1 +typedef uint16_t zmk_behavior_local_id_t; + struct zmk_behavior_binding { - char *behavior_dev; +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_LOCAL_IDS_IN_BINDINGS) + zmk_behavior_local_id_t local_id; +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_LOCAL_IDS_IN_BINDINGS) + const char *behavior_dev; uint32_t param1; uint32_t param2; }; @@ -36,3 +41,23 @@ struct zmk_behavior_binding_event { * unrelated node which shares the same name as a behavior. */ const struct device *zmk_behavior_get_binding(const char *name); + +/** + * @brief Get a local ID for a behavior from its @p name field. + * + * @param name Behavior name to search for. + * + * @retval The local ID value that can be used to reference the behavior later, across reboots. + * @retval UINT16_MAX if the behavior is not found or its initialization function failed. + */ +zmk_behavior_local_id_t zmk_behavior_get_local_id(const char *name); + +/** + * @brief Get a behavior name for a behavior from its @p local_id . + * + * @param local_id Behavior local ID used to search for the behavior + * + * @retval The name of the behavior that is associated with that local ID. + * @retval NULL if the behavior is not found or its initialization function failed. + */ +const char *zmk_behavior_find_behavior_name_from_local_id(zmk_behavior_local_id_t local_id); diff --git a/app/include/zmk/ble.h b/app/include/zmk/ble.h index 773323c1..cc55a6ce 100644 --- a/app/include/zmk/ble.h +++ b/app/include/zmk/ble.h @@ -29,7 +29,10 @@ int zmk_ble_prof_disconnect(uint8_t index); int zmk_ble_active_profile_index(void); int zmk_ble_profile_index(const bt_addr_le_t *addr); + bt_addr_le_t *zmk_ble_active_profile_addr(void); +struct bt_conn *zmk_ble_active_profile_conn(void); + bool zmk_ble_active_profile_is_open(void); bool zmk_ble_active_profile_is_connected(void); char *zmk_ble_active_profile_name(void); diff --git a/app/include/zmk/display.h b/app/include/zmk/display.h index 1ef41f48..d206d357 100644 --- a/app/include/zmk/display.h +++ b/app/include/zmk/display.h @@ -23,12 +23,12 @@ int zmk_display_init(void); * * @param listener THe ZMK Event manager listener name. * @param state_type The struct/enum type used to store/transfer state. - * @param cb The callback to invoke in the dispaly queue context to update the UI. Should be `void + * @param cb The callback to invoke in the display queue context to update the UI. Should be `void * func(state_type)` signature. * @param state_func The callback function to invoke to fetch the updated state from ZMK core. * Should be `state type func(const zmk_event_t *eh)` signature. - * @retval listner##_init Generates a function `listener##_init` that should be called by the widget - * once ready to be updated. + * @retval listener##_init Generates a function `listener##_init` that should be called by the + * widget once ready to be updated. **/ #define ZMK_DISPLAY_WIDGET_LISTENER(listener, state_type, cb, state_func) \ K_MUTEX_DEFINE(listener##_mutex); \ diff --git a/app/include/zmk/event_manager.h b/app/include/zmk/event_manager.h index e4420715..0eb63ad7 100644 --- a/app/include/zmk/event_manager.h +++ b/app/include/zmk/event_manager.h @@ -64,6 +64,7 @@ struct zmk_event_subscription { #define ZMK_LISTENER(mod, cb) const struct zmk_listener zmk_listener_##mod = {.callback = cb}; #define ZMK_SUBSCRIPTION(mod, ev_type) \ + extern const struct zmk_listener zmk_listener_##mod; \ const Z_DECL_ALIGN(struct zmk_event_subscription) \ _CONCAT(_CONCAT(zmk_event_sub_, mod), ev_type) __used \ __attribute__((__section__(".event_subscription"))) = { \ diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index d1d3b7d4..766fb9c4 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -6,6 +6,8 @@ #pragma once +#include + #include #include @@ -23,6 +25,22 @@ #define ZMK_HID_KEYBOARD_NKRO_MAX_USAGE HID_USAGE_KEY_KEYPAD_EQUAL #endif +#if IS_ENABLED(CONFIG_ZMK_HID_CONSUMER_REPORT_USAGES_BASIC) +#define ZMK_HID_CONSUMER_MAX_USAGE 0xFF +#elif IS_ENABLED(CONFIG_ZMK_HID_CONSUMER_REPORT_USAGES_FULL) +#define ZMK_HID_CONSUMER_MAX_USAGE 0xFFF +#else +#error "Unknown consumer report usages configuration" +#endif + +#if IS_ENABLED(CONFIG_ZMK_HID_REPORT_TYPE_NKRO) +#define ZMK_HID_KEYBOARD_MAX_USAGE ZMK_HID_KEYBOARD_NKRO_MAX_USAGE +#elif IS_ENABLED(CONFIG_ZMK_HID_REPORT_TYPE_HKRO) +#define ZMK_HID_KEYBOARD_MAX_USAGE 0xFF +#else +#error "Unknown keyboard report usages configuration" +#endif + #define ZMK_HID_MOUSE_NUM_BUTTONS 0x05 // See https://www.usb.org/sites/default/files/hid1_11.pdf section 6.2.2.4 Main Items @@ -200,7 +218,7 @@ struct zmk_hid_keyboard_report_body { zmk_mod_flags_t modifiers; uint8_t _reserved; #if IS_ENABLED(CONFIG_ZMK_HID_REPORT_TYPE_NKRO) - uint8_t keys[(ZMK_HID_KEYBOARD_NKRO_MAX_USAGE + 1) / 8]; + uint8_t keys[DIV_ROUND_UP(ZMK_HID_KEYBOARD_NKRO_MAX_USAGE + 1, 8)]; #elif IS_ENABLED(CONFIG_ZMK_HID_REPORT_TYPE_HKRO) uint8_t keys[CONFIG_ZMK_HID_KEYBOARD_REPORT_SIZE]; #endif diff --git a/app/include/zmk/kscan.h b/app/include/zmk/kscan.h deleted file mode 100644 index eebe41e7..00000000 --- a/app/include/zmk/kscan.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2020 The ZMK Contributors - * - * SPDX-License-Identifier: MIT - */ - -#pragma once - -#include - -int zmk_kscan_init(const struct device *dev); diff --git a/app/include/zmk/matrix.h b/app/include/zmk/matrix.h index 5f8cd7d7..e38f5a49 100644 --- a/app/include/zmk/matrix.h +++ b/app/include/zmk/matrix.h @@ -9,15 +9,25 @@ #include #define ZMK_MATRIX_NODE_ID DT_CHOSEN(zmk_kscan) +#define ZMK_MATRIX_HAS_TRANSFORM DT_HAS_CHOSEN(zmk_matrix_transform) -#if DT_HAS_CHOSEN(zmk_matrix_transform) +#if DT_HAS_COMPAT_STATUS_OKAY(zmk_physical_layout) + +#if ZMK_MATRIX_HAS_TRANSFORM +#error "To use physical layouts, remove the chosen `zmk,matrix-transform` value." +#endif + +#define ZMK_PHYSICAL_LAYOUT_BYTE_ARRAY(node_id) \ + uint8_t _CONCAT(prop_, node_id)[DT_PROP_LEN(DT_PHANDLE(node_id, transform), map)]; + +#define ZMK_KEYMAP_LEN \ + sizeof(union {DT_FOREACH_STATUS_OKAY(zmk_physical_layout, ZMK_PHYSICAL_LAYOUT_BYTE_ARRAY)}) + +#elif ZMK_MATRIX_HAS_TRANSFORM #define ZMK_KEYMAP_TRANSFORM_NODE DT_CHOSEN(zmk_matrix_transform) #define ZMK_KEYMAP_LEN DT_PROP_LEN(ZMK_KEYMAP_TRANSFORM_NODE, map) -#define ZMK_MATRIX_ROWS DT_PROP(ZMK_KEYMAP_TRANSFORM_NODE, rows) -#define ZMK_MATRIX_COLS DT_PROP(ZMK_KEYMAP_TRANSFORM_NODE, columns) - #else /* DT_HAS_CHOSEN(zmk_matrix_transform) */ #if DT_NODE_HAS_PROP(ZMK_MATRIX_NODE_ID, row_gpios) diff --git a/app/include/zmk/matrix_transform.h b/app/include/zmk/matrix_transform.h index ffd3e3f1..42a98151 100644 --- a/app/include/zmk/matrix_transform.h +++ b/app/include/zmk/matrix_transform.h @@ -6,4 +6,16 @@ #pragma once -int32_t zmk_matrix_transform_row_column_to_position(uint32_t row, uint32_t column); \ No newline at end of file +#include + +typedef const struct zmk_matrix_transform *zmk_matrix_transform_t; + +#define ZMK_MATRIX_TRANSFORM_DEFAULT_EXTERN() \ + extern const struct zmk_matrix_transform zmk_matrix_transform_default +#define ZMK_MATRIX_TRANSFORM_EXTERN(node_id) \ + extern const struct zmk_matrix_transform _CONCAT(zmk_matrix_transform_, node_id) + +#define ZMK_MATRIX_TRANSFORM_T_FOR_NODE(node_id) &_CONCAT(zmk_matrix_transform_, node_id) + +int32_t zmk_matrix_transform_row_column_to_position(zmk_matrix_transform_t mt, uint32_t row, + uint32_t column); diff --git a/app/include/zmk/physical_layouts.h b/app/include/zmk/physical_layouts.h new file mode 100644 index 00000000..8d8188e3 --- /dev/null +++ b/app/include/zmk/physical_layouts.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include +#include + +struct zmk_key_physical_attrs { + int16_t width; + int16_t height; + int16_t x; + int16_t y; + int16_t rx; + int16_t ry; + int16_t r; +}; + +struct zmk_physical_layout { + const char *display_name; + + zmk_matrix_transform_t matrix_transform; + const struct device *kscan; + + const struct zmk_key_physical_attrs *keys; + size_t keys_len; +}; + +#define ZMK_PHYS_LAYOUTS_FOREACH(_ref) STRUCT_SECTION_FOREACH(zmk_physical_layout, _ref) + +size_t zmk_physical_layouts_get_list(struct zmk_physical_layout const *const **phys_layouts); + +int zmk_physical_layouts_select(uint8_t index); +int zmk_physical_layouts_get_selected(void); + +int zmk_physical_layouts_check_unsaved_selection(void); +int zmk_physical_layouts_save_selected(void); +int zmk_physical_layouts_revert_selected(void); + +int zmk_physical_layouts_get_position_map(uint8_t source, uint8_t dest, uint32_t *map); diff --git a/app/include/zmk/studio/core.h b/app/include/zmk/studio/core.h new file mode 100644 index 00000000..a8fdc8ff --- /dev/null +++ b/app/include/zmk/studio/core.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include + +enum zmk_studio_core_lock_state { + ZMK_STUDIO_CORE_LOCK_STATE_LOCKED = 0, + ZMK_STUDIO_CORE_LOCK_STATE_UNLOCKED = 1, +}; + +struct zmk_studio_core_lock_state_changed { + enum zmk_studio_core_lock_state state; +}; + +struct zmk_studio_core_unlock_requested {}; + +ZMK_EVENT_DECLARE(zmk_studio_core_lock_state_changed); + +enum zmk_studio_core_lock_state zmk_studio_core_get_lock_state(void); + +void zmk_studio_core_unlock(); +void zmk_studio_core_lock(); +void zmk_studio_core_initiate_unlock(); +void zmk_studio_core_complete_unlock(); + +void zmk_studio_core_reschedule_lock_timeout(); \ No newline at end of file diff --git a/app/include/zmk/studio/rpc.h b/app/include/zmk/studio/rpc.h new file mode 100644 index 00000000..07bd98e4 --- /dev/null +++ b/app/include/zmk/studio/rpc.h @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include +#include + +#include + +#include +#include +#include + +enum zmk_studio_rpc_handler_security { + ZMK_STUDIO_RPC_HANDLER_SECURED, + ZMK_STUDIO_RPC_HANDLER_UNSECURED, +}; + +struct zmk_studio_rpc_notification { + zmk_studio_Notification notification; +}; + +ZMK_EVENT_DECLARE(zmk_studio_rpc_notification); + +struct zmk_rpc_subsystem; + +typedef zmk_studio_Response(subsystem_func)(const struct zmk_rpc_subsystem *subsys, + const zmk_studio_Request *req); + +typedef zmk_studio_Response(rpc_func)(const zmk_studio_Request *neq); + +/** + * @brief An RPC subsystem is a cohesive collection of related RPCs. A specific RPC is identified by + * the pair or subsystem and request identifiers. This struct is the high level entity to + * aggregate all the possible handler functions for the request in the given subsystem. + */ +struct zmk_rpc_subsystem { + subsystem_func *func; + uint16_t handlers_start_index; + uint16_t handlers_end_index; + uint8_t subsystem_choice; +}; + +/** + * @brief An entry for a specific handler function in a given subsystem, including metadata + * indicating if the particular handler requires the device be unlock in order to be invoked. + */ +struct zmk_rpc_subsystem_handler { + rpc_func *func; + uint8_t subsystem_choice; + uint8_t request_choice; + enum zmk_studio_rpc_handler_security security; +}; + +/** + * @brief Generate a "meta" subsystem response indicating an "empty" response to an RPC request. + */ +#define ZMK_RPC_NO_RESPONSE() ZMK_RPC_RESPONSE(meta, no_response, true) + +/** + * @brief Generate a "meta" subsystem response with one of a few possible simple error responses. + * @see https://github.com/zmkfirmware/zmk-studio-messages/blob/main/proto/zmk/meta.proto#L5 + */ +#define ZMK_RPC_SIMPLE_ERR(type) \ + ZMK_RPC_RESPONSE(meta, simple_error, zmk_meta_ErrorConditions_##type) + +/** + * @brief Register an RPC subsystem to aggregate handlers for request to that subsystem. + * @param prefix The identifier for the subsystem, e.g. `core`, `keymap`, etc. + * @see https://github.com/zmkfirmware/zmk-studio-messages/blob/main/proto/zmk/studio.proto#L15 + */ +#define ZMK_RPC_SUBSYSTEM(prefix) \ + zmk_studio_Response subsystem_func_##prefix(const struct zmk_rpc_subsystem *subsys, \ + const zmk_studio_Request *req) { \ + uint8_t which_req = req->subsystem.prefix.which_request_type; \ + return zmk_rpc_subsystem_delegate_to_subs(subsys, req, which_req); \ + } \ + STRUCT_SECTION_ITERABLE(zmk_rpc_subsystem, prefix##_subsystem) = { \ + .func = subsystem_func_##prefix, \ + .subsystem_choice = zmk_studio_Request_##prefix##_tag, \ + }; + +/** + * @brief Register an RPC subsystem handler handler a specific request within the subsystem. + * @param prefix The identifier for the subsystem, e.g. `core`, `keymap`, etc. + * @param request_id The identifier for the request ID, e.g. `save_changes`. + * @param _secured Whether the handler requires the device be unlocked to allow invocation. + * + * @note A function with a name matching the request_id must be in-scope and will be used as the + * the callback handler. The function must have a signature of + * zmk_studio_Response (*func)(const zmk_studio_Request*) + */ +#define ZMK_RPC_SUBSYSTEM_HANDLER(prefix, request_id, _security) \ + STRUCT_SECTION_ITERABLE(zmk_rpc_subsystem_handler, \ + prefix##_subsystem_handler_##request_id) = { \ + .func = request_id, \ + .subsystem_choice = zmk_studio_Request_##prefix##_tag, \ + .request_choice = zmk_##prefix##_Request_##request_id##_tag, \ + .security = _security, \ + }; + +/** + * @brief Create a zmk_studio_Notification struct for the given subsystem and type, including + initialization of the inner fields. + * @param subsys The identifier for the subsystem, e.g. `core`, `keymap`, etc. + * @param _type The identifier for the notification type in that subsystem, e.g. + `unsaved_changes_status_changed`. + * + * @see example + https://github.com/zmkfirmware/zmk-studio-messages/blob/main/proto/zmk/keymap.proto#L41C14-L41C44 + */ +#define ZMK_RPC_NOTIFICATION(subsys, _type, ...) \ + ((zmk_studio_Notification){ \ + .which_subsystem = zmk_studio_Notification_##subsys##_tag, \ + .subsystem = \ + { \ + .subsys = \ + { \ + .which_notification_type = zmk_##subsys##_Notification_##_type##_tag, \ + .notification_type = {._type = __VA_ARGS__}, \ + }, \ + }, \ + }) + +/** + * @brief Create a zmk_studio_Response struct for the given subsystem and type, including + initialization of the inner fields. + * @param subsys The identifier for the subsystem, e.g. `core`, `keymap`, etc. + * @param _type The identifier for the response type in that subsystem, e.g. `get_keymap`. + * + * @see example + https://github.com/zmkfirmware/zmk-studio-messages/blob/main/proto/zmk/keymap.proto#L24 + */ +#define ZMK_RPC_RESPONSE(subsys, _type, ...) \ + ((zmk_studio_Response){ \ + .which_type = zmk_studio_Response_request_response_tag, \ + .type = \ + { \ + .request_response = \ + { \ + .which_subsystem = zmk_studio_RequestResponse_##subsys##_tag, \ + .subsystem = \ + { \ + .subsys = \ + { \ + .which_response_type = \ + zmk_##subsys##_Response_##_type##_tag, \ + .response_type = {._type = __VA_ARGS__}, \ + }, \ + }, \ + }, \ + }, \ + }) + +typedef int(zmk_rpc_event_mapper_cb)(const zmk_event_t *ev, zmk_studio_Notification *n); + +struct zmk_rpc_event_mapper { + zmk_rpc_event_mapper_cb *func; +}; + +/** + * @brief A single ZMK event listener is registered that will listen for events and map them to + * RPC notifications to be sent to the connected client. This macro adds additional + * subscriptions to that one single registered listener. + * @param _t The ZMK event type. + */ +#define ZMK_RPC_EVENT_MAPPER_ADD_LISTENER(_t) ZMK_SUBSCRIPTION(studio_rpc, _t) + +/** + * @brief Register a mapping function that can selectively map a given internal ZMK event type into + * a possible zmk_studio_Notification type. + * @param name A unique identifier for the mapper. Often a subsystem identifier like `core` is used. + * @param _func The `zmk_rpc_event_mapper_cb` function used to map the internal event type. + */ +#define ZMK_RPC_EVENT_MAPPER(name, _func, ...) \ + FOR_EACH_NONEMPTY_TERM(ZMK_RPC_EVENT_MAPPER_ADD_LISTENER, (;), __VA_ARGS__) \ + STRUCT_SECTION_ITERABLE(zmk_rpc_event_mapper, name) = { \ + .func = _func, \ + }; + +typedef int (*zmk_rpc_rx_start_stop_func)(void); + +typedef void (*zmk_rpc_tx_buffer_notify_func)(struct ring_buf *buf, size_t added, bool message_done, + void *user_data); +typedef void *(*zmk_rpc_tx_user_data_func)(void); + +struct zmk_rpc_transport { + enum zmk_transport transport; + + zmk_rpc_tx_user_data_func tx_user_data; + zmk_rpc_tx_buffer_notify_func tx_notify; + zmk_rpc_rx_start_stop_func rx_start; + zmk_rpc_rx_start_stop_func rx_stop; +}; + +zmk_studio_Response zmk_rpc_subsystem_delegate_to_subs(const struct zmk_rpc_subsystem *subsys, + const zmk_studio_Request *req, + uint8_t which_req); + +struct ring_buf *zmk_rpc_get_tx_buf(void); +struct ring_buf *zmk_rpc_get_rx_buf(void); +void zmk_rpc_rx_notify(void); + +#define ZMK_RPC_TRANSPORT(name, _transport, _rx_start, _rx_stop, _tx_user_data, _tx_notify) \ + STRUCT_SECTION_ITERABLE(zmk_rpc_transport, name) = { \ + .transport = _transport, \ + .rx_start = _rx_start, \ + .rx_stop = _rx_stop, \ + .tx_user_data = _tx_user_data, \ + .tx_notify = _tx_notify, \ + } diff --git a/app/module/drivers/kscan/kscan_composite.c b/app/module/drivers/kscan/kscan_composite.c index 2a364324..a064903a 100644 --- a/app/module/drivers/kscan/kscan_composite.c +++ b/app/module/drivers/kscan/kscan_composite.c @@ -7,6 +7,7 @@ #define DT_DRV_COMPAT zmk_kscan_composite #include +#include #include #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -26,10 +27,10 @@ struct kscan_composite_child_config { .row_offset = DT_PROP(inst, row_offset), \ .column_offset = DT_PROP(inst, column_offset)}, -const struct kscan_composite_child_config kscan_composite_children[] = { - DT_FOREACH_CHILD(MATRIX_NODE_ID, CHILD_CONFIG)}; - -struct kscan_composite_config {}; +struct kscan_composite_config { + const struct kscan_composite_child_config *children; + size_t children_len; +}; struct kscan_composite_data { kscan_callback_t callback; @@ -38,51 +39,80 @@ struct kscan_composite_data { }; static int kscan_composite_enable_callback(const struct device *dev) { - for (int i = 0; i < ARRAY_SIZE(kscan_composite_children); i++) { - const struct kscan_composite_child_config *cfg = &kscan_composite_children[i]; + const struct kscan_composite_config *cfg = dev->config; - kscan_enable_callback(cfg->child); + for (int i = 0; i < cfg->children_len; i++) { + const struct kscan_composite_child_config *child_cfg = &cfg->children[i]; + +#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) + if (!pm_device_runtime_is_enabled(dev) && pm_device_runtime_is_enabled(child_cfg->child)) { + pm_device_runtime_get(child_cfg->child); + } +#elif IS_ENABLED(CONFIG_PM_DEVICE) + pm_device_action_run(child_cfg->child, PM_DEVICE_ACTION_RESUME); +#endif // IS_ENABLED(CONFIG_PM_DEVICE) + + kscan_enable_callback(child_cfg->child); } return 0; } static int kscan_composite_disable_callback(const struct device *dev) { - for (int i = 0; i < ARRAY_SIZE(kscan_composite_children); i++) { - const struct kscan_composite_child_config *cfg = &kscan_composite_children[i]; + const struct kscan_composite_config *cfg = dev->config; + for (int i = 0; i < cfg->children_len; i++) { + const struct kscan_composite_child_config *child_cfg = &cfg->children[i]; - kscan_disable_callback(cfg->child); + kscan_disable_callback(child_cfg->child); + +#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) + if (!pm_device_runtime_is_enabled(dev) && pm_device_runtime_is_enabled(child_cfg->child)) { + pm_device_runtime_put(child_cfg->child); + } +#elif IS_ENABLED(CONFIG_PM_DEVICE) + pm_device_action_run(child_cfg->child, PM_DEVICE_ACTION_SUSPEND); +#endif // IS_ENABLED(CONFIG_PM_DEVICE) } return 0; } +#define KSCAN_COMP_INST_DEV(n) DEVICE_DT_GET(DT_DRV_INST(n)), + +static const struct device *all_instances[] = {DT_INST_FOREACH_STATUS_OKAY(KSCAN_COMP_INST_DEV)}; + static void kscan_composite_child_callback(const struct device *child_dev, uint32_t row, uint32_t column, bool pressed) { // TODO: Ideally we can get this passed into our callback! - const struct device *dev = DEVICE_DT_GET(DT_DRV_INST(0)); - struct kscan_composite_data *data = dev->data; + for (int i = 0; i < ARRAY_SIZE(all_instances); i++) { - for (int i = 0; i < ARRAY_SIZE(kscan_composite_children); i++) { - const struct kscan_composite_child_config *cfg = &kscan_composite_children[i]; + const struct device *dev = all_instances[i]; + const struct kscan_composite_config *cfg = dev->config; + struct kscan_composite_data *data = dev->data; - if (cfg->child != child_dev) { - continue; + for (int c = 0; c < cfg->children_len; c++) { + const struct kscan_composite_child_config *child_cfg = &cfg->children[c]; + + if (child_cfg->child != child_dev) { + continue; + } + + data->callback(dev, row + child_cfg->row_offset, column + child_cfg->column_offset, + pressed); } - - data->callback(dev, row + cfg->row_offset, column + cfg->column_offset, pressed); } } static int kscan_composite_configure(const struct device *dev, kscan_callback_t callback) { + const struct kscan_composite_config *cfg = dev->config; struct kscan_composite_data *data = dev->data; if (!callback) { return -EINVAL; } - for (int i = 0; i < ARRAY_SIZE(kscan_composite_children); i++) { - const struct kscan_composite_child_config *cfg = &kscan_composite_children[i]; + for (int i = 0; i < cfg->children_len; i++) { + const struct kscan_composite_child_config *child_cfg = &cfg->children[i]; - kscan_config(cfg->child, &kscan_composite_child_callback); + kscan_config(child_cfg->child, &kscan_composite_child_callback); } data->callback = callback; @@ -95,6 +125,10 @@ static int kscan_composite_init(const struct device *dev) { data->dev = dev; +#if IS_ENABLED(CONFIG_PM_DEVICE) + pm_device_init_suspended(dev); +#endif + return 0; } @@ -104,9 +138,32 @@ static const struct kscan_driver_api mock_driver_api = { .disable_callback = kscan_composite_disable_callback, }; -static const struct kscan_composite_config kscan_composite_config = {}; +#if IS_ENABLED(CONFIG_PM_DEVICE) -static struct kscan_composite_data kscan_composite_data; +static int kscan_composite_pm_action(const struct device *dev, enum pm_device_action action) { + switch (action) { + case PM_DEVICE_ACTION_SUSPEND: + return kscan_composite_disable_callback(dev); + case PM_DEVICE_ACTION_RESUME: + return kscan_composite_enable_callback(dev); + default: + return -ENOTSUP; + } +} -DEVICE_DT_INST_DEFINE(0, kscan_composite_init, NULL, &kscan_composite_data, &kscan_composite_config, - POST_KERNEL, CONFIG_ZMK_KSCAN_COMPOSITE_INIT_PRIORITY, &mock_driver_api); +#endif // IS_ENABLED(CONFIG_PM_DEVICE) + +#define KSCAN_COMP_DEV(n) \ + static const struct kscan_composite_child_config kscan_composite_children_##n[] = { \ + DT_INST_FOREACH_CHILD(n, CHILD_CONFIG)}; \ + static const struct kscan_composite_config kscan_composite_config_##n = { \ + .children = kscan_composite_children_##n, \ + .children_len = ARRAY_SIZE(kscan_composite_children_##n), \ + }; \ + static struct kscan_composite_data kscan_composite_data_##n; \ + PM_DEVICE_DT_INST_DEFINE(n, kscan_composite_pm_action); \ + DEVICE_DT_INST_DEFINE(n, kscan_composite_init, PM_DEVICE_DT_INST_GET(n), \ + &kscan_composite_data_##n, &kscan_composite_config_##n, POST_KERNEL, \ + CONFIG_ZMK_KSCAN_COMPOSITE_INIT_PRIORITY, &mock_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(KSCAN_COMP_DEV) diff --git a/app/module/drivers/kscan/kscan_gpio_charlieplex.c b/app/module/drivers/kscan/kscan_gpio_charlieplex.c index 3ecbcd6a..f48a6a2f 100644 --- a/app/module/drivers/kscan/kscan_gpio_charlieplex.c +++ b/app/module/drivers/kscan/kscan_gpio_charlieplex.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -167,6 +168,21 @@ static int kscan_charlieplex_set_all_outputs(const struct device *dev, const int return 0; } +static int kscan_charlieplex_disconnect_all(const struct device *dev) { + const struct kscan_charlieplex_config *config = dev->config; + + for (int i = 0; i < config->cells.len; i++) { + const struct gpio_dt_spec *gpio = &config->cells.gpios[i]; + int err = gpio_pin_configure_dt(gpio, GPIO_DISCONNECTED); + if (err) { + LOG_ERR("Unable to configure pin %u on %s for input", gpio->pin, gpio->port->name); + return err; + } + } + + return 0; +} + static int kscan_charlieplex_interrupt_configure(const struct device *dev, const gpio_flags_t flags) { const struct kscan_charlieplex_config *config = dev->config; @@ -359,11 +375,7 @@ static int kscan_charlieplex_init_interrupt(const struct device *dev) { return err; } -static int kscan_charlieplex_init(const struct device *dev) { - struct kscan_charlieplex_data *data = dev->data; - - data->dev = dev; - +static void kscan_charlieplex_setup_pins(const struct device *dev) { kscan_charlieplex_init_inputs(dev); kscan_charlieplex_set_all_outputs(dev, 0); @@ -371,7 +383,46 @@ static int kscan_charlieplex_init(const struct device *dev) { if (config->use_interrupt) { kscan_charlieplex_init_interrupt(dev); } +} + +#if IS_ENABLED(CONFIG_PM_DEVICE) + +static int kscan_charlieplex_pm_action(const struct device *dev, enum pm_device_action action) { + switch (action) { + case PM_DEVICE_ACTION_SUSPEND: + kscan_charlieplex_interrupt_configure(dev, GPIO_INT_DISABLE); + kscan_charlieplex_disconnect_all(dev); + + return kscan_charlieplex_disable(dev); + case PM_DEVICE_ACTION_RESUME: + kscan_charlieplex_setup_pins(dev); + + return kscan_charlieplex_enable(dev); + default: + return -ENOTSUP; + } +} + +#endif // IS_ENABLED(CONFIG_PM_DEVICE) + +static int kscan_charlieplex_init(const struct device *dev) { + struct kscan_charlieplex_data *data = dev->data; + + data->dev = dev; + k_work_init_delayable(&data->work, kscan_charlieplex_work_handler); + +#if IS_ENABLED(CONFIG_PM_DEVICE) + pm_device_init_suspended(dev); + +#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) + pm_device_runtime_enable(dev); +#endif + +#else + kscan_charlieplex_setup_pins(dev); +#endif + return 0; } @@ -406,8 +457,10 @@ static const struct kscan_driver_api kscan_charlieplex_api = { COND_THIS_INTERRUPT(n, (.use_interrupt = INST_INTR_DEFINED(n), )) \ COND_THIS_INTERRUPT(n, (.interrupt = KSCAN_INTR_CFG_INIT(n), ))}; \ \ - DEVICE_DT_INST_DEFINE(n, &kscan_charlieplex_init, NULL, &kscan_charlieplex_data_##n, \ - &kscan_charlieplex_config_##n, POST_KERNEL, CONFIG_KSCAN_INIT_PRIORITY, \ - &kscan_charlieplex_api); + PM_DEVICE_DT_INST_DEFINE(n, kscan_charlieplex_pm_action); \ + \ + DEVICE_DT_INST_DEFINE(n, &kscan_charlieplex_init, PM_DEVICE_DT_INST_GET(n), \ + &kscan_charlieplex_data_##n, &kscan_charlieplex_config_##n, POST_KERNEL, \ + CONFIG_KSCAN_INIT_PRIORITY, &kscan_charlieplex_api); DT_INST_FOREACH_STATUS_OKAY(KSCAN_CHARLIEPLEX_INIT); diff --git a/app/module/drivers/kscan/kscan_gpio_direct.c b/app/module/drivers/kscan/kscan_gpio_direct.c index fa24e69e..245e78b5 100644 --- a/app/module/drivers/kscan/kscan_gpio_direct.c +++ b/app/module/drivers/kscan/kscan_gpio_direct.c @@ -294,6 +294,24 @@ static int kscan_direct_init_input_inst(const struct device *dev, const struct g return 0; } +#if IS_ENABLED(CONFIG_PM_DEVICE) + +static int kscan_direct_disconnect_inputs(const struct device *dev) { + const struct kscan_direct_data *data = dev->data; + + for (int i = 0; i < data->inputs.len; i++) { + const struct gpio_dt_spec *gpio = &data->inputs.gpios[i].spec; + int err = gpio_pin_configure_dt(gpio, GPIO_DISCONNECTED); + if (err) { + return err; + } + } + + return 0; +} + +#endif // IS_ENABLED(CONFIG_PM_DEVICE) + 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; @@ -317,9 +335,20 @@ static int kscan_direct_init(const struct device *dev) { // Sort inputs by port so we can read each port just once per scan. kscan_gpio_list_sort_by_port(&data->inputs); + k_work_init_delayable(&data->work, kscan_direct_work_handler); + +#if IS_ENABLED(CONFIG_PM_DEVICE) + pm_device_init_suspended(dev); + +#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) + pm_device_runtime_enable(dev); +#endif + +#else + kscan_direct_init_inputs(dev); - k_work_init_delayable(&data->work, kscan_direct_work_handler); +#endif return 0; } @@ -329,8 +358,10 @@ static int kscan_direct_init(const struct device *dev) { static int kscan_direct_pm_action(const struct device *dev, enum pm_device_action action) { switch (action) { case PM_DEVICE_ACTION_SUSPEND: + kscan_direct_disconnect_inputs(dev); return kscan_direct_disable(dev); case PM_DEVICE_ACTION_RESUME: + kscan_direct_init_inputs(dev); return kscan_direct_enable(dev); default: return -ENOTSUP; diff --git a/app/module/drivers/kscan/kscan_gpio_matrix.c b/app/module/drivers/kscan/kscan_gpio_matrix.c index 8a3c39f2..e0c76395 100644 --- a/app/module/drivers/kscan/kscan_gpio_matrix.c +++ b/app/module/drivers/kscan/kscan_gpio_matrix.c @@ -405,6 +405,44 @@ static int kscan_matrix_init_outputs(const struct device *dev) { return 0; } +#if IS_ENABLED(CONFIG_PM_DEVICE) + +static int kscan_matrix_disconnect_inputs(const struct device *dev) { + const struct kscan_matrix_data *data = dev->data; + + for (int i = 0; i < data->inputs.len; i++) { + const struct gpio_dt_spec *gpio = &data->inputs.gpios[i].spec; + int err = gpio_pin_configure_dt(gpio, GPIO_DISCONNECTED); + if (err) { + return err; + } + } + + return 0; +} + +static int kscan_matrix_disconnect_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].spec; + int err = gpio_pin_configure_dt(gpio, GPIO_DISCONNECTED); + if (err) { + return err; + } + } + + return 0; +} + +#endif // IS_ENABLED(CONFIG_PM_DEVICE) + +static void kscan_matrix_setup_pins(const struct device *dev) { + kscan_matrix_init_inputs(dev); + kscan_matrix_init_outputs(dev); + kscan_matrix_set_all_outputs(dev, 0); +} + static int kscan_matrix_init(const struct device *dev) { struct kscan_matrix_data *data = dev->data; @@ -413,12 +451,19 @@ static int kscan_matrix_init(const struct device *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); - k_work_init_delayable(&data->work, kscan_matrix_work_handler); +#if IS_ENABLED(CONFIG_PM_DEVICE) + pm_device_init_suspended(dev); + +#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) + pm_device_runtime_enable(dev); +#endif + +#else + kscan_matrix_setup_pins(dev); +#endif + return 0; } @@ -427,8 +472,12 @@ static int kscan_matrix_init(const struct device *dev) { static int kscan_matrix_pm_action(const struct device *dev, enum pm_device_action action) { switch (action) { case PM_DEVICE_ACTION_SUSPEND: + kscan_matrix_disconnect_inputs(dev); + kscan_matrix_disconnect_outputs(dev); + return kscan_matrix_disable(dev); case PM_DEVICE_ACTION_RESUME: + kscan_matrix_setup_pins(dev); return kscan_matrix_enable(dev); default: return -ENOTSUP; diff --git a/app/snippets/studio-rpc-usb-uart/snippet.yml b/app/snippets/studio-rpc-usb-uart/snippet.yml new file mode 100644 index 00000000..e0e334de --- /dev/null +++ b/app/snippets/studio-rpc-usb-uart/snippet.yml @@ -0,0 +1,7 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT + +name: studio-rpc-usb-uart +append: + EXTRA_DTC_OVERLAY_FILE: studio-rpc-usb-uart.overlay + EXTRA_CONF_FILE: studio-rpc-usb-uart.conf diff --git a/app/snippets/studio-rpc-usb-uart/studio-rpc-usb-uart.conf b/app/snippets/studio-rpc-usb-uart/studio-rpc-usb-uart.conf new file mode 100644 index 00000000..84f25e09 --- /dev/null +++ b/app/snippets/studio-rpc-usb-uart/studio-rpc-usb-uart.conf @@ -0,0 +1,9 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT + +CONFIG_ZMK_USB=y +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_CDC_ACM=y +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_UART_LINE_CTRL=y diff --git a/app/snippets/studio-rpc-usb-uart/studio-rpc-usb-uart.overlay b/app/snippets/studio-rpc-usb-uart/studio-rpc-usb-uart.overlay new file mode 100644 index 00000000..82da5a10 --- /dev/null +++ b/app/snippets/studio-rpc-usb-uart/studio-rpc-usb-uart.overlay @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/ { + chosen { + zmk,studio-rpc-uart = &snippet_studio_rpc_usb_uart; + }; +}; + +&zephyr_udc0 { + snippet_studio_rpc_usb_uart: snippet_studio_rpc_usb_uart { + compatible = "zephyr,cdc-acm-uart"; + }; +}; + diff --git a/app/snippets/zmk-usb-logging/snippet.yml b/app/snippets/zmk-usb-logging/snippet.yml new file mode 100644 index 00000000..8f218085 --- /dev/null +++ b/app/snippets/zmk-usb-logging/snippet.yml @@ -0,0 +1,4 @@ +name: zmk-usb-logging +append: + EXTRA_CONF_FILE: zmk-usb-logging.conf + EXTRA_DTC_OVERLAY_FILE: zmk-usb-logging.overlay diff --git a/app/snippets/zmk-usb-logging/zmk-usb-logging.conf b/app/snippets/zmk-usb-logging/zmk-usb-logging.conf new file mode 100644 index 00000000..57893df5 --- /dev/null +++ b/app/snippets/zmk-usb-logging/zmk-usb-logging.conf @@ -0,0 +1,2 @@ +CONFIG_ZMK_USB_LOGGING=y + diff --git a/app/snippets/zmk-usb-logging/zmk-usb-logging.overlay b/app/snippets/zmk-usb-logging/zmk-usb-logging.overlay new file mode 100644 index 00000000..5ceda583 --- /dev/null +++ b/app/snippets/zmk-usb-logging/zmk-usb-logging.overlay @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/ { + chosen { + zephyr,console = &snippet_zmk_usb_logging_uart; + zephyr,shell-uart = &snippet_zmk_usb_logging_uart; + }; +}; + +&zephyr_udc0 { + snippet_zmk_usb_logging_uart: snippet_zmk_usb_logging_uart { + compatible = "zephyr,cdc-acm-uart"; + }; +}; diff --git a/app/src/backlight.c b/app/src/backlight.c index f050978f..22b73066 100644 --- a/app/src/backlight.c +++ b/app/src/backlight.c @@ -58,7 +58,7 @@ static int zmk_backlight_update(void) { #if IS_ENABLED(CONFIG_SETTINGS) static int backlight_settings_load_cb(const char *name, size_t len, settings_read_cb read_cb, - void *cb_arg, void *param) { + void *cb_arg) { const char *next; if (settings_name_steq(name, "state", &next) && !next) { if (len != sizeof(state)) { @@ -66,11 +66,18 @@ static int backlight_settings_load_cb(const char *name, size_t len, settings_rea } int rc = read_cb(cb_arg, &state, sizeof(state)); + if (rc >= 0) { + rc = zmk_backlight_update(); + } + return MIN(rc, 0); } return -ENOENT; } +SETTINGS_STATIC_HANDLER_DEFINE(backlight, "backlight", NULL, backlight_settings_load_cb, NULL, + NULL); + static void backlight_save_work_handler(struct k_work *work) { settings_save_one("backlight/state", &state, sizeof(state)); } @@ -85,11 +92,6 @@ static int zmk_backlight_init(void) { } #if IS_ENABLED(CONFIG_SETTINGS) - settings_subsys_init(); - int rc = settings_load_subtree_direct("backlight", backlight_settings_load_cb, NULL); - if (rc != 0) { - LOG_ERR("Failed to load backlight settings: %d", rc); - } k_work_init_delayable(&backlight_save_work, backlight_save_work_handler); #endif #if IS_ENABLED(CONFIG_ZMK_BACKLIGHT_AUTO_OFF_USB) diff --git a/app/src/behavior.c b/app/src/behavior.c index fa2005ff..e69cdf88 100644 --- a/app/src/behavior.c +++ b/app/src/behavior.c @@ -6,11 +6,21 @@ #include #include +#include #include #include +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_LOCAL_IDS) && \ + IS_ENABLED(CONFIG_ZMK_BEHAVIOR_LOCAL_ID_TYPE_SETTINGS_TABLE) + +#include + +#endif + #include #include +#include +#include #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -39,6 +49,269 @@ const struct device *z_impl_behavior_get_binding(const char *name) { return NULL; } +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +int zmk_behavior_get_empty_param_metadata(const struct device *dev, + struct behavior_parameter_metadata *metadata) { + metadata->sets_len = 0; + return 0; +} + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) +static int validate_hid_usage(uint16_t usage_page, uint16_t usage_id) { + LOG_DBG("Validate usage %d in page %d", usage_id, usage_page); + switch (usage_page) { + case HID_USAGE_KEY: + if (usage_id == 0 || (usage_id > ZMK_HID_KEYBOARD_NKRO_MAX_USAGE && + usage_id < LEFT_CONTROL && usage_id > RIGHT_GUI)) { + return -EINVAL; + } + break; + case HID_USAGE_CONSUMER: + if (usage_id > + COND_CODE_1(IS_ENABLED(CONFIG_ZMK_HID_CONSUMER_REPORT_USAGES_BASIC), (0xFF), (0xFFF))) { + return -EINVAL; + } + break; + default: + LOG_WRN("Unsupported HID usage page %d", usage_page); + return -EINVAL; + } + + return 0; +} + +#define PARAM_MATCHES 0 + +static int check_param_matches_value(const struct behavior_parameter_value_metadata *value_meta, + uint32_t param) { + switch (value_meta->type) { + case BEHAVIOR_PARAMETER_VALUE_TYPE_NIL: + if (param == 0) { + return PARAM_MATCHES; + } + break; + case BEHAVIOR_PARAMETER_VALUE_TYPE_HID_USAGE: + if (validate_hid_usage(ZMK_HID_USAGE_PAGE(param), ZMK_HID_USAGE_ID(param)) >= 0) { + return PARAM_MATCHES; + } + + break; + case BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID: + if (param >= 0 && param < ZMK_KEYMAP_LEN) { + return PARAM_MATCHES; + } + break; + /* TODO: Restore with HSV -> RGB refactor + case BEHAVIOR_PARAMETER_STANDARD_DOMAIN_HSV: + // TODO: No real way to validate? Maybe max brightness? + break; + */ + case BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE: + if (param == value_meta->value) { + return PARAM_MATCHES; + } + break; + case BEHAVIOR_PARAMETER_VALUE_TYPE_RANGE: + if (param >= value_meta->range.min && param <= value_meta->range.max) { + return PARAM_MATCHES; + } + break; + default: + LOG_WRN("Unknown type %d", value_meta->type); + break; + } + + return -ENOTSUP; +} + +int zmk_behavior_validate_param_values(const struct behavior_parameter_value_metadata *values, + size_t values_len, uint32_t param) { + if (values_len == 0) { + return -ENODEV; + } + + for (int v = 0; v < values_len; v++) { + int ret = check_param_matches_value(&values[v], param); + if (ret >= 0) { + return ret; + } + } + + return -EINVAL; +} + +int zmk_behavior_check_params_match_metadata(const struct behavior_parameter_metadata *metadata, + uint32_t param1, uint32_t param2) { + if (!metadata || metadata->sets_len == 0) { + if (!metadata) { + LOG_ERR("No metadata to check against"); + } + + return (param1 == 0 && param2 == 0) ? 0 : -ENODEV; + } + + for (int s = 0; s < metadata->sets_len; s++) { + const struct behavior_parameter_metadata_set *set = &metadata->sets[s]; + int param1_ret = + zmk_behavior_validate_param_values(set->param1_values, set->param1_values_len, param1); + int param2_ret = + zmk_behavior_validate_param_values(set->param2_values, set->param2_values_len, param2); + + if ((param1_ret >= 0 || (param1_ret == -ENODEV && param1 == 0)) && + (param2_ret >= 0 || (param2_ret == -ENODEV && param2 == 0))) { + return 0; + } + } + + return -EINVAL; +} + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +int zmk_behavior_validate_binding(const struct zmk_behavior_binding *binding) { +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + const struct device *behavior = zmk_behavior_get_binding(binding->behavior_dev); + + if (!behavior) { + return -ENODEV; + } + + struct behavior_parameter_metadata metadata; + int ret = behavior_get_parameter_metadata(behavior, &metadata); + + if (ret < 0) { + LOG_WRN("Failed getting metadata for %s: %d", binding->behavior_dev, ret); + return ret; + } + + return zmk_behavior_check_params_match_metadata(&metadata, binding->param1, binding->param2); +#else + return 0; +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) +} + +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_LOCAL_IDS) + +zmk_behavior_local_id_t zmk_behavior_get_local_id(const char *name) { + if (!name) { + return UINT16_MAX; + } + + STRUCT_SECTION_FOREACH(zmk_behavior_local_id_map, item) { + if (z_device_is_ready(item->device) && strcmp(item->device->name, name) == 0) { + return item->local_id; + } + } + + return UINT16_MAX; +} + +const char *zmk_behavior_find_behavior_name_from_local_id(zmk_behavior_local_id_t local_id) { + STRUCT_SECTION_FOREACH(zmk_behavior_local_id_map, item) { + if (z_device_is_ready(item->device) && item->local_id == local_id) { + return item->device->name; + } + } + + return NULL; +} + +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_LOCAL_ID_TYPE_CRC16) + +static int behavior_local_id_init(void) { + STRUCT_SECTION_FOREACH(zmk_behavior_local_id_map, item) { + item->local_id = crc16_ansi(item->device->name, strlen(item->device->name)); + } + + return 0; +} + +SYS_INIT(behavior_local_id_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); + +#elif IS_ENABLED(CONFIG_ZMK_BEHAVIOR_LOCAL_ID_TYPE_SETTINGS_TABLE) + +static zmk_behavior_local_id_t largest_local_id = 0; + +static int behavior_handle_set(const char *name, size_t len, settings_read_cb read_cb, + void *cb_arg) { + const char *next; + + if (settings_name_steq(name, "local_id", &next) && next) { + char *endptr; + zmk_behavior_local_id_t local_id = strtoul(next, &endptr, 10); + if (*endptr != '\0') { + LOG_WRN("Invalid behavior local ID: %s with endptr %s", next, endptr); + return -EINVAL; + } + + if (len >= 64) { + LOG_ERR("Too large binding setting size (got %d expected less than %d)", len, 64); + return -EINVAL; + } + + char name[len + 1]; + + int err = read_cb(cb_arg, name, len); + if (err <= 0) { + LOG_ERR("Failed to handle keymap binding from settings (err %d)", err); + return err; + } + + name[len] = '\0'; + STRUCT_SECTION_FOREACH(zmk_behavior_local_id_map, item) { + if (strcmp(name, item->device->name) == 0) { + item->local_id = local_id; + largest_local_id = MAX(largest_local_id, local_id); + return 0; + } + } + + return -EINVAL; + } + + return 0; +} + +static int behavior_handle_commit(void) { + STRUCT_SECTION_FOREACH(zmk_behavior_local_id_map, item) { + if (item->local_id != 0) { + continue; + } + + if (!item->device || !item->device->name || !device_is_ready(item->device)) { + LOG_WRN("Skipping ID for device that doesn't exist or isn't ready"); + continue; + } + + item->local_id = ++largest_local_id; + char setting_name[32]; + sprintf(setting_name, "behavior/local_id/%d", item->local_id); + + // If the `device->name` is readonly in flash, settings save can fail to copy/read it while + // persisting to flash, so copy the device name into memory first before saving. + char device_name[32]; + snprintf(device_name, ARRAY_SIZE(device_name), "%s", item->device->name); + + settings_save_one(setting_name, device_name, strlen(device_name)); + } + + return 0; +} + +SETTINGS_STATIC_HANDLER_DEFINE(behavior, "behavior", NULL, behavior_handle_set, + behavior_handle_commit, NULL); + +#else + +#error "A behavior local ID mechanism must be selected" + +#endif + +#endif + #if IS_ENABLED(CONFIG_LOG) static int check_behavior_names(void) { // Behavior names must be unique, but we don't have a good way to enforce this diff --git a/app/src/behaviors/behavior_backlight.c b/app/src/behaviors/behavior_backlight.c index 3f836b73..d67ce2e7 100644 --- a/app/src/behaviors/behavior_backlight.c +++ b/app/src/behaviors/behavior_backlight.c @@ -18,6 +18,82 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static const struct behavior_parameter_value_metadata no_arg_values[] = { + { + .display_name = "Toggle On/Off", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BL_TOG_CMD, + }, + { + .display_name = "Turn On", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BL_ON_CMD, + }, + { + .display_name = "Turn OFF", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BL_OFF_CMD, + }, + { + .display_name = "Increase Brightness", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BL_INC_CMD, + }, + { + .display_name = "Decrease Brightness", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BL_DEC_CMD, + }, + { + .display_name = "Cycle Brightness", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BL_CYCLE_CMD, + }, +}; + +static const struct behavior_parameter_value_metadata one_arg_p1_values[] = { + { + .display_name = "Set Brightness", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BL_SET_CMD, + }, +}; + +static const struct behavior_parameter_value_metadata one_arg_p2_values[] = { + { + .display_name = "Brightness", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_RANGE, + .range = + { + .min = 0, + .max = 255, + }, + }, +}; + +static const struct behavior_parameter_metadata_set no_args_set = { + .param1_values = no_arg_values, + .param1_values_len = ARRAY_SIZE(no_arg_values), +}; + +static const struct behavior_parameter_metadata_set one_args_set = { + .param1_values = one_arg_p1_values, + .param1_values_len = ARRAY_SIZE(one_arg_p1_values), + .param2_values = one_arg_p2_values, + .param2_values_len = ARRAY_SIZE(one_arg_p2_values), +}; + +static const struct behavior_parameter_metadata_set sets[] = {no_args_set, one_args_set}; + +static const struct behavior_parameter_metadata metadata = { + .sets_len = ARRAY_SIZE(sets), + .sets = sets, +}; + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + static int behavior_backlight_init(const struct device *dev) { return 0; } static int @@ -89,6 +165,9 @@ static const struct behavior_driver_api behavior_backlight_driver_api = { .binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released, .locality = BEHAVIOR_LOCALITY_GLOBAL, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .parameter_metadata = &metadata, +#endif }; BEHAVIOR_DT_INST_DEFINE(0, behavior_backlight_init, NULL, NULL, NULL, POST_KERNEL, diff --git a/app/src/behaviors/behavior_bt.c b/app/src/behaviors/behavior_bt.c index 03bb7d8c..f439e49b 100644 --- a/app/src/behaviors/behavior_bt.c +++ b/app/src/behaviors/behavior_bt.c @@ -20,6 +20,74 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static const struct behavior_parameter_value_metadata no_arg_values[] = { + { + .display_name = "Next Profile", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BT_NXT_CMD, + }, + { + .display_name = "Previous Profile", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BT_PRV_CMD, + }, + { + .display_name = "Clear All Profiles", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BT_CLR_ALL_CMD, + }, + { + .display_name = "Clear Selected Profile", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BT_CLR_CMD, + }, +}; + +static const struct behavior_parameter_metadata_set no_args_set = { + .param1_values = no_arg_values, + .param1_values_len = ARRAY_SIZE(no_arg_values), +}; + +static const struct behavior_parameter_value_metadata prof_index_param1_values[] = { + { + .display_name = "Select Profile", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BT_SEL_CMD, + }, + { + .display_name = "Disconnect Profile", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = BT_DISC_CMD, + }, +}; + +static const struct behavior_parameter_value_metadata prof_index_param2_values[] = { + { + .display_name = "Profile", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_RANGE, + .range = {.min = 0, .max = ZMK_BLE_PROFILE_COUNT}, + }, +}; + +static const struct behavior_parameter_metadata_set profile_index_metadata_set = { + .param1_values = prof_index_param1_values, + .param1_values_len = ARRAY_SIZE(prof_index_param1_values), + .param2_values = prof_index_param2_values, + .param2_values_len = ARRAY_SIZE(prof_index_param2_values), +}; + +static const struct behavior_parameter_metadata_set metadata_sets[] = {no_args_set, + profile_index_metadata_set}; + +static const struct behavior_parameter_metadata metadata = { + .sets_len = ARRAY_SIZE(metadata_sets), + .sets = metadata_sets, +}; + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding, struct zmk_behavior_binding_event event) { switch (binding->param1) { @@ -54,6 +122,9 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding, static const struct behavior_driver_api behavior_bt_driver_api = { .binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .parameter_metadata = &metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; BEHAVIOR_DT_INST_DEFINE(0, behavior_bt_init, NULL, NULL, NULL, POST_KERNEL, diff --git a/app/src/behaviors/behavior_caps_word.c b/app/src/behaviors/behavior_caps_word.c index d9b3f24e..bf74a4b3 100644 --- a/app/src/behaviors/behavior_caps_word.c +++ b/app/src/behaviors/behavior_caps_word.c @@ -75,6 +75,9 @@ static int on_caps_word_binding_released(struct zmk_behavior_binding *binding, static const struct behavior_driver_api behavior_caps_word_driver_api = { .binding_pressed = on_caps_word_binding_pressed, .binding_released = on_caps_word_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = zmk_behavior_get_empty_param_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; static int caps_word_keycode_state_changed_listener(const zmk_event_t *eh); diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index 204e50f4..c45ee803 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -24,8 +24,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) -#define ZMK_BHV_HOLD_TAP_MAX_HELD 10 -#define ZMK_BHV_HOLD_TAP_MAX_CAPTURED_EVENTS 40 +#define ZMK_BHV_HOLD_TAP_MAX_HELD CONFIG_ZMK_BEHAVIOR_HOLD_TAP_MAX_HELD +#define ZMK_BHV_HOLD_TAP_MAX_CAPTURED_EVENTS CONFIG_ZMK_BEHAVIOR_HOLD_TAP_MAX_CAPTURED_EVENTS // increase if you have keyboard with more keys. #define ZMK_BHV_HOLD_TAP_POSITION_NOT_USED 9999 @@ -68,6 +68,12 @@ struct behavior_hold_tap_config { int32_t hold_trigger_key_positions[]; }; +struct behavior_hold_tap_data { +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + struct behavior_parameter_metadata_set set; +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) +}; + // this data is specific for each hold-tap struct active_hold_tap { int32_t position; @@ -181,7 +187,7 @@ static void release_captured_events() { // // Events for different mod-tap instances are separated by a NULL pointer. // - // The first event popped will never be catched by the next active hold-tap + // The first event popped will never be caught by the next active hold-tap // because to start capturing a mod-tap-key-down event must first completely // go through the events queue. // @@ -652,9 +658,52 @@ static int on_hold_tap_binding_released(struct zmk_behavior_binding *binding, return ZMK_BEHAVIOR_OPAQUE; } +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) +static int hold_tap_parameter_metadata(const struct device *hold_tap, + struct behavior_parameter_metadata *param_metadata) { + const struct behavior_hold_tap_config *cfg = hold_tap->config; + struct behavior_hold_tap_data *data = hold_tap->data; + int err; + struct behavior_parameter_metadata child_meta; + + err = behavior_get_parameter_metadata(zmk_behavior_get_binding(cfg->hold_behavior_dev), + &child_meta); + if (err < 0) { + LOG_WRN("Failed to get the hold behavior parameter: %d", err); + return err; + } + + if (child_meta.sets_len > 0) { + data->set.param1_values = child_meta.sets[0].param1_values; + data->set.param1_values_len = child_meta.sets[0].param1_values_len; + } + + err = behavior_get_parameter_metadata(zmk_behavior_get_binding(cfg->tap_behavior_dev), + &child_meta); + if (err < 0) { + LOG_WRN("Failed to get the tap behavior parameter: %d", err); + return err; + } + + if (child_meta.sets_len > 0) { + data->set.param2_values = child_meta.sets[0].param1_values; + data->set.param2_values_len = child_meta.sets[0].param1_values_len; + } + + param_metadata->sets = &data->set; + param_metadata->sets_len = 1; + + return 0; +} + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + static const struct behavior_driver_api behavior_hold_tap_driver_api = { .binding_pressed = on_hold_tap_binding_pressed, .binding_released = on_hold_tap_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = hold_tap_parameter_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; static int position_state_changed_listener(const zmk_event_t *eh) { @@ -791,7 +840,7 @@ static int behavior_hold_tap_init(const struct device *dev) { } #define KP_INST(n) \ - static struct behavior_hold_tap_config behavior_hold_tap_config_##n = { \ + static const struct behavior_hold_tap_config behavior_hold_tap_config_##n = { \ .tapping_term_ms = DT_INST_PROP(n, tapping_term_ms), \ .hold_behavior_dev = DEVICE_DT_NAME(DT_INST_PHANDLE_BY_IDX(n, bindings, 0)), \ .tap_behavior_dev = DEVICE_DT_NAME(DT_INST_PHANDLE_BY_IDX(n, bindings, 1)), \ @@ -807,9 +856,10 @@ static int behavior_hold_tap_init(const struct device *dev) { .hold_trigger_key_positions = DT_INST_PROP(n, hold_trigger_key_positions), \ .hold_trigger_key_positions_len = DT_INST_PROP_LEN(n, hold_trigger_key_positions), \ }; \ - BEHAVIOR_DT_INST_DEFINE(n, behavior_hold_tap_init, NULL, NULL, &behavior_hold_tap_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &behavior_hold_tap_driver_api); + static struct behavior_hold_tap_data behavior_hold_tap_data_##n = {}; \ + BEHAVIOR_DT_INST_DEFINE(n, behavior_hold_tap_init, NULL, &behavior_hold_tap_data_##n, \ + &behavior_hold_tap_config_##n, POST_KERNEL, \ + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_hold_tap_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) diff --git a/app/src/behaviors/behavior_key_press.c b/app/src/behaviors/behavior_key_press.c index 566cfcfb..b090401e 100644 --- a/app/src/behaviors/behavior_key_press.c +++ b/app/src/behaviors/behavior_key_press.c @@ -16,6 +16,27 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static const struct behavior_parameter_value_metadata param_values[] = { + { + .display_name = "Key", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_HID_USAGE, + }, +}; + +static const struct behavior_parameter_metadata_set param_metadata_set[] = {{ + .param1_values = param_values, + .param1_values_len = ARRAY_SIZE(param_values), +}}; + +static const struct behavior_parameter_metadata metadata = { + .sets_len = ARRAY_SIZE(param_metadata_set), + .sets = param_metadata_set, +}; + +#endif + static int behavior_key_press_init(const struct device *dev) { return 0; }; static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding, @@ -31,7 +52,12 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding, } static const struct behavior_driver_api behavior_key_press_driver_api = { - .binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released}; + .binding_pressed = on_keymap_binding_pressed, + .binding_released = on_keymap_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .parameter_metadata = &metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) +}; #define KP_INST(n) \ BEHAVIOR_DT_INST_DEFINE(n, behavior_key_press_init, NULL, NULL, NULL, POST_KERNEL, \ diff --git a/app/src/behaviors/behavior_key_repeat.c b/app/src/behaviors/behavior_key_repeat.c index c93fa722..21343ae8 100644 --- a/app/src/behaviors/behavior_key_repeat.c +++ b/app/src/behaviors/behavior_key_repeat.c @@ -67,6 +67,9 @@ static int on_key_repeat_binding_released(struct zmk_behavior_binding *binding, static const struct behavior_driver_api behavior_key_repeat_driver_api = { .binding_pressed = on_key_repeat_binding_pressed, .binding_released = on_key_repeat_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = zmk_behavior_get_empty_param_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; static int key_repeat_keycode_state_changed_listener(const zmk_event_t *eh); diff --git a/app/src/behaviors/behavior_key_toggle.c b/app/src/behaviors/behavior_key_toggle.c index 0dc0f5ab..72f2570b 100644 --- a/app/src/behaviors/behavior_key_toggle.c +++ b/app/src/behaviors/behavior_key_toggle.c @@ -31,9 +31,33 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding, return 0; } +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static const struct behavior_parameter_value_metadata param_values[] = { + { + .display_name = "Key", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_HID_USAGE, + }, +}; + +static const struct behavior_parameter_metadata_set param_metadata_set[] = {{ + .param1_values = param_values, + .param1_values_len = ARRAY_SIZE(param_values), +}}; + +static const struct behavior_parameter_metadata metadata = { + .sets_len = ARRAY_SIZE(param_metadata_set), + .sets = param_metadata_set, +}; + +#endif + static const struct behavior_driver_api behavior_key_toggle_driver_api = { .binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .parameter_metadata = &metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; #define KT_INST(n) \ diff --git a/app/src/behaviors/behavior_macro.c b/app/src/behaviors/behavior_macro.c index acffe3d8..b535ed8b 100644 --- a/app/src/behaviors/behavior_macro.c +++ b/app/src/behaviors/behavior_macro.c @@ -34,6 +34,10 @@ struct behavior_macro_trigger_state { struct behavior_macro_state { struct behavior_macro_trigger_state release_state; +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + struct behavior_parameter_metadata_set set; +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + uint32_t press_bindings_count; }; @@ -209,9 +213,100 @@ static int on_macro_binding_released(struct zmk_behavior_binding *binding, return ZMK_BEHAVIOR_OPAQUE; } +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static void assign_values_to_set(enum param_source param_source, + struct behavior_parameter_metadata_set *set, + const struct behavior_parameter_value_metadata *values, + size_t values_len) { + if (param_source == PARAM_SOURCE_MACRO_1ST) { + set->param1_values = values; + set->param1_values_len = values_len; + } else { + set->param2_values = values; + set->param2_values_len = values_len; + } +} + +// This function will dynamically determine the parameter metadata for a particular macro by +// inspecting the macro *bindings* to see what behaviors in that list receive the macro parameters, +// and then using the metadata from those behaviors for the macro itself. +// +// Care need be taken, where a behavior in the list takes two parameters, and the macro passes along +// a value for the *second* parameter, we need to make sure we find the right metadata set for the +// referenced behavior that matches the first parameter. +static int get_macro_parameter_metadata(const struct device *macro, + struct behavior_parameter_metadata *param_metadata) { + const struct behavior_macro_config *cfg = macro->config; + struct behavior_macro_state *data = macro->data; + struct behavior_macro_trigger_state state = {0}; + + for (int i = 0; (i < cfg->count) && (!data->set.param1_values || !data->set.param2_values); + i++) { + if (handle_control_binding(&state, &cfg->bindings[i]) || + (state.param1_source == PARAM_SOURCE_BINDING && + state.param2_source == PARAM_SOURCE_BINDING)) { + continue; + } + + LOG_DBG("checking %d for the given state", i); + + struct behavior_parameter_metadata binding_meta; + int err = behavior_get_parameter_metadata( + zmk_behavior_get_binding(cfg->bindings[i].behavior_dev), &binding_meta); + if (err < 0 || binding_meta.sets_len == 0) { + LOG_WRN("Failed to fetch macro binding parameter details %d", err); + return -ENOTSUP; + } + + // If both macro parameters get passed to this one entry, use + // the metadata for this behavior verbatim. + if (state.param1_source != PARAM_SOURCE_BINDING && + state.param2_source != PARAM_SOURCE_BINDING) { + param_metadata->sets_len = binding_meta.sets_len; + param_metadata->sets = binding_meta.sets; + return 0; + } + + if (state.param1_source != PARAM_SOURCE_BINDING) { + assign_values_to_set(state.param1_source, &data->set, + binding_meta.sets[0].param1_values, + binding_meta.sets[0].param1_values_len); + } + + if (state.param2_source != PARAM_SOURCE_BINDING) { + // For the param2 metadata, we need to find a set that matches fully bound first + // parameter of our macro entry, and use the metadata from that set. + for (int s = 0; s < binding_meta.sets_len; s++) { + if (zmk_behavior_validate_param_values(binding_meta.sets[s].param1_values, + binding_meta.sets[s].param1_values_len, + cfg->bindings[i].param1) >= 0) { + assign_values_to_set(state.param2_source, &data->set, + binding_meta.sets[s].param2_values, + binding_meta.sets[s].param2_values_len); + break; + } + } + } + + state.param1_source = PARAM_SOURCE_BINDING; + state.param2_source = PARAM_SOURCE_BINDING; + } + + param_metadata->sets_len = 1; + param_metadata->sets = &data->set; + + return 0; +} + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + static const struct behavior_driver_api behavior_macro_driver_api = { .binding_pressed = on_macro_binding_pressed, .binding_released = on_macro_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = get_macro_parameter_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; #define TRANSFORMED_BEHAVIORS(n) \ diff --git a/app/src/behaviors/behavior_mod_morph.c b/app/src/behaviors/behavior_mod_morph.c index 3a8bf08c..303f96a7 100644 --- a/app/src/behaviors/behavior_mod_morph.c +++ b/app/src/behaviors/behavior_mod_morph.c @@ -75,6 +75,9 @@ static int on_mod_morph_binding_released(struct zmk_behavior_binding *binding, static const struct behavior_driver_api behavior_mod_morph_driver_api = { .binding_pressed = on_mod_morph_binding_pressed, .binding_released = on_mod_morph_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = zmk_behavior_get_empty_param_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; static int behavior_mod_morph_init(const struct device *dev) { return 0; } diff --git a/app/src/behaviors/behavior_momentary_layer.c b/app/src/behaviors/behavior_momentary_layer.c index 0c86e605..b781a953 100644 --- a/app/src/behaviors/behavior_momentary_layer.c +++ b/app/src/behaviors/behavior_momentary_layer.c @@ -15,6 +15,27 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static const struct behavior_parameter_value_metadata param_values[] = { + { + .display_name = "Layer", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID, + }, +}; + +static const struct behavior_parameter_metadata_set param_metadata_set[] = {{ + .param1_values = param_values, + .param1_values_len = ARRAY_SIZE(param_values), +}}; + +static const struct behavior_parameter_metadata metadata = { + .sets_len = ARRAY_SIZE(param_metadata_set), + .sets = param_metadata_set, +}; + +#endif + struct behavior_mo_config {}; struct behavior_mo_data {}; @@ -33,7 +54,12 @@ static int mo_keymap_binding_released(struct zmk_behavior_binding *binding, } static const struct behavior_driver_api behavior_mo_driver_api = { - .binding_pressed = mo_keymap_binding_pressed, .binding_released = mo_keymap_binding_released}; + .binding_pressed = mo_keymap_binding_pressed, + .binding_released = mo_keymap_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .parameter_metadata = &metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) +}; static const struct behavior_mo_config behavior_mo_config = {}; diff --git a/app/src/behaviors/behavior_none.c b/app/src/behaviors/behavior_none.c index 0137622a..b1dc4ad3 100644 --- a/app/src/behaviors/behavior_none.c +++ b/app/src/behaviors/behavior_none.c @@ -31,6 +31,9 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding, static const struct behavior_driver_api behavior_none_driver_api = { .binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = zmk_behavior_get_empty_param_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; BEHAVIOR_DT_INST_DEFINE(0, behavior_none_init, NULL, NULL, NULL, POST_KERNEL, diff --git a/app/src/behaviors/behavior_outputs.c b/app/src/behaviors/behavior_outputs.c index d172c3a1..ffa57d16 100644 --- a/app/src/behaviors/behavior_outputs.c +++ b/app/src/behaviors/behavior_outputs.c @@ -20,6 +20,42 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static const struct behavior_parameter_value_metadata std_values[] = { + { + .value = OUT_TOG, + .display_name = "Toggle Outputs", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + }, +#if IS_ENABLED(CONFIG_ZMK_USB) + { + .value = OUT_USB, + .display_name = "USB Output", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + }, +#endif // IS_ENABLED(CONFIG_ZMK_USB) +#if IS_ENABLED(CONFIG_ZMK_BLE) + { + .value = OUT_BLE, + .display_name = "BLE Output", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + }, +#endif // IS_ENABLED(CONFIG_ZMK_BLE) +}; + +static const struct behavior_parameter_metadata_set std_set = { + .param1_values = std_values, + .param1_values_len = ARRAY_SIZE(std_values), +}; + +static const struct behavior_parameter_metadata metadata = { + .sets_len = 1, + .sets = &std_set, +}; + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding, struct zmk_behavior_binding_event event) { switch (binding->param1) { @@ -40,6 +76,9 @@ static int behavior_out_init(const struct device *dev) { return 0; } static const struct behavior_driver_api behavior_outputs_driver_api = { .binding_pressed = on_keymap_binding_pressed, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .parameter_metadata = &metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; BEHAVIOR_DT_INST_DEFINE(0, behavior_out_init, NULL, NULL, NULL, POST_KERNEL, diff --git a/app/src/behaviors/behavior_reset.c b/app/src/behaviors/behavior_reset.c index c559f17f..554132f4 100644 --- a/app/src/behaviors/behavior_reset.c +++ b/app/src/behaviors/behavior_reset.c @@ -38,6 +38,9 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding, static const struct behavior_driver_api behavior_reset_driver_api = { .binding_pressed = on_keymap_binding_pressed, .locality = BEHAVIOR_LOCALITY_EVENT_SOURCE, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = zmk_behavior_get_empty_param_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; #define RST_INST(n) \ diff --git a/app/src/behaviors/behavior_rgb_underglow.c b/app/src/behaviors/behavior_rgb_underglow.c index a16ee591..c37e5217 100644 --- a/app/src/behaviors/behavior_rgb_underglow.c +++ b/app/src/behaviors/behavior_rgb_underglow.c @@ -18,6 +18,119 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static const struct behavior_parameter_value_metadata no_arg_values[] = { + { + .display_name = "Toggle On/Off", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_TOG_CMD, + }, + { + .display_name = "Turn On", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_ON_CMD, + }, + { + .display_name = "Turn OFF", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_OFF_CMD, + }, + { + .display_name = "Hue Up", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_HUI_CMD, + }, + { + .display_name = "Hue Down", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_HUD_CMD, + }, + { + .display_name = "Saturation Up", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_SAI_CMD, + }, + { + .display_name = "Saturation Down", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_SAD_CMD, + }, + { + .display_name = "Brightness Up", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_BRI_CMD, + }, + { + .display_name = "Brightness Down", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_BRD_CMD, + }, + { + .display_name = "Speed Up", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_SPI_CMD, + }, + { + .display_name = "Speed Down", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_SPD_CMD, + }, + { + .display_name = "Next Effect", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_EFF_CMD, + }, + { + .display_name = "Previous Effect", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_EFR_CMD, + }, +}; + +static const struct behavior_parameter_metadata_set no_args_set = { + .param1_values = no_arg_values, + .param1_values_len = ARRAY_SIZE(no_arg_values), +}; + +/* +static const struct behavior_parameter_value_metadata hsv_p1_value_metadata_values[] = { + { + .display_name = "Set Color", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + .value = RGB_COLOR_HSB_CMD, + }, +}; + +static const struct behavior_parameter_value_metadata hsv_p2_value_metadata_values[] = { + { + .display_name = "Color", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_STANDARD, + .standard = BEHAVIOR_PARAMETER_STANDARD_DOMAIN_HSV, + }, +}; + +static const struct behavior_parameter_metadata_set hsv_value_metadata_set = { + .param1_values = hsv_p1_value_metadata_values, + .param1_values_len = ARRAY_SIZE(hsv_p1_value_metadata_values), + .param_values = hsv_p2_value_metadata_values, + .param_values_len = ARRAY_SIZE(hsv_p2_value_metadata_values), +}; + +*/ + +static const struct behavior_parameter_metadata_set sets[] = { + no_args_set, + // hsv_value_metadata_set, +}; + +static const struct behavior_parameter_metadata metadata = { + .sets_len = ARRAY_SIZE(sets), + .sets = sets, +}; + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + static int behavior_rgb_underglow_init(const struct device *dev) { return 0; } static int @@ -147,6 +260,9 @@ static const struct behavior_driver_api behavior_rgb_underglow_driver_api = { .binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released, .locality = BEHAVIOR_LOCALITY_GLOBAL, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .parameter_metadata = &metadata, +#endif }; BEHAVIOR_DT_INST_DEFINE(0, behavior_rgb_underglow_init, NULL, NULL, NULL, POST_KERNEL, diff --git a/app/src/behaviors/behavior_soft_off.c b/app/src/behaviors/behavior_soft_off.c index 3a4ae424..fcffd09a 100644 --- a/app/src/behaviors/behavior_soft_off.c +++ b/app/src/behaviors/behavior_soft_off.c @@ -57,6 +57,9 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding, uint32_t hold_time = k_uptime_get() - data->press_start; if (hold_time > config->hold_time_ms) { + if (IS_ENABLED(CONFIG_ZMK_SPLIT) && IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)) { + k_sleep(K_MSEC(100)); + } zmk_pm_soft_off(); } else { LOG_INF("Not triggering soft off: held for %d and hold time is %d", hold_time, @@ -71,6 +74,9 @@ static const struct behavior_driver_api behavior_soft_off_driver_api = { .binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released, .locality = BEHAVIOR_LOCALITY_GLOBAL, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = zmk_behavior_get_empty_param_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; #define BSO_INST(n) \ @@ -80,7 +86,7 @@ static const struct behavior_driver_api behavior_soft_off_driver_api = { DT_INST_PROP_OR(n, split_peripheral_off_on_press, false), \ }; \ static struct behavior_soft_off_data bso_data_##n = {}; \ - BEHAVIOR_DT_INST_DEFINE(0, behavior_soft_off_init, NULL, &bso_data_##n, &bso_config_##n, \ + BEHAVIOR_DT_INST_DEFINE(n, behavior_soft_off_init, NULL, &bso_data_##n, &bso_config_##n, \ POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &behavior_soft_off_driver_api); diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c index b0e9f3ed..61c86fb7 100644 --- a/app/src/behaviors/behavior_sticky_key.c +++ b/app/src/behaviors/behavior_sticky_key.c @@ -26,7 +26,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #define KEY_PRESS DEVICE_DT_NAME(DT_INST(0, zmk_behavior_key_press)) -#define ZMK_BHV_STICKY_KEY_MAX_HELD 10 +#define ZMK_BHV_STICKY_KEY_MAX_HELD CONFIG_ZMK_BEHAVIOR_STICKY_KEY_MAX_HELD #define ZMK_BHV_STICKY_KEY_POSITION_FREE UINT32_MAX @@ -188,9 +188,42 @@ static int on_sticky_key_binding_released(struct zmk_behavior_binding *binding, return ZMK_BEHAVIOR_OPAQUE; } +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static int sticky_key_parameter_domains(const struct device *sk, + struct behavior_parameter_metadata *param_metadata) { + const struct behavior_sticky_key_config *cfg = sk->config; + + struct behavior_parameter_metadata child_metadata; + + int err = behavior_get_parameter_metadata(zmk_behavior_get_binding(cfg->behavior.behavior_dev), + &child_metadata); + if (err < 0) { + LOG_WRN("Failed to get the sticky key bound behavior parameter: %d", err); + return err; + } + + for (int s = 0; s < child_metadata.sets_len; s++) { + const struct behavior_parameter_metadata_set *set = &child_metadata.sets[s]; + + if (set->param2_values_len > 0) { + return -ENOTSUP; + } + } + + *param_metadata = child_metadata; + + return 0; +} + +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + static const struct behavior_driver_api behavior_sticky_key_driver_api = { .binding_pressed = on_sticky_key_binding_pressed, .binding_released = on_sticky_key_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = sticky_key_parameter_domains, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; static int sticky_key_keycode_state_changed_listener(const zmk_event_t *eh); @@ -337,7 +370,7 @@ struct behavior_sticky_key_data {}; static struct behavior_sticky_key_data behavior_sticky_key_data; #define KP_INST(n) \ - static struct behavior_sticky_key_config behavior_sticky_key_config_##n = { \ + static const struct behavior_sticky_key_config behavior_sticky_key_config_##n = { \ .behavior = ZMK_KEYMAP_EXTRACT_BINDING(0, DT_DRV_INST(n)), \ .release_after_ms = DT_INST_PROP(n, release_after_ms), \ .quick_release = DT_INST_PROP(n, quick_release), \ diff --git a/app/src/behaviors/behavior_studio_unlock.c b/app/src/behaviors/behavior_studio_unlock.c new file mode 100644 index 00000000..95f2b40d --- /dev/null +++ b/app/src/behaviors/behavior_studio_unlock.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#define DT_DRV_COMPAT zmk_behavior_studio_unlock + +#include +#include +#include + +#include +#include + +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) + +static int behavior_studio_unlock_init(const struct device *dev) { return 0; }; + +static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding, + struct zmk_behavior_binding_event event) { + zmk_studio_core_unlock(); + + return ZMK_BEHAVIOR_OPAQUE; +} + +static int on_keymap_binding_released(struct zmk_behavior_binding *binding, + struct zmk_behavior_binding_event event) { + return ZMK_BEHAVIOR_OPAQUE; +} + +static const struct behavior_driver_api behavior_studio_unlock_driver_api = { + .binding_pressed = on_keymap_binding_pressed, + .binding_released = on_keymap_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = zmk_behavior_get_empty_param_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) +}; + +BEHAVIOR_DT_INST_DEFINE(0, behavior_studio_unlock_init, NULL, NULL, NULL, POST_KERNEL, + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_studio_unlock_driver_api); + +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_tap_dance.c b/app/src/behaviors/behavior_tap_dance.c index 4f6fa1a1..ce57b70f 100644 --- a/app/src/behaviors/behavior_tap_dance.c +++ b/app/src/behaviors/behavior_tap_dance.c @@ -189,6 +189,9 @@ void behavior_tap_dance_timer_handler(struct k_work *item) { static const struct behavior_driver_api behavior_tap_dance_driver_api = { .binding_pressed = on_tap_dance_binding_pressed, .binding_released = on_tap_dance_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = zmk_behavior_get_empty_param_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; static int tap_dance_position_state_changed_listener(const zmk_event_t *eh); diff --git a/app/src/behaviors/behavior_to_layer.c b/app/src/behaviors/behavior_to_layer.c index 1c87a925..f739ec8d 100644 --- a/app/src/behaviors/behavior_to_layer.c +++ b/app/src/behaviors/behavior_to_layer.c @@ -32,9 +32,33 @@ static int to_keymap_binding_released(struct zmk_behavior_binding *binding, return ZMK_BEHAVIOR_OPAQUE; } +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static const struct behavior_parameter_value_metadata param_values[] = { + { + .display_name = "Layer", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID, + }, +}; + +static const struct behavior_parameter_metadata_set param_metadata_set[] = {{ + .param1_values = param_values, + .param1_values_len = ARRAY_SIZE(param_values), +}}; + +static const struct behavior_parameter_metadata metadata = { + .sets_len = ARRAY_SIZE(param_metadata_set), + .sets = param_metadata_set, +}; + +#endif + static const struct behavior_driver_api behavior_to_driver_api = { .binding_pressed = to_keymap_binding_pressed, .binding_released = to_keymap_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .parameter_metadata = &metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; BEHAVIOR_DT_INST_DEFINE(0, behavior_to_init, NULL, NULL, NULL, POST_KERNEL, diff --git a/app/src/behaviors/behavior_toggle_layer.c b/app/src/behaviors/behavior_toggle_layer.c index 817462df..ea46c79f 100644 --- a/app/src/behaviors/behavior_toggle_layer.c +++ b/app/src/behaviors/behavior_toggle_layer.c @@ -34,9 +34,33 @@ static int tog_keymap_binding_released(struct zmk_behavior_binding *binding, return ZMK_BEHAVIOR_OPAQUE; } +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static const struct behavior_parameter_value_metadata param_values[] = { + { + .display_name = "Layer", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID, + }, +}; + +static const struct behavior_parameter_metadata_set param_metadata_set[] = {{ + .param1_values = param_values, + .param1_values_len = ARRAY_SIZE(param_values), +}}; + +static const struct behavior_parameter_metadata metadata = { + .sets_len = ARRAY_SIZE(param_metadata_set), + .sets = param_metadata_set, +}; + +#endif + static const struct behavior_driver_api behavior_tog_driver_api = { .binding_pressed = tog_keymap_binding_pressed, .binding_released = tog_keymap_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .parameter_metadata = &metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; static const struct behavior_tog_config behavior_tog_config = {}; diff --git a/app/src/behaviors/behavior_transparent.c b/app/src/behaviors/behavior_transparent.c index c7bf802b..32357046 100644 --- a/app/src/behaviors/behavior_transparent.c +++ b/app/src/behaviors/behavior_transparent.c @@ -31,6 +31,9 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding, static const struct behavior_driver_api behavior_transparent_driver_api = { .binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released, +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + .get_parameter_metadata = zmk_behavior_get_empty_param_metadata, +#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) }; BEHAVIOR_DT_INST_DEFINE(0, behavior_transparent_init, NULL, NULL, NULL, POST_KERNEL, diff --git a/app/src/ble.c b/app/src/ble.c index 7e1ae7d4..776730fe 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -318,6 +318,21 @@ int zmk_ble_prof_disconnect(uint8_t index) { bt_addr_le_t *zmk_ble_active_profile_addr(void) { return &profiles[active_profile].peer; } +struct bt_conn *zmk_ble_active_profile_conn(void) { + struct bt_conn *conn; + bt_addr_le_t *addr = zmk_ble_active_profile_addr(); + + if (!bt_addr_le_cmp(addr, BT_ADDR_LE_ANY)) { + LOG_WRN("Not sending, no active address for current profile"); + return NULL; + } else if ((conn = bt_conn_lookup_addr_le(BT_ID_DEFAULT, addr)) == NULL) { + LOG_WRN("Not sending, not connected to active profile"); + return NULL; + } + + return conn; +} + char *zmk_ble_active_profile_name(void) { return profiles[active_profile].name; } #if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) @@ -430,7 +445,11 @@ static int ble_profiles_handle_set(const char *name, size_t len, settings_read_c return 0; }; -struct settings_handler profiles_handler = {.name = "ble", .h_set = ble_profiles_handle_set}; +static int zmk_ble_complete_startup(void); + +static struct settings_handler profiles_handler = { + .name = "ble", .h_set = ble_profiles_handle_set, .h_commit = zmk_ble_complete_startup}; + #endif /* IS_ENABLED(CONFIG_SETTINGS) */ static bool is_conn_active_profile(const struct bt_conn *conn) { @@ -629,29 +648,7 @@ static void zmk_ble_ready(int err) { update_advertising(); } -static int zmk_ble_init(void) { - int err = bt_enable(NULL); - - if (err) { - LOG_ERR("BLUETOOTH FAILED (%d)", err); - return err; - } - -#if IS_ENABLED(CONFIG_SETTINGS) - settings_subsys_init(); - - err = settings_register(&profiles_handler); - if (err) { - LOG_ERR("Failed to setup the profile settings handler (err %d)", err); - return err; - } - - k_work_init_delayable(&ble_save_work, ble_save_profile_work); - - settings_load_subtree("ble"); - settings_load_subtree("bt"); - -#endif +static int zmk_ble_complete_startup(void) { #if IS_ENABLED(CONFIG_ZMK_BLE_CLEAR_BONDS_ON_START) LOG_WRN("Clearing all existing BLE bond information from the keyboard"); @@ -691,6 +688,24 @@ static int zmk_ble_init(void) { return 0; } +static int zmk_ble_init(void) { + int err = bt_enable(NULL); + + if (err < 0 && err != -EALREADY) { + LOG_ERR("BLUETOOTH FAILED (%d)", err); + return err; + } + +#if IS_ENABLED(CONFIG_SETTINGS) + settings_register(&profiles_handler); + k_work_init_delayable(&ble_save_work, ble_save_profile_work); +#else + zmk_ble_complete_startup(); +#endif + + return 0; +} + #if IS_ENABLED(CONFIG_ZMK_BLE_PASSKEY_ENTRY) static bool zmk_ble_numeric_usage_to_value(const zmk_key_t key, const zmk_key_t one, diff --git a/app/src/combo.c b/app/src/combo.c index 61671d33..3f78878f 100644 --- a/app/src/combo.c +++ b/app/src/combo.c @@ -162,7 +162,7 @@ static int setup_candidates_for_first_keypress(int32_t position, int64_t timesta static int filter_candidates(int32_t position) { // this code iterates over candidates and the lookup together to filter in O(n) - // assuming they are both sorted on key_position_len, virtal_key_position + // assuming they are both sorted on key_position_len, virtual_key_position int matches = 0, lookup_idx = 0, candidate_idx = 0; while (lookup_idx < CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY && candidate_idx < CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY) { diff --git a/app/src/endpoints.c b/app/src/endpoints.c index 7c9d15a3..65243853 100644 --- a/app/src/endpoints.c +++ b/app/src/endpoints.c @@ -263,7 +263,8 @@ static int endpoints_handle_set(const char *name, size_t len, settings_read_cb r return 0; } -struct settings_handler endpoints_handler = {.name = "endpoints", .h_set = endpoints_handle_set}; +SETTINGS_STATIC_HANDLER_DEFINE(endpoints, "endpoints", NULL, endpoints_handle_set, NULL, NULL); + #endif /* IS_ENABLED(CONFIG_SETTINGS) */ static bool is_usb_ready(void) { @@ -322,17 +323,7 @@ static struct zmk_endpoint_instance get_selected_instance(void) { static int zmk_endpoints_init(void) { #if IS_ENABLED(CONFIG_SETTINGS) - settings_subsys_init(); - - int err = settings_register(&endpoints_handler); - if (err) { - LOG_ERR("Failed to register the endpoints settings handler (err %d)", err); - return err; - } - k_work_init_delayable(&endpoints_save_work, endpoints_save_preferred_work); - - settings_load_subtree("endpoints"); #endif current_instance = get_selected_instance(); diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c index 2586f436..17b3ba64 100644 --- a/app/src/ext_power_generic.c +++ b/app/src/ext_power_generic.c @@ -121,12 +121,27 @@ static int ext_power_settings_set(const char *name, size_t len, settings_read_cb return -ENOENT; } -struct settings_handler ext_power_conf = {.name = "ext_power/state", - .h_set = ext_power_settings_set}; +static int ext_power_settings_commit() { + const struct device *dev = DEVICE_DT_GET(DT_DRV_INST(0)); + struct ext_power_generic_data *data = dev->data; + + if (!data->settings_init) { + + data->status = true; + k_work_schedule(&ext_power_save_work, K_NO_WAIT); + + ext_power_enable(dev); + } + + return 0; +} + +SETTINGS_STATIC_HANDLER_DEFINE(ext_power, "ext_power/state", NULL, ext_power_settings_set, + ext_power_settings_commit, NULL); + #endif static int ext_power_generic_init(const struct device *dev) { - struct ext_power_generic_data *data = dev->data; const struct ext_power_generic_config *config = dev->config; if (gpio_pin_configure_dt(&config->control, GPIO_OUTPUT_INACTIVE)) { @@ -135,30 +150,12 @@ static int ext_power_generic_init(const struct device *dev) { } #if IS_ENABLED(CONFIG_SETTINGS) - settings_subsys_init(); - - int err = settings_register(&ext_power_conf); - if (err) { - LOG_ERR("Failed to register the ext_power settings handler (err %d)", err); - return err; - } - k_work_init_delayable(&ext_power_save_work, ext_power_save_state_work); - - // Set default value (on) if settings isn't set - settings_load_subtree("ext_power"); - if (!data->settings_init) { - - data->status = true; - k_work_schedule(&ext_power_save_work, K_NO_WAIT); - - ext_power_enable(dev); - } -#else - // Default to the ext_power being open when no settings - ext_power_enable(dev); #endif + // Enable by default. We may get disabled again once settings load. + ext_power_enable(dev); + if (config->init_delay_ms) { k_msleep(config->init_delay_ms); } diff --git a/app/src/gpio_key_wakeup_trigger.c b/app/src/gpio_key_wakeup_trigger.c index 308c4973..d22523a4 100644 --- a/app/src/gpio_key_wakeup_trigger.c +++ b/app/src/gpio_key_wakeup_trigger.c @@ -36,7 +36,12 @@ static int zmk_gpio_key_wakeup_trigger_init(const struct device *dev) { static int gpio_key_wakeup_trigger_pm_resume(const struct device *dev) { const struct gpio_key_wakeup_trigger_config *config = dev->config; - int ret = gpio_pin_interrupt_configure_dt(&config->trigger, GPIO_INT_LEVEL_ACTIVE); + int ret = gpio_pin_configure_dt(&config->trigger, GPIO_INPUT); + if (ret < 0) { + LOG_ERR("Failed to configure wakeup trigger key GPIO pin as input (%d)", ret); + return ret; + } + ret = gpio_pin_interrupt_configure_dt(&config->trigger, GPIO_INT_LEVEL_ACTIVE); if (ret < 0) { LOG_ERR("Failed to configure wakeup trigger key GPIO pin interrupt (%d)", ret); return ret; diff --git a/app/src/hid.c b/app/src/hid.c index 8b0c23f3..24572ad3 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -126,7 +126,7 @@ zmk_hid_boot_report_t *zmk_hid_get_boot_report(void) { memset(&boot_report.keys, 0, HID_BOOT_KEY_LEN); int ix = 0; uint8_t base_code = 0; - for (int i = 0; i < (ZMK_HID_KEYBOARD_NKRO_MAX_USAGE + 1) / 8; ++i) { + for (int i = 0; i < sizeof(keyboard_report.body.keys); ++i) { if (ix == keys_held) { break; } @@ -249,8 +249,9 @@ static inline int check_keyboard_usage(zmk_key_t usage) { #endif #define TOGGLE_CONSUMER(match, val) \ - COND_CODE_1(IS_ENABLED(CONFIG_ZMK_HID_CONSUMER_REPORT_USAGES_BASIC), \ - (if (val > 0xFF) { return -ENOTSUP; }), ()) \ + if (val > ZMK_HID_CONSUMER_MAX_USAGE) { \ + return -ENOTSUP; \ + } \ for (int idx = 0; idx < CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE; idx++) { \ if (consumer_report.body.keys[idx] != match) { \ continue; \ diff --git a/app/src/hid_indicators.c b/app/src/hid_indicators.c index 1b489068..a2220b1b 100644 --- a/app/src/hid_indicators.c +++ b/app/src/hid_indicators.c @@ -64,5 +64,5 @@ static int profile_listener(const zmk_event_t *eh) { return 0; } -static ZMK_LISTENER(profile_listener, profile_listener); -static ZMK_SUBSCRIPTION(profile_listener, zmk_endpoint_changed); +ZMK_LISTENER(profile_listener, profile_listener); +ZMK_SUBSCRIPTION(profile_listener, zmk_endpoint_changed); diff --git a/app/src/hid_listener.c b/app/src/hid_listener.c index 2b847082..2d17a395 100644 --- a/app/src/hid_listener.c +++ b/app/src/hid_listener.c @@ -66,6 +66,17 @@ static int hid_listener_keycode_released(const struct zmk_keycode_state_changed return err; } +#if IS_ENABLED(CONFIG_ZMK_HID_SEPARATE_MOD_RELEASE_REPORT) + + // send report of normal key release early to fix the issue + // of some programs recognizing the implicit_mod release before the actual key release + err = zmk_endpoints_send_report(ev->usage_page); + if (err < 0) { + LOG_ERR("Failed to send key report for the released keycode (%d)", err); + } + +#endif // IS_ENABLED(CONFIG_ZMK_HID_SEPARATE_MOD_RELEASE_REPORT) + explicit_mods_changed = zmk_hid_unregister_mods(ev->explicit_modifiers); // There is a minor issue with this code. // If LC(A) is pressed, then LS(B), then LC(A) is released, the shift for B will be released @@ -73,7 +84,7 @@ static int hid_listener_keycode_released(const struct zmk_keycode_state_changed // Solving this would require keeping track of which key's implicit modifiers are currently // active and only releasing modifiers at that time. implicit_mods_changed = zmk_hid_implicit_modifiers_release(); - ; + if (ev->usage_page != HID_USAGE_KEY && (explicit_mods_changed > 0 || implicit_mods_changed > 0)) { err = zmk_endpoints_send_report(HID_USAGE_KEY); diff --git a/app/src/hog.c b/app/src/hog.c index f17f759c..82fafc29 100644 --- a/app/src/hog.c +++ b/app/src/hog.c @@ -220,21 +220,6 @@ BT_GATT_SERVICE_DEFINE( BT_GATT_CHARACTERISTIC(BT_UUID_HIDS_CTRL_POINT, BT_GATT_CHRC_WRITE_WITHOUT_RESP, BT_GATT_PERM_WRITE, NULL, write_ctrl_point, &ctrl_point)); -struct bt_conn *destination_connection(void) { - struct bt_conn *conn; - bt_addr_le_t *addr = zmk_ble_active_profile_addr(); - LOG_DBG("Address pointer %p", addr); - if (!bt_addr_le_cmp(addr, BT_ADDR_LE_ANY)) { - LOG_WRN("Not sending, no active address for current profile"); - return NULL; - } else if ((conn = bt_conn_lookup_addr_le(BT_ID_DEFAULT, addr)) == NULL) { - LOG_WRN("Not sending, not connected to active profile"); - return NULL; - } - - return conn; -} - K_THREAD_STACK_DEFINE(hog_q_stack, CONFIG_ZMK_BLE_THREAD_STACK_SIZE); struct k_work_q hog_work_q; @@ -246,7 +231,7 @@ void send_keyboard_report_callback(struct k_work *work) { struct zmk_hid_keyboard_report_body report; while (k_msgq_get(&zmk_hog_keyboard_msgq, &report, K_NO_WAIT) == 0) { - struct bt_conn *conn = destination_connection(); + struct bt_conn *conn = zmk_ble_active_profile_conn(); if (conn == NULL) { return; } @@ -298,7 +283,7 @@ void send_consumer_report_callback(struct k_work *work) { struct zmk_hid_consumer_report_body report; while (k_msgq_get(&zmk_hog_consumer_msgq, &report, K_NO_WAIT) == 0) { - struct bt_conn *conn = destination_connection(); + struct bt_conn *conn = zmk_ble_active_profile_conn(); if (conn == NULL) { return; } @@ -351,7 +336,7 @@ K_MSGQ_DEFINE(zmk_hog_mouse_msgq, sizeof(struct zmk_hid_mouse_report_body), void send_mouse_report_callback(struct k_work *work) { struct zmk_hid_mouse_report_body report; while (k_msgq_get(&zmk_hog_mouse_msgq, &report, K_NO_WAIT) == 0) { - struct bt_conn *conn = destination_connection(); + struct bt_conn *conn = zmk_ble_active_profile_conn(); if (conn == NULL) { return; } diff --git a/app/src/kscan.c b/app/src/kscan.c deleted file mode 100644 index 5c7a5535..00000000 --- a/app/src/kscan.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2020 The ZMK Contributors - * - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include -#include -#include -#include - -LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); - -#include -#include -#include - -#define ZMK_KSCAN_EVENT_STATE_PRESSED 0 -#define ZMK_KSCAN_EVENT_STATE_RELEASED 1 - -struct zmk_kscan_event { - uint32_t row; - uint32_t column; - uint32_t state; -}; - -struct zmk_kscan_msg_processor { - struct k_work work; -} msg_processor; - -K_MSGQ_DEFINE(zmk_kscan_msgq, sizeof(struct zmk_kscan_event), CONFIG_ZMK_KSCAN_EVENT_QUEUE_SIZE, 4); - -static void zmk_kscan_callback(const struct device *dev, uint32_t row, uint32_t column, - bool pressed) { - struct zmk_kscan_event ev = { - .row = row, - .column = column, - .state = (pressed ? ZMK_KSCAN_EVENT_STATE_PRESSED : ZMK_KSCAN_EVENT_STATE_RELEASED)}; - - k_msgq_put(&zmk_kscan_msgq, &ev, K_NO_WAIT); - k_work_submit(&msg_processor.work); -} - -void zmk_kscan_process_msgq(struct k_work *item) { - struct zmk_kscan_event ev; - - while (k_msgq_get(&zmk_kscan_msgq, &ev, K_NO_WAIT) == 0) { - bool pressed = (ev.state == ZMK_KSCAN_EVENT_STATE_PRESSED); - int32_t position = zmk_matrix_transform_row_column_to_position(ev.row, ev.column); - - if (position < 0) { - LOG_WRN("Not found in transform: row: %d, col: %d, pressed: %s", ev.row, ev.column, - (pressed ? "true" : "false")); - continue; - } - - LOG_DBG("Row: %d, col: %d, position: %d, pressed: %s", ev.row, ev.column, position, - (pressed ? "true" : "false")); - raise_zmk_position_state_changed( - (struct zmk_position_state_changed){.source = ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL, - .state = pressed, - .position = position, - .timestamp = k_uptime_get()}); - } -} - -int zmk_kscan_init(const struct device *dev) { - if (dev == NULL) { - LOG_ERR("Failed to get the KSCAN device"); - return -EINVAL; - } - - k_work_init(&msg_processor.work, zmk_kscan_process_msgq); - -#if IS_ENABLED(CONFIG_PM_DEVICE) - if (pm_device_wakeup_is_capable(dev)) { - pm_device_wakeup_enable(dev, true); - } -#endif // IS_ENABLED(CONFIG_PM_DEVICE) - - kscan_config(dev, zmk_kscan_callback); - kscan_enable_callback(dev); - - return 0; -} diff --git a/app/src/kscan_sideband_behaviors.c b/app/src/kscan_sideband_behaviors.c index 7a9922af..602cae12 100644 --- a/app/src/kscan_sideband_behaviors.c +++ b/app/src/kscan_sideband_behaviors.c @@ -26,6 +26,7 @@ struct ksbb_entry { struct ksbb_config { const struct device *kscan; + bool auto_enable; struct ksbb_entry *entries; size_t entries_len; }; @@ -93,34 +94,65 @@ void ksbb_inner_kscan_callback(const struct device *dev, uint32_t row, uint32_t } static int ksbb_configure(const struct device *dev, kscan_callback_t callback) { - const struct ksbb_config *cfg = dev->config; struct ksbb_data *data = dev->data; data->callback = callback; -#if IS_ENABLED(CONFIG_PM_DEVICE) - if (pm_device_wakeup_is_enabled(dev) && pm_device_wakeup_is_capable(cfg->kscan)) { - pm_device_wakeup_enable(cfg->kscan, true); - } -#endif // IS_ENABLED(CONFIG_PM_DEVICE) - return 0; } static int ksbb_enable(const struct device *dev) { struct ksbb_data *data = dev->data; + const struct ksbb_config *config = dev->config; data->enabled = true; +#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) + if (!pm_device_runtime_is_enabled(dev) && pm_device_runtime_is_enabled(config->kscan)) { + pm_device_runtime_get(config->kscan); + } +#elif IS_ENABLED(CONFIG_PM_DEVICE) + pm_device_action_run(config->kscan, PM_DEVICE_ACTION_RESUME); +#endif // IS_ENABLED(CONFIG_PM_DEVICE) + + kscan_config(config->kscan, &ksbb_inner_kscan_callback); + kscan_enable_callback(config->kscan); + return 0; } static int ksbb_disable(const struct device *dev) { struct ksbb_data *data = dev->data; + const struct ksbb_config *config = dev->config; data->enabled = false; + kscan_disable_callback(config->kscan); + +#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) + if (!pm_device_runtime_is_enabled(dev) && pm_device_runtime_is_enabled(config->kscan)) { + pm_device_runtime_put(config->kscan); + } +#elif IS_ENABLED(CONFIG_PM_DEVICE) + pm_device_action_run(config->kscan, PM_DEVICE_ACTION_SUSPEND); +#endif // IS_ENABLED(CONFIG_PM_DEVICE) + return 0; } +#if IS_ENABLED(CONFIG_PM_DEVICE) + +static int ksbb_pm_action(const struct device *dev, enum pm_device_action action) { + switch (action) { + case PM_DEVICE_ACTION_SUSPEND: + return ksbb_disable(dev); + case PM_DEVICE_ACTION_RESUME: + return ksbb_enable(dev); + default: + return -ENOTSUP; + } +} + +#endif // IS_ENABLED(CONFIG_PM_DEVICE) + static int ksbb_init(const struct device *dev) { const struct ksbb_config *config = dev->config; @@ -129,8 +161,16 @@ static int ksbb_init(const struct device *dev) { return -ENODEV; } - kscan_config(config->kscan, &ksbb_inner_kscan_callback); - kscan_enable_callback(config->kscan); + if (config->auto_enable) { +#if !IS_ENABLED(CONFIG_PM_DEVICE) + kscan_config(config->kscan, &ksbb_inner_kscan_callback); + kscan_enable_callback(config->kscan); +#else + ksbb_pm_action(dev, PM_DEVICE_ACTION_RESUME); + } else { + pm_device_init_suspended(dev); +#endif + } return 0; } @@ -141,21 +181,6 @@ static const struct kscan_driver_api ksbb_api = { .disable_callback = ksbb_disable, }; -#if IS_ENABLED(CONFIG_PM_DEVICE) - -static int ksbb_pm_action(const struct device *dev, enum pm_device_action action) { - switch (action) { - case PM_DEVICE_ACTION_SUSPEND: - return ksbb_disable(dev); - case PM_DEVICE_ACTION_RESUME: - return ksbb_disable(dev); - default: - return -ENOTSUP; - } -} - -#endif // IS_ENABLED(CONFIG_PM_DEVICE) - #define ENTRY(e) \ { \ .row = DT_PROP(e, row), .column = DT_PROP(e, column), \ @@ -167,6 +192,7 @@ static int ksbb_pm_action(const struct device *dev, enum pm_device_action action DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP(n, ENTRY, (, ))}; \ const struct ksbb_config ksbb_config_##n = { \ .kscan = DEVICE_DT_GET(DT_INST_PHANDLE(n, kscan)), \ + .auto_enable = DT_INST_PROP_OR(n, auto_enable, false), \ .entries = entries_##n, \ .entries_len = ARRAY_SIZE(entries_##n), \ }; \ diff --git a/app/src/main.c b/app/src/main.c index 9bd7af32..60df1a45 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -12,17 +12,15 @@ #include LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL); -#include -#include #include -#include int main(void) { LOG_INF("Welcome to ZMK!\n"); - if (zmk_kscan_init(DEVICE_DT_GET(ZMK_MATRIX_NODE_ID)) != 0) { - return -ENOTSUP; - } +#if IS_ENABLED(CONFIG_SETTINGS) + settings_subsys_init(); + settings_load(); +#endif #ifdef CONFIG_ZMK_DISPLAY zmk_display_init(); diff --git a/app/src/matrix_transform.c b/app/src/matrix_transform.c index 6c616d5e..97ab0efe 100644 --- a/app/src/matrix_transform.c +++ b/app/src/matrix_transform.c @@ -4,12 +4,23 @@ * SPDX-License-Identifier: MIT */ +#include #include +#include #include #include #include -#ifdef ZMK_KEYMAP_TRANSFORM_NODE +#define DT_DRV_COMPAT zmk_matrix_transform + +struct zmk_matrix_transform { + uint32_t const *lookup_table; + size_t len; + uint8_t rows; + uint8_t columns; + uint8_t col_offset; + uint8_t row_offset; +}; /* the transform in the device tree is a list of (row,column) pairs that is * indexed by by the keymap position of that key. We want to invert this in @@ -28,38 +39,58 @@ #define INDEX_OFFSET 1 -#define TRANSFORM_ENTRY(i, _) \ - [(KT_ROW(DT_PROP_BY_IDX(ZMK_KEYMAP_TRANSFORM_NODE, map, i)) * ZMK_MATRIX_COLS) + \ - KT_COL(DT_PROP_BY_IDX(ZMK_KEYMAP_TRANSFORM_NODE, map, i))] = i + INDEX_OFFSET +#if DT_HAS_COMPAT_STATUS_OKAY(zmk_matrix_transform) -static uint32_t transform[] = {LISTIFY(ZMK_KEYMAP_LEN, TRANSFORM_ENTRY, (, ), 0)}; +#define TRANSFORM_LOOKUP_ENTRY(i, n) \ + [(KT_ROW(DT_INST_PROP_BY_IDX(n, map, i)) * DT_INST_PROP(n, columns)) + \ + KT_COL(DT_INST_PROP_BY_IDX(n, map, i))] = i + INDEX_OFFSET -#endif +#define MATRIX_TRANSFORM_INIT(n) \ + static const uint32_t _CONCAT(zmk_transform_lookup_table_, n)[] = { \ + LISTIFY(DT_INST_PROP_LEN(n, map), TRANSFORM_LOOKUP_ENTRY, (, ), n)}; \ + const struct zmk_matrix_transform _CONCAT(zmk_matrix_transform_, DT_DRV_INST(n)) = { \ + .rows = DT_INST_PROP(n, rows), \ + .columns = DT_INST_PROP(n, columns), \ + .col_offset = DT_INST_PROP(n, col_offset), \ + .row_offset = DT_INST_PROP(n, row_offset), \ + .lookup_table = _CONCAT(zmk_transform_lookup_table_, n), \ + .len = ARRAY_SIZE(_CONCAT(zmk_transform_lookup_table_, n)), \ + }; -int32_t zmk_matrix_transform_row_column_to_position(uint32_t row, uint32_t column) { -#if DT_NODE_HAS_PROP(ZMK_KEYMAP_TRANSFORM_NODE, col_offset) - column += DT_PROP(ZMK_KEYMAP_TRANSFORM_NODE, col_offset); -#endif +DT_INST_FOREACH_STATUS_OKAY(MATRIX_TRANSFORM_INIT); -#if DT_NODE_HAS_PROP(ZMK_KEYMAP_TRANSFORM_NODE, row_offset) - row += DT_PROP(ZMK_KEYMAP_TRANSFORM_NODE, row_offset); -#endif +#elif DT_HAS_CHOSEN(zmk_kscan) && defined(ZMK_MATRIX_COLS) && defined(ZMK_MATRIX_ROWS) - const uint32_t matrix_index = (row * ZMK_MATRIX_COLS) + column; - -#ifdef ZMK_KEYMAP_TRANSFORM_NODE - if (matrix_index >= ARRAY_SIZE(transform)) { - return -EINVAL; - } - - const uint32_t value = transform[matrix_index]; - - if (!value) { - return -EINVAL; - } - - return value - INDEX_OFFSET; -#else - return matrix_index; -#endif /* ZMK_KEYMAP_TRANSFORM_NODE */ +const struct zmk_matrix_transform zmk_matrix_transform_default = { + .rows = ZMK_MATRIX_ROWS, + .columns = ZMK_MATRIX_COLS, + .len = ZMK_KEYMAP_LEN, }; + +#else + +#error "Need a matrix transform or compatible kscan selected to determine keymap size!" +` +#endif // DT_HAS_COMPAT_STATUS_OKAY(zmk_matrix_transform) + +int32_t zmk_matrix_transform_row_column_to_position(zmk_matrix_transform_t mt, uint32_t row, + uint32_t column) { + column += mt->col_offset; + row += mt->row_offset; + + if (!mt->lookup_table) { + return (row * mt->columns) + column; + } + + uint16_t lookup_index = ((row * mt->columns) + column); + if (lookup_index >= mt->len) { + return -EINVAL; + } + + int32_t val = mt->lookup_table[lookup_index]; + if (val == 0) { + return -EINVAL; + } + + return val - INDEX_OFFSET; +}; \ No newline at end of file diff --git a/app/src/physical_layouts.c b/app/src/physical_layouts.c new file mode 100644 index 00000000..16b13e71 --- /dev/null +++ b/app/src/physical_layouts.c @@ -0,0 +1,386 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include + +#if IS_ENABLED(CONFIG_SETTINGS) +#include +#endif + +#include + +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +#include +#include +#include + +#define DT_DRV_COMPAT zmk_physical_layout + +#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) + +#define ZKPA_INIT(i, n) \ + (const struct zmk_key_physical_attrs) { \ + .width = (int16_t)(int32_t)DT_INST_PHA_BY_IDX(n, keys, i, width), \ + .height = (int16_t)(int32_t)DT_INST_PHA_BY_IDX(n, keys, i, height), \ + .x = (int16_t)(int32_t)DT_INST_PHA_BY_IDX(n, keys, i, x), \ + .y = (int16_t)(int32_t)DT_INST_PHA_BY_IDX(n, keys, i, y), \ + .rx = (int16_t)(int32_t)DT_INST_PHA_BY_IDX(n, keys, i, rx), \ + .ry = (int16_t)(int32_t)DT_INST_PHA_BY_IDX(n, keys, i, ry), \ + .r = (int16_t)(int32_t)DT_INST_PHA_BY_IDX(n, keys, i, r), \ + } + +#define ZMK_LAYOUT_INST(n) \ + static const struct zmk_key_physical_attrs const _CONCAT( \ + _zmk_physical_layout_keys_, n)[DT_INST_PROP_LEN_OR(n, keys, 0)] = { \ + LISTIFY(DT_INST_PROP_LEN_OR(n, keys, 0), ZKPA_INIT, (, ), n)}; \ + ZMK_MATRIX_TRANSFORM_EXTERN(DT_INST_PHANDLE(n, transform)); \ + static const struct zmk_physical_layout const _CONCAT(_zmk_physical_layout_, \ + DT_DRV_INST(n)) = { \ + .display_name = DT_INST_PROP_OR(n, display_name, "Layout #" #n), \ + .matrix_transform = ZMK_MATRIX_TRANSFORM_T_FOR_NODE(DT_INST_PHANDLE(n, transform)), \ + .keys = _CONCAT(_zmk_physical_layout_keys_, n), \ + .keys_len = DT_INST_PROP_LEN_OR(n, keys, 0), \ + .kscan = DEVICE_DT_GET(COND_CODE_1(DT_INST_PROP_LEN(n, kscan), \ + (DT_INST_PHANDLE(n, kscan)), (DT_CHOSEN(zmk_kscan))))}; + +DT_INST_FOREACH_STATUS_OKAY(ZMK_LAYOUT_INST) + +#define POS_MAP_COMPAT zmk_physical_layout_position_map +#define HAVE_POS_MAP DT_HAS_COMPAT_STATUS_OKAY(POS_MAP_COMPAT) + +#define POS_MAP_COMPLETE (HAVE_POS_MAP && DT_PROP(DT_INST(0, POS_MAP_COMPAT), complete)) + +#if HAVE_POS_MAP + +// Using sizeof + union trick to calculate the "positions" length statically. +#define ZMK_POS_MAP_POSITIONS_ARRAY(node_id) \ + uint8_t _CONCAT(prop_, node_id)[DT_PROP_LEN(node_id, positions)]; + +#define ZMK_POS_MAP_LEN \ + sizeof(union {DT_FOREACH_CHILD(DT_INST(0, POS_MAP_COMPAT), ZMK_POS_MAP_POSITIONS_ARRAY)}) + +struct position_map_entry { + const struct zmk_physical_layout *layout; + const uint32_t positions[ZMK_POS_MAP_LEN]; +}; + +#define ZMK_POS_MAP_ENTRY(node_id) \ + { \ + .layout = &_CONCAT(_zmk_physical_layout_, DT_PHANDLE(node_id, physical_layout)), \ + .positions = DT_PROP(node_id, positions), \ + } + +static const struct position_map_entry positions_maps[] = { + DT_FOREACH_CHILD_SEP(DT_INST(0, POS_MAP_COMPAT), ZMK_POS_MAP_ENTRY, (, ))}; + +#endif + +#define ZMK_LAYOUT_REF(n) &_CONCAT(_zmk_physical_layout_, DT_DRV_INST(n)), + +static const struct zmk_physical_layout *const layouts[] = { + DT_INST_FOREACH_STATUS_OKAY(ZMK_LAYOUT_REF)}; + +#elif DT_HAS_CHOSEN(zmk_matrix_transform) + +ZMK_MATRIX_TRANSFORM_EXTERN(DT_CHOSEN(zmk_matrix_transform)); + +static const struct zmk_physical_layout _CONCAT(_zmk_physical_layout_, chosen) = { + .display_name = "Default", + .matrix_transform = ZMK_MATRIX_TRANSFORM_T_FOR_NODE(DT_CHOSEN(zmk_matrix_transform)), + COND_CODE_1(DT_HAS_CHOSEN(zmk_kscan), (.kscan = DEVICE_DT_GET(DT_CHOSEN(zmk_kscan)), ), ())}; + +static const struct zmk_physical_layout *const layouts[] = { + &_CONCAT(_zmk_physical_layout_, chosen)}; + +#elif DT_HAS_CHOSEN(zmk_kscan) + +ZMK_MATRIX_TRANSFORM_DEFAULT_EXTERN(); +static const struct zmk_physical_layout _CONCAT(_zmk_physical_layout_, chosen) = { + .display_name = "Default", + .matrix_transform = &zmk_matrix_transform_default, + .kscan = DEVICE_DT_GET(DT_CHOSEN(zmk_kscan)), +}; + +static const struct zmk_physical_layout *const layouts[] = { + &_CONCAT(_zmk_physical_layout_, chosen)}; + +#endif + +const struct zmk_physical_layout *active; + +size_t zmk_physical_layouts_get_list(struct zmk_physical_layout const *const **dest_layouts) { + *dest_layouts = &layouts[0]; + + return ARRAY_SIZE(layouts); +} + +#define ZMK_KSCAN_EVENT_STATE_PRESSED 0 +#define ZMK_KSCAN_EVENT_STATE_RELEASED 1 + +struct zmk_kscan_event { + uint32_t row; + uint32_t column; + uint32_t state; +}; + +static struct zmk_kscan_msg_processor { struct k_work work; } msg_processor; + +K_MSGQ_DEFINE(physical_layouts_kscan_msgq, sizeof(struct zmk_kscan_event), + CONFIG_ZMK_KSCAN_EVENT_QUEUE_SIZE, 4); + +static void zmk_physical_layout_kscan_callback(const struct device *dev, uint32_t row, + uint32_t column, bool pressed) { + if (dev != active->kscan) { + return; + } + + struct zmk_kscan_event ev = { + .row = row, + .column = column, + .state = (pressed ? ZMK_KSCAN_EVENT_STATE_PRESSED : ZMK_KSCAN_EVENT_STATE_RELEASED)}; + + k_msgq_put(&physical_layouts_kscan_msgq, &ev, K_NO_WAIT); + k_work_submit(&msg_processor.work); +} + +static void zmk_physical_layouts_kscan_process_msgq(struct k_work *item) { + struct zmk_kscan_event ev; + + while (k_msgq_get(&physical_layouts_kscan_msgq, &ev, K_NO_WAIT) == 0) { + bool pressed = (ev.state == ZMK_KSCAN_EVENT_STATE_PRESSED); + int32_t position = zmk_matrix_transform_row_column_to_position(active->matrix_transform, + ev.row, ev.column); + + if (position < 0) { + LOG_WRN("Not found in transform: row: %d, col: %d, pressed: %s", ev.row, ev.column, + (pressed ? "true" : "false")); + continue; + } + + LOG_DBG("Row: %d, col: %d, position: %d, pressed: %s", ev.row, ev.column, position, + (pressed ? "true" : "false")); + raise_zmk_position_state_changed( + (struct zmk_position_state_changed){.source = ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL, + .state = pressed, + .position = position, + .timestamp = k_uptime_get()}); + } +} + +int zmk_physical_layouts_select_layout(const struct zmk_physical_layout *dest_layout) { + if (!dest_layout) { + return -ENODEV; + } + + if (dest_layout == active) { + return 0; + } + + if (active) { + if (active->kscan) { + kscan_disable_callback(active->kscan); +#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) + pm_device_runtime_put(active->kscan); +#elif IS_ENABLED(CONFIG_PM_DEVICE) + pm_device_action_run(active->kscan, PM_DEVICE_ACTION_SUSPEND); +#endif + } + } + + active = dest_layout; + + if (active->kscan) { +#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) + int err = pm_device_runtime_get(active->kscan); + if (err < 0) { + LOG_WRN("PM runtime get of kscan device to enable it %d", err); + return err; + } +#elif IS_ENABLED(CONFIG_PM_DEVICE) + pm_device_action_run(active->kscan, PM_DEVICE_ACTION_RESUME); +#endif + kscan_config(active->kscan, zmk_physical_layout_kscan_callback); + kscan_enable_callback(active->kscan); + } + + return 0; +} + +int zmk_physical_layouts_select(uint8_t index) { + if (index >= ARRAY_SIZE(layouts)) { + return -EINVAL; + } + + return zmk_physical_layouts_select_layout(layouts[index]); +} + +int zmk_physical_layouts_get_selected(void) { + for (int i = 0; i < ARRAY_SIZE(layouts); i++) { + if (layouts[i] == active) { + return i; + } + } + + return -ENODEV; +} + +#if IS_ENABLED(CONFIG_SETTINGS) + +static int8_t saved_selected_index = -1; + +#endif + +int zmk_physical_layouts_select_initial(void) { + const struct zmk_physical_layout *initial; + +#if DT_HAS_CHOSEN(zmk_physical_layout) + initial = &_CONCAT(_zmk_physical_layout_, DT_CHOSEN(zmk_physical_layout)); +#else + initial = layouts[0]; +#endif + + int ret = zmk_physical_layouts_select_layout(initial); + + return ret; +} + +int zmk_physical_layouts_check_unsaved_selection(void) { +#if IS_ENABLED(CONFIG_SETTINGS) + return saved_selected_index < 0 || + saved_selected_index == (uint8_t)zmk_physical_layouts_get_selected() + ? 0 + : 1; +#else + return -ENOTSUP; +#endif +} + +int zmk_physical_layouts_save_selected(void) { +#if IS_ENABLED(CONFIG_SETTINGS) + uint8_t val = (uint8_t)zmk_physical_layouts_get_selected(); + + return settings_save_one("physical_layouts/selected", &val, sizeof(val)); +#else + return -ENOTSUP; +#endif +} + +int zmk_physical_layouts_revert_selected(void) { return zmk_physical_layouts_select_initial(); } + +int zmk_physical_layouts_get_position_map(uint8_t source, uint8_t dest, uint32_t *map) { + if (source >= ARRAY_SIZE(layouts) || dest >= ARRAY_SIZE(layouts)) { + return -EINVAL; + } + + const struct zmk_physical_layout *src_layout = layouts[source]; + const struct zmk_physical_layout *dest_layout = layouts[dest]; + +#if HAVE_POS_MAP + const struct position_map_entry *src_pos_map = NULL; + const struct position_map_entry *dest_pos_map = NULL; + + for (int pm = 0; pm < ARRAY_SIZE(positions_maps); pm++) { + if (positions_maps[pm].layout == src_layout) { + src_pos_map = &positions_maps[pm]; + } + + if (positions_maps[pm].layout == dest_layout) { + dest_pos_map = &positions_maps[pm]; + } + } +#endif + + memset(map, UINT32_MAX, dest_layout->keys_len); + + for (int b = 0; b < dest_layout->keys_len; b++) { + bool found = false; + +#if HAVE_POS_MAP + if (src_pos_map && dest_pos_map) { + for (int m = 0; m < ZMK_POS_MAP_LEN; m++) { + if (dest_pos_map->positions[m] == b) { + map[b] = src_pos_map->positions[m]; + found = true; + break; + } + } + } +#endif + +#if !POS_MAP_COMPLETE + if (!found) { + const struct zmk_key_physical_attrs *key = &dest_layout->keys[b]; + for (int old_b = 0; old_b < src_layout->keys_len; old_b++) { + const struct zmk_key_physical_attrs *candidate_key = &src_layout->keys[old_b]; + + if (candidate_key->x == key->x && candidate_key->y == key->y) { + map[b] = old_b; + found = true; + break; + } + } + } +#endif + + if (!found || map[b] >= src_layout->keys_len) { + map[b] = UINT32_MAX; + } + } + + return dest_layout->keys_len; +} + +#if IS_ENABLED(CONFIG_SETTINGS) + +static int physical_layouts_handle_set(const char *name, size_t len, settings_read_cb read_cb, + void *cb_arg) { + const char *next; + + if (settings_name_steq(name, "selected", &next) && !next) { + if (len != sizeof(saved_selected_index)) { + return -EINVAL; + } + + int err = read_cb(cb_arg, &saved_selected_index, len); + if (err <= 0) { + LOG_ERR("Failed to handle selected physical dest_layout from settings (err %d)", err); + return err; + } + + return zmk_physical_layouts_select(saved_selected_index); + } + + return 0; +}; + +SETTINGS_STATIC_HANDLER_DEFINE(physical_layouts, "physical_layouts", NULL, + physical_layouts_handle_set, NULL, NULL); + +#endif // IS_ENABLED(CONFIG_SETTINGS) + +static int zmk_physical_layouts_init(void) { + k_work_init(&msg_processor.work, zmk_physical_layouts_kscan_process_msgq); + +#if IS_ENABLED(CONFIG_PM_DEVICE) + for (int l = 0; l < ARRAY_SIZE(layouts); l++) { + const struct zmk_physical_layout *pl = layouts[l]; + if (pl->kscan) { + if (pm_device_wakeup_is_capable(pl->kscan)) { + pm_device_wakeup_enable(pl->kscan, true); + } + } + } +#endif // IS_ENABLED(CONFIG_PM_DEVICE) + + return zmk_physical_layouts_select_initial(); +} + +SYS_INIT(zmk_physical_layouts_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); diff --git a/app/src/rgb_underglow.c b/app/src/rgb_underglow.c index a7a9b4f0..3453fb44 100644 --- a/app/src/rgb_underglow.c +++ b/app/src/rgb_underglow.c @@ -82,7 +82,7 @@ static struct zmk_led_hsb hsb_scale_zero_max(struct zmk_led_hsb hsb) { } static struct led_rgb hsb_to_rgb(struct zmk_led_hsb hsb) { - float r, g, b; + float r = 0, g = 0, b = 0; uint8_t i = hsb.h / 60; float v = hsb.b / ((float)BRT_MAX); @@ -221,6 +221,10 @@ static int rgb_settings_set(const char *name, size_t len, settings_read_cb read_ rc = read_cb(cb_arg, &state, sizeof(state)); if (rc >= 0) { + if (state.on) { + k_timer_start(&underglow_tick, K_NO_WAIT, K_MSEC(50)); + } + return 0; } @@ -230,7 +234,7 @@ static int rgb_settings_set(const char *name, size_t len, settings_read_cb read_ return -ENOENT; } -struct settings_handler rgb_conf = {.name = "rgb/underglow", .h_set = rgb_settings_set}; +SETTINGS_STATIC_HANDLER_DEFINE(rgb_underglow, "rgb/underglow", NULL, rgb_settings_set, NULL, NULL); static void zmk_rgb_underglow_save_state_work(struct k_work *_work) { settings_save_one("rgb/underglow/state", &state, sizeof(state)); @@ -262,17 +266,7 @@ static int zmk_rgb_underglow_init(void) { }; #if IS_ENABLED(CONFIG_SETTINGS) - settings_subsys_init(); - - int err = settings_register(&rgb_conf); - if (err) { - LOG_ERR("Failed to register the ext_power settings handler (err %d)", err); - return err; - } - k_work_init_delayable(&underglow_save_work, zmk_rgb_underglow_save_state_work); - - settings_load_subtree("rgb/underglow"); #endif #if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_USB) @@ -468,17 +462,31 @@ int zmk_rgb_underglow_change_spd(int direction) { #if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE) || \ IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_USB) -static int rgb_underglow_auto_state(bool *prev_state, bool new_state) { - if (state.on == new_state) { +struct rgb_underglow_sleep_state { + bool is_awake; + bool rgb_state_before_sleeping; +}; + +static int rgb_underglow_auto_state(bool target_wake_state) { + static struct rgb_underglow_sleep_state sleep_state = { + is_awake : true, + rgb_state_before_sleeping : false + }; + + // wake up event while awake, or sleep event while sleeping -> no-op + if (target_wake_state == sleep_state.is_awake) { return 0; } - if (new_state) { - state.on = *prev_state; - *prev_state = false; - return zmk_rgb_underglow_on(); + sleep_state.is_awake = target_wake_state; + + if (sleep_state.is_awake) { + if (sleep_state.rgb_state_before_sleeping) { + return zmk_rgb_underglow_on(); + } else { + return zmk_rgb_underglow_off(); + } } else { - state.on = false; - *prev_state = true; + sleep_state.rgb_state_before_sleeping = state.on; return zmk_rgb_underglow_off(); } } @@ -487,16 +495,13 @@ static int rgb_underglow_event_listener(const zmk_event_t *eh) { #if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE) if (as_zmk_activity_state_changed(eh)) { - static bool prev_state = false; - return rgb_underglow_auto_state(&prev_state, - zmk_activity_get_state() == ZMK_ACTIVITY_ACTIVE); + return rgb_underglow_auto_state(zmk_activity_get_state() == ZMK_ACTIVITY_ACTIVE); } #endif #if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_USB) if (as_zmk_usb_conn_state_changed(eh)) { - static bool prev_state = false; - return rgb_underglow_auto_state(&prev_state, zmk_usb_is_powered()); + return rgb_underglow_auto_state(zmk_usb_is_powered()); } #endif diff --git a/app/src/split/Kconfig b/app/src/split/Kconfig index 11349370..ce90037b 100644 --- a/app/src/split/Kconfig +++ b/app/src/split/Kconfig @@ -24,7 +24,7 @@ config ZMK_SPLIT_PERIPHERAL_HID_INDICATORS bool "Peripheral HID Indicators" depends on ZMK_HID_INDICATORS help - Enable propogating the HID (LED) Indicator state to the split peripheral(s). + Enable propagating the HID (LED) Indicator state to the split peripheral(s). #ZMK_SPLIT endif diff --git a/app/src/split/bluetooth/Kconfig b/app/src/split/bluetooth/Kconfig index 4da50528..7f362fde 100644 --- a/app/src/split/bluetooth/Kconfig +++ b/app/src/split/bluetooth/Kconfig @@ -76,7 +76,7 @@ if !ZMK_SPLIT_ROLE_CENTRAL config ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE int "BLE split peripheral notify thread stack size" - default 650 + default 756 config ZMK_SPLIT_BLE_PERIPHERAL_PRIORITY int "BLE split peripheral notify thread priority" diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index abb37a0b..0f4cd78b 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -585,7 +586,7 @@ static bool split_central_eir_found(const bt_addr_le_t *addr) { return false; } - LOG_DBG("Initiating new connnection"); + LOG_DBG("Initiating new connection"); struct bt_le_conn_param *param = BT_LE_CONN_PARAM(CONFIG_ZMK_SPLIT_BLE_PREF_INT, CONFIG_ZMK_SPLIT_BLE_PREF_INT, CONFIG_ZMK_SPLIT_BLE_PREF_LATENCY, CONFIG_ZMK_SPLIT_BLE_PREF_TIMEOUT); @@ -865,13 +866,34 @@ int zmk_split_bt_update_hid_indicator(zmk_hid_indicators_t indicators) { #endif // IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) +static int finish_init() { + return IS_ENABLED(CONFIG_ZMK_BLE_CLEAR_BONDS_ON_START) ? 0 : start_scanning(); +} + +#if IS_ENABLED(CONFIG_SETTINGS) + +static int central_ble_handle_set(const char *name, size_t len, settings_read_cb read_cb, + void *cb_arg) { + return 0; +} + +static struct settings_handler ble_central_settings_handler = { + .name = "ble_central", .h_set = central_ble_handle_set, .h_commit = finish_init}; + +#endif // IS_ENABLED(CONFIG_SETTINGS) + static int zmk_split_bt_central_init(void) { k_work_queue_start(&split_central_split_run_q, split_central_split_run_q_stack, K_THREAD_STACK_SIZEOF(split_central_split_run_q_stack), CONFIG_ZMK_BLE_THREAD_PRIORITY, NULL); bt_conn_cb_register(&conn_callbacks); - return IS_ENABLED(CONFIG_ZMK_BLE_CLEAR_BONDS_ON_START) ? 0 : start_scanning(); +#if IS_ENABLED(CONFIG_SETTINGS) + settings_register(&ble_central_settings_handler); + return 0; +#else + return finish_init(); +#endif // IS_ENABLED(CONFIG_SETTINGS) } SYS_INIT(zmk_split_bt_central_init, APPLICATION, CONFIG_ZMK_BLE_INIT_PRIORITY); diff --git a/app/src/split/bluetooth/peripheral.c b/app/src/split/bluetooth/peripheral.c index 6ce82d0a..5a12e0fc 100644 --- a/app/src/split/bluetooth/peripheral.c +++ b/app/src/split/bluetooth/peripheral.c @@ -146,21 +146,7 @@ bool zmk_split_bt_peripheral_is_connected(void) { return is_connected; } bool zmk_split_bt_peripheral_is_bonded(void) { return is_bonded; } -static int zmk_peripheral_ble_init(void) { - int err = bt_enable(NULL); - - if (err) { - LOG_ERR("BLUETOOTH FAILED (%d)", err); - return err; - } - -#if IS_ENABLED(CONFIG_SETTINGS) - settings_subsys_init(); - - settings_load_subtree("ble"); - settings_load_subtree("bt"); -#endif - +static int zmk_peripheral_ble_complete_startup(void) { #if IS_ENABLED(CONFIG_ZMK_BLE_CLEAR_BONDS_ON_START) LOG_WRN("Clearing all existing BLE bond information from the keyboard"); @@ -176,4 +162,35 @@ static int zmk_peripheral_ble_init(void) { return 0; } +#if IS_ENABLED(CONFIG_SETTINGS) + +static int peripheral_ble_handle_set(const char *name, size_t len, settings_read_cb read_cb, + void *cb_arg) { + return 0; +} + +static struct settings_handler ble_peripheral_settings_handler = { + .name = "ble_peripheral", + .h_set = peripheral_ble_handle_set, + .h_commit = zmk_peripheral_ble_complete_startup}; + +#endif // IS_ENABLED(CONFIG_SETTINGS) + +static int zmk_peripheral_ble_init(void) { + int err = bt_enable(NULL); + + if (err) { + LOG_ERR("BLUETOOTH FAILED (%d)", err); + return err; + } + +#if IS_ENABLED(CONFIG_SETTINGS) + settings_register(&ble_peripheral_settings_handler); +#else + zmk_peripheral_ble_complete_startup(); +#endif + + return 0; +} + SYS_INIT(zmk_peripheral_ble_init, APPLICATION, CONFIG_ZMK_BLE_INIT_PRIORITY); diff --git a/app/src/studio/CMakeLists.txt b/app/src/studio/CMakeLists.txt new file mode 100644 index 00000000..e8f0d49d --- /dev/null +++ b/app/src/studio/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT + +zephyr_linker_sources(DATA_SECTIONS ../../include/linker/zmk-rpc-subsystems.ld) +zephyr_linker_sources(SECTIONS ../../include/linker/zmk-rpc-subsystem-handlers.ld) +zephyr_linker_sources(SECTIONS ../../include/linker/zmk-rpc-event-mappers.ld) +zephyr_linker_sources(SECTIONS ../../include/linker/zmk-rpc-transport.ld) + +target_sources(app PRIVATE msg_framing.c) +target_sources(app PRIVATE rpc.c) +target_sources(app PRIVATE core.c) +target_sources(app PRIVATE behavior_subsystem.c) +target_sources(app PRIVATE core_subsystem.c) +target_sources_ifdef(CONFIG_ZMK_STUDIO_TRANSPORT_UART app PRIVATE uart_rpc_transport.c) +target_sources_ifdef(CONFIG_ZMK_STUDIO_TRANSPORT_BLE app PRIVATE gatt_rpc_transport.c) \ No newline at end of file diff --git a/app/src/studio/Kconfig b/app/src/studio/Kconfig new file mode 100644 index 00000000..ebe680bb --- /dev/null +++ b/app/src/studio/Kconfig @@ -0,0 +1,95 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: MIT + +menuconfig ZMK_STUDIO + bool "Studio Support" + select ZMK_STUDIO_RPC if !ZMK_SPLIT || ZMK_SPLIT_ROLE_CENTRAL + select PM_DEVICE # Needed for physical layout switching + help + Add firmware support for realtime keymap updates (ZMK Studio) + +if ZMK_STUDIO + +module = ZMK_STUDIO +module-str = zmk_studio +source "subsys/logging/Kconfig.template.log_config" + +menuconfig ZMK_STUDIO_LOCKING + bool "Lock Support" + +if ZMK_STUDIO_LOCKING + +config ZMK_STUDIO_LOCK_IDLE_TIMEOUT_SEC + int "Idle Timeout" + default 600 + +config ZMK_STUDIO_LOCK_ON_DISCONNECT + bool "Lock On Disconnect" + default y + +endif + +menuconfig ZMK_STUDIO_RPC + bool "Remote Procedure Calls (RPC)" + select NANOPB + # These two save stack size + imply NANOPB_NO_ERRMSG + imply NANOPB_WITHOUT_64BIT + imply ZMK_STUDIO_LOCKING if !ARCH_POSIX + select CBPRINTF_LIBC_SUBSTS if ARCH_POSIX + select SETTINGS + select ZMK_BEHAVIOR_METADATA + select ZMK_BEHAVIOR_LOCAL_IDS + select RING_BUFFER + help + Add firmware support for studio RPC protocol + +if ZMK_STUDIO_RPC + +menu "Transports" + +config ZMK_STUDIO_TRANSPORT_UART + bool "Serial" + select SERIAL + select RING_BUFFER + default y if ZMK_USB || ARCH_POSIX + +config ZMK_STUDIO_TRANSPORT_UART_RX_STACK_SIZE + int "RX Stack Size" + depends on !UART_INTERRUPT_DRIVEN + default 512 + +config ZMK_STUDIO_TRANSPORT_BLE + bool "BLE (GATT)" + select RING_BUFFER + select BT_USER_DATA_LEN_UPDATE + depends on ZMK_BLE + default y + +config BT_CONN_TX_MAX + default 64 if ZMK_STUDIO_TRANSPORT_BLE + +config ZMK_STUDIO_TRANSPORT_BLE_PREF_LATENCY + int "BLE Transport preferred latency" + default 10 + help + When the studio UI is connected, a lower latency can be requested in order + to make the interactions between keyboard and studio faster. + +endmenu + +config ZMK_STUDIO_RPC_THREAD_STACK_SIZE + int "RPC Thread Stack Size" + default 4096 + +config ZMK_STUDIO_RPC_RX_BUF_SIZE + int "RX Buffer Size" + default 30 + +config ZMK_STUDIO_RPC_TX_BUF_SIZE + int "TX Buffer Size" + default 64 + +endif + +endif diff --git a/app/src/studio/behavior_subsystem.c b/app/src/studio/behavior_subsystem.c new file mode 100644 index 00000000..b8d1ef1d --- /dev/null +++ b/app/src/studio/behavior_subsystem.c @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +#include +#include +#include +#include + +ZMK_RPC_SUBSYSTEM(behaviors) + +#define BEHAVIOR_RESPONSE(type, ...) ZMK_RPC_RESPONSE(behaviors, type, __VA_ARGS__) + +static bool encode_behavior_summaries(pb_ostream_t *stream, const pb_field_t *field, + void *const *arg) { + STRUCT_SECTION_FOREACH(zmk_behavior_local_id_map, beh) { + if (!pb_encode_tag_for_field(stream, field)) { + return false; + } + + if (!pb_encode_varint(stream, beh->local_id)) { + LOG_ERR("Failed to encode behavior ID"); + return false; + } + } + + return true; +} + +zmk_studio_Response list_all_behaviors(const zmk_studio_Request *req) { + zmk_behaviors_ListAllBehaviorsResponse beh_resp = + zmk_behaviors_ListAllBehaviorsResponse_init_zero; + beh_resp.behaviors.funcs.encode = encode_behavior_summaries; + + return BEHAVIOR_RESPONSE(list_all_behaviors, beh_resp); +} + +struct encode_metadata_sets_state { + const struct behavior_parameter_metadata_set *sets; + size_t sets_len; + size_t i; +}; + +static bool encode_value_description_name(pb_ostream_t *stream, const pb_field_t *field, + void *const *arg) { + struct behavior_parameter_value_metadata *state = + (struct behavior_parameter_value_metadata *)*arg; + + if (!state->display_name) { + return true; + } + + if (!pb_encode_tag_for_field(stream, field)) { + return false; + } + + return pb_encode_string(stream, state->display_name, strlen(state->display_name)); +} + +static bool encode_value_description(pb_ostream_t *stream, const pb_field_t *field, + void *const *arg) { + struct encode_metadata_sets_state *state = (struct encode_metadata_sets_state *)*arg; + + const struct behavior_parameter_metadata_set *set = &state->sets[state->i]; + + bool is_param1 = field->tag == zmk_behaviors_BehaviorBindingParametersSet_param1_tag; + size_t values_len = is_param1 ? set->param1_values_len : set->param2_values_len; + const struct behavior_parameter_value_metadata *values = + is_param1 ? set->param1_values : set->param2_values; + + for (int val_i = 0; val_i < values_len; val_i++) { + const struct behavior_parameter_value_metadata *val = &values[val_i]; + + if (!pb_encode_tag_for_field(stream, field)) { + return false; + } + + zmk_behaviors_BehaviorParameterValueDescription desc = + zmk_behaviors_BehaviorParameterValueDescription_init_zero; + desc.name.funcs.encode = encode_value_description_name; + desc.name.arg = val; + + switch (val->type) { + case BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE: + desc.which_value_type = zmk_behaviors_BehaviorParameterValueDescription_constant_tag; + desc.value_type.constant = val->value; + break; + case BEHAVIOR_PARAMETER_VALUE_TYPE_RANGE: + desc.which_value_type = zmk_behaviors_BehaviorParameterValueDescription_range_tag; + desc.value_type.range.min = val->range.min; + desc.value_type.range.max = val->range.max; + break; + case BEHAVIOR_PARAMETER_VALUE_TYPE_NIL: + desc.which_value_type = zmk_behaviors_BehaviorParameterValueDescription_nil_tag; + break; + case BEHAVIOR_PARAMETER_VALUE_TYPE_HID_USAGE: + desc.which_value_type = zmk_behaviors_BehaviorParameterValueDescription_hid_usage_tag; + desc.value_type.hid_usage.consumer_max = ZMK_HID_CONSUMER_MAX_USAGE; + desc.value_type.hid_usage.keyboard_max = ZMK_HID_KEYBOARD_MAX_USAGE; + break; + case BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID: + desc.which_value_type = zmk_behaviors_BehaviorParameterValueDescription_layer_id_tag; + break; + default: + LOG_ERR("Unknown value description type %d", val->type); + return false; + } + + if (!pb_encode_submessage(stream, &zmk_behaviors_BehaviorParameterValueDescription_msg, + &desc)) { + LOG_WRN("Failed to encode submessage for set %d, value %d!", state->i, val_i); + return false; + } + } + + return true; +} + +static bool encode_metadata_sets(pb_ostream_t *stream, const pb_field_t *field, void *const *arg) { + struct encode_metadata_sets_state *state = (struct encode_metadata_sets_state *)*arg; + bool ret = true; + + LOG_DBG("Encoding the %d metadata sets with %p", state->sets_len, state->sets); + + for (int i = 0; i < state->sets_len; i++) { + LOG_DBG("Encoding set %d", i); + if (!pb_encode_tag_for_field(stream, field)) { + return false; + } + + state->i = i; + zmk_behaviors_BehaviorBindingParametersSet msg = + zmk_behaviors_BehaviorBindingParametersSet_init_zero; + msg.param1.funcs.encode = encode_value_description; + msg.param1.arg = state; + msg.param2.funcs.encode = encode_value_description; + msg.param2.arg = state; + ret = pb_encode_submessage(stream, &zmk_behaviors_BehaviorBindingParametersSet_msg, &msg); + if (!ret) { + LOG_WRN("Failed to encode submessage for set %d", i); + break; + } + } + + return ret; +} + +static bool encode_behavior_name(pb_ostream_t *stream, const pb_field_t *field, void *const *arg) { + struct zmk_behavior_ref *zbm = (struct zmk_behavior_ref *)*arg; + + if (!pb_encode_tag_for_field(stream, field)) { + return false; + } + + return pb_encode_string(stream, zbm->metadata.display_name, strlen(zbm->metadata.display_name)); +} + +static struct encode_metadata_sets_state state = {}; + +zmk_studio_Response get_behavior_details(const zmk_studio_Request *req) { + uint32_t behavior_id = req->subsystem.behaviors.request_type.get_behavior_details.behavior_id; + + const char *behavior_name = zmk_behavior_find_behavior_name_from_local_id(behavior_id); + + if (!behavior_name) { + LOG_WRN("No behavior found for ID %d", behavior_id); + return ZMK_RPC_SIMPLE_ERR(GENERIC); + } + + const struct device *device = behavior_get_binding(behavior_name); + + struct zmk_behavior_ref *zbm = NULL; + STRUCT_SECTION_FOREACH(zmk_behavior_ref, item) { + if (item->device == device) { + zbm = item; + break; + } + } + + __ASSERT(zbm != NULL, "Can't find a device without also having metadata"); + + struct behavior_parameter_metadata desc = {0}; + int ret = behavior_get_parameter_metadata(device, &desc); + if (ret < 0) { + LOG_DBG("Failed to fetch the metadata for %s! %d", zbm->metadata.display_name, ret); + } else { + LOG_DBG("Got metadata with %d sets", desc.sets_len); + } + + zmk_behaviors_GetBehaviorDetailsResponse resp = + zmk_behaviors_GetBehaviorDetailsResponse_init_zero; + resp.id = behavior_id; + resp.display_name.funcs.encode = encode_behavior_name; + resp.display_name.arg = zbm; + + state.sets = desc.sets; + state.sets_len = desc.sets_len; + + resp.metadata.funcs.encode = encode_metadata_sets; + resp.metadata.arg = &state; + + return BEHAVIOR_RESPONSE(get_behavior_details, resp); +} + +ZMK_RPC_SUBSYSTEM_HANDLER(behaviors, list_all_behaviors, ZMK_STUDIO_RPC_HANDLER_UNSECURED); +ZMK_RPC_SUBSYSTEM_HANDLER(behaviors, get_behavior_details, ZMK_STUDIO_RPC_HANDLER_SECURED); diff --git a/app/src/studio/core.c b/app/src/studio/core.c new file mode 100644 index 00000000..fafe0248 --- /dev/null +++ b/app/src/studio/core.c @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +ZMK_EVENT_IMPL(zmk_studio_core_lock_state_changed); + +static enum zmk_studio_core_lock_state state = IS_ENABLED(CONFIG_ZMK_STUDIO_LOCKING) + ? ZMK_STUDIO_CORE_LOCK_STATE_LOCKED + : ZMK_STUDIO_CORE_LOCK_STATE_UNLOCKED; + +enum zmk_studio_core_lock_state zmk_studio_core_get_lock_state(void) { return state; } + +static void set_state(enum zmk_studio_core_lock_state new_state) { + if (state == new_state) { + return; + } + + state = new_state; + + raise_zmk_studio_core_lock_state_changed( + (struct zmk_studio_core_lock_state_changed){.state = state}); +} + +#if CONFIG_ZMK_STUDIO_LOCK_IDLE_TIMEOUT_SEC > 0 + +static void core_idle_lock_timeout_cb(struct k_work *work) { zmk_studio_core_lock(); } + +K_WORK_DELAYABLE_DEFINE(core_idle_lock_timeout, core_idle_lock_timeout_cb); + +void zmk_studio_core_reschedule_lock_timeout() { + k_work_reschedule(&core_idle_lock_timeout, K_SECONDS(CONFIG_ZMK_STUDIO_LOCK_IDLE_TIMEOUT_SEC)); +} + +#else + +void zmk_studio_core_reschedule_lock_timeout() {} + +#endif + +void zmk_studio_core_unlock() { + set_state(ZMK_STUDIO_CORE_LOCK_STATE_UNLOCKED); + + zmk_studio_core_reschedule_lock_timeout(); +} + +void zmk_studio_core_lock() { set_state(ZMK_STUDIO_CORE_LOCK_STATE_LOCKED); } \ No newline at end of file diff --git a/app/src/studio/core_subsystem.c b/app/src/studio/core_subsystem.c new file mode 100644 index 00000000..001aed9b --- /dev/null +++ b/app/src/studio/core_subsystem.c @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +#include +#include +#include + +ZMK_RPC_SUBSYSTEM(core) + +#define CORE_RESPONSE(type, ...) ZMK_RPC_RESPONSE(core, type, __VA_ARGS__) + +static bool encode_device_info_name(pb_ostream_t *stream, const pb_field_t *field, + void *const *arg) { + if (!pb_encode_tag_for_field(stream, field)) { + return false; + } + + return pb_encode_string(stream, CONFIG_ZMK_KEYBOARD_NAME, strlen(CONFIG_ZMK_KEYBOARD_NAME)); +} + +#if IS_ENABLED(CONFIG_HWINFO) +static bool encode_device_info_serial_number(pb_ostream_t *stream, const pb_field_t *field, + void *const *arg) { + uint8_t id_buffer[32]; + const ssize_t id_size = hwinfo_get_device_id(id_buffer, ARRAY_SIZE(id_buffer)); + + if (id_size <= 0) { + return true; + } + + if (!pb_encode_tag_for_field(stream, field)) { + return false; + } + + return pb_encode_string(stream, id_buffer, id_size); +} + +#endif // IS_ENABLED(CONFIG_HWINFO) + +zmk_studio_Response get_device_info(const zmk_studio_Request *req) { + zmk_core_GetDeviceInfoResponse resp = zmk_core_GetDeviceInfoResponse_init_zero; + + resp.name.funcs.encode = encode_device_info_name; +#if IS_ENABLED(CONFIG_HWINFO) + resp.serial_number.funcs.encode = encode_device_info_serial_number; +#endif // IS_ENABLED(CONFIG_HWINFO) + + return CORE_RESPONSE(get_device_info, resp); +} + +zmk_studio_Response get_lock_state(const zmk_studio_Request *req) { + zmk_core_LockState resp = zmk_studio_core_get_lock_state(); + + return CORE_RESPONSE(get_lock_state, resp); +} + +ZMK_RPC_SUBSYSTEM_HANDLER(core, get_device_info, ZMK_STUDIO_RPC_HANDLER_UNSECURED); +ZMK_RPC_SUBSYSTEM_HANDLER(core, get_lock_state, ZMK_STUDIO_RPC_HANDLER_UNSECURED); + +static int core_event_mapper(const zmk_event_t *eh, zmk_studio_Notification *n) { + struct zmk_studio_core_lock_state_changed *lock_ev = as_zmk_studio_core_lock_state_changed(eh); + + if (!lock_ev) { + return -ENOTSUP; + } + + LOG_DBG("Mapped a lock state event properly"); + + *n = ZMK_RPC_NOTIFICATION(core, lock_state_changed, lock_ev->state); + return 0; +} + +ZMK_RPC_EVENT_MAPPER(core, core_event_mapper, zmk_studio_core_lock_state_changed); diff --git a/app/src/studio/gatt_rpc_transport.c b/app/src/studio/gatt_rpc_transport.c new file mode 100644 index 00000000..f0ab3152 --- /dev/null +++ b/app/src/studio/gatt_rpc_transport.c @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "uuid.h" + +#include + +LOG_MODULE_DECLARE(zmk_studio, CONFIG_ZMK_STUDIO_LOG_LEVEL); + +static bool handling_rx = false; + +static atomic_t notify_size; + +static void rpc_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value) { + ARG_UNUSED(attr); + + bool notif_enabled = (value == BT_GATT_CCC_INDICATE); + + LOG_INF("RPC Notifications %s", notif_enabled ? "enabled" : "disabled"); + +#if CONFIG_ZMK_STUDIO_TRANSPORT_BLE_PREF_LATENCY < CONFIG_BT_PERIPHERAL_PREF_LATENCY + struct bt_conn *conn = zmk_ble_active_profile_conn(); + if (conn) { + uint8_t latency = notif_enabled ? CONFIG_ZMK_STUDIO_TRANSPORT_BLE_PREF_LATENCY + : CONFIG_BT_PERIPHERAL_PREF_LATENCY; + + int ret = bt_conn_le_param_update( + conn, + BT_LE_CONN_PARAM(CONFIG_BT_PERIPHERAL_PREF_MIN_INT, CONFIG_BT_PERIPHERAL_PREF_MAX_INT, + latency, CONFIG_BT_PERIPHERAL_PREF_TIMEOUT)); + if (ret < 0) { + LOG_WRN("Failed to request lower latency while studio is active (%d)", ret); + } + + bt_conn_unref(conn); + } +#endif +} + +static ssize_t read_rpc_resp(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, + uint16_t len, uint16_t offset) { + + LOG_DBG("Read response for length %d at offset %d", len, offset); + return 0; +} + +static ssize_t write_rpc_req(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, + uint16_t len, uint16_t offset, uint8_t flags) { + if (!handling_rx) { + return len; + } + + uint32_t copied = 0; + struct ring_buf *rpc_buf = zmk_rpc_get_rx_buf(); + while (copied < len) { + uint8_t *buffer; + uint32_t claim_len = ring_buf_put_claim(rpc_buf, &buffer, len - copied); + + if (claim_len > 0) { + memcpy(buffer, ((uint8_t *)buf) + copied, claim_len); + copied += claim_len; + } + + ring_buf_put_finish(rpc_buf, claim_len); + } + + zmk_rpc_rx_notify(); + + return len; +} + +BT_GATT_SERVICE_DEFINE( + rpc_interface, BT_GATT_PRIMARY_SERVICE(BT_UUID_DECLARE_128(ZMK_STUDIO_BT_SERVICE_UUID)), + BT_GATT_CHARACTERISTIC(BT_UUID_DECLARE_128(ZMK_STUDIO_BT_RPC_CHRC_UUID), + BT_GATT_CHRC_WRITE | BT_GATT_CHRC_READ | BT_GATT_CHRC_INDICATE, + BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT, read_rpc_resp, + write_rpc_req, NULL), + BT_GATT_CCC(rpc_ccc_cfg_changed, BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT)); + +static uint16_t get_notify_size_for_conn(struct bt_conn *conn) { + uint16_t notify_size = 23; // Default MTU size unless negotiated higher + struct bt_conn_info conn_info; + if (conn && bt_conn_get_info(conn, &conn_info) >= 0) { + notify_size = conn_info.le.data_len->tx_max_len; + } + + return notify_size; +} + +static void refresh_notify_size(void) { + struct bt_conn *conn = zmk_ble_active_profile_conn(); + + uint16_t ns = get_notify_size_for_conn(conn); + if (conn) { + bt_conn_unref(conn); + } + + atomic_set(¬ify_size, ns); +} + +static int gatt_start_rx() { + refresh_notify_size(); + handling_rx = true; + return 0; +} + +static int gatt_stop_rx(void) { + handling_rx = false; + return 0; +} + +static struct bt_gatt_indicate_params rpc_indicate_params = { + .attr = &rpc_interface.attrs[1], +}; + +static void notif_rpc_tx_cb(struct k_work *work) { + struct bt_conn *conn = zmk_ble_active_profile_conn(); + struct ring_buf *tx_buf = zmk_rpc_get_tx_buf(); + + if (!conn) { + LOG_WRN("No active connection for queued data, dropping"); + ring_buf_reset(tx_buf); + return; + } + + uint16_t notify_size = get_notify_size_for_conn(conn); + uint8_t notify_bytes[notify_size]; + + while (ring_buf_size_get(tx_buf) > 0) { + uint16_t added = 0; + while (added < notify_size && ring_buf_size_get(tx_buf) > 0) { + uint8_t *buf; + int len = ring_buf_get_claim(tx_buf, &buf, notify_size - added); + + memcpy(notify_bytes + added, buf, len); + + added += len; + ring_buf_get_finish(tx_buf, len); + } + + rpc_indicate_params.data = notify_bytes; + rpc_indicate_params.len = added; + + int notify_attempts = 5; + do { + int err = bt_gatt_indicate(conn, &rpc_indicate_params); + if (err >= 0) { + break; + } + + LOG_WRN("Failed to notify the response %d", err); + k_sleep(K_MSEC(200)); + } while (notify_attempts-- > 0); + } + + bt_conn_unref(conn); +} + +static K_WORK_DEFINE(notify_tx_work, notif_rpc_tx_cb); + +struct gatt_write_state { + size_t pending_notify; +}; + +static void gatt_tx_notify(struct ring_buf *tx_buf, size_t added, bool msg_done, void *user_data) { + struct gatt_write_state *state = (struct gatt_write_state *)user_data; + + state->pending_notify += added; + + atomic_t ns = atomic_get(¬ify_size); + + if (msg_done || state->pending_notify > ns) { + k_work_submit(¬ify_tx_work); + state->pending_notify = 0; + } +} + +static struct gatt_write_state tx_state = {}; + +static void *gatt_tx_user_data(void) { + memset(&tx_state, sizeof(tx_state), 0); + + return &tx_state; +} + +ZMK_RPC_TRANSPORT(gatt, ZMK_TRANSPORT_BLE, gatt_start_rx, gatt_stop_rx, gatt_tx_user_data, + gatt_tx_notify); + +static int gatt_rpc_listener(const zmk_event_t *eh) { + refresh_notify_size(); + +#if IS_ENABLED(CONFIG_ZMK_STUDIO_LOCK_ON_DISCONNECT) + struct bt_conn *conn = zmk_ble_active_profile_conn(); + + if (!conn) { + zmk_studio_core_lock(); + } else { + bt_conn_unref(conn); + } +#endif + + return 0; +} + +ZMK_LISTENER(gatt_rpc_listener, gatt_rpc_listener); +ZMK_SUBSCRIPTION(gatt_rpc_listener, zmk_ble_active_profile_changed); diff --git a/app/src/studio/msg_framing.c b/app/src/studio/msg_framing.c new file mode 100644 index 00000000..a14289ee --- /dev/null +++ b/app/src/studio/msg_framing.c @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +#include "msg_framing.h" + +static bool process_byte_err_state(enum studio_framing_state *rpc_framing_state, uint8_t c) { + switch (c) { + case FRAMING_EOF: + *rpc_framing_state = FRAMING_STATE_IDLE; + return false; + case FRAMING_SOF: + *rpc_framing_state = FRAMING_STATE_AWAITING_DATA; + return false; + default: + LOG_WRN("Discarding unexpected data 0x%02x", c); + return false; + } + + return false; +} + +static bool process_byte_idle_state(enum studio_framing_state *rpc_framing_state, uint8_t c) { + switch (c) { + case FRAMING_SOF: + *rpc_framing_state = FRAMING_STATE_AWAITING_DATA; + return false; + default: + LOG_WRN("Expected SOF, got 0x%02x", c); + return false; + } + return false; +} + +static bool process_byte_awaiting_data_state(enum studio_framing_state *rpc_framing_state, + uint8_t c) { + switch (c) { + case FRAMING_SOF: + LOG_WRN("Unescaped SOF mid-data"); + *rpc_framing_state = FRAMING_STATE_ERR; + return false; + case FRAMING_ESC: + *rpc_framing_state = FRAMING_STATE_ESCAPED; + return false; + case FRAMING_EOF: + *rpc_framing_state = FRAMING_STATE_EOF; + return false; + default: + return true; + } + + return false; +} + +static bool process_byte_escaped_state(enum studio_framing_state *rpc_framing_state, uint8_t c) { + *rpc_framing_state = FRAMING_STATE_AWAITING_DATA; + return true; +} + +bool studio_framing_process_byte(enum studio_framing_state *rpc_framing_state, uint8_t c) { + switch (*rpc_framing_state) { + case FRAMING_STATE_ERR: + return process_byte_err_state(rpc_framing_state, c); + case FRAMING_STATE_IDLE: + case FRAMING_STATE_EOF: + return process_byte_idle_state(rpc_framing_state, c); + case FRAMING_STATE_AWAITING_DATA: + return process_byte_awaiting_data_state(rpc_framing_state, c); + case FRAMING_STATE_ESCAPED: + return process_byte_escaped_state(rpc_framing_state, c); + default: + LOG_ERR("Unsupported framing state: %d", *rpc_framing_state); + return false; + } +} \ No newline at end of file diff --git a/app/src/studio/msg_framing.h b/app/src/studio/msg_framing.h new file mode 100644 index 00000000..cbe4abdf --- /dev/null +++ b/app/src/studio/msg_framing.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include + +enum studio_framing_state { + FRAMING_STATE_IDLE, + FRAMING_STATE_AWAITING_DATA, + FRAMING_STATE_ESCAPED, + FRAMING_STATE_ERR, + FRAMING_STATE_EOF, +}; + +#define FRAMING_SOF 0xAB +#define FRAMING_ESC 0xAC +#define FRAMING_EOF 0xAD + +/** + * @brief Process an incoming byte from a frame. Will possibly update the framing state depending on + * what data is received. + * @retval true if data is a non-framing byte, and is real data to be handled by the upper level + * logic. + * @retval false if data is a framing byte, and should be ignored. Also indicates the framing state + * has been updated. + */ +bool studio_framing_process_byte(enum studio_framing_state *frame_state, uint8_t data); diff --git a/app/src/studio/rpc.c b/app/src/studio/rpc.c new file mode 100644 index 00000000..3d5bfcd7 --- /dev/null +++ b/app/src/studio/rpc.c @@ -0,0 +1,343 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "msg_framing.h" + +#include +#include + +#include +#include +#include + +LOG_MODULE_REGISTER(zmk_studio, CONFIG_ZMK_STUDIO_LOG_LEVEL); + +#include +#include +#include +#include +#include + +ZMK_EVENT_IMPL(zmk_studio_rpc_notification); + +static struct zmk_rpc_subsystem *find_subsystem_for_choice(uint8_t choice) { + STRUCT_SECTION_FOREACH(zmk_rpc_subsystem, sub) { + if (sub->subsystem_choice == choice) { + return sub; + } + } + + return NULL; +} + +zmk_studio_Response zmk_rpc_subsystem_delegate_to_subs(const struct zmk_rpc_subsystem *subsys, + const zmk_studio_Request *req, + uint8_t which_req) { + LOG_DBG("Got subsystem func for %d", subsys->subsystem_choice); + + for (int i = subsys->handlers_start_index; i <= subsys->handlers_end_index; i++) { + struct zmk_rpc_subsystem_handler *sub_handler; + STRUCT_SECTION_GET(zmk_rpc_subsystem_handler, i, &sub_handler); + if (sub_handler->request_choice == which_req) { + if (sub_handler->security == ZMK_STUDIO_RPC_HANDLER_SECURED && + zmk_studio_core_get_lock_state() != ZMK_STUDIO_CORE_LOCK_STATE_UNLOCKED) { + return ZMK_RPC_RESPONSE(meta, simple_error, + zmk_meta_ErrorConditions_UNLOCK_REQUIRED); + } + return sub_handler->func(req); + } + } + LOG_ERR("No handler func found for %d", which_req); + return ZMK_RPC_RESPONSE(meta, simple_error, zmk_meta_ErrorConditions_RPC_NOT_FOUND); +} + +static zmk_studio_Response handle_request(const zmk_studio_Request *req) { + zmk_studio_core_reschedule_lock_timeout(); + struct zmk_rpc_subsystem *sub = find_subsystem_for_choice(req->which_subsystem); + if (!sub) { + LOG_WRN("No subsystem found for choice %d", req->which_subsystem); + return ZMK_RPC_RESPONSE(meta, simple_error, zmk_meta_ErrorConditions_RPC_NOT_FOUND); + } + + zmk_studio_Response resp = sub->func(sub, req); + resp.type.request_response.request_id = req->request_id; + + return resp; +} + +RING_BUF_DECLARE(rpc_rx_buf, CONFIG_ZMK_STUDIO_RPC_RX_BUF_SIZE); + +static K_SEM_DEFINE(rpc_rx_sem, 0, 1); + +static enum studio_framing_state rpc_framing_state; + +static K_MUTEX_DEFINE(rpc_transport_mutex); +static struct zmk_rpc_transport *selected_transport; + +struct ring_buf *zmk_rpc_get_rx_buf(void) { + return &rpc_rx_buf; +} + +void zmk_rpc_rx_notify(void) { k_sem_give(&rpc_rx_sem); } + +static bool rpc_read_cb(pb_istream_t *stream, uint8_t *buf, size_t count) { + uint32_t write_offset = 0; + + do { + uint8_t *buffer; + uint32_t len = ring_buf_get_claim(&rpc_rx_buf, &buffer, count); + + if (len > 0) { + for (int i = 0; i < len; i++) { + if (studio_framing_process_byte(&rpc_framing_state, buffer[i])) { + buf[write_offset++] = buffer[i]; + } + } + } else { + k_sem_take(&rpc_rx_sem, K_FOREVER); + } + + ring_buf_get_finish(&rpc_rx_buf, len); + } while (write_offset < count && rpc_framing_state != FRAMING_STATE_EOF); + + if (rpc_framing_state == FRAMING_STATE_EOF) { + stream->bytes_left = 0; + return false; + } else { + return true; + } +} + +static pb_istream_t pb_istream_for_rx_ring_buf() { + pb_istream_t stream = {&rpc_read_cb, NULL, SIZE_MAX}; + return stream; +} + +RING_BUF_DECLARE(rpc_tx_buf, CONFIG_ZMK_STUDIO_RPC_TX_BUF_SIZE); + +struct ring_buf *zmk_rpc_get_tx_buf(void) { + return &rpc_tx_buf; +} + +static bool rpc_tx_buffer_write(pb_ostream_t *stream, const uint8_t *buf, size_t count) { + void *user_data = stream->state; + size_t written = 0; + + bool escape_byte_already_written = false; + do { + uint32_t write_idx = 0; + + uint8_t *write_buf; + uint32_t claim_len = ring_buf_put_claim(&rpc_tx_buf, &write_buf, count - written); + + if (claim_len == 0) { + continue; + } + + int escapes_written = 0; + for (int i = 0; i < claim_len && write_idx < claim_len; i++) { + uint8_t b = buf[written + i]; + switch (b) { + case FRAMING_EOF: + case FRAMING_ESC: + case FRAMING_SOF: + // Care to be taken. We may need to write the escape byte, + // but that's the last available spot for this claim, so we track + // if the escape has already been written in the previous iteration + // of our loop. + if (!escape_byte_already_written) { + escapes_written++; + write_buf[write_idx++] = FRAMING_ESC; + escape_byte_already_written = true; + if (write_idx >= claim_len) { + LOG_WRN("Skipping on, no room to write escape and real byte"); + continue; + } + } + default: + write_buf[write_idx++] = b; + escape_byte_already_written = false; + break; + } + } + + ring_buf_put_finish(&rpc_tx_buf, write_idx); + + written += (write_idx - escapes_written); + + selected_transport->tx_notify(&rpc_tx_buf, write_idx, false, user_data); + } while (written < count); + + return true; +} + +static pb_ostream_t pb_ostream_for_tx_buf(void *user_data) { + pb_ostream_t stream = {&rpc_tx_buffer_write, (void *)user_data, SIZE_MAX, 0}; + return stream; +} + +static int send_response(const zmk_studio_Response *resp) { + k_mutex_lock(&rpc_transport_mutex, K_FOREVER); + + if (!selected_transport) { + goto exit; + } + + void *user_data = selected_transport->tx_user_data ? selected_transport->tx_user_data() : NULL; + + pb_ostream_t stream = pb_ostream_for_tx_buf(user_data); + + uint8_t framing_byte = FRAMING_SOF; + ring_buf_put(&rpc_tx_buf, &framing_byte, 1); + + selected_transport->tx_notify(&rpc_tx_buf, 1, false, user_data); + + /* Now we are ready to encode the message! */ + bool status = pb_encode(&stream, &zmk_studio_Response_msg, resp); + + if (!status) { +#if !IS_ENABLED(CONFIG_NANOPB_NO_ERRMSG) + LOG_ERR("Failed to encode the message %s", stream.errmsg); +#endif // !IS_ENABLED(CONFIG_NANOPB_NO_ERRMSG) + return -EINVAL; + } + + framing_byte = FRAMING_EOF; + ring_buf_put(&rpc_tx_buf, &framing_byte, 1); + + selected_transport->tx_notify(&rpc_tx_buf, 1, true, user_data); + +exit: + k_mutex_unlock(&rpc_transport_mutex); + return 0; +} + +static void rpc_main(void) { + for (;;) { + pb_istream_t stream = pb_istream_for_rx_ring_buf(); + zmk_studio_Request req = zmk_studio_Request_init_zero; + bool status = pb_decode(&stream, &zmk_studio_Request_msg, &req); + + rpc_framing_state = FRAMING_STATE_IDLE; + + if (status) { + zmk_studio_Response resp = handle_request(&req); + + int err = send_response(&resp); + if (err < 0) { + LOG_ERR("Failed to send the RPC response %d", err); + } + } else { + LOG_DBG("Decode failed"); + } + } +} + +K_THREAD_DEFINE(studio_rpc_thread, CONFIG_ZMK_STUDIO_RPC_THREAD_STACK_SIZE, rpc_main, NULL, NULL, + NULL, K_LOWEST_APPLICATION_THREAD_PRIO, 0, 0); + +static void refresh_selected_transport(void) { + enum zmk_transport transport = zmk_endpoints_selected().transport; + + k_mutex_lock(&rpc_transport_mutex, K_FOREVER); + + if (selected_transport && selected_transport->transport == transport) { + return; + } + + if (selected_transport) { + if (selected_transport->rx_stop) { + selected_transport->rx_stop(); + } + selected_transport = NULL; +#if IS_ENABLED(CONFIG_ZMK_STUDIO_LOCK_ON_DISCONNECT) + zmk_studio_core_lock(); +#endif + } + + STRUCT_SECTION_FOREACH(zmk_rpc_transport, t) { + if (t->transport == transport) { + selected_transport = t; + if (selected_transport->rx_start) { + selected_transport->rx_start(); + } + break; + } + } + + if (!selected_transport) { + LOG_WRN("Failed to select a transport!"); + } + + k_mutex_unlock(&rpc_transport_mutex); +} + +static int zmk_rpc_init(void) { + int prev_choice = -1; + struct zmk_rpc_subsystem *prev_sub = NULL; + int i = 0; + + STRUCT_SECTION_FOREACH(zmk_rpc_subsystem_handler, handler) { + struct zmk_rpc_subsystem *sub = find_subsystem_for_choice(handler->subsystem_choice); + + __ASSERT(sub != NULL, "RPC Handler for unknown subsystem choice %d", + handler->subsystem_choice); + + if (prev_choice < 0) { + sub->handlers_start_index = i; + } else if ((prev_choice != handler->subsystem_choice) && prev_sub) { + prev_sub->handlers_end_index = i - 1; + sub->handlers_start_index = i; + } + + prev_choice = handler->subsystem_choice; + prev_sub = sub; + i++; + } + + if (prev_sub) { + prev_sub->handlers_end_index = i - 1; + } + + refresh_selected_transport(); + + return 0; +} + +SYS_INIT(zmk_rpc_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); + +static int studio_rpc_listener_cb(const zmk_event_t *eh) { + struct zmk_endpoint_changed *ep_changed = as_zmk_endpoint_changed(eh); + if (ep_changed) { + refresh_selected_transport(); + return ZMK_EV_EVENT_BUBBLE; + } + + struct zmk_studio_rpc_notification *rpc_notify = as_zmk_studio_rpc_notification(eh); + if (rpc_notify) { + zmk_studio_Response resp = zmk_studio_Response_init_zero; + resp.which_type = zmk_studio_Response_notification_tag; + resp.type.notification = rpc_notify->notification; + send_response(&resp); + return ZMK_EV_EVENT_BUBBLE; + } + + zmk_studio_Notification n = zmk_studio_Notification_init_zero; + STRUCT_SECTION_FOREACH(zmk_rpc_event_mapper, mapper) { + int ret = mapper->func(eh, &n); + if (ret >= 0) { + raise_zmk_studio_rpc_notification( + (struct zmk_studio_rpc_notification){.notification = n}); + break; + } + } + + return ZMK_EV_EVENT_BUBBLE; +} + +ZMK_LISTENER(studio_rpc, studio_rpc_listener_cb); +ZMK_SUBSCRIPTION(studio_rpc, zmk_endpoint_changed); +ZMK_SUBSCRIPTION(studio_rpc, zmk_studio_rpc_notification); diff --git a/app/src/studio/uart_rpc_transport.c b/app/src/studio/uart_rpc_transport.c new file mode 100644 index 00000000..d4a4de83 --- /dev/null +++ b/app/src/studio/uart_rpc_transport.c @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include + +#include +#include + +LOG_MODULE_DECLARE(zmk_studio, CONFIG_ZMK_STUDIO_LOG_LEVEL); + +/* change this to any other UART peripheral if desired */ +#define UART_DEVICE_NODE DT_CHOSEN(zmk_studio_rpc_uart) + +static const struct device *const uart_dev = DEVICE_DT_GET(UART_DEVICE_NODE); + +static void tx_notify(struct ring_buf *tx_ring_buf, size_t written, bool msg_done, + void *user_data) { + if (msg_done || (ring_buf_size_get(tx_ring_buf) > (ring_buf_capacity_get(tx_ring_buf) / 2))) { +#if IS_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN) + uart_irq_tx_enable(uart_dev); +#else + struct ring_buf *tx_buf = zmk_rpc_get_tx_buf(); + uint8_t *buf; + uint32_t claim_len; + while ((claim_len = ring_buf_get_claim(tx_buf, &buf, tx_buf->size)) > 0) { + for (int i = 0; i < claim_len; i++) { + uart_poll_out(uart_dev, buf[i]); + } + + ring_buf_get_finish(tx_buf, claim_len); + } +#endif + } +} + +#if !IS_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN) + +static void uart_rx_main(void) { + for (;;) { + uint8_t *buf; + struct ring_buf *ring_buf = zmk_rpc_get_rx_buf(); + uint32_t claim_len = ring_buf_put_claim(ring_buf, &buf, 1); + + if (claim_len < 1) { + LOG_WRN("NO CLAIM ABLE TO BE HAD"); + k_sleep(K_MSEC(1)); + continue; + } + + if (uart_poll_in(uart_dev, buf) < 0) { + ring_buf_put_finish(ring_buf, 0); + k_sleep(K_MSEC(1)); + } else { + ring_buf_put_finish(ring_buf, 1); + zmk_rpc_rx_notify(); + } + } +} + +K_THREAD_DEFINE(uart_transport_read_thread, CONFIG_ZMK_STUDIO_TRANSPORT_UART_RX_STACK_SIZE, + uart_rx_main, NULL, NULL, NULL, K_LOWEST_APPLICATION_THREAD_PRIO, 0, 0); + +#endif + +static int start_rx() { +#if IS_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN) + uart_irq_rx_enable(uart_dev); +#else + k_thread_resume(uart_transport_read_thread); +#endif + return 0; +} + +static int stop_rx(void) { +#if IS_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN) + uart_irq_rx_disable(uart_dev); +#else + k_thread_suspend(uart_transport_read_thread); +#endif + return 0; +} + +ZMK_RPC_TRANSPORT(uart, ZMK_TRANSPORT_USB, start_rx, stop_rx, NULL, tx_notify); + +#if IS_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN) + +/* + * Read characters from UART until line end is detected. Afterwards push the + * data to the message queue. + */ +static void serial_cb(const struct device *dev, void *user_data) { + if (!uart_irq_update(uart_dev)) { + return; + } + + if (uart_irq_rx_ready(uart_dev)) { + /* read until FIFO empty */ + uint32_t last_read = 0, len = 0; + struct ring_buf *buf = zmk_rpc_get_rx_buf(); + do { + uint8_t *buffer; + len = ring_buf_put_claim(buf, &buffer, buf->size); + if (len > 0) { + last_read = uart_fifo_read(uart_dev, buffer, len); + + ring_buf_put_finish(buf, last_read); + } else { + LOG_ERR("Dropping incoming RPC byte, insufficient room in the RX buffer. Bump " + "CONFIG_ZMK_STUDIO_RPC_RX_BUF_SIZE."); + uint8_t dummy; + last_read = uart_fifo_read(uart_dev, &dummy, 1); + } + } while (last_read && last_read == len); + + zmk_rpc_rx_notify(); + } + + if (uart_irq_tx_ready(uart_dev)) { + struct ring_buf *tx_buf = zmk_rpc_get_tx_buf(); + uint32_t len; + while ((len = ring_buf_size_get(tx_buf)) > 0) { + uint8_t *buf; + uint32_t claim_len = ring_buf_get_claim(tx_buf, &buf, tx_buf->size); + + if (claim_len == 0) { + continue; + } + + int sent = uart_fifo_fill(uart_dev, buf, claim_len); + + ring_buf_get_finish(tx_buf, MAX(sent, 0)); + } + } +} + +#endif + +static int uart_rpc_interface_init(void) { + if (!device_is_ready(uart_dev)) { + LOG_ERR("UART device not found!"); + return -ENODEV; + } + +#if IS_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN) + /* configure interrupt and callback to receive data */ + int ret = uart_irq_callback_user_data_set(uart_dev, serial_cb, NULL); + + if (ret < 0) { + if (ret == -ENOTSUP) { + printk("Interrupt-driven UART API support not enabled\n"); + } else if (ret == -ENOSYS) { + printk("UART device does not support interrupt-driven API\n"); + } else { + printk("Error setting UART callback: %d\n", ret); + } + return ret; + } +#endif // IS_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN) + + return 0; +} + +SYS_INIT(uart_rpc_interface_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); diff --git a/app/src/studio/uuid.h b/app/src/studio/uuid.h new file mode 100644 index 00000000..4b412ac8 --- /dev/null +++ b/app/src/studio/uuid.h @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include + +#define ZMK_BT_STUDIO_UUID(num) BT_UUID_128_ENCODE(num, 0x0196, 0x6107, 0xc967, 0xc5cfb1c2482a) +#define ZMK_STUDIO_BT_SERVICE_UUID ZMK_BT_STUDIO_UUID(0x00000000) +#define ZMK_STUDIO_BT_RPC_CHRC_UUID ZMK_BT_STUDIO_UUID(0x00000001) diff --git a/app/src/usb_hid.c b/app/src/usb_hid.c index cd3ef920..9db10952 100644 --- a/app/src/usb_hid.c +++ b/app/src/usb_hid.c @@ -195,4 +195,4 @@ static int zmk_usb_hid_init(void) { return 0; } -SYS_INIT(zmk_usb_hid_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); +SYS_INIT(zmk_usb_hid_init, APPLICATION, CONFIG_ZMK_USB_HID_INIT_PRIORITY); diff --git a/app/tests/mod-morph/2b-masked-morph-implicit-overwrite/native_posix_64.keymap b/app/tests/mod-morph/2b-masked-morph-implicit-overwrite/native_posix_64.keymap index 8f7b2cdb..1a0642f1 100644 --- a/app/tests/mod-morph/2b-masked-morph-implicit-overwrite/native_posix_64.keymap +++ b/app/tests/mod-morph/2b-masked-morph-implicit-overwrite/native_posix_64.keymap @@ -7,7 +7,7 @@ mod_morph: mod_morph { compatible = "zmk,behavior-mod-morph"; #binding-cells = <0>; - bindings = <&kp A>, <&kp LS(B)>; // implict mod overwrite + bindings = <&kp A>, <&kp LS(B)>; // implicit mod overwrite mods = <(MOD_LSFT|MOD_RSFT)>; }; }; diff --git a/app/west.yml b/app/west.yml index 1b502477..ac4964f3 100644 --- a/app/west.yml +++ b/app/west.yml @@ -29,5 +29,13 @@ manifest: - openthread - edtt - trusted-firmware-m + - name: nanopb + revision: 65cbefb4695bc7af1cb733ced99618afb3586b20 + path: modules/lib/nanopb + remote: zephyrproject-rtos + - name: zmk-studio-messages + revision: 42446798e357e8021c5202a01ea250a34a776e85 + path: modules/msgs/zmk-studio-messages + remote: zmkfirmware self: west-commands: scripts/west-commands.yml diff --git a/docs/blog/2020-08-12-zmk-sotf-1.md b/docs/blog/2020-08-12-zmk-sotf-1.md index afa03405..89cfffab 100644 --- a/docs/blog/2020-08-12-zmk-sotf-1.md +++ b/docs/blog/2020-08-12-zmk-sotf-1.md @@ -19,7 +19,7 @@ There's been lots of various activity in ZMK land! - Tons of [documentation](/docs) work. - Refactoring ([#73](https://github.com/zmkfirmware/zmk/pull/73), [#74](https://github.com/zmkfirmware/zmk/pull/74)) of [keymaps](/docs/features/keymaps) to make them simpler for users. - Mod-Tap Behavior (docs coming!) is much improved ([#69](https://github.com/zmkfirmware/zmk/pull/69)) and usable now. -- An initial [`setup.sh`](http://localhost:3000/docs/user-setup#user-config-setup-script) script was created, allowing users to quickly bootstrap a "user config" setup and push it to GitHub, where GitHub Actions will build the firmware for you. +- An initial [`setup.sh`](/docs/user-setup#user-config-setup-script) script was created, allowing users to quickly bootstrap a "user config" setup and push it to GitHub, where GitHub Actions will build the firmware for you. - Corne shield ([#80](https://github.com/zmkfirmware/zmk/pull/80)) shield definition was added. - Initial [encoder](/docs/features/encoders) support ([#61](https://github.com/zmkfirmware/zmk/pull/61)) was added. diff --git a/docs/blog/2021-07-17-zephyr-2-5.md b/docs/blog/2021-07-17-zephyr-2-5.md index 153027bb..789a644c 100644 --- a/docs/blog/2021-07-17-zephyr-2-5.md +++ b/docs/blog/2021-07-17-zephyr-2-5.md @@ -61,7 +61,7 @@ Once the container has rebuilt, VS Code will be running the 2.5 Docker image. The following steps will get you building ZMK locally against Zephyr 2.5: -- Run the updated [toolchain installation](/docs/development/setup#toolchain-installation) steps, and once completed, remove the previously installed SDK version (optional, existing SDK should still work) +- Run the updated [toolchain installation](/docs/development/setup) steps, and once completed, remove the previously installed SDK version (optional, existing SDK should still work) - pull the latest ZMK `main` with `git pull` for your ZMK checkout - run `west update` to pull the updated Zephyr version and its dependencies diff --git a/docs/blog/2022-04-02-zephyr-3-0.md b/docs/blog/2022-04-02-zephyr-3-0.md index 3b16b87e..92e8b33b 100644 --- a/docs/blog/2022-04-02-zephyr-3-0.md +++ b/docs/blog/2022-04-02-zephyr-3-0.md @@ -62,7 +62,7 @@ Once the container has rebuilt, VS Code will be running the 3.0 Docker image. The following steps will get you building ZMK locally against Zephyr 3.0: -- Run the updated [toolchain installation](/docs/development/setup#toolchain-installation) steps, and once completed, remove the previously installed SDK version (optional, existing SDK should still work) +- Run the updated [toolchain installation](/docs/development/setup) steps, and once completed, remove the previously installed SDK version (optional, existing SDK should still work) - pull the latest ZMK `main` with `git pull` for your ZMK checkout - run `west update` to pull the updated Zephyr version and its dependencies diff --git a/docs/blog/2022-04-10-zmk-sotf-5.md b/docs/blog/2022-04-10-zmk-sotf-5.md index 43cb4e67..1a0ea270 100644 --- a/docs/blog/2022-04-10-zmk-sotf-5.md +++ b/docs/blog/2022-04-10-zmk-sotf-5.md @@ -132,7 +132,7 @@ Another persistent bug that Apple users experienced was related to crashes and p The long awaited locality enhancement was finally merged by [petejohanson] in [#547](https://github.com/zmkfirmware/zmk/pull/547), allowing more fine grained control of where certain behaviors are invoked. Some key improvements thanks to the changes: - [RGB Underglow](/docs/features/underglow) behaviors now run globally, so enabling/disabling RGB, changing the color, animation, etc. applies to both sides of a split properly. -- [Reset](/docs/behaviors/reset#reset)/[Bootloader](/docs/behaviors/reset#bootloader) behaviors now run wherever the key was pressed. For example, adding a `&bootloader` reference to the peripheral side of a split will now put that side of the split into the bootloader when pressed. +- [Reset](/docs/behaviors/reset#reset)/[Bootloader](/docs/behaviors/reset#bootloader-reset) behaviors now run wherever the key was pressed. For example, adding a `&bootloader` reference to the peripheral side of a split will now put that side of the split into the bootloader when pressed. #### Split Connections diff --git a/docs/blog/2023-04-06-zephyr-3-2.md b/docs/blog/2023-04-06-zephyr-3-2.md index 4ba71cac..21058ca9 100644 --- a/docs/blog/2023-04-06-zephyr-3-2.md +++ b/docs/blog/2023-04-06-zephyr-3-2.md @@ -57,7 +57,7 @@ and then update it as appropriate to build the right shields/boards for your con ### Upgrade a manual script -If you have a custom GitHub Actions workflow you need to maintain for some reason, you can update the workflow to to use the `stable` Docker image tag for the build: +If you have a custom GitHub Actions workflow you need to maintain for some reason, you can update the workflow to use the `stable` Docker image tag for the build: - Open `.github/workflows/build.yml` in your editor/IDE - Change `zmkfirmware/zmk-build-arm:2.5` to `zmkfirmware/zmk-build-arm:stable` wherever it is found @@ -87,7 +87,7 @@ Once the container has rebuilt, VS Code will be running the 3.2 Docker image. The following steps will get you building ZMK locally against Zephyr 3.2: -- Run the updated [toolchain installation](/docs/development/setup#toolchain-installation) steps, and once completed, remove the previously installed SDK version (optional, existing SDK should still work) +- Run the updated [toolchain installation](/docs/development/setup) steps, and once completed, remove the previously installed SDK version (optional, existing SDK should still work) - Install the latest version of `west` by running `pip3 install --user --update west`. - pull the latest ZMK `main` with `git pull` for your ZMK checkout - run `west update` to pull the updated Zephyr version and its dependencies diff --git a/docs/blog/2023-10-05-zmk-sotf-6.md b/docs/blog/2023-10-05-zmk-sotf-6.md index fb8dc131..bd818cf6 100644 --- a/docs/blog/2023-10-05-zmk-sotf-6.md +++ b/docs/blog/2023-10-05-zmk-sotf-6.md @@ -105,7 +105,7 @@ Note that documentation is still lacking for utilizing more than one peripheral [petejohanson] contributed a fix to release held keys on peripheral disconnect [#1340](https://github.com/zmkfirmware/zmk/pull/1340), which makes scenarios where a split disconnects unexpectedly less painful. -[petejohanson] also improved [the `settings_reset` shield](/docs/troubleshooting#split-keyboard-halves-unable-to-pair) by making it clear bonds more reliably, and allow it to build for all boards in [#1879](https://github.com/zmkfirmware/zmk/pull/1879). +[petejohanson] also improved [the `settings_reset` shield](/docs/troubleshooting/connection-issues#split-keyboard-halves-unable-to-pair) by making it clear bonds more reliably, and allow it to build for all boards in [#1879](https://github.com/zmkfirmware/zmk/pull/1879). [petejohanson] and [xudongzheng] contributed additional split connectivity improvements, via using directed advertising in [#1913](https://github.com/zmkfirmware/zmk/pull/1913) and improving the robustness of central scanning in [#1912](https://github.com/zmkfirmware/zmk/pull/1912). diff --git a/docs/blog/2024-01-05-zmk-tools.md b/docs/blog/2024-01-05-zmk-tools.md index b48e5735..5ea3fd13 100755 --- a/docs/blog/2024-01-05-zmk-tools.md +++ b/docs/blog/2024-01-05-zmk-tools.md @@ -145,7 +145,7 @@ I should note that, as a native English speaker and typer, I don't use any of th ## Keyboard Latency Testing -The last project I want to mention is a tool for testing keyboard latency. It requires only a Rasbperry Pi, an optocoupler IC, a resistor, and some wire. If you've ever wondered how ZMK's latency compares to other keyboards, you can [check the results here](https://github.com/joelspadin/keyboard-latency-tester/blob/main/results/chart.ipynb)! +The last project I want to mention is a tool for testing keyboard latency. It requires only a Raspberry Pi, an optocoupler IC, a resistor, and some wire. If you've ever wondered how ZMK's latency compares to other keyboards, you can [check the results here](https://github.com/joelspadin/keyboard-latency-tester/blob/main/results/chart.ipynb)! I don't have a very large collection of keyboards though, so the data is pretty limited so far. If you want to try it on your own keyboard, see the instructions on the [keyboard latency tester README](https://github.com/joelspadin/keyboard-latency-tester), and please send me a PR with your results! diff --git a/docs/blog/2024-02-09-zephyr-3-5.md b/docs/blog/2024-02-09-zephyr-3-5.md index b3fec6cb..738f22da 100644 --- a/docs/blog/2024-02-09-zephyr-3-5.md +++ b/docs/blog/2024-02-09-zephyr-3-5.md @@ -70,7 +70,7 @@ Once the container has rebuilt, VS Code will be running the 3.5 Docker image. The following steps will get you building ZMK locally against Zephyr 3.5: -- Run the updated [toolchain installation](/docs/development/setup#toolchain-installation) steps, and once completed, remove the previously installed SDK version (optional, existing SDK should still work) +- Run the updated [toolchain installation](/docs/development/setup) steps, and once completed, remove the previously installed SDK version (optional, existing SDK should still work) - Install the latest version of `west` by running `pip3 install --user --update west`. - Pull the latest ZMK `main` with `git pull` for your ZMK checkout - Run `west update` to pull the updated Zephyr version and its dependencies diff --git a/docs/docs/behaviors/backlight.md b/docs/docs/behaviors/backlight.md index 12ed01f1..040bb7b7 100644 --- a/docs/docs/behaviors/backlight.md +++ b/docs/docs/behaviors/backlight.md @@ -58,4 +58,4 @@ However the settings will only be saved after [`CONFIG_ZMK_SETTINGS_SAVE_DEBOUNC ## Split Keyboards -Backlight behaviors are global: This means that when triggered, they affect both the central and peripheral side of split keyboards. +Backlight behaviors are [global](../features/split-keyboards.md#global-locality-behaviors): This means that when triggered, they affect both the central and peripheral side of split keyboards. diff --git a/docs/docs/behaviors/caps-word.md b/docs/docs/behaviors/caps-word.md index 77c8fd20..c79ebae0 100644 --- a/docs/docs/behaviors/caps-word.md +++ b/docs/docs/behaviors/caps-word.md @@ -7,7 +7,7 @@ sidebar_label: Caps Word The caps word behavior behaves similar to a caps lock, but will automatically deactivate when any key not in a continue list is pressed, or if the caps word key is pressed again. For smaller keyboards using [mod-taps](/docs/behaviors/mod-tap), this can help avoid repeated alternating holds when typing words in all caps. -The modifiers are applied only to to the alphabetic (`A` to `Z`) keycodes, to avoid automatically applying them to numeric values, etc. +The modifiers are applied only to the alphabetic (`A` to `Z`) keycodes, to avoid automatically applying them to numeric values, etc. ### Behavior Binding @@ -21,7 +21,7 @@ Example: ### Configuration -#### Continue List +#### Continue list By default, the caps word will remain active when any alphanumeric character or underscore (`UNDERSCORE`), backspace (`BACKSPACE`), or delete (`DELETE`) characters are pressed. Any other non-modifier keycode sent will turn off caps word. If you would like to override this, you can set a new array of keys in the `continue-list` property in your keymap: @@ -37,7 +37,7 @@ By default, the caps word will remain active when any alphanumeric character or }; ``` -#### Applied Modifier(s) +#### Applied modifier(s) In addition, if you would like _multiple_ modifiers, instead of just `MOD_LSFT`, you can override the `mods` property: diff --git a/docs/docs/behaviors/hold-tap.mdx b/docs/docs/behaviors/hold-tap.mdx index 5217cf79..20aaf810 100644 --- a/docs/docs/behaviors/hold-tap.mdx +++ b/docs/docs/behaviors/hold-tap.mdx @@ -35,7 +35,7 @@ When the hold-tap key is released and the hold behavior has not been triggered, ![Hold-tap comparison](../assets/hold-tap/comparison.svg) -### Basic usage +### Basic Usage For basic usage, please see the [mod-tap](mod-tap.md) and [layer-tap](layers.md#layer-tap) pages. diff --git a/docs/docs/behaviors/index.mdx b/docs/docs/behaviors/index.mdx index 24d73ae6..9aa2f339 100644 --- a/docs/docs/behaviors/index.mdx +++ b/docs/docs/behaviors/index.mdx @@ -9,7 +9,7 @@ sidebar_label: Overview Below is a summary of pre-defined behavior bindings and user-definable behaviors available in ZMK, with references to documentation pages describing them. -## Key press behaviors +## Key Press Behaviors | Binding | Behavior | Description | | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -21,14 +21,14 @@ Below is a summary of pre-defined behavior bindings and user-definable behaviors | `&caps_word` | [Caps Word](caps-word.md) | Behaves similar to caps lock, but automatically deactivates when any key not in a continue list is pressed, or if the caps word key is pressed again | | `&key_repeat` | [Key Repeat](key-repeat.md) | Sends again whatever keycode was last sent | -## Miscellaneous behaviors +## Miscellaneous Behaviors | Binding | Behavior | Description | | -------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | `&trans` | [Transparent](misc.md#transparent) | Passes the key press down to the next active layer in the stack for processing | | `&none` | [None](misc.md#none) | Swallows and stops the key press, no keycode will be sent nor will the key press be passed down to the next active layer in the stack | -## Layer navigation behaviors +## Layer Navigation Behaviors | Binding | Behavior | Description | | ------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------- | @@ -39,41 +39,41 @@ Below is a summary of pre-defined behavior bindings and user-definable behaviors | `&sl` | [Sticky Layer](sticky-layer.md) | Activates a layer until another key is pressed, then deactivates it | | `&df` | [Default Layer](layers.md#default-layer) | Change the default layer. Persisted across power reset. | -## Mouse emulation behaviors +## Mouse Emulation Behaviors | Binding | Behavior | Description | | ------- | ----------------------------------------------------------- | ------------------------------- | | `&mkp` | [Mouse Button Press](mouse-emulation.md#mouse-button-press) | Emulates pressing mouse buttons | -## Reset behaviors +## Reset Behaviors -| Binding | Behavior | Description | -| ------------- | --------------------------------- | ---------------------------------------------------------------------------------------- | -| `&sys_reset` | [Reset](reset.md#reset) | Resets the keyboard and re-runs the firmware flashed to the device | -| `&bootloader` | [Bootloader](reset.md#bootloader) | Resets the keyboard and puts it into bootloader mode, allowing you to flash new firmware | +| Binding | Behavior | Description | +| ------------- | --------------------------------------- | ---------------------------------------------------------------------------------------- | +| `&sys_reset` | [Reset](reset.md#reset) | Resets the keyboard and re-runs the firmware flashed to the device | +| `&bootloader` | [Bootloader](reset.md#bootloader-reset) | Resets the keyboard and puts it into bootloader mode, allowing you to flash new firmware | -## Output selection behaviors +## Output Selection Behaviors | Binding | Behavior | Description | | ------- | -------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | | `&bt` | [Bluetooth](bluetooth.md#bluetooth-behavior) | Completes a bluetooth action given on press, for example switching between devices | | `&out` | [Output Selection](outputs.md#output-selection-behavior) | Allows selecting whether output is sent to the USB or bluetooth connection when both are connected | -## Lighting behaviors +## Lighting Behaviors | Binding | Behavior | Description | | --------- | ---------------------------------------------- | ---------------------------------------------------------------------------- | | `&rgb_ug` | [RGB Underglow](underglow.md#behavior-binding) | Controls the RGB underglow, usually placed underneath the keyboard | | `&bl` | [Backlight](backlight.md#behavior-binding) | Controls the keyboard backlighting, usually placed through or under switches | -## Power management behaviors +## Power Management Behaviors | Binding | Behavior | Description | | ------------ | --------------------------------------------- | --------------------------------------------------------------- | | `&ext_power` | [Power management](power.md#behavior-binding) | Allows enabling or disabling the VCC power output to save power | | `&soft_off` | [Soft off](soft-off.md#behavior-binding) | Turns the keyboard off. | -## User-defined behaviors +## User-Defined Behaviors | Behavior | Description | | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | diff --git a/docs/docs/behaviors/key-repeat.md b/docs/docs/behaviors/key-repeat.md index 9772fdb4..21870084 100644 --- a/docs/docs/behaviors/key-repeat.md +++ b/docs/docs/behaviors/key-repeat.md @@ -19,7 +19,7 @@ Example: ### Configuration -#### Usage Pages +#### Usage pages By default, the key repeat will only track the last pressed key from the HID "Key" usage page, and ignore events from other usages, e.g. Consumer page. diff --git a/docs/docs/behaviors/layers.md b/docs/docs/behaviors/layers.md index 2367c4a6..b04174cc 100644 --- a/docs/docs/behaviors/layers.md +++ b/docs/docs/behaviors/layers.md @@ -8,7 +8,11 @@ sidebar_label: Layers Often, you may want a certain key position to alter which layers are enabled, change the default layer, etc. Some of those behaviors are still in the works; the ones that are working now are documented here. -## Defines To Refer To Layers +:::note +Multiple layers can be active at the same time and activating a layer will not deactivate layers higher up in the "layer stack". See [Layers](../features/keymaps.mdx#layers) for more information. +::: + +## Defines to Refer to Layers When working with layers, you may have several different key positions with bindings that enable/disable those layers. To make it easier to refer to those layers in your key bindings, and to change which layers are where later, you can @@ -33,7 +37,7 @@ again. ### Behavior Binding - Reference: `&mo` -- Parameter: The layer number to enable/disable, e.g. `1` +- Parameter: The layer number to enable while held, e.g. `1` Example: @@ -41,14 +45,14 @@ Example: &mo LOWER ``` -## Layer-tap +## Layer-Tap The "layer-tap" behavior enables a layer when a key is held, and outputs a [keypress](key-press.md) when the key is only tapped for a short time. ### Behavior Binding - Reference: `<` -- Parameter: The layer number to enable when held, e.g. `1` +- Parameter: The layer number to enable while held, e.g. `1` - Parameter: The keycode to send when tapped, e.g. `A` Example: @@ -99,7 +103,7 @@ Example: ## Toggle Layer -The "toggle layer" behavior enables a layer until the layer is manually disabled. +The "toggle layer" behavior enables a layer if it is currently disabled, or disables it if enabled. ### Behavior Binding @@ -112,43 +116,6 @@ Example: &tog LOWER ``` -"Toggle layer" for a : - -```dts -#define DEFAULT 0 -#define NAVI 1 - -#define NONE 0 - -/ { - keymap { - compatible = "zmk,keymap"; - - default_layer { - bindings = < - &tog NAVI &kp KP_DIVIDE &kp KP_MULTIPLY &kp KP_MINUS - &kp NUMBER_7 &kp NUMBER_8 &kp NUMBER_9 &kp KP_PLUS - &kp NUMBER_4 &kp NUMBER_5 &kp NUMBER_6 &kp KP_PLUS - &kp NUMBER_1 &kp NUMBER_2 &kp NUMBER_3 &kp RETURN - &kp NUMBER_0 &kp NUMBER_0 &kp DOT &kp RETURN - >; - }; - - nav_layer { - bindings = < - &tog NAVI &kp KP_DIVIDE &kp KP_MULTIPLY &kp KP_MINUS - &kp HOME &kp UP &kp PAGE_UP &kp KP_PLUS - &kp LEFT &none &kp RIGHT &kp KP_PLUS - &kp END &kp DOWN &kp PAGE_DOWN &kp RETURN - &kp INSERT &kp INSERT &kp DEL &kp RETURN - >; - }; - }; -}; -``` - -It is possible to use "toggle layer" to have keys that raise and lower the layers as well. - ## Conditional Layers The "conditional layers" feature enables a particular layer when all layers in a specified set are active. diff --git a/docs/docs/behaviors/macros.md b/docs/docs/behaviors/macros.md index 37ca80ff..50c8945e 100644 --- a/docs/docs/behaviors/macros.md +++ b/docs/docs/behaviors/macros.md @@ -223,7 +223,7 @@ Common examples are enabling one or more modifiers when the layer is active, or To achieve this, a combination of a 0ms wait time and splitting the press and release between a `¯o_pause_for_release` is used: -#### Layer + Modifier +#### Layer + modifier ```dts /** @@ -256,7 +256,7 @@ lm: lm { }; ``` -#### Layer + Underglow Color +#### Layer + underglow color To trigger a different underglow when the macro is pressed, and when it is released, we use the macro "press" activation mode whenever triggering the `&rgb_ug` behavior: diff --git a/docs/docs/behaviors/mod-morph.md b/docs/docs/behaviors/mod-morph.md index 7ecb9ab8..879db998 100644 --- a/docs/docs/behaviors/mod-morph.md +++ b/docs/docs/behaviors/mod-morph.md @@ -5,18 +5,17 @@ sidebar_label: Mod-Morph ## Summary -The Mod-Morph behavior sends a different keypress, depending on whether a specified modifier is being held during the keypress. +The mod-morph behavior invokes a different behavior depending on whether any of the specified modifiers are being held during the key press. -- If you tap the key by itself, the first keycode is sent. -- If you tap the key while holding the specified modifier, the second keycode is sent. +- If you tap the key by itself, the first behavior binding is activated. +- If you tap the key while holding (any of) the specified modifier(s), the second behavior binding is activated. ## Mod-Morph -The Mod-Morph behavior acts as one of two keycodes, depending on if the required modifier is being held during the keypress. - ### Configuration -An example of how to implement the mod-morph "Grave Escape": +Below is an example of how to implement the mod-morph "Grave Escape". When assigned to a key, pressing the key on its own will send an +Escape keycode but pressing it while a shift or GUI modifier is held sends the grave `` ` `` keycode instead: ```dts / { @@ -31,7 +30,7 @@ An example of how to implement the mod-morph "Grave Escape": }; ``` -Note that this specific mod-morph exists in ZMK by default using code `&gresc`. +Note that this specific mod-morph exists in ZMK by default using the binding `&gresc`. ### Behavior Binding @@ -65,9 +64,9 @@ Example: mods = <(MOD_LGUI|MOD_LSFT|MOD_RGUI|MOD_RSFT)>; ``` -### Advanced configuration +### Advanced Configuration -`keep-mods` +#### `keep-mods` When a modifier specified in `mods` is being held, it won't be sent along with the morphed keycode unless it is also specified in `keep-mods`. By default `keep-mods` equals `0`, which means no modifier specified in `mods` will be sent along with the morphed keycode. @@ -87,6 +86,34 @@ For example, the following configuration morphs `LEFT_SHIFT` + `BACKSPACE` into }; ``` +#### Trigger conditions with multiple modifiers + +Any modifier used in the `mods` property will activate a mod-morph; it isn't possible to require that multiple modifiers are held _together_ in order to activate it. +However, you can nest multiple mod-morph behaviors to achieve more complex decision logic, where you use one (or two) mod-morph behaviors in the `bindings` fields of another mod-morph. + +As an example, consider the following two mod-morphs: + +```dts +/ { + behaviors { + morph_BC: morph_BC { + compatible = "zmk,behavior-mod-morph"; + #binding-cells = <0>; + bindings = <&kp B>, <&kp C>; + mods = <(MOD_LCTL|MOD_RCTL)>; + }; + morph_ABC: morph_ABC { + compatible = "zmk,behavior-mod-morph"; + #binding-cells = <0>; + bindings = <&kp A>, <&morph_BC>; + mods = <(MOD_LSFT|MOD_RSFT)>; + }; + }; +}; +``` + +When you assign `&morph_ABC` to a key position and press it, it will output `A` by default. If you press it while a shift modifier is held it will output `B`, and if you are also holding a control modifier it will output `C` instead. + :::note[Karabiner-Elements (macOS) interfering with mod-morphs] If the first modified key press sends the modifier along with the morphed keycode and [Karabiner-Elements](https://karabiner-elements.pqrs.org/) is running, disable the "Modify Events" toggle from Karabiner's "Devices" settings page for the keyboard running ZMK. diff --git a/docs/docs/behaviors/power.md b/docs/docs/behaviors/power.md index dce7b155..53110f95 100644 --- a/docs/docs/behaviors/power.md +++ b/docs/docs/behaviors/power.md @@ -70,4 +70,4 @@ However it will only be saved after [`CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE`](../con ## Split Keyboards -Power management behaviors are global: This means that when triggered, they affects both the central and peripheral side of split keyboards. +Power management behaviors are [global](../features/split-keyboards.md#global-locality-behaviors): This means that when triggered, they affects both the central and peripheral side of split keyboards. diff --git a/docs/docs/behaviors/reset.md b/docs/docs/behaviors/reset.md index 60e69431..0ccde851 100644 --- a/docs/docs/behaviors/reset.md +++ b/docs/docs/behaviors/reset.md @@ -44,8 +44,4 @@ Example: ## Split Keyboards -Both basic and bootloader reset behaviors are source-specific: This means that it affects the side of the keyboard that contains the behavior binding for split keyboards. For example if you press a key with the `&sys_reset` binding on the left half of the keyboard, the left half will be reset. If you want to be able to reset both sides you can put the bindings on both sides of the keyboard and activate it on the side you would like to reset. - -:::note[Peripheral invocation] -The peripheral side of the keyboard has to be paired and connected to the central side in order to be able to activate these behaviors, even if it is possible to trigger the behavior using only keys on that side. This is because the key bindings are processed on the central side which would then instruct the peripheral side to reset. -::: +Both basic and bootloader reset behaviors are [source-specific](../features/split-keyboards.md#source-locality-behaviors): This means that it affects the side of the keyboard that contains the behavior binding for split keyboards. For example if you press a key with the `&sys_reset` binding on the left half of the keyboard, the left half will be reset. If you want to be able to reset both sides you can put the bindings on both sides of the keyboard and activate it on the side you would like to reset. diff --git a/docs/docs/behaviors/soft-off.md b/docs/docs/behaviors/soft-off.md index 14b5f36a..086b5d75 100644 --- a/docs/docs/behaviors/soft-off.md +++ b/docs/docs/behaviors/soft-off.md @@ -23,7 +23,7 @@ Example: ### Configuration -#### Hold Time +#### Hold time By default, the keyboard will be turned off as soon as the key bound to the behavior is released, even if the key is only tapped briefly. If you would prefer that the key need be held a certain amount of time before releasing, you can set the `hold-time-ms` to a non-zero value in your keymap: diff --git a/docs/docs/behaviors/sticky-key.md b/docs/docs/behaviors/sticky-key.md index 8c3962f5..30345882 100644 --- a/docs/docs/behaviors/sticky-key.md +++ b/docs/docs/behaviors/sticky-key.md @@ -81,7 +81,7 @@ This configuration would apply to all sticky keys. This may not be appropriate i }; ``` -### Advanced usage +### Advanced Usage Sticky keys can be combined; if you tap `&sk LCTRL` and then `&sk LSHIFT` and then `&kp A`, the output will be ctrl+shift+a. diff --git a/docs/docs/behaviors/sticky-layer.md b/docs/docs/behaviors/sticky-layer.md index 41c2ccf5..6a231f08 100644 --- a/docs/docs/behaviors/sticky-layer.md +++ b/docs/docs/behaviors/sticky-layer.md @@ -36,7 +36,7 @@ You can configure a different `release-after-ms` in your keymap: }; ``` -### Advanced usage +### Advanced Usage Sticky layers behave slightly different from sticky keys. They are configured to `quick-release`. This means that the layer is released immediately when another key is pressed. "Normal" sticky keys are not `quick-release`; they are released when the next key is released. This makes it possible to combine sticky layers and sticky keys as such: tap `&sl 1`, tap `&sk LSHIFT` on layer 1, tap `&kp A` on base layer to output shift+A. diff --git a/docs/docs/behaviors/underglow.md b/docs/docs/behaviors/underglow.md index 490789a7..bd549395 100644 --- a/docs/docs/behaviors/underglow.md +++ b/docs/docs/behaviors/underglow.md @@ -77,4 +77,4 @@ However the settings will only be saved after [`CONFIG_ZMK_SETTINGS_SAVE_DEBOUNC ## Split Keyboards -RGB underglow behaviors are global: This means that when triggered, they affect both the central and peripheral side of split keyboards. +RGB underglow behaviors are [global](../features/split-keyboards.md#global-locality-behaviors): This means that when triggered, they affect both the central and peripheral side of split keyboards. diff --git a/docs/docs/codes/_keyboard-consumer.md b/docs/docs/codes/_keyboard-consumer.md new file mode 100644 index 00000000..2f50ea4b --- /dev/null +++ b/docs/docs/codes/_keyboard-consumer.md @@ -0,0 +1,8 @@ +:::info[Keyboard vs. Consumer keycodes] +In the below tables, there are keycode pairs with similar names where one variant has a `K_` prefix and another `C_`. +These variants correspond to similarly named usages from different [HID usage pages](https://usb.org/sites/default/files/hut1_2.pdf#page=16), +namely the "keyboard/keypad" and "consumer" ones respectively. + +In practice, some OS and applications might listen to only one of the variants. +You can use the values in the compatibility columns below to assist you in selecting which one to use. +::: diff --git a/docs/docs/codes/applications.mdx b/docs/docs/codes/applications.mdx index 68e24d36..2dd53dca 100644 --- a/docs/docs/codes/applications.mdx +++ b/docs/docs/codes/applications.mdx @@ -7,9 +7,11 @@ hide_title: true import OsLegend from "@site/src/components/codes/OsLegend"; import ToastyContainer from "@site/src/components/codes/ToastyContainer"; import Content, { toc as contentToc } from "./_applications.mdx"; +import KeyboardConsumer from "./_keyboard-consumer.md"; export const toc = contentToc; + diff --git a/docs/docs/codes/editing.mdx b/docs/docs/codes/editing.mdx index 3475d6c2..8dc0488e 100644 --- a/docs/docs/codes/editing.mdx +++ b/docs/docs/codes/editing.mdx @@ -7,9 +7,11 @@ hide_title: true import OsLegend from "@site/src/components/codes/OsLegend"; import ToastyContainer from "@site/src/components/codes/ToastyContainer"; import Content, { toc as contentToc } from "./_editing.mdx"; +import KeyboardConsumer from "./_keyboard-consumer.md"; export const toc = contentToc; + diff --git a/docs/docs/codes/index.mdx b/docs/docs/codes/index.mdx index a701b4ce..c8d84122 100644 --- a/docs/docs/codes/index.mdx +++ b/docs/docs/codes/index.mdx @@ -5,7 +5,6 @@ hide_title: true slug: ./ --- -import SpellingCaution from "@site/src/components/codes/SpellingCaution"; import OsLegend from "@site/src/components/codes/OsLegend"; import ToastyContainer from "@site/src/components/codes/ToastyContainer"; import Key, { toc as keyToc } from "./_keyboard-keypad.mdx"; @@ -14,6 +13,7 @@ import Media, { toc as mediaToc } from "./_media.mdx"; import Applications, { toc as applicationsToc } from "./_applications.mdx"; import InputAssist, { toc as inputAssistToc } from "./_input-assist.mdx"; import Power, { toc as powerToc } from "./_power.mdx"; +import KeyboardConsumer from "./_keyboard-consumer.md"; export const toc = [ ...keyToc, @@ -24,7 +24,12 @@ export const toc = [ ...powerToc, ]; - +:::warning +Take extra notice of the spelling of the keycodes, especially the shorthand spelling. +Otherwise, it will result in an elusive parsing error! +::: + + diff --git a/docs/docs/codes/media.mdx b/docs/docs/codes/media.mdx index c7884479..bbbae6e5 100644 --- a/docs/docs/codes/media.mdx +++ b/docs/docs/codes/media.mdx @@ -7,9 +7,11 @@ hide_title: true import OsLegend from "@site/src/components/codes/OsLegend"; import ToastyContainer from "@site/src/components/codes/ToastyContainer"; import Content, { toc as contentToc } from "./_media.mdx"; +import KeyboardConsumer from "./_keyboard-consumer.md"; export const toc = contentToc; + diff --git a/docs/docs/codes/power.mdx b/docs/docs/codes/power.mdx index 2af3233f..925cd3f8 100644 --- a/docs/docs/codes/power.mdx +++ b/docs/docs/codes/power.mdx @@ -7,9 +7,11 @@ hide_title: true import OsLegend from "@site/src/components/codes/OsLegend"; import ToastyContainer from "@site/src/components/codes/ToastyContainer"; import Content, { toc as contentToc } from "./_power.mdx"; +import KeyboardConsumer from "./_keyboard-consumer.md"; export const toc = contentToc; + diff --git a/docs/docs/config/battery.md b/docs/docs/config/battery.md index 463dc087..4596395b 100644 --- a/docs/docs/config/battery.md +++ b/docs/docs/config/battery.md @@ -18,7 +18,7 @@ Definition file: [zmk/app/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/ :::note[Default setting] -While `CONFIG_ZMK_BATTERY_REPORTING` is disabled by default it is implied by `CONFIG_ZMK_BLE`, thus any board with BLE enabled will have this automatically enabled unless explicitly overriden. +While `CONFIG_ZMK_BATTERY_REPORTING` is disabled by default it is implied by `CONFIG_ZMK_BLE`, thus any board with BLE enabled will have this automatically enabled unless explicitly overridden. ::: @@ -28,7 +28,7 @@ On macOS the BLE battery reporting packets can cause the computer to wakeup from ::: -### Peripheral battery monitoring +### Peripheral Battery Monitoring You can [configure ZMK to allow support for peripheral battery monitoring over BLE](system.md#split-keyboards) (e.g. when having a split keyboard with two independent and wirelessly connected sides). If you want to report the battery levels of both sides of a split keyboard, you should have both `CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_PROXY` and `CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING` set to `y`. diff --git a/docs/docs/config/behaviors.md b/docs/docs/config/behaviors.md index 28abdf27..a422e599 100644 --- a/docs/docs/config/behaviors.md +++ b/docs/docs/config/behaviors.md @@ -51,6 +51,13 @@ Creates a custom behavior that triggers one behavior when a key is held or a dif See the [hold-tap behavior](../behaviors/hold-tap.mdx) documentation for more details and examples. +### Kconfig + +| Config | Type | Description | Default | +| -------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------- | ------- | +| `CONFIG_ZMK_BEHAVIOR_HOLD_TAP_MAX_HELD` | int | Maximum number of simultaneous held hold-taps | 10 | +| `CONFIG_ZMK_BEHAVIOR_HOLD_TAP_MAX_CAPTURED_EVENTS` | int | Maximum number of system events to capture while deferring a hold or tap decision resolution | 40 | + ### Devicetree Definition file: [zmk/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml](https://github.com/zmkfirmware/zmk/blob/main/app/dts/bindings/behaviors/zmk%2Cbehavior-hold-tap.yaml) @@ -227,6 +234,12 @@ Creates a custom behavior that triggers a behavior and keeps it pressed it until See the [sticky key behavior](../behaviors/sticky-key.md) and [sticky layer behavior](../behaviors/sticky-layer.md) documentation for more details and examples. +### Kconfig + +| Config | Type | Description | Default | +| ----------------------------------------- | ---- | ----------------------------------------------- | ------- | +| `CONFIG_ZMK_BEHAVIOR_STICKY_KEY_MAX_HELD` | int | Maximum number of simultaneous held sticky keys | 10 | + ### Devicetree Definition file: [zmk/app/dts/bindings/behaviors/zmk,behavior-sticky-key.yaml](https://github.com/zmkfirmware/zmk/blob/main/app/dts/bindings/behaviors/zmk%2Cbehavior-sticky-key.yaml) diff --git a/docs/docs/config/bluetooth.md b/docs/docs/config/bluetooth.md index 9149b36b..83fb9ec0 100644 --- a/docs/docs/config/bluetooth.md +++ b/docs/docs/config/bluetooth.md @@ -9,10 +9,10 @@ See [Configuration Overview](index.md) for instructions on how to change these s ## Kconfig -| Option | Type | Description | Default | -| -------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| `CONFIG_ZMK_BLE_EXPERIMENTAL_CONN` | bool | Enables a combination of settings that are planned to be default in future versions of ZMK to improve connection stability. This includes changes to timing on BLE pairing initation, restores use of the updated/new LLCP implementation, and disables 2M PHY support. | n | -| `CONFIG_ZMK_BLE_EXPERIMENTAL_SEC` | bool | Enables a combination of settings that are planned to be officially supported in the future. This includes enabling BT Secure Connection passkey entry, and allows overwrite of keys from previously paired hosts. | n | -| `CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES` | bool | Aggregate config that enables both `CONFIG_ZMK_BLE_EXPERIMENTAL_CONN` and `CONFIG_ZMK_BLE_EXPERIMENTAL_SEC`. | n | -| `CONFIG_ZMK_BLE_PASSKEY_ENTRY` | bool | Enable passkey entry during pairing for enhanced security. (Note: After enabling this, you will need to re-pair all previously paired hosts.) | n | -| `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION` | bool | Low level setting for GATT subscriptions. Set to `n` to work around an annoying Windows bug with battery notifications. | y | +| Option | Type | Description | Default | +| -------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- | +| `CONFIG_ZMK_BLE_EXPERIMENTAL_CONN` | bool | Enables a combination of settings that are planned to be default in future versions of ZMK to improve connection stability. Currently this only disables 2M PHY support. | n | +| `CONFIG_ZMK_BLE_EXPERIMENTAL_SEC` | bool | Enables a combination of settings that are planned to be officially supported in the future. This includes enabling BT Secure Connection passkey entry, and allows overwrite of keys from previously paired hosts. | n | +| `CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES` | bool | Aggregate config that enables both `CONFIG_ZMK_BLE_EXPERIMENTAL_CONN` and `CONFIG_ZMK_BLE_EXPERIMENTAL_SEC`. | n | +| `CONFIG_ZMK_BLE_PASSKEY_ENTRY` | bool | Enable passkey entry during pairing for enhanced security. (Note: After enabling this, you will need to re-pair all previously paired hosts.) | n | +| `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION` | bool | Low level setting for GATT subscriptions. Set to `n` to work around an annoying Windows bug with battery notifications. | y | diff --git a/docs/docs/config/encoders.md b/docs/docs/config/encoders.md index b242f49b..c8966846 100644 --- a/docs/docs/config/encoders.md +++ b/docs/docs/config/encoders.md @@ -29,7 +29,7 @@ If `CONFIG_EC11` is enabled, exactly one of the following options must be set to ### Devicetree -#### Keymap Sensor Config +#### Keymap sensor config For shields/boards that export a `sensors` node configuration label, both global and per-sensor settings can be set by overriding the properties there. @@ -69,7 +69,7 @@ Definition file: [zmk/app/drivers/zephyr/dts/bindings/zmk,keymap-sensors.yaml](h | ----------------------- | ---- | --------------------------------------------------------------- | ------- | | `triggers-per-rotation` | int | Number of times to trigger the bound behavior per full rotation | | -#### EC11 Nodes +#### EC11 nodes Applies to: `compatible = "alps,ec11"` diff --git a/docs/docs/config/index.md b/docs/docs/config/index.md index d542d435..409b1f04 100644 --- a/docs/docs/config/index.md +++ b/docs/docs/config/index.md @@ -24,22 +24,22 @@ When building with a `zmk-config` folder, ZMK will search the `zmk-config/config These files hold your personal settings for the keyboard. All files are optional. If present, they override any configuration set in the board or shield folders. Otherwise, the default configuration and/or keymap is used. -When using a split keyboard, you can use a single file without the `_left` or `_right` suffix to configure both sides. For example, `corne.conf` and `corne.keymap` will apply to both `corne_left` and `corne_right`. If a shared config file exists, any left or right files will be ignored. +When using a [split keyboard](../features/split-keyboards.md), you can use a single file without the `_left` or `_right` suffix to configure both sides. For example, `corne.conf` and `corne.keymap` will apply to both `corne_left` and `corne_right`. If a shared config file exists, any left or right files will be ignored. ### Board Folder -ZMK will search for config files in either of: +ZMK will search for config files in: - [`zmk/app/boards/arm/`](https://github.com/zmkfirmware/zmk/tree/main/app/boards/arm) -- `zmk-config/config/boards/arm/` +- `zmk-config/boards/arm/` +- `/boards/arm/` +- `zmk-config/config/boards/arm/` (For backwards compatibility only, do not use.) -...where `` is the name of the board. These files describe the hardware of the board. +...where `` is the name of the board and `` is the root directory of any [included module](../features/modules.mdx). These files describe the hardware of the board. -ZMK will search the board folder for the following config files: +ZMK will search the board folder for the following config files _in addition_ to [Zephyr board-defining files](https://docs.zephyrproject.org/3.5.0/hardware/porting/board_porting.html#create-your-board-directory): -- `_defconfig` (Kconfig) - `.conf` (Kconfig) -- `.dts` (Devicetree) - `.keymap` (Devicetree, keyboards with onboard controllers only) Shared config files (excluding any `_left` or `_right` suffix) are not currently supported in board folders. @@ -48,17 +48,18 @@ For more documentation on creating and configuring a new board, see [Zephyr's bo ### Shield Folder -When building with a shield, ZMK will search for config files in either of: +When building with a shield, ZMK will search for config files in: - [`zmk/app/boards/shields/`](https://github.com/zmkfirmware/zmk/tree/main/app/boards/shields) -- `zmk-config/config/boards/shields/` +- `zmk-config/boards/shields/` +- `/boards/shields/` +- `zmk-config/config/boards/shields/` (For backwards compatibility only, do not use.) -...where `` is the name of the shield. These files describe the hardware of the shield that the board is plugged into. +...where `` is the name of the shield and `` is the root directory of any [included module](../features/modules.mdx). These files describe the hardware of the shield that the board is plugged into. -ZMK will search the shield folder for the following config files: +ZMK will search the shield folder for the following config files _in addition_ to [Zephyr shield-defining files](https://docs.zephyrproject.org/3.5.0/hardware/porting/shields.html#shield-porting-and-configuration): - `.conf` (Kconfig) -- `.overlay` (Devicetree) - `.keymap` (Devicetree) Shared config files (excluding any `_left` or `_right` suffix) are not currently supported in shield folders. diff --git a/docs/docs/config/kscan.md b/docs/docs/config/kscan.md index e6e8bb62..af4a63fe 100644 --- a/docs/docs/config/kscan.md +++ b/docs/docs/config/kscan.md @@ -81,10 +81,6 @@ Definition file: [zmk/app/module/dts/bindings/kscan/zmk,kscan-gpio-direct.yaml]( | `toggle-mode` | bool | Use toggle switch mode. | n | | `wakeup-source` | bool | Mark this kscan instance as able to wake the keyboard from deep sleep | n | -By default, a switch will drain current through the internal pull up/down resistor whenever it is pressed. This is not ideal for a toggle switch, where the switch may be left in the "pressed" state for a long time. Enabling `toggle-mode` will make the driver flip between pull up and down as the switch is toggled to optimize for power. - -`toggle-mode` applies to all switches handled by the instance of the driver. To use a toggle switch with other, non-toggle, direct GPIO switches, create two instances of the direct GPIO driver, one with `toggle-mode` and the other without. Then, use a [composite driver](#composite-driver) to combine them. - Assuming the switches connect each GPIO pin to the ground, the [GPIO flags](https://docs.zephyrproject.org/3.5.0/hardware/peripherals/gpio.html#api-reference) for the elements in `input-gpios` should be `(GPIO_ACTIVE_LOW | GPIO_PULL_UP)`: ```dts @@ -98,6 +94,27 @@ Assuming the switches connect each GPIO pin to the ground, the [GPIO flags](http }; ``` +A direct pin defined in the `input-gpios` property is considered a column when used in a [matrix transform](#matrix-transform); e.g. the 5th pin on the list can be referred to using `RC(0,4)`. + +By default, a switch will drain current through the internal pull up/down resistor whenever it is pressed. This is not ideal for a toggle switch, where the switch may be left in the "pressed" state for a long time. Enabling `toggle-mode` will make the driver enable and disable the internal pull up/down resistor as needed when the switch is toggled to minimise power draw. For `toggle-mode` to work correctly each pole of the switch needs a dedicated GPIO pin. + +`toggle-mode` applies to all switches handled by the instance of the driver. To use a toggle switch with other, non-toggle, direct GPIO switches, create two instances of the direct GPIO driver, one with `toggle-mode` and the other without. Then, use a [composite driver](#composite-driver) to combine them. The state of the switch is read on power on, so if the switch is moved whilst the board is off this will get correctly interpreted by the driver. + +When using `toggle-mode` the pull resistors get automatically set by the driver and should not be set in the devicetree via GPIO flags. Assuming the common pole of the switch is connected to ground with an SP3T switch: + +```dts + kscan_sp3t_toggle: kscan_sp3t_toggle { + compatible = "zmk,kscan-gpio-direct"; + toggle-mode; + + input-gpios + = <&pro_micro 4 GPIO_ACTIVE_LOW> + , <&pro_micro 3 GPIO_ACTIVE_LOW> + , <&pro_micro 2 GPIO_ACTIVE_LOW> + ; + }; +``` + ## Matrix Driver Keyboard scan driver where keys are arranged on a matrix with one GPIO per row and column. @@ -327,7 +344,7 @@ Transforms should be used any time the physical layout of a keyboard's keys does Transforms can also be used for keyboards with multiple layouts. You can define multiple matrix transform nodes, one for each layout, and users can select which one they want from the `/chosen` node in their keymaps. -See the [new shield guide](../development/new-shield.mdx#optional-matrix-transform) for more documentation on how to define a matrix transform. +See the [new shield guide](../development/new-shield.mdx#matrix-transform) for more documentation on how to define a matrix transform. ### Devicetree diff --git a/docs/docs/config/system.md b/docs/docs/config/system.md index 675830e4..1a5306bd 100644 --- a/docs/docs/config/system.md +++ b/docs/docs/config/system.md @@ -29,10 +29,11 @@ Making changes to any of the settings in this section modifies the HID report de ::: -| Config | Type | Description | Default | -| ------------------------------------- | ---- | -------------------------------------------------------------- | ------- | -| `CONFIG_ZMK_HID_INDICATORS` | bool | Enable reciept of HID/LED indicator state from connected hosts | n | -| `CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE` | int | Number of consumer keys simultaneously reportable | 6 | +| Config | Type | Description | Default | +| -------------------------------------------- | ---- | ---------------------------------------------------------------- | ------- | +| `CONFIG_ZMK_HID_INDICATORS` | bool | Enable receipt of HID/LED indicator state from connected hosts | n | +| `CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE` | int | Number of consumer keys simultaneously reportable | 6 | +| `CONFIG_ZMK_HID_SEPARATE_MOD_RELEASE_REPORT` | bool | Send modifier release event **after** non-modifier release event | n | Exactly zero or one of the following options may be set to `y`. The first is used if none are set. @@ -116,7 +117,7 @@ Note that `CONFIG_BT_MAX_CONN` and `CONFIG_BT_MAX_PAIRED` should be set to the s ### Split keyboards -Following split keyboard settings are defined in [zmk/app/src/split/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/app/src/split/Kconfig) (generic) and [zmk/app/src/split/bluetooth/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/app/src/split/bluetooth/Kconfig) (bluetooth). +Following [split keyboard](../features/split-keyboards.md) settings are defined in [zmk/app/src/split/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/app/src/split/Kconfig) (generic) and [zmk/app/src/split/bluetooth/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/app/src/split/bluetooth/Kconfig) (bluetooth). | Config | Type | Description | Default | | ------------------------------------------------------- | ---- | -------------------------------------------------------------------------- | ------------------------------------------ | @@ -124,6 +125,7 @@ Following split keyboard settings are defined in [zmk/app/src/split/Kconfig](htt | `CONFIG_ZMK_SPLIT_ROLE_CENTRAL` | bool | `y` for central device, `n` for peripheral | | | `CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS` | bool | Enable split keyboard support for passing indicator state to peripherals | n | | `CONFIG_ZMK_SPLIT_BLE` | bool | Use BLE to communicate between split keyboard halves | y | +| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS` | int | Number of peripherals that will connect to the central | 1 | | `CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING` | bool | Enable fetching split peripheral battery levels to the central side | n | | `CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_PROXY` | bool | Enable central reporting of split battery levels to hosts | n | | `CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_QUEUE_SIZE` | int | Max number of battery level events to queue when received from peripherals | `CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS` | diff --git a/docs/docs/customization.md b/docs/docs/customization.md index 46427b9e..5b02003d 100644 --- a/docs/docs/customization.md +++ b/docs/docs/customization.md @@ -40,7 +40,7 @@ If you need to, a review of [Learn The Basics Of Git In Under 10 Minutes](https: ::: :::note -It is also possible to build firmware locally on your computer by following the [toolchain setup](development/setup.mdx) and +It is also possible to build firmware locally on your computer by following the [toolchain setup](development/setup/index.md) and [building instructions](development/build-flash.mdx), which includes pointers to [building using your `zmk-config` folder](development/build-flash.mdx#building-from-zmk-config-folder). ::: @@ -49,8 +49,8 @@ It is also possible to build firmware locally on your computer by following the For normal keyboards, follow the same flashing instructions as before to flash your updated firmware. -For split keyboards, only the central (left) side will need to be reflashed if you are just updating your keymap. -More troubleshooting information for split keyboards can be found [here](troubleshooting.md#split-keyboard-halves-unable-to-pair). +For [split keyboards](features/split-keyboards.md#building-and-flashing-firmware), only the central (left) side will need to be reflashed if you are just updating your keymap. +More troubleshooting information for split keyboards can be found [here](troubleshooting/connection-issues.mdx#split-keyboard-halves-unable-to-pair). ## Building Additional Keyboards diff --git a/docs/docs/development/build-flash.mdx b/docs/docs/development/build-flash.mdx index 2cbcf5b8..cfcb39ee 100644 --- a/docs/docs/development/build-flash.mdx +++ b/docs/docs/development/build-flash.mdx @@ -77,7 +77,7 @@ This produces `left` and `right` subfolders under the `build` directory and two Build times can be significantly reduced after the initial build by omitting all build arguments except the build directory, e.g. `west build -d build/left`. The additional options and intermediate build outputs from your initial build are cached and reused for unchanged files. ::: -### Building with external modules +### Building With External Modules ZMK supports loading additional boards, shields, code, etc. from [external Zephyr modules](https://docs.zephyrproject.org/3.5.0/develop/modules.html), facilitating out-of-tree management and versioning independent of the ZMK repository. To build with any additional modules, use the `ZMK_EXTRA_MODULES` define added to your `west build` command. @@ -108,6 +108,10 @@ west build -b nice_nano -- -DSHIELD=kyria_left -DZMK_CONFIG="C:/Users/myUser/Doc The above command must still be invoked from the `zmk/app` directory as noted above, rather than the config directory. Otherwise, you will encounter errors such as `ERROR: source directory "." does not contain a CMakeLists.txt; is this really what you want to build?`. Alternatively you can add the `-s /path/to/zmk/app` flag to your `west` command. ::: +:::warning +If your config is also a [module](../features/modules.mdx), then you should also add the root (the folder in which the `zephyr` folder is found) of your `zmk-config` as an [external module to build with](#building-with-external-modules). +::: + In order to make your `zmk-config` folder available when building within the VSCode Remote Container, you need to create a docker volume named `zmk-config` by binding it to the full path of your config directory. If you have run the VSCode Remote Container before, it is likely that docker has created this volume automatically -- we need to delete the default volume before binding it to the correct path. Follow the following steps: diff --git a/docs/docs/development/documentation.md b/docs/docs/development/documentation.md index 56c4d276..169642ba 100644 --- a/docs/docs/development/documentation.md +++ b/docs/docs/development/documentation.md @@ -5,7 +5,7 @@ sidebar_label: Documentation This document outlines how to test your documentation changes locally and prepare the changes for a pull request. -The documentation is written with [Docusaurus](https://docusaurus.io/). The ZMK source code has all of the necessary Docusaurus dependencies included but referencing their documentation can be helpful at times. +The documentation is written with [Docusaurus](https://docusaurus.io/). The ZMK source code has all of the necessary Docusaurus dependencies included, but referencing their documentation can be helpful at times. The general process for updating the ZMK documentation is: @@ -52,6 +52,12 @@ The check commands can be run with the following procedure in a terminal that's If any of the above steps throw an error, they need to be addressed and all of the checks re-run prior to submitting a pull request. ::: +:::note +The documentation uses American English spelling and grammar conventions. Title case is used for the first three heading levels, with sentence case used beyond that. + +Please make sure your changes conform to these conventions - prettier and lint are unfortunately unable to do this automatically. +::: + ## Submitting a Pull Request Once the above sections are complete the documentation updates are ready to submit as a pull request. diff --git a/docs/docs/development/ide-integration.mdx b/docs/docs/development/ide-integration.mdx index 87a5a4ca..cee12f4b 100644 --- a/docs/docs/development/ide-integration.mdx +++ b/docs/docs/development/ide-integration.mdx @@ -51,7 +51,7 @@ Change these options: If you are developing inside a Docker container, set the IntelliSense mode to `linux-gcc-arm` regardless of the host operating system. -#### Compiler Path +#### Compiler path Open VS Code's integrated terminal and run the following command: @@ -79,7 +79,7 @@ If you are building for an platform other than ARM, replace `/arm-zephyr-eabi/bi /home/marvin/.local/zephyr-sdk-0.15.2/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc ``` -#### Compiler Commands Path +#### Compiler commands path When building with all default options, the path to the compilation database file is `${workspaceFolder}/app/build/compile_commands.json` as shown in the table above, diff --git a/docs/docs/development/new-behavior.mdx b/docs/docs/development/new-behavior.mdx index 914abf52..113ddf0a 100644 --- a/docs/docs/development/new-behavior.mdx +++ b/docs/docs/development/new-behavior.mdx @@ -35,7 +35,7 @@ The following resources are provided for those seeking further understanding: ## Creating the Behavior -### Creating the devicetree binding (`.yaml`) +### Creating the Devicetree Binding (`.yaml`) The properties of the behavior are listed in the behavior's devicetree binding, which comes in the form of a `.yaml` file. Devicetree bindings are stored in the directory `app/dts/bindings/behaviors/` and are labelled in lowercase, beginning with the prefix `zmk,behavior-`, and ending with the behavior's name, using dashes to separate multiple words. For example, the directory for the hold-tap's devicetree binding would be located at `app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml`, which is shown below as a reference: @@ -119,7 +119,7 @@ These are additional variables required to configure a particular instance of a For more information on additional `properties`, refer to [Zephyr's documentation on Devicetree bindings](https://docs.zephyrproject.org/3.5.0/build/dts/bindings-syntax.html#properties). ::: -### Creating the driver (`.c`) +### Creating the Driver (`.c`) :::info Developing drivers for behaviors in ZMK makes extensive use of the Zephyr Devicetree API and Device Driver Model. Links to the Zephyr Project Documentation for both of these concepts can be found below: @@ -203,7 +203,7 @@ The dependencies required for any ZMK behavior are: Other common dependencies include `zmk/keymap.h`, which allows behaviors to access layer information and extract behavior bindings from keymaps, and `zmk/event_manager.h` which is detailed below. -##### ZMK Event Manager +##### ZMK event manager Including `zmk/event_manager.h` is required for the following dependencies to function properly. @@ -213,7 +213,7 @@ Including `zmk/event_manager.h` is required for the following dependencies to fu Events can be used similarly to hardware interrupts, through the use of [listeners](#listeners-and-subscriptions). -###### Listeners and Subscriptions +###### Listeners and subscriptions The condensed form of lines 192-225 of the tap-dance driver, shown below, does an excellent job of showcasing the function of listeners and subscriptions with respect to the [ZMK Event Manager](#zmk-event-manager). @@ -279,11 +279,11 @@ Note that in the hold-tap example, the instance number, `0`, has been replaced b Behaviors also require the following parameters of `BEHAVIOR_DT_INST_DEFINE` to be changed: -##### Initialization Function +##### Initialization function Comes in the form `static int _init(const struct device *dev)`. Initialization functions preconfigure any data, like resetting timers and position for hold-taps and tap-dances. All initialization functions `return 0;` once complete. -##### API Structure +##### API structure Comes in the form `static const struct behavior_driver_api _driver_api)`. Common items to include in the API Structure are: @@ -297,7 +297,7 @@ Comes in the form `static const struct behavior_driver_api _drive For unibody keyboards, all locality values perform the same as `BEHAVIOR_LOCALITY_GLOBAL`. ::: -##### Data Pointers (Optional) +##### Data pointers (optional) The data `struct` stores additional data required for **each new instance** of the behavior. Regardless of the instance number, `n`, `behavior__data_##n` is typically initialized as an empty `struct`. The data respective to each instance of the behavior can be accessed in functions like [`on__binding_pressed(struct zmk_behavior_binding *binding, struct zmk_behavior_binding_event event)`](#dependencies) by extracting the behavior device from the keybind like so: @@ -310,7 +310,7 @@ The variables stored inside the data `struct`, `data`, can be then modified as n The fourth cell of `BEHAVIOR_DT_INST_DEFINE` can be set to `NULL` instead if instance-specific data is not required. -##### Configuration Pointers (Optional) +##### Configuration pointers (optional) The configuration `struct` stores the properties declared from the behavior's `.yaml` for **each new instance** of the behavior. As seen in the `#define KP_INST(n)` of the hold-tap example, the configuration `struct`, `behavior__config_##n`, for each instance number, `n`, can be initialized using the [Zephyr Devicetree Instance-based APIs](https://docs.zephyrproject.org/3.5.0/build/dts/api/api.html#instance-based-apis), which extract the values from the `properties` of each instance of the [devicetree binding](#creating-the-devicetree-binding-yaml) from a user's keymap or [predefined use-case `.dtsi` files](#defining-common-use-cases-for-the-behavior-dtsi-optional) stored in `app/dts/behaviors/`. We illustrate this further by comparing the [`#define KP_INST(n)` from the hold-tap driver](#behavior_dt_inst_define) and the [`properties` of the hold-tap devicetree binding.](#creating-the-devicetree-binding-yaml) @@ -320,7 +320,7 @@ The fifth cell of `BEHAVIOR_DT_INST_DEFINE` can be set to `NULL` instead if inst Remember that `.c` files should be formatted according to `clang-format` to ensure that checks run smoothly once the pull request is submitted. ::: -### Updating `app/CmakeLists.txt` to include the new driver +### Updating `app/CmakeLists.txt` to Include the New Driver Most behavior drivers' are invoked according to the central half's [locality](#api-structure), and are therefore stored after the line `if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)` in the form, `target_sources(app PRIVATE src/behaviors/.c)`, as shown below. @@ -346,14 +346,14 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL) endif() ``` -For behaviors that do not require central locality, the following options for updating `app/CmakeLists.txt` also exist: +For behaviors that do not require [central locality](../features/split-keyboards.md#behaviors-with-locality), the following options for updating `app/CMakeLists.txt` also exist: - Behavior applies to unibody, or central or peripheral half of keyboard: place `target_sources(app PRIVATE .c)` line _before_ `if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)` - Behavior applies to _only_ central half of split keyboard: place `target_sources(app PRIVATE .c)` after `if (CONFIG_ZMK_SPLIT AND CONFIG_ZMK_SPLIT_ROLE_CENTRAL)` - Behavior applies to _only_ peripheral half of split keyboard: place `target_sources(app PRIVATE .c)` after `if (CONFIG_ZMK_SPLIT AND (NOT CONFIG_ZMK_SPLIT_ROLE_CENTRAL))` - Behavior requires certain condition in a keyboard's `.conf` file to be met: use `target_sources_ifdef(CONFIG_ app PRIVATE .c)` instead of `target_sources(.c)` -### Defining common use-cases for the behavior (`.dtsi`) (Optional) +### Defining Common Use-Cases for the Behavior (`.dtsi`) (Optional) `.dtsi` files, found in the directory `app/dts/behaviors/`, are only necessary for behaviors with more common use-cases. A common example is the mod-tap (`&mt`), which is a predefined type of hold-tap that takes a modifier key as the hold parameter and another key as the tap parameter. @@ -422,7 +422,7 @@ After creating the `.dtsi` from above, update `app/dts/behaviors.dtsi` to includ #include ``` -## Testing changes locally +## Testing Changes Locally Create a new folder in `app/tests/` to develop virtual test sets for all common use cases of the behavior. Behaviors should be tested thoroughly on both virtual testing environments using `west test` and real hardware. @@ -437,7 +437,7 @@ Zephyr currently does not support logging over Bluetooth, so any use of the seri ::: -## Documenting behavior functionality +## Documenting Behavior Functionality Consider the following prompts when writing documentation for new behaviors: @@ -453,7 +453,7 @@ Consider also including visual aids alongside written documentation if it adds c See [Documentation](documentation.md) for more information on writing, testing, and formatting ZMK documentation. ::: -## Submitting a pull request +## Submitting a Pull Request Once the above sections are complete, the behavior is almost ready to submit as a pull request. New [devicetree bindings](#creating-the-devicetree-binding-yaml), new [drivers](#creating-the-driver-c), and [predefined use-cases](#defining-common-use-cases-for-the-behavior-dtsi-optional) of the new behavior must contain the appropriate copyright headers, which can be copied and pasted from the tabs below. diff --git a/docs/docs/development/new-shield.mdx b/docs/docs/development/new-shield.mdx index 867ccbc8..5234e13e 100644 --- a/docs/docs/development/new-shield.mdx +++ b/docs/docs/development/new-shield.mdx @@ -19,7 +19,8 @@ The high level steps are: - Create a new shield directory. - Add the base Kconfig files. - Add the shield overlay file to define the KSCAN driver for detecting key press/release. -- (Optional) Add the matrix transform for mapping KSCAN row/column values to sane key positions. This is needed for non-rectangular keyboards, or where the underlying row/column pin arrangement does not map one to one with logical locations on the keyboard. +- Add the matrix transform for mapping KSCAN row/column values to key positions in the keymap. +- Add a physical layout definition to select the matrix transform and KSCAN instance. - Add a default keymap, which users can override in their own configs as needed. - Add a `.zmk.yml` metadata file to document the high level details of your shield, and the features it supports. - Update the `build.yaml` file from the repository template to have some sample builds of the firmware to test. @@ -28,7 +29,7 @@ The high level steps are: It may be helpful to review the upstream [shields documentation](https://docs.zephyrproject.org/3.5.0/hardware/porting/shields.html#shields) to get a proper understanding of the underlying system before continuing. :::note -ZMK support for split keyboards requires a few more files than single boards to ensure proper connectivity between the central and peripheral units. Check the following guides thoroughly to ensure that all the files are in place. +ZMK support for [split keyboards](../features/split-keyboards.md) requires a few more files than single boards to ensure proper connectivity between the central and peripheral units. Check the following guides thoroughly to ensure that all the files are in place. ::: ## New Zephyr Module Repository @@ -50,6 +51,13 @@ Follow these steps to create your new repository: - Select Public or Private, depending on your preference. - Click the green "Create repository" button +The repository is a combination of the directories and files required of a ZMK config, and those required of a shield module. To create a shield module, the following components are needed: + +- The `boards/shields` directory, where the keyboard's files will go +- The `zephyr/module.yml` file, which identifies and describes the module. See the [Zephyr documentation](https://docs.zephyrproject.org/3.5.0/develop/modules.html#module-yaml-file-description) for details on customising this file. For the purposes of creating a shield module, the default found in the template can be left untouched. + +Neither of these should be moved out of their parent directory. The other files and directories such as `config` are not necessary for the purposes of a shield module, but rather intended to be used for user configuration and testing. + ## New Shield Directory :::note @@ -67,6 +75,10 @@ mkdir boards/shields/ ## Base Kconfig Files +:::tip[Example shields] +You can check out the [`shields` folder](https://github.com/zmkfirmware/zmk/tree/main/app/boards/shields) in the ZMK repo that houses [the in-tree supported shields](../hardware.mdx) in order to copy and modify as a starting point. +::: + There are two required Kconfig files that need to be created for your new keyboard shield to get it picked up for ZMK, `Kconfig.shield` and `Kconfig.defconfig`. @@ -229,8 +241,9 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,2) RC(4,9) RC(3,6) RC(3,7) kscan0: kscan { compatible = "zmk,kscan-gpio-matrix"; - diode-direction = "col2row"; + wakeup-source; + row-gpios = <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row A from the schematic file , <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row B from the schematic file @@ -313,7 +326,7 @@ The shared configuration in `my_awesome_split_board.conf` is only applied when y -## (Optional) Matrix Transform +## Matrix Transform Internally ZMK translates all row/column events into "key position" events to maintain a consistent model that works no matter what any possible GPIO matrix may look like for a certain keyboard. This is particularly helpful when: @@ -323,15 +336,7 @@ Internally ZMK translates all row/column events into "key position" events to ma A "key position" is the numeric index (zero-based) of a given key, which identifies the logical key location as perceived by the end user. All _keymap_ mappings actually bind behaviors to _key positions_, not to row/column values. -_Without_ a matrix transform, that intentionally map each key position to the row/column pair that position corresponds to, the default equation to determine that is: - -```c -($row * NUMBER_OF_COLUMNS) + $column -``` - -Which effectively amounts to numbering the key positions by traversing each row from top to bottom and assigning numerically incrementing key positions. - -Whenever that default key position mapping is insufficient, the `.overlay` file should _also_ include a matrix transform. +The `.overlay` must include a matrix transform that defines this mapping from row/column values to key positions. Here is an example for the [nice60](https://github.com/Nicell/nice60), which uses an efficient 8x8 GPIO matrix, and uses a transform: @@ -339,10 +344,7 @@ Here is an example for the [nice60](https://github.com/Nicell/nice60), which use #include / { - chosen { - zmk,kscan = &kscan0; - zmk,matrix-transform = &default_transform; - }; + /* define kscan node with label `kscan0`... */ default_transform: keymap_transform_0 { compatible = "zmk,matrix-transform"; @@ -361,16 +363,70 @@ RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(5,3) RC(6,4) RC(5,4) RC(6,5) RC(5,5) RC RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,5) RC(7,6) RC(6,7) RC(7,7) >; }; + + /* potentially other overlay nodes... */ +}; ``` Some important things to note: - The `#include ` is critical. The `RC` macro is used to generate the internal storage in the matrix transform, and is actually replaced by a C preprocessor before the final devicetree is compiled into ZMK. - `RC(row, column)` is placed sequentially to define what row and column values that position corresponds to. -- If you have a keyboard with options for `2u` keys in certain positions, or break away portions, it is a good idea to set the chosen `zmk,matrix-transform` to the default arrangement, and include _other_ possible matrix transform nodes in the devicetree that users can select in their user config by overriding the chosen node. +- If you have a keyboard with options for `2u` keys in certain positions, ANSI vs. ISO layouts, or break away portions, define one matrix transform for each possible arrangement to be used in the physical layouts. This will allow the users to select the right layout in their keymap files. See the [matrix transform section](../config/kscan.md#matrix-transform) in the Keyboard Scan configuration documentation for details and more examples of matrix transforms. +## Physical Layout + +The physical layout is the top level entity that aggregates all details about a certain possible layout for a keyboard: the matrix transform that defines the set of key positions and what row/column they correspond to, what kscan driver is used for that layout, etc. +For keyboards that support multiple layouts, setting a `chosen` node to a defined physical layout in your keymap will allow selecting the specific layout that you've built. + +A physical layout is very basic, e.g.: + +``` +/ { + default_layout: default_layout { + compatible = "zmk,physical-layout"; + display-name = "Default Layout"; + transform = <&default_transform>; + kscan = <&kscan0>; + }; +}; +``` + +When supporting multiple layouts, define the multiple layout nodes and then set a `chosen` for the default: + +``` +/ { + chosen { + zmk,physical-layout = &default_layout; + ... + }; + + default_layout: default_layout { + compatible = "zmk,physical-layout"; + display-name = "Default Layout"; + transform = <&default_transform>; + kscan = <&kscan0>; + }; + + alt_layout: alt_layout { + compatible = "zmk,physical-layout"; + display-name = "Alternate Layout"; + transform = <&alt_transform>; + kscan = <&alt_kscan0>; + }; +}; +``` + +This way, users can select a different layout by overriding the `zmk,physical-layout` chosen node in their keymap file. + +:::note +Some keyboards use different GPIO pins for different layouts, and need different kscan nodes created for each layout. +However, if all of your physical layouts use the same `kscan` node under the hood, you can skip setting the `kscan` property on each +layout and instead assign the `zmk,kscan` chosen node to your single kscan instance. +::: + ## Default Keymap Each keyboard should provide a default keymap to be used when building the firmware, which can be overridden and customized by user configs. For "shield keyboards", this should be placed in the `boards/shields//.keymap` file. The keymap is configured as an additional devicetree overlay that includes the following: @@ -544,7 +600,7 @@ Add additional bindings as necessary to match the default number of encoders on ### GitHub Actions -Using GitHub Actions to build your new firmware can save you from doing any local [development setup](./setup.mdx), +Using GitHub Actions to build your new firmware can save you from doing any local [development setup](./setup/index.md), at the expense of a longer feedback loop if there are issues. To push your changes and trigger a build: - Add all your pending changes with `git add .` @@ -556,7 +612,7 @@ Once pushed, click on the "Actions" tab of the repo you created in the first ste ### Local Build :::note -To build locally, be sure you've followed the [development setup](./setup.mdx) guide first. +To build locally, be sure you've followed the [development setup](./setup/index.md) guide first. ::: Once you've fully created the new keyboard shield definition, diff --git a/docs/docs/development/setup.mdx b/docs/docs/development/setup.mdx deleted file mode 100644 index bc275804..00000000 --- a/docs/docs/development/setup.mdx +++ /dev/null @@ -1,322 +0,0 @@ ---- -title: Toolchain Setup -sidebar_label: Toolchain Setup ---- - -import Tabs from "@theme/Tabs"; -import TabItem from "@theme/TabItem"; - -export const OsTabs = (props) => ( - - {/* eslint-disable-next-line */} - {props.children} - -); - -This guide will show you how to set up a development environment for building ZMK locally. - -## Install Dependencies - -Click the operating system you are using. (The VS Code & Docker option can be used on any OS.) - - - - -This option use the same [Docker image which is used by the GitHub action](https://github.com/zmkfirmware/zmk-docker) for local development. Beyond the benefits of [dev/prod parity](https://12factor.net/dev-prod-parity), this approach is also the easiest to set up. No toolchain or dependencies are necessary when using Docker; the container image you'll be using already has the toolchain installed and set up to use. - -1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop) for your operating system. -2. Install [Visual Studio Code](https://code.visualstudio.com/) -3. Install the [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) - -:::info -The docker container already includes `west`. Skip past the following section to [Get Source Code](#get-source-code). -::: - - - - -Open Zephyr's [Getting Started Guide](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html) and follow the instructions under these sections: - -- [Select and Update OS](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#select-and-update-os) -- [Install Dependencies](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#install-dependencies) -- [Install Zephyr SDK](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#install-zephyr-sdk) - -Return to this guide once you are finished with each section. - - - - -Open Zephyr's [Getting Started Guide](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html) and follow the instructions under these sections: - -- [Select and Update OS](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#select-and-update-os) -- [Install Dependencies](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#install-dependencies) -- [Install Zephyr SDK](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#install-zephyr-sdk) - -Return to this guide once you are finished with each section. - -`dfu-util` is required to flash devices that use DFU, but there is currently no maintained package for it on Chocolatey. [QMK Toolbox](https://github.com/qmk/qmk_toolbox) contains a working version of it though. - - - - -Open Zephyr's [Getting Started Guide](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html) and follow the instructions under these sections: - -- [Select and Update OS](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#select-and-update-os) -- [Install Dependencies](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#install-dependencies) -- [Install Zephyr SDK](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#install-zephyr-sdk) - -Return to this guide once you are finished with each section. - - - - -#### Install Base Dependencies - -Open Zephyr's [Getting Started Guide](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html) and follow the instructions for Ubuntu under these sections: - -- [Select and Update OS](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#select-and-update-os) -- [Install Dependencies](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#install-dependencies) - -Return to this guide once you are finished with each section. - -#### Install Cross-Compile Toolchain - -Because Raspberry OS runs on the same architecture (but different ABI) as ARM keyboard MCUs, the operating system's installed [cross compilers](https://docs.zephyrproject.org/3.5.0/develop/toolchains/other_x_compilers.html) can be used to target the different ABI. Building for non-ARM MCUs has not been tested. - -First, the cross compiler should be installed: - -```sh -sudo apt install gcc-arm-none-eabi -``` - -Next, we'll configure Zephyr with some [environment variables](https://docs.zephyrproject.org/3.5.0/develop/env_vars.html#env-vars) needed to find the cross compiler. Create a file named `~/.zephyrrc` if it doesn't exist, and add these lines to it: - -```sh -export ZEPHYR_TOOLCHAIN_VARIANT=cross-compile -export CROSS_COMPILE=/usr/bin/arm-none-eabi- -``` - - - - -Follow Zephyr's [Install Linux Host Dependencies](https://docs.zephyrproject.org/3.5.0/develop/getting_started/installation_linux.html) documentation for Fedora. - - - - -### Install West - -`west` is the [Zephyr® Project's meta-tool](https://docs.zephyrproject.org/3.5.0/develop/west/index.html) used to configure and build Zephyr OS applications. - -West can be installed by using the `pip` python package manager. The [Zephyr™ instructions](https://docs.zephyrproject.org/3.5.0/develop/west/install.html) are summarized here: - - - - -Install west: - -```sh -pip3 install --user -U west -``` - -Verify that west is installed: - -```sh -west --version -``` - -This should print a message like "West version: v0.14.0". If it prints an error instead, make sure `~/.local/bin` is on your `PATH` environment variable. You can add it with these commands: - -```sh -echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc -source ~/.bashrc -``` - - - - -Install west: - -```sh -pip3 install -U west -``` - -Verify that west is installed: - -```sh -west --version -``` - -This should print a message like "West version: v0.14.0". If it prints an error instead, make sure that the Python scripts directory is on your `PATH` environment variable. You can add it by opening a PowerShell window and running the following commands: - -```powershell -$Scripts = python -c "import sysconfig; print(sysconfig.get_path('scripts'))" -$Path = [Environment]::GetEnvironmentVariable('PATH', 'User') -[Environment]::SetEnvironmentVariable('PATH', "$Path;$Scripts", 'User') -$env:PATH += ";$Scripts" -``` - - - - -Install west: - -```sh -pip3 install -U west -``` - - - - -## Get Source Code - -Next, you'll need to clone the ZMK source repository if you haven't already. Navigate to the folder you would like to place your `zmk` directory in and run the following command: - -``` -git clone https://github.com/zmkfirmware/zmk.git -``` - -## Initialize & Update Zephyr Workspace - -Since ZMK is built as a Zephyr™ application, the next step is -to use `west` to initialize and update your workspace. The ZMK -Zephyr™ application is in the `app/` source directory: - -### Step into the repository - - - - -```sh -cd zmk -``` - - - - -```sh -cd zmk -``` - - - - -```sh -cd zmk -``` - - - - -```sh -cd zmk -``` - - - - -```sh -cd zmk -``` - - - - - -Open the `zmk` checkout folder in VS Code. The repository includes a configuration for containerized development, so an alert will pop up: - -![VS Code Dev Container Configuration Alert](../assets/dev-setup/vscode_devcontainer.png) - -Click `Reopen in Container` in order to reopen the VS Code with the running container. - -The first time you do this on your machine, it will pull the docker image down from the registry and build the container. Subsequent launches are much faster! - -:::warning -All subsequent steps must be performed from the VS Code terminal _inside_ the container. -::: - - - - -### Initialize the Application - -```sh -west init -l app/ -``` - -### Update to Fetch Modules - -```sh -west update -``` - -:::tip -This step pulls down quite a bit of tooling. Go grab a cup of coffee, it can take 10-15 minutes even on a good internet connection! -::: - -:::info -If you're using Docker, you're done with setup! You must restart the container at this point. The easiest way to do so is to close the VS Code window, verify that the container has stopped in Docker Dashboard, and reopen the container with VS Code. - -Once your container is restarted, proceed to [Building and Flashing](development/build-flash.mdx). -::: - -### Export Zephyr CMake package - -This allows CMake to load the code needed to build ZMK. - -```sh -west zephyr-export -``` - -### Install Zephyr Python Dependencies - -Some additional Python dependencies are listed in Zephyr's `scripts/requirements.txt` file. - - - - -```sh -pip3 install --user -r zephyr/scripts/requirements.txt -``` - - - - -```sh -pip3 install -r zephyr/scripts/requirements.txt -``` - - - - -```sh -pip3 install -r zephyr/scripts/requirements.txt -``` - - - diff --git a/docs/docs/development/setup/docker.md b/docs/docs/development/setup/docker.md new file mode 100644 index 00000000..767331e4 --- /dev/null +++ b/docs/docs/development/setup/docker.md @@ -0,0 +1,53 @@ +--- +title: Docker +sidebar_label: Docker +--- + +:::note +Currently the Docker approach is only documented for [VS Code](https://github.com/microsoft/vscode) (not [Code OSS](https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code)). While it can be replicated using [devcontainers](https://containers.dev/) this is not documented yet - contributions are welcome! +::: + +### Source Code + +First, you'll need to clone the ZMK source repository if you haven't already. Open a terminal and navigate to the folder you would like to place your `zmk` directory in, then run the following command: + +```sh +git clone https://github.com/zmkfirmware/zmk.git +``` + +### Installing Development Tools + +1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop) for your operating system. +2. Install [VS Code](https://code.visualstudio.com/). +3. Install the [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). + +### Initialize & Update Zephyr Workspace + +Open the `zmk` checkout folder in VS Code. The repository includes a configuration for containerized development, so an alert will pop up: + +![VS Code Dev Container Configuration Alert](../../assets/dev-setup/vscode_devcontainer.png) + +Click `Reopen in Container` in order to reopen the VS Code with the running container. If the alert fails to pop up or you accidentally close it, you can perform the same action by pressing `ctrl+shift+p` and selecting `Remote: Show Remote Menu`. + +The first time you do this on your machine, it will pull the docker image down from the registry and build the container. Subsequent launches are much faster! + +:::caution +The following step and any future [build commands](../build-flash.mdx) must be executed from the VS Code terminal _inside_ the container. +::: + +Initialize the application and update to fetch modules, including Zephyr: + +```sh +west init -l app/ +west update +``` + +:::tip +This step pulls down quite a bit of tooling, be patient! +::: + +:::info +You must restart the container at this point. The easiest way to do so is to close the VS Code window, verify that the container has stopped in Docker Dashboard, and reopen the container with VS Code. + +Your setup is complete once your container has restarted. +::: diff --git a/docs/docs/development/setup/index.md b/docs/docs/development/setup/index.md new file mode 100644 index 00000000..5c795fa2 --- /dev/null +++ b/docs/docs/development/setup/index.md @@ -0,0 +1,20 @@ +--- +title: Getting Started +sidebar_label: Getting Started +--- + +:::tip +We recommend reading through the setup process before following it step by step, to ensure that you are happy with installing the required dependencies. +::: + +## Environment Setup + +There are two ways to set up the ZMK development environment: + +- [Docker](/docs/development/setup/docker): \ + A self-contained development environment. It uses the same [Docker image which is used by the GitHub action](https://github.com/zmkfirmware/zmk-docker) for local development. Beyond the benefits of [dev/prod parity](https://12factor.net/dev-prod-parity), this approach may be easier to set up for some operating systems. No toolchain or dependencies are necessary when using Docker; the container image has the toolchain installed and set up to use. + +- [Native](/docs/development/setup/native):\ + This uses your operating system directly. Usually runs slightly faster than the Docker approach, and can be preferable for users who already have the dependencies on their system. + +Please see the [Docker](/docs/development/setup/docker) instructions or [native](/docs/development/setup/native) instructions to continue setup. diff --git a/docs/docs/development/setup/native.mdx b/docs/docs/development/setup/native.mdx new file mode 100644 index 00000000..40c1bbed --- /dev/null +++ b/docs/docs/development/setup/native.mdx @@ -0,0 +1,353 @@ +--- +title: Native Setup +sidebar_label: Native +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +export const OsTabs = (props) => ( + + {/* eslint-disable-next-line */} + {props.children} + + +); + +export const OsNoteTabs = (props) => ( + + {/* eslint-disable-next-line */} + {props.children} + + +); + +export const EnvTabs = (props) => ( + + {/* eslint-disable-next-line */} + {props.children} + + +); + +export const WinTermTabs = (props) => ( + + {/* eslint-disable-next-line */} + {props.children} + + +); + +## 1. Install Zephyr Dependencies + +Open Zephyr's [Getting Started Guide](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html) and follow the instructions under these sections: + +- [Select and Update OS](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#select-and-update-os) +- [Install Dependencies](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#install-dependencies) + +:::info +Zephyr's [Install Linux Host Dependencies](https://docs.zephyrproject.org/3.5.0/develop/getting_started/installation_linux.html) page may be of use for users of Linux distributions which are not based on Ubuntu. +::: + +## 2. Source Code + +Next, you'll need to clone the ZMK source repository if you haven't already. Open a terminal and navigate to the folder you would like to place your `zmk` directory in, then run the following command: + +```sh +git clone https://github.com/zmkfirmware/zmk.git +``` + +Then step into the repository. + +```sh +cd zmk +``` + +## 3. Get Zephyr and install Python dependencies + +:::note +These steps are very similar to Zephyr's [Get Zephyr and install Python dependencies](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#get-zephyr-and-install-python-dependencies) instructions, but specialized for ZMK. +::: + + + + + + +1. Use `apt` to install Python `venv` package: + +```sh +sudo apt install python3-venv +``` + +2. Create a new virtual environment and activate it: + +```sh +python3 -m venv .venv +source .venv/bin/activate +``` + + + + +1. Create a new virtual environment: + +```sh +python -m venv .venv +``` + +2. Activate the virtual environment: + + + + +```sh +.venv\Scripts\activate.bat +``` + + + + + +```powershell +.venv\Scripts\Activate.ps1 +``` + + + + + + + + +1. Create a new virtual environment: + +```sh +python3 -m venv .venv +``` + +2. Activate the virtual environment: + +```sh +source .venv/bin/activate +``` + + + + +Once activated your shell will be prefixed with `(.venv)`. The virtual environment can be deactivated at any time by running `deactivate`. + +:::note +Remember to activate the virtual environment every time you start working. +::: + +4. Install west: + +```sh +pip install west +``` + +5. Initialize the application and update to fetch modules, including Zephyr: + +```sh +west init -l app/ +west update +``` + +:::tip +This step pulls down quite a bit of tooling, be patient! +::: + +6. Export a [Zephyr CMake package](https://docs.zephyrproject.org/3.5.0/build/zephyr_cmake_package.html#cmake-pkg). This allows CMake to automatically load boilerplate code required for building Zephyr applications. + +```sh +west zephyr-export +``` + +7. Install the additional dependencies found in Zephyr's `requirements-base.txt`: + +```sh +pip install -r zephyr/scripts/requirements-base.txt +``` + + + + + +1. Install `west`: + +```sh +pip3 install --user -U west +``` + +:::note +You need `~/.local/bin` to be on your `PATH` environment variable; verify that it is by running + +```sh +west --version +``` + +If this prints an error rather than a `west` version number, then add `~/.local/bin` to your `PATH`: + +```sh +echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc +source ~/.bashrc +``` + +::: + + + + +1. Install `west`: + +```sh +pip install -U west +``` + +:::note +You need the Python scripts directory to be on your PATH environment variable; verify that it is by running + +```sh +west --version +``` + +If this prints an error rather than a `west` version number, then add said directory to your `PATH` with PowerShell: + +```powershell +$Scripts = python -c "import sysconfig; print(sysconfig.get_path('scripts'))" +$Path = [Environment]::GetEnvironmentVariable('PATH', 'User') +[Environment]::SetEnvironmentVariable('PATH', "$Path;$Scripts", 'User') +$env:PATH += ";$Scripts" +``` + +::: + + + + + +1. Install `west`: + +```sh +pip3 install -U west +``` + + + + +2. Initialize the application and update to fetch modules, including Zephyr: + +```sh +west init -l app/ +west update +``` + +:::tip +This step pulls down quite a bit of tooling, be patient! +::: + +3. Export a [Zephyr CMake package](https://docs.zephyrproject.org/3.5.0/build/zephyr_cmake_package.html#cmake-pkg). This allows CMake to automatically load boilerplate code required for building Zephyr applications. + +```sh +west zephyr-export +``` + + + + +4. Install the additional dependencies found in Zephyr's `requirements-base.txt`: + +```sh +pip3 install --user -r zephyr/scripts/requirements-base.txt +``` + + + + + +4. Install the additional dependencies found in Zephyr's `requirements-base.txt`: + +```sh +pip install -r zephyr/scripts/requirements-base.txt +``` + + + + +4. Install the additional dependencies found in Zephyr's `requirements-base.txt`. + +```sh +pip3 install -r zephyr/scripts/requirements-base.txt +``` + + + + + + +## 4. Install Zephyr SDK + +Return to Zephyr's Getting Started Guide and [Install Zephyr SDK](https://docs.zephyrproject.org/3.5.0/develop/getting_started/index.html#install-zephyr-sdk). + +### OS-Specific Notes + + + + `dfu-util` is required to flash devices that use DFU, but there is currently + no maintained package for it on Chocolatey. [QMK + Toolbox](https://github.com/qmk/qmk_toolbox) contains a working version of it + though. + + + +#### Install cross-compile toolchain + +Because Raspberry OS runs on the same architecture (but different ABI) as ARM keyboard MCUs, the operating system's installed [cross compilers](https://docs.zephyrproject.org/3.5.0/develop/toolchains/other_x_compilers.html) can be used to target the different ABI. Building for non-ARM MCUs has not been tested. + +First, the cross compiler should be installed: + +```sh +sudo apt install gcc-arm-none-eabi +``` + +Next, we'll configure Zephyr with some [environment variables](https://docs.zephyrproject.org/3.5.0/develop/env_vars.html#env-vars) needed to find the cross compiler. Create a file named `~/.zephyrrc` if it doesn't exist, and add these lines to it: + +```sh +export ZEPHYR_TOOLCHAIN_VARIANT=cross-compile +export CROSS_COMPILE=/usr/bin/arm-none-eabi- +``` + + + + +Your setup is now complete. diff --git a/docs/docs/development/studio-rpc-protocol.md b/docs/docs/development/studio-rpc-protocol.md new file mode 100644 index 00000000..f352a174 --- /dev/null +++ b/docs/docs/development/studio-rpc-protocol.md @@ -0,0 +1,139 @@ +--- +title: Studio RPC Protocol +--- + +:::warning[Alpha Feature] + +ZMK Studio is still in active development, and the below information is for development purposes only. For up to date information, join the [ZMK Discord](https://zmk.dev/community/discord/invite) server and discuss in `#studio-development`. + +::: + +## Overview + +The ZMK Studio UI communicates with ZMK devices using a custom RPC protocol developed to be robust and reliable, while remaining simple and easy to extend with future enhancements. + +The protocol consists of [protocol buffer](https://protobuf.dev/programming-guides/proto3/) messages which are encoded/decoded using message framing, and then transmitted using an underlying transport. Two transports are currently implemented: a BLE transport using a custom GATT service and a serial port transport, which usually is used with CDC ADM devices over USB. + +## Protobuf Messages + +The messages for ZMK Studio are defined in a dedicated [zmk-studio-messages](https://github.com/zmkfirmware/zmk-studio-messages) repository. Fundamentally, the [`Request`](https://github.com/zmkfirmware/zmk-studio-messages/blob/main/proto/zmk/studio.proto#L11) message is used to send any requests from the Studio client to the ZMK device, and the [`Response`](https://github.com/zmkfirmware/zmk-studio-messages/blob/main/proto/zmk/studio.proto#L21) messages are sent from the ZMK device to the Studio client. + +Responses can either be [`RequestResponses`](https://github.com/zmkfirmware/zmk-studio-messages/blob/main/proto/zmk/studio.proto#L28) that are sent in response to an incoming `Request` or a [`Notification`](https://github.com/zmkfirmware/zmk-studio-messages/blob/main/proto/zmk/studio.proto#L38) which is sent at any point from the ZMK device to the Studio client to inform the client about state changes on the device, e.g. that the device is unlocked. + +## Message Framing + +Studio uses a simple framing protocol to easily identify the start and end of a given message, with basic escaping to allow for unrestricted content. + +The following special bytes are used for the framing protocol: + +- Start of Frame (SoF): `0xAB` +- Escape Byte (Esc): `0xAC` +- End of Frame (EoF): `0xAD` + +A message consists of a SoF byte, the payload, escaped as needed, followed by an EoF byte. Within the payload, any of the special encoding bytes will be escaped by being prefixed with an Esc byte. + +### Example Encoding (Simple) + +Here is an example encoding when the message content does not include any of the special bytes: + +```mermaid +block-beta + columns 5 + + space:1 + block:group1:3 + columns 3 + contentLabel["Content"]:1 space:2 + OrigA["0x12"] OrigB["0x01"] OrigC["0xBB"] + end + + space + + down<[" "]>(down):5 + + block:groupSoF:1 + columns 1 + SoFLabel["SoF"] + SoF["0xAB"] + end + + block:group2:3 + columns 3 + contentLabel2["Content"]:1 space:2 + EncA["0x12"] + EncB["0x01"] + EncC["0xBB"] + end + block:groupEoF:1 + columns 1 + EoFLabel["EoF"] + 0xAD + end + + class contentLabel boxLabel + class contentLabel2 boxLabel + class SoFLabel boxLabel + class EoFLabel boxLabel + + classDef boxLabel stroke:transparent,fill:transparent +``` + +### Example Encoding (Escaping) + +When the message content includes any of the special bytes, those bytes are escaped whe framed + +```mermaid +block-beta + columns 6 + + space:1 + block:group1:4 + columns 5 + contentLabel["Content"]:1 space:4 + OrigA["0x12"] space OrigB["0xAD"] space OrigC["0xAC"] + end + + space:1 + + down<[" "]>(down):6 + + block:groupSoF:1 + columns 1 + SoFLabel["SoF"] + SoF["0xAB"] + end + + block:group2:4 + columns 5 + contentLabel2["Content"]:1 space:4 + EncA["0x12"] + EscB["0xAC"] + EncB["0xAD"] + EscC["0xAC"] + EncC["0xAC"] + end + block:groupEoF:1 + columns 1 + EoFLabel["EoF"] + 0xAD + end + + class contentLabel boxLabel + class contentLabel2 boxLabel + class SoFLabel boxLabel + class EoFLabel boxLabel + + classDef boxLabel stroke:transparent,fill:transparent +``` + +## Transports + +Two transports are available right now, over USB or Bluetooth connections. + +### USB (Serial) + +The USB transport is actually a basic serial/UART transport, that happens to use the CDC/ACM USB class for a serial connection. Framed messages are sent between Studio client and ZMK device using simple UART transmission. + +### Bluetooth (GATT) + +The bluetooth transport uses a custom GATT service to transmit/receive. The service has UUID `00000000-0196-6107-c967-c5cfb1c2482a` and has exactly one characteristic with UUID `00000001-0196-6107-c967-c5cfb1c2482a`. The characteristic accepts writes of framed client messages, and will use GATT Indications to send framed messages to the client. diff --git a/docs/docs/development/usb-logging.mdx b/docs/docs/development/usb-logging.mdx index cb9508a2..b7c3d233 100644 --- a/docs/docs/development/usb-logging.mdx +++ b/docs/docs/development/usb-logging.mdx @@ -18,26 +18,33 @@ It is recommended to only enable logging when needed, and not leaving it on by d ::: -## Kconfig +## USB Logging Snippet -The `CONFIG_ZMK_USB_LOGGING` Kconfig enables USB logging. This can be set at the keyboard level, typically in the `config/.conf` -file if you are using a [user config repository](user-setup.mdx). It can also be enabled at the ZMK level using the `app/prj.conf` file, or other -search locations described in the [configuration overview](config/index.md#config-file-locations). +The `zmk-usb-logging` snippet is used to enable logging. + +If using GitHub Actions to build your firmware, enabling logging +requires adding a `snippet: zmk-usb-logging` to your `build.yaml` file for any build you want logging enabled, e.g. + +```yaml +--- +include: + - board: nice_nano_v2 + shield: corne_left + snippet: zmk-usb-logging +``` + +When building locally, the `-S`/`--snippet` flag can be passed to `west build` to enable the snippet, e.g. + +```sh +west build -b nice_nano_v2 -S zmk-usb-logging -- -DSHIELD="corne_left" +``` + +### Additional Config Logging can be further configured using Kconfig described in [the Zephyr documentation](https://docs.zephyrproject.org/3.5.0/services/logging/index.html). For instance, setting `CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS` to a large value such as `8000` might help catch issues that happen near keyboard boot, before you can connect to view the logs. -:::note -In Github Actions, you can check the ` Kconfig file` step output to verify the options above have been enabled -for you successfully. -::: - -```ini -# Turn on logging, and set ZMK logging to debug output -CONFIG_ZMK_USB_LOGGING=y -``` - ## Viewing Logs After flashing the updated ZMK image, the board should expose a USB CDC ACM device that you can connect to and view the logs. @@ -89,27 +96,29 @@ From there, you should see the various log messages from ZMK and Zephyr, dependi Standard boards such as the nice!nano and Seeeduino XIAO family have the necessary configuration for logging already added, however if you are developing your own standalone board you may wish to add the ability to use USB logging in the future. -To add USB logging to a board you need to define the USB CDC ACM device that the serial output gets piped to, as well as adding the console in the `chosen` node inside `.dts`. +To do so, you need to follow the upstream Zephyr [`cdc-acm-console` snippet requirements](https://docs.zephyrproject.org/3.5.0/snippets/cdc-acm-console/README.html#requirements) steps. -Inside the USB device (`&usbd`), add the CDC ACM node: +Usually, this just requires ensuring that the USB node has been tagged with the `zephyr_udc0` label, e.g. ```dts -&usbd { +zephyr_udc0: &usbd { status = "okay"; - cdc_acm_uart: cdc_acm_uart { - compatible = "zephyr,cdc-acm-uart"; - }; }; ``` -Then you can add the `zephyr,console` binding in the `chosen` node: +## Enabling Logging on Older Boards -```dts -/ { - chosen { - ... - zephyr,console = &cdc_acm_uart; - }; - ... -}; +Previously, enabling logging required setting the `CONFIG_ZMK_USB_LOGGING` Kconfig symbol. If for whatever reason +a custom board definition does not support the new `zmk-usb-logging` snippet, you can try setting this symbol at the keyboard level, typically in the `config/.conf` +file if you are using a [user config repository](user-setup.mdx). It can also be enabled at the ZMK level using the `app/prj.conf` file, or other +search locations described in the [configuration overview](config/index.md#config-file-locations). + +:::note +In Github Actions, you can check the ` Kconfig file` step output to verify the options above have been enabled +for you successfully. +::: + +```ini +# Turn on logging, and set ZMK logging to debug output +CONFIG_ZMK_USB_LOGGING=y ``` diff --git a/docs/docs/features/backlight.mdx b/docs/docs/features/backlight.mdx index 4c473057..5debc375 100644 --- a/docs/docs/features/backlight.mdx +++ b/docs/docs/features/backlight.mdx @@ -34,7 +34,7 @@ There are various Kconfig options used to configure the backlight feature. These | `CONFIG_ZMK_BACKLIGHT_AUTO_OFF_IDLE` | Turn off backlight when keyboard goes into idle state | n | | `CONFIG_ZMK_BACKLIGHT_AUTO_OFF_USB` | Turn off backlight when USB is disconnected | n | -## Adding Backlight to a board or a shield +## Adding Backlight to a Board or a Shield -pinctrl.dtsi` file if it does not already exist, and include it at the beginning of the `.dts` file. `CONFIG_PINCTRL=y` must be added to to `_defconfig` if it isn't already enabled. +Create a `-pinctrl.dtsi` file if it does not already exist, and include it at the beginning of the `.dts` file. `CONFIG_PINCTRL=y` must be added to `_defconfig` if it isn't already enabled. The pinctrl file has a `&pinctrl` node that encompasses all pinctrl settings, including I2C or SPI peripherals (e.g. WS2812 LEDs, Battery fuel gauges): @@ -208,7 +208,7 @@ Finally you need to add backlight to the `chosen` element of the root devicetree -### Multiple backlight LEDs +### Multiple Backlight LEDs It is possible to control multiple backlight LEDs at the same time. This is useful if, for example, you have a Caps Lock LED connected to a different pin and you want it to be part of the backlight. diff --git a/docs/docs/features/battery.md b/docs/docs/features/battery.md index 29142eed..14dd6661 100644 --- a/docs/docs/features/battery.md +++ b/docs/docs/features/battery.md @@ -5,7 +5,7 @@ sidebar_label: Battery Level If your keyboard has a battery sensor, ZMK will report its battery level to the connected bluetooth host and show it on the keyboard's display, if it has one. -For split keyboards, only the battery level of the central (usually left) side is reported over bluetooth by default. ZMK can be [configured to report the battery levels for peripherals](../config/battery.md#peripheral-battery-monitoring), but not many host systems will display this information without additional configuration or the use of third party utilities. +For [split keyboards](split-keyboards.md), only the battery level of the central (usually left) side is reported over bluetooth by default. ZMK can be [configured to report the battery levels for peripherals](../config/battery.md#peripheral-battery-monitoring), but not many host systems will display this information without additional configuration or the use of third party utilities. :::note diff --git a/docs/docs/features/beta-testing.mdx b/docs/docs/features/beta-testing.mdx deleted file mode 100644 index 148005ce..00000000 --- a/docs/docs/features/beta-testing.mdx +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: Beta Testing -sidebar_label: Beta Testing ---- - -import Tabs from "@theme/Tabs"; -import TabItem from "@theme/TabItem"; - -You may find that ZMK does not support a feature or keyboard that you are interesting in using. You may find that someone -has already taken the time to submit the feature you need as a [Pull Request](https://github.com/zmkfirmware/zmk/pulls). If you find the feature you need as a pull request, -this page is for you! - -## Developer Repositories and Branches - -For a developer to submit a pull request to ZMK, they must first clone the original ZMK repository. After they have a copy -of the source code, they may create a feature branch to work within. When they have finished, they will publish the feature -branch and create the pull request. - -### Finding the Repository Page from the Pull Request - -![PR Repository](../assets/features/beta-testing/pr-repo-branch.png) - -### Finding the Repository URL - -![Repository URL](../assets/features/beta-testing/repo-url.png) - -### Finding the Repository Branch - -![Repository URL](../assets/features/beta-testing/repo-branch.png) - -## Testing features - -Testing features will require you to modify the `west.yml` file. You will need to add a new remote for the pull request you -would like to test, and change the selected remote and revision (or branch) for the `zmk` project. - -### Examples - - - - -```yaml -manifest: - remotes: - - name: zmkfirmware - url-base: https://github.com/zmkfirmware - projects: - - name: zmk - remote: zmkfirmware - revision: main - import: app/west.yml - self: - path: config -``` - - - - -```yaml -manifest: - remotes: - - name: zmkfirmware - url-base: https://github.com/zmkfirmware - - name: okke-formsma - url-base: https://github.com/okke-formsma - projects: - - name: zmk - remote: okke-formsma - revision: macros - import: app/west.yml - self: - path: config -``` - - - - -```yaml -manifest: - remotes: - - name: zmkfirmware - url-base: https://github.com/zmkfirmware - - name: mcrosson - url-base: https://github.com/mcrosson - projects: - - name: zmk - remote: mcrosson - revision: feat-behavior-sleep - import: app/west.yml - self: - path: config -``` - - - diff --git a/docs/docs/features/bluetooth.md b/docs/docs/features/bluetooth.md index 28ba2136..79af22b4 100644 --- a/docs/docs/features/bluetooth.md +++ b/docs/docs/features/bluetooth.md @@ -3,7 +3,7 @@ title: Bluetooth sidebar_label: Bluetooth --- -ZMK's bluetooth functionality allows users to connect their keyboards to hosts using Bluetooth Low Energy (BLE) technology. It also is used for split keyboards to connect the two halves wirelessly. +ZMK's bluetooth functionality allows users to connect their keyboards to hosts using Bluetooth Low Energy (BLE) technology. It also is used for [split keyboards](split-keyboards.md) to connect the two halves wirelessly. :::note @@ -47,52 +47,4 @@ Firmware changes that would modify the descriptor include the following: While the descriptor refresh happens on boot for USB, hosts will frequently cache this descriptor for BLE devices. In order to refresh this cache, you need to remove the keyboard from the host device, clear the profile associated with the host on the keyboard, then pair again. -For Windows systems you might need to follow the instructions in [this troubleshooting section](#windows-connected-but-not-working) below. - -## Troubleshooting - -### Connectivity Issues - -Some users may experience a poor connection between the keyboard and the host. This might be due to poor quality BLE hardware, a metal enclosure on the keyboard or host, or the distance between them. Increasing the transmit power of the keyboard's BLE radio may reduce the severity of this problem. To do this, set the `CONFIG_BT_CTLR_TX_PWR_PLUS_8` configuration value in the `.conf` file of your user config directory as such: - -```ini -CONFIG_BT_CTLR_TX_PWR_PLUS_8=y -``` - -For the `nRF52840`, the value `PLUS_8` can be set to any multiple of four between `MINUS_20` and `PLUS_8`. The default value for this config is `0`, but if you are having connection issues it is recommended to set it to `PLUS_8` because the power consumption difference is negligible. For more information on changing the transmit power of your BLE device, please refer to [the Zephyr docs.](https://docs.zephyrproject.org/3.5.0/kconfig.html#CONFIG_BT_CTLR_TX_PWR) - -:::info -This setting can also improve the connection strength between the keyboard halves for split keyboards. -::: - -### Using bluetooth output with USB power - -If you want to test bluetooth output on your keyboard and are powering it through the USB connection rather than a battery, you will be able to pair with a host device but may not see keystrokes sent. In this case you need to use the [output selection behavior](../behaviors/outputs.md) to prefer sending keystrokes over bluetooth rather than USB. This might be necessary even if you are not powering from a device capable of receiving USB inputs, such as a USB charger. - -### Issues with dual boot setups - -Since ZMK associates pairing/bond keys with hardware addresses of hosts, you cannot pair to two different operating systems in a dual boot system at the same time. -While you can find [documented workarounds](https://wiki.archlinux.org/title/bluetooth#Dual_boot_pairing) that involve copying pairing keys across operating systems and use both OS with a single profile, they can be fairly involved and should be followed with caution. - -### macOS Connected But Not Working - -If you attempt to pair a ZMK keyboard from macOS in a way that causes a bonding issue, macOS may report the keyboard as connected, but fail to actually work. If this occurs: - -1. Remove the keyboard from macOS using the Bluetooth control panel. -1. Invoke `&bt BT_CLR` on the keyboard while the profile associated with the macOS device is active, by pressing the correct keys for your particular keymap. -1. Try connecting again from macOS. - -### Windows Connected But Not Working - -Occasionally pairing the keyboard to a Windows device might result in a state where the keyboard is connected but does not send any key strokes. -If this occurs: - -1. Remove the keyboard from Windows using the Bluetooth settings. -1. Invoke `&bt BT_CLR` on the keyboard while the profile associated with the Windows device is active, by pressing the correct keys for your particular keymap. -1. Turn off Bluetooth from Windows settings, then turn it back on. -1. Pair the keyboard to the Windows device. - -If this doesn't help, try following the procedure above but replace step 3 with one of the following: - -- Restart the Windows device -- Open "Device Manager," turn on "Show hidden devices" from the "View" menu, then find and delete the keyboard under the "Bluetooth" item +For Windows systems you might need to follow the additional instructions in [the section on troubleshooting connection issues](troubleshooting/connection-issues.mdx#windows-connected-but-not-working). diff --git a/docs/docs/features/combos.md b/docs/docs/features/combos.md index 32f09c1c..ad24d61f 100644 --- a/docs/docs/features/combos.md +++ b/docs/docs/features/combos.md @@ -38,14 +38,14 @@ Key positions are numbered like the keys in your keymap, starting at 0. So, if t ::: -### Advanced usage +### Advanced Usage - Partially overlapping combos like `0 1` and `0 2` are supported. - Fully overlapping combos like `0 1` and `0 1 2` are supported. - You are not limited to `&kp` bindings. You can use all ZMK behaviors there, like `&mo`, `&bt`, `&mt`, `<` etc. :::note[Source-specific behaviors on split keyboards] -Invoking a source-specific behavior such as one of the [reset behaviors](behaviors/reset.md) using a combo will always trigger it on the central side of the keyboard, regardless of the side that the keys corresponding to `key-positions` are on. +Invoking a [source-specific behavior](split-keyboards.md#source-locality-behaviors) such as one of the [reset behaviors](behaviors/reset.md) using a combo will always trigger it on the central side of the keyboard, regardless of the side that the keys corresponding to `key-positions` are on. ::: -See [combo configuration](/docs/config/combos) for advanced configuration options. +See [combo configuration](../config/combos.md) for advanced configuration options. diff --git a/docs/docs/features/debouncing.md b/docs/docs/features/debouncing.md index 7d194efa..31e00843 100644 --- a/docs/docs/features/debouncing.md +++ b/docs/docs/features/debouncing.md @@ -40,7 +40,7 @@ CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS=3 CONFIG_ZMK_KSCAN_DEBOUNCE_RELEASE_MS=3 ``` -### Per-driver Options +### Per-Driver Options You can add these Devicetree properties to a kscan node to control debouncing for that instance of the driver. Values must be `<= 16383`. diff --git a/docs/docs/features/keymaps.mdx b/docs/docs/features/keymaps.mdx index 105ca794..c1608204 100644 --- a/docs/docs/features/keymaps.mdx +++ b/docs/docs/features/keymaps.mdx @@ -4,7 +4,6 @@ sidebar_label: Keymaps --- import KeymapExample from "../keymap-example.md"; -import KeymapExampleFile from "../keymap-example-file.md"; ZMK uses a declarative approach to keymaps instead of using C code for all keymap configuration. Right now, ZMK uses the devicetree syntax to declare those keymaps; future work is envisioned for @@ -38,21 +37,24 @@ For the full set of possible behaviors, see the [overview page for behaviors](.. ## Layers Like many mechanical keyboard firmwares, ZMK keymaps are composed of a collection of layers, with a -minimum of at least one layer that is the default, usually near the bottom of the "stack". Each layer +minimum of at least one layer that is the default, usually near the bottom of the "layer stack". Each layer in ZMK contains a set of bindings that bind a certain behavior to a certain key position in that layer. | ![Diagram of three layers](../assets/features/keymaps/layer-diagram.png) | | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | _A simplified diagram showing three layers. The layout of each layer is the same (they all contain four keys), but the behavior bindings within each layer can be different._ | -In addition to the base default layer (which can be changed), certain bound behaviors may also -enable/disable additional layers "on top" of the default layer. +All layers are assigned and referred to by a natural number, with the base layer being layer `0`. It is common to [use the C preprocessor to "name" layers](../behaviors/layers.md#defines-to-refer-to-layers), making them more legible. -When a key location is pressed/released, the stack of all active layers from "top to bottom" is used, -and the event is sent to the behavior bound at that position in each layer, for it to perform whatever -actions it wants to in reaction to the event. Those behaviors can choose to "handle" the event, and stop -it from being passed to any lower layers, or may choose to "pass it along", and let the next layer -in the stack _also_ get the event. +The default layer (the base layer with index 0) is always enabled. Certain bound behaviors may enable/disable additional layers. + +When a key location is pressed/released, the _highest-valued currently active_ layer is used. The press/release event is sent to the behavior bound at that position in said layer, for it to perform whatever actions it wants to in reaction to the event. The behavior can choose to "consume" the event, or "pass it along" and let the next highest-valued active layer _also_ get the event (whose behavior may continue "passing it along"). + +Note that the _activation_ order isn't relevant for determining the priority of active layers, it is determined _only_ by the definition order. + +:::tip +If you wish to use multiple base layers (with a [toggle](../behaviors/layers.md#toggle-layer)), e.g. one for QWERTY and another for Colemak layouts, you will want these layers to have the lowest value possible. In other words, one should be layer `0`, and the other should be layer `1`. This allows other momentary layers activated on top of them to work with both. +::: ## Behavior Bindings @@ -96,7 +98,7 @@ The first defines the nodes for all the available behaviors in ZMK, which will b The second include brings in the defines for all the keycodes (e.g. `A`, `N1`, `C_PLAY`) and the modifiers (e.g. `LSHIFT`) used for various behavior bindings. -### Root devicetree Node +### Root Devicetree Node All the remaining keymap nodes will be nested inside of the root devicetree node, like so: @@ -121,18 +123,49 @@ Nested under the devicetree root, is the keymap node. The node _name_ itself is ### Layers -Each layer of your keymap will be nested under the keymap node. Here is a sample -that defines just one layer for this keymap: +Each layer of your keymap will be nested under the keymap node. Here is an example of a layer in a 6-key macropad. - +```dts + keymap { + compatible = "zmk,keymap"; + + default_layer { // Layer 0 +// ---------------------------------------------- +// | Z | M | K | +// | A | B | C | + bindings = < + &kp Z &kp M &kp K + &kp A &kp B &kp C + >; + }; + }; +``` Each layer should have: 1. A `bindings` property this will be a list of [behavior bindings](../behaviors/index.mdx), one for each key position for the keyboard. 1. (Optional) A `sensor-bindings` property that will be a list of behavior bindings for each sensor on the keyboard. (Currently, only encoders are supported as sensor hardware, but in the future devices like trackpoints would be supported the same way) +### Multiple Layers + +Layers are numbered in the order that they appear in keymap node - the first layer is `0`, the second layer is `1`, etc. + +Here is an example of a trio of layers for a simple 6-key macropad: + + + +:::note +Even if layer `1` was to be activated after `2`, layer `2` would still have priority as it is higher valued. Behaviors such as [To Layer (`&to`)](../behaviors/layers.md#to-layer) can be used to enable one layer _and disable all other non-default layers_, though. +::: + ### Complete Example -Putting this all together, a complete [`kyria.keymap`](https://github.com/zmkfirmware/zmk/blob/main/app/boards/shields/kyria/kyria.keymap) looks like: +Some examples of complete keymaps for a keyboard are: - +- [`corne.keymap`](https://github.com/zmkfirmware/zmk/blob/main/app/boards/shields/corne/corne.keymap) +- [`kyria.keymap`](https://github.com/zmkfirmware/zmk/blob/main/app/boards/shields/kyria/kyria.keymap) +- [`lily58.keymap`](https://github.com/zmkfirmware/zmk/blob/main/app/boards/shields/lily58/lily58.keymap) + +:::tip +Every keyboard comes with a "default keymap". For additional examples, the [ZMK tree's `app/boards` folder](https://github.com/zmkfirmware/zmk/blob/main/app/boards) can be browsed. +::: diff --git a/docs/docs/features/modules.mdx b/docs/docs/features/modules.mdx new file mode 100644 index 00000000..e25bc72a --- /dev/null +++ b/docs/docs/features/modules.mdx @@ -0,0 +1,194 @@ +--- +title: Modules +sidebar_label: Modules +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +ZMK makes use of [Zephyr modules](https://docs.zephyrproject.org/3.5.0/develop/modules.html) to include additional source code or configuration files into its build. You can think of them as similar to plugins or themes. The most common uses of this feature are: + +- Building firmware for a keyboard external to ZMK's tree +- Adding functionality to ZMK, such as a driver or a behavior + +A common ZMK setup thus consists of the following separate components, commonly housed in their respective Git repositories: + +- A single ZMK config maintained by the user, containing the `.conf` and `.keymap` files for one or multiple keyboards. This is also where files from ZMK or modules should be overridden/modified, if there is a need. +- Any number of ZMK modules, maintained by the module's owner. Some modules may contain multiple keyboards or functionalities. If all of your keyboards and functionalities are internal to ZMK's tree, then no modules are necessary. +- The ZMK firmware itself, maintained by its contributors. + +:::note +The shift to using modules for keyboards is a relatively recent one, and not all designs may be properly configured to be used as a module. If this is the case for your keyboard, then we would strongly suggest asking your vendor or designer to rectify this. +::: + +## Building With Modules + +### GitHub Actions + +When [using GitHub Actions to build ZMK](../user-setup.mdx), adding modules is as simple as modifying the `west.yml` found in your `zmk-config`'s `config` directory. The recommended way of doing so is: + +1. Find the URL base (the parent URL) for the module and add it as an entry to the [remotes](https://docs.zephyrproject.org/3.5.0/develop/west/manifest.html#remotes). +2. Add the module as an entry to the [projects](https://docs.zephyrproject.org/3.5.0/develop/west/manifest.html#projects). + Aside from the mandatory `name`, `remote`, and the commonly used `revision` properties, take note of the `import` property under `projects`. Some modules may have other modules as dependencies. This property allows the specifying of an additional west manifest file found in the tree of the module, which will automatically import all dependencies. + +For more information on `west.yml`, see [West Manifests](https://docs.zephyrproject.org/3.5.0/develop/west/manifest.html). + +#### Examples + + + + +```yaml +manifest: + remotes: + - name: zmkfirmware + url-base: https://github.com/zmkfirmware + projects: + - name: zmk + remote: zmkfirmware + revision: main + import: app/west.yml + self: + path: config +``` + + + + +```yaml +manifest: + remotes: + - name: zmkfirmware + url-base: https://github.com/zmkfirmware + - name: module_a_base + url-base: https://github.com/alice + projects: + - name: zmk + remote: zmkfirmware + revision: main + import: app/west.yml + - name: module_a + remote: module_a_base + revision: main + self: + path: config +``` + + + + +```yaml +manifest: + remotes: + - name: zmkfirmware + url-base: https://github.com/zmkfirmware + - name: module_a_base + url-base: https://github.com/alice + - name: module_b_base + url-base: https://github.com/bob + projects: + - name: zmk + remote: zmkfirmware + revision: main + import: app/west.yml + - name: module_a + remote: module_a_base + revision: main + - name: module_b + remote: module_b_base + revision: main + import: west.yml + self: + path: config +``` + + + + +### Building Locally + +To add a module to your build when building locally, you will need to clone/copy said module into your local file tree. You can then build using the module as described in [Building with External Modules](../development/build-flash.mdx#building-with-external-modules). + +## Beta Testing + +You may find that there are some features which you desire for which there is a [Pull Request](https://github.com/zmkfirmware/zmk/pulls), but no module. If this is the case, you can still make use of the feature. + +### Developer Repositories and Branches + +For a developer to submit a pull request to ZMK, they must first clone the original ZMK repository. After they have a copy +of the source code, they may create a feature branch to work within. When they have finished, they will publish the feature +branch and create the pull request. + +#### Finding the repository page from the Pull Request + +![PR Repository](../assets/features/beta-testing/pr-repo-branch.png) + +#### Finding the repository URL + +![Repository URL](../assets/features/beta-testing/repo-url.png) + +#### Finding the repository branch + +![Repository URL](../assets/features/beta-testing/repo-branch.png) + +## Testing Features + +### GitHub Actions + +When [using GitHub Actions to build ZMK](../user-setup.mdx), once you have obtained the correct URL, you'll need to modify the `west.yml` file similarly to [Building With Modules](#building-with-modules). Add the remote for the branch like in said section. The difference is that you will need to change the selected remote and revision (or branch) for the `zmk` project. + +#### Example + + + + +```yaml +manifest: + remotes: + - name: zmkfirmware + url-base: https://github.com/zmkfirmware + projects: + - name: zmk + remote: zmkfirmware + revision: main + import: app/west.yml + self: + path: config +``` + + + + +```yaml +manifest: + remotes: + - name: zmkfirmware + url-base: https://github.com/zmkfirmware + - name: forkedzmk + url-base: https://github.com/forkedzmk + projects: + - name: zmk + remote: forkedzmk + revision: specificpr + import: app/west.yml + self: + path: config +``` + + + + +### Building Locally + +When building from a pull request locally, you'll need to [perform the local user setup](../development/setup/index.md), but using the repository of the pull request rather than the official ZMK repository. You can then [build and flash](../development/build-flash.mdx) as usual. diff --git a/docs/docs/features/soft-off.md b/docs/docs/features/soft-off.md index bd631f1b..207bb13f 100644 --- a/docs/docs/features/soft-off.md +++ b/docs/docs/features/soft-off.md @@ -101,7 +101,7 @@ To use the [soft off behavior](../behaviors/soft-off.md) outside of a keymap, ad The kscan sideband behavior driver will be used to trigger the [soft off behavior](../behaviors/soft-off.md) "out of band" from the normal keymap processing. To do so, it will decorate/wrap an underlying kscan driver. What kscan driver will vary for simple direct pin vs. matrix-integrated hardware combo. -#### Simple Direct Pin +#### Simple direct pin With a simple direct pin setup, the The [direct kscan](../config/kscan.md) driver can be used with a GPIO key, to make a small "side matrix": @@ -121,6 +121,7 @@ With that in place, the kscan sideband behavior will wrap the new driver: compatible = "zmk,kscan-sideband-behaviors"; kscan = <&soft_off_direct_scan>; + auto-enable; wakeup-source; soft_off { @@ -148,7 +149,7 @@ Here are the properties for the node: - The `compatible` property for the node must be `zmk,soft-off-wakeup-sources`. - The `wakeup-sources` property is a [phandle array](../config/index.md#devicetree-property-types) pointing to all the devices that should be enabled during the shutdown process to be sure they can later wake the keyboard. -#### Matrix-Integrated Hardware Combo +#### Matrix-integrated hardware combo For this case, you will supplement the existing kscan matrix, by adding the additional pin as another entry in the `row-gpios`/`col-gpios` for whichever pins are used to read the matrix state. For example, for an existing matrix like: diff --git a/docs/docs/features/split-keyboards.md b/docs/docs/features/split-keyboards.md new file mode 100644 index 00000000..aae61090 --- /dev/null +++ b/docs/docs/features/split-keyboards.md @@ -0,0 +1,101 @@ +--- +title: Split Keyboards +sidebar_label: Split Keyboards +--- + +ZMK supports setups where a keyboard is split into two or more physical parts (also called "sides" or "halves" when split in two), each with their own controller running ZMK. The parts communicate with each other to work as a single keyboard device. + +:::note[Split communication protocols] +Currently ZMK only supports split keyboards that communicate with each other wirelessly over BLE. +As such, only controllers that support BLE can be used with ZMK split keyboards. + +Supporting split communication over wired protocols is planned, allowing for ZMK split keyboards using non-wireless controllers. +::: + +## Central and Peripheral Roles + +In split keyboards running ZMK, one part is assigned the "central" role which receives key position and sensor events from the other parts that are called "peripherals." +The central runs the necessary keymap logic to convert received events into HID events such as keycodes and then communicates with the connected host devices, e.g. over USB or bluetooth. + +The internal keyboard state (like active layers) is handled exclusively by the central. +Peripherals _cannot_ communicate with host devices on their own, since they can only communicate with the central. +They will not present as keyboard devices when connected over USB and will not advertise as pairable BLE keyboards. + +By convention, for a keyboard split into two "halves" the left half is set as the central and the right as a peripheral. + +:::info[Battery life impact] +For BLE-based split keyboards, the central uses significantly more power than the peripherals because its radio needs to periodically wake up to check for incoming transmissions. +You can refer to the [power profiler](/power-profiler) to see battery life estimates for different roles. +::: + +### Configuration + +The [new shield guide](../development/new-shield.mdx) details how to define a split keyboard shield with two parts, enabling the split feature and setting up the necessary roles for each part. + +Also see the reference section on [split keyboards configuration](../config/system.md#split-keyboards) where the relevant symbols include `CONFIG_ZMK_SPLIT` that enables the feature, `CONFIG_ZMK_SPLIT_ROLE_CENTRAL` which sets the central role and `CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS` that sets the number of peripherals. + +### Latency Considerations + +Since peripherals communicate through centrals, the key and sensor events originating from them will naturally have a larger latency, especially with a wireless split communication protocol. +For the currently used BLE-based transport, split communication increases the average latency by 3.75ms with a worst case increase of 7.5ms. + +## Building and Flashing Firmware + +ZMK split keyboards require building and flashing different firmware files for each split part. +For instance when [using the GitHub workflow](../user-setup.mdx) to build two part split keyboards, two firmware files that typically contain `_left` and `_right` in the file names will be produced. +These files need to be flashed to the respective controllers of the two halves. + +:::tip[Updating your keymap] +Since the keymap processing is primarily done on the central side, for keymap changes it will typically be enough to flash the controller of the central half. +However if you make changes to [config files](../config/index.md) that should apply to all parts, you need to flash to all parts. +Any changes in ZMK related to split keyboard features might also necessitate doing this. +::: + +## Pairing for Wireless Split Keyboards + +Split keyboards with BLE-based split communications (i.e. all officially supported split keyboards) have an internal pairing procedure between the central and each peripheral. +When the central has an open slot for a peripheral, it will advertise for connections (which will not be visible to non-ZMK devices). +Then, any peripheral that has not yet bonded to a peripheral will pair to it. +Similar to how [bluetooth profiles](bluetooth.md) are managed between the keyboard and host devices, the bonding information will be stored with the corresponding hardware addresses of the other keyboard part, on both the central and peripheral. + +In practice, this means that your split keyboard parts will automatically pair and work the first time they are all on at the same time. +However, if this process somehow went wrong or you used controllers in a different split keyboard configuration before, you will need to explicitly clear the stored bond information so that the parts can pair properly. +For this, please follow [the specified procedure](../troubleshooting/connection-issues.mdx#split-keyboard-halves-unable-to-pair) in the troubleshooting section. + +:::warning +If the central keyboard part is either advertising for a pairing or waiting for disconnected peripherals, it will consume more power and drain batteries faster. +::: + +## Behaviors with Locality + +Most ZMK [behaviors](../behaviors/index.mdx) are processed exclusively on the central of the split keyboard as it handles the keymap state and any communication with the host devices. +However, certain behaviors have "global" or "source" localities, where they can affect the peripherals when invoked. + +### Global Locality Behaviors + +These are behaviors that affect all keyboard parts, such as changing lighting effects: + +- [RGB underglow behaviors](../behaviors/underglow.md) +- [Backlight behaviors](../behaviors/backlight.md) +- [Power management behaviors](../behaviors/power.md) +- [Soft off behavior](../behaviors/soft-off.md) + +### Source Locality Behaviors + +These behaviors only affect the keyboard part that they are invoked from: + +- [Reset behaviors](../behaviors/reset.md) + +:::warning[Nesting behaviors with locality] +Currently there is [an issue](https://github.com/zmkfirmware/zmk/issues/1494) preventing both global and source locality behaviors from working as expected if they are invoked from another behavior, such as a hold-tap, tap dance or a mod-morph. +For this reason it is recommended that these behaviors are placed directly on a keymap layer. +::: + +:::note[Peripheral invocation] +Peripherals must be paired and connected to the central in order to be able to activate these behaviors, even if it is possible to trigger the behavior using only keys on a particular peripheral. +This is because the key bindings are processed on the central side which would then instruct the peripheral side to run the behavior's effect. +::: + +:::note[Combos] +[Combos](combos.md) always invoke behaviors with source locality on the central. +::: diff --git a/docs/docs/features/underglow.md b/docs/docs/features/underglow.md index a32306ca..ba6c0092 100644 --- a/docs/docs/features/underglow.md +++ b/docs/docs/features/underglow.md @@ -39,7 +39,7 @@ use Kconfig. If your board or shield does not have RGB underglow configured, refer to [Adding RGB Underglow to a Board](#adding-rgb-underglow-to-a-board). -### Modifying the number of LEDs +### Modifying the Number of LEDs A common issue when enabling underglow is that some of the installed LEDs do not illuminate. This can happen when a board's default underglow configuration accounts only for either the downward facing LEDs or the upward facing LEDs under each key. On a split keyboard, a good sign that this may be the problem is that the unilluminated LEDs on each half are symmetrical. @@ -64,7 +64,7 @@ If you have a shield with RGB underglow, you must add a `boards/` directory with Inside the `boards/` folder, you define a `.overlay` for each different board. For example, the Kyria shield has a `boards/nice_nano.overlay` file that defines the RGB underglow for the `nice_nano` board specifically. -### nRF52-based boards +### nRF52-Based Boards With nRF52 boards, you can just use `&spi3` and define the pins you want to use. @@ -128,7 +128,7 @@ If your board/shield uses LEDs that require the data sent in a different order, ::: -### Other boards +### Other Boards For other boards, you must select an SPI definition that has the `MOSI` pin as your data pin going to your LED strip. diff --git a/docs/docs/intro.md b/docs/docs/intro.md index da01e829..e11eda71 100644 --- a/docs/docs/intro.md +++ b/docs/docs/intro.md @@ -46,7 +46,7 @@ ZMK is currently missing some features found in other popular firmware. This tab [^2]: Tap-Dances are limited to single and double-tap on BlueMicro [^1]: OLEDs are currently proof of concept in ZMK. -## Code Of Conduct +## Code of Conduct Please note that this project is released with a [Contributor Code of Conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/). diff --git a/docs/docs/keymap-example.md b/docs/docs/keymap-example.md index e526d542..57f40762 100644 --- a/docs/docs/keymap-example.md +++ b/docs/docs/keymap-example.md @@ -2,20 +2,32 @@ keymap { compatible = "zmk,keymap"; - default_layer { -// -------------------------------------------------------------------------------------------------------------------------------------------------------------------- -// | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ | -// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' | -// | SHIFT | Z | X | C | V | B | CTRL+A | CTRL+C | | CTRL+V | CTRL+X | N | M | , | . | / | R CTRL | -// | GUI | DEL | RETURN | SPACE | ESCAPE | | RETURN | SPACE | TAB | BSPC | R ALT | + default_layer { // Layer 0 +// ---------------------------------------------- +// | Z | M | K | +// | &mo 1 | LEFT SHIFT | &mo 2 | bindings = < - &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH - &kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT - &kp LSHIFT &kp Z &kp X &kp C &kp V &kp B &kp LC(A) &kp LC(C) &kp LC(V) &kp LC(X) &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RCTRL - &kp LGUI &kp DEL &kp RET &kp SPACE &kp ESC &kp RET &kp SPACE &kp TAB &kp BSPC &kp RALT + &kp Z &kp M &kp K + &mo 1 &kp LSHIFT &mo 2 + >; + }; + abc { // Layer 1 +// ---------------------------------------------- +// | A | B | C | +// | &trans | &trans | &trans | + bindings = < + &kp A &kp B &kp C + &trans &trans &trans + >; + }; + xyz { // Layer 2 +// ---------------------------------------------- +// | X | Y | Z | +// | LEFT CTRL | LEFT ALT | &trans | + bindings = < + &kp X &kp Y &kp Z + &kp LCTRL &kp LALT &trans >; - - sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>; }; }; ``` diff --git a/docs/docs/troubleshooting.md b/docs/docs/troubleshooting.md deleted file mode 100644 index 2e9ab4dc..00000000 --- a/docs/docs/troubleshooting.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -title: Troubleshooting -sidebar_title: Troubleshooting ---- - -The following page provides suggestions for common errors that may occur during firmware compilation or other issues with keyboard usage. If the information provided is insufficient to resolve the issue, feel free to seek out help from the [ZMK Discord](https://zmk.dev/community/discord/invite). - -Please also see [the troubleshooting section](features/bluetooth.md#troubleshooting) under the Bluetooth feature page for issues related to bluetooth. - -### File Transfer Error - -Variations of the warnings shown below occur when flashing the `.uf2` onto the microcontroller. This is because the microcontroller resets itself before the OS receives confirmation that the file transfer is complete. Errors like this are normal and can generally be ignored. Verification of a functional board can be done by attempting to pair your newly flashed keyboard to your computer via Bluetooth or plugging in a USB cable if `ZMK_USB` is enabled in your Kconfig.defconfig. - -| ![Example Error Screen](../docs/assets/troubleshooting/filetransfer/windows.png) | -| :------------------------------------------------------------------------------: | -| An example of the file transfer error on Windows 10 | - -| ![Example Error Screen](../docs/assets/troubleshooting/filetransfer/linux.png) | -| :----------------------------------------------------------------------------: | -| An example of the file transfer error on Linux | - -| ![Example Error Screen](../docs/assets/troubleshooting/filetransfer/mac.png) | -| :--------------------------------------------------------------------------: | -| An example of the file transfer error on macOS | - -### macOS Ventura error - -macOS 13.0 (Ventura) Finder may report an error code 100093 when copying `.uf2` files into microcontrollers. This bug is limited to the operating system's Finder. You can work around it by copying on Terminal command line or use a third party file manager. Issue is fixed in macOS version 13.1. - -### macOS Sonoma error - -macOS 14.x (Sonoma) Finder may report an "Error code -36" when copying `.uf2` files into microcontrollers. A similar "fcopyfile failed: Input/output error" will also be reported when copying is performed using Terminal command line. These errors can be ignored because they are reported when the bootloader disconnects automatically after the uf2 file is copied successfully. - -### CMake Error - -An error along the lines of `CMake Error at (zmk directory)/zephyr/cmake/generic_toolchain.cmake:64 (include): include could not find load file:` during firmware compilation indicates that the Zephyr Environment Variables are not properly defined. -For more information, see [toolchain setup documentation](../docs/development/setup.mdx). - -### West Build Errors - -West build errors usually indicate syntax problems in the `.keymap` file during the compilation process. The following are some examples and root causes. - -:::note -If you are reviewing these errors in the GitHub Actions tab, they can be found in the `West Build` step of the build process. -::: - -#### Keymap error - -If you get an error stating `Keymap node not found, check a keymap is available and is has compatible = "zmk,keymap" set` this is an indication that the build process cannot find the keymap. Double check that the `.keymap` file is present and has been discovered by the build process. This can be checked by looking for a line in the build log stating `-- Using keymap file: /path/to/keymap/file/.keymap`. Inside the keymap file ensure the keymap node has `compatible = zmk,keymap` and it's not misspelled. For more information see the [Keymap](features/keymaps.mdx) and [Config](config/index.md) documentation. - -#### devicetree error - -A `devicetree error` followed by a reference to the line number on `.keymap` refers to an issue at the exact line position in that file. For example, below error message indicates a missing `;` at line 109 of the `cradio.keymap` file: - -``` -devicetree error: /__w/zmk-config/zmk-config/config/cradio.keymap:109 (column 4): parse error: expected ';' or ',' -``` - -A `devicetree error` followed by an `empty_file.c` reference with `lacks #binding-cells` string indicates possible problems with improper parameters for specific bindings: - -``` -devicetree error: lacks #binding-cells -``` - -This error can be triggered by incorrect binding syntax such as `&kp BT_SEL 0` instead of `&bt BT_SEL 0`. - -#### devicetree_unfixed.h error - -A `devicetree_unfixed.h` error that follows with an "undeclared here" string indicates a problem with key bindings, like behavior nodes (e.g. `&kp` or `&mt`) with incorrect number of parameters: - -``` -/__w/zmk-config/zmk-config/build/zephyr/include/generated/devicetree_unfixed.h:3756:145: error: 'DT_N_S_keymap_S_symbol_layer_P_bindings_IDX_12_PH_P_label' undeclared here (not in a function); did you mean 'DT_N_S_keymap_S_symbol_layer_P_bindings_IDX_16_PH'? -``` - -In this example, the error string `DT_N_S_keymap_S_symbol_layer_P_bindings_IDX_12_PH_P_label` indicates a problem with the key binding in position `12` in the `symbol_layer` of the keymap. - -:::info -Key positions are numbered starting from `0` at the top left key on the keymap, incrementing horizontally, row by row. -::: - -:::tip -A common mistake that leads to this error is to use [key press keycodes](behaviors/key-press.md) without the leading `&kp` binding. That is, having entries such as `SPACE` that should have been `&kp SPACE`. -::: - -### Split Keyboard Halves Unable to Pair - -Split keyboard halves will automatically pair with one another, but there are some cases where this breaks, and the pairing needs to be reset, for example: - -- Switching which halves are the central/peripheral. -- Replacing the controller for one of the halves. - -These issues can be resolved by flashing a settings reset firmware to both controllers. - -:::warning - -This procedure will erase all settings, such as Bluetooth profiles, output selection, RGB underglow color, etc. - -::: - -First, acquire the reset UF2 image file with one of the following options: - -#### Option 1: Build Reset UF2 in 'zmk-config' - -Find the `build.yaml` file in your `zmk-config` folder and add an additional settings reset build for the board used by your split keyboard. For example assuming that the config repo is setup for nice!nano v2 with Corne, append the `settings_reset` shield to the `build.yaml` file as follows: - -```yml -include: - - board: nice_nano_v2 - shield: corne_left - - board: nice_nano_v2 - shield: corne_right - - board: nice_nano_v2 - shield: settings_reset -``` - -Save the file, commit the changes and push them to GitHub. Download the new firmware zip file build by the latest GitHub Actions job. In it you will find an additional `settings_reset` UF2 image file. - -#### Option 2: Download Reset UF2 from ZMK's Workflow - -1. [Open the GitHub `Actions` tab and select the `Build` workflow](https://github.com/zmkfirmware/zmk/actions?query=workflow%3ABuild+branch%3Amain+event%3Apush). -1. Find one of the 'results' for which the core-coverage job was successfully run, indicated by a green checkmark in the core-coverage bubble like the image example below. -1. From the next page under "Artifacts", download and unzip the `-settings_reset-zmk` zip file for the UF2 image. - -| ![Successful core-coverage Job](../docs/assets/troubleshooting/splitpairing/corecoverage.png) | -| :-------------------------------------------------------------------------------------------: | -| An example of a successful core-coverage job which will produce a settings_reset firmware. | - -#### Reset Split Keyboard Procedure - -Perform the following steps to reset both halves of your split keyboard: - -1. Put each half of the split keyboard into bootloader mode. -1. Flash one of the halves of the split with the downloaded settings reset UF2 image. -1. Repeat step 2 with the other half of the split keyboard. -1. Flash the actual image for each half of the split keyboard (e.g `my_board_left.uf2` to the left half, `my_board_right.uf2` to the right half). - -After completing these steps, pair the halves of the split keyboard together by resetting them at the same time. Most commonly, this is done by grounding the reset pins for each of your keyboard's microcontrollers or pressing the reset buttons at the same time. - -Once this is done, you can remove/forget the keyboard on each host device and pair it again. - -:::info - -The settings reset firmware has Bluetooth disabled to prevent the two sides from automatically re-pairing until you are done resetting them both. You will not be able to pair your keyboard or see it in any Bluetooth device lists until you have flashed the normal firmware again. - -::: diff --git a/docs/docs/troubleshooting/building-issues.md b/docs/docs/troubleshooting/building-issues.md new file mode 100644 index 00000000..5ea52611 --- /dev/null +++ b/docs/docs/troubleshooting/building-issues.md @@ -0,0 +1,62 @@ +--- +title: Building Issues +sidebar_label: Building Issues +description: Troubleshooting issues when compiling ZMK firmware. +--- + +## CMake Error + +An error along the lines of `CMake Error at (zmk directory)/zephyr/cmake/generic_toolchain.cmake:64 (include): include could not find load file:` during firmware compilation indicates that the Zephyr Environment Variables are not properly defined. +For more information, see [Zephyr's CMake Package](https://docs.zephyrproject.org/3.5.0/build/zephyr_cmake_package.html). + +## West Build Errors + +West build errors usually indicate syntax problems in the `.keymap` file during the compilation process. The following are some examples and root causes. + +:::note +If you are reviewing these errors in the GitHub Actions tab, they can be found in the `West Build` step of the build process. +::: + +### Keymap Error + +If you get an error stating `Keymap node not found, check a keymap is available and is has compatible = "zmk,keymap" set` this is an indication that the build process cannot find the keymap. Double check that the `.keymap` file is present and has been discovered by the build process. This can be checked by looking for a line in the build log stating `-- Using keymap file: /path/to/keymap/file/.keymap`. Inside the keymap file ensure the keymap node has `compatible = zmk,keymap` and it's not misspelled. For more information see the [Keymap](features/keymaps.mdx) and [Config](config/index.md) documentation. + +### Devicetree Errors + +#### "parse error" + +A `devicetree error` followed by a reference to the line number on `.keymap` refers to an issue at the exact line position in that file. For example, below error message indicates a missing `;` at line 109 of the `cradio.keymap` file: + +``` +devicetree error: /__w/zmk-config/zmk-config/config/cradio.keymap:109 (column 4): parse error: expected ';' or ',' +``` + +Note that the provided number for the column corresponds to the numbering after the preprocessor expansion and it will likely not match the column numbers in your keymap. + +#### "lacks #binding-cells" + +A `devicetree error` followed by an `empty_file.c` reference with `lacks #binding-cells` string indicates possible problems with improper parameters for specific bindings: + +``` +devicetree error: lacks #binding-cells +``` + +This error can be triggered by incorrect binding syntax such as `&kp BT_SEL 0` instead of `&bt BT_SEL 0`. + +#### "devicetree_generated.h[...] undeclared here" + +A `devicetree_generated.h` error that follows with an "undeclared here" string indicates a problem with key bindings, like behavior nodes (e.g. `&kp` or `&mt`) with incorrect number of parameters: + +``` +/__w/zmk-config/zmk-config/build/zephyr/include/generated/devicetree_generated.h:3756:145: error: 'DT_N_S_keymap_S_symbol_layer_P_bindings_IDX_12_PH_P_label' undeclared here (not in a function); did you mean 'DT_N_S_keymap_S_symbol_layer_P_bindings_IDX_16_PH'? +``` + +In this example, the error string `DT_N_S_keymap_S_symbol_layer_P_bindings_IDX_12_PH_P_label` indicates a problem with the key binding in position `12` in the `symbol_layer` of the keymap. + +:::info +Key positions are numbered starting from `0` at the top left key on the keymap, incrementing horizontally, row by row. +::: + +:::tip +A common mistake that leads to this error is to use [key press keycodes](behaviors/key-press.md) without the leading `&kp` binding. That is, having entries such as `SPACE` that should have been `&kp SPACE`. +::: diff --git a/docs/docs/troubleshooting/connection-issues.mdx b/docs/docs/troubleshooting/connection-issues.mdx new file mode 100644 index 00000000..19d9f441 --- /dev/null +++ b/docs/docs/troubleshooting/connection-issues.mdx @@ -0,0 +1,167 @@ +--- +title: Connection Issues +sidebar_label: Connection Issues +description: Troubleshooting wireless connection issues of ZMK devices. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +export const Uf2Tabs = (props) => ( + + {/* eslint-disable-next-line */} + {props.children} + + +); + +:::tip +[USB logging](../development/usb-logging.mdx) can be very helpful for diagnosing issues with ZMK. However, when connected to USB your ZMK device will output to USB by default. To troubleshoot wireless connection issues using logging, you will need to [change the preferred output endpoint](../behaviors/outputs.md). +::: + +## Split Keyboard Halves Unable to Pair + +[Split keyboard](../features/split-keyboards.md) halves will automatically pair with one another, but there are some cases where this breaks, and the pairing needs to be reset, for example: + +- Switching which halves are the central/peripheral. +- Replacing the controller for one of the halves. + +These issues can be resolved by flashing a settings reset firmware to both controllers. + +:::warning + +This procedure will erase all settings, such as Bluetooth profiles, output selection, RGB underglow color, etc. + +::: + +### Acquiring a Reset UF2 + +First, acquire the reset UF2 image file with one of the following options: + + + + +Find the `build.yaml` file in your `zmk-config` folder and add an additional settings reset build for the board used by your split keyboard. For example assuming that the config repo is setup for nice!nano v2 with Corne, append the `settings_reset` shield to the `build.yaml` file as follows: + +```yml +include: + - board: nice_nano_v2 + shield: corne_left + - board: nice_nano_v2 + shield: corne_right + - board: nice_nano_v2 + shield: settings_reset +``` + +Save the file, commit the changes and push them to GitHub. Download the new firmware zip file build by the latest GitHub Actions job. In it you will find an additional `settings_reset` UF2 image file. + + + + +1. [Open the `Build` workflow](https://github.com/zmkfirmware/zmk/actions/workflows/build.yml?query=event%3Apush+branch%3Amain+is%3Asuccess) from the `Actions` tab of the ZMK GitHub repository. +1. Find one of the results for which the `core-coverage` job ran successfully, indicated by a green checkmark in the "core-coverage" bubble like the image example below. +1. From the next page under "Artifacts", download and unzip the `-settings_reset-zmk` zip file for the UF2 image. + +| ![Successful core-coverage Job](../../docs/assets/troubleshooting/splitpairing/corecoverage.png) | +| :----------------------------------------------------------------------------------------------: | +| An example of a successful core-coverage job which will produce a settings_reset firmware. | + + + + +### Reset Split Keyboard Procedure + +Perform the following steps to reset **_both_** halves of your split keyboard: + +1. Put each half of the split keyboard into bootloader mode. +1. Flash one of the halves of the split with the downloaded settings reset UF2 image. +1. Repeat step 2 with the other half of the split keyboard. +1. Flash the actual image for each half of the split keyboard (e.g `my_board_left.uf2` to the left half, `my_board_right.uf2` to the right half). + +After completing these steps, pair the halves of the split keyboard together by resetting them at the same time. Most commonly, this is done by grounding the reset pins for each of your keyboard's microcontrollers or pressing the reset buttons at the same time. + +Once this is done, you can remove/forget the keyboard on each host device and pair it again. + +:::info + +The settings reset firmware has Bluetooth disabled to prevent the two sides from automatically re-pairing until you are done resetting them both. You will not be able to pair your keyboard or see it in any Bluetooth device lists until you have flashed the normal firmware again. + +::: + +## Unable to Connect to Device + +### Additional Bluetooth Options + +Some devices and operating systems may have additional restrictions that they require be met before allowing a bluetooth peripheral to pair with them. If your keyboard is visible to your host but you are having issues trouble connecting or no input is registered, this might be the cause. Some of ZMK's [experimental bluetooth settings](../config/bluetooth.md) may suffice to resolve the issue. In particular: + +- Disabling PHY 2Mbps ([`CONFIG_BT_CTLR_PHY_2M=n`](https://docs.zephyrproject.org/3.5.0/kconfig.html#CONFIG_BT_CTLR_PHY_2M)) helps to pair and connect for certain wireless chipset firmware versions, particularly on Windows (Realtek and Intel chips) and older Intel Macs with Broadcom chipsets. +- Enabling passkey entry ([`CONFIG_ZMK_BLE_PASSKEY_ENTRY=y`](../config/bluetooth.md)) helps for certain Windows computers (work-managed ones in particular). This may also manifest in not sending keystrokes. + +### Issues With Dual Boot Setups + +Since ZMK associates pairing/bond keys with hardware addresses of hosts, you cannot pair to two different operating systems in a dual boot system at the same time. +While you can find [documented workarounds](https://wiki.archlinux.org/title/bluetooth#Dual_boot_pairing) that involve copying pairing keys across operating systems and use both OS with a single profile, they can be fairly involved and should be followed with caution. + +### Mitigating a Faulty Oscillator + +Rarely, due to a manufacturing error, a device may have a faulty oscillator. This prevents it from functioning correctly wirelessly and can be difficult to diagnose. Some microcontrollers such as the `nRF52840` allow for the usage of an internal oscillator instead of an external one. This results in increased power draw but can be a solution if your device does indeed have a faulty oscillator. + +For the `nRF52840`, the flag to set to use the internal oscillator is: + +``` +CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y +``` + +Other microcontrollers may have similar configuration options [found in the Zephyr documentation](https://docs.zephyrproject.org/3.5.0/search.html?q=CONFIG_CLOCK_CONTROL&check_keywords=yes&area=default). Do note that not all microcontrollers allow for the use of an internal oscillator, though. + +## Issues While Connected + +### Unreliable/Weak Connection + +Some users may experience a poor connection between the keyboard and the host. This might be due to poor quality BLE hardware, a metal enclosure on the keyboard or host, or the distance between them. Increasing the transmit power of the keyboard's BLE radio may reduce the severity of this problem. To do this, set the `CONFIG_BT_CTLR_TX_PWR_PLUS_8` configuration value in the `.conf` file of your user config directory as such: + +```ini +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y +``` + +For the `nRF52840`, the value `PLUS_8` can be set to any multiple of four between `MINUS_20` and `PLUS_8`. The default value for this config is `0`, but if you are having connection issues it is recommended to set it to `PLUS_8` because the power consumption difference is negligible. For more information on changing the transmit power of your BLE device, please refer to [the Zephyr docs.](https://docs.zephyrproject.org/3.5.0/kconfig.html#CONFIG_BT_CTLR_TX_PWR) + +:::info +This setting can also improve the connection strength between the keyboard halves for split keyboards. +::: + +### Using Bluetooth Output With USB Power + +If you want to test Bluetooth output on your keyboard and are powering it through the USB connection rather than a battery, you will be able to pair with a host device but may not see keystrokes sent. In this case you need to use the [output selection behavior](../behaviors/outputs.md) to prefer sending keystrokes over Bluetooth rather than USB. This might be necessary even if you are not powering from a device capable of receiving USB inputs, such as a USB charger. + +### macOS Connected but Not Working + +If you attempt to pair a ZMK keyboard from macOS in a way that causes a bonding issue, macOS may report the keyboard as connected, but fail to actually work. If this occurs: + +1. Remove the keyboard from macOS using the Bluetooth control panel. +1. Invoke `&bt BT_CLR` on the keyboard while the profile associated with the macOS device is active, by pressing the correct keys for your particular keymap. +1. Try connecting again from macOS. + +### Windows Connected but Not Working + +Occasionally pairing the keyboard to a Windows device might result in a state where the keyboard is connected but does not send any key strokes. +If this occurs: + +1. Remove the keyboard from Windows using the Bluetooth settings. +1. Invoke `&bt BT_CLR` on the keyboard while the profile associated with the Windows device is active, by pressing the correct keys for your particular keymap. +1. Turn off Bluetooth from Windows settings, then turn it back on. +1. Pair the keyboard to the Windows device. + +If this doesn't help, try following the procedure above but replace step 3 with one of the following: + +- Restart the Windows device +- Open "Device Manager," turn on "Show hidden devices" from the "View" menu, then find and delete the keyboard under the "Bluetooth" item + +Some Windows devices may also require passkey entry, described under ["Unable to Connect to Device"](#unable-to-connect-to-device). diff --git a/docs/docs/troubleshooting/flashing-issues.md b/docs/docs/troubleshooting/flashing-issues.md new file mode 100644 index 00000000..699555d5 --- /dev/null +++ b/docs/docs/troubleshooting/flashing-issues.md @@ -0,0 +1,29 @@ +--- +title: Flashing Issues +sidebar_label: Flashing Issues +description: Troubleshooting issues when flashing ZMK firmware to devices. +--- + +## File Transfer Error + +Variations of the warnings shown below occur when flashing the `.uf2` onto the microcontroller. This is because the microcontroller resets itself before the OS receives confirmation that the file transfer is complete. Errors like this are normal and can generally be ignored. Verification of a functional board can be done by attempting to pair your newly flashed keyboard to your computer via Bluetooth or plugging in a USB cable if `ZMK_USB` is enabled in your Kconfig.defconfig. + +| ![Example Error Screen](../../docs/assets/troubleshooting/filetransfer/windows.png) | +| :---------------------------------------------------------------------------------: | +| An example of the file transfer error on Windows 10 | + +| ![Example Error Screen](../../docs/assets/troubleshooting/filetransfer/linux.png) | +| :-------------------------------------------------------------------------------: | +| An example of the file transfer error on Linux | + +| ![Example Error Screen](../../docs/assets/troubleshooting/filetransfer/mac.png) | +| :-----------------------------------------------------------------------------: | +| An example of the file transfer error on macOS | + +## macOS Ventura Error + +macOS 13.0 (Ventura) Finder may report an error code 100093 when copying `.uf2` files into microcontrollers. This bug is limited to the operating system's Finder. You can work around it by copying on Terminal command line or use a third party file manager. Issue is fixed in macOS version 13.1. + +## macOS Sonoma Error + +macOS 14.x (Sonoma) Finder may report an "Error code -36" when copying `.uf2` files into microcontrollers. A similar "fcopyfile failed: Input/output error" will also be reported when copying is performed using Terminal command line. These errors can be ignored because they are reported when the bootloader disconnects automatically after the uf2 file is copied successfully. diff --git a/docs/docs/troubleshooting/index.mdx b/docs/docs/troubleshooting/index.mdx new file mode 100644 index 00000000..45a93191 --- /dev/null +++ b/docs/docs/troubleshooting/index.mdx @@ -0,0 +1,10 @@ +--- +title: Troubleshooting +sidebar_label: Troubleshooting +--- + +import DocCardList from "@theme/DocCardList"; + +The following pages provide suggestions for common errors that may occur while setting up or using devices running ZMK. If the information provided is insufficient to resolve an issue, feel free to seek out additional help from the [ZMK Discord](https://zmk.dev/community/discord/invite). + + diff --git a/docs/docs/user-setup.mdx b/docs/docs/user-setup.mdx index 355fc51d..a79a2956 100644 --- a/docs/docs/user-setup.mdx +++ b/docs/docs/user-setup.mdx @@ -177,9 +177,9 @@ push the initial commit. ::: -## Installing The Firmware +## Installing the Firmware -### Download The Archive +### Download the Archive Once the setup script is complete and the new user config repository has been pushed, GitHub will automatically run the action to build your keyboard firmware files. You can view the actions by clicking on the "Actions" tab on your GitHub repository. @@ -209,6 +209,7 @@ connect to it wirelessly. For split keyboards, only the central half (typically the left side) will send keyboard outputs over USB or advertise to other devices over bluetooth. Peripheral half will only send keystrokes to the central once they are paired and connected. For this reason it is recommended to test the left half of a split keyboard first. +Please refer to [split keyboards documentation](features/split-keyboards.md) for more information. ::: @@ -221,11 +222,12 @@ ZMK supports multiple BLE “profiles”, which allows you to connect to and swi ### Connecting Split Keyboard Halves For split keyboards, after flashing each half individually you can connect them together by resetting them at the same time. Within a few seconds of resetting, both halves should automatically connect to each other. +Please refer to [the pairing section in the split keyboards documentation](features/split-keyboards.md#pairing-for-wireless-split-keyboards) for more information. :::note If you have issues connecting the halves, make sure that both sides are getting powered properly through USB or batteries, then follow the -[recommended troubleshooting procedure](troubleshooting.md#split-keyboard-halves-unable-to-pair). This is typically necessary if you +[recommended troubleshooting procedure](troubleshooting/connection-issues.mdx#split-keyboard-halves-unable-to-pair). This is typically necessary if you swapped firmware sides between controllers, like flashing left side firmware to the same controller after flashing the right, or vice versa. ::: diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index c9a07179..ae26fd43 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -12,6 +12,7 @@ module.exports = { organizationName: "zmkfirmware", // Usually your GitHub org/user name. projectName: "zmk", // Usually your repo name. plugins: [ + "@docusaurus/theme-mermaid", path.resolve(__dirname, "src/docusaurus-tree-sitter-plugin"), path.resolve(__dirname, "src/hardware-metadata-collection-plugin"), path.resolve(__dirname, "src/hardware-metadata-static-plugin"), @@ -31,6 +32,7 @@ module.exports = { "linker-script", "log", "powershell", + "diff", ], theme, darkTheme, @@ -79,7 +81,7 @@ module.exports = { }, { label: "Development", - to: "docs/development/setup/", + to: "docs/development/setup", }, ], }, @@ -163,6 +165,7 @@ module.exports = { ], ], markdown: { + mermaid: true, mdx1Compat: { comments: false, admonitions: false, diff --git a/docs/package-lock.json b/docs/package-lock.json index 3c76a963..e4009e20 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@docusaurus/core": "^3.0.0", "@docusaurus/preset-classic": "^3.0.0", + "@docusaurus/theme-mermaid": "^3.0.0", "@fortawesome/fontawesome-svg-core": "^6.4.2", "@fortawesome/free-solid-svg-icons": "^6.4.0", "@fortawesome/react-fontawesome": "^0.2.0", @@ -33,7 +34,7 @@ "@types/react-router-dom": "^5.1.7", "eslint": "^8.39.0", "eslint-config-prettier": "^8.8.0", - "eslint-plugin-mdx": "^2.0.5", + "eslint-plugin-mdx": "^3.1.5", "eslint-plugin-react": "^7.33.2", "json-schema-to-typescript": "^13.1.1", "mustache": "^4.2.0", @@ -2156,6 +2157,11 @@ "url": "https://github.com/sponsors/philsturgeon" } }, + "node_modules/@braintree/sanitize-url": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-6.0.4.tgz", + "integrity": "sha512-s3jaWicZd0pkP0jf5ysyHUI/RE7MHos6qlToFcGWXVp+ykHOy77OUMrfbgJ9it2C5bow7OIQwYYaHjk9XlBQ2A==" + }, "node_modules/@colors/colors": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", @@ -2667,6 +2673,27 @@ "react-dom": "^18.0.0" } }, + "node_modules/@docusaurus/theme-mermaid": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-mermaid/-/theme-mermaid-3.1.0.tgz", + "integrity": "sha512-63y08fvRWIe9satRV1e/Dps9he+sPjQ+kwl4ccQQEzkM2nxeAgWwk8WzpbVhm1Pf02N/11y0C6FcvFqn4dERHA==", + "dependencies": { + "@docusaurus/core": "3.1.0", + "@docusaurus/module-type-aliases": "3.1.0", + "@docusaurus/theme-common": "3.1.0", + "@docusaurus/types": "3.1.0", + "@docusaurus/utils-validation": "3.1.0", + "mermaid": "^10.4.0", + "tslib": "^2.6.0" + }, + "engines": { + "node": ">=18.0" + }, + "peerDependencies": { + "react": "^18.0.0", + "react-dom": "^18.0.0" + } + }, "node_modules/@docusaurus/theme-search-algolia": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@docusaurus/theme-search-algolia/-/theme-search-algolia-3.1.0.tgz", @@ -3195,37 +3222,111 @@ } }, "node_modules/@npmcli/config": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@npmcli/config/-/config-6.4.0.tgz", - "integrity": "sha512-/fQjIbuNVIT/PbXvw178Tm97bxV0E0nVUFKHivMKtSI2pcs8xKdaWkHJxf9dTI0G/y5hp/KuCvgcUu5HwAtI1w==", + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/@npmcli/config/-/config-8.3.4.tgz", + "integrity": "sha512-01rtHedemDNhUXdicU7s+QYz/3JyV5Naj84cvdXGH4mgCdL+agmSYaLF4LUG4vMCLzhBO8YtS0gPpH1FGvbgAw==", "dev": true, "dependencies": { "@npmcli/map-workspaces": "^3.0.2", - "ci-info": "^3.8.0", - "ini": "^4.1.0", - "nopt": "^7.0.0", - "proc-log": "^3.0.0", - "read-package-json-fast": "^3.0.2", + "@npmcli/package-json": "^5.1.1", + "ci-info": "^4.0.0", + "ini": "^4.1.2", + "nopt": "^7.2.1", + "proc-log": "^4.2.0", "semver": "^7.3.5", "walk-up-path": "^3.0.1" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/config/node_modules/ci-info": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz", + "integrity": "sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" } }, "node_modules/@npmcli/config/node_modules/ini": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz", - "integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.3.tgz", + "integrity": "sha512-X7rqawQBvfdjS10YU1y1YVreA3SsLrW9dX2CewP2EbBJM4ypVNLDkO5y04gejPwKIY9lR+7r9gn3rFPt/kmWFg==", "dev": true, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/@npmcli/git": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-5.0.8.tgz", + "integrity": "sha512-liASfw5cqhjNW9UFd+ruwwdEf/lbOAQjLL2XY2dFW/bkJheXDYZgOyul/4gVvEV4BWkTXjYGmDqMw9uegdbJNQ==", + "dev": true, + "dependencies": { + "@npmcli/promise-spawn": "^7.0.0", + "ini": "^4.1.3", + "lru-cache": "^10.0.1", + "npm-pick-manifest": "^9.0.0", + "proc-log": "^4.0.0", + "promise-inflight": "^1.0.1", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^4.0.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/git/node_modules/ini": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.3.tgz", + "integrity": "sha512-X7rqawQBvfdjS10YU1y1YVreA3SsLrW9dX2CewP2EbBJM4ypVNLDkO5y04gejPwKIY9lR+7r9gn3rFPt/kmWFg==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/git/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/@npmcli/git/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, + "node_modules/@npmcli/git/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dev": true, + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, "node_modules/@npmcli/map-workspaces": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-3.0.4.tgz", - "integrity": "sha512-Z0TbvXkRbacjFFLpVpV0e2mheCh+WzQpcqL+4xp49uNJOxOnIAPZyXtUxZ5Qn3QBTGKA11Exjd9a5411rBrhDg==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-3.0.6.tgz", + "integrity": "sha512-tkYs0OYnzQm6iIRdfy+LcLBjcKuQCeE5YLb8KnrIlutJfheNaPvPpgoFEyEFgbjzl5PLZ3IA/BWAwRU0eHuQDA==", "dev": true, "dependencies": { "@npmcli/name-from-folder": "^2.0.0", @@ -3247,31 +3348,29 @@ } }, "node_modules/@npmcli/map-workspaces/node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/@npmcli/map-workspaces/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -3292,6 +3391,113 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/@npmcli/package-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-5.2.0.tgz", + "integrity": "sha512-qe/kiqqkW0AGtvBjL8TJKZk/eBBSpnJkUWvHdQ9jM2lKHXRYYJuyNpJPlJw3c8QjC2ow6NZYiLExhUaeJelbxQ==", + "dev": true, + "dependencies": { + "@npmcli/git": "^5.0.0", + "glob": "^10.2.2", + "hosted-git-info": "^7.0.0", + "json-parse-even-better-errors": "^3.0.0", + "normalize-package-data": "^6.0.0", + "proc-log": "^4.0.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/package-json/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@npmcli/package-json/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@npmcli/package-json/node_modules/json-parse-even-better-errors": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.2.tgz", + "integrity": "sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/package-json/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@npmcli/promise-spawn": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-7.0.2.tgz", + "integrity": "sha512-xhfYPXoV5Dy4UkY0D+v2KkwvnDfiA/8Mt3sWCGI/hM03NsYIH8ZaG6QzS9x7pje5vHZBZJ2v6VRFVTWACnqcmQ==", + "dev": true, + "dependencies": { + "which": "^4.0.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/promise-spawn/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/@npmcli/promise-spawn/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dev": true, + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -3303,9 +3509,9 @@ } }, "node_modules/@pkgr/core": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.0.tgz", - "integrity": "sha512-Zwq5OCzuwJC2jwqmpEQt7Ds1DTi6BWSwoGkbb1n9pO3hzb35BoJELx7c0T23iDkBGkh2e7tvOtjF3tr3OaQHDQ==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", "dev": true, "engines": { "node": "^12.20.0 || ^14.18.0 || >=16.0.0" @@ -3726,6 +3932,24 @@ "@types/node": "*" } }, + "node_modules/@types/d3-scale": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.8.tgz", + "integrity": "sha512-gkK1VVTr5iNiYJ7vWDI+yUFFlszhNMtVeneJ6lUTKPjprsvLLI9/tgEGiXJOnlINJA8FyA88gfnQsHbybVZrYQ==", + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-scale-chromatic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.0.3.tgz", + "integrity": "sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw==" + }, + "node_modules/@types/d3-time": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.3.tgz", + "integrity": "sha512-2p6olUZ4w3s+07q3Tm2dbiMZy5pCDfYwtLXXHUnVzXgQlZ/OyPtUz6OL382BkOuGlLXqfT+wqv8Fw2v8/0geBw==" + }, "node_modules/@types/debug": { "version": "4.1.12", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", @@ -3886,7 +4110,6 @@ "version": "3.0.15", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.15.tgz", "integrity": "sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==", - "dev": true, "dependencies": { "@types/unist": "^2" } @@ -3894,8 +4117,7 @@ "node_modules/@types/mdast/node_modules/@types/unist": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", - "dev": true + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" }, "node_modules/@types/mdx": { "version": "2.0.10", @@ -4897,11 +5119,11 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -5673,6 +5895,14 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, + "node_modules/cose-base": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cose-base/-/cose-base-1.0.3.tgz", + "integrity": "sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg==", + "dependencies": { + "layout-base": "^1.0.0" + } + }, "node_modules/cosmiconfig": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", @@ -5978,6 +6208,25 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, + "node_modules/cytoscape": { + "version": "3.30.0", + "resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.30.0.tgz", + "integrity": "sha512-l590mjTHT6/Cbxp13dGPC2Y7VXdgc+rUeF8AnF/JPzhjNevbDJfObnJgaSjlldOgBQZbue+X6IUZ7r5GAgvauQ==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/cytoscape-cose-bilkent": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cytoscape-cose-bilkent/-/cytoscape-cose-bilkent-4.1.0.tgz", + "integrity": "sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ==", + "dependencies": { + "cose-base": "^1.0.0" + }, + "peerDependencies": { + "cytoscape": "^3.2.0" + } + }, "node_modules/d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", @@ -5988,6 +6237,444 @@ "type": "^1.0.1" } }, + "node_modules/d3": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/d3/-/d3-7.9.0.tgz", + "integrity": "sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==", + "dependencies": { + "d3-array": "3", + "d3-axis": "3", + "d3-brush": "3", + "d3-chord": "3", + "d3-color": "3", + "d3-contour": "4", + "d3-delaunay": "6", + "d3-dispatch": "3", + "d3-drag": "3", + "d3-dsv": "3", + "d3-ease": "3", + "d3-fetch": "3", + "d3-force": "3", + "d3-format": "3", + "d3-geo": "3", + "d3-hierarchy": "3", + "d3-interpolate": "3", + "d3-path": "3", + "d3-polygon": "3", + "d3-quadtree": "3", + "d3-random": "3", + "d3-scale": "4", + "d3-scale-chromatic": "3", + "d3-selection": "3", + "d3-shape": "3", + "d3-time": "3", + "d3-time-format": "4", + "d3-timer": "3", + "d3-transition": "3", + "d3-zoom": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-axis": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.0.tgz", + "integrity": "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-brush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz", + "integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "3", + "d3-transition": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-chord": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-3.0.1.tgz", + "integrity": "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==", + "dependencies": { + "d3-path": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-contour": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-4.0.2.tgz", + "integrity": "sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA==", + "dependencies": { + "d3-array": "^3.2.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-delaunay": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz", + "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==", + "dependencies": { + "delaunator": "5" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-drag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", + "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-selection": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dsv": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz", + "integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==", + "dependencies": { + "commander": "7", + "iconv-lite": "0.6", + "rw": "1" + }, + "bin": { + "csv2json": "bin/dsv2json.js", + "csv2tsv": "bin/dsv2dsv.js", + "dsv2dsv": "bin/dsv2dsv.js", + "dsv2json": "bin/dsv2json.js", + "json2csv": "bin/json2dsv.js", + "json2dsv": "bin/json2dsv.js", + "json2tsv": "bin/json2dsv.js", + "tsv2csv": "bin/dsv2dsv.js", + "tsv2json": "bin/dsv2json.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dsv/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "engines": { + "node": ">= 10" + } + }, + "node_modules/d3-dsv/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-fetch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-3.0.1.tgz", + "integrity": "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==", + "dependencies": { + "d3-dsv": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-force": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", + "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-quadtree": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-geo": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz", + "integrity": "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==", + "dependencies": { + "d3-array": "2.5.0 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-polygon": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.1.tgz", + "integrity": "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-quadtree": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", + "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-random": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-3.0.1.tgz", + "integrity": "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-sankey": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/d3-sankey/-/d3-sankey-0.12.3.tgz", + "integrity": "sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ==", + "dependencies": { + "d3-array": "1 - 2", + "d3-shape": "^1.2.0" + } + }, + "node_modules/d3-sankey/node_modules/d3-array": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz", + "integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==", + "dependencies": { + "internmap": "^1.0.0" + } + }, + "node_modules/d3-sankey/node_modules/d3-path": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz", + "integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==" + }, + "node_modules/d3-sankey/node_modules/d3-shape": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz", + "integrity": "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==", + "dependencies": { + "d3-path": "1" + } + }, + "node_modules/d3-sankey/node_modules/internmap": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz", + "integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==" + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale-chromatic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz", + "integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==", + "dependencies": { + "d3-color": "1 - 3", + "d3-interpolate": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-selection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", + "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", + "dependencies": { + "d3-color": "1 - 3", + "d3-dispatch": "1 - 3", + "d3-ease": "1 - 3", + "d3-interpolate": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "d3-selection": "2 - 3" + } + }, + "node_modules/d3-zoom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz", + "integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "2 - 3", + "d3-transition": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/dagre-d3-es": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/dagre-d3-es/-/dagre-d3-es-7.0.10.tgz", + "integrity": "sha512-qTCQmEhcynucuaZgY5/+ti3X/rnszKZhEQH/ZdWdtP1tA/y3VoHJzcVrO9pjjJCNpigfscAtoUB5ONcd2wNn0A==", + "dependencies": { + "d3": "^7.8.2", + "lodash-es": "^4.17.21" + } + }, + "node_modules/dayjs": { + "version": "1.11.11", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz", + "integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==" + }, "node_modules/debounce": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", @@ -6145,6 +6832,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/delaunator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.1.tgz", + "integrity": "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==", + "dependencies": { + "robust-predicates": "^3.0.2" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -6230,9 +6925,9 @@ } }, "node_modules/diff": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", - "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", "dev": true, "engines": { "node": ">=0.3.1" @@ -6318,6 +7013,11 @@ "url": "https://github.com/fb55/domhandler?sponsor=1" } }, + "node_modules/dompurify": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.5.tgz", + "integrity": "sha512-lwG+n5h8QNpxtyrJW/gJWckL+1/DQiYMX8f7t8Z2AZTPw1esVrqjI63i7Zc2Gz0aKzLVMYC1V1PL/ky+aY/NgA==" + }, "node_modules/domutils": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", @@ -6382,6 +7082,11 @@ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.630.tgz", "integrity": "sha512-osHqhtjojpCsACVnuD11xO5g9xaCyw7Qqn/C2KParkMv42i8jrJJgx3g7mkHfpxwhy9MnOJr8+pKOdZ7qzgizg==" }, + "node_modules/elkjs": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/elkjs/-/elkjs-0.9.3.tgz", + "integrity": "sha512-f/ZeWvW/BCXbhGEf1Ujp29EASo/lk1FDnETgNKwJrsVvGZhUWCZyg3xLJjAsxfOmt8KjswHmI5EwCQcPMpOYhQ==" + }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", @@ -6440,6 +7145,12 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -6719,28 +7430,28 @@ } }, "node_modules/eslint-mdx": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/eslint-mdx/-/eslint-mdx-2.3.3.tgz", - "integrity": "sha512-nD7K8pWuIrOmsAtUhJRABHdlX81ti5PiD1/2N5sD7gJysgsLKlu3BNHqN/rBlxdf0tjZt0/XAulJz+pguLlLAA==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/eslint-mdx/-/eslint-mdx-3.1.5.tgz", + "integrity": "sha512-ynztX0k7CQ3iDL7fDEIeg3g0O/d6QPv7IBI9fdYLhXp5fAp0fi8X22xF/D3+Pk0f90R27uwqa1clHpay6t0l8Q==", "dev": true, "dependencies": { - "acorn": "^8.10.0", + "acorn": "^8.11.3", "acorn-jsx": "^5.3.2", "espree": "^9.6.1", - "estree-util-visit": "^1.2.1", - "remark-mdx": "^2.3.0", - "remark-parse": "^10.0.2", - "remark-stringify": "^10.0.3", + "estree-util-visit": "^2.0.0", + "remark-mdx": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", "synckit": "^0.9.0", - "tslib": "^2.6.1", - "unified": "^10.1.2", - "unified-engine": "^10.1.0", - "unist-util-visit": "^4.1.2", + "tslib": "^2.6.2", + "unified": "^11.0.4", + "unified-engine": "^11.2.0", + "unist-util-visit": "^5.0.0", "uvu": "^0.5.6", - "vfile": "^5.3.7" + "vfile": "^6.0.1" }, "engines": { - "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + "node": ">=18.0.0" }, "funding": { "type": "opencollective", @@ -6750,945 +7461,6 @@ "eslint": ">=8.0.0" } }, - "node_modules/eslint-mdx/node_modules/@types/hast": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.9.tgz", - "integrity": "sha512-pTHyNlaMD/oKJmS+ZZUyFUcsZeBZpC0lmGquw98CqRVNgAdJZJeD7GoeLiT6Xbx5rU9VCjSt0RwEvDgzh4obFw==", - "dev": true, - "dependencies": { - "@types/unist": "^2" - } - }, - "node_modules/eslint-mdx/node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", - "dev": true - }, - "node_modules/eslint-mdx/node_modules/character-entities-legacy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", - "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-mdx/node_modules/character-reference-invalid": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", - "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-mdx/node_modules/estree-util-is-identifier-name": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-2.1.0.tgz", - "integrity": "sha512-bEN9VHRyXAUOjkKVQVvArFym08BTWB0aJPppZZr0UNyAqWsLaVfAqP7hbaTJjzHifmB5ebnR8Wm7r7yGN/HonQ==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/is-alphabetical": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", - "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-mdx/node_modules/is-alphanumerical": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", - "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", - "dev": true, - "dependencies": { - "is-alphabetical": "^2.0.0", - "is-decimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-mdx/node_modules/is-decimal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", - "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-mdx/node_modules/is-hexadecimal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", - "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-mdx/node_modules/mdast-util-from-markdown": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-1.3.1.tgz", - "integrity": "sha512-4xTO/M8c82qBcnQc1tgpNtubGUW/Y1tBQ1B0i5CtSoelOLKFYlElIr3bvgREYYO5iRqbMY1YuqZng0GVOI8Qww==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "decode-named-character-reference": "^1.0.0", - "mdast-util-to-string": "^3.1.0", - "micromark": "^3.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-decode-string": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "unist-util-stringify-position": "^3.0.0", - "uvu": "^0.5.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/mdast-util-mdx": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-2.0.1.tgz", - "integrity": "sha512-38w5y+r8nyKlGvNjSEqWrhG0w5PmnRA+wnBvm+ulYCct7nsGYhFVb0lljS9bQav4psDAS1eGkP2LMVcZBi/aqw==", - "dev": true, - "dependencies": { - "mdast-util-from-markdown": "^1.0.0", - "mdast-util-mdx-expression": "^1.0.0", - "mdast-util-mdx-jsx": "^2.0.0", - "mdast-util-mdxjs-esm": "^1.0.0", - "mdast-util-to-markdown": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/mdast-util-mdx-expression": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-1.3.2.tgz", - "integrity": "sha512-xIPmR5ReJDu/DHH1OoIT1HkuybIfRGYRywC+gJtI7qHjCJp/M9jrmBEJW22O8lskDWm562BX2W8TiAwRTb0rKA==", - "dev": true, - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^2.0.0", - "@types/mdast": "^3.0.0", - "mdast-util-from-markdown": "^1.0.0", - "mdast-util-to-markdown": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/mdast-util-mdx-jsx": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-2.1.4.tgz", - "integrity": "sha512-DtMn9CmVhVzZx3f+optVDF8yFgQVt7FghCRNdlIaS3X5Bnym3hZwPbg/XW86vdpKjlc1PVj26SpnLGeJBXD3JA==", - "dev": true, - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^2.0.0", - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "ccount": "^2.0.0", - "mdast-util-from-markdown": "^1.1.0", - "mdast-util-to-markdown": "^1.3.0", - "parse-entities": "^4.0.0", - "stringify-entities": "^4.0.0", - "unist-util-remove-position": "^4.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/mdast-util-mdxjs-esm": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-1.3.1.tgz", - "integrity": "sha512-SXqglS0HrEvSdUEfoXFtcg7DRl7S2cwOXc7jkuusG472Mmjag34DUDeOJUZtl+BVnyeO1frIgVpHlNRWc2gk/w==", - "dev": true, - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^2.0.0", - "@types/mdast": "^3.0.0", - "mdast-util-from-markdown": "^1.0.0", - "mdast-util-to-markdown": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/mdast-util-phrasing": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-3.0.1.tgz", - "integrity": "sha512-WmI1gTXUBJo4/ZmSk79Wcb2HcjPJBzM1nlI/OUWA8yk2X9ik3ffNbBGsU+09BFmXaL1IBb9fiuvq6/KMiNycSg==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/mdast-util-to-markdown": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-1.5.0.tgz", - "integrity": "sha512-bbv7TPv/WC49thZPg3jXuqzuvI45IL2EVAr/KxF0BSdHsU0ceFHOmwQn6evxAh1GaoK/6GQ1wp4R4oW2+LFL/A==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "longest-streak": "^3.0.0", - "mdast-util-phrasing": "^3.0.0", - "mdast-util-to-string": "^3.0.0", - "micromark-util-decode-string": "^1.0.0", - "unist-util-visit": "^4.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/mdast-util-to-string": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz", - "integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/micromark": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-3.2.0.tgz", - "integrity": "sha512-uD66tJj54JLYq0De10AhWycZWGQNUvDI55xPgk2sQM5kn1JYlhbCMTtEeT27+vAhW2FBQxLlOmS3pmA7/2z4aA==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "@types/debug": "^4.0.0", - "debug": "^4.0.0", - "decode-named-character-reference": "^1.0.0", - "micromark-core-commonmark": "^1.0.1", - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-chunked": "^1.0.0", - "micromark-util-combine-extensions": "^1.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-encode": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-resolve-all": "^1.0.0", - "micromark-util-sanitize-uri": "^1.0.0", - "micromark-util-subtokenize": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.1", - "uvu": "^0.5.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-core-commonmark": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-1.1.0.tgz", - "integrity": "sha512-BgHO1aRbolh2hcrzL2d1La37V0Aoz73ymF8rAcKnohLy93titmv62E0gP8Hrx9PKcKrqCZ1BbLGbP3bEhoXYlw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "decode-named-character-reference": "^1.0.0", - "micromark-factory-destination": "^1.0.0", - "micromark-factory-label": "^1.0.0", - "micromark-factory-space": "^1.0.0", - "micromark-factory-title": "^1.0.0", - "micromark-factory-whitespace": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-chunked": "^1.0.0", - "micromark-util-classify-character": "^1.0.0", - "micromark-util-html-tag-name": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-resolve-all": "^1.0.0", - "micromark-util-subtokenize": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.1", - "uvu": "^0.5.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-extension-mdx-expression": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-1.0.8.tgz", - "integrity": "sha512-zZpeQtc5wfWKdzDsHRBY003H2Smg+PUi2REhqgIhdzAa5xonhP03FcXxqFSerFiNUr5AWmHpaNPQTBVOS4lrXw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "@types/estree": "^1.0.0", - "micromark-factory-mdx-expression": "^1.0.0", - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-events-to-acorn": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "uvu": "^0.5.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-extension-mdx-jsx": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-1.0.5.tgz", - "integrity": "sha512-gPH+9ZdmDflbu19Xkb8+gheqEDqkSpdCEubQyxuz/Hn8DOXiXvrXeikOoBA71+e8Pfi0/UYmU3wW3H58kr7akA==", - "dev": true, - "dependencies": { - "@types/acorn": "^4.0.0", - "@types/estree": "^1.0.0", - "estree-util-is-identifier-name": "^2.0.0", - "micromark-factory-mdx-expression": "^1.0.0", - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "uvu": "^0.5.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-extension-mdx-md": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-md/-/micromark-extension-mdx-md-1.0.1.tgz", - "integrity": "sha512-7MSuj2S7xjOQXAjjkbjBsHkMtb+mDGVW6uI2dBL9snOBCbZmoNgDAeZ0nSn9j3T42UE/g2xVNMn18PJxZvkBEA==", - "dev": true, - "dependencies": { - "micromark-util-types": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-extension-mdxjs": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs/-/micromark-extension-mdxjs-1.0.1.tgz", - "integrity": "sha512-7YA7hF6i5eKOfFUzZ+0z6avRG52GpWR8DL+kN47y3f2KhxbBZMhmxe7auOeaTBrW2DenbbZTf1ea9tA2hDpC2Q==", - "dev": true, - "dependencies": { - "acorn": "^8.0.0", - "acorn-jsx": "^5.0.0", - "micromark-extension-mdx-expression": "^1.0.0", - "micromark-extension-mdx-jsx": "^1.0.0", - "micromark-extension-mdx-md": "^1.0.0", - "micromark-extension-mdxjs-esm": "^1.0.0", - "micromark-util-combine-extensions": "^1.0.0", - "micromark-util-types": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-extension-mdxjs-esm": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-1.0.5.tgz", - "integrity": "sha512-xNRBw4aoURcyz/S69B19WnZAkWJMxHMT5hE36GtDAyhoyn/8TuAeqjFJQlwk+MKQsUD7b3l7kFX+vlfVWgcX1w==", - "dev": true, - "dependencies": { - "@types/estree": "^1.0.0", - "micromark-core-commonmark": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-events-to-acorn": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "unist-util-position-from-estree": "^1.1.0", - "uvu": "^0.5.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-factory-destination": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-1.1.0.tgz", - "integrity": "sha512-XaNDROBgx9SgSChd69pjiGKbV+nfHGDPVYFs5dOoDd7ZnMAE+Cuu91BCpsY8RT2NP9vo/B8pds2VQNCLiu0zhg==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-factory-label": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-1.1.0.tgz", - "integrity": "sha512-OLtyez4vZo/1NjxGhcpDSbHQ+m0IIGnT8BoPamh+7jVlzLJBH98zzuCoUeMxvM6WsNeh8wx8cKvqLiPHEACn0w==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "uvu": "^0.5.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-factory-mdx-expression": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-1.0.9.tgz", - "integrity": "sha512-jGIWzSmNfdnkJq05c7b0+Wv0Kfz3NJ3N4cBjnbO4zjXIlxJr+f8lk+5ZmwFvqdAbUy2q6B5rCY//g0QAAaXDWA==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "@types/estree": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-events-to-acorn": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "unist-util-position-from-estree": "^1.0.0", - "uvu": "^0.5.0", - "vfile-message": "^3.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-factory-title": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-1.1.0.tgz", - "integrity": "sha512-J7n9R3vMmgjDOCY8NPw55jiyaQnH5kBdV2/UXCtZIpnHH3P6nHUKaH7XXEYuWwx/xUJcawa8plLBEjMPU24HzQ==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-factory-whitespace": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-1.1.0.tgz", - "integrity": "sha512-v2WlmiymVSp5oMg+1Q0N1Lxmt6pMhIHD457whWM7/GUlEks1hI9xj5w3zbc4uuMKXGisksZk8DzP2UyGbGqNsQ==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-util-chunked": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-1.1.0.tgz", - "integrity": "sha512-Ye01HXpkZPNcV6FiyoW2fGZDUw4Yc7vT0E9Sad83+bEDiCJ1uXu0S3mr8WLpsz3HaG3x2q0HM6CTuPdcZcluFQ==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-util-classify-character": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-1.1.0.tgz", - "integrity": "sha512-SL0wLxtKSnklKSUplok1WQFoGhUdWYKggKUiqhX+Swala+BtptGCu5iPRc+xvzJ4PXE/hwM3FNXsfEVgoZsWbw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-util-combine-extensions": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.1.0.tgz", - "integrity": "sha512-Q20sp4mfNf9yEqDL50WwuWZHUrCO4fEyeDCnMGmG5Pr0Cz15Uo7KBs6jq+dq0EgX4DPwwrh9m0X+zPV1ypFvUA==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-chunked": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-util-decode-numeric-character-reference": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.1.0.tgz", - "integrity": "sha512-m9V0ExGv0jB1OT21mrWcuf4QhP46pH1KkfWy9ZEezqHKAxkj4mPCy3nIH1rkbdMlChLHX531eOrymlwyZIf2iw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-util-decode-string": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.1.0.tgz", - "integrity": "sha512-YphLGCK8gM1tG1bd54azwyrQRjCFcmgj2S2GoJDNnh4vYtnL38JS8M4gpxzOPNyHdNEpheyWXCTnnTDY3N+NVQ==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "decode-named-character-reference": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-util-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-1.1.0.tgz", - "integrity": "sha512-EuEzTWSTAj9PA5GOAs992GzNh2dGQO52UvAbtSOMvXTxv3Criqb6IOzJUBCmEqrrXSblJIJBbFFv6zPxpreiJw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, - "node_modules/eslint-mdx/node_modules/micromark-util-events-to-acorn": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-1.2.3.tgz", - "integrity": "sha512-ij4X7Wuc4fED6UoLWkmo0xJQhsktfNh1J0m8g4PbIMPlx+ek/4YdW5mvbye8z/aZvAPUoxgXHrwVlXAPKMRp1w==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "@types/acorn": "^4.0.0", - "@types/estree": "^1.0.0", - "@types/unist": "^2.0.0", - "estree-util-visit": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "uvu": "^0.5.0", - "vfile-message": "^3.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-util-html-tag-name": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.2.0.tgz", - "integrity": "sha512-VTQzcuQgFUD7yYztuQFKXT49KghjtETQ+Wv/zUjGSGBioZnkA4P1XXZPT1FHeJA6RwRXSF47yvJ1tsJdoxwO+Q==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, - "node_modules/eslint-mdx/node_modules/micromark-util-normalize-identifier": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.1.0.tgz", - "integrity": "sha512-N+w5vhqrBihhjdpM8+5Xsxy71QWqGn7HYNUvch71iV2PM7+E3uWGox1Qp90loa1ephtCxG2ftRV/Conitc6P2Q==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-util-resolve-all": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-1.1.0.tgz", - "integrity": "sha512-b/G6BTMSg+bX+xVCshPTPyAu2tmA0E4X98NSR7eIbeC6ycCqCeE7wjfDIgzEbkzdEVJXRtOG4FbEm/uGbCRouA==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-util-sanitize-uri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.2.0.tgz", - "integrity": "sha512-QO4GXv0XZfWey4pYFndLUKEAktKkG5kZTdUNaTAkzbuJxn2tNBOr+QtxR2XpWaMhbImT2dPzyLrPXLlPhph34A==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-encode": "^1.0.0", - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/eslint-mdx/node_modules/micromark-util-subtokenize": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-1.1.0.tgz", - "integrity": "sha512-kUQHyzRoxvZO2PuLzMt2P/dwVsTiivCK8icYTeR+3WgbuPqfHgPPy7nFKbeqRivBvn/3N3GBiNC+JRTMSxEC7A==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-chunked": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "uvu": "^0.5.0" - } - }, - "node_modules/eslint-mdx/node_modules/parse-entities": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.1.tgz", - "integrity": "sha512-SWzvYcSJh4d/SGLIOQfZ/CoNv6BTlI6YEQ7Nj82oDVnRpwe/Z/F1EMx42x3JAOwGBlCjeCH0BRJQbQ/opHL17w==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "character-entities": "^2.0.0", - "character-entities-legacy": "^3.0.0", - "character-reference-invalid": "^2.0.0", - "decode-named-character-reference": "^1.0.0", - "is-alphanumerical": "^2.0.0", - "is-decimal": "^2.0.0", - "is-hexadecimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-mdx/node_modules/remark-mdx": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-2.3.0.tgz", - "integrity": "sha512-g53hMkpM0I98MU266IzDFMrTD980gNF3BJnkyFcmN+dD873mQeD5rdMO3Y2X+x8umQfbSE0PcoEDl7ledSA+2g==", - "dev": true, - "dependencies": { - "mdast-util-mdx": "^2.0.0", - "micromark-extension-mdxjs": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/remark-parse": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-10.0.2.tgz", - "integrity": "sha512-3ydxgHa/ZQzG8LvC7jTXccARYDcRld3VfcgIIFs7bI6vbRSxJJmzgLEIIoYKyrfhaY+ujuWaf/PJiMZXoiCXgw==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0", - "mdast-util-from-markdown": "^1.0.0", - "unified": "^10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/unified": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", - "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "bail": "^2.0.0", - "extend": "^3.0.0", - "is-buffer": "^2.0.0", - "is-plain-obj": "^4.0.0", - "trough": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/unist-util-is": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", - "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/unist-util-position-from-estree": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unist-util-position-from-estree/-/unist-util-position-from-estree-1.1.2.tgz", - "integrity": "sha512-poZa0eXpS+/XpoQwGwl79UUdea4ol2ZuCYguVaJS4qzIOMDzbqz8a3erUCOmubSZkaOuGamb3tX790iwOIROww==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/unist-util-remove-position": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-4.0.2.tgz", - "integrity": "sha512-TkBb0HABNmxzAcfLf4qsIbFbaPDvMO6wa3b3j4VcEzFVaw1LBKwnW4/sRJ/atSLSzoIg41JWEdnE7N6DIhGDGQ==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-visit": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/unist-util-stringify-position": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", - "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/unist-util-visit": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", - "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.1.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/unist-util-visit-parents": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", - "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/vfile": { - "version": "5.3.7", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", - "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "is-buffer": "^2.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-mdx/node_modules/vfile-message": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", - "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-stringify-position": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/eslint-plugin-markdown": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/eslint-plugin-markdown/-/eslint-plugin-markdown-3.0.1.tgz", @@ -7705,22 +7477,22 @@ } }, "node_modules/eslint-plugin-mdx": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-mdx/-/eslint-plugin-mdx-2.3.3.tgz", - "integrity": "sha512-x7H3RWOM9zpX07/9Up+qBMB5nWANXHH1y/TeGE2iqbMGmYafhIgYh5FDYRChG4Bxas1MxXBG+B4BsSiDxqwAWA==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-mdx/-/eslint-plugin-mdx-3.1.5.tgz", + "integrity": "sha512-lUE7tP7IrIRHU3gTtASDe5u4YM2SvQveYVJfuo82yn3MLh/B/v05FNySURCK4aIxIYF1QYo3IRemQG/lyQzpAg==", "dev": true, "dependencies": { - "eslint-mdx": "^2.3.3", + "eslint-mdx": "^3.1.5", "eslint-plugin-markdown": "^3.0.1", - "remark-mdx": "^2.3.0", - "remark-parse": "^10.0.2", - "remark-stringify": "^10.0.3", - "tslib": "^2.6.1", - "unified": "^10.1.2", - "vfile": "^5.3.7" + "remark-mdx": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "tslib": "^2.6.2", + "unified": "^11.0.4", + "vfile": "^6.0.1" }, "engines": { - "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + "node": ">=18.0.0" }, "funding": { "type": "opencollective", @@ -7730,945 +7502,6 @@ "eslint": ">=8.0.0" } }, - "node_modules/eslint-plugin-mdx/node_modules/@types/hast": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.9.tgz", - "integrity": "sha512-pTHyNlaMD/oKJmS+ZZUyFUcsZeBZpC0lmGquw98CqRVNgAdJZJeD7GoeLiT6Xbx5rU9VCjSt0RwEvDgzh4obFw==", - "dev": true, - "dependencies": { - "@types/unist": "^2" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", - "dev": true - }, - "node_modules/eslint-plugin-mdx/node_modules/character-entities-legacy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", - "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/character-reference-invalid": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", - "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/estree-util-is-identifier-name": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-2.1.0.tgz", - "integrity": "sha512-bEN9VHRyXAUOjkKVQVvArFym08BTWB0aJPppZZr0UNyAqWsLaVfAqP7hbaTJjzHifmB5ebnR8Wm7r7yGN/HonQ==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/is-alphabetical": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", - "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/is-alphanumerical": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", - "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", - "dev": true, - "dependencies": { - "is-alphabetical": "^2.0.0", - "is-decimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/is-decimal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", - "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/is-hexadecimal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", - "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/mdast-util-from-markdown": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-1.3.1.tgz", - "integrity": "sha512-4xTO/M8c82qBcnQc1tgpNtubGUW/Y1tBQ1B0i5CtSoelOLKFYlElIr3bvgREYYO5iRqbMY1YuqZng0GVOI8Qww==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "decode-named-character-reference": "^1.0.0", - "mdast-util-to-string": "^3.1.0", - "micromark": "^3.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-decode-string": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "unist-util-stringify-position": "^3.0.0", - "uvu": "^0.5.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/mdast-util-mdx": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-2.0.1.tgz", - "integrity": "sha512-38w5y+r8nyKlGvNjSEqWrhG0w5PmnRA+wnBvm+ulYCct7nsGYhFVb0lljS9bQav4psDAS1eGkP2LMVcZBi/aqw==", - "dev": true, - "dependencies": { - "mdast-util-from-markdown": "^1.0.0", - "mdast-util-mdx-expression": "^1.0.0", - "mdast-util-mdx-jsx": "^2.0.0", - "mdast-util-mdxjs-esm": "^1.0.0", - "mdast-util-to-markdown": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/mdast-util-mdx-expression": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-1.3.2.tgz", - "integrity": "sha512-xIPmR5ReJDu/DHH1OoIT1HkuybIfRGYRywC+gJtI7qHjCJp/M9jrmBEJW22O8lskDWm562BX2W8TiAwRTb0rKA==", - "dev": true, - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^2.0.0", - "@types/mdast": "^3.0.0", - "mdast-util-from-markdown": "^1.0.0", - "mdast-util-to-markdown": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/mdast-util-mdx-jsx": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-2.1.4.tgz", - "integrity": "sha512-DtMn9CmVhVzZx3f+optVDF8yFgQVt7FghCRNdlIaS3X5Bnym3hZwPbg/XW86vdpKjlc1PVj26SpnLGeJBXD3JA==", - "dev": true, - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^2.0.0", - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "ccount": "^2.0.0", - "mdast-util-from-markdown": "^1.1.0", - "mdast-util-to-markdown": "^1.3.0", - "parse-entities": "^4.0.0", - "stringify-entities": "^4.0.0", - "unist-util-remove-position": "^4.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/mdast-util-mdxjs-esm": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-1.3.1.tgz", - "integrity": "sha512-SXqglS0HrEvSdUEfoXFtcg7DRl7S2cwOXc7jkuusG472Mmjag34DUDeOJUZtl+BVnyeO1frIgVpHlNRWc2gk/w==", - "dev": true, - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^2.0.0", - "@types/mdast": "^3.0.0", - "mdast-util-from-markdown": "^1.0.0", - "mdast-util-to-markdown": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/mdast-util-phrasing": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-3.0.1.tgz", - "integrity": "sha512-WmI1gTXUBJo4/ZmSk79Wcb2HcjPJBzM1nlI/OUWA8yk2X9ik3ffNbBGsU+09BFmXaL1IBb9fiuvq6/KMiNycSg==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/mdast-util-to-markdown": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-1.5.0.tgz", - "integrity": "sha512-bbv7TPv/WC49thZPg3jXuqzuvI45IL2EVAr/KxF0BSdHsU0ceFHOmwQn6evxAh1GaoK/6GQ1wp4R4oW2+LFL/A==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "longest-streak": "^3.0.0", - "mdast-util-phrasing": "^3.0.0", - "mdast-util-to-string": "^3.0.0", - "micromark-util-decode-string": "^1.0.0", - "unist-util-visit": "^4.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/mdast-util-to-string": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz", - "integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-3.2.0.tgz", - "integrity": "sha512-uD66tJj54JLYq0De10AhWycZWGQNUvDI55xPgk2sQM5kn1JYlhbCMTtEeT27+vAhW2FBQxLlOmS3pmA7/2z4aA==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "@types/debug": "^4.0.0", - "debug": "^4.0.0", - "decode-named-character-reference": "^1.0.0", - "micromark-core-commonmark": "^1.0.1", - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-chunked": "^1.0.0", - "micromark-util-combine-extensions": "^1.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-encode": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-resolve-all": "^1.0.0", - "micromark-util-sanitize-uri": "^1.0.0", - "micromark-util-subtokenize": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.1", - "uvu": "^0.5.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-core-commonmark": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-1.1.0.tgz", - "integrity": "sha512-BgHO1aRbolh2hcrzL2d1La37V0Aoz73ymF8rAcKnohLy93titmv62E0gP8Hrx9PKcKrqCZ1BbLGbP3bEhoXYlw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "decode-named-character-reference": "^1.0.0", - "micromark-factory-destination": "^1.0.0", - "micromark-factory-label": "^1.0.0", - "micromark-factory-space": "^1.0.0", - "micromark-factory-title": "^1.0.0", - "micromark-factory-whitespace": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-chunked": "^1.0.0", - "micromark-util-classify-character": "^1.0.0", - "micromark-util-html-tag-name": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-resolve-all": "^1.0.0", - "micromark-util-subtokenize": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.1", - "uvu": "^0.5.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-extension-mdx-expression": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-1.0.8.tgz", - "integrity": "sha512-zZpeQtc5wfWKdzDsHRBY003H2Smg+PUi2REhqgIhdzAa5xonhP03FcXxqFSerFiNUr5AWmHpaNPQTBVOS4lrXw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "@types/estree": "^1.0.0", - "micromark-factory-mdx-expression": "^1.0.0", - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-events-to-acorn": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "uvu": "^0.5.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-extension-mdx-jsx": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-1.0.5.tgz", - "integrity": "sha512-gPH+9ZdmDflbu19Xkb8+gheqEDqkSpdCEubQyxuz/Hn8DOXiXvrXeikOoBA71+e8Pfi0/UYmU3wW3H58kr7akA==", - "dev": true, - "dependencies": { - "@types/acorn": "^4.0.0", - "@types/estree": "^1.0.0", - "estree-util-is-identifier-name": "^2.0.0", - "micromark-factory-mdx-expression": "^1.0.0", - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "uvu": "^0.5.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-extension-mdx-md": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-md/-/micromark-extension-mdx-md-1.0.1.tgz", - "integrity": "sha512-7MSuj2S7xjOQXAjjkbjBsHkMtb+mDGVW6uI2dBL9snOBCbZmoNgDAeZ0nSn9j3T42UE/g2xVNMn18PJxZvkBEA==", - "dev": true, - "dependencies": { - "micromark-util-types": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-extension-mdxjs": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs/-/micromark-extension-mdxjs-1.0.1.tgz", - "integrity": "sha512-7YA7hF6i5eKOfFUzZ+0z6avRG52GpWR8DL+kN47y3f2KhxbBZMhmxe7auOeaTBrW2DenbbZTf1ea9tA2hDpC2Q==", - "dev": true, - "dependencies": { - "acorn": "^8.0.0", - "acorn-jsx": "^5.0.0", - "micromark-extension-mdx-expression": "^1.0.0", - "micromark-extension-mdx-jsx": "^1.0.0", - "micromark-extension-mdx-md": "^1.0.0", - "micromark-extension-mdxjs-esm": "^1.0.0", - "micromark-util-combine-extensions": "^1.0.0", - "micromark-util-types": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-extension-mdxjs-esm": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-1.0.5.tgz", - "integrity": "sha512-xNRBw4aoURcyz/S69B19WnZAkWJMxHMT5hE36GtDAyhoyn/8TuAeqjFJQlwk+MKQsUD7b3l7kFX+vlfVWgcX1w==", - "dev": true, - "dependencies": { - "@types/estree": "^1.0.0", - "micromark-core-commonmark": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-events-to-acorn": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "unist-util-position-from-estree": "^1.1.0", - "uvu": "^0.5.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-factory-destination": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-1.1.0.tgz", - "integrity": "sha512-XaNDROBgx9SgSChd69pjiGKbV+nfHGDPVYFs5dOoDd7ZnMAE+Cuu91BCpsY8RT2NP9vo/B8pds2VQNCLiu0zhg==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-factory-label": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-1.1.0.tgz", - "integrity": "sha512-OLtyez4vZo/1NjxGhcpDSbHQ+m0IIGnT8BoPamh+7jVlzLJBH98zzuCoUeMxvM6WsNeh8wx8cKvqLiPHEACn0w==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "uvu": "^0.5.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-factory-mdx-expression": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-1.0.9.tgz", - "integrity": "sha512-jGIWzSmNfdnkJq05c7b0+Wv0Kfz3NJ3N4cBjnbO4zjXIlxJr+f8lk+5ZmwFvqdAbUy2q6B5rCY//g0QAAaXDWA==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "@types/estree": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-events-to-acorn": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "unist-util-position-from-estree": "^1.0.0", - "uvu": "^0.5.0", - "vfile-message": "^3.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-factory-title": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-1.1.0.tgz", - "integrity": "sha512-J7n9R3vMmgjDOCY8NPw55jiyaQnH5kBdV2/UXCtZIpnHH3P6nHUKaH7XXEYuWwx/xUJcawa8plLBEjMPU24HzQ==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-factory-whitespace": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-1.1.0.tgz", - "integrity": "sha512-v2WlmiymVSp5oMg+1Q0N1Lxmt6pMhIHD457whWM7/GUlEks1hI9xj5w3zbc4uuMKXGisksZk8DzP2UyGbGqNsQ==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-chunked": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-1.1.0.tgz", - "integrity": "sha512-Ye01HXpkZPNcV6FiyoW2fGZDUw4Yc7vT0E9Sad83+bEDiCJ1uXu0S3mr8WLpsz3HaG3x2q0HM6CTuPdcZcluFQ==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-classify-character": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-1.1.0.tgz", - "integrity": "sha512-SL0wLxtKSnklKSUplok1WQFoGhUdWYKggKUiqhX+Swala+BtptGCu5iPRc+xvzJ4PXE/hwM3FNXsfEVgoZsWbw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-combine-extensions": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.1.0.tgz", - "integrity": "sha512-Q20sp4mfNf9yEqDL50WwuWZHUrCO4fEyeDCnMGmG5Pr0Cz15Uo7KBs6jq+dq0EgX4DPwwrh9m0X+zPV1ypFvUA==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-chunked": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-decode-numeric-character-reference": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.1.0.tgz", - "integrity": "sha512-m9V0ExGv0jB1OT21mrWcuf4QhP46pH1KkfWy9ZEezqHKAxkj4mPCy3nIH1rkbdMlChLHX531eOrymlwyZIf2iw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-decode-string": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.1.0.tgz", - "integrity": "sha512-YphLGCK8gM1tG1bd54azwyrQRjCFcmgj2S2GoJDNnh4vYtnL38JS8M4gpxzOPNyHdNEpheyWXCTnnTDY3N+NVQ==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "decode-named-character-reference": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-1.1.0.tgz", - "integrity": "sha512-EuEzTWSTAj9PA5GOAs992GzNh2dGQO52UvAbtSOMvXTxv3Criqb6IOzJUBCmEqrrXSblJIJBbFFv6zPxpreiJw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-events-to-acorn": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-1.2.3.tgz", - "integrity": "sha512-ij4X7Wuc4fED6UoLWkmo0xJQhsktfNh1J0m8g4PbIMPlx+ek/4YdW5mvbye8z/aZvAPUoxgXHrwVlXAPKMRp1w==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "@types/acorn": "^4.0.0", - "@types/estree": "^1.0.0", - "@types/unist": "^2.0.0", - "estree-util-visit": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "uvu": "^0.5.0", - "vfile-message": "^3.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-html-tag-name": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.2.0.tgz", - "integrity": "sha512-VTQzcuQgFUD7yYztuQFKXT49KghjtETQ+Wv/zUjGSGBioZnkA4P1XXZPT1FHeJA6RwRXSF47yvJ1tsJdoxwO+Q==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-normalize-identifier": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.1.0.tgz", - "integrity": "sha512-N+w5vhqrBihhjdpM8+5Xsxy71QWqGn7HYNUvch71iV2PM7+E3uWGox1Qp90loa1ephtCxG2ftRV/Conitc6P2Q==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-resolve-all": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-1.1.0.tgz", - "integrity": "sha512-b/G6BTMSg+bX+xVCshPTPyAu2tmA0E4X98NSR7eIbeC6ycCqCeE7wjfDIgzEbkzdEVJXRtOG4FbEm/uGbCRouA==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-sanitize-uri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.2.0.tgz", - "integrity": "sha512-QO4GXv0XZfWey4pYFndLUKEAktKkG5kZTdUNaTAkzbuJxn2tNBOr+QtxR2XpWaMhbImT2dPzyLrPXLlPhph34A==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-encode": "^1.0.0", - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/micromark-util-subtokenize": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-1.1.0.tgz", - "integrity": "sha512-kUQHyzRoxvZO2PuLzMt2P/dwVsTiivCK8icYTeR+3WgbuPqfHgPPy7nFKbeqRivBvn/3N3GBiNC+JRTMSxEC7A==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-chunked": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "uvu": "^0.5.0" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/parse-entities": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.1.tgz", - "integrity": "sha512-SWzvYcSJh4d/SGLIOQfZ/CoNv6BTlI6YEQ7Nj82oDVnRpwe/Z/F1EMx42x3JAOwGBlCjeCH0BRJQbQ/opHL17w==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "character-entities": "^2.0.0", - "character-entities-legacy": "^3.0.0", - "character-reference-invalid": "^2.0.0", - "decode-named-character-reference": "^1.0.0", - "is-alphanumerical": "^2.0.0", - "is-decimal": "^2.0.0", - "is-hexadecimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/remark-mdx": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-2.3.0.tgz", - "integrity": "sha512-g53hMkpM0I98MU266IzDFMrTD980gNF3BJnkyFcmN+dD873mQeD5rdMO3Y2X+x8umQfbSE0PcoEDl7ledSA+2g==", - "dev": true, - "dependencies": { - "mdast-util-mdx": "^2.0.0", - "micromark-extension-mdxjs": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/remark-parse": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-10.0.2.tgz", - "integrity": "sha512-3ydxgHa/ZQzG8LvC7jTXccARYDcRld3VfcgIIFs7bI6vbRSxJJmzgLEIIoYKyrfhaY+ujuWaf/PJiMZXoiCXgw==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0", - "mdast-util-from-markdown": "^1.0.0", - "unified": "^10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/unified": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", - "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "bail": "^2.0.0", - "extend": "^3.0.0", - "is-buffer": "^2.0.0", - "is-plain-obj": "^4.0.0", - "trough": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/unist-util-is": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", - "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/unist-util-position-from-estree": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unist-util-position-from-estree/-/unist-util-position-from-estree-1.1.2.tgz", - "integrity": "sha512-poZa0eXpS+/XpoQwGwl79UUdea4ol2ZuCYguVaJS4qzIOMDzbqz8a3erUCOmubSZkaOuGamb3tX790iwOIROww==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/unist-util-remove-position": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-4.0.2.tgz", - "integrity": "sha512-TkBb0HABNmxzAcfLf4qsIbFbaPDvMO6wa3b3j4VcEzFVaw1LBKwnW4/sRJ/atSLSzoIg41JWEdnE7N6DIhGDGQ==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-visit": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/unist-util-stringify-position": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", - "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/unist-util-visit": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", - "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.1.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/unist-util-visit-parents": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", - "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/vfile": { - "version": "5.3.7", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", - "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "is-buffer": "^2.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/eslint-plugin-mdx/node_modules/vfile-message": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", - "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-stringify-position": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/eslint-plugin-react": { "version": "7.33.2", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz", @@ -8930,25 +7763,18 @@ } }, "node_modules/estree-util-visit": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-1.2.1.tgz", - "integrity": "sha512-xbgqcrkIVbIG+lI/gzbvd9SGTJL4zqJKBFttUl5pP27KhAjtMKbX/mQXJ7qgyXpMgVy/zvpm0xoQQaGL8OloOw==", - "dev": true, + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-2.0.0.tgz", + "integrity": "sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww==", "dependencies": { "@types/estree-jsx": "^1.0.0", - "@types/unist": "^2.0.0" + "@types/unist": "^3.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" } }, - "node_modules/estree-util-visit/node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", - "dev": true - }, "node_modules/estree-walker": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", @@ -9288,9 +8114,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -9415,9 +8241,9 @@ } }, "node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", + "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", "dev": true, "dependencies": { "cross-spawn": "^7.0.0", @@ -10266,6 +9092,24 @@ "react-is": "^16.7.0" } }, + "node_modules/hosted-git-info": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.2.tgz", + "integrity": "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==", + "dev": true, + "dependencies": { + "lru-cache": "^10.0.1" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/hosted-git-info/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, "node_modules/hpack.js": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", @@ -10628,9 +9472,9 @@ } }, "node_modules/import-meta-resolve": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-2.2.2.tgz", - "integrity": "sha512-f8KcQ1D80V7RnqVm+/lirO9zkOxjGxhaTC1IPrBGd3MEfNgmNG67tSUO9gTi2F3Blr2Az6g1vocaxzkVnWl9MA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz", + "integrity": "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw==", "dev": true, "funding": { "type": "github", @@ -10699,6 +9543,14 @@ "node": ">= 0.4" } }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "engines": { + "node": ">=12" + } + }, "node_modules/interpret": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", @@ -10820,29 +9672,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "engines": { - "node": ">=4" - } - }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -11320,16 +10149,13 @@ } }, "node_modules/jackspeak": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", - "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", "dev": true, "dependencies": { "@isaacs/cliui": "^8.0.2" }, - "engines": { - "node": ">=14" - }, "funding": { "url": "https://github.com/sponsors/isaacs" }, @@ -11514,6 +10340,29 @@ "node": ">=4.0" } }, + "node_modules/katex": { + "version": "0.16.10", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.10.tgz", + "integrity": "sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==", + "funding": [ + "https://opencollective.com/katex", + "https://github.com/sponsors/katex" + ], + "dependencies": { + "commander": "^8.3.0" + }, + "bin": { + "katex": "cli.js" + } + }, + "node_modules/katex/node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -11522,6 +10371,11 @@ "json-buffer": "3.0.1" } }, + "node_modules/khroma": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/khroma/-/khroma-2.1.0.tgz", + "integrity": "sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw==" + }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -11561,6 +10415,11 @@ "shell-quote": "^1.8.1" } }, + "node_modules/layout-base": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/layout-base/-/layout-base-1.0.2.tgz", + "integrity": "sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg==" + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -11596,13 +10455,13 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, "node_modules/load-plugin": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/load-plugin/-/load-plugin-5.1.0.tgz", - "integrity": "sha512-Lg1CZa1CFj2CbNaxijTL6PCbzd4qGTlZov+iH2p5Xwy/ApcZJh+i6jMN2cYePouTfjJfrNu3nXFdEw8LvbjPFQ==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/load-plugin/-/load-plugin-6.0.3.tgz", + "integrity": "sha512-kc0X2FEUZr145odl68frm+lMJuQ23+rTXYmR6TImqPtbpmXC4vVXbWKDQ9IzndA0HfyQamWfKLhzsqGSTxE63w==", "dev": true, "dependencies": { - "@npmcli/config": "^6.0.0", - "import-meta-resolve": "^2.0.0" + "@npmcli/config": "^8.0.0", + "import-meta-resolve": "^4.0.0" }, "funding": { "type": "github", @@ -11649,6 +10508,11 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" + }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -13880,6 +12744,450 @@ "node": ">= 8" } }, + "node_modules/mermaid": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/mermaid/-/mermaid-10.9.1.tgz", + "integrity": "sha512-Mx45Obds5W1UkW1nv/7dHRsbfMM1aOKA2+Pxs/IGHNonygDHwmng8xTHyS9z4KWVi0rbko8gjiBmuwwXQ7tiNA==", + "dependencies": { + "@braintree/sanitize-url": "^6.0.1", + "@types/d3-scale": "^4.0.3", + "@types/d3-scale-chromatic": "^3.0.0", + "cytoscape": "^3.28.1", + "cytoscape-cose-bilkent": "^4.1.0", + "d3": "^7.4.0", + "d3-sankey": "^0.12.3", + "dagre-d3-es": "7.0.10", + "dayjs": "^1.11.7", + "dompurify": "^3.0.5", + "elkjs": "^0.9.0", + "katex": "^0.16.9", + "khroma": "^2.0.0", + "lodash-es": "^4.17.21", + "mdast-util-from-markdown": "^1.3.0", + "non-layered-tidy-tree-layout": "^2.0.2", + "stylis": "^4.1.3", + "ts-dedent": "^2.2.0", + "uuid": "^9.0.0", + "web-worker": "^1.2.0" + } + }, + "node_modules/mermaid/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/mermaid/node_modules/mdast-util-from-markdown": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-1.3.1.tgz", + "integrity": "sha512-4xTO/M8c82qBcnQc1tgpNtubGUW/Y1tBQ1B0i5CtSoelOLKFYlElIr3bvgREYYO5iRqbMY1YuqZng0GVOI8Qww==", + "dependencies": { + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "mdast-util-to-string": "^3.1.0", + "micromark": "^3.0.0", + "micromark-util-decode-numeric-character-reference": "^1.0.0", + "micromark-util-decode-string": "^1.0.0", + "micromark-util-normalize-identifier": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "unist-util-stringify-position": "^3.0.0", + "uvu": "^0.5.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mermaid/node_modules/mdast-util-to-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz", + "integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==", + "dependencies": { + "@types/mdast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mermaid/node_modules/micromark": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-3.2.0.tgz", + "integrity": "sha512-uD66tJj54JLYq0De10AhWycZWGQNUvDI55xPgk2sQM5kn1JYlhbCMTtEeT27+vAhW2FBQxLlOmS3pmA7/2z4aA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "micromark-core-commonmark": "^1.0.1", + "micromark-factory-space": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-chunked": "^1.0.0", + "micromark-util-combine-extensions": "^1.0.0", + "micromark-util-decode-numeric-character-reference": "^1.0.0", + "micromark-util-encode": "^1.0.0", + "micromark-util-normalize-identifier": "^1.0.0", + "micromark-util-resolve-all": "^1.0.0", + "micromark-util-sanitize-uri": "^1.0.0", + "micromark-util-subtokenize": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.1", + "uvu": "^0.5.0" + } + }, + "node_modules/mermaid/node_modules/micromark-core-commonmark": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-1.1.0.tgz", + "integrity": "sha512-BgHO1aRbolh2hcrzL2d1La37V0Aoz73ymF8rAcKnohLy93titmv62E0gP8Hrx9PKcKrqCZ1BbLGbP3bEhoXYlw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-factory-destination": "^1.0.0", + "micromark-factory-label": "^1.0.0", + "micromark-factory-space": "^1.0.0", + "micromark-factory-title": "^1.0.0", + "micromark-factory-whitespace": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-chunked": "^1.0.0", + "micromark-util-classify-character": "^1.0.0", + "micromark-util-html-tag-name": "^1.0.0", + "micromark-util-normalize-identifier": "^1.0.0", + "micromark-util-resolve-all": "^1.0.0", + "micromark-util-subtokenize": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.1", + "uvu": "^0.5.0" + } + }, + "node_modules/mermaid/node_modules/micromark-factory-destination": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-1.1.0.tgz", + "integrity": "sha512-XaNDROBgx9SgSChd69pjiGKbV+nfHGDPVYFs5dOoDd7ZnMAE+Cuu91BCpsY8RT2NP9vo/B8pds2VQNCLiu0zhg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-factory-label": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-1.1.0.tgz", + "integrity": "sha512-OLtyez4vZo/1NjxGhcpDSbHQ+m0IIGnT8BoPamh+7jVlzLJBH98zzuCoUeMxvM6WsNeh8wx8cKvqLiPHEACn0w==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + } + }, + "node_modules/mermaid/node_modules/micromark-factory-title": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-1.1.0.tgz", + "integrity": "sha512-J7n9R3vMmgjDOCY8NPw55jiyaQnH5kBdV2/UXCtZIpnHH3P6nHUKaH7XXEYuWwx/xUJcawa8plLBEjMPU24HzQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-factory-space": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-factory-whitespace": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-1.1.0.tgz", + "integrity": "sha512-v2WlmiymVSp5oMg+1Q0N1Lxmt6pMhIHD457whWM7/GUlEks1hI9xj5w3zbc4uuMKXGisksZk8DzP2UyGbGqNsQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-factory-space": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-util-chunked": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-1.1.0.tgz", + "integrity": "sha512-Ye01HXpkZPNcV6FiyoW2fGZDUw4Yc7vT0E9Sad83+bEDiCJ1uXu0S3mr8WLpsz3HaG3x2q0HM6CTuPdcZcluFQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-util-classify-character": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-1.1.0.tgz", + "integrity": "sha512-SL0wLxtKSnklKSUplok1WQFoGhUdWYKggKUiqhX+Swala+BtptGCu5iPRc+xvzJ4PXE/hwM3FNXsfEVgoZsWbw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-util-combine-extensions": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.1.0.tgz", + "integrity": "sha512-Q20sp4mfNf9yEqDL50WwuWZHUrCO4fEyeDCnMGmG5Pr0Cz15Uo7KBs6jq+dq0EgX4DPwwrh9m0X+zPV1ypFvUA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-chunked": "^1.0.0", + "micromark-util-types": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-util-decode-numeric-character-reference": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.1.0.tgz", + "integrity": "sha512-m9V0ExGv0jB1OT21mrWcuf4QhP46pH1KkfWy9ZEezqHKAxkj4mPCy3nIH1rkbdMlChLHX531eOrymlwyZIf2iw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-util-decode-string": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.1.0.tgz", + "integrity": "sha512-YphLGCK8gM1tG1bd54azwyrQRjCFcmgj2S2GoJDNnh4vYtnL38JS8M4gpxzOPNyHdNEpheyWXCTnnTDY3N+NVQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-decode-numeric-character-reference": "^1.0.0", + "micromark-util-symbol": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-util-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-1.1.0.tgz", + "integrity": "sha512-EuEzTWSTAj9PA5GOAs992GzNh2dGQO52UvAbtSOMvXTxv3Criqb6IOzJUBCmEqrrXSblJIJBbFFv6zPxpreiJw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/mermaid/node_modules/micromark-util-html-tag-name": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.2.0.tgz", + "integrity": "sha512-VTQzcuQgFUD7yYztuQFKXT49KghjtETQ+Wv/zUjGSGBioZnkA4P1XXZPT1FHeJA6RwRXSF47yvJ1tsJdoxwO+Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/mermaid/node_modules/micromark-util-normalize-identifier": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.1.0.tgz", + "integrity": "sha512-N+w5vhqrBihhjdpM8+5Xsxy71QWqGn7HYNUvch71iV2PM7+E3uWGox1Qp90loa1ephtCxG2ftRV/Conitc6P2Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-util-resolve-all": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-1.1.0.tgz", + "integrity": "sha512-b/G6BTMSg+bX+xVCshPTPyAu2tmA0E4X98NSR7eIbeC6ycCqCeE7wjfDIgzEbkzdEVJXRtOG4FbEm/uGbCRouA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-types": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-util-sanitize-uri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.2.0.tgz", + "integrity": "sha512-QO4GXv0XZfWey4pYFndLUKEAktKkG5kZTdUNaTAkzbuJxn2tNBOr+QtxR2XpWaMhbImT2dPzyLrPXLlPhph34A==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^1.0.0", + "micromark-util-encode": "^1.0.0", + "micromark-util-symbol": "^1.0.0" + } + }, + "node_modules/mermaid/node_modules/micromark-util-subtokenize": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-1.1.0.tgz", + "integrity": "sha512-kUQHyzRoxvZO2PuLzMt2P/dwVsTiivCK8icYTeR+3WgbuPqfHgPPy7nFKbeqRivBvn/3N3GBiNC+JRTMSxEC7A==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-chunked": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "uvu": "^0.5.0" + } + }, + "node_modules/mermaid/node_modules/unist-util-stringify-position": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", + "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mermaid/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -15688,19 +14996,6 @@ "vfile-message": "^4.0.0" } }, - "node_modules/micromark-util-events-to-acorn/node_modules/estree-util-visit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-2.0.0.tgz", - "integrity": "sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww==", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/micromark-util-events-to-acorn/node_modules/micromark-util-symbol": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.0.tgz", @@ -16066,9 +15361,9 @@ } }, "node_modules/minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, "engines": { "node": ">=16 || 14 >=14.17" @@ -16090,7 +15385,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", - "dev": true, "engines": { "node": ">=4" } @@ -16218,10 +15512,15 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" }, + "node_modules/non-layered-tidy-tree-layout": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/non-layered-tidy-tree-layout/-/non-layered-tidy-tree-layout-2.0.2.tgz", + "integrity": "sha512-gkXMxRzUH+PB0ax9dUN0yYF0S25BqeAYqhgMaLUFmpXLEk7Fcu8f4emJuOAY0V8kjDICxROIKsTAKsV/v355xw==" + }, "node_modules/nopt": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-7.2.0.tgz", - "integrity": "sha512-CVDtwCdhYIvnAzFoJ6NJ6dX3oga9/HyciQDnG1vQDjSLMeKLJ4A93ZqYKDrgYSr1FBY5/hMYC+2VCi24pgpkGA==", + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-7.2.1.tgz", + "integrity": "sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w==", "dev": true, "dependencies": { "abbrev": "^2.0.0" @@ -16233,6 +15532,20 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/normalize-package-data": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", + "integrity": "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==", + "dev": true, + "dependencies": { + "hosted-git-info": "^7.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -16260,6 +15573,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/npm-install-checks": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.3.0.tgz", + "integrity": "sha512-W29RiK/xtpCGqn6f3ixfRYGk+zRyr+Ew9F2E20BfXxT5/euLdA/Nm7fO7OeTGuAmTs30cpgInyJ0cYe708YTZw==", + "dev": true, + "dependencies": { + "semver": "^7.1.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/npm-normalize-package-bin": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.1.tgz", @@ -16269,6 +15594,36 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/npm-package-arg": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-11.0.3.tgz", + "integrity": "sha512-sHGJy8sOC1YraBywpzQlIKBE4pBbGbiF95U6Auspzyem956E0+FtDtsx1ZxlOJkQCZ1AFXAY/yuvtFYrOxF+Bw==", + "dev": true, + "dependencies": { + "hosted-git-info": "^7.0.0", + "proc-log": "^4.0.0", + "semver": "^7.3.5", + "validate-npm-package-name": "^5.0.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/npm-pick-manifest": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-9.1.0.tgz", + "integrity": "sha512-nkc+3pIIhqHVQr085X9d2JzPzLyjzQS96zbruppqC9aZRm/x8xx6xhI98gHtsfELP2bE+loHq8ZaHFHhe+NauA==", + "dev": true, + "dependencies": { + "npm-install-checks": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0", + "npm-package-arg": "^11.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -16610,6 +15965,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "dev": true + }, "node_modules/param-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", @@ -16755,29 +16116,26 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "node_modules/path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dev": true, "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", + "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", - "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", - "dev": true, - "engines": { - "node": "14 || >=16.14" - } + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true }, "node_modules/path-to-regexp": { "version": "1.8.0", @@ -17645,9 +17003,9 @@ } }, "node_modules/proc-log": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-3.0.0.tgz", - "integrity": "sha512-++Vn7NS4Xf9NacaU9Xq3URUuqZETPsf8L4j5/ckhaRYsfPeRyzGw+iDjFhV/Jr3uNmTvvddEJFWh5R1gRgUH8A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-4.2.0.tgz", + "integrity": "sha512-g8+OnU/L2v+wyiVK+D5fA34J7EH8jZ8DDlvwhRCMxmMj7UCBvxiO1mGeN+36JXIKF4zevU4kRBd8lVgG9vLelA==", "dev": true, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -17658,6 +17016,34 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, + "node_modules/promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", + "dev": true + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/promise-retry/node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -18074,9 +17460,9 @@ } }, "node_modules/read-package-json-fast/node_modules/json-parse-even-better-errors": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.1.tgz", - "integrity": "sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.2.tgz", + "integrity": "sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ==", "dev": true, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -18375,20 +17761,6 @@ "@types/unist": "*" } }, - "node_modules/remark-gfm/node_modules/remark-stringify": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", - "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-to-markdown": "^2.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-mdx": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.0.0.tgz", @@ -18575,216 +17947,25 @@ } }, "node_modules/remark-stringify": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-10.0.3.tgz", - "integrity": "sha512-koyOzCMYoUHudypbj4XpnAKFbkddRMYZHwghnxd7ue5210WzGw6kOBwauJTRUMq16jsovXx8dYNvSSWP89kZ3A==", - "dev": true, + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", + "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", "dependencies": { - "@types/mdast": "^3.0.0", - "mdast-util-to-markdown": "^1.0.0", - "unified": "^10.0.0" + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" } }, - "node_modules/remark-stringify/node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", - "dev": true - }, - "node_modules/remark-stringify/node_modules/mdast-util-phrasing": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-3.0.1.tgz", - "integrity": "sha512-WmI1gTXUBJo4/ZmSk79Wcb2HcjPJBzM1nlI/OUWA8yk2X9ik3ffNbBGsU+09BFmXaL1IBb9fiuvq6/KMiNycSg==", - "dev": true, + "node_modules/remark-stringify/node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", "dependencies": { - "@types/mdast": "^3.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-stringify/node_modules/mdast-util-to-markdown": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-1.5.0.tgz", - "integrity": "sha512-bbv7TPv/WC49thZPg3jXuqzuvI45IL2EVAr/KxF0BSdHsU0ceFHOmwQn6evxAh1GaoK/6GQ1wp4R4oW2+LFL/A==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "longest-streak": "^3.0.0", - "mdast-util-phrasing": "^3.0.0", - "mdast-util-to-string": "^3.0.0", - "micromark-util-decode-string": "^1.0.0", - "unist-util-visit": "^4.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-stringify/node_modules/mdast-util-to-string": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz", - "integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==", - "dev": true, - "dependencies": { - "@types/mdast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-stringify/node_modules/micromark-util-decode-numeric-character-reference": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.1.0.tgz", - "integrity": "sha512-m9V0ExGv0jB1OT21mrWcuf4QhP46pH1KkfWy9ZEezqHKAxkj4mPCy3nIH1rkbdMlChLHX531eOrymlwyZIf2iw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/remark-stringify/node_modules/micromark-util-decode-string": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.1.0.tgz", - "integrity": "sha512-YphLGCK8gM1tG1bd54azwyrQRjCFcmgj2S2GoJDNnh4vYtnL38JS8M4gpxzOPNyHdNEpheyWXCTnnTDY3N+NVQ==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "decode-named-character-reference": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/remark-stringify/node_modules/unified": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", - "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "bail": "^2.0.0", - "extend": "^3.0.0", - "is-buffer": "^2.0.0", - "is-plain-obj": "^4.0.0", - "trough": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-stringify/node_modules/unist-util-is": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", - "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-stringify/node_modules/unist-util-stringify-position": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", - "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-stringify/node_modules/unist-util-visit": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", - "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.1.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-stringify/node_modules/unist-util-visit-parents": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", - "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-stringify/node_modules/vfile": { - "version": "5.3.7", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", - "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "is-buffer": "^2.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-stringify/node_modules/vfile-message": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", - "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-stringify-position": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" + "@types/unist": "*" } }, "node_modules/renderkid": { @@ -18980,6 +18161,11 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/robust-predicates": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz", + "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==" + }, "node_modules/rtl-detect": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/rtl-detect/-/rtl-detect-1.1.2.tgz", @@ -19024,11 +18210,15 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==" + }, "node_modules/sade": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", - "dev": true, "dependencies": { "mri": "^1.1.0" }, @@ -19633,6 +18823,38 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.18", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.18.tgz", + "integrity": "sha512-xxRs31BqRYHwiMzudOrpSiHtZ8i/GeionCBDSilhYRj+9gIcI8wCZTlXZKu9vZIVqViP3dcp9qE5G6AlIaD+TQ==", + "dev": true + }, "node_modules/spdy": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", @@ -19971,6 +19193,11 @@ "postcss": "^8.2.15" } }, + "node_modules/stylis": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.2.tgz", + "integrity": "sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg==" + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -20090,9 +19317,9 @@ } }, "node_modules/synckit": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.0.tgz", - "integrity": "sha512-7RnqIMq572L8PeEzKeBINYEJDDxpcH8JEgLwUqBd3TkofhFRbkq4QLR0u+36avGAhCRbk2nnmjcW9SE531hPDg==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.1.tgz", + "integrity": "sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==", "dev": true, "dependencies": { "@pkgr/core": "^0.1.0", @@ -20282,69 +19509,6 @@ "node": ">=8.0" } }, - "node_modules/to-vfile": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-7.2.4.tgz", - "integrity": "sha512-2eQ+rJ2qGbyw3senPI0qjuM7aut8IYXK6AEoOWb+fJx/mQYzviTckm1wDjq91QYHAPBTYzmdJXxMFA6Mk14mdw==", - "dev": true, - "dependencies": { - "is-buffer": "^2.0.0", - "vfile": "^5.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/to-vfile/node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", - "dev": true - }, - "node_modules/to-vfile/node_modules/unist-util-stringify-position": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", - "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/to-vfile/node_modules/vfile": { - "version": "5.3.7", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", - "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "is-buffer": "^2.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/to-vfile/node_modules/vfile-message": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", - "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-stringify-position": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/toggle-selection": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", @@ -20384,6 +19548,14 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/ts-dedent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-2.2.0.tgz", + "integrity": "sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==", + "engines": { + "node": ">=6.10" + } + }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -20623,32 +19795,31 @@ } }, "node_modules/unified-engine": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/unified-engine/-/unified-engine-10.1.0.tgz", - "integrity": "sha512-5+JDIs4hqKfHnJcVCxTid1yBoI/++FfF/1PFdSMpaftZZZY+qg2JFruRbf7PaIwa9KgLotXQV3gSjtY0IdcFGQ==", + "version": "11.2.1", + "resolved": "https://registry.npmjs.org/unified-engine/-/unified-engine-11.2.1.tgz", + "integrity": "sha512-xBAdZ8UY2X4R9Hm6X6kMne4Nz0PlpOc1oE6DPeqJnewr5Imkb8uT5Eyvy1h7xNekPL3PSWh3ZJyNrMW6jnNQBg==", "dev": true, "dependencies": { "@types/concat-stream": "^2.0.0", "@types/debug": "^4.0.0", "@types/is-empty": "^1.0.0", - "@types/node": "^18.0.0", - "@types/unist": "^2.0.0", + "@types/node": "^20.0.0", + "@types/unist": "^3.0.0", "concat-stream": "^2.0.0", "debug": "^4.0.0", - "fault": "^2.0.0", - "glob": "^8.0.0", + "extend": "^3.0.0", + "glob": "^10.0.0", "ignore": "^5.0.0", - "is-buffer": "^2.0.0", "is-empty": "^1.0.0", "is-plain-obj": "^4.0.0", - "load-plugin": "^5.0.0", - "parse-json": "^6.0.0", - "to-vfile": "^7.0.0", + "load-plugin": "^6.0.0", + "parse-json": "^7.0.0", "trough": "^2.0.0", - "unist-util-inspect": "^7.0.0", - "vfile-message": "^3.0.0", - "vfile-reporter": "^7.0.0", - "vfile-statistics": "^2.0.0", + "unist-util-inspect": "^8.0.0", + "vfile": "^6.0.0", + "vfile-message": "^4.0.0", + "vfile-reporter": "^8.0.0", + "vfile-statistics": "^3.0.0", "yaml": "^2.0.0" }, "funding": { @@ -20656,21 +19827,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/unified-engine/node_modules/@types/node": { - "version": "18.19.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.6.tgz", - "integrity": "sha512-X36s5CXMrrJOs2lQCdDF68apW4Rfx9ixYMawlepwmE4Anezv/AV2LSpKD1Ub8DAc+urp5bk0BGZ6NtmBitfnsg==", - "dev": true, - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/unified-engine/node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", - "dev": true - }, "node_modules/unified-engine/node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -20681,24 +19837,34 @@ } }, "node_modules/unified-engine/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dev": true, "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, - "engines": { - "node": ">=12" + "bin": { + "glob": "dist/esm/bin.mjs" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/unified-engine/node_modules/json-parse-even-better-errors": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.2.tgz", + "integrity": "sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/unified-engine/node_modules/lines-and-columns": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.4.tgz", @@ -20709,67 +19875,59 @@ } }, "node_modules/unified-engine/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=10" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/unified-engine/node_modules/parse-json": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-6.0.2.tgz", - "integrity": "sha512-SA5aMiaIjXkAiBrW/yPgLgQAQg42f7K3ACO+2l/zOvtQBwX58DMUsFJXelW2fx3yMBmWOVkR6j1MGsdSbCA4UA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-7.1.1.tgz", + "integrity": "sha512-SgOTCX/EZXtZxBE5eJ97P4yGM5n37BwRU+YMsH4vNzFqJV/oWFXXCmwFlgWUM4PrakybVOueJJ6pwHqSVhTFDw==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.16.0", + "@babel/code-frame": "^7.21.4", "error-ex": "^1.3.2", - "json-parse-even-better-errors": "^2.3.1", - "lines-and-columns": "^2.0.2" + "json-parse-even-better-errors": "^3.0.0", + "lines-and-columns": "^2.0.3", + "type-fest": "^3.8.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/unified-engine/node_modules/unist-util-stringify-position": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", - "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + "node_modules/unified-engine/node_modules/type-fest": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", + "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" + "engines": { + "node": ">=14.16" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unified-engine/node_modules/vfile-message": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", - "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-stringify-position": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/unified-engine/node_modules/yaml": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", - "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", + "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==", "dev": true, + "bin": { + "yaml": "bin.mjs" + }, "engines": { "node": ">= 14" } @@ -20789,24 +19947,18 @@ } }, "node_modules/unist-util-inspect": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/unist-util-inspect/-/unist-util-inspect-7.0.2.tgz", - "integrity": "sha512-Op0XnmHUl6C2zo/yJCwhXQSm/SmW22eDZdWP2qdf4WpGrgO1ZxFodq+5zFyeRGasFjJotAnLgfuD1jkcKqiH1Q==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/unist-util-inspect/-/unist-util-inspect-8.1.0.tgz", + "integrity": "sha512-mOlg8Mp33pR0eeFpo5d2902ojqFFOKMMG2hF8bmH7ZlhnmjFgh0NI3/ZDwdaBJNbvrS7LZFVrBVtIE9KZ9s7vQ==", "dev": true, "dependencies": { - "@types/unist": "^2.0.0" + "@types/unist": "^3.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" } }, - "node_modules/unist-util-inspect/node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", - "dev": true - }, "node_modules/unist-util-is": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", @@ -21126,7 +20278,6 @@ "version": "0.5.6", "resolved": "https://registry.npmjs.org/uvu/-/uvu-0.5.6.tgz", "integrity": "sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==", - "dev": true, "dependencies": { "dequal": "^2.0.0", "diff": "^5.0.0", @@ -21144,11 +20295,29 @@ "version": "4.1.5", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", - "dev": true, "engines": { "node": ">=6" } }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/validate-npm-package-name": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.1.tgz", + "integrity": "sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/value-equal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz", @@ -21203,31 +20372,75 @@ } }, "node_modules/vfile-reporter": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/vfile-reporter/-/vfile-reporter-7.0.5.tgz", - "integrity": "sha512-NdWWXkv6gcd7AZMvDomlQbK3MqFWL1RlGzMn++/O2TI+68+nqxCPTvLugdOtfSzXmjh+xUyhp07HhlrbJjT+mw==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/vfile-reporter/-/vfile-reporter-8.1.1.tgz", + "integrity": "sha512-qxRZcnFSQt6pWKn3PAk81yLK2rO2i7CDXpy8v8ZquiEOMLSnPw6BMSi9Y1sUCwGGl7a9b3CJT1CKpnRF7pp66g==", "dev": true, "dependencies": { "@types/supports-color": "^8.0.0", - "string-width": "^5.0.0", + "string-width": "^6.0.0", "supports-color": "^9.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile": "^5.0.0", - "vfile-message": "^3.0.0", - "vfile-sort": "^3.0.0", - "vfile-statistics": "^2.0.0" + "unist-util-stringify-position": "^4.0.0", + "vfile": "^6.0.0", + "vfile-message": "^4.0.0", + "vfile-sort": "^4.0.0", + "vfile-statistics": "^3.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" } }, - "node_modules/vfile-reporter/node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", + "node_modules/vfile-reporter/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/vfile-reporter/node_modules/emoji-regex": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", "dev": true }, + "node_modules/vfile-reporter/node_modules/string-width": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-6.1.0.tgz", + "integrity": "sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^10.2.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vfile-reporter/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/vfile-reporter/node_modules/supports-color": { "version": "9.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.4.0.tgz", @@ -21240,106 +20453,14 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/vfile-reporter/node_modules/unist-util-stringify-position": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", - "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-reporter/node_modules/vfile": { - "version": "5.3.7", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", - "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "is-buffer": "^2.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-reporter/node_modules/vfile-message": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", - "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-stringify-position": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/vfile-sort": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/vfile-sort/-/vfile-sort-3.0.1.tgz", - "integrity": "sha512-1os1733XY6y0D5x0ugqSeaVJm9lYgj0j5qdcZQFyxlZOSy1jYarL77lLyb5gK4Wqr1d5OxmuyflSO3zKyFnTFw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/vfile-sort/-/vfile-sort-4.0.0.tgz", + "integrity": "sha512-lffPI1JrbHDTToJwcq0rl6rBmkjQmMuXkAxsZPRS9DXbaJQvc642eCg6EGxcX2i1L+esbuhq+2l9tBll5v8AeQ==", "dev": true, "dependencies": { - "vfile": "^5.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-sort/node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", - "dev": true - }, - "node_modules/vfile-sort/node_modules/unist-util-stringify-position": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", - "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-sort/node_modules/vfile": { - "version": "5.3.7", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", - "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "is-buffer": "^2.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-sort/node_modules/vfile-message": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", - "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-stringify-position": "^3.0.0" + "vfile": "^6.0.0", + "vfile-message": "^4.0.0" }, "funding": { "type": "opencollective", @@ -21347,62 +20468,13 @@ } }, "node_modules/vfile-statistics": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/vfile-statistics/-/vfile-statistics-2.0.1.tgz", - "integrity": "sha512-W6dkECZmP32EG/l+dp2jCLdYzmnDBIw6jwiLZSER81oR5AHRcVqL+k3Z+pfH1R73le6ayDkJRMk0sutj1bMVeg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/vfile-statistics/-/vfile-statistics-3.0.0.tgz", + "integrity": "sha512-/qlwqwWBWFOmpXujL/20P+Iuydil0rZZNglR+VNm6J0gpLHwuVM5s7g2TfVoswbXjZ4HuIhLMySEyIw5i7/D8w==", "dev": true, "dependencies": { - "vfile": "^5.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-statistics/node_modules/@types/unist": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", - "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", - "dev": true - }, - "node_modules/vfile-statistics/node_modules/unist-util-stringify-position": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", - "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-statistics/node_modules/vfile": { - "version": "5.3.7", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", - "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "is-buffer": "^2.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-statistics/node_modules/vfile-message": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", - "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", - "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-stringify-position": "^3.0.0" + "vfile": "^6.0.0", + "vfile-message": "^4.0.0" }, "funding": { "type": "opencollective", @@ -21449,6 +20521,11 @@ "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.20.8.tgz", "integrity": "sha512-weOVgZ3aAARgdnb220GqYuh7+rZU0Ka9k9yfKtGAzEYMa6GgiCzW9JjQRJyCJakvibQW+dfjJdihjInKuuCAUQ==" }, + "node_modules/web-worker": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.3.0.tgz", + "integrity": "sha512-BSR9wyRsy/KOValMgd5kMyr3JzpdeoR9KVId8u5GVlTTAtNChlsE4yTxeY7zMdNSyOmoKBv8NH2qeRY9Tg+IaA==" + }, "node_modules/webpack": { "version": "5.89.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.89.0.tgz", diff --git a/docs/package.json b/docs/package.json index a0801763..78a0817f 100644 --- a/docs/package.json +++ b/docs/package.json @@ -17,6 +17,7 @@ "dependencies": { "@docusaurus/core": "^3.0.0", "@docusaurus/preset-classic": "^3.0.0", + "@docusaurus/theme-mermaid": "^3.0.0", "@fortawesome/fontawesome-svg-core": "^6.4.2", "@fortawesome/free-solid-svg-icons": "^6.4.0", "@fortawesome/react-fontawesome": "^0.2.0", @@ -52,7 +53,7 @@ "@types/react-router-dom": "^5.1.7", "eslint": "^8.39.0", "eslint-config-prettier": "^8.8.0", - "eslint-plugin-mdx": "^2.0.5", + "eslint-plugin-mdx": "^3.1.5", "eslint-plugin-react": "^7.33.2", "json-schema-to-typescript": "^13.1.1", "mustache": "^4.2.0", diff --git a/docs/sidebars.js b/docs/sidebars.js index ebf0aef7..d4c398b4 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -1,98 +1,152 @@ module.exports = { - docs: { - "Getting Started": [ - "intro", - "hardware", - "faq", - "user-setup", - "customization", - "troubleshooting", - ], - Features: [ - "features/keymaps", - "features/bluetooth", - "features/combos", - "features/conditional-layers", - "features/debouncing", - "features/displays", - "features/encoders", - "features/underglow", - "features/backlight", - "features/battery", - "features/soft-off", - "features/beta-testing", - ], - Behaviors: [ - "behaviors/index", - "behaviors/key-press", - "behaviors/layers", - "behaviors/misc", - "behaviors/hold-tap", - "behaviors/mod-tap", - "behaviors/mod-morph", - "behaviors/macros", - "behaviors/key-toggle", - "behaviors/sticky-key", - "behaviors/sticky-layer", - "behaviors/tap-dance", - "behaviors/caps-word", - "behaviors/key-repeat", - "behaviors/sensor-rotate", - "behaviors/mouse-emulation", - "behaviors/reset", - "behaviors/bluetooth", - "behaviors/outputs", - "behaviors/underglow", - "behaviors/backlight", - "behaviors/power", - "behaviors/soft-off", - ], - Codes: [ - "codes/index", - "codes/keyboard-keypad", - "codes/modifiers", - "codes/editing", - "codes/media", - "codes/applications", - "codes/input-assist", - "codes/power", - ], - Configuration: [ - "config/index", - "config/backlight", - "config/battery", - "config/behaviors", - "config/bluetooth", - "config/combos", - "config/displays", - "config/encoders", - "config/keymap", - "config/kscan", - "config/power", - "config/underglow", - "config/system", - ], - Development: [ - "development/clean-room", - "development/pre-commit", - "development/documentation", - "development/setup", - "development/build-flash", - "development/boards-shields-keymaps", - "development/posix-board", - "development/tests", - "development/usb-logging", - "development/ide-integration", - { - type: "category", - label: "Guides", - collapsed: false, - items: [ - "development/new-shield", - "development/hardware-metadata-files", - "development/new-behavior", - ], + docs: [ + { + type: "category", + label: "Getting Started", + link: { + type: "doc", + id: "intro", }, - ], - }, + collapsed: false, + items: [ + "hardware", + "faq", + "user-setup", + "customization", + { + type: "category", + label: "Troubleshooting", + link: { + type: "doc", + id: "troubleshooting/index", + }, + collapsed: true, + items: [ + "troubleshooting/building-issues", + "troubleshooting/flashing-issues", + "troubleshooting/connection-issues", + ], + }, + ], + }, + { + Features: [ + "features/keymaps", + "features/bluetooth", + "features/split-keyboards", + "features/combos", + "features/conditional-layers", + "features/debouncing", + "features/displays", + "features/encoders", + "features/modules", + "features/underglow", + "features/backlight", + "features/battery", + "features/soft-off", + ], + }, + { + type: "category", + label: "Behaviors", + link: { + type: "doc", + id: "behaviors/index", + }, + collapsed: true, + items: [ + "behaviors/key-press", + "behaviors/layers", + "behaviors/misc", + "behaviors/hold-tap", + "behaviors/mod-tap", + "behaviors/mod-morph", + "behaviors/macros", + "behaviors/key-toggle", + "behaviors/sticky-key", + "behaviors/sticky-layer", + "behaviors/tap-dance", + "behaviors/caps-word", + "behaviors/key-repeat", + "behaviors/sensor-rotate", + "behaviors/mouse-emulation", + "behaviors/reset", + "behaviors/bluetooth", + "behaviors/outputs", + "behaviors/underglow", + "behaviors/backlight", + "behaviors/power", + "behaviors/soft-off", + ], + }, + { + Codes: [ + "codes/index", + "codes/keyboard-keypad", + "codes/modifiers", + "codes/editing", + "codes/media", + "codes/applications", + "codes/input-assist", + "codes/power", + ], + }, + { + type: "category", + label: "Configuration", + link: { + type: "doc", + id: "config/index", + }, + collapsed: true, + items: [ + "config/backlight", + "config/battery", + "config/behaviors", + "config/bluetooth", + "config/combos", + "config/displays", + "config/encoders", + "config/keymap", + "config/kscan", + "config/power", + "config/underglow", + "config/system", + ], + }, + { + Development: [ + "development/clean-room", + "development/pre-commit", + "development/documentation", + { + type: "category", + label: "Setup", + collapsed: true, + items: [ + "development/setup/index", + "development/setup/docker", + "development/setup/native", + ], + }, + "development/build-flash", + "development/boards-shields-keymaps", + "development/posix-board", + "development/tests", + "development/usb-logging", + "development/ide-integration", + "development/studio-rpc-protocol", + { + type: "category", + label: "Guides", + collapsed: false, + items: [ + "development/new-shield", + "development/hardware-metadata-files", + "development/new-behavior", + ], + }, + ], + }, + ], }; diff --git a/docs/src/components/codes/SpellingCaution.jsx b/docs/src/components/codes/SpellingCaution.jsx deleted file mode 100644 index 84e6f800..00000000 --- a/docs/src/components/codes/SpellingCaution.jsx +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2020 The ZMK Contributors - * - * SPDX-License-Identifier: CC-BY-NC-SA-4.0 - */ - -import Admonition from "@theme/Admonition"; - -export default function SpellingCaution() { - return ( - -

- Take extra notice of the spelling of the keycodes, especially the - shorthand spelling. Otherwise, it will result in an elusive parsing - error! -

-
- ); -} - -SpellingCaution.propTypes = {}; diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css index c2df00e2..99920d54 100644 --- a/docs/src/css/custom.css +++ b/docs/src/css/custom.css @@ -46,3 +46,7 @@ width: 100%; height: 100%; } + +.secrettabs { + display: none; +} diff --git a/docs/src/docusaurus-tree-sitter-plugin/index.js b/docs/src/docusaurus-tree-sitter-plugin/index.js index a6952ce7..e7f5596b 100644 --- a/docs/src/docusaurus-tree-sitter-plugin/index.js +++ b/docs/src/docusaurus-tree-sitter-plugin/index.js @@ -6,6 +6,7 @@ module.exports = function () { return { + name: "tree-sitter", configureWebpack(config, isServer) { let rules = []; diff --git a/docs/src/templates/setup.ps1.mustache b/docs/src/templates/setup.ps1.mustache index b8ecc293..33a4be38 100644 --- a/docs/src/templates/setup.ps1.mustache +++ b/docs/src/templates/setup.ps1.mustache @@ -308,6 +308,6 @@ if ($github_repo -ne "") { if ($github_repo -imatch "https") { $actions = "$($github_repo.substring(0, $github_repo.length - 4))/actions" - Write-Host "Your firmware should be availalbe from GitHub Actions shortly: $actions" + Write-Host "Your firmware should be available from GitHub Actions shortly: $actions" } } diff --git a/docs/src/templates/setup.sh.mustache b/docs/src/templates/setup.sh.mustache index dd7a7a2d..cde3a8a1 100644 --- a/docs/src/templates/setup.sh.mustache +++ b/docs/src/templates/setup.sh.mustache @@ -297,7 +297,7 @@ if [ -n "$github_repo" ]; then exit 1 fi - # TODO: Support determing the actions URL when non-https:// repo URL is used. + # TODO: Support determining the actions URL when non-https:// repo URL is used. if [ "${github_repo}" != "${github_repo#https://}" ]; then echo "Your firmware should be available from GitHub Actions shortly: ${github_repo%.git}/actions" fi