summaryrefslogtreecommitdiff
path: root/include/driver
diff options
context:
space:
mode:
authorTristan Honscheid <honscheid@google.com>2021-10-18 16:22:17 -0600
committerCommit Bot <commit-bot@chromium.org>2021-10-19 21:26:29 +0000
commitfb7facda70d06efb0b9337ba8a8ed0834019a12a (patch)
treebf613809b09b9b6c21b415dcd0e16139ee2801b5 /include/driver
parent81e812f8a091217a7fedcf5cf88f33b462889af1 (diff)
downloadchrome-ec-fb7facda70d06efb0b9337ba8a8ed0834019a12a.tar.gz
zephyr: Test BMI260 interrupt handler
Quick test of the interrupt handler in accelgyro_bmi260.c that verifies the event flags get set properly. Also moved the definition of CONFIG_ACCELGYRO_BMI260_INT_EVENT in to the corresponding header file so we can access that value in the test. BRANCH=None BUG=b:184856157 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: Ibf88aee12f661a7883d1fffb6b3a6d53b79289db Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229647 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include/driver')
-rw-r--r--include/driver/accelgyro_bmi160.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/driver/accelgyro_bmi160.h b/include/driver/accelgyro_bmi160.h
index c916576130..d1b5253023 100644
--- a/include/driver/accelgyro_bmi160.h
+++ b/include/driver/accelgyro_bmi160.h
@@ -391,4 +391,24 @@ int bmi160_sec_raw_write8(const int port, const uint16_t addr_flags,
const uint8_t reg, int data);
#endif
+#if defined(CONFIG_ZEPHYR) && defined(CONFIG_ACCEL_INTERRUPTS)
+/*
+ * Get the mostion sensor ID of the BMI260 sensor that
+ * generates the interrupt.
+ * The interrupt is converted to the event and transferred to motion
+ * sense task that actually handles the interrupt.
+ *
+ * Here, we use alias to get the motion sensor ID
+ *
+ * e.g) base_accel is the label of a child node in /motionsense-sensors
+ * aliases {
+ * bmi260-int = &base_accel;
+ * };
+ */
+#if DT_NODE_EXISTS(DT_ALIAS(bmi260_int))
+#define CONFIG_ACCELGYRO_BMI260_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(SENSOR_ID(DT_ALIAS(bmi260_int)))
+#endif
+#endif
+
#endif /* __CROS_EC_ACCELGYRO_BMI160_H */