Skip to content

Commit 7569d0a

Browse files
committed
drivers: fuelgauge: Add Onsemi LC709203F driver
Replace IC specific fuelgauge example with a generic fuelgauge example Signed-off-by: Philipp Steiner <[email protected]>
1 parent 2a4c054 commit 7569d0a

21 files changed

+143
-141
lines changed

boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
aliases {
2121
backlight = &led1;
22+
fuel-gauge0 = &max17048;
2223
};
2324

2425
leds {

boards/adafruit/feather_esp32s3/adafruit_feather_esp32s3_procpu.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
sw0 = &button0;
3939
led0 = &led0;
4040
led-strip = &led_strip;
41+
fuel-gauge0 = &max17048;
4142
};
4243

4344
buttons {

boards/adafruit/feather_esp32s3_tft/adafruit_feather_esp32s3_tft_procpu.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
aliases {
2323
i2c-0 = &i2c0;
2424
watchdog0 = &wdt0;
25+
fuel-gauge0 = &max17048;
2526
};
2627

2728
chosen {
File renamed without changes.

samples/fuel_gauge/README.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.. zephyr:code-sample:: fuel_gauge
2+
:name: Fuel Gauge
3+
4+
Read battery percentage and power status using MAX17048 fuel gauge.
5+
6+
Overview
7+
********
8+
9+
This sample shows how to use the Zephyr :ref:`fuel_gauge_api` API driver for.
10+
11+
The sample periodically reads battery percentage and voltage.
12+
13+
Building and Running
14+
********************
15+
16+
The sample can be configured to support a fuel gauge.
17+
18+
Features
19+
********
20+
By using this fuel gauge you can get the following information:
21+
* Battery charge status as percentage
22+
* Battery voltage
23+
24+
Sample output
25+
*************
26+
27+
```
28+
*** Booting Zephyr OS build 95f75fc5596b ***
29+
[00:00:00.116,000] <inf> app: Found device "lc709203f@0b", getting fuel gauge data
30+
[00:00:00.124,000] <inf> app: Fuel gauge data: Charge: 98%, Voltage: 4159mV
31+
[00:00:05.125,000] <inf> app: Fuel gauge data: Charge: 98%, Voltage: 4162mV
32+
```

samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_C.conf renamed to samples/fuel_gauge/boards/adafruit_feather_esp32s2.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ CONFIG_POWER_DOMAIN=y
22
CONFIG_GPIO=y
33
CONFIG_PM_DEVICE=y
44
CONFIG_PM_DEVICE_POWER_DOMAIN=y
5+
CONFIG_CRC=y
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/ {
2+
aliases {
3+
fuel-gauge0 = &lc709203f;
4+
};
5+
};
6+
7+
&i2c0 {
8+
lc709203f: lc709203f@0b {
9+
compatible = "onnn,lc709203f";
10+
status = "okay";
11+
reg = <0x0b>;
12+
power-domains = <&i2c_reg>;
13+
apa = "500mAh";
14+
battery-profile = <0x01>;
15+
};
16+
};

samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft.overlay renamed to samples/fuel_gauge/boards/adafruit_feather_esp32s2_max17048.overlay

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/ {
2+
aliases {
3+
fuel-gauge0 = &max17048;
4+
};
5+
};
6+
17
&i2c0 {
28
max17048: max17048@36 {
39
compatible = "maxim,max17048";

samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft.conf renamed to samples/fuel_gauge/boards/adafruit_feather_esp32s2_tft.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ CONFIG_POWER_DOMAIN=y
22
CONFIG_GPIO=y
33
CONFIG_PM_DEVICE=y
44
CONFIG_PM_DEVICE_POWER_DOMAIN=y
5+
CONFIG_CRC=y

samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft_reverse.conf renamed to samples/fuel_gauge/boards/adafruit_feather_esp32s2_tft_reverse.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ CONFIG_POWER_DOMAIN=y
22
CONFIG_GPIO=y
33
CONFIG_PM_DEVICE=y
44
CONFIG_PM_DEVICE_POWER_DOMAIN=y
5+
CONFIG_CRC=y

0 commit comments

Comments
 (0)