Skip to content

Commit cb99cd7

Browse files
soburiaescolar
authored andcommitted
tests: drivers: build_all: fuel_gauge: Add devices to build test
Add build tests for the following devices. - maxim,max17048 - ti,bq27z746 - sbs,sbs-gauge-new-api - zephyr,fuel-gauge-composite Signed-off-by: TOKITA Hiroshi <[email protected]>
1 parent 20d17cf commit cb99cd7

File tree

6 files changed

+132
-0
lines changed

6 files changed

+132
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 TOKITA Hiroshi
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
cmake_minimum_required(VERSION 3.20.0)
5+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6+
project(build_all)
7+
8+
target_sources(app PRIVATE src/main.c)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright (c) 2024 TOKITA Hiroshi
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <zephyr/dt-bindings/i2c/i2c.h>
7+
8+
/ {
9+
test {
10+
#address-cells = <1>;
11+
#size-cells = <1>;
12+
13+
test_gpio: gpio@deadbeef {
14+
compatible = "vnd,gpio";
15+
gpio-controller;
16+
reg = <0xdeadbeef 0x1000>;
17+
#gpio-cells = <0x2>;
18+
status = "okay";
19+
};
20+
21+
test_i2c: i2c@11112222 {
22+
#address-cells = <1>;
23+
#size-cells = <0>;
24+
compatible = "vnd,i2c";
25+
reg = <0x11112222 0x1000>;
26+
status = "okay";
27+
clock-frequency = <I2C_BITRATE_STANDARD>;
28+
29+
#include "i2c.dtsi"
30+
};
31+
32+
test_adc: adc@adc0adc0 {
33+
compatible = "vnd,adc";
34+
reg = <0xadc0adc0 0x1000>;
35+
#io-channel-cells = <1>;
36+
#address-cells = <1>;
37+
#size-cells = <0>;
38+
status = "okay";
39+
40+
channel@0 {
41+
reg = <0>;
42+
zephyr,gain = "ADC_GAIN_1";
43+
zephyr,reference = "ADC_REF_VDD_1";
44+
zephyr,acquisition-time = <0>;
45+
};
46+
};
47+
48+
test_vbatt: vbatt {
49+
compatible = "voltage-divider";
50+
io-channels = <&test_adc 0>;
51+
output-ohms = <180000>;
52+
full-ohms = <(1500000 + 180000)>;
53+
power-gpios = <&gpio0 16 0>;
54+
};
55+
56+
test_fuel_gauge: fuel_gauge {
57+
compatible = "zephyr,fuel-gauge-composite";
58+
status = "okay";
59+
battery-voltage = <&test_vbatt>;
60+
device-chemistry = "lithium-ion-polymer";
61+
ocv-capacity-table-0 = <0>;
62+
charge-full-design-microamp-hours = <1350000>;
63+
};
64+
};
65+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2024 TOKITA Hiroshi
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/****************************************
7+
* PLEASE KEEP REG ADDRESSES SEQUENTIAL *
8+
***************************************/
9+
10+
max17048@0 {
11+
compatible = "maxim,max17048";
12+
reg = <0x0>;
13+
status = "okay";
14+
};
15+
16+
bq27z746@1 {
17+
compatible = "ti,bq27z746";
18+
reg = <0x1>;
19+
status = "okay";
20+
};
21+
22+
sbs-gauge-new-api@2 {
23+
compatible = "sbs,sbs-gauge-new-api";
24+
reg = <0x2>;
25+
status = "okay";
26+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_FUEL_GAUGE=y
2+
CONFIG_SENSOR=y
3+
CONFIG_GPIO=y
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 TOKITA Hiroshi
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
int main(void)
7+
{
8+
return 0;
9+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2024 TOKITA hiroshi
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
tests:
5+
drivers.fuel_gauge.build:
6+
tags:
7+
- drivers
8+
- fuel_gauge
9+
build_only: true
10+
platform_allow:
11+
- native_sim
12+
13+
drivers.fuel_gauge.emul.build:
14+
tags:
15+
- drivers
16+
- fuel_gauge
17+
build_only: true
18+
platform_allow:
19+
- native_sim
20+
extra_configs:
21+
- CONFIG_EMUL=y

0 commit comments

Comments
 (0)