summaryrefslogtreecommitdiff
path: root/board/samus/board.c
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 /board/samus/board.c
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 'board/samus/board.c')
-rw-r--r--board/samus/board.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/board/samus/board.c b/board/samus/board.c
index 08dae68780..e6682d4717 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -28,6 +28,7 @@
#include "lid_switch.h"
#include "lightbar.h"
#include "motion_sense.h"
+#include "motion_lid.h"
#include "peci.h"
#include "power.h"
#include "power_button.h"
@@ -264,6 +265,19 @@ static struct mutex g_lid_mutex;
struct kxcj9_data g_kxcj9_data;
/* Four Motion sensors */
+/* Matrix to rotate accelrator into standard reference frame */
+const matrix_3x3_t base_standard_ref = {
+ {-1, 0, 0},
+ { 0, -1, 0},
+ { 0, 0, -1}
+};
+
+const matrix_3x3_t lid_standard_ref = {
+ { 0, 1, 0},
+ {-1, 0, 0},
+ { 0, 0, -1}
+};
+
struct motion_sensor_t motion_sensors[] = {
/*
@@ -274,30 +288,23 @@ struct motion_sensor_t motion_sensors[] = {
{SENSOR_ACTIVE_S0_S3_S5, "Base", SENSOR_CHIP_LSM6DS0,
SENSOR_ACCELEROMETER, LOCATION_BASE,
&lsm6ds0_drv, &g_base_mutex, NULL,
- LSM6DS0_ADDR1, 119000, 2},
+ LSM6DS0_ADDR1, &base_standard_ref, 119000, 2},
{SENSOR_ACTIVE_S0, "Lid", SENSOR_CHIP_KXCJ9,
SENSOR_ACCELEROMETER, LOCATION_LID,
&kxcj9_drv, &g_lid_mutex, &g_kxcj9_data,
- KXCJ9_ADDR0, 100000, 2},
+ KXCJ9_ADDR0, &lid_standard_ref, 100000, 2},
{SENSOR_ACTIVE_S0, "Base Gyro", SENSOR_CHIP_LSM6DS0,
SENSOR_GYRO, LOCATION_BASE,
&lsm6ds0_drv, &g_base_mutex, NULL,
- LSM6DS0_ADDR1, 119000, 2000},
+ LSM6DS0_ADDR1, NULL, 119000, 2000},
};
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Define the accelerometer orientation matrices. */
const struct accel_orientation acc_orient = {
- /* Lid and base sensor are already aligned. */
- .rot_align = {
- { 0, -1, 0},
- { 1, 0, 0},
- { 0, 0, 1}
- },
-
/* Hinge aligns with y axis. */
.rot_hinge_90 = {
{ 1, 0, 0},
@@ -309,10 +316,5 @@ const struct accel_orientation acc_orient = {
{ 0, 1, 0},
{ 0, 0, 1}
},
- .rot_standard_ref = {
- {-1, 0, 0},
- { 0, -1, 0},
- { 0, 0, -1}
- },
.hinge_axis = {0, 1, 0},
};