Lines Matching full:ism330dhcx

1 /* ST Microelectronics ISM330DHCX 6-axis IMU sensor driver
8 * https://www.st.com/resource/en/datasheet/ism330dhcx.pdf
18 #include "ism330dhcx.h"
20 LOG_MODULE_DECLARE(ISM330DHCX, CONFIG_SENSOR_LOG_LEVEL);
29 struct ism330dhcx_data *ism330dhcx = dev->data; in ism330dhcx_enable_t_int() local
36 ism330dhcx_temperature_raw_get(ism330dhcx->ctx, &buf); in ism330dhcx_enable_t_int()
44 ism330dhcx_read_reg(ism330dhcx->ctx, ISM330DHCX_INT2_CTRL, in ism330dhcx_enable_t_int()
47 return ism330dhcx_write_reg(ism330dhcx->ctx, ISM330DHCX_INT2_CTRL, in ism330dhcx_enable_t_int()
58 struct ism330dhcx_data *ism330dhcx = dev->data; in ism330dhcx_enable_xl_int() local
64 ism330dhcx_acceleration_raw_get(ism330dhcx->ctx, buf); in ism330dhcx_enable_xl_int()
71 ism330dhcx_read_reg(ism330dhcx->ctx, ISM330DHCX_INT1_CTRL, in ism330dhcx_enable_xl_int()
75 return ism330dhcx_write_reg(ism330dhcx->ctx, ISM330DHCX_INT1_CTRL, in ism330dhcx_enable_xl_int()
80 ism330dhcx_read_reg(ism330dhcx->ctx, ISM330DHCX_INT2_CTRL, in ism330dhcx_enable_xl_int()
83 return ism330dhcx_write_reg(ism330dhcx->ctx, ISM330DHCX_INT2_CTRL, in ism330dhcx_enable_xl_int()
94 struct ism330dhcx_data *ism330dhcx = dev->data; in ism330dhcx_enable_g_int() local
100 ism330dhcx_angular_rate_raw_get(ism330dhcx->ctx, buf); in ism330dhcx_enable_g_int()
107 ism330dhcx_read_reg(ism330dhcx->ctx, ISM330DHCX_INT1_CTRL, in ism330dhcx_enable_g_int()
110 return ism330dhcx_write_reg(ism330dhcx->ctx, ISM330DHCX_INT1_CTRL, in ism330dhcx_enable_g_int()
115 ism330dhcx_read_reg(ism330dhcx->ctx, ISM330DHCX_INT2_CTRL, in ism330dhcx_enable_g_int()
118 return ism330dhcx_write_reg(ism330dhcx->ctx, ISM330DHCX_INT2_CTRL, in ism330dhcx_enable_g_int()
130 struct ism330dhcx_data *ism330dhcx = dev->data; in ism330dhcx_trigger_set() local
138 ism330dhcx->handler_drdy_acc = handler; in ism330dhcx_trigger_set()
139 ism330dhcx->trig_drdy_acc = trig; in ism330dhcx_trigger_set()
146 ism330dhcx->handler_drdy_gyr = handler; in ism330dhcx_trigger_set()
147 ism330dhcx->trig_drdy_gyr = trig; in ism330dhcx_trigger_set()
156 ism330dhcx->handler_drdy_temp = handler; in ism330dhcx_trigger_set()
157 ism330dhcx->trig_drdy_temp = trig; in ism330dhcx_trigger_set()
175 struct ism330dhcx_data *ism330dhcx = dev->data; in ism330dhcx_handle_interrupt() local
180 if (ism330dhcx_status_reg_get(ism330dhcx->ctx, &status) < 0) { in ism330dhcx_handle_interrupt()
193 if ((status.xlda) && (ism330dhcx->handler_drdy_acc != NULL)) { in ism330dhcx_handle_interrupt()
194 ism330dhcx->handler_drdy_acc(dev, ism330dhcx->trig_drdy_acc); in ism330dhcx_handle_interrupt()
197 if ((status.gda) && (ism330dhcx->handler_drdy_gyr != NULL)) { in ism330dhcx_handle_interrupt()
198 ism330dhcx->handler_drdy_gyr(dev, ism330dhcx->trig_drdy_gyr); in ism330dhcx_handle_interrupt()
202 if ((status.tda) && (ism330dhcx->handler_drdy_temp != NULL)) { in ism330dhcx_handle_interrupt()
203 ism330dhcx->handler_drdy_temp(dev, ism330dhcx->trig_drdy_temp); in ism330dhcx_handle_interrupt()
214 struct ism330dhcx_data *ism330dhcx = in ism330dhcx_gpio_callback() local
216 const struct ism330dhcx_config *cfg = ism330dhcx->dev->config; in ism330dhcx_gpio_callback()
223 k_sem_give(&ism330dhcx->gpio_sem); in ism330dhcx_gpio_callback()
225 k_work_submit(&ism330dhcx->work); in ism330dhcx_gpio_callback()
235 struct ism330dhcx_data *ism330dhcx = p1; in ism330dhcx_thread() local
238 k_sem_take(&ism330dhcx->gpio_sem, K_FOREVER); in ism330dhcx_thread()
239 ism330dhcx_handle_interrupt(ism330dhcx->dev); in ism330dhcx_thread()
247 struct ism330dhcx_data *ism330dhcx = in ism330dhcx_work_cb() local
250 ism330dhcx_handle_interrupt(ism330dhcx->dev); in ism330dhcx_work_cb()
256 struct ism330dhcx_data *ism330dhcx = dev->data; in ism330dhcx_init_interrupt() local
266 k_sem_init(&ism330dhcx->gpio_sem, 0, K_SEM_MAX_LIMIT); in ism330dhcx_init_interrupt()
268 k_thread_create(&ism330dhcx->thread, ism330dhcx->thread_stack, in ism330dhcx_init_interrupt()
271 ism330dhcx, NULL, NULL, in ism330dhcx_init_interrupt()
275 ism330dhcx->work.handler = ism330dhcx_work_cb; in ism330dhcx_init_interrupt()
284 gpio_init_callback(&ism330dhcx->gpio_cb, ism330dhcx_gpio_callback, BIT(cfg->drdy_gpio.pin)); in ism330dhcx_init_interrupt()
286 if (gpio_add_callback(cfg->drdy_gpio.port, &ism330dhcx->gpio_cb) < 0) { in ism330dhcx_init_interrupt()
292 if (ism330dhcx_data_ready_mode_set(ism330dhcx->ctx, in ism330dhcx_init_interrupt()