fuel_gauge: Implement sbs gauge read for mfr acc
Implement and weakly test fetching the manufacturer access word from an SBS compatible fuel gauge. Signed-off-by: Aaron Massey <aaronmassey@google.com>
This commit is contained in:
parent
db60e08604
commit
c0762d003a
|
@ -69,6 +69,10 @@ static int sbs_gauge_get_prop(const struct device *dev, struct fuel_gauge_get_pr
|
|||
rc = sbs_cmd_reg_read(dev, SBS_GAUGE_CMD_AVG_TIME2FULL, &val);
|
||||
prop->value.runtime_to_empty = val;
|
||||
break;
|
||||
case FUEL_GAUGE_SBS_MFR_ACCESS:
|
||||
rc = sbs_cmd_reg_read(dev, SBS_GAUGE_CMD_MANUFACTURER_ACCESS, &val);
|
||||
prop->value.sbs_mfr_access_word = val;
|
||||
break;
|
||||
case FUEL_GAUGE_STATE_OF_CHARGE:
|
||||
rc = sbs_cmd_reg_read(dev, SBS_GAUGE_CMD_ASOC, &val);
|
||||
prop->value.state_of_charge = val;
|
||||
|
|
|
@ -53,6 +53,7 @@ static int emul_sbs_gauge_reg_read(const struct emul *target, int reg, int *val)
|
|||
ARG_UNUSED(target);
|
||||
|
||||
switch (reg) {
|
||||
case SBS_GAUGE_CMD_MANUFACTURER_ACCESS:
|
||||
case SBS_GAUGE_CMD_VOLTAGE:
|
||||
case SBS_GAUGE_CMD_AVG_CURRENT:
|
||||
case SBS_GAUGE_CMD_TEMP:
|
||||
|
|
|
@ -123,6 +123,9 @@ ZTEST_F(sbs_gauge_new_api, test_get_props__returns_ok)
|
|||
{
|
||||
.property_type = FUEL_GAUGE_CYCLE_COUNT,
|
||||
},
|
||||
{
|
||||
.property_type = FUEL_GAUGE_SBS_MFR_ACCESS,
|
||||
},
|
||||
};
|
||||
|
||||
int ret = fixture->api->get_property(fixture->dev, props, ARRAY_SIZE(props));
|
||||
|
|
Loading…
Reference in a new issue