diff --git a/app/module/drivers/kscan/CMakeLists.txt b/app/module/drivers/kscan/CMakeLists.txt index 4e562a1b..d8c78a5c 100644 --- a/app/module/drivers/kscan/CMakeLists.txt +++ b/app/module/drivers/kscan/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2020 The ZMK Contributors +# Copyright (c) 2020-2023 The ZMK Contributors # SPDX-License-Identifier: MIT zephyr_library_amend() diff --git a/app/module/drivers/kscan/Kconfig b/app/module/drivers/kscan/Kconfig index 23cdb59e..fa2bde42 100644 --- a/app/module/drivers/kscan/Kconfig +++ b/app/module/drivers/kscan/Kconfig @@ -66,7 +66,7 @@ endif # ZMK_KSCAN_GPIO_MATRIX if ZMK_KSCAN_GPIO_CHARLIPLEX -config ZMK_KSCAN_MATRIX_WAIT_BEFORE_INPUTS +config ZMK_KSCAN_CHARLIPLEX_WAIT_BEFORE_INPUTS int "Ticks to wait before reading inputs after an output set active" default 0 help @@ -97,9 +97,6 @@ if ZMK_KSCAN_GPIO_DRIVER config ZMK_KSCAN_MATRIX_POLLING bool "Poll for key event triggers instead of using interrupts on matrix boards." -config ZMK_KSCAN_CHARLIPLEX_POLLING - bool "Poll for key event triggers instead of using interrupts on multiplex boards." - config ZMK_KSCAN_DIRECT_POLLING bool "Poll for key event triggers instead of using interrupts on direct wired boards." diff --git a/app/module/dts/bindings/kscan/zmk,kscan-gpio-charliplex.yaml b/app/module/dts/bindings/kscan/zmk,kscan-gpio-charliplex.yaml index e2eed813..033c852f 100644 --- a/app/module/dts/bindings/kscan/zmk,kscan-gpio-charliplex.yaml +++ b/app/module/dts/bindings/kscan/zmk,kscan-gpio-charliplex.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2022 The ZMK Contributors +# Copyright (c) 2023 The ZMK Contributors # SPDX-License-Identifier: MIT description: GPIO keyboard charliplex matrix controller @@ -13,7 +13,6 @@ properties: required: true interrupt-gpios: type: phandle-array - required: true debounce-press-ms: type: int default: 5 diff --git a/docs/docs/config/kscan.md b/docs/docs/config/kscan.md index e98d21f9..775c5303 100644 --- a/docs/docs/config/kscan.md +++ b/docs/docs/config/kscan.md @@ -151,13 +151,15 @@ The output pins (e.g. columns for `col2row`) should have the flag `GPIO_ACTIVE_H ## Charliplex Driver -Keyboard scan driver where keys are arranged on a matrix with each GPIO used as both input and output. This driver enables n pins to drive up to n\*(n-1) keys. +Keyboard scan driver where keys are arranged on a matrix with each GPIO used as both input and output. + +- With `interrupt-gpios` unset, this allows n pins to drive n\*(n-1) keys. +- With `interrupt-gpios` set, n pins will drive (n-1)\*(n-2) keys, but provide much improved power handling. Definition file: [zmk/app/drivers/kscan/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/app/drivers/kscan/Kconfig) | Config | Type | Description | Default | | --------------------------------------------------- | ----------- | ------------------------------------------------------------------------- | ------- | -| `CONFIG_ZMK_KSCAN_CHARLIPLEX_POLLING` | bool | Poll for key presses instead of using interrupts | n | | `CONFIG_ZMK_KSCAN_CHARLIPLEX_WAIT_BEFORE_INPUTS` | int (ticks) | How long to wait before reading input pins after setting output active | 0 | | `CONFIG_ZMK_KSCAN_CHARLIPLEX_WAIT_BETWEEN_OUTPUTS` | int (ticks) | How long to wait between each output to allow previous output to "settle" | 0 | @@ -170,15 +172,15 @@ Applies to: `compatible = "zmk,kscan-gpio-charliplex"` Definition file: [zmk/app/drivers/zephyr/dts/bindings/kscan/zmk,kscan-gpio-charliplex.yaml](https://github.com/zmkfirmware/zmk/blob/main/app/drivers/zephyr/dts/bindings/kscan/zmk%2Ckscan-gpio-charliplex.yaml) -| Property | Type | Description | Default | -| ------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------- | ------- | -| `label` | string | Unique label for the node | | -| `gpios` | GPIO array | GPIOs used, listed in order | | -| `interrupt-gpios` | GPIO array | A single GPIO to use for interrupt | | -| `debounce-press-ms` | int | Debounce time for key press in milliseconds. Use 0 for eager debouncing. | 5 | -| `debounce-release-ms` | int | Debounce time for key release in milliseconds. | 5 | -| `debounce-scan-period-ms` | int | Time between reads in milliseconds when any key is pressed. | 1 | -| `poll-period-ms` | int | Time between reads in milliseconds when no key is pressed and `CONFIG_ZMK_KSCAN_MATRIX_POLLING` is enabled. | 10 | +| Property | Type | Description | Default | +| ------------------------- | ---------- | ------------------------------------------------------------------------------------------- | ------- | +| `label` | string | Unique label for the node. | | +| `gpios` | GPIO array | GPIOs used, listed in order. | | +| `interrupt-gpios` | GPIO array | A single GPIO to use for interrupt. Leaving this empty will enable continuous polling. | | +| `debounce-press-ms` | int | Debounce time for key press in milliseconds. Use 0 for eager debouncing. | 5 | +| `debounce-release-ms` | int | Debounce time for key release in milliseconds. | 5 | +| `debounce-scan-period-ms` | int | Time between reads in milliseconds when any key is pressed. | 1 | +| `poll-period-ms` | int | Time between reads in milliseconds when no key is pressed and `interrupt-gpois` is not set. | 10 | Define the transform with a [matrix transform](#matrix-transform). The row is always the driven pin, and the column always the receiving pin (input to the controller). For example, in `RC(5,0)` power flows from the 6th pin in `gpios` to the 1st pin in `gpios`.