Lines Matching +full:conversion +full:- +full:rate
4 * SPDX-License-Identifier: Apache-2.0
41 /* Continuous conversion time = 240ms -> 1/0.240*1000000 */
44 /* The quantization step size at 16-bit resolution is 0.0078125. */
51 const struct adt7310_dev_config *cfg = dev->config; in adt7310_temp_reg_read()
59 ret = spi_transceive_dt(&cfg->bus, &tx, &rx); in adt7310_temp_reg_read()
72 const struct adt7310_dev_config *cfg = dev->config; in adt7310_temp_reg_write()
83 return spi_transceive_dt(&cfg->bus, &tx, &rx); in adt7310_temp_reg_write()
88 const struct adt7310_dev_config *cfg = dev->config; in adt7310_reg_read()
96 ret = spi_transceive_dt(&cfg->bus, &tx, &rx); in adt7310_reg_read()
108 const struct adt7310_dev_config *cfg = dev->config; in adt7310_reg_write()
115 return spi_transceive_dt(&cfg->bus, &tx, &rx); in adt7310_reg_write()
120 struct adt7310_data *drv_data = dev->data; in adt7310_sample_fetch()
125 return -ENOTSUP; in adt7310_sample_fetch()
133 drv_data->sample = value; in adt7310_sample_fetch()
142 struct adt7310_data *drv_data = dev->data; in adt7310_channel_get()
145 return -ENOTSUP; in adt7310_channel_get()
148 value = ADT7310_SAMPLE_TO_MICRO_DEG((int32_t)drv_data->sample); in adt7310_channel_get()
149 val->val1 = value / 1000000; in adt7310_channel_get()
150 val->val2 = value % 1000000; in adt7310_channel_get()
174 int32_t rate, value; in adt7310_attr_set() local
178 return -ENOTSUP; in adt7310_attr_set()
181 if (val->val1 > INT32_MAX/1000000 - 1 || val->val1 < INT32_MIN/1000000 + 1) { in adt7310_attr_set()
182 return -EINVAL; in adt7310_attr_set()
187 rate = val->val1 * 1000000 + val->val2; in adt7310_attr_set()
189 if (rate > ADT7310_MAX_SAMPLE_RATE || rate < 0) { in adt7310_attr_set()
190 return -EINVAL; in adt7310_attr_set()
193 if (rate > 1000000) { in adt7310_attr_set()
203 if (val->val1 < 0 || val->val1 > ADT7310_HYSTERESIS_TEMP_MAX || val->val2 != 0) { in adt7310_attr_set()
204 return -EINVAL; in adt7310_attr_set()
206 return adt7310_reg_write(dev, ADT7310_REG_HYST, val->val1); in adt7310_attr_set()
215 value = val->val1 * 1000000 + val->val2; in adt7310_attr_set()
219 return -EINVAL; in adt7310_attr_set()
223 return -ENOTSUP; in adt7310_attr_set()
243 return -ENODEV; in adt7310_probe()
254 const struct adt7310_dev_config *cfg = dev->config; in adt7310_init()
257 if (!spi_is_ready_dt(&cfg->bus)) { in adt7310_init()
258 LOG_ERR("SPI bus %s not ready", cfg->bus.bus->name); in adt7310_init()
259 return -ENODEV; in adt7310_init()
268 if (cfg->int_gpio.port) { in adt7310_init()