summaryrefslogtreecommitdiff
path: root/test/motion_lid.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-07-17 17:59:14 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-22 05:02:53 +0000
commit57ec5805fe302b8da22e4141a3e5620812fd7663 (patch)
tree1ff56501eda99c19f83ea532e0dbef6fb58717f0 /test/motion_lid.c
parent2302647f574852f3a76813dc8adf2a9dc7d81235 (diff)
downloadchrome-ec-57ec5805fe302b8da22e4141a3e5620812fd7663.tar.gz
ryu: Fix orientation of accel and compass
Add matrices to align sensors vectors with the device reference. Move rotation in read routines, to allow fifo to contains processed information. BRANCH=smaug TEST=Worsk on smaug BUG=chrome-os-partner:39900 Change-Id: I009e7f24ef6ee0574ed664aeb5fd649fcd7039fd Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/286659 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'test/motion_lid.c')
-rw-r--r--test/motion_lid.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/motion_lid.c b/test/motion_lid.c
index d06a76135d..a3ce4925f1 100644
--- a/test/motion_lid.c
+++ b/test/motion_lid.c
@@ -40,9 +40,10 @@ static int accel_init(const struct motion_sensor_t *s)
static int accel_read(const struct motion_sensor_t *s, vector_3_t v)
{
- v[X] = s->xyz[X];
- v[Y] = s->xyz[Y];
- v[Z] = s->xyz[Z];
+ if (*s->rot_standard_ref != NULL)
+ rotate(s->xyz, *s->rot_standard_ref, v);
+ else if (s->xyz != v)
+ memcpy(v, s->xyz, sizeof(v));
return EC_SUCCESS;
}