summaryrefslogtreecommitdiff
path: root/include/motion_lid.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2014-10-23 16:58:21 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-29 22:23:54 +0000
commit66164f2784b1ca34d9a10febd39c19db064c1750 (patch)
tree965c82a6d0826de677ff5c95e8191f53a01cd9e0 /include/motion_lid.h
parentd5b32aa6e1e9ac206f4cbdd6cf4452a08dc2ec36 (diff)
downloadchrome-ec-66164f2784b1ca34d9a10febd39c19db064c1750.tar.gz
Samus: Split motion sense and lid angle
Split motion_sense.c. Translate the accel data in the Android coordinate right away. BUG=chrome-os-partner:32002 BRANCH=ToT TEST=On samus, check lid angle are still correct. Change-Id: If743e25245dc1ce4cdacb8a4d5af22616c4a79e4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225486 Reviewed-by: Sheng-liang Song <ssl@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include/motion_lid.h')
-rw-r--r--include/motion_lid.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/motion_lid.h b/include/motion_lid.h
new file mode 100644
index 0000000000..b3348c020e
--- /dev/null
+++ b/include/motion_lid.h
@@ -0,0 +1,50 @@
+/* Copyright (c) 2014 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.
+ */
+
+/* Header for motion_sense.c */
+
+#ifndef __CROS_EC_MOTION_LID_H
+#define __CROS_EC_MOTION_LID_H
+
+/* Anything outside of lid angle range [-180, 180] should work. */
+#define LID_ANGLE_UNRELIABLE 500.0F
+
+/**
+ * This structure defines all of the data needed to specify the orientation
+ * of the base and lid accelerometers in order to calculate the lid angle.
+ */
+struct accel_orientation {
+ /* Rotation matrix to rotate positive 90 degrees around the hinge. */
+ matrix_3x3_t rot_hinge_90;
+
+ /*
+ * Rotation matrix to rotate 180 degrees around the hinge. The value
+ * here should be rot_hinge_90 ^ 2.
+ */
+ matrix_3x3_t rot_hinge_180;
+
+ /* Vector pointing along hinge axis. */
+ vector_3_t hinge_axis;
+};
+
+/* Link global structure for orientation. This must be defined in board.c. */
+extern const struct accel_orientation acc_orient;
+
+
+/**
+ * Get last calculated lid angle. Note, the lid angle calculated by the EC
+ * is un-calibrated and is an approximate angle.
+ *
+ * @return lid angle in degrees in range [0, 360].
+ */
+int motion_lid_get_angle(void);
+
+int host_cmd_motion_lid(struct host_cmd_handler_args *args);
+
+void motion_lid_calc(void);
+
+#endif /* __CROS_EC_MOTION_LID_H */
+
+