Lines Matching +full:i2c +full:- +full:command

5  * SPDX-License-Identifier: Apache-2.0
14 #include <zephyr/drivers/i2c.h>
28 const struct bq27z746_config *cfg = dev->config; in bq27z746_read16()
29 const int status = i2c_burst_read_dt(&cfg->i2c, reg, i2c_data, sizeof(i2c_data)); in bq27z746_read16()
43 const struct bq27z746_config *cfg = dev->config; in bq27z746_write16()
48 return i2c_write_dt(&cfg->i2c, buf, sizeof(buf)); in bq27z746_write16()
54 return -EINVAL; in bq27z746_read_mac()
58 const struct bq27z746_config *cfg = dev->config; in bq27z746_read_mac()
69 * 0..1: The command (for verification) in bq27z746_read_mac()
71 * 34: Checksum calculated as (uint8_t)(0xFF - (sum of all command and data bytes)) in bq27z746_read_mac()
72 * 35: Length including command, checksum and length (e.g. data length + 4) in bq27z746_read_mac()
75 ret = i2c_burst_read_dt(&cfg->i2c, BQ27Z746_ALTMANUFACTURERACCESS, buf, in bq27z746_read_mac()
81 /* The first two bytes read is the command and is used for verification */ in bq27z746_read_mac()
85 LOG_ERR("Read command 0x%x != written command 0x%x", read_cmd, cmd); in bq27z746_read_mac()
86 return -EIO; in bq27z746_read_mac()
92 for (int i = 0; i < BQ27Z746_MAC_COMPLETE_LEN - 2; i++) { in bq27z746_read_mac()
96 const uint8_t checksum_expected = 0xFF - sum; in bq27z746_read_mac()
100 return -EIO; in bq27z746_read_mac()
104 data[0] = buf[35] - BQ27Z746_MAC_OVERHEAD_LEN; in bq27z746_read_mac()
106 /* Copy only the data to the user buffer (= skipping the first two command bytes) */ in bq27z746_read_mac()
126 val->avg_current = (int16_t)tmp_val * 1000; in bq27z746_get_prop()
130 val->cycle_count = tmp_val * 100; in bq27z746_get_prop()
134 val->current = (int16_t)tmp_val * 1000; in bq27z746_get_prop()
138 val->full_charge_capacity = tmp_val * 1000; in bq27z746_get_prop()
142 val->remaining_capacity = tmp_val * 1000; in bq27z746_get_prop()
146 val->runtime_to_empty = tmp_val; in bq27z746_get_prop()
150 val->runtime_to_full = tmp_val; in bq27z746_get_prop()
154 val->sbs_mfr_access_word = tmp_val; in bq27z746_get_prop()
158 val->relative_state_of_charge = tmp_val; in bq27z746_get_prop()
162 val->temperature = tmp_val; in bq27z746_get_prop()
166 val->voltage = tmp_val * 1000; in bq27z746_get_prop()
170 val->sbs_at_rate = (int16_t)tmp_val; in bq27z746_get_prop()
174 val->sbs_at_rate_time_to_empty = tmp_val; in bq27z746_get_prop()
178 val->chg_voltage = tmp_val * 1000; in bq27z746_get_prop()
182 val->chg_current = tmp_val * 1000; in bq27z746_get_prop()
186 val->fg_status = tmp_val; in bq27z746_get_prop()
190 val->design_cap = tmp_val; in bq27z746_get_prop()
193 rc = -ENOTSUP; in bq27z746_get_prop()
209 (uint8_t *)dst, dst_len - 1); in bq27z746_get_buffer_prop()
211 rc = -EINVAL; in bq27z746_get_buffer_prop()
217 dst_len - 1); in bq27z746_get_buffer_prop()
219 rc = -EINVAL; in bq27z746_get_buffer_prop()
225 dst_len - 1); in bq27z746_get_buffer_prop()
227 rc = -EINVAL; in bq27z746_get_buffer_prop()
231 rc = -ENOTSUP; in bq27z746_get_buffer_prop()
253 rc = -ENOTSUP; in bq27z746_set_prop()
263 cfg = dev->config; in bq27z746_init()
265 if (!device_is_ready(cfg->i2c.bus)) { in bq27z746_init()
267 return -ENODEV; in bq27z746_init()
282 .i2c = I2C_DT_SPEC_INST_GET(index), \