From 9a890ad22965daa7e9365a0b2cb8c734ae41a842 Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Tue, 16 Oct 2018 15:16:29 -0700 Subject: 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 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 Tested-by: Daisuke Nojiri Reviewed-by: Randall Spangler --- chip/nrf51/keyboard_raw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'chip/nrf51') 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 */ -- cgit v1.2.1