summaryrefslogtreecommitdiff
path: root/driver/accelgyro_bmi_common.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2020-10-21 16:11:07 -0700
committerCommit Bot <commit-bot@chromium.org>2020-11-06 01:43:08 +0000
commit851daf728dca124f4bb2b6d27238d3952be5cf2b (patch)
tree5a7725232cc1992a74340e6540fb2ba80e6b7896 /driver/accelgyro_bmi_common.c
parent8dfdaa83815669c50f70332932fa35614ef2e4f6 (diff)
downloadchrome-ec-851daf728dca124f4bb2b6d27238d3952be5cf2b.tar.gz
motion: orientation: update interface
Enabling orientation sensor would not compile anymore. Fix interface by replacing macros with functions. BUG=chromium:718919 BRANCH=none TEST=Compile when enabled on grunt and eve. Change-Id: Ic5d6992d040cde79ef3f691db494804e160b7650 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2491266 Reviewed-by: Ching-Kang Yen <chingkang@chromium.org>
Diffstat (limited to 'driver/accelgyro_bmi_common.c')
-rw-r--r--driver/accelgyro_bmi_common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/driver/accelgyro_bmi_common.c b/driver/accelgyro_bmi_common.c
index 30093258f9..ce2e836234 100644
--- a/driver/accelgyro_bmi_common.c
+++ b/driver/accelgyro_bmi_common.c
@@ -861,3 +861,22 @@ void bmi_set_gyro_offset(const struct motion_sensor_t *gyro, intv3_t v,
}
}
+#ifdef CONFIG_BMI_ORIENTATION_SENSOR
+bool motion_orientation_changed(const struct motion_sensor_t *s)
+{
+ return BMI_GET_DATA(s)->orientation !=
+ BMI_GET_DATA(s)->last_orientation;
+}
+
+enum motionsensor_orientation *motion_orientation_ptr(
+ const struct motion_sensor_t *s)
+{
+ return &BMI_GET_DATA(s)->orientation;
+}
+
+void motion_orientation_update(const struct motion_sensor_t *s)
+{
+ BMI_GET_DATA(s)->last_orientation = BMI_GET_DATA(s)->orientation;
+}
+#endif
+