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 --- include/keyboard_scan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/keyboard_scan.h') diff --git a/include/keyboard_scan.h b/include/keyboard_scan.h index 7e16fe732f..4bb44434fc 100644 --- a/include/keyboard_scan.h +++ b/include/keyboard_scan.h @@ -30,7 +30,7 @@ struct keyboard_scan_config { /* Revert to interrupt mode after no keyboard activity for this long */ uint32_t poll_timeout_us; /* Mask with 1 bits only for keys that actually exist */ - uint8_t actual_key_mask[KEYBOARD_COLS]; + uint8_t actual_key_mask[KEYBOARD_COLS_MAX]; }; /** @@ -78,7 +78,7 @@ static inline uint32_t keyboard_scan_get_boot_keys(void) /** * Return a pointer to the current debounced keyboard matrix state, which is - * KEYBOARD_COLS bytes long. + * KEYBOARD_COLS_MAX bytes long. */ const uint8_t *keyboard_scan_get_state(void); -- cgit v1.2.1