Commit 651898e1 authored by Kumar Gala's avatar Kumar Gala Committed by Anas Nashif
Browse files

drivers: sensor: icm42605: Fix build issues



There are several different issues when trying to build the icm42605
sensor driver:

* Missing entry in drivers/sensor/CMakeLists.txt
* Issues with #ifndef in header files
* Issues with const usage
* Missing function prototypes in headers
* Fix use of LOG_MODULE_REGISTER v LOG_MODULE_DECLARE
* Add missing dts node to tests/drivers/build_all/spi.dtsi

Signed-off-by: default avatarKumar Gala <kumar.gala@linaro.org>
parent f183d649
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ add_subdirectory_ifdef(CONFIG_TI_HDC ti_hdc)
add_subdirectory_ifdef(CONFIG_HMC5883L		hmc5883l)
add_subdirectory_ifdef(CONFIG_HP206C		hp206c)
add_subdirectory_ifdef(CONFIG_HTS221		hts221)
add_subdirectory_ifdef(CONFIG_ICM42605		icm42605)
add_subdirectory_ifdef(CONFIG_IIS2DH		iis2dh)
add_subdirectory_ifdef(CONFIG_IIS2DLPC		iis2dlpc)
add_subdirectory_ifdef(CONFIG_IIS2ICLX		iis2iclx)
+2 −2
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ static inline void icm42605_convert_temp(struct sensor_value *val,

static int icm42605_channel_get(const struct device *dev,
				enum sensor_channel chan,
				const struct sensor_value *val)
				struct sensor_value *val)
{
	const struct icm42605_data *drv_data = dev->data;

@@ -124,7 +124,7 @@ static int icm42605_channel_get(const struct device *dev,
int icm42605_tap_fetch(const struct device *dev)
{
	int result = 0;
	const struct icm42605_data *drv_data = dev->data;
	struct icm42605_data *drv_data = dev->data;

	if (drv_data->tap_en &&
	    (drv_data->tap_handler || drv_data->double_tap_handler)) {
+4 −3
Original line number Diff line number Diff line
@@ -16,9 +16,10 @@
#include "icm42605_reg.h"

typedef void (*tap_fetch_t)(const struct device *dev);
int icm42605_tap_fetch(const struct device *dev);

struct icm42605_data {
	struct device *spi;
	const struct device *spi;

	uint8_t fifo_data[HARDWARE_FIFO_SIZE];

@@ -44,8 +45,8 @@ struct icm42605_data {

	bool sensor_started;

	struct device *dev;
	struct device *gpio;
	const struct device *dev;
	const struct device *gpio;
	struct gpio_callback gpio_cb;

	struct sensor_trigger data_ready_trigger;
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
#include "icm42605_reg.h"
#include "icm42605_spi.h"

LOG_MODULE_REGISTER(ICM42605, CONFIG_SENSOR_LOG_LEVEL);
LOG_MODULE_DECLARE(ICM42605, CONFIG_SENSOR_LOG_LEVEL);

int icm42605_set_fs(const struct device *dev, uint16_t a_sf, uint16_t g_sf)
{
+2 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
 * SPDX-License-Identifier: Apache-2.0
 */

#ifdef ZEPHYR_DRIVERS_SENSOR_ICM42605_ICM42605_SETUP_H_
#ifndef ZEPHYR_DRIVERS_SENSOR_ICM42605_ICM42605_SETUP_H_
#define ZEPHYR_DRIVERS_SENSOR_ICM42605_ICM42605_SETUP_H_

#include <device.h>
@@ -13,6 +13,7 @@ int icm42605_sensor_init(const struct device *dev);
int icm42605_turn_on_fifo(const struct device *dev);
int icm42605_turn_off_fifo(const struct device *dev);
int icm42605_turn_off_sensor(const struct device *dev);
int icm42605_turn_on_sensor(const struct device *dev);
int icm42605_set_odr(const struct device *dev, int a_rate, int g_rate);

#endif /* __SENSOR_ICM42605_ICM42605_SETUP__ */
Loading