summaryrefslogtreecommitdiff
path: root/driver/accel_lis2dw12.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2021-06-07 09:48:00 -0600
committerCommit Bot <commit-bot@chromium.org>2021-06-07 18:15:22 +0000
commit4df10f7b2b0e67d1c36bb69285436ec0d5e3fdfd (patch)
tree4276acbab14b79df5066770362347e14b0d6380d /driver/accel_lis2dw12.c
parent43fffb5b0292ee1c48015b04ea55793a140d8177 (diff)
downloadchrome-ec-4df10f7b2b0e67d1c36bb69285436ec0d5e3fdfd.tar.gz
zephyr: driver: add ST accel_lis2dw12
BUG=b:180980668,b:189857004 BRANCH=none TEST=make buildall TEST=zmake configure -b $PROJ_HAYATO Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ib743f0dbcc4a9731ccb575344413f161cd0dbba2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2944617 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'driver/accel_lis2dw12.c')
-rw-r--r--driver/accel_lis2dw12.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/driver/accel_lis2dw12.c b/driver/accel_lis2dw12.c
index 270c2d0eed..2658217d5c 100644
--- a/driver/accel_lis2dw12.c
+++ b/driver/accel_lis2dw12.c
@@ -10,7 +10,7 @@
#include "accelgyro.h"
#include "common.h"
#include "console.h"
-#include "driver/accel_lis2dw12.h"
+#include "accel_lis2dw12.h"
#include "hooks.h"
#include "hwtimer.h"
#include "math_util.h"
@@ -28,6 +28,23 @@
#define LIS2DW12_ENABLE_FIFO
#endif
+#if defined(CONFIG_ZEPHYR) && defined(CONFIG_ACCEL_INTERRUPTS)
+/* Get the motion sensor ID of the LIS2DW12 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 an alias (lis2dw12_int) to get the motion sensor ID. This alias
+ * MUST be defined for this driver to work.
+ * aliases {
+ * lis2dw12-int = &lid_accel;
+ * };
+ */
+#if DT_NODE_EXISTS(DT_ALIAS(lis2dw12_int))
+#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(SENSOR_ID(DT_ALIAS(lis2dw12_int)))
+#endif
+#endif
+
STATIC_IF(LIS2DW12_ENABLE_FIFO) volatile uint32_t last_interrupt_timestamp;
/**