diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-03-22 09:35:00 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-03-29 11:40:34 -0700 |
commit | fe3ccdf70a002e651bc1a13bcc305ae1e3422154 (patch) | |
tree | a4e1f70850c720d2a1599285304816269fc489f1 /include | |
parent | 4311bc5ccf666d7425f1ea50eee08e3a032e2508 (diff) | |
download | chrome-ec-fe3ccdf70a002e651bc1a13bcc305ae1e3422154.tar.gz |
Merge lm4 and stm32 implementations of keyboard_scan
Scanning is now performed identically on all platforms. keyboard_scan
talks to chip-specific keyboard_raw on the bottom end, and 8042 or mkbp
keyboard protocol on the top end.
8042 can now take advantage of CONFIG_KEYBOARD_TEST to simulate scan results.
BUG=chrome-os-partner:18360
BRANCH=none
TEST=compile all boards; test keyboard on spring and link
1) Type on keyboard. Should produce keystrokes.
2) At EC console:
kbpress 3 7 1
kbpress 3 7 0
Should produce 'r' keystroke(s); key repeat should kick in if you wait
a while between the commands.
3) Hold power button while typing. Should not produce keystrokes.
4) Reboot with power+refresh+esc. Should go to recovery mode.
5) While the system is up, alt+volup+R should reboot the AP.
Change-Id: I48e0bca15b869162672b5f54ffcb561f6fcf0f45
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46666
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/keyboard_scan.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/keyboard_scan.h b/include/keyboard_scan.h index 04a21838bb..e775477421 100644 --- a/include/keyboard_scan.h +++ b/include/keyboard_scan.h @@ -9,12 +9,40 @@ #define __CROS_EC_KEYBOARD_SCAN_H #include "common.h" +#include "keyboard_config.h" + +struct keyboard_scan_config { + /* Delay between setting up output and waiting for it to settle */ + uint16_t output_settle_us; + /* Times for debouncing key-down and key-up */ + uint16_t debounce_down_us; + uint16_t debounce_up_us; + /* Time between start of scans when in polling mode */ + uint16_t scan_period_us; + /* + * Minimum time between end of one scan and start of the next one. + * This ensures keyboard scanning doesn't starve the rest of the system + * if the scan period is set too short, or if other higher-priority + * system activity is starving the keyboard scan task too. + */ + uint16_t min_post_scan_delay_us; + + /* 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]; +}; /** * Initializes the module. */ void keyboard_scan_init(void); +/** + * Return a pointer to the keyboard scan config. + */ +struct keyboard_scan_config *keyboard_scan_get_config(void); + /* Key held down at keyboard-controlled reset boot time. */ enum boot_key { BOOT_KEY_NONE, /* No keys other than keyboard-controlled reset keys */ @@ -31,6 +59,12 @@ enum boot_key { enum boot_key keyboard_scan_get_boot_key(void); /** + * Return a pointer to the current debounced keyboard matrix state, which is + * KEYBOARD_COLS bytes long. + */ +const uint8_t *keyboard_scan_get_state(void); + +/** * Enables/disables keyboard matrix scan. */ void keyboard_scan_enable(int enable); |