input: gpio_kbd_matrix: add 16 bit rows support

Add a Kconfig option to extend the row type to 16 bits, allowing the
library to handle a 16 row matrix.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2023-11-17 13:22:30 +00:00 committed by Carles Cufí
parent adcb2f580c
commit f9ed74e0d5
2 changed files with 10 additions and 0 deletions

View File

@ -14,4 +14,10 @@ config INPUT_KBD_MATRIX_THREAD_STACK_SIZE
help
Size of the stack used for the keyboard matrix thread.
config INPUT_KBD_MATRIX_16_BIT_ROW
bool "16 bit row size support"
help
Use a 16 bit type for the internal structure, allow using a matrix
with up to 16 rows if the driver supports it.
endif # INPUT_KBD_MATRIX

View File

@ -30,7 +30,11 @@
#define INPUT_KBD_MATRIX_SCAN_OCURRENCES 30U
/** Row entry data type */
#if CONFIG_INPUT_KBD_MATRIX_16_BIT_ROW
typedef uint16_t kbd_row_t;
#else
typedef uint8_t kbd_row_t;
#endif
/** Maximum number of rows */
#define INPUT_KBD_MATRIX_ROW_BITS NUM_BITS(kbd_row_t)