diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2012-10-09 13:29:58 -0700 |
---|---|---|
committer | Vincent Palatin <vpalatin@chromium.org> | 2012-10-10 11:41:19 -0700 |
commit | 63c5547987b7ad6eefe7ecd7e2025cc87d161331 (patch) | |
tree | 640f4a2c667b69ec985ab00452160842274abdae | |
parent | 7e0be8cb9ef4041b8e5775be6aec24a913e73b28 (diff) | |
download | chrome-ec-63c5547987b7ad6eefe7ecd7e2025cc87d161331.tar.gz |
Revert "stm32: Drop key scan masks"
This reverts commit 7fbfac862dbb3da4ecd621f7328104b80e428526.
do not re-write the keyboard code in the released branch
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=snow
BUG=chrome-os-partner:12179
TEST=None
Change-Id: Ibb50ca6ed55a99e6cacc1b5e7c304be33a7abf3f
Reviewed-on: https://gerrit.chromium.org/gerrit/35052
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | chip/stm32/keyboard_scan.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c index 1705528a90..de537cc931 100644 --- a/chip/stm32/keyboard_scan.c +++ b/chip/stm32/keyboard_scan.c @@ -44,6 +44,20 @@ static struct mutex scanning_enabled; /* The keyboard state from the last read */ static uint8_t raw_state[KB_OUTPUTS]; +/* Mask with 1 bits only for keys that actually exist */ +static const uint8_t *actual_key_mask; + +/* All actual key masks (todo: move to keyboard matrix definition) */ +/* TODO: (crosbug.com/p/7485) fill in real key mask with 0-bits for coords that + aren't keys */ +static const uint8_t actual_key_masks[4][KB_OUTPUTS] = { + {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + {0}, + {0}, + {0}, + }; + /* Key masks for special boot keys */ #define MASK_INDEX_ESC 1 #define MASK_VALUE_ESC 0x02 @@ -265,6 +279,9 @@ static int check_keys_changed(void) /* Invert it so 0=not pressed, 1=pressed */ r ^= 0xff; + /* Mask off keys that don't exist so they never show + * as pressed */ + r &= actual_key_mask[c]; #ifdef OR_WITH_CURRENT_STATE_FOR_TESTING /* KLUDGE - or current state in, so we can make sure @@ -353,6 +370,10 @@ int keyboard_scan_init(void) /* Tri-state (put into Hi-Z) the outputs */ select_column(COL_TRI_STATE_ALL); + /* TODO: method to set which keyboard we have, so we set the actual + * key mask properly */ + actual_key_mask = actual_key_masks[0]; + /* Initialize raw state */ check_keys_changed(); |