Lines Matching +full:- +full:exponent

4  * SPDX-License-Identifier: Apache-2.0
22 const struct opt3001_config *config = dev->config; in opt3001_reg_read()
25 if (i2c_burst_read_dt(&config->i2c, reg, value, 2) != 0) { in opt3001_reg_read()
26 return -EIO; in opt3001_reg_read()
37 const struct opt3001_config *config = dev->config; in opt3001_reg_write()
45 return i2c_write_dt(&config->i2c, tx_buf, sizeof(tx_buf)); in opt3001_reg_write()
55 return -EIO; in opt3001_reg_update()
67 struct opt3001_data *drv_data = dev->data; in opt3001_sample_fetch()
72 drv_data->sample = 0U; in opt3001_sample_fetch()
75 return -EIO; in opt3001_sample_fetch()
78 drv_data->sample = value; in opt3001_sample_fetch()
87 struct opt3001_data *drv_data = dev->data; in opt3001_channel_get()
91 return -ENOTSUP; in opt3001_channel_get()
95 * sample consists of 4 bits of exponent and 12 bits of mantissa in opt3001_channel_get()
96 * bits 15 to 12 are exponent bits in opt3001_channel_get()
100 * (2^(exponent value)) * 0.01 * mantissa value in opt3001_channel_get()
102 uval = (1 << (drv_data->sample >> OPT3001_SAMPLE_EXPONENT_SHIFT)) in opt3001_channel_get()
103 * (drv_data->sample & OPT3001_MANTISSA_MASK); in opt3001_channel_get()
104 val->val1 = uval / 100; in opt3001_channel_get()
105 val->val2 = (uval % 100) * 10000; in opt3001_channel_get()
117 const struct opt3001_config *config = dev->config; in opt3001_chip_init()
120 if (!device_is_ready(config->i2c.bus)) { in opt3001_chip_init()
122 return -ENODEV; in opt3001_chip_init()
126 return -EIO; in opt3001_chip_init()
131 return -ENOTSUP; in opt3001_chip_init()
135 return -EIO; in opt3001_chip_init()
140 return -ENOTSUP; in opt3001_chip_init()
147 return -EIO; in opt3001_chip_init()
156 return -EINVAL; in opt3001_init()