diff options
author | Ting Shen <phoenixshen@google.com> | 2023-05-02 15:04:21 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-09 10:19:29 +0000 |
commit | ac67c629e211278567a63f8d3400652139b856c1 (patch) | |
tree | 3fb6f1c66bf03f29d130a215a363174629693737 /driver | |
parent | e794570e9daa3aba90ec645dba41238e812b7015 (diff) | |
download | chrome-ec-ac67c629e211278567a63f8d3400652139b856c1.tar.gz |
zephyr: implement icm42607 test
Add unittest for ICM42607 accel+gyro sensor.
Note that we've already hit the hard limit of motion sensor count in
zephyr/test/drivers/default/, so this one is implemented as a
standalone test.
Also fixed an endian bug in driver/accelgyro_icm42607.c.
BUG=b:272665228
TEST=twister
Change-Id: Ia52a81e671a981fc0f003d07c7f59ca3d0c24233
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4497324
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/accelgyro_icm42607.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/driver/accelgyro_icm42607.c b/driver/accelgyro_icm42607.c index 48518fa315..07582ba88e 100644 --- a/driver/accelgyro_icm42607.c +++ b/driver/accelgyro_icm42607.c @@ -9,6 +9,7 @@ */ #include "accelgyro.h" +#include "builtin/endian.h" #include "console.h" #include "driver/accelgyro_icm42607.h" #include "driver/accelgyro_icm_common.h" @@ -960,6 +961,9 @@ static int icm42607_read_temp(const struct motion_sensor_t *s, int *temp_ptr) if (ret != EC_SUCCESS) return ret; + /* This register is big-endian and not configurable */ + val = be16toh(val); + /* ensure correct propagation of 16 bits sign bit */ val = sign_extend(val, 15); |