diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2014-07-31 13:44:30 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-19 06:59:28 +0000 |
commit | a048d76e0df9244e2deb104201e14afc80e0864c (patch) | |
tree | 236a1dbd34def4b73ced8957c27a450531d98af2 /test/math_util.c | |
parent | be060242e310090a421f70caa5917e2808f26433 (diff) | |
download | chrome-ec-a048d76e0df9244e2deb104201e14afc80e0864c.tar.gz |
Refactor accel / gyro driver to accomodate various configurations
Previously our accel / gyro drivers assumed that we had exactly two of
each identical part in the system. Some systems may have different
configurations, so allow this to be specified at the board-level.
Note that our motion_sense algorithm currently assumes that we have one
accelerometer in the lid and one in the base -- we'll need to fix that
in another CL.
BUG=chrome-os-partner:27320
TEST=Compile-only. Tested in future Samus commit.
BRANCH=None.
Change-Id: I1fae1f6c578fedebe78b473a5d66a5794ccaae00
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/212321
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'test/math_util.c')
-rw-r--r-- | test/math_util.c | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/test/math_util.c b/test/math_util.c index 5ace8d2a83..e69005fcbc 100644 --- a/test/math_util.c +++ b/test/math_util.c @@ -10,43 +10,12 @@ #include "math_util.h" #include "motion_sense.h" #include "test_util.h" +#include "util.h" /*****************************************************************************/ -/* Mock functions */ - -/* Need to define accelerometer functions just to compile. */ -int accel_init(enum accel_id id) -{ - return EC_SUCCESS; -} -int accel_read(enum accel_id id, int *x_acc, int *y_acc, int *z_acc) -{ - return EC_SUCCESS; -} -int accel_set_range(const enum accel_id id, const int range, const int rnd) -{ - return EC_SUCCESS; -} -int accel_get_range(const enum accel_id id, int * const range) -{ - return EC_SUCCESS; -} -int accel_set_resolution(const enum accel_id id, const int res, const int rnd) -{ - return EC_SUCCESS; -} -int accel_get_resolution(const enum accel_id id, int * const res) -{ - return EC_SUCCESS; -} -int accel_set_datarate(const enum accel_id id, const int rate, const int rnd) -{ - return EC_SUCCESS; -} -int accel_get_datarate(const enum accel_id id, int * const rate) -{ - return EC_SUCCESS; -} +/* Need to define motion sensor globals just to compile. */ +const struct motion_sensor_t motion_sensors[] = {}; +const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); /*****************************************************************************/ /* Test utilities */ |