diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-10-16 15:16:29 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-19 23:21:56 -0700 |
commit | 9a890ad22965daa7e9365a0b2cb8c734ae41a842 (patch) | |
tree | 27e3f1f0845031e685fc46ffdad44d8cb87adfeb /chip/nrf51 | |
parent | 4d4d8f06e91090336c2eb29ee00ca86fea2bb796 (diff) | |
download | chrome-ec-9a890ad22965daa7e9365a0b2cb8c734ae41a842.tar.gz |
Keyboard: Allow keyboard size to be set at run time
Currently, the keyboard size (i.e. number of columns) is static.
This patch allows it to be configured at run time. It's required to
support a keyboard with/without keypad in a single image.
KEYBOARD_COLS_MAX has the build time col size. It's used to allocate
exact spaces for arrays. Actual keyboard scanning is done using
keyboard_cols, which holds a runtime col size.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b:117126568
BRANCH=none
TEST=Verify keyboard functionality on Sona and Veyron.
Change-Id: I4b3552be0b4b315c3fe5a6884cf25e10aba8be7c
Reviewed-on: https://chromium-review.googlesource.com/1285292
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'chip/nrf51')
-rw-r--r-- | chip/nrf51/keyboard_raw.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/chip/nrf51/keyboard_raw.c b/chip/nrf51/keyboard_raw.c index 6db9840499..7eaf8f995c 100644 --- a/chip/nrf51/keyboard_raw.c +++ b/chip/nrf51/keyboard_raw.c @@ -8,7 +8,7 @@ * input and output entries in the board's gpio_list[]. Each set of inputs or * outputs must be listed in consecutive, increasing order so that scan loops * can iterate beginning at KB_IN00 or KB_OUT00 for however many GPIOs are - * utilized (KEYBOARD_ROWS or KEYBOARD_COLS). + * utilized (KEYBOARD_ROWS or KEYBOARD_COLS_MAX). */ #include "gpio.h" @@ -28,7 +28,7 @@ void keyboard_raw_init(void) /* Initialize col_mask */ col_mask = 0; - for (i = 0; i < KEYBOARD_COLS; i++) + for (i = 0; i < keyboard_cols; i++) col_mask |= gpio_list[GPIO_KB_OUT00 + i].mask; /* Ensure interrupts are disabled */ |