zephyr/samples/fuel_gauge/max17048
Aaron Massey 12cbfcf397 fuel_gauge: Repl property struct w/ union
Based on review of the similar charger driver API, it's been demonstrated
from the community that embedding a per value property type when fetching
properties. Separating off the property types from the property values
themselves also allow an array of property types to declared as static
const.

Break up fuel_gauge_property struct into a fuel_gauge_prop_val union and a
fuel_gauge_prop_t property type as inputs into fuel gauge API functions.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-27 12:07:59 +02:00
..
boards
src fuel_gauge: Repl property struct w/ union 2023-09-27 12:07:59 +02:00
CMakeLists.txt
README.rst
prj.conf
sample.yaml

README.rst

.. _MAX17048_sample:

MAX17048 Li-Ion battery fuel gauge
###################################

Overview
********

This sample shows how to use the Zephyr :ref:`fuel_gauge_api` API driver for the `MAX17048` fuel gauge.

.. _MAX17048: https://www.maximintegrated.com/en/products/power/battery-management/MAX17048.html

The sample periodically reads battery percentage and power status

Building and Running
********************

The sample can be configured to support MAX17048 fuel gauge connected via either I2C. It only needs
an I2C pin configuration

Features
********
By using this fuel gauge you can get the following information:
  * Battery charge status as percentage
  * Total time until battery is fully charged or discharged
  * Battery voltage
  * Charging state: if charging or discharging


Notes
*****
The charging state and the time to full/empty are estimated and based on the last consumption average. That means that
if you plug/unplug a charger it will take some time until it is actually detected by the chip. Don't try to plug/unplug
to see in real time the charging status change because it will not work. If you really need to know exactly the moment
when the battery is being charged you will need other method.

Sample output
*************

```
*** Booting Zephyr OS build 16043f62a40a ***
Found device "max17048@36", getting fuel gauge data
Time to empty 1911
Time to full 0
Charge 72%
Voltage 3968
Time to empty 1911
Time to full 0
Charge 72%
Voltage 3968
```