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 <tokita.hiroshi@gmail.com>
This commit is contained in:
parent
20d17cfa6a
commit
cb99cd795d
6 changed files with 132 additions and 0 deletions
8
tests/drivers/build_all/fuel_gauge/CMakeLists.txt
Normal file
8
tests/drivers/build_all/fuel_gauge/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Copyright (c) 2024 TOKITA Hiroshi
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.20.0)
|
||||||
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||||
|
project(build_all)
|
||||||
|
|
||||||
|
target_sources(app PRIVATE src/main.c)
|
65
tests/drivers/build_all/fuel_gauge/app.overlay
Normal file
65
tests/drivers/build_all/fuel_gauge/app.overlay
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 TOKITA Hiroshi
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr/dt-bindings/i2c/i2c.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
test {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
test_gpio: gpio@deadbeef {
|
||||||
|
compatible = "vnd,gpio";
|
||||||
|
gpio-controller;
|
||||||
|
reg = <0xdeadbeef 0x1000>;
|
||||||
|
#gpio-cells = <0x2>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
test_i2c: i2c@11112222 {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
compatible = "vnd,i2c";
|
||||||
|
reg = <0x11112222 0x1000>;
|
||||||
|
status = "okay";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
|
|
||||||
|
#include "i2c.dtsi"
|
||||||
|
};
|
||||||
|
|
||||||
|
test_adc: adc@adc0adc0 {
|
||||||
|
compatible = "vnd,adc";
|
||||||
|
reg = <0xadc0adc0 0x1000>;
|
||||||
|
#io-channel-cells = <1>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
channel@0 {
|
||||||
|
reg = <0>;
|
||||||
|
zephyr,gain = "ADC_GAIN_1";
|
||||||
|
zephyr,reference = "ADC_REF_VDD_1";
|
||||||
|
zephyr,acquisition-time = <0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
test_vbatt: vbatt {
|
||||||
|
compatible = "voltage-divider";
|
||||||
|
io-channels = <&test_adc 0>;
|
||||||
|
output-ohms = <180000>;
|
||||||
|
full-ohms = <(1500000 + 180000)>;
|
||||||
|
power-gpios = <&gpio0 16 0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
test_fuel_gauge: fuel_gauge {
|
||||||
|
compatible = "zephyr,fuel-gauge-composite";
|
||||||
|
status = "okay";
|
||||||
|
battery-voltage = <&test_vbatt>;
|
||||||
|
device-chemistry = "lithium-ion-polymer";
|
||||||
|
ocv-capacity-table-0 = <0>;
|
||||||
|
charge-full-design-microamp-hours = <1350000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
26
tests/drivers/build_all/fuel_gauge/i2c.dtsi
Normal file
26
tests/drivers/build_all/fuel_gauge/i2c.dtsi
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 TOKITA Hiroshi
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/****************************************
|
||||||
|
* PLEASE KEEP REG ADDRESSES SEQUENTIAL *
|
||||||
|
***************************************/
|
||||||
|
|
||||||
|
max17048@0 {
|
||||||
|
compatible = "maxim,max17048";
|
||||||
|
reg = <0x0>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
bq27z746@1 {
|
||||||
|
compatible = "ti,bq27z746";
|
||||||
|
reg = <0x1>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
sbs-gauge-new-api@2 {
|
||||||
|
compatible = "sbs,sbs-gauge-new-api";
|
||||||
|
reg = <0x2>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
3
tests/drivers/build_all/fuel_gauge/prj.conf
Normal file
3
tests/drivers/build_all/fuel_gauge/prj.conf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
CONFIG_FUEL_GAUGE=y
|
||||||
|
CONFIG_SENSOR=y
|
||||||
|
CONFIG_GPIO=y
|
9
tests/drivers/build_all/fuel_gauge/src/main.c
Normal file
9
tests/drivers/build_all/fuel_gauge/src/main.c
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 TOKITA Hiroshi
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
21
tests/drivers/build_all/fuel_gauge/testcase.yaml
Normal file
21
tests/drivers/build_all/fuel_gauge/testcase.yaml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Copyright (c) 2024 TOKITA hiroshi
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
tests:
|
||||||
|
drivers.fuel_gauge.build:
|
||||||
|
tags:
|
||||||
|
- drivers
|
||||||
|
- fuel_gauge
|
||||||
|
build_only: true
|
||||||
|
platform_allow:
|
||||||
|
- native_sim
|
||||||
|
|
||||||
|
drivers.fuel_gauge.emul.build:
|
||||||
|
tags:
|
||||||
|
- drivers
|
||||||
|
- fuel_gauge
|
||||||
|
build_only: true
|
||||||
|
platform_allow:
|
||||||
|
- native_sim
|
||||||
|
extra_configs:
|
||||||
|
- CONFIG_EMUL=y
|
Loading…
Add table
Add a link
Reference in a new issue