diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-07-17 17:59:14 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-07-22 05:02:53 +0000 |
commit | 57ec5805fe302b8da22e4141a3e5620812fd7663 (patch) | |
tree | 1ff56501eda99c19f83ea532e0dbef6fb58717f0 /driver/accelgyro_lsm6ds0.c | |
parent | 2302647f574852f3a76813dc8adf2a9dc7d81235 (diff) | |
download | chrome-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 'driver/accelgyro_lsm6ds0.c')
-rw-r--r-- | driver/accelgyro_lsm6ds0.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/driver/accelgyro_lsm6ds0.c b/driver/accelgyro_lsm6ds0.c index ebd9bd745e..001f7bb5c7 100644 --- a/driver/accelgyro_lsm6ds0.c +++ b/driver/accelgyro_lsm6ds0.c @@ -356,9 +356,8 @@ static int read(const struct motion_sensor_t *s, vector_3_t v) * to get the latest updated sensor data quickly. */ if (!tmp) { - v[0] = s->raw_xyz[0]; - v[1] = s->raw_xyz[1]; - v[2] = s->raw_xyz[2]; + if (v != s->raw_xyz) + memcpy(v, s->raw_xyz, sizeof(s->raw_xyz)); return EC_SUCCESS; } @@ -381,6 +380,8 @@ static int read(const struct motion_sensor_t *s, vector_3_t v) v[i] = ((int16_t)((raw[i * 2 + 1] << 8) | raw[i * 2])); v[i] += (data->offset[i] << 5) / range; } + if (*s->rot_standard_ref != NULL) + rotate(v, *s->rot_standard_ref, v); return EC_SUCCESS; } |