Lines Matching +full:drdy +full:- +full:pulsed

6  * SPDX-License-Identifier: Apache-2.0
17 struct lis2dux12_data *data = dev->data; in st_lis2dux12_set_odr_raw()
18 const struct lis2dux12_config *cfg = dev->config; in st_lis2dux12_set_odr_raw()
19 stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; in st_lis2dux12_set_odr_raw()
20 lis2dux12_md_t mode = {.odr = odr, .fs = data->range}; in st_lis2dux12_set_odr_raw()
22 data->odr = odr; in st_lis2dux12_set_odr_raw()
29 struct lis2dux12_data *data = dev->data; in st_lis2dux12_set_range()
30 const struct lis2dux12_config *cfg = dev->config; in st_lis2dux12_set_range()
31 stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; in st_lis2dux12_set_range()
32 lis2dux12_md_t val = { .odr = data->odr, .fs = range }; in st_lis2dux12_set_range()
41 data->gain = lis2dux12_from_fs2g_to_mg(1); in st_lis2dux12_set_range()
44 data->gain = lis2dux12_from_fs4g_to_mg(1); in st_lis2dux12_set_range()
47 data->gain = lis2dux12_from_fs8g_to_mg(1); in st_lis2dux12_set_range()
50 data->gain = lis2dux12_from_fs16g_to_mg(1); in st_lis2dux12_set_range()
54 return -EINVAL; in st_lis2dux12_set_range()
57 data->range = range; in st_lis2dux12_set_range()
63 struct lis2dux12_data *data = dev->data; in st_lis2dux12_sample_fetch_accel()
64 const struct lis2dux12_config *cfg = dev->config; in st_lis2dux12_sample_fetch_accel()
65 stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; in st_lis2dux12_sample_fetch_accel()
68 lis2dux12_md_t mode = {.fs = data->range}; in st_lis2dux12_sample_fetch_accel()
73 return -EIO; in st_lis2dux12_sample_fetch_accel()
76 data->sample_x = xzy_data.raw[0]; in st_lis2dux12_sample_fetch_accel()
77 data->sample_y = xzy_data.raw[1]; in st_lis2dux12_sample_fetch_accel()
78 data->sample_z = xzy_data.raw[2]; in st_lis2dux12_sample_fetch_accel()
86 struct lis2dux12_data *data = dev->data; in st_lis2dux12_sample_fetch_temp()
87 const struct lis2dux12_config *cfg = dev->config; in st_lis2dux12_sample_fetch_temp()
88 stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; in st_lis2dux12_sample_fetch_temp()
95 return -EIO; in st_lis2dux12_sample_fetch_temp()
98 data->sample_temp = temp_data.heat.deg_c; in st_lis2dux12_sample_fetch_temp()
107 struct lis2dux12_data *lis2dux12 = dev->data; in st_lis2dux12_handle_interrupt()
108 const struct lis2dux12_config *cfg = dev->config; in st_lis2dux12_handle_interrupt()
109 stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; in st_lis2dux12_handle_interrupt()
115 if (sources.drdy == 0) { in st_lis2dux12_handle_interrupt()
119 if (lis2dux12->data_ready_handler != NULL) { in st_lis2dux12_handle_interrupt()
120 lis2dux12->data_ready_handler(dev, lis2dux12->data_ready_trigger); in st_lis2dux12_handle_interrupt()
124 ret = gpio_pin_interrupt_configure_dt(lis2dux12->drdy_gpio, GPIO_INT_EDGE_TO_ACTIVE); in st_lis2dux12_handle_interrupt()
126 LOG_ERR("%s: Not able to configure pin_int", dev->name); in st_lis2dux12_handle_interrupt()
132 const struct lis2dux12_config *cfg = dev->config; in st_lis2dux12_init_interrupt()
133 stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; in st_lis2dux12_init_interrupt()
137 /* Enable pulsed mode */ in st_lis2dux12_init_interrupt()
143 /* route data-ready interrupt on int1 */ in st_lis2dux12_init_interrupt()
149 route.drdy = 1; in st_lis2dux12_init_interrupt()
175 const struct lis2dux12_config *const cfg = dev->config; in st_lis2dux12_init()
176 stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; in st_lis2dux12_init()
186 LOG_ERR("%s: Not able to read dev id", dev->name); in st_lis2dux12_init()
191 LOG_ERR("%s: Invalid chip ID 0x%02x", dev->name, chip_id); in st_lis2dux12_init()
192 return -EINVAL; in st_lis2dux12_init()
203 LOG_INF("%s: chip id 0x%x", dev->name, chip_id); in st_lis2dux12_init()
211 if (cfg->trig_enabled) { in st_lis2dux12_init()
214 LOG_ERR("%s: Failed to initialize triggers", dev->name); in st_lis2dux12_init()
221 LOG_DBG("%s: pm: %d, odr: %d", dev->name, cfg->pm, cfg->odr); in st_lis2dux12_init()
222 ret = st_lis2dux12_set_odr_raw(dev, cfg->odr); in st_lis2dux12_init()
224 LOG_ERR("%s: odr init error (12.5 Hz)", dev->name); in st_lis2dux12_init()
229 LOG_DBG("%s: range is %d", dev->name, cfg->range); in st_lis2dux12_init()
230 ret = st_lis2dux12_set_range(dev, cfg->range); in st_lis2dux12_init()
232 LOG_ERR("%s: range init error %d", dev->name, cfg->range); in st_lis2dux12_init()