Lines Matching +full:device +full:- +full:chemistry
4 * SPDX-License-Identifier: Apache-2.0
9 #include <zephyr/device.h>
17 const struct device *battery_voltage;
18 const struct device *battery_current;
21 enum battery_chemistry chemistry; member
24 static int composite_read_micro(const struct device *dev, enum sensor_channel chan, int *val) in composite_read_micro()
49 static int composite_get_prop(const struct device *dev, fuel_gauge_prop_t prop, in composite_get_prop()
52 const struct composite_config *config = dev->config; in composite_get_prop()
57 if (config->charge_capacity_microamp_hours == 0) { in composite_get_prop()
58 return -ENOTSUP; in composite_get_prop()
60 val->full_charge_capacity = config->charge_capacity_microamp_hours; in composite_get_prop()
63 if (config->charge_capacity_microamp_hours == 0) { in composite_get_prop()
64 return -ENOTSUP; in composite_get_prop()
66 val->full_charge_capacity = config->charge_capacity_microamp_hours / 1000; in composite_get_prop()
69 rc = composite_read_micro(config->battery_voltage, SENSOR_CHAN_VOLTAGE, in composite_get_prop()
70 &val->voltage); in composite_get_prop()
74 if (config->ocv_lookup_table[0] == -1) { in composite_get_prop()
75 return -ENOTSUP; in composite_get_prop()
77 rc = composite_read_micro(config->battery_voltage, SENSOR_CHAN_VOLTAGE, &voltage); in composite_get_prop()
78 val->relative_state_of_charge = in composite_get_prop()
79 battery_soc_lookup(config->ocv_lookup_table, voltage) / 1000; in composite_get_prop()
82 if (config->battery_current == NULL) { in composite_get_prop()
83 return -ENOTSUP; in composite_get_prop()
85 rc = composite_read_micro(config->battery_current, SENSOR_CHAN_CURRENT, in composite_get_prop()
86 &val->current); in composite_get_prop()
89 return -ENOTSUP; in composite_get_prop()
107 .chemistry = BATTERY_CHEMISTRY_DT_GET(inst), \