1 /* 2 * Copyright (c) 2022 Esco Medical ApS 3 * Copyright (c) 2020 TDK Invensense 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 #ifndef ZEPHYR_DRIVERS_SENSOR_ICM42670_H_ 9 #define ZEPHYR_DRIVERS_SENSOR_ICM42670_H_ 10 11 #include <zephyr/drivers/gpio.h> 12 #include <zephyr/drivers/sensor.h> 13 #include <zephyr/drivers/spi.h> 14 #include <zephyr/kernel.h> 15 16 struct icm42670_data { 17 int16_t accel_x; 18 int16_t accel_y; 19 int16_t accel_z; 20 uint16_t accel_sensitivity_shift; 21 uint16_t accel_hz; 22 uint16_t accel_fs; 23 int16_t gyro_x; 24 int16_t gyro_y; 25 int16_t gyro_z; 26 uint16_t gyro_sensitivity_x10; 27 uint16_t gyro_hz; 28 uint16_t gyro_fs; 29 int16_t temp; 30 #ifdef CONFIG_ICM42670_TRIGGER 31 const struct device *dev; 32 struct gpio_callback gpio_cb; 33 sensor_trigger_handler_t data_ready_handler; 34 const struct sensor_trigger *data_ready_trigger; 35 struct k_mutex mutex; 36 #endif 37 #ifdef CONFIG_ICM42670_TRIGGER_OWN_THREAD 38 K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_ICM42670_THREAD_STACK_SIZE); 39 struct k_thread thread; 40 struct k_sem gpio_sem; 41 #endif 42 #ifdef CONFIG_ICM42670_TRIGGER_GLOBAL_THREAD 43 struct k_work work; 44 #endif 45 }; 46 47 struct icm42670_config { 48 struct spi_dt_spec spi; 49 struct gpio_dt_spec gpio_int; 50 }; 51 52 #endif /* ZEPHYR_DRIVERS_SENSOR_ICM42670_H_ */ 53