Skip to content

Commit c43f938

Browse files
committed
fuel_gauge: composite: support FUEL_GAUGE_TEMPERATURE
Add support for the `FUEL_GAUGE_TEMPERATURE` property. Signed-off-by: Jordan Yates <[email protected]>
1 parent 64abfac commit c43f938

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/fuel_gauge/composite/fuel_gauge_composite.c

+6
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ static int composite_get_prop(const struct device *dev, fuel_gauge_prop_t prop,
128128
rc = composite_channel_get(dev, sensor_chan, &sensor_val);
129129
val->current = sensor_value_to_micro(&sensor_val);
130130
break;
131+
case FUEL_GAUGE_TEMPERATURE:
132+
sensor_chan = config->fg_channels ? SENSOR_CHAN_GAUGE_TEMP : SENSOR_CHAN_DIE_TEMP;
133+
rc = composite_channel_get(dev, sensor_chan, &sensor_val);
134+
/* Output unit = 0.1K (10x increase + 273.0) */
135+
val->temperature = sensor_value_to_deci(&sensor_val) + 2730;
136+
break;
131137
default:
132138
return -ENOTSUP;
133139
}

0 commit comments

Comments
 (0)