drivers: sensor: icm42605: Fix build issues

If CONFIG_ICM42605_TRIGGER is not set the driver doesn't build.  There
are a few places that need ifdefs based on CONFIG_ICM42605_TRIGGER for
the driver to build correctly.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2021-06-18 10:36:06 -05:00 committed by Kumar Gala
commit 83cfcd41fc
2 changed files with 6 additions and 0 deletions

View file

@ -421,10 +421,12 @@ static int icm42605_init(const struct device *dev)
drv_data->accel_sensitivity_shift = 14 - 3;
drv_data->gyro_sensitivity_x10 = icm42605_gyro_sensitivity_x10[3];
#ifdef CONFIG_ICM42605_TRIGGER
if (icm42605_init_interrupt(dev) < 0) {
LOG_ERR("Failed to initialize interrupts.");
return -EIO;
}
#endif
LOG_DBG("Initialize interrupt done");
@ -432,7 +434,9 @@ static int icm42605_init(const struct device *dev)
}
static const struct sensor_driver_api icm42605_driver_api = {
#ifdef CONFIG_ICM42605_TRIGGER
.trigger_set = icm42605_trigger_set,
#endif
.sample_fetch = icm42605_sample_fetch,
.channel_get = icm42605_channel_get,
.attr_set = icm42605_attr_set,

View file

@ -58,9 +58,11 @@ struct icm42605_data {
struct sensor_trigger double_tap_trigger;
sensor_trigger_handler_t double_tap_handler;
#ifdef CONFIG_ICM42605_TRIGGER
K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_ICM42605_THREAD_STACK_SIZE);
struct k_thread thread;
struct k_sem gpio_sem;
#endif
struct spi_cs_control spi_cs;
struct spi_config spi_cfg;