Skip to content

Commit 61896e5

Browse files
author
Aurelie Fontaine
committed
drivers: sensor: icm42670: supports icm42670-P and icm42670-S
samples: sensor: icm42670: adds sample to support enhanced features Adds official TDK Invensense Inc. driver for icm42670-P and icm42670-S 6-axis sensor. Adds SPI and I2C interface support. Adds APEX features, such as Pedometer, Tilt detection, Wake on Motion and Significant Motion Detector. Adds AML support for icm42670-S to demonstrate pointing, gestures recognition, quaternion computing features with AML library built for CM4 target. Add samples for this driver. Validated with custom setup based on nrf52dk_nrf52832 + icm42670-p/icm42670-s EVB board Build ok by running: west -T samples\sensor\icm42670\data_stream -T samples\sensor\icm42670\apex -T samples\sensor\icm42670\aml_pointing -p nrf52dk/nrf52832 Signed-off-by: Aurelie Fontaine <[email protected]>
1 parent 7fd0a7a commit 61896e5

Some content is hidden

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

58 files changed

+10642
-1133
lines changed

drivers/sensor/tdk/icm42670/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ 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)
17+
18+
zephyr_library_sources_ifdef(CONFIG_ICM42670S_AML icm42670S_aml.c)
19+
if(CONFIG_ICM42670S_AML)
20+
zephyr_library_include_directories(./invn.algo.sw-integration.aml-42670S-gcc-arm-none-eabi-cm4-fpu-1.6.0/include)
21+
zephyr_library_import(InvnAlgoAML_42670S ${CMAKE_CURRENT_SOURCE_DIR}/invn.algo.sw-integration.aml-42670S-gcc-arm-none-eabi-cm4-fpu-1.6.0/release/lib/libInvnAlgoAML_42670S.a)
22+
endif()
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: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,61 @@
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 ICM42670_APEX_PEDOMETER
27+
help
28+
Select APEX feature for ICM42670 sensor.
29+
config ICM42670_APEX_PEDOMETER
30+
bool "Pedometer: Tracks step count"
31+
config ICM42670_APEX_TILT
32+
bool "Tilt Detection: Detect the Tilt angle exceeds 35 degrees"
33+
config ICM42670_APEX_SMD
34+
bool "Significant Motion Detector (SMD): Detects significant motion based on accelerometer data"
35+
config ICM42670_APEX_WOM
36+
bool "Wake on Motion (WoM): Detects motion when accelerometer samples exceed a programmable threshold"
37+
endchoice
38+
39+
menuconfig ICM42670S_AML
40+
bool "ICM42670 Air Motion Library (AML)"
41+
default n
42+
43+
if ICM42670S_AML
44+
45+
config ICM42670S_AML_POINTING
46+
bool "Delta values for pointing"
47+
config ICM42670S_AML_GESTURES
48+
bool "Orientation of the remote and detected swipes"
49+
config ICM42670S_AML_GYR_OFFSET
50+
bool "Computed 3-axis raw gyroscope offsets"
51+
config ICM42670S_AML_QUATERNION
52+
bool "Computed W, X, Y and Z quaternion coefficients"
53+
54+
endif # ICM42670S_AML
55+
1856
choice ICM42670_TRIGGER_MODE
1957
prompt "Trigger mode"
20-
default ICM42670_TRIGGER_NONE
58+
default ICM42670_TRIGGER_OWN_THREAD
2159
help
2260
Specify the type of triggering to be used by the driver.
2361

0 commit comments

Comments
 (0)