drivers: sensors: sbs-gauge: add CHAN_ALL to fetch
Add the SENSORS_CHAN_ALL to the fetch function. Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
This commit is contained in:
parent
c79b1a38aa
commit
1c792fb0b5
1 changed files with 24 additions and 0 deletions
|
@ -108,6 +108,20 @@ static int sbs_gauge_channel_get(const struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const uint16_t all_channels[] = {
|
||||
SENSOR_CHAN_GAUGE_VOLTAGE,
|
||||
SENSOR_CHAN_GAUGE_AVG_CURRENT,
|
||||
SENSOR_CHAN_GAUGE_TEMP,
|
||||
SENSOR_CHAN_GAUGE_STATE_OF_CHARGE,
|
||||
SENSOR_CHAN_GAUGE_FULL_CHARGE_CAPACITY,
|
||||
SENSOR_CHAN_GAUGE_REMAINING_CHARGE_CAPACITY,
|
||||
SENSOR_CHAN_GAUGE_NOM_AVAIL_CAPACITY,
|
||||
SENSOR_CHAN_GAUGE_FULL_AVAIL_CAPACITY,
|
||||
SENSOR_CHAN_GAUGE_TIME_TO_EMPTY,
|
||||
SENSOR_CHAN_GAUGE_TIME_TO_FULL,
|
||||
SENSOR_CHAN_GAUGE_CYCLE_COUNT
|
||||
};
|
||||
|
||||
static int sbs_gauge_sample_fetch(const struct device *dev,
|
||||
enum sensor_channel chan)
|
||||
{
|
||||
|
@ -222,6 +236,16 @@ static int sbs_gauge_sample_fetch(const struct device *dev,
|
|||
}
|
||||
break;
|
||||
|
||||
case SENSOR_CHAN_ALL:
|
||||
for (int i = 0; i < ARRAY_SIZE(all_channels); i++) {
|
||||
status = sbs_gauge_sample_fetch(dev, all_channels[i]);
|
||||
if (status != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue