diff options
author | Hung-Te Lin <hungte@chromium.org> | 2018-08-08 12:35:37 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-16 13:14:46 -0700 |
commit | 7ef6291e33c31388652e66ebf0f96ec6d836d528 (patch) | |
tree | 675b2d1f463df13a94ea3e7621b714009f4d83c7 /common/keyboard_8042.c | |
parent | 50e52e2182a09eb862e5a0b4cbb25d052c94364d (diff) | |
download | chrome-ec-7ef6291e33c31388652e66ebf0f96ec6d836d528.tar.gz |
keyboard: Change scan code magic values to enum.
The key codes are now always scan code set 2 so we can create a list of
scan codes and use them easily.
BUG=None
TEST=make buildall -j; boots properly
BRANCH=None
Change-Id: I1fdd7ab81bc13c97c4139afc19d71f5898e22f96
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1166743
Diffstat (limited to 'common/keyboard_8042.c')
-rw-r--r-- | common/keyboard_8042.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c index 4b2b9a5db9..50320807cb 100644 --- a/common/keyboard_8042.c +++ b/common/keyboard_8042.c @@ -776,30 +776,33 @@ static void i8042_handle_from_host(void) static void keyboard_special(uint16_t k) { static uint8_t s; - static const uint16_t a[] = {0xe075, 0xe075, 0xe072, 0xe072, 0xe06b, - 0xe074, 0xe06b, 0xe074, 0x0032, 0x001c}; + static const uint16_t a[] = { + SCANCODE_UP, SCANCODE_UP, SCANCODE_DOWN, SCANCODE_DOWN, + SCANCODE_LEFT, SCANCODE_RIGHT, SCANCODE_LEFT, SCANCODE_RIGHT, + SCANCODE_B, SCANCODE_A}; + #ifdef HAS_TASK_LIGHTBAR /* Lightbar demo mode: keyboard can fake the battery state */ switch (k) { - case 0xe075: /* up */ + case SCANCODE_UP: demo_battery_level(1); break; - case 0xe072: /* down */ + case SCANCODE_DOWN: demo_battery_level(-1); break; - case 0xe06b: /* left */ + case SCANCODE_LEFT: demo_is_charging(0); break; - case 0xe074: /* right */ + case SCANCODE_RIGHT: demo_is_charging(1); break; - case 0x000b: /* dim */ + case SCANCODE_F6: /* dim */ demo_brightness(-1); break; - case 0x0083: /* bright */ + case SCANCODE_F7: /* bright */ demo_brightness(1); break; - case 0x002c: /* T */ + case SCANCODE_T: demo_tap(); break; } @@ -807,7 +810,7 @@ static void keyboard_special(uint16_t k) if (k == a[s]) s++; - else if (k != 0xe075) + else if (k != SCANCODE_UP) s = 0; else if (s != 2) s = 1; |