diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-08-18 12:37:33 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-08-24 19:08:40 +0000 |
commit | 3a7e5132737424ca5d6847247136e25bc5aa548c (patch) | |
tree | 718e394bb6bff580dc4f33f96bfdd96a8c04db54 /driver/mag_bmm150.c | |
parent | 69bd4ce351ca56a3141281bf25431a07ea10512f (diff) | |
download | chrome-ec-3a7e5132737424ca5d6847247136e25bc5aa548c.tar.gz |
driver: bmi160: use rotation matrix to handle offsets.
Store offsets using sensors axis, not the device axis.
Therefore apply rot_standard_ref to the offset vector before
get and rot_standard_ref^-1 before set.
BRANCH=smaug
TEST=using mag sensor, check the offset are applied to the right axis
and store correctly.
BUG=chromium:517675
Change-Id: I95c8ef2a62603890184412674e7bde91ebecd288
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/294596
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Diffstat (limited to 'driver/mag_bmm150.c')
-rw-r--r-- | driver/mag_bmm150.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/driver/mag_bmm150.c b/driver/mag_bmm150.c index 59ce76785e..87933945fb 100644 --- a/driver/mag_bmm150.c +++ b/driver/mag_bmm150.c @@ -226,8 +226,7 @@ void bmm150_normalize(const struct motion_sensor_t *s, } int bmm150_set_offset(const struct motion_sensor_t *s, - const int16_t *offset, - int16_t temp) + const vector_3_t offset) { struct bmm150_comp_registers *regs = BMM150_COMP_REG(s); regs->offset[X] = offset[X]; @@ -237,13 +236,11 @@ int bmm150_set_offset(const struct motion_sensor_t *s, } int bmm150_get_offset(const struct motion_sensor_t *s, - int16_t *offset, - int16_t *temp) + vector_3_t offset) { struct bmm150_comp_registers *regs = BMM150_COMP_REG(s); offset[X] = regs->offset[X]; offset[Y] = regs->offset[Y]; offset[Z] = regs->offset[Z]; - *temp = EC_MOTION_SENSE_INVALID_CALIB_TEMP; return EC_SUCCESS; } |