@ -58,10 +58,6 @@ Definition file: [zmk/app/drivers/zephyr/dts/bindings/kscan/zmk,kscan-gpio-demux
Keyboard scan driver where each key has a dedicated GPIO.
Keyboard scan driver where each key has a dedicated GPIO.
:::note
Currently this driver does not honor the `CONFIG_ZMK_KSCAN_DEBOUNCE_*` settings.
:::
### Kconfig
### Kconfig
Definition file: [zmk/app/drivers/kscan/Kconfig ](https://github.com/zmkfirmware/zmk/blob/main/app/drivers/kscan/Kconfig )
Definition file: [zmk/app/drivers/kscan/Kconfig ](https://github.com/zmkfirmware/zmk/blob/main/app/drivers/kscan/Kconfig )
@ -77,10 +73,19 @@ Applies to: `compatible = "zmk,kscan-gpio-direct"`
Definition file: [zmk/app/drivers/zephyr/dts/bindings/kscan/zmk,kscan-gpio-direct.yaml ](https://github.com/zmkfirmware/zmk/blob/main/app/drivers/zephyr/dts/bindings/kscan/zmk%2Ckscan-gpio-direct.yaml )
Definition file: [zmk/app/drivers/zephyr/dts/bindings/kscan/zmk,kscan-gpio-direct.yaml ](https://github.com/zmkfirmware/zmk/blob/main/app/drivers/zephyr/dts/bindings/kscan/zmk%2Ckscan-gpio-direct.yaml )
| Property | Type | Description | Default |
| Property | Type | Description | Default |
| ----------------- | ---------- | ------------------------------- | ------- |
| ------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------- | ---- ------- |
| `label` | string | Unique label for the node | |
| `label` | string | Unique label for the node | |
| `input-gpios` | GPIO array | Input GPIOs (one per key) | |
| `input-gpios` | GPIO array | Input GPIOs (one per key) | |
| `debounce-period` | int | Debounce period in milliseconds | 5 |
| `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 |
| `diode-direction` | string | The direction of the matrix diodes | `"row2col"` |
| `poll-period-ms` | int | Time between reads in milliseconds when no key is pressed and `CONFIG_ZMK_KSCAN_DIRECT_POLLING` is enabled. | 10 |
| `toggle-mode` | bool | Use toggle switch mode. | 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.
## Matrix Driver
## Matrix Driver
@ -99,7 +104,7 @@ Applies to: `compatible = "zmk,kscan-gpio-matrix"`
Definition file: [zmk/app/drivers/zephyr/dts/bindings/kscan/zmk,kscan-gpio-matrix.yaml ](https://github.com/zmkfirmware/zmk/blob/main/app/drivers/zephyr/dts/bindings/kscan/zmk%2Ckscan-gpio-matrix.yaml )
Definition file: [zmk/app/drivers/zephyr/dts/bindings/kscan/zmk,kscan-gpio-matrix.yaml ](https://github.com/zmkfirmware/zmk/blob/main/app/drivers/zephyr/dts/bindings/kscan/zmk%2Ckscan-gpio-matrix.yaml )
| Property | Type | Description | Default |
| Property | Type | Description | Default |
| ------------------------- | ---------- | -------------------------------------------------------------------------------------------------- | ----------- |
| ------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------- | ----------- |
| `label` | string | Unique label for the node | |
| `label` | string | Unique label for the node | |
| `row-gpios` | GPIO array | Matrix row GPIOs in order, starting from the top row | |
| `row-gpios` | GPIO array | Matrix row GPIOs in order, starting from the top row | |
| `col-gpios` | GPIO array | Matrix column GPIOs in order, starting from the leftmost row | |
| `col-gpios` | GPIO array | Matrix column GPIOs in order, starting from the leftmost row | |
@ -107,7 +112,7 @@ Definition file: [zmk/app/drivers/zephyr/dts/bindings/kscan/zmk,kscan-gpio-matri
| `debounce-release-ms` | int | Debounce time for key release in milliseconds. | 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 |
| `debounce-scan-period-ms` | int | Time between reads in milliseconds when any key is pressed. | 1 |
| `diode-direction` | string | The direction of the matrix diodes | `"row2col"` |
| `diode-direction` | string | The direction of the matrix diodes | `"row2col"` |
| `poll-period-ms` | int | Time between reads in milliseconds when no key is pressed and ZMK_KSCAN_MATRIX_POLLING is enabled. | 10 |
| `poll-period-ms` | int | Time between reads in milliseconds when no key is pressed and `CONFIG_ ZMK_KSCAN_MATRIX_POLLING` is enabled. | 10 |
The `diode-direction` property must be one of:
The `diode-direction` property must be one of:
@ -213,7 +218,7 @@ One possible way to do this is a 3x4 matrix where the direct GPIO keys are shift
// Include the direct GPIO driver...
// Include the direct GPIO driver...
direct {
direct {
kscan = < &kscan2>;
kscan = < &kscan2>;
row-offset = < 3 > ; // ..and shift it to not overlap
row-offset = < 3 > ; // ... and shift it to not overlap
};
};
};
};