diff --git a/.github/workflows/build-user-config.yml b/.github/workflows/build-user-config.yml index cb462b1a..c3aeff20 100644 --- a/.github/workflows/build-user-config.yml +++ b/.github/workflows/build-user-config.yml @@ -1,21 +1,21 @@ name: Reusable user config build -on: +on: workflow_call: inputs: build_matrix_path: - description: 'Path to the build matrix file' - default: 'build.yaml' + description: "Path to the build matrix file" + default: "build.yaml" required: false type: string config_path: - description: 'Path to the config directory' - default: 'config' + description: "Path to the config directory" + default: "config" required: false type: string fallback_binary: - description: 'Fallback binary format, if no *.uf2 file was built' - default: 'bin' + description: "Fallback binary format, if no *.uf2 file was built" + default: "bin" required: false type: string @@ -71,6 +71,7 @@ jobs: - name: Cache west modules uses: actions/cache@v3.0.1 + continue-on-error: true env: cache-name: cache-zephyr-${{ steps.variables.outputs.zephyr-version }}-modules with: @@ -101,7 +102,7 @@ jobs: - name: ${{ steps.variables.outputs.display-name }} Kconfig file run: cat build/zephyr/.config | grep -v "^#" | grep -v "^$" | sort - + - name: Rename artifacts run: | mkdir build/artifacts @@ -112,7 +113,7 @@ jobs: then cp build/zephyr/zmk.${{ inputs.fallback_binary }} "build/artifacts/${{ steps.variables.outputs.artifact-name }}.${{ inputs.fallback_binary }}" fi - + - name: Archive (${{ steps.variables.outputs.display-name }}) uses: actions/upload-artifact@v2 with: diff --git a/app/Kconfig b/app/Kconfig index 8b13d524..9b47c4c2 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -88,6 +88,9 @@ if ZMK_USB config USB_NUMOF_EP_WRITE_RETRIES default 10 +config USB_HID_POLL_INTERVAL_MS + default 1 + #ZMK_USB endif @@ -142,6 +145,18 @@ config ZMK_BLE_PASSKEY_ENTRY bool "Experimental: Requiring typing passkey from host to pair BLE connection" default n +config BT_PERIPHERAL_PREF_MIN_INT + default 6 + +config BT_PERIPHERAL_PREF_MAX_INT + default 12 + +config BT_PERIPHERAL_PREF_LATENCY + default 30 + +config BT_PERIPHERAL_PREF_TIMEOUT + default 400 + #ZMK_BLE endif @@ -163,6 +178,7 @@ menuconfig ZMK_SPLIT_BLE depends on ZMK_BLE default y select BT_USER_PHY_UPDATE + select BT_AUTO_PHY_UPDATE if ZMK_SPLIT_BLE @@ -192,7 +208,7 @@ if !ZMK_SPLIT_BLE_ROLE_CENTRAL config ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE int "BLE split peripheral notify thread stack size" - default 512 + default 650 config ZMK_SPLIT_BLE_PERIPHERAL_PRIORITY int "BLE split peripheral notify thread priority" @@ -211,8 +227,8 @@ config BT_MAX_PAIRED config BT_MAX_CONN default 1 -config BT_GAP_AUTO_UPDATE_CONN_PARAMS - default n +config BT_PERIPHERAL_PREF_MAX_INT + default 6 #!ZMK_SPLIT_BLE_ROLE_CENTRAL endif @@ -448,12 +464,6 @@ config ZMK_KSCAN_EVENT_QUEUE_SIZE int "Size of the event queue for KSCAN events to buffer events" default 4 -config ZMK_KSCAN_MOCK_DRIVER - bool "Enable mock kscan driver to simulate key presses" - -config ZMK_KSCAN_COMPOSITE_DRIVER - bool "Enable composite kscan driver to combine kscan devices" - #KSCAN Settings endmenu diff --git a/app/boards/arm/bdn9/bdn9_rev2.dts b/app/boards/arm/bdn9/bdn9_rev2.dts index 8a66be07..e75893d6 100644 --- a/app/boards/arm/bdn9/bdn9_rev2.dts +++ b/app/boards/arm/bdn9/bdn9_rev2.dts @@ -72,7 +72,7 @@ &spi2 { status = "okay"; - pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>; + pinctrl-0 = <&spi2_sck_pb13 &spi2_mosi_pb15>; pinctrl-names = "default"; led_strip: ws2812@0 { diff --git a/app/boards/arm/bluemicro840/Kconfig.defconfig b/app/boards/arm/bluemicro840/Kconfig.defconfig index bc68f311..5d911ec6 100644 --- a/app/boards/arm/bluemicro840/Kconfig.defconfig +++ b/app/boards/arm/bluemicro840/Kconfig.defconfig @@ -24,7 +24,4 @@ config ZMK_BLE config ZMK_USB default y -config ZMK_BATTERY_VOLTAGE_DIVIDER - default y - endif # BOARD_BLUEMICRO840_V1 diff --git a/app/boards/arm/bt60/Kconfig.defconfig b/app/boards/arm/bt60/Kconfig.defconfig index 7e7ab124..bad1e7cd 100644 --- a/app/boards/arm/bt60/Kconfig.defconfig +++ b/app/boards/arm/bt60/Kconfig.defconfig @@ -25,9 +25,6 @@ config ZMK_BLE config ZMK_USB default y -config ZMK_BATTERY_VOLTAGE_DIVIDER - default y - config ZMK_KEYBOARD_NAME default "BT60" diff --git a/app/boards/arm/ferris/Kconfig.defconfig b/app/boards/arm/ferris/Kconfig.defconfig index 23bc8a1e..c59cb902 100644 --- a/app/boards/arm/ferris/Kconfig.defconfig +++ b/app/boards/arm/ferris/Kconfig.defconfig @@ -17,7 +17,4 @@ config ZMK_USB config ZMK_KSCAN_MATRIX_POLLING default y -config ZMK_KSCAN_COMPOSITE_DRIVER - default y - endif # BOARD_FERRIS diff --git a/app/boards/arm/ferris/ferris_rev02_defconfig b/app/boards/arm/ferris/ferris_rev02_defconfig index 8742cd86..934dc4a0 100644 --- a/app/boards/arm/ferris/ferris_rev02_defconfig +++ b/app/boards/arm/ferris/ferris_rev02_defconfig @@ -17,8 +17,6 @@ CONFIG_I2C=y # ZMK Settings CONFIG_ZMK_USB=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=y -CONFIG_ZMK_KSCAN_COMPOSITE_DRIVER=y CONFIG_ZMK_KSCAN_MATRIX_POLLING=y CONFIG_USB_SELF_POWERED=n diff --git a/app/boards/arm/mikoto/Kconfig.defconfig b/app/boards/arm/mikoto/Kconfig.defconfig index 2ca77b9e..6aafc613 100644 --- a/app/boards/arm/mikoto/Kconfig.defconfig +++ b/app/boards/arm/mikoto/Kconfig.defconfig @@ -34,7 +34,4 @@ choice BOARD_MIKOTO_CHARGER_CURRENT default BOARD_MIKOTO_CHARGER_CURRENT_100MA endchoice -config ZMK_BATTERY_VOLTAGE_DIVIDER - default y - endif # BOARD_MIKOTO_520 diff --git a/app/boards/arm/mikoto/mikoto_520.dts b/app/boards/arm/mikoto/mikoto_520.dts index 44321e79..49d9d6be 100644 --- a/app/boards/arm/mikoto/mikoto_520.dts +++ b/app/boards/arm/mikoto/mikoto_520.dts @@ -38,7 +38,7 @@ vbatt: vbatt { compatible = "zmk,battery-voltage-divider"; label = "BATTERY"; - io-channels = <&adc 2>; + io-channels = <&adc 1>; output-ohms = <10000000>; full-ohms = <(10000000 + 4000000)>; }; diff --git a/app/boards/arm/nice60/Kconfig.defconfig b/app/boards/arm/nice60/Kconfig.defconfig index 42d417ab..39cf1540 100644 --- a/app/boards/arm/nice60/Kconfig.defconfig +++ b/app/boards/arm/nice60/Kconfig.defconfig @@ -22,7 +22,4 @@ config ZMK_BLE config ZMK_USB default y -config ZMK_BATTERY_VOLTAGE_DIVIDER - default y - endif # BOARD_NICE60 diff --git a/app/boards/arm/nice_nano/Kconfig.defconfig b/app/boards/arm/nice_nano/Kconfig.defconfig index 24571653..ad3fefef 100644 --- a/app/boards/arm/nice_nano/Kconfig.defconfig +++ b/app/boards/arm/nice_nano/Kconfig.defconfig @@ -23,17 +23,3 @@ config ZMK_USB default y endif # BOARD_NICE_NANO || BOARD_NICE_NANO_V2 - -if BOARD_NICE_NANO - -config ZMK_BATTERY_VOLTAGE_DIVIDER - default y - -endif # BOARD_NICE_NANO - -if BOARD_NICE_NANO_V2 - -config ZMK_BATTERY_NRF_VDDH - default y - -endif # BOARD_NICE_NANO_V2 diff --git a/app/boards/arm/nrfmicro/Kconfig.defconfig b/app/boards/arm/nrfmicro/Kconfig.defconfig index 754a430e..159d9ade 100644 --- a/app/boards/arm/nrfmicro/Kconfig.defconfig +++ b/app/boards/arm/nrfmicro/Kconfig.defconfig @@ -32,9 +32,6 @@ if BOARD_NRFMICRO_13 config BOARD_NRFMICRO_CHARGER default y -config ZMK_BATTERY_VOLTAGE_DIVIDER - default y - endif # BOARD_NRFMICRO_13 endif # BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13 diff --git a/app/boards/arm/s40nc/Kconfig.defconfig b/app/boards/arm/s40nc/Kconfig.defconfig index 0f407151..266f8443 100644 --- a/app/boards/arm/s40nc/Kconfig.defconfig +++ b/app/boards/arm/s40nc/Kconfig.defconfig @@ -25,7 +25,4 @@ config ZMK_BLE config ZMK_USB default y -config ZMK_BATTERY_VOLTAGE_DIVIDER - default y - endif # BOARD_S40NC diff --git a/app/boards/native_posix.conf b/app/boards/native_posix.conf index fa9d953e..c3d0260e 100644 --- a/app/boards/native_posix.conf +++ b/app/boards/native_posix.conf @@ -1,6 +1,3 @@ -CONFIG_KSCAN=n -CONFIG_ZMK_KSCAN_MOCK_DRIVER=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=n CONFIG_ZMK_BLE=n CONFIG_LOG=y diff --git a/app/boards/native_posix_64.conf b/app/boards/native_posix_64.conf index 7d3e62b7..0d8e0d81 100644 --- a/app/boards/native_posix_64.conf +++ b/app/boards/native_posix_64.conf @@ -1,6 +1,3 @@ -CONFIG_KSCAN=n -CONFIG_ZMK_KSCAN_MOCK_DRIVER=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=n # Enable to have the native posix build expose USBIP device(s) # CONFIG_ZMK_USB=y diff --git a/app/boards/seeeduino_xiao_ble.conf b/app/boards/seeeduino_xiao_ble.conf index 22e6a9b5..205f67e9 100644 --- a/app/boards/seeeduino_xiao_ble.conf +++ b/app/boards/seeeduino_xiao_ble.conf @@ -3,7 +3,13 @@ CONFIG_CONSOLE=n CONFIG_SERIAL=n CONFIG_UART_CONSOLE=n CONFIG_UART_INTERRUPT_DRIVEN=n -CONFIG_ZMK_BATTERY_VOLTAGE_DIVIDER=y CONFIG_ZMK_USB=y CONFIG_ZMK_BLE=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 \ No newline at end of file diff --git a/app/drivers/kscan/CMakeLists.txt b/app/drivers/kscan/CMakeLists.txt index c19fa431..ced31e6f 100644 --- a/app/drivers/kscan/CMakeLists.txt +++ b/app/drivers/kscan/CMakeLists.txt @@ -5,8 +5,8 @@ zephyr_library_named(zmk__drivers__kscan) zephyr_library_include_directories(${CMAKE_SOURCE_DIR}/include) zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DRIVER debounce.c) -zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DRIVER kscan_gpio_matrix.c) -zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DRIVER kscan_gpio_direct.c) -zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DRIVER kscan_gpio_demux.c) +zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_MATRIX kscan_gpio_matrix.c) +zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DIRECT kscan_gpio_direct.c) +zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DEMUX kscan_gpio_demux.c) zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_MOCK_DRIVER kscan_mock.c) zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_COMPOSITE_DRIVER kscan_composite.c) diff --git a/app/drivers/kscan/Kconfig b/app/drivers/kscan/Kconfig index 3ffec09c..c9ace0a3 100644 --- a/app/drivers/kscan/Kconfig +++ b/app/drivers/kscan/Kconfig @@ -1,11 +1,39 @@ # Copyright (c) 2020 The ZMK Contributors # SPDX-License-Identifier: MIT +DT_COMPAT_ZMK_KSCAN_COMPOSITE := zmk,kscan-composite +DT_COMPAT_ZMK_KSCAN_GPIO_DEMUX := zmk,kscan-gpio-demux +DT_COMPAT_ZMK_KSCAN_GPIO_DIRECT := zmk,kscan-gpio-direct +DT_COMPAT_ZMK_KSCAN_GPIO_MATRIX := zmk,kscan-gpio-matrix +DT_COMPAT_ZMK_KSCAN_MOCK := zmk,kscan-mock + +config ZMK_KSCAN_COMPOSITE_DRIVER + bool + default $(dt_compat_enabled,$(DT_COMPAT_ZMK_KSCAN_COMPOSITE)) + config ZMK_KSCAN_GPIO_DRIVER - bool "Enable GPIO kscan driver to detect key presses" - default y + bool select GPIO +config ZMK_KSCAN_GPIO_DEMUX + bool + default $(dt_compat_enabled,$(DT_COMPAT_ZMK_KSCAN_GPIO_DEMUX)) + select ZMK_KSCAN_GPIO_DRIVER + +config ZMK_KSCAN_GPIO_DIRECT + bool + default $(dt_compat_enabled,$(DT_COMPAT_ZMK_KSCAN_GPIO_DIRECT)) + select ZMK_KSCAN_GPIO_DRIVER + +config ZMK_KSCAN_GPIO_MATRIX + bool + default $(dt_compat_enabled,$(DT_COMPAT_ZMK_KSCAN_GPIO_MATRIX)) + select ZMK_KSCAN_GPIO_DRIVER + +config ZMK_KSCAN_MOCK_DRIVER + bool + default $(dt_compat_enabled,$(DT_COMPAT_ZMK_KSCAN_MOCK)) + if ZMK_KSCAN_GPIO_DRIVER config ZMK_KSCAN_MATRIX_POLLING diff --git a/app/drivers/kscan/kscan_gpio_demux.c b/app/drivers/kscan/kscan_gpio_demux.c index e064a942..6e3d9e79 100644 --- a/app/drivers/kscan/kscan_gpio_demux.c +++ b/app/drivers/kscan/kscan_gpio_demux.c @@ -13,8 +13,6 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) - struct kscan_gpio_item_config { char *label; gpio_pin_t pin; @@ -251,5 +249,3 @@ struct kscan_gpio_item_config { &gpio_driver_api_##n); DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT) - -#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/drivers/kscan/kscan_gpio_direct.c b/app/drivers/kscan/kscan_gpio_direct.c index 3f4f5a1b..a67f0895 100644 --- a/app/drivers/kscan/kscan_gpio_direct.c +++ b/app/drivers/kscan/kscan_gpio_direct.c @@ -13,8 +13,6 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) - struct kscan_gpio_item_config { char *label; gpio_pin_t pin; @@ -242,5 +240,3 @@ static const struct kscan_driver_api gpio_driver_api = { &gpio_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT) - -#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/drivers/kscan/kscan_gpio_matrix.c b/app/drivers/kscan/kscan_gpio_matrix.c index b41e09b7..4ef5d5a0 100644 --- a/app/drivers/kscan/kscan_gpio_matrix.c +++ b/app/drivers/kscan/kscan_gpio_matrix.c @@ -19,8 +19,6 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #define DT_DRV_COMPAT zmk_kscan_gpio_matrix -#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) - #define INST_DIODE_DIR(n) DT_ENUM_IDX(DT_DRV_INST(n), diode_direction) #define COND_DIODE_DIR(n, row2col_code, col2row_code) \ COND_CODE_0(INST_DIODE_DIR(n), row2col_code, col2row_code) @@ -51,29 +49,10 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #define COND_POLL_OR_INTERRUPTS(pollcode, intcode) \ COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, pollcode, intcode) -// TODO (Zephr 2.6): replace the following -// kscan_gpio_dt_spec -> gpio_dt_spec -// KSCAN_GPIO_DT_SPEC_GET_BY_IDX -> GPIO_DT_SPEC_GET_BY_IDX -// gpio_pin_get -> gpio_pin_get_dt -// gpio_pin_set -> gpio_pin_set_dt -// gpio_pin_interrupt_configure -> gpio_pin_interrupt_configure_dt -struct kscan_gpio_dt_spec { - const struct device *port; - gpio_pin_t pin; - gpio_dt_flags_t dt_flags; -}; - -#define KSCAN_GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, idx) \ - { \ - .port = DEVICE_DT_GET(DT_GPIO_CTLR_BY_IDX(node_id, prop, idx)), \ - .pin = DT_GPIO_PIN_BY_IDX(node_id, prop, idx), \ - .dt_flags = DT_GPIO_FLAGS_BY_IDX(node_id, prop, idx), \ - } - #define KSCAN_GPIO_ROW_CFG_INIT(idx, inst_idx) \ - KSCAN_GPIO_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst_idx), row_gpios, idx), + GPIO_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst_idx), row_gpios, idx), #define KSCAN_GPIO_COL_CFG_INIT(idx, inst_idx) \ - KSCAN_GPIO_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst_idx), col_gpios, idx), + GPIO_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst_idx), col_gpios, idx), enum kscan_diode_direction { KSCAN_ROW2COL, @@ -103,7 +82,7 @@ struct kscan_matrix_data { }; struct kscan_gpio_list { - const struct kscan_gpio_dt_spec *gpios; + const struct gpio_dt_spec *gpios; size_t len; }; @@ -146,9 +125,9 @@ static int kscan_matrix_set_all_outputs(const struct device *dev, const int valu const struct kscan_matrix_config *config = dev->config; for (int i = 0; i < config->outputs.len; i++) { - const struct kscan_gpio_dt_spec *gpio = &config->outputs.gpios[i]; + const struct gpio_dt_spec *gpio = &config->outputs.gpios[i]; - int err = gpio_pin_set(gpio->port, gpio->pin, value); + int err = gpio_pin_set_dt(gpio, value); if (err) { LOG_ERR("Failed to set output %i to %i: %i", i, value, err); return err; @@ -163,9 +142,9 @@ static int kscan_matrix_interrupt_configure(const struct device *dev, const gpio const struct kscan_matrix_config *config = dev->config; for (int i = 0; i < config->inputs.len; i++) { - const struct kscan_gpio_dt_spec *gpio = &config->inputs.gpios[i]; + const struct gpio_dt_spec *gpio = &config->inputs.gpios[i]; - int err = gpio_pin_interrupt_configure(gpio->port, gpio->pin, flags); + int err = gpio_pin_interrupt_configure_dt(gpio, flags); if (err) { LOG_ERR("Unable to configure interrupt for pin %u on %s", gpio->pin, gpio->port->name); return err; @@ -248,25 +227,25 @@ static int kscan_matrix_read(const struct device *dev) { // Scan the matrix. for (int o = 0; o < config->outputs.len; o++) { - const struct kscan_gpio_dt_spec *out_gpio = &config->outputs.gpios[o]; + const struct gpio_dt_spec *out_gpio = &config->outputs.gpios[o]; - int err = gpio_pin_set(out_gpio->port, out_gpio->pin, 1); + int err = gpio_pin_set_dt(out_gpio, 1); if (err) { LOG_ERR("Failed to set output %i active: %i", o, err); return err; } for (int i = 0; i < config->inputs.len; i++) { - const struct kscan_gpio_dt_spec *in_gpio = &config->inputs.gpios[i]; + const struct gpio_dt_spec *in_gpio = &config->inputs.gpios[i]; const int index = state_index_io(config, i, o); - const bool active = gpio_pin_get(in_gpio->port, in_gpio->pin); + const bool active = gpio_pin_get_dt(in_gpio); debounce_update(&data->matrix_state[index], active, config->debounce_scan_period_ms, &config->debounce_config); } - err = gpio_pin_set(out_gpio->port, out_gpio->pin, 0); + err = gpio_pin_set_dt(out_gpio, 0); if (err) { LOG_ERR("Failed to set output %i inactive: %i", o, err); return err; @@ -342,14 +321,14 @@ static int kscan_matrix_disable(const struct device *dev) { #endif } -static int kscan_matrix_init_input_inst(const struct device *dev, - const struct kscan_gpio_dt_spec *gpio, const int index) { +static int kscan_matrix_init_input_inst(const struct device *dev, const struct gpio_dt_spec *gpio, + const int index) { if (!device_is_ready(gpio->port)) { LOG_ERR("GPIO is not ready: %s", gpio->port->name); return -ENODEV; } - int err = gpio_pin_configure(gpio->port, gpio->pin, GPIO_INPUT | gpio->dt_flags); + int err = gpio_pin_configure_dt(gpio, GPIO_INPUT); if (err) { LOG_ERR("Unable to configure pin %u on %s for input", gpio->pin, gpio->port->name); return err; @@ -377,7 +356,7 @@ static int kscan_matrix_init_inputs(const struct device *dev) { const struct kscan_matrix_config *config = dev->config; for (int i = 0; i < config->inputs.len; i++) { - const struct kscan_gpio_dt_spec *gpio = &config->inputs.gpios[i]; + const struct gpio_dt_spec *gpio = &config->inputs.gpios[i]; int err = kscan_matrix_init_input_inst(dev, gpio, i); if (err) { return err; @@ -388,13 +367,13 @@ static int kscan_matrix_init_inputs(const struct device *dev) { } static int kscan_matrix_init_output_inst(const struct device *dev, - const struct kscan_gpio_dt_spec *gpio) { + const struct gpio_dt_spec *gpio) { if (!device_is_ready(gpio->port)) { LOG_ERR("GPIO is not ready: %s", gpio->port->name); return -ENODEV; } - int err = gpio_pin_configure(gpio->port, gpio->pin, GPIO_OUTPUT | gpio->dt_flags); + int err = gpio_pin_configure_dt(gpio, GPIO_OUTPUT); if (err) { LOG_ERR("Unable to configure pin %u on %s for output", gpio->pin, gpio->port->name); return err; @@ -409,7 +388,7 @@ static int kscan_matrix_init_outputs(const struct device *dev) { const struct kscan_matrix_config *config = dev->config; for (int i = 0; i < config->outputs.len; i++) { - const struct kscan_gpio_dt_spec *gpio = &config->outputs.gpios[i]; + const struct gpio_dt_spec *gpio = &config->outputs.gpios[i]; int err = kscan_matrix_init_output_inst(dev, gpio); if (err) { return err; @@ -445,10 +424,10 @@ static const struct kscan_driver_api kscan_matrix_api = { BUILD_ASSERT(INST_DEBOUNCE_RELEASE_MS(index) <= DEBOUNCE_COUNTER_MAX, \ "ZMK_KSCAN_DEBOUNCE_RELEASE_MS or debounce-release-ms is too large"); \ \ - static const struct kscan_gpio_dt_spec kscan_matrix_rows_##index[] = { \ + static const struct gpio_dt_spec kscan_matrix_rows_##index[] = { \ UTIL_LISTIFY(INST_ROWS_LEN(index), KSCAN_GPIO_ROW_CFG_INIT, index)}; \ \ - static const struct kscan_gpio_dt_spec kscan_matrix_cols_##index[] = { \ + static const struct gpio_dt_spec kscan_matrix_cols_##index[] = { \ UTIL_LISTIFY(INST_COLS_LEN(index), KSCAN_GPIO_COL_CFG_INIT, index)}; \ \ static struct debounce_state kscan_matrix_state_##index[INST_MATRIX_LEN(index)]; \ @@ -482,5 +461,3 @@ static const struct kscan_driver_api kscan_matrix_api = { CONFIG_APPLICATION_INIT_PRIORITY, &kscan_matrix_api); DT_INST_FOREACH_STATUS_OKAY(KSCAN_MATRIX_INIT); - -#endif // DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) diff --git a/app/drivers/sensor/battery/Kconfig b/app/drivers/sensor/battery/Kconfig index fd8cd26d..d7c82bb0 100644 --- a/app/drivers/sensor/battery/Kconfig +++ b/app/drivers/sensor/battery/Kconfig @@ -1,20 +1,25 @@ # Copyright (c) 2020-2021 The ZMK Contributors # SPDX-License-Identifier: MIT +DT_COMPAT_ZMK_BATTERY_NRF_VDDH := zmk,battery-nrf-vddh +DT_COMPAT_ZMK_BATTERY_VOLTAGE_DIVIDER := zmk,battery-voltage-divider + config ZMK_BATTERY bool "ZMK battery monitoring" help Enable battery monitoring config ZMK_BATTERY_NRF_VDDH - bool "ZMK nRF VDDH battery monitoring" + bool + default $(dt_compat_enabled,$(DT_COMPAT_ZMK_BATTERY_NRF_VDDH)) select ADC select ZMK_BATTERY help Enable ZMK nRF VDDH voltage driver for battery monitoring. config ZMK_BATTERY_VOLTAGE_DIVIDER - bool "ZMK battery voltage divider" + bool + default $(dt_compat_enabled,$(DT_COMPAT_ZMK_BATTERY_VOLTAGE_DIVIDER)) select ADC select ZMK_BATTERY help diff --git a/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml b/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml index 09691159..e4cfaeab 100644 --- a/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml +++ b/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml @@ -20,6 +20,8 @@ properties: default: -1 quick_tap_ms: # deprecated type: int + global-quick-tap: + type: boolean flavor: type: string required: false diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index 030cd3dd..413806b4 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -57,6 +57,7 @@ struct behavior_hold_tap_config { char *hold_behavior_dev; char *tap_behavior_dev; int quick_tap_ms; + bool global_quick_tap; enum flavor flavor; bool retro_tap; int32_t hold_trigger_key_positions_len; @@ -88,22 +89,33 @@ struct active_hold_tap active_hold_taps[ZMK_BHV_HOLD_TAP_MAX_HELD] = {}; // We capture most position_state_changed events and some modifiers_state_changed events. const zmk_event_t *captured_events[ZMK_BHV_HOLD_TAP_MAX_CAPTURED_EVENTS] = {}; -// Keep track of which key was tapped most recently for 'quick_tap_ms' +// Keep track of which key was tapped most recently for the standard, if it is a hold-tap +// a position, will be given, if not it will just be INT32_MIN struct last_tapped { int32_t position; - int64_t tap_deadline; + int64_t timestamp; }; -struct last_tapped last_tapped; +struct last_tapped last_tapped = {INT32_MIN, INT64_MIN}; -static void store_last_tapped(struct active_hold_tap *hold_tap) { +static void store_last_tapped(int64_t timestamp) { + if (timestamp > last_tapped.timestamp) { + last_tapped.position = INT32_MIN; + last_tapped.timestamp = timestamp; + } +} + +static void store_last_hold_tapped(struct active_hold_tap *hold_tap) { last_tapped.position = hold_tap->position; - last_tapped.tap_deadline = hold_tap->timestamp + hold_tap->config->quick_tap_ms; + last_tapped.timestamp = hold_tap->timestamp; } static bool is_quick_tap(struct active_hold_tap *hold_tap) { - return last_tapped.position == hold_tap->position && - last_tapped.tap_deadline > hold_tap->timestamp; + if (hold_tap->config->global_quick_tap || last_tapped.position == hold_tap->position) { + return (last_tapped.timestamp + hold_tap->config->quick_tap_ms) > hold_tap->timestamp; + } else { + return false; + } } static int capture_event(const zmk_event_t *event) { @@ -362,7 +374,7 @@ static int press_binding(struct active_hold_tap *hold_tap) { } else { binding.behavior_dev = hold_tap->config->tap_behavior_dev; binding.param1 = hold_tap->param_tap; - store_last_tapped(hold_tap); + store_last_hold_tapped(hold_tap); } return behavior_keymap_binding_pressed(&binding, event); } @@ -619,6 +631,10 @@ static int keycode_state_changed_listener(const zmk_event_t *eh) { // we want to catch layer-up events too... how? struct zmk_keycode_state_changed *ev = as_zmk_keycode_state_changed(eh); + if (ev->state && !is_mod(ev->usage_page, ev->keycode)) { + store_last_tapped(ev->timestamp); + } + if (undecided_hold_tap == NULL) { // LOG_DBG("0x%02X bubble (no undecided hold_tap active)", ev->keycode); return ZMK_EV_EVENT_BUBBLE; @@ -680,6 +696,7 @@ static int behavior_hold_tap_init(const struct device *dev) { .hold_behavior_dev = DT_LABEL(DT_INST_PHANDLE_BY_IDX(n, bindings, 0)), \ .tap_behavior_dev = DT_LABEL(DT_INST_PHANDLE_BY_IDX(n, bindings, 1)), \ .quick_tap_ms = DT_INST_PROP(n, quick_tap_ms), \ + .global_quick_tap = DT_INST_PROP(n, global_quick_tap), \ .flavor = DT_ENUM_IDX(DT_DRV_INST(n), flavor), \ .retro_tap = DT_INST_PROP(n, retro_tap), \ .hold_trigger_key_positions = DT_INST_PROP(n, hold_trigger_key_positions), \ diff --git a/app/src/ble.c b/app/src/ble.c index ed823178..aecf6023 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -398,15 +398,6 @@ static void connected(struct bt_conn *conn, uint8_t err) { LOG_DBG("Connected %s", log_strdup(addr)); - err = bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x000c, 30, 400)); - if (err) { - LOG_WRN("Failed to update LE parameters (err %d)", err); - } - -#if IS_SPLIT_PERIPHERAL - bt_conn_le_phy_update(conn, BT_CONN_LE_PHY_PARAM_2M); -#endif - if (bt_conn_set_security(conn, BT_SECURITY_L2)) { LOG_ERR("Failed to set security"); } diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index 7eacc675..2f02faaf 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -403,12 +403,6 @@ static bool split_central_eir_found(struct bt_data *data, void *user_data) { BT_HCI_OP_LE_CREATE_CONN); start_scan(); } - - err = bt_conn_le_phy_update(slot->conn, BT_CONN_LE_PHY_PARAM_2M); - if (err) { - LOG_ERR("Update phy conn failed (err %d)", err); - start_scan(); - } } return false; diff --git a/app/tests/backlight/basic/native_posix_64.conf b/app/tests/backlight/basic/native_posix_64.conf index 565121d3..bd29a072 100644 --- a/app/tests/backlight/basic/native_posix_64.conf +++ b/app/tests/backlight/basic/native_posix_64.conf @@ -1,6 +1,3 @@ -CONFIG_KSCAN=n -CONFIG_ZMK_KSCAN_MOCK_DRIVER=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=y CONFIG_GPIO_EMUL=y CONFIG_ZMK_BLE=n diff --git a/app/tests/backlight/config-brt/native_posix_64.conf b/app/tests/backlight/config-brt/native_posix_64.conf index 0d0758c0..65cdd326 100644 --- a/app/tests/backlight/config-brt/native_posix_64.conf +++ b/app/tests/backlight/config-brt/native_posix_64.conf @@ -1,6 +1,3 @@ -CONFIG_KSCAN=n -CONFIG_ZMK_KSCAN_MOCK_DRIVER=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=y CONFIG_GPIO_EMUL=y CONFIG_ZMK_BLE=n diff --git a/app/tests/backlight/config-on/native_posix_64.conf b/app/tests/backlight/config-on/native_posix_64.conf index 241c66a7..eb9e7c8a 100644 --- a/app/tests/backlight/config-on/native_posix_64.conf +++ b/app/tests/backlight/config-on/native_posix_64.conf @@ -1,6 +1,3 @@ -CONFIG_KSCAN=n -CONFIG_ZMK_KSCAN_MOCK_DRIVER=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=y CONFIG_GPIO_EMUL=y CONFIG_ZMK_BLE=n diff --git a/app/tests/backlight/config-step/native_posix_64.conf b/app/tests/backlight/config-step/native_posix_64.conf index 4df7a861..c03eb7b0 100644 --- a/app/tests/backlight/config-step/native_posix_64.conf +++ b/app/tests/backlight/config-step/native_posix_64.conf @@ -1,6 +1,3 @@ -CONFIG_KSCAN=n -CONFIG_ZMK_KSCAN_MOCK_DRIVER=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=y CONFIG_GPIO_EMUL=y CONFIG_ZMK_BLE=n diff --git a/app/tests/backlight/cycle/native_posix_64.conf b/app/tests/backlight/cycle/native_posix_64.conf index 565121d3..bd29a072 100644 --- a/app/tests/backlight/cycle/native_posix_64.conf +++ b/app/tests/backlight/cycle/native_posix_64.conf @@ -1,6 +1,3 @@ -CONFIG_KSCAN=n -CONFIG_ZMK_KSCAN_MOCK_DRIVER=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=y CONFIG_GPIO_EMUL=y CONFIG_ZMK_BLE=n diff --git a/app/tests/backlight/low-brightness/native_posix_64.conf b/app/tests/backlight/low-brightness/native_posix_64.conf index 565121d3..bd29a072 100644 --- a/app/tests/backlight/low-brightness/native_posix_64.conf +++ b/app/tests/backlight/low-brightness/native_posix_64.conf @@ -1,6 +1,3 @@ -CONFIG_KSCAN=n -CONFIG_ZMK_KSCAN_MOCK_DRIVER=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=y CONFIG_GPIO_EMUL=y CONFIG_ZMK_BLE=n diff --git a/app/tests/hold-tap/balanced/8-global-quick-tap/1-basic/events.patterns b/app/tests/hold-tap/balanced/8-global-quick-tap/1-basic/events.patterns new file mode 100644 index 00000000..4db21917 --- /dev/null +++ b/app/tests/hold-tap/balanced/8-global-quick-tap/1-basic/events.patterns @@ -0,0 +1,6 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p +s/.*update_hold_status_for_retro_tap/update_hold_status_for_retro_tap/p +s/.*decide_retro_tap/decide_retro_tap/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced/8-global-quick-tap/1-basic/keycode_events.snapshot b/app/tests/hold-tap/balanced/8-global-quick-tap/1-basic/keycode_events.snapshot new file mode 100644 index 00000000..dc1ac805 --- /dev/null +++ b/app/tests/hold-tap/balanced/8-global-quick-tap/1-basic/keycode_events.snapshot @@ -0,0 +1,24 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (balanced decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (balanced decision moment quick-tap) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-timer (balanced decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (balanced decision moment quick-tap) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/8-global-quick-tap/1-basic/native_posix.keymap b/app/tests/hold-tap/balanced/8-global-quick-tap/1-basic/native_posix.keymap new file mode 100644 index 00000000..93076055 --- /dev/null +++ b/app/tests/hold-tap/balanced/8-global-quick-tap/1-basic/native_posix.keymap @@ -0,0 +1,25 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + /* tap */ + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* normal quick tap */ + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_RELEASE(0,0,400) + /* hold */ + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,400) + /* global quick tap */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; diff --git a/app/tests/hold-tap/balanced/8-global-quick-tap/2-double-hold/events.patterns b/app/tests/hold-tap/balanced/8-global-quick-tap/2-double-hold/events.patterns new file mode 100644 index 00000000..4db21917 --- /dev/null +++ b/app/tests/hold-tap/balanced/8-global-quick-tap/2-double-hold/events.patterns @@ -0,0 +1,6 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p +s/.*update_hold_status_for_retro_tap/update_hold_status_for_retro_tap/p +s/.*decide_retro_tap/decide_retro_tap/p \ No newline at end of file diff --git a/app/tests/hold-tap/balanced/8-global-quick-tap/2-double-hold/keycode_events.snapshot b/app/tests/hold-tap/balanced/8-global-quick-tap/2-double-hold/keycode_events.snapshot new file mode 100644 index 00000000..baaadf04 --- /dev/null +++ b/app/tests/hold-tap/balanced/8-global-quick-tap/2-double-hold/keycode_events.snapshot @@ -0,0 +1,12 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-timer (balanced decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 1 new undecided hold_tap +ht_decide: 1 decided hold-timer (balanced decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 1 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/8-global-quick-tap/2-double-hold/native_posix.keymap b/app/tests/hold-tap/balanced/8-global-quick-tap/2-double-hold/native_posix.keymap new file mode 100644 index 00000000..37c37f55 --- /dev/null +++ b/app/tests/hold-tap/balanced/8-global-quick-tap/2-double-hold/native_posix.keymap @@ -0,0 +1,20 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + /* hold the first mod tap */ + ZMK_MOCK_PRESS(0,0,400) + /* hold the second mod tap */ + ZMK_MOCK_PRESS(0,1,400) + /* press the normal key */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + + /* release the hold taps */ + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(0,1,10) + >; +}; diff --git a/app/tests/hold-tap/balanced/8-global-quick-tap/behavior_keymap.dtsi b/app/tests/hold-tap/balanced/8-global-quick-tap/behavior_keymap.dtsi new file mode 100644 index 00000000..0966ce0d --- /dev/null +++ b/app/tests/hold-tap/balanced/8-global-quick-tap/behavior_keymap.dtsi @@ -0,0 +1,29 @@ +#include +#include +#include + +/ { + behaviors { + ht_bal: behavior_balanced { + compatible = "zmk,behavior-hold-tap"; + label = "MOD_TAP"; + #binding-cells = <2>; + flavor = "balanced"; + tapping-term-ms = <300>; + quick-tap-ms = <300>; + bindings = <&kp>, <&kp>; + global-quick-tap; + }; + }; + + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &ht_bal LEFT_SHIFT F &ht_bal LEFT_CONTROL C + &kp D &none>; + }; + }; +}; diff --git a/app/tests/hold-tap/hold-preferred/8-global-quick-tap/1-basic/events.patterns b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/1-basic/events.patterns new file mode 100644 index 00000000..4db21917 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/1-basic/events.patterns @@ -0,0 +1,6 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p +s/.*update_hold_status_for_retro_tap/update_hold_status_for_retro_tap/p +s/.*decide_retro_tap/decide_retro_tap/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred/8-global-quick-tap/1-basic/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/1-basic/keycode_events.snapshot new file mode 100644 index 00000000..27feeb8e --- /dev/null +++ b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/1-basic/keycode_events.snapshot @@ -0,0 +1,24 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment quick-tap) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-interrupt (hold-preferred decision moment other-key-down) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred decision moment quick-tap) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/8-global-quick-tap/1-basic/native_posix.keymap b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/1-basic/native_posix.keymap new file mode 100644 index 00000000..ee0d5e80 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/1-basic/native_posix.keymap @@ -0,0 +1,25 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + /* tap */ + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* normal quick tap */ + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_RELEASE(0,0,400) + /* hold */ + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,400) + /* global quick tap */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; diff --git a/app/tests/hold-tap/hold-preferred/8-global-quick-tap/2-double-hold/events.patterns b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/2-double-hold/events.patterns new file mode 100644 index 00000000..4db21917 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/2-double-hold/events.patterns @@ -0,0 +1,6 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p +s/.*update_hold_status_for_retro_tap/update_hold_status_for_retro_tap/p +s/.*decide_retro_tap/decide_retro_tap/p \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred/8-global-quick-tap/2-double-hold/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/2-double-hold/keycode_events.snapshot new file mode 100644 index 00000000..797a6ab4 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/2-double-hold/keycode_events.snapshot @@ -0,0 +1,12 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-timer (hold-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 1 new undecided hold_tap +ht_decide: 1 decided hold-timer (hold-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 1 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/8-global-quick-tap/2-double-hold/native_posix.keymap b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/2-double-hold/native_posix.keymap new file mode 100644 index 00000000..37c37f55 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/2-double-hold/native_posix.keymap @@ -0,0 +1,20 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + /* hold the first mod tap */ + ZMK_MOCK_PRESS(0,0,400) + /* hold the second mod tap */ + ZMK_MOCK_PRESS(0,1,400) + /* press the normal key */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + + /* release the hold taps */ + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(0,1,10) + >; +}; diff --git a/app/tests/hold-tap/hold-preferred/8-global-quick-tap/behavior_keymap.dtsi b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/behavior_keymap.dtsi new file mode 100644 index 00000000..fee3361e --- /dev/null +++ b/app/tests/hold-tap/hold-preferred/8-global-quick-tap/behavior_keymap.dtsi @@ -0,0 +1,29 @@ +#include +#include +#include + +/ { + behaviors { + hp: behavior_hold_preferred { + compatible = "zmk,behavior-hold-tap"; + label = "MOD_TAP"; + #binding-cells = <2>; + flavor = "hold-preferred"; + tapping-term-ms = <300>; + quick-tap-ms = <300>; + bindings = <&kp>, <&kp>; + global-quick-tap; + }; + }; + + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &hp LEFT_SHIFT F &hp LEFT_CONTROL G + &kp D &none>; + }; + }; +}; diff --git a/app/tests/hold-tap/tap-preferred/8-global-quick-tap/1-basic/events.patterns b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/1-basic/events.patterns new file mode 100644 index 00000000..4db21917 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/1-basic/events.patterns @@ -0,0 +1,6 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p +s/.*update_hold_status_for_retro_tap/update_hold_status_for_retro_tap/p +s/.*decide_retro_tap/decide_retro_tap/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred/8-global-quick-tap/1-basic/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/1-basic/keycode_events.snapshot new file mode 100644 index 00000000..455b3330 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/1-basic/keycode_events.snapshot @@ -0,0 +1,24 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment quick-tap) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-timer (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred decision moment quick-tap) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/8-global-quick-tap/1-basic/native_posix.keymap b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/1-basic/native_posix.keymap new file mode 100644 index 00000000..93076055 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/1-basic/native_posix.keymap @@ -0,0 +1,25 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + /* tap */ + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* normal quick tap */ + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_RELEASE(0,0,400) + /* hold */ + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,400) + /* global quick tap */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; diff --git a/app/tests/hold-tap/tap-preferred/8-global-quick-tap/2-double-hold/events.patterns b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/2-double-hold/events.patterns new file mode 100644 index 00000000..4db21917 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/2-double-hold/events.patterns @@ -0,0 +1,6 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p +s/.*update_hold_status_for_retro_tap/update_hold_status_for_retro_tap/p +s/.*decide_retro_tap/decide_retro_tap/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred/8-global-quick-tap/2-double-hold/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/2-double-hold/keycode_events.snapshot new file mode 100644 index 00000000..ef428873 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/2-double-hold/keycode_events.snapshot @@ -0,0 +1,12 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided hold-timer (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 1 new undecided hold_tap +ht_decide: 1 decided hold-timer (tap-preferred decision moment timer) +kp_pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 1 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/8-global-quick-tap/2-double-hold/native_posix.keymap b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/2-double-hold/native_posix.keymap new file mode 100644 index 00000000..37c37f55 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/2-double-hold/native_posix.keymap @@ -0,0 +1,20 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + /* hold the first mod tap */ + ZMK_MOCK_PRESS(0,0,400) + /* hold the second mod tap */ + ZMK_MOCK_PRESS(0,1,400) + /* press the normal key */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + + /* release the hold taps */ + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(0,1,10) + >; +}; diff --git a/app/tests/hold-tap/tap-preferred/8-global-quick-tap/behavior_keymap.dtsi b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/behavior_keymap.dtsi new file mode 100644 index 00000000..4771ab75 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred/8-global-quick-tap/behavior_keymap.dtsi @@ -0,0 +1,29 @@ +#include +#include +#include + +/ { + behaviors { + tp: behavior_tap_preferred { + compatible = "zmk,behavior-hold-tap"; + label = "MOD_TAP"; + #binding-cells = <2>; + flavor = "tap-preferred"; + tapping-term-ms = <300>; + quick-tap-ms = <300>; + bindings = <&kp>, <&kp>; + global-quick-tap; + }; + }; + + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &tp LEFT_SHIFT F &tp LEFT_CONTROL C + &kp D &none>; + }; + }; +}; diff --git a/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/1-basic/events.patterns b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/1-basic/events.patterns new file mode 100644 index 00000000..4db21917 --- /dev/null +++ b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/1-basic/events.patterns @@ -0,0 +1,6 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p +s/.*update_hold_status_for_retro_tap/update_hold_status_for_retro_tap/p +s/.*decide_retro_tap/decide_retro_tap/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/1-basic/keycode_events.snapshot b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/1-basic/keycode_events.snapshot new file mode 100644 index 00000000..03bc0289 --- /dev/null +++ b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/1-basic/keycode_events.snapshot @@ -0,0 +1,24 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-unless-interrupted decision moment key-up) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-unless-interrupted decision moment quick-tap) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-unless-interrupted decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-unless-interrupted decision moment quick-tap) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/1-basic/native_posix.keymap b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/1-basic/native_posix.keymap new file mode 100644 index 00000000..93076055 --- /dev/null +++ b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/1-basic/native_posix.keymap @@ -0,0 +1,25 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + /* tap */ + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* normal quick tap */ + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_RELEASE(0,0,400) + /* hold */ + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,400) + /* global quick tap */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(0,0,400) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; diff --git a/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/2-double-hold/events.patterns b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/2-double-hold/events.patterns new file mode 100644 index 00000000..4db21917 --- /dev/null +++ b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/2-double-hold/events.patterns @@ -0,0 +1,6 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p +s/.*on_hold_tap_binding/ht_binding/p +s/.*decide_hold_tap/ht_decide/p +s/.*update_hold_status_for_retro_tap/update_hold_status_for_retro_tap/p +s/.*decide_retro_tap/decide_retro_tap/p \ No newline at end of file diff --git a/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/2-double-hold/keycode_events.snapshot b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/2-double-hold/keycode_events.snapshot new file mode 100644 index 00000000..dfd2e934 --- /dev/null +++ b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/2-double-hold/keycode_events.snapshot @@ -0,0 +1,12 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-unless-interrupted decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_pressed: 1 new undecided hold_tap +ht_decide: 1 decided tap (tap-unless-interrupted decision moment timer) +kp_pressed: usage_page 0x07 keycode 0x0d implicit_mods 0x00 explicit_mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 0 cleaning up hold-tap +kp_released: usage_page 0x07 keycode 0x0d implicit_mods 0x00 explicit_mods 0x00 +ht_binding_released: 1 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/2-double-hold/native_posix.keymap b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/2-double-hold/native_posix.keymap new file mode 100644 index 00000000..37c37f55 --- /dev/null +++ b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/2-double-hold/native_posix.keymap @@ -0,0 +1,20 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + /* hold the first mod tap */ + ZMK_MOCK_PRESS(0,0,400) + /* hold the second mod tap */ + ZMK_MOCK_PRESS(0,1,400) + /* press the normal key */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + + /* release the hold taps */ + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(0,1,10) + >; +}; diff --git a/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/behavior_keymap.dtsi b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/behavior_keymap.dtsi new file mode 100644 index 00000000..6ca7ac72 --- /dev/null +++ b/app/tests/hold-tap/tap-unless-interrupted/6-global-quick-tap/behavior_keymap.dtsi @@ -0,0 +1,29 @@ +#include +#include +#include + +/ { + behaviors { + ht_tui: behavior_hold_tap_tap_unless_interrupted { + compatible = "zmk,behavior-hold-tap"; + label = "hold_tap_tap_unless_interrupted"; + #binding-cells = <2>; + flavor = "tap-unless-interrupted"; + tapping-term-ms = <300>; + quick-tap-ms = <300>; + bindings = <&kp>, <&kp>; + global-quick-tap; + }; + }; + + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &ht_tui LEFT_SHIFT F &ht_tui LEFT_CONTROL J + &kp D &kp RIGHT_CONTROL>; + }; + }; +}; diff --git a/app/tests/wpm/1-single_keypress/native_posix_64.conf b/app/tests/wpm/1-single_keypress/native_posix_64.conf index 360e77d5..670f63d8 100644 --- a/app/tests/wpm/1-single_keypress/native_posix_64.conf +++ b/app/tests/wpm/1-single_keypress/native_posix_64.conf @@ -1,6 +1,3 @@ -CONFIG_KSCAN=n -CONFIG_ZMK_KSCAN_MOCK_DRIVER=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=n CONFIG_ZMK_BLE=n CONFIG_LOG=y diff --git a/app/tests/wpm/2-multiple_keypress/native_posix_64.conf b/app/tests/wpm/2-multiple_keypress/native_posix_64.conf index f0e1a480..980eff5c 100644 --- a/app/tests/wpm/2-multiple_keypress/native_posix_64.conf +++ b/app/tests/wpm/2-multiple_keypress/native_posix_64.conf @@ -1,6 +1,3 @@ -CONFIG_KSCAN=n -CONFIG_ZMK_KSCAN_MOCK_DRIVER=y -CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=n CONFIG_ZMK_BLE=n CONFIG_LOG=y diff --git a/app/west.yml b/app/west.yml index 14c494c0..f7e1ae12 100644 --- a/app/west.yml +++ b/app/west.yml @@ -31,5 +31,6 @@ manifest: - openthread - edtt - trusted-firmware-m + - sof self: west-commands: scripts/west-commands.yml diff --git a/docs/blog/2022-04-21-zmk-2yo.md b/docs/blog/2022-04-21-zmk-2yo.md new file mode 100644 index 00000000..6ebadb96 --- /dev/null +++ b/docs/blog/2022-04-21-zmk-2yo.md @@ -0,0 +1,71 @@ +--- +title: "ZMK's Second Birthday" +author: Pete Johanson +author_title: Project Creator +author_url: https://gitlab.com/petejohanson +author_image_url: https://www.gravatar.com/avatar/2001ceff7e9dc753cf96fcb2e6f41110 +tags: [keyboards, firmware, oss] +--- + +Two years ago, today, I minted the first ever commit for ZMK: + +``` +commit 85c8be89dea8f7a00e8efb06d38e2b32f3459935 +Author: Pete Johanson +Date: Tue Apr 21 16:20:34 2020 -0400 + + Initial work. + + .gitignore | 1 + + .gitmodules | 3 +++ + CMakeLists.txt | 40 +++++++++++++++++++++++++++++++++++++++ + src/main.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/zmk_lib.h | 7 +++++++ + zephyr-rust | 1 + + 6 files changed, 112 insertions(+) +``` + +I will never forget that commit. Not because of the code it contained (please don't look, it's not worth it!), but for what it started. + +Working on ZMK has given me the opportunity to reconnect with old friends ([@brixmeister](https://twitter.com/brixmeister) was my Gentoo mentor/sponsor when I became a contributor there on my first ever OSS project, and is a current active Zephyr RTOS contributor!), make new ones, and learn so much from the amazing mechanical keyboard community. + +## First Keyboard + +But I'm getting ahead of myself! Back to early ZMK. I present you the first ZMK keyboard: + +![stm32wb55rg dev kit keyboard](assets/2022-04-21-zmk-2yo/first-zmk-keyboard.jpg) + +That first "keyboard" taught me a _lot_. It forced me to dust off my long forgotten, rudimentary electronics knowledge, and gave me my first taste of really combining the physical/tangible with code in a way that years of doing backend API development never had. + +I was _hooked_. + +## Zephyr RTOS + +Early in my brainstorming, I knew I needed a foundation to build upon that would get me "a lot for free." I evaluated several different real-time operating systems (RTOSes) and happened upon [Zephyr](https://zephyrproject.org/). It immediately ticked all the boxes I wanted: + +- Robust, open source Bluetooth stack, supporting multiple SoCs. At the time, I was trying out stm32wb thanks to some interest among keyboard designers, but I also so there were other compelling choices that might be a good fit. +- An open source, non-copyleft license. I am a firm believer in F/OSS, and wanted to use a license that was as unrestricted as possible. +- Had a lot of core APIs available, so I could focus on the keyboard functionality, not the plumbing. I love tinkering, but I wanted to focus my time on the interesting bits, not infrastructure. + +I'm really happy with the choice, it has served us incredibly well the past two years. + +## Real Keyboard + +At some point, somehow, [innovaker] introduced me to [nicell] who graciously sent me a few of the early pre-production nice!nano controllers, which I was able to get running on my Kyria. Doing so required the first split code, as well as lots of general improvements. + +![kyria keyboard](assets/2022-04-21-zmk-2yo/kyria-first-split.jpg) + +The day I was finally able to type on a wireless, split keyboard running ZMK was deeply momentous for me! + +## Onward and Upward + +We've come a long way since then, with our [supported hardware](/docs/hardware), [features](/docs/features/keymaps) and [behaviors](/docs/behaviors/key-press) growing regularly. + +ZMK powered keyboards are now available in group buys and in stock at various vendors; compatible controllers have been used in a wide range of builds to empower our users to free themselves from their USB/TRRS cables and move about untethered. + +This progress is only possible thanks to all of the contributors who've joined me in the vision for a wireless-first world. I am so grateful for everyone who has given their time to contribute code, answer questions on our Discord server, write more documentation, and especially all the users who have trusted us to make their input devices work. + +I can't wait to see what we can accomplish together in the next two years. + +[innovaker]: https://github.com/innovaker +[nicell]: https://github.com/Nicell diff --git a/docs/blog/assets/2022-04-21-zmk-2yo/first-zmk-keyboard.jpg b/docs/blog/assets/2022-04-21-zmk-2yo/first-zmk-keyboard.jpg new file mode 100644 index 00000000..ae119f52 Binary files /dev/null and b/docs/blog/assets/2022-04-21-zmk-2yo/first-zmk-keyboard.jpg differ diff --git a/docs/blog/assets/2022-04-21-zmk-2yo/kyria-first-split.jpg b/docs/blog/assets/2022-04-21-zmk-2yo/kyria-first-split.jpg new file mode 100644 index 00000000..bc007903 Binary files /dev/null and b/docs/blog/assets/2022-04-21-zmk-2yo/kyria-first-split.jpg differ diff --git a/docs/docs/behaviors/hold-tap.md b/docs/docs/behaviors/hold-tap.md index f7c386b3..d0255c70 100644 --- a/docs/docs/behaviors/hold-tap.md +++ b/docs/docs/behaviors/hold-tap.md @@ -48,6 +48,29 @@ If you press a tapped hold-tap again within `quick-tap-ms` milliseconds, it will In QMK, unlike ZMK, this functionality is enabled by default, and you turn it off using `TAPPING_FORCE_HOLD`. +#### `global-quick-tap` + +If global quick tap is enabled, then `quick-tap-ms` will apply not only when the given hold-tap is tapped but for any key tap before it. This effectively disables the hold tap when typing quickly, which can be quite useful for home row mods. It can also have the effect of removing the input delay when typing quickly. + +For example, the following hold-tap configuration enables global quick tap with a 125 millisecond term. + +``` +gqt: global-quick-tap { + compatible = "zmk,behavior-hold-tap"; + label = "GLOBAL_QUICK_TAP"; + #binding-cells = <2>; + flavor = "tap-preferred"; + tapping-term-ms = <200>; + quick-tap-ms = <125>; + global-quick-tap; + bindings = <&kp>, <&kp>; +}; +``` + +If you press `&kp A` and then `&gqt LEFT_SHIFT B` **within** 125 ms, then `ab` will be output. Importantly, `b` will be output immediately since it was within the `quick-tap-ms`. This quick-tap behavior will work for any key press, whether it is within a behavior like hold-tap, or a simple `&kp`. This means the `&gqt LEFT_SHIFT B` binding will only have its underlying hold-tap behavior if it is pressed 125 ms **after** a key press. + +Note that the higher the `quick-tap-ms` the harder it will be to use the hold behavior, making this less applicable for something like capitalizing letter while typing normally. However, if the hold behavior isn't used during fast typing, then it can be an effective way to mitigate misfires. + #### `retro-tap` If retro tap is enabled, the tap behavior is triggered when releasing the hold-tap key if no other key was pressed in the meantime. diff --git a/docs/docs/behaviors/mod-tap.md b/docs/docs/behaviors/mod-tap.md index 9ad25f39..cc2b1ce0 100644 --- a/docs/docs/behaviors/mod-tap.md +++ b/docs/docs/behaviors/mod-tap.md @@ -46,4 +46,4 @@ You can configure a different tapping term in your keymap: ### Additional information -The mod-tap is a [hold-tap](hold-tap.md) under the hood with the "balanced" flavor and tapping-term-ms 200. +The mod-tap is a [hold-tap](hold-tap.md) under the hood with the "hold-preferred" flavor and tapping-term-ms 200. diff --git a/docs/docs/customization.md b/docs/docs/customization.md index 47ebe417..ff5da61d 100644 --- a/docs/docs/customization.md +++ b/docs/docs/customization.md @@ -1,5 +1,5 @@ --- -title: Customizing ZMK/`zmk-config` folders +title: Customizing ZMK/zmk-config folders sidebar_label: Customizing ZMK --- diff --git a/docs/docs/faq.md b/docs/docs/faq.md index 6a16f6f8..36ecc010 100644 --- a/docs/docs/faq.md +++ b/docs/docs/faq.md @@ -7,10 +7,10 @@ sidebar_label: FAQs As a best-in-class RTOS, Zephyr™ brings many [benefits](https://www.zephyrproject.org/benefits) to ZMK, such as: -- A _single_ platform [supporting](https://docs.zephyrproject.org/latest/boards) many architectures, processors and boards. +- A _single_ platform [supporting](https://docs.zephyrproject.org/latest/boards/index.html) many architectures, processors and boards. - Optimization for low-powered, small memory footprint devices. -- Powerful hardware abstraction and configuration using [DeviceTree](https://docs.zephyrproject.org/latest/guides/dts/index.html) and [Kconfig](https://docs.zephyrproject.org/latest/guides/kconfig/index.html). -- A BLE stack that periodically obtains [qualification](https://docs.zephyrproject.org/latest/guides/bluetooth/bluetooth-qual.html) listings, making it easier for final products to obtain qualification from the Bluetooth® SIG. +- Powerful hardware abstraction and configuration using [DeviceTree](https://docs.zephyrproject.org/latest/guides/dts/index.html) and [Kconfig](https://docs.zephyrproject.org/latest/build/kconfig/index.html). +- A BLE stack that periodically obtains [qualification](https://docs.zephyrproject.org/latest/connectivity/bluetooth/bluetooth-qual.html) listings, making it easier for final products to obtain qualification from the Bluetooth® SIG. - Multi-processor support, which is critical for power efficiency in upcoming MCUs. - Permissive licensing with its Apache 2.0 open source [license](https://www.apache.org/licenses/LICENSE-2.0). - A buzzing developer [community](https://github.com/zephyrproject-rtos/zephyr) including many leading [embedded technology](https://www.zephyrproject.org/project-members) companies. diff --git a/docs/docs/features/backlight.md b/docs/docs/features/backlight.md index 6632a0f0..03d206f1 100644 --- a/docs/docs/features/backlight.md +++ b/docs/docs/features/backlight.md @@ -103,7 +103,7 @@ Finally you need to add backlight to the `chosen` element of the root devicetree chosen { zmk,backlight = &backlight; }; -}: +}; ``` diff --git a/docs/docs/features/combos.md b/docs/docs/features/combos.md index 550bd251..55e1563c 100644 --- a/docs/docs/features/combos.md +++ b/docs/docs/features/combos.md @@ -25,7 +25,7 @@ Combos configured in your `.keymap` file, but are separate from the `keymap` nod - The name of the combo doesn't really matter, but convention is to start the node name with `combo_`. - The `compatible` property should always be `"zmk,combos"` for combos. -- `timeout-ms` is the number of milliseconds that all keys of the combo must be pressed. +- `timeout-ms` is the length of the window (in milliseconds) in which all keys of the combo must be pressed in order to successfully trigger the combo. - `key-positions` is an array of key positions. See the info section below about how to figure out the positions on your board. - `layers = <0 1...>` will allow limiting a combo to specific layers. This is an _optional_ parameter, when omitted it defaults to global scope. - `bindings` is the behavior that is activated when the behavior is pressed. diff --git a/docs/docs/troubleshooting.md b/docs/docs/troubleshooting.md index b163e7ba..46901d15 100644 --- a/docs/docs/troubleshooting.md +++ b/docs/docs/troubleshooting.md @@ -105,7 +105,7 @@ Some users may experience a poor connection between the keyboard and the host. T 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/latest/reference/kconfig/CONFIG_BT_CTLR_TX_PWR_PLUS_8.html) +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/latest/kconfig.html#CONFIG_BT_CTLR_TX_PWR) ### Other notes and warnings diff --git a/docs/src/setup-script-generation-plugin/index.js b/docs/src/setup-script-generation-plugin/index.js index 908ac659..87e77141 100644 --- a/docs/src/setup-script-generation-plugin/index.js +++ b/docs/src/setup-script-generation-plugin/index.js @@ -30,6 +30,7 @@ function generateSetupScripts() { if (item.features?.includes("keys")) { agg.keyboards.push(item); } else { + item.usb_only = !item.outputs?.includes("ble"); agg.boards.push(item); } break; diff --git a/docs/src/templates/setup.ps1.mustache b/docs/src/templates/setup.ps1.mustache index 4af4d79d..54c5ae82 100644 --- a/docs/src/templates/setup.ps1.mustache +++ b/docs/src/templates/setup.ps1.mustache @@ -125,12 +125,23 @@ if ($keyboard_type -eq "shield") { {{id}} = "{{{name}}}"; {{/boards}} } + $boards_usb_only = [ordered]@{ + {{#boards}} + {{id}} = "{{usb_only}}"; + {{/boards}} + } Write-Host "$title" Write-Host "" Write-Host "MCU Board Selection:" $choice = Get-Choice-From-Options -Options $boards.values -Prompt $prompt + + if ($keyboard_split -eq "true" -and $($($boards_usb_only.values)[$choice]) -eq "true") { + Write-Host "Wired split is not yet supported by ZMK." + exit 1 + } + $shields = $keyboard_siblings $board = $($($boards.keys)[$choice]) $boards = ( $board ) diff --git a/docs/src/templates/setup.sh.mustache b/docs/src/templates/setup.sh.mustache index cec164a2..a8a2da22 100644 --- a/docs/src/templates/setup.sh.mustache +++ b/docs/src/templates/setup.sh.mustache @@ -120,6 +120,7 @@ if [ "$keyboard_shield" == "y" ]; then prompt="Pick an MCU board:" options=({{#boards}}"{{{name}}}" {{/boards}}) board_ids=({{#boards}}"{{id}}" {{/boards}}) + boards_usb_only=({{#boards}}"{{#usb_only}}y{{/usb_only}}{{^usb_only}}n{{/usb_only}}" {{/boards}}) echo "" echo "MCU Board Selection:" @@ -134,6 +135,12 @@ if [ "$keyboard_shield" == "y" ]; then echo "Invalid option. Try another one." continue fi + + if [ -n "${!keyboard_sibling_first}" ] && [ "${boards_usb_only[$board_index]}" = "y" ] ; then + echo "Wired split is not yet supported by ZMK." + exit 1 + fi + board_index=$(( $REPLY-1 )) board=${board_ids[$board_index]} board_title=${options[$board_index]}