Lines Matching +full:data +full:- +full:ready

4  * SPDX-License-Identifier: Apache-2.0
23 struct mpu9250_data *drv_data = dev->data; in mpu9250_trigger_set()
24 const struct mpu9250_config *cfg = dev->config; in mpu9250_trigger_set()
27 if (trig->type != SENSOR_TRIG_DATA_READY) { in mpu9250_trigger_set()
28 return -ENOTSUP; in mpu9250_trigger_set()
31 ret = gpio_pin_interrupt_configure_dt(&cfg->int_pin, GPIO_INT_DISABLE); in mpu9250_trigger_set()
37 drv_data->data_ready_handler = handler; in mpu9250_trigger_set()
42 drv_data->data_ready_trigger = trig; in mpu9250_trigger_set()
44 ret = gpio_pin_interrupt_configure_dt(&cfg->int_pin, in mpu9250_trigger_set()
59 const struct mpu9250_config *cfg = drv_data->dev->config; in mpu9250_gpio_callback()
64 ret = gpio_pin_interrupt_configure_dt(&cfg->int_pin, GPIO_INT_DISABLE); in mpu9250_gpio_callback()
71 k_sem_give(&drv_data->gpio_sem); in mpu9250_gpio_callback()
73 k_work_submit(&drv_data->work); in mpu9250_gpio_callback()
79 struct mpu9250_data *drv_data = dev->data; in mpu9250_thread_cb()
80 const struct mpu9250_config *cfg = dev->config; in mpu9250_thread_cb()
83 if (drv_data->data_ready_handler != NULL) { in mpu9250_thread_cb()
84 drv_data->data_ready_handler(dev, in mpu9250_thread_cb()
85 drv_data->data_ready_trigger); in mpu9250_thread_cb()
88 ret = gpio_pin_interrupt_configure_dt(&cfg->int_pin, in mpu9250_thread_cb()
105 k_sem_take(&drv_data->gpio_sem, K_FOREVER); in mpu9250_thread()
106 mpu9250_thread_cb(drv_data->dev); in mpu9250_thread()
117 mpu9250_thread_cb(drv_data->dev); in mpu9250_work_cb()
123 struct mpu9250_data *drv_data = dev->data; in mpu9250_init_interrupt()
124 const struct mpu9250_config *cfg = dev->config; in mpu9250_init_interrupt()
127 /* setup data ready gpio interrupt */ in mpu9250_init_interrupt()
128 if (!gpio_is_ready_dt(&cfg->int_pin)) { in mpu9250_init_interrupt()
129 LOG_ERR("Interrupt pin is not ready."); in mpu9250_init_interrupt()
130 return -EIO; in mpu9250_init_interrupt()
133 drv_data->dev = dev; in mpu9250_init_interrupt()
135 ret = gpio_pin_configure_dt(&cfg->int_pin, GPIO_INPUT); in mpu9250_init_interrupt()
141 gpio_init_callback(&drv_data->gpio_cb, in mpu9250_init_interrupt()
143 BIT(cfg->int_pin.pin)); in mpu9250_init_interrupt()
145 ret = gpio_add_callback(cfg->int_pin.port, &drv_data->gpio_cb); in mpu9250_init_interrupt()
151 /* enable data ready interrupt */ in mpu9250_init_interrupt()
152 ret = i2c_reg_write_byte_dt(&cfg->i2c, MPU9250_REG_INT_EN, in mpu9250_init_interrupt()
155 LOG_ERR("Failed to enable data ready interrupt."); in mpu9250_init_interrupt()
160 ret = k_sem_init(&drv_data->gpio_sem, 0, K_SEM_MAX_LIMIT); in mpu9250_init_interrupt()
166 k_thread_create(&drv_data->thread, drv_data->thread_stack, in mpu9250_init_interrupt()
172 drv_data->work.handler = mpu9250_work_cb; in mpu9250_init_interrupt()
175 ret = gpio_pin_interrupt_configure_dt(&cfg->int_pin, in mpu9250_init_interrupt()