2022-11-18 13:59:37 -07:00
|
|
|
.. _fuel_gauge_api:
|
|
|
|
|
2023-03-30 09:47:14 +02:00
|
|
|
Fuel Gauge
|
|
|
|
##########
|
2022-11-18 13:59:37 -07:00
|
|
|
|
2025-06-04 12:00:40 +02:00
|
|
|
The fuel gauge subsystem exposes an API to uniformly access battery fuel gauge devices.
|
2022-11-18 13:59:37 -07:00
|
|
|
|
|
|
|
Basic Operation
|
|
|
|
***************
|
|
|
|
|
|
|
|
Properties
|
|
|
|
==========
|
|
|
|
|
|
|
|
Fundamentally, a property is a quantity that a fuel gauge device can measure.
|
|
|
|
|
|
|
|
Fuel gauges typically support multiple properties, such as temperature readings of the battery-pack
|
|
|
|
or present-time current/voltage.
|
|
|
|
|
2023-09-22 12:17:27 -06:00
|
|
|
Properties are fetched by the client one at a time using :c:func:`fuel_gauge_get_prop`, or fetched
|
2025-06-04 12:00:40 +02:00
|
|
|
in a batch using :c:func:`fuel_gauge_get_props`. Buffer properties, e.g. device name, are fetched by
|
|
|
|
using :c:func:`fuel_gauge_get_buffer_prop`.
|
2023-09-22 12:17:27 -06:00
|
|
|
|
|
|
|
Properties are set by the client one at a time using :c:func:`fuel_gauge_set_prop`, or set in a
|
|
|
|
batch using :c:func:`fuel_gauge_set_props`.
|
2022-11-18 13:59:37 -07:00
|
|
|
|
2023-08-16 14:39:38 -06:00
|
|
|
Battery Cutoff
|
|
|
|
==============
|
|
|
|
|
|
|
|
Many fuel gauges embedded within battery packs expose a register address that when written to with a
|
|
|
|
specific payload will do a battery cutoff. This battery cutoff is often referred to as ship, shelf,
|
|
|
|
or sleep mode due to its utility in reducing battery drain while devices are stored or shipped.
|
|
|
|
|
|
|
|
The fuel gauge API exposes battery cutoff with the :c:func:`fuel_gauge_battery_cutoff` function.
|
|
|
|
|
2022-11-18 13:59:37 -07:00
|
|
|
Caching
|
|
|
|
=======
|
|
|
|
|
|
|
|
The Fuel Gauge API explicitly provides no caching for its clients.
|
|
|
|
|
|
|
|
|
|
|
|
.. _fuel_gauge_api_reference:
|
|
|
|
|
|
|
|
API Reference
|
|
|
|
*************
|
|
|
|
|
|
|
|
.. doxygengroup:: fuel_gauge_interface
|
2023-05-26 14:25:59 -06:00
|
|
|
.. doxygengroup:: fuel_gauge_emulator_backend
|