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:
parent
a6c7569733
commit
83cfcd41fc
2 changed files with 6 additions and 0 deletions
|
@ -421,10 +421,12 @@ static int icm42605_init(const struct device *dev)
|
||||||
drv_data->accel_sensitivity_shift = 14 - 3;
|
drv_data->accel_sensitivity_shift = 14 - 3;
|
||||||
drv_data->gyro_sensitivity_x10 = icm42605_gyro_sensitivity_x10[3];
|
drv_data->gyro_sensitivity_x10 = icm42605_gyro_sensitivity_x10[3];
|
||||||
|
|
||||||
|
#ifdef CONFIG_ICM42605_TRIGGER
|
||||||
if (icm42605_init_interrupt(dev) < 0) {
|
if (icm42605_init_interrupt(dev) < 0) {
|
||||||
LOG_ERR("Failed to initialize interrupts.");
|
LOG_ERR("Failed to initialize interrupts.");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_DBG("Initialize interrupt done");
|
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 = {
|
static const struct sensor_driver_api icm42605_driver_api = {
|
||||||
|
#ifdef CONFIG_ICM42605_TRIGGER
|
||||||
.trigger_set = icm42605_trigger_set,
|
.trigger_set = icm42605_trigger_set,
|
||||||
|
#endif
|
||||||
.sample_fetch = icm42605_sample_fetch,
|
.sample_fetch = icm42605_sample_fetch,
|
||||||
.channel_get = icm42605_channel_get,
|
.channel_get = icm42605_channel_get,
|
||||||
.attr_set = icm42605_attr_set,
|
.attr_set = icm42605_attr_set,
|
||||||
|
|
|
@ -58,9 +58,11 @@ struct icm42605_data {
|
||||||
struct sensor_trigger double_tap_trigger;
|
struct sensor_trigger double_tap_trigger;
|
||||||
sensor_trigger_handler_t double_tap_handler;
|
sensor_trigger_handler_t double_tap_handler;
|
||||||
|
|
||||||
|
#ifdef CONFIG_ICM42605_TRIGGER
|
||||||
K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_ICM42605_THREAD_STACK_SIZE);
|
K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_ICM42605_THREAD_STACK_SIZE);
|
||||||
struct k_thread thread;
|
struct k_thread thread;
|
||||||
struct k_sem gpio_sem;
|
struct k_sem gpio_sem;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct spi_cs_control spi_cs;
|
struct spi_cs_control spi_cs;
|
||||||
struct spi_config spi_cfg;
|
struct spi_config spi_cfg;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue