Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions drivers/sensor/mpu6050/mpu6050_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ int mpu6050_trigger_set(struct device *dev,
return -ENOTSUP;
}

gpio_pin_disable_callback(drv_data->gpio, cfg->int_pin);
gpio_pin_interrupt_configure(drv_data->gpio, cfg->int_pin,
GPIO_INT_DISABLE);

drv_data->data_ready_handler = handler;
if (handler == NULL) {
Expand All @@ -34,7 +35,8 @@ int mpu6050_trigger_set(struct device *dev,

drv_data->data_ready_trigger = *trig;

gpio_pin_enable_callback(drv_data->gpio, cfg->int_pin);
gpio_pin_interrupt_configure(drv_data->gpio, cfg->int_pin,
GPIO_INT_EDGE_TO_ACTIVE);

return 0;
}
Expand All @@ -48,7 +50,8 @@ static void mpu6050_gpio_callback(struct device *dev,

ARG_UNUSED(pins);

gpio_pin_disable_callback(dev, cfg->int_pin);
gpio_pin_interrupt_configure(drv_data->gpio, cfg->int_pin,
GPIO_INT_DISABLE);

#if defined(CONFIG_MPU6050_TRIGGER_OWN_THREAD)
k_sem_give(&drv_data->gpio_sem);
Expand All @@ -68,7 +71,9 @@ static void mpu6050_thread_cb(void *arg)
&drv_data->data_ready_trigger);
}

gpio_pin_enable_callback(drv_data->gpio, cfg->int_pin);
gpio_pin_interrupt_configure(drv_data->gpio, cfg->int_pin,
GPIO_INT_EDGE_TO_ACTIVE);

}

#ifdef CONFIG_MPU6050_TRIGGER_OWN_THREAD
Expand Down Expand Up @@ -112,8 +117,7 @@ int mpu6050_init_interrupt(struct device *dev)
drv_data->dev = dev;

gpio_pin_configure(drv_data->gpio, cfg->int_pin,
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE);
GPIO_INPUT | cfg->int_flags);

gpio_init_callback(&drv_data->gpio_cb,
mpu6050_gpio_callback,
Expand Down Expand Up @@ -143,7 +147,8 @@ int mpu6050_init_interrupt(struct device *dev)
drv_data->work.handler = mpu6050_work_cb;
#endif

gpio_pin_enable_callback(drv_data->gpio, cfg->int_pin);
gpio_pin_interrupt_configure(drv_data->gpio, cfg->int_pin,
GPIO_INT_EDGE_TO_ACTIVE);

return 0;
}
2 changes: 1 addition & 1 deletion samples/sensor/mpu6050/boards/nrf52_pca10040.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
reg = <0x68>;
status = "okay";
label = "MPU6050";
int-gpios = <&gpio0 11 0>;
int-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
};
};