Revert "feat(kscan): remove property input-gpios"
This reverts commit 9935fb29d2
.
This commit is contained in:
parent
5ac83e6a04
commit
21dc825c0c
2 changed files with 11 additions and 14 deletions
|
@ -19,8 +19,9 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
|||
|
||||
#define DT_DRV_COMPAT zmk_kscan_gpio_round_robin_matrix
|
||||
|
||||
#define INST_GPIOS_LEN(n) DT_INST_PROP_LEN(n, gpios)
|
||||
#define INST_MATRIX_LEN(n) (INST_GPIOS_LEN(n) * INST_GPIOS_LEN(n))
|
||||
#define INST_INPUTS_LEN(n) DT_INST_PROP_LEN(n, input_gpios)
|
||||
#define INST_OUTPUTS_LEN(n) DT_INST_PROP_LEN(n, output_gpios)
|
||||
#define INST_MATRIX_LEN(n) (INST_INPUTS_LEN(n) * INST_OUTPUTS_LEN(n))
|
||||
|
||||
#if CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS >= 0
|
||||
#define INST_DEBOUNCE_PRESS_MS(n) CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS
|
||||
|
@ -36,17 +37,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
|||
DT_INST_PROP(n, debounce_release_ms)
|
||||
#endif
|
||||
|
||||
#define KSCAN_GPIO_ITEM_CFG_INIT(node_id, prop, idx, flags) \
|
||||
{ \
|
||||
.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 = flags, \
|
||||
},
|
||||
|
||||
#define KSCAN_GPIO_INPUT_CFG_INIT(idx, inst_idx) \
|
||||
KSCAN_GPIO_ITEM_CFG_INIT(DT_DRV_INST(inst_idx), gpios, idx, \
|
||||
(GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN))
|
||||
|
||||
GPIO_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst_idx), input_gpios, idx),
|
||||
#define KSCAN_GPIO_OUTPUT_CFG_INIT(idx, inst_idx) \
|
||||
KSCAN_GPIO_ITEM_CFG_INIT(DT_DRV_INST(inst_idx), gpios, idx, GPIO_ACTIVE_HIGH)
|
||||
|
||||
|
@ -209,13 +201,15 @@ static const struct kscan_driver_api kscan_round_robin_matrix_api = {
|
|||
};
|
||||
|
||||
#define KSCAN_ROUND_ROBIN_MATRIX_INIT(n) \
|
||||
BUILD_ASSERT(INST_INPUTS_LEN(n) == INST_OUTPUTS_LEN(n), \
|
||||
"the number of input-gpios must be equal to output-gpios"); \
|
||||
BUILD_ASSERT(INST_DEBOUNCE_PRESS_MS(n) <= DEBOUNCE_COUNTER_MAX, \
|
||||
"ZMK_KSCAN_DEBOUNCE_PRESS_MS or debounce-press-ms is too large"); \
|
||||
BUILD_ASSERT(INST_DEBOUNCE_RELEASE_MS(n) <= DEBOUNCE_COUNTER_MAX, \
|
||||
"ZMK_KSCAN_DEBOUNCE_RELEASE_MS or debounce-release-ms is too large"); \
|
||||
\
|
||||
static const struct gpio_dt_spec kscan_round_robin_matrix_inputs_##n[] = { \
|
||||
UTIL_LISTIFY(INST_GPIOS_LEN(n), KSCAN_GPIO_INPUT_CFG_INIT, n)}; \
|
||||
UTIL_LISTIFY(INST_INPUTS_LEN(n), KSCAN_GPIO_INPUT_CFG_INIT, n)}; \
|
||||
\
|
||||
static const struct gpio_dt_spec kscan_round_robin_matrix_outputs_##n[] = { \
|
||||
UTIL_LISTIFY(INST_GPIOS_LEN(n), KSCAN_GPIO_OUTPUT_CFG_INIT, n)}; \
|
||||
|
|
|
@ -8,7 +8,10 @@ compatible: "zmk,kscan-gpio-round-robin-matrix"
|
|||
include: kscan.yaml
|
||||
|
||||
properties:
|
||||
gpios:
|
||||
input-gpios:
|
||||
type: phandle-array
|
||||
required: true
|
||||
output-gpios:
|
||||
type: phandle-array
|
||||
required: true
|
||||
debounce-press-ms:
|
||||
|
|
Loading…
Add table
Reference in a new issue