summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2011-10-25 19:53:04 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2011-10-25 19:53:04 -0700
commit360d484d3accba7da94298d41a77d3a9d3dec57c (patch)
tree3690ec2af7cbc44f69155949ed6ffee2819c15ed
parent169620605cdd9db111b04753f1f0128d70dc19f3 (diff)
parent53acb3f245b15d4c67a6acc2f304a606de0d337d (diff)
downloadchrome-ec-360d484d3accba7da94298d41a77d3a9d3dec57c.tar.gz
Merge "The keyboard interface between EC core and EC lib."
-rw-r--r--chip_interface/keyboard.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/chip_interface/keyboard.h b/chip_interface/keyboard.h
new file mode 100644
index 0000000000..78828678f3
--- /dev/null
+++ b/chip_interface/keyboard.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * keyboard.h - Keyboard interface between EC core and EC Lib.
+ */
+
+#ifndef __CHIP_INTERFACE_KEYBOARD_H
+#define __CHIP_INTERFACE_KEYBOARD_H
+
+#include "cros_ec/include/ec_common.h"
+
+#define MAX_KEYBOARD_MATRIX_COLS 16
+#define MAX_KEYBOARD_MATRIX_ROWS 8
+
+typedef void (*EcKeyboardCallback)(int col, int row, int is_pressed);
+
+/* Registers a callback function to underlayer EC lib. So that any key state
+ * change would notify the upper EC main code.
+ *
+ * Note that passing NULL removes any previously registered callback.
+ */
+EcError EcKeyboardRegisterCallback(EcKeyboardCallback cb);
+
+/* Asks the underlayer EC lib what keys are pressed right now.
+ *
+ * Sets bit_array to a debounced array of which keys are currently pressed,
+ * where a 1-bit means the key is pressed. For example, if only col=2 row=3
+ * is pressed, it would set bit_array to {0, 0, 0x08, 0, ...}
+ *
+ * bit_array must be at least MAX_KEYBOARD_MATRIX_COLS bytes long.
+ */
+EcError EcKeyboardGetState(uint8_t *bit_array);
+
+#endif /* __CHIP_INTERFACE_KEYBOARD_H */