Lines Matching +full:temperature +full:- +full:format
4 * SPDX-License-Identifier: Apache-2.0
74 /** Temperatures in raw format read from sensor */
92 int offset = (chan - SENSOR_CHAN_LM95234_REMOTE_TEMP_1); in lm95234_fetch_temp()
94 ret = i2c_reg_read_byte_dt(&cfg->i2c, in lm95234_fetch_temp()
100 ret = i2c_reg_read_byte_dt(&cfg->i2c, in lm95234_fetch_temp()
109 /* Read signed temperature if unsigned temperature is 0, or for local sensor */ in lm95234_fetch_temp()
112 (chan - SENSOR_CHAN_LM95234_REMOTE_TEMP_1 + 1); in lm95234_fetch_temp()
115 ret = i2c_reg_read_byte_dt(&cfg->i2c, in lm95234_fetch_temp()
121 ret = i2c_reg_read_byte_dt(&cfg->i2c, in lm95234_fetch_temp()
136 struct lm95234_data *data = dev->data; in lm95234_sample_fetch()
137 const struct lm95234_config *cfg = dev->config; in lm95234_sample_fetch()
143 ret = -EIO; in lm95234_sample_fetch()
149 ret = lm95234_fetch_temp(cfg, data, SENSOR_CHAN_AMBIENT_TEMP, &data->local); in lm95234_sample_fetch()
153 for (int i = 0; i < ARRAY_SIZE(data->remote); i++) { in lm95234_sample_fetch()
156 &data->remote[i]); in lm95234_sample_fetch()
163 ret = lm95234_fetch_temp(cfg, data, chan, &data->local); in lm95234_sample_fetch()
170 &data->remote[chan - SENSOR_CHAN_LM95234_REMOTE_TEMP_1]); in lm95234_sample_fetch()
173 ret = -ENOTSUP; in lm95234_sample_fetch()
184 struct lm95234_data *data = dev->data; in lm95234_channel_get()
189 raw_temp = data->local; in lm95234_channel_get()
195 raw_temp = data->remote[chan - SENSOR_CHAN_LM95234_REMOTE_TEMP_1]; in lm95234_channel_get()
198 return -ENOTSUP; in lm95234_channel_get()
201 /* Raw data format is 8 bits integer, 5 bits fractional, 3 bits zero */ in lm95234_channel_get()
202 val->val1 = raw_temp / 256; in lm95234_channel_get()
203 val->val2 = (raw_temp % 256) * 1000000 / 256; in lm95234_channel_get()
214 const struct lm95234_config *cfg = dev->config; in lm95234_init()
218 if (!i2c_is_ready_dt(&cfg->i2c)) { in lm95234_init()
220 return -ENODEV; in lm95234_init()
223 ret = i2c_reg_read_byte_dt(&cfg->i2c, LM95234_REG_MANUF_ID, &value); in lm95234_init()
230 return -ENODEV; in lm95234_init()
232 ret = i2c_reg_read_byte_dt(&cfg->i2c, LM95234_REG_REV_ID, &value); in lm95234_init()
239 return -ENODEV; in lm95234_init()
241 ret = i2c_reg_read_byte_dt(&cfg->i2c, LM95234_REG_CONFIG, &value); in lm95234_init()
248 ret = i2c_reg_write_byte_dt(&cfg->i2c, LM95234_REG_CONFIG, value); in lm95234_init()
254 ret = i2c_reg_read_byte_dt(&cfg->i2c, LM95234_REG_DIODE_MODEL_SELECT, &model_select); in lm95234_init()
259 ret = i2c_reg_read_byte_dt(&cfg->i2c, LM95234_REG_DIODE_MODEL_STATUS, &model_status); in lm95234_init()
270 ret = i2c_reg_write_byte_dt(&cfg->i2c, LM95234_REG_DIODE_MODEL_SELECT, in lm95234_init()
282 if (ret < 0 && ret != -ENOTSUP) { in lm95234_init()
302 return -ENOTSUP; in lm95234_pm_action()