Lines Matching +full:reset +full:- +full:val
5 * SPDX-License-Identifier: Apache-2.0
26 const struct hp206c_device_config *cfg = dev->config; in hp206c_bus_config()
31 return i2c_configure(cfg->i2c.bus, i2c_cfg); in hp206c_bus_config()
37 const struct hp206c_device_config *cfg = dev->config; in hp206c_read()
41 if (i2c_burst_read_dt(&cfg->i2c, cmd, data, len) < 0) { in hp206c_read()
42 return -EIO; in hp206c_read()
59 const struct hp206c_device_config *cfg = dev->config; in hp206c_write()
63 if (i2c_burst_write_dt(&cfg->i2c, cmd, data, len) < 0) { in hp206c_write()
64 return -EIO; in hp206c_write()
80 const struct hp206c_device_config *cfg = dev->config; in hp206c_cmd_send()
84 return i2c_write_dt(&cfg->i2c, &cmd, 1); in hp206c_cmd_send()
90 * the times converted to microseconds. The trade-off is 900us added to the
106 struct hp206c_device_data *hp206c = dev->data; in hp206c_osr_set()
110 for (i = 0U; i < 6 && BIT(12 - i) != osr; i++) { in hp206c_osr_set()
114 return -ENOTSUP; in hp206c_osr_set()
117 hp206c->osr = i; in hp206c_osr_set()
129 return -EIO; in hp206c_altitude_offs_set()
135 return -EIO; in hp206c_altitude_offs_set()
143 const struct sensor_value *val) in hp206c_attr_set() argument
147 return hp206c_osr_set(dev, val->val1); in hp206c_attr_set()
153 return -ENOTSUP; in hp206c_attr_set()
156 return hp206c_altitude_offs_set(dev, val->val1); in hp206c_attr_set()
160 return -ENOTSUP; in hp206c_attr_set()
166 struct hp206c_device_data *hp206c = dev->data; in hp206c_wait_dev_ready()
169 k_timer_start(&hp206c->tmr, K_MSEC(timeout_ms), K_NO_WAIT); in hp206c_wait_dev_ready()
170 k_timer_status_sync(&hp206c->tmr); in hp206c_wait_dev_ready()
173 return -EIO; in hp206c_wait_dev_ready()
180 return -EBUSY; in hp206c_wait_dev_ready()
186 struct hp206c_device_data *hp206c = dev->data; in hp206c_adc_acquire()
188 if (hp206c_cmd_send(dev, HP206C_CMD_ADC_CVT | (hp206c->osr << 2)) < 0) { in hp206c_adc_acquire()
189 return -EIO; in hp206c_adc_acquire()
192 return hp206c_wait_dev_ready(dev, hp206c_adc_time_ms[hp206c->osr]); in hp206c_adc_acquire()
209 uint8_t cmd, struct sensor_value *val) in hp206c_val_get() argument
215 return -EIO; in hp206c_val_get()
229 val->val1 = temp / 1000; in hp206c_val_get()
230 val->val2 = temp % 1000 * 1000; in hp206c_val_get()
232 val->val1 = temp / 100; in hp206c_val_get()
233 val->val2 = temp % 100 * 10000; in hp206c_val_get()
240 struct sensor_value *val) in hp206c_pressure_get() argument
242 return hp206c_val_get(dev, HP206C_CMD_READ_P, val); in hp206c_pressure_get()
246 struct sensor_value *val) in hp206c_altitude_get() argument
248 return hp206c_val_get(dev, HP206C_CMD_READ_A, val); in hp206c_altitude_get()
252 struct sensor_value *val) in hp206c_temperature_get() argument
254 return hp206c_val_get(dev, HP206C_CMD_READ_T, val); in hp206c_temperature_get()
259 struct sensor_value *val) in hp206c_channel_get() argument
263 return hp206c_temperature_get(dev, val); in hp206c_channel_get()
266 return hp206c_pressure_get(dev, val); in hp206c_channel_get()
269 return hp206c_altitude_get(dev, val); in hp206c_channel_get()
272 return -ENOTSUP; in hp206c_channel_get()
286 struct hp206c_device_data *hp206c = dev->data; in hp206c_init()
287 const struct hp206c_device_config *cfg = dev->config; in hp206c_init()
289 if (!device_is_ready(cfg->i2c.bus)) { in hp206c_init()
291 return -EINVAL; in hp206c_init()
294 /* reset the chip */ in hp206c_init()
296 LOG_ERR("Cannot reset chip."); in hp206c_init()
297 return -EIO; in hp206c_init()
300 k_timer_init(&hp206c->tmr, NULL, NULL); in hp206c_init()
306 return -ENOTSUP; in hp206c_init()
310 return -EIO; in hp206c_init()