-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
samples: sensor: accel_trig: add sample with double tap detection.
Add the tap detection trigger to the existing example. For this example it uses lis2dw12 accelerometer to detect a double tap. Signed-off-by: Pierrick Curt <pierrickcurt@gmail.com>
- Loading branch information
Showing
4 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CONFIG_I2C=y | ||
CONFIG_SENSOR_LOG_LEVEL_DBG=y | ||
CONFIG_LIS2DW12_TRIGGER_GLOBAL_THREAD=y | ||
CONFIG_LIS2DW12_TAP=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2024, Pierrick Curt. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/dt-bindings/sensor/lis2dw12.h> | ||
|
||
/ { | ||
aliases { | ||
accel0 = &lis2dw12_accel; | ||
}; | ||
}; | ||
|
||
&i2c2 { | ||
pinctrl-0 = <&i2c2_scl_pa9 &i2c2_sda_pa10>; | ||
pinctrl-names = "default"; | ||
status = "okay"; | ||
clock-frequency = <I2C_BITRATE_FAST>; | ||
|
||
lis2dw12_accel: lis2dw12@19 { | ||
compatible = "st,lis2dw12"; | ||
reg = <0x19>; | ||
odr = <400>; | ||
tap-mode = <LIS2DW12_DT_SINGLE_DOUBLE_TAP>; | ||
tap-threshold = <12>, <12>, <12>; | ||
power-mode = <LIS2DW12_DT_HP_MODE>; | ||
tap-shock = <0x03>; | ||
tap-quiet = <0x03>; | ||
tap-latency = <0x03>; | ||
irq-gpios = <&gpioe 6 GPIO_ACTIVE_HIGH>; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters