Lines Matching +full:swap +full:- +full:bytes
4 * SPDX-License-Identifier: Apache-2.0
21 struct p3t1755_data *data = dev->data; in p3t1755_i3c_read_reg()
23 return i3c_burst_read(data->i3c_dev, reg, value, len); in p3t1755_i3c_read_reg()
28 struct p3t1755_data *data = dev->data; in p3t1755_i3c_write_reg()
30 return i3c_burst_write(data->i3c_dev, reg, byte, len); in p3t1755_i3c_write_reg()
37 const struct p3t1755_config *config = dev->config; in p3t1755_i2c_read_reg()
39 return i2c_burst_read_dt(&config->bus_cfg.i2c, reg, value, len); in p3t1755_i2c_read_reg()
44 const struct p3t1755_config *config = dev->config; in p3t1755_i2c_write_reg()
46 return i2c_burst_write_dt(&config->bus_cfg.i2c, reg, byte, len); in p3t1755_i2c_write_reg()
52 const struct p3t1755_config *config = dev->config; in p3t1755_sample_fetch()
53 struct p3t1755_data *data = dev->data; in p3t1755_sample_fetch()
58 return -ENOTSUP; in p3t1755_sample_fetch()
61 if (config->oneshot_mode) { in p3t1755_sample_fetch()
62 data->config_reg |= P3T1755_CONFIG_REG_OS; in p3t1755_sample_fetch()
63 config->ops.write(dev, P3T1755_CONFIG_REG, &data->config_reg, 1); in p3t1755_sample_fetch()
64 /* Maximum one-shot conversion time per specification is 12ms */ in p3t1755_sample_fetch()
68 int status = config->ops.read(dev, P3T1755_TEMPERATURE_REG, raw_temp, 2); in p3t1755_sample_fetch()
72 return -ENOTSUP; in p3t1755_sample_fetch()
75 /* Byte 1 contains the MSByte and Byte 2 contains the LSByte, we need to swap the 2 bytes. in p3t1755_sample_fetch()
78 data->sample = (((uint16_t)raw_temp[0] << 8U) | (uint16_t)raw_temp[1]) >> in p3t1755_sample_fetch()
90 /* Convert 12-bit 2s complement to signed negative in p3t1755_convert_to_signed()
93 rv = -(1U + (rv ^ P3T1755_TEMPERATURE_ABS_MASK)); in p3t1755_convert_to_signed()
101 struct p3t1755_data *data = dev->data; in p3t1755_channel_get()
105 return -ENOTSUP; in p3t1755_channel_get()
108 raw_val = p3t1755_convert_to_signed(data->sample); in p3t1755_channel_get()
120 const struct p3t1755_config *config = dev->config; in p3t1755_init()
121 struct p3t1755_data *data = dev->data; in p3t1755_init()
124 if (config->i3c.bus != NULL) { in p3t1755_init()
125 data->i3c_dev = i3c_device_find(config->i3c.bus, &config->i3c.dev_id); in p3t1755_init()
126 if (data->i3c_dev == NULL) { in p3t1755_init()
128 return -ENODEV; in p3t1755_init()
133 if (config->inst_on_bus == P3T1755_BUS_I2C) { in p3t1755_init()
134 if (!i2c_is_ready_dt(&config->bus_cfg.i2c)) { in p3t1755_init()
136 return -ENODEV; in p3t1755_init()
141 if (config->oneshot_mode) { in p3t1755_init()
142 config->ops.read(dev, P3T1755_CONFIG_REG, &data->config_reg, 1); in p3t1755_init()
144 * one-shot temperature measurement. in p3t1755_init()
146 data->config_reg |= P3T1755_CONFIG_REG_SD; in p3t1755_init()
147 config->ops.write(dev, P3T1755_CONFIG_REG, &data->config_reg, 1); in p3t1755_init()