Skip to content

Commit a65d60c

Browse files
author
Aurelie Fontaine
committed
drivers: sensor: icm42670: supports icm42670-P/-S
samples: sensor: tdk_apex: adds sample to support APEX features samples: sensor: 6dof_motion_drdy: adds sample to support 6-axis sensor data report Adds official TDK Invensense Inc. driver for icm42670-P/-S sensor. Adds SPI and I2C interface support. Adds APEX features, such as Pedometer, Tilt detection, Wake on Motion and Significant Motion Detector. Add generic samples supporting this driver. Validated with custom setup: nrf52dk_nrf52832 + icm42670-P/-S EVB board Build ok by running: west twister -T samples\sensor\tdk_apex -T samples\sensor\6dof_motion_drdy -p nrf52dk/nrf52832 Signed-off-by: Aurelie Fontaine <[email protected]>
1 parent 7fd0a7a commit a65d60c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+9740
-1134
lines changed

drivers/sensor/tdk/icm42670/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ zephyr_library()
55
zephyr_library_sources(
66
icm42670.c
77
icm42670_spi.c
8+
icm42670_i2c.c
89
)
10+
zephyr_library_include_directories(.)
11+
zephyr_library_sources(imu/inv_imu_driver.c imu/inv_imu_transport.c)
912

1013
zephyr_library_sources_ifdef(CONFIG_ICM42670_TRIGGER icm42670_trigger.c)
14+
15+
zephyr_library_sources_ifdef(CONFIG_ICM42670_APEX icm42670_apex.c)
16+
zephyr_library_sources_ifdef(CONFIG_ICM42670_APEX imu/inv_imu_apex.c)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* SPDX-License-Identifier: BSD-3-Clause
3+
*/
4+
/*
5+
*
6+
* Copyright (c) [2015] by InvenSense, Inc.
7+
* * Permission to use, copy, modify, and/or distribute this software for any
8+
* purpose with or without fee is hereby granted.
9+
* * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12+
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
14+
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15+
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16+
*
17+
*/
18+
19+
/** @defgroup InvError Error code
20+
* @brief Common error code
21+
*
22+
* @ingroup EmbUtils
23+
* @{
24+
*/
25+
26+
#ifndef _INV_ERROR_H_
27+
#define _INV_ERROR_H_
28+
29+
/** @brief Common error code definition
30+
*/
31+
enum inv_error {
32+
INV_ERROR_SUCCESS = 0, /**< no error */
33+
INV_ERROR = -1, /**< unspecified error */
34+
INV_ERROR_NIMPL = -2, /**< function not implemented for given arguments */
35+
INV_ERROR_TRANSPORT = -3, /**< error occurred at transport level */
36+
INV_ERROR_TIMEOUT = -4, /**< action did not complete in the expected time window */
37+
INV_ERROR_SIZE = -5, /**< argument's size is not suitable to complete requested action */
38+
INV_ERROR_OS = -6, /**< error related to OS */
39+
INV_ERROR_IO = -7, /**< error related to IO operation */
40+
INV_ERROR_MEM = -9, /**< not enough memory to complete requested action */
41+
INV_ERROR_HW = -10, /**< error at HW level */
42+
INV_ERROR_BAD_ARG = -11, /**< provided arguments are not good to perform requested action */
43+
INV_ERROR_UNEXPECTED = -12, /**< something unexpected happened */
44+
INV_ERROR_FILE = -13, /**< cannot access file or unexpected format */
45+
INV_ERROR_PATH = -14, /**< invalid file path */
46+
INV_ERROR_IMAGE_TYPE = -15, /**< error when image type is not managed */
47+
INV_ERROR_WATCHDOG = -16, /**< error when device doesn't respond to ping */
48+
};
49+
50+
#endif /* _INV_ERROR_H_ */
51+
52+
/** @} */

drivers/sensor/tdk/icm42670/Kconfig

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
1-
# ICM42670 Six-Axis Motion Tracking device configuration options
1+
# ICM42670-P ICM42670-S Six-Axis Motion Tracking device configuration options
22
#
3+
# Copyright (c) 2023 TDK Invensense
34
# Copyright (c) 2022 Esco Medical ApS
45
# Copyright (c) 2020 TDK Invensense
5-
#
66
# SPDX-License-Identifier: Apache-2.0
77

88
menuconfig ICM42670
9-
bool "ICM42670 Six-Axis Motion Tracking Device"
9+
bool "ICM42670 6-Axis Motion Tracking Device"
1010
default y
1111
depends on DT_HAS_INVENSENSE_ICM42670_ENABLED
12-
select SPI
12+
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_INVENSENSE_ICM42670),i2c)
13+
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_INVENSENSE_ICM42670),spi)
1314
help
14-
Enable driver for ICM42670 SPI-based six-axis motion tracking device.
15+
Enable driver for ICM42670 I2C-based or SPI-based Six-Axis Motion Tracking device.
1516

1617
if ICM42670
1718

19+
config ICM42670_APEX
20+
bool "ICM42670 APEX features"
21+
default n
22+
23+
choice APEX_FEATURES
24+
prompt "ICM42670 APEX features"
25+
depends on ICM42670_APEX
26+
default TDK_APEX_PEDOMETER
27+
help
28+
Select APEX feature for ICM42670 sensor.
29+
config TDK_APEX_PEDOMETER
30+
bool "Pedometer: Tracks step count"
31+
config TDK_APEX_TILT
32+
bool "Tilt Detection: Detect the Tilt angle exceeds 35 degrees"
33+
config TDK_APEX_SMD
34+
bool "Significant Motion Detector (SMD): Detects significant motion based on accelerometer data"
35+
config TDK_APEX_WOM
36+
bool "Wake on Motion (WoM): Detects motion when accelerometer samples exceed a programmable threshold"
37+
endchoice
38+
1839
choice ICM42670_TRIGGER_MODE
1940
prompt "Trigger mode"
2041
default ICM42670_TRIGGER_NONE

0 commit comments

Comments
 (0)