Lines Matching +full:data +full:- +full:sheet

4  * SPDX-License-Identifier: Apache-2.0
12 * bits resolution respectively. Data sheet can be found here:
64 static int dacx0501_reg_read(const struct device *dev, const uint8_t addr, uint16_t *data) in dacx0501_reg_read() argument
66 const struct dacx0501_config *config = dev->config; in dacx0501_reg_read()
70 status = i2c_write_read_dt(&config->i2c_spec, &addr, sizeof(addr), raw_data, in dacx0501_reg_read()
77 *data = sys_get_be16(raw_data); in dacx0501_reg_read()
81 static int dacx0501_reg_write(const struct device *dev, uint8_t addr, uint16_t data) in dacx0501_reg_write() argument
83 const struct dacx0501_config *config = dev->config; in dacx0501_reg_write()
87 sys_put_be16(data, write_cmd + 1); in dacx0501_reg_write()
89 return i2c_write_dt(&config->i2c_spec, write_cmd, sizeof(write_cmd)); in dacx0501_reg_write()
95 struct dacx0501_data *data = dev->data; in dacx0501_channel_setup() local
98 if (channel_cfg->channel_id != 0) { in dacx0501_channel_setup()
99 LOG_ERR("Unsupported channel %d", channel_cfg->channel_id); in dacx0501_channel_setup()
100 return -ENOTSUP; in dacx0501_channel_setup()
103 if (channel_cfg->resolution != data->resolution) { in dacx0501_channel_setup()
104 LOG_ERR("Unsupported resolution %d. Actual: %d", channel_cfg->resolution, in dacx0501_channel_setup()
105 data->resolution); in dacx0501_channel_setup()
106 return -ENOTSUP; in dacx0501_channel_setup()
109 if (channel_cfg->internal) { in dacx0501_channel_setup()
111 return -ENOTSUP; in dacx0501_channel_setup()
119 struct dacx0501_data *data = dev->data; in dacx0501_write_value() local
123 return -ENOTSUP; in dacx0501_write_value()
126 if (value >= (1 << data->resolution)) { in dacx0501_write_value()
128 return -EINVAL; in dacx0501_write_value()
131 value <<= (16 - data->resolution); in dacx0501_write_value()
138 const struct dacx0501_config *config = dev->config; in dacx0501_init()
139 struct dacx0501_data *data = dev->data; in dacx0501_init() local
143 if (!i2c_is_ready_dt(&config->i2c_spec)) { in dacx0501_init()
144 LOG_ERR("I2C bus %s not ready", config->i2c_spec.bus->name); in dacx0501_init()
145 return -ENODEV; in dacx0501_init()
154 /* See DEVICE_ID register RES field in the data sheet. */ in dacx0501_init()
155 data->resolution = 16 - 2 * FIELD_GET(DACX0501_MASK_DEVICE_ID_RES, device_id); in dacx0501_init()
159 config->voltage_reference == REF_EXTERNAL)); in dacx0501_init()
167 FIELD_PREP(DACX0501_MASK_GAIN_REFDIV_EN, config->output_gain == VM_DIV2) | in dacx0501_init()
168 FIELD_PREP(DACX0501_MASK_GAIN_BUFF_GAIN, config->output_gain == VM_MUL2)); in dacx0501_init()