From 486ccec75a65d6bd72abbdd1989915d3c7113c04 Mon Sep 17 00:00:00 2001 From: Sergei Ovchinnikov Date: Thu, 24 Jul 2025 11:22:09 +0200 Subject: [PATCH] samples: pmic: update npm1300_fuel_gauge sample to support nPM1304 Added possibility to choose the nPM1300 or the nPM1304 EK shield to build for. Adapted code and DTS overlays to accomodate both PMICs. Signed-off-by: Sergei Ovchinnikov --- doc/_utils/redirects.py | 1 + .../app_dev/device_guides/pmic/npm1300.rst | 2 +- doc/nrf/links.txt | 2 + .../releases/release-notes-2.4.0.rst | 4 +- .../releases/release-notes-2.6.0.rst | 2 +- .../releases/release-notes-2.8.0-preview1.rst | 2 +- .../releases/release-notes-2.8.0.rst | 2 +- .../releases/release-notes-3.0.0-preview1.rst | 2 +- .../releases/release-notes-3.0.0-preview2.rst | 2 +- .../releases/release-notes-3.0.0.rst | 2 +- .../releases/release-notes-3.1.0.rst | 2 +- .../CMakeLists.txt | 4 +- .../README.rst | 74 +++++++++++++------ .../nrf54h20dk_nrf54h20_cpuapp.overlay | 4 +- .../nrf54l15dk_nrf54l15_cpuapp.overlay | 0 .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 0 .../boards/nrf52840dk_nrf52840.overlay | 5 -- .../boards/nrf52dk_nrf52832.overlay | 5 -- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 5 -- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 7 -- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 5 -- .../nrf54lm20dk_nrf54lm20a_cpuapp.overlay | 5 -- .../boards/nrf9160dk_nrf9160.overlay | 5 -- .../native/npm13xx_fuel_gauge/npm1300.overlay | 10 +++ .../native/npm13xx_fuel_gauge/npm1304.overlay | 10 +++ .../prj.conf | 0 .../sample.yaml | 25 +++---- .../src/CMakeLists.txt | 0 .../src/battery_model.inc | 0 .../src/battery_model_20mAh.inc | 19 +++++ .../src/fuel_gauge.c | 26 ++++--- .../src/fuel_gauge.h | 0 .../src/main.c | 14 +++- scripts/quarantine_integration.yaml | 3 +- 34 files changed, 146 insertions(+), 103 deletions(-) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/CMakeLists.txt (83%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/README.rst (55%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/boards/extensions/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.overlay (89%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/boards/extensions/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.overlay (100%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/boards/extensions/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.overlay (100%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/boards/nrf52840dk_nrf52840.overlay (67%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/boards/nrf52dk_nrf52832.overlay (67%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/boards/nrf5340dk_nrf5340_cpuapp.overlay (67%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/boards/nrf54h20dk_nrf54h20_cpuapp.overlay (65%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/boards/nrf54l15dk_nrf54l15_cpuapp.overlay (71%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay (71%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/boards/nrf9160dk_nrf9160.overlay (67%) create mode 100644 samples/pmic/native/npm13xx_fuel_gauge/npm1300.overlay create mode 100644 samples/pmic/native/npm13xx_fuel_gauge/npm1304.overlay rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/prj.conf (100%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/sample.yaml (67%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/src/CMakeLists.txt (100%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/src/battery_model.inc (100%) create mode 100644 samples/pmic/native/npm13xx_fuel_gauge/src/battery_model_20mAh.inc rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/src/fuel_gauge.c (86%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/src/fuel_gauge.h (100%) rename samples/pmic/native/{npm1300_fuel_gauge => npm13xx_fuel_gauge}/src/main.c (79%) diff --git a/doc/_utils/redirects.py b/doc/_utils/redirects.py index 7f37f5299a77..0c874c58aa55 100644 --- a/doc/_utils/redirects.py +++ b/doc/_utils/redirects.py @@ -441,6 +441,7 @@ ("samples/wifi/sr_coex/README", "samples/wifi/ble_coex/README"), # Wi-Fi: Bluetooth LE coexistence ("samples/samples_zigbee", "samples/zigbee"), # Zigbee samples (landing) ("samples/samples_other", "samples/other"), # Other samples (landing) + ("samples/pmic/native/npm1300_fuel_gauge/README", "samples/pmic/native/npm13xx_fuel_gauge/README"), ("libraries/bluetooth_services/index", "libraries/bluetooth/index"), # Changed the folder name libraries/bluetooth_services to libraries/bluetooth to better match the include folder structure ("libraries/bluetooth_services/adv_prov", "libraries/bluetooth/adv_prov"), ("libraries/bluetooth_services/conn_ctx", "libraries/bluetooth/conn_ctx"), diff --git a/doc/nrf/app_dev/device_guides/pmic/npm1300.rst b/doc/nrf/app_dev/device_guides/pmic/npm1300.rst index f314b203892c..c61a090263a0 100644 --- a/doc/nrf/app_dev/device_guides/pmic/npm1300.rst +++ b/doc/nrf/app_dev/device_guides/pmic/npm1300.rst @@ -122,7 +122,7 @@ Connecting the development kit to nPM1300 ========================================= If you are using the nRF5340 DK, follow the steps in `Use the nPM1300 EK with an nRF5340 DK`_ in the `nPM1300 EK User Guide`_. -For other Nordic Semiconductor kits, use the wiring steps in the documentation for :ref:`pmic_samples` as reference (:ref:`wiring for the Fuel gauge sample ` and :ref:`wiring for the One button sample `, respectively). +For other Nordic Semiconductor kits, use the wiring steps in the documentation for :ref:`pmic_samples` as reference (:ref:`wiring for the Fuel gauge sample ` and :ref:`wiring for the One button sample `, respectively). If you are using custom hardware, the wiring process is similar to the `one for the nRF5340 DK `_, but board-specific steps will be different. diff --git a/doc/nrf/links.txt b/doc/nrf/links.txt index 53d1036dd014..bc048c190dd3 100644 --- a/doc/nrf/links.txt +++ b/doc/nrf/links.txt @@ -350,6 +350,8 @@ .. _`nPM1300 EK product page`: https://www.nordicsemi.com/Products/Development-hardware/nPM1300-EK .. _`nPM1300 EK get started`: https://www.nordicsemi.com/Products/Development-hardware/nPM1300-EK/Get-started?lang=en#infotabs +.. _`nPM1304 product website`: https://www.nordicsemi.com/products/npm1304 + .. _`nPM2100 product website`: https://www.nordicsemi.com/Products/nPM2100 .. _`nRF Desktop reference design page`: https://www.nordicsemi.com/Products/Reference-designs/nRF-Desktop .. _`Nordic Semiconductor's IoT cloud platform`: https://www.nordicsemi.com/Products/Cloud-services diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-2.4.0.rst b/doc/nrf/releases_and_maturity/releases/release-notes-2.4.0.rst index 6be54211d91f..6a655d4395e0 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-2.4.0.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-2.4.0.rst @@ -56,7 +56,7 @@ The following list includes the summary of the most relevant changes introduced * PMIC: nPM1300 PMIC and nPM1300 EK: * Charger, BUCKs, LDOs, Load Switches, and GPIOs. - * :ref:`Sample showing fuel gauge functionality `. + * :ref:`Sample showing fuel gauge functionality `. The sample calculates battery state of charge, time to empty, time to full and provides updates of these over the terminal once every second. * The nPM1300 EK sample that supports PMIC features: regulators (BUCKs, LDO) and GPIOs. @@ -622,7 +622,7 @@ nRF9160 samples PMIC samples ------------ -* Added :ref:`npm1300_fuel_gauge` sample that demonstrates how to calculate the battery state of charge using the :ref:`nrfxlib:nrf_fuel_gauge`. +* Added the :ref:`nPM1300: Fuel gauge ` sample that demonstrates how to calculate the battery state of charge using the :ref:`nrfxlib:nrf_fuel_gauge`. Trusted Firmware-M (TF-M) samples --------------------------------- diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst b/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst index 6bec5144afd8..fb8ebeb00e2d 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst @@ -928,7 +928,7 @@ PMIC samples * Added :ref:`npm1300_one_button` sample that demonstrates how to support wake-up, shutdown, and user interactions through a single button connected to the nPM1300. -* :ref:`npm1300_fuel_gauge` sample: +* :ref:`nPM1300: Fuel gauge ` sample: * Updated to accommodate API changes in the :ref:`nrfxlib:nrf_fuel_gauge`. diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-2.8.0-preview1.rst b/doc/nrf/releases_and_maturity/releases/release-notes-2.8.0-preview1.rst index 6a9dd5c9bbff..993ea04ed73e 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-2.8.0-preview1.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-2.8.0-preview1.rst @@ -688,7 +688,7 @@ PMIC samples * Added support for the :zephyr:board:`nrf54l15dk` and :zephyr:board:`nrf54h20dk` to the PMIC samples. -* :ref:`npm1300_fuel_gauge` sample: +* :ref:`nPM1300: Fuel gauge ` sample: * Updated to accommodate API changes in nRF Fuel Gauge library v0.11.1. diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-2.8.0.rst b/doc/nrf/releases_and_maturity/releases/release-notes-2.8.0.rst index 744b3f8f42f3..e9b9f127c510 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-2.8.0.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-2.8.0.rst @@ -933,7 +933,7 @@ PMIC samples * Added support for the :zephyr:board:`nrf54l15dk` and :zephyr:board:`nrf54h20dk` to the PMIC samples. -* :ref:`npm1300_fuel_gauge` sample: +* :ref:`nPM1300: Fuel gauge ` sample: * Updated to accommodate API changes in nRF Fuel Gauge library v0.11.1. diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0-preview1.rst b/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0-preview1.rst index 477c37602e61..3e11d79a85a2 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0-preview1.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0-preview1.rst @@ -496,7 +496,7 @@ Peripheral samples PMIC samples ------------ -* :ref:`npm1300_fuel_gauge` sample: +* :ref:`nPM1300: Fuel gauge ` sample: * Updated to accommodate API changes in nRF Fuel Gauge library v1.0.0. diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0-preview2.rst b/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0-preview2.rst index 30d9145d7838..ecc8d297d717 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0-preview2.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0-preview2.rst @@ -650,7 +650,7 @@ PMIC samples * The :ref:`npm2100_one_button` sample that demonstrates how to support wake-up, shutdown, and user interactions through a single button connected to the nPM2100 PMIC. * The :ref:`npm2100_fuel_gauge` sample that demonstrates how to calculate the battery state of charge of primary cell batteries using the :ref:`nrfxlib:nrf_fuel_gauge`. -* :ref:`npm1300_fuel_gauge` sample: +* :ref:`nPM1300: Fuel gauge ` sample: * Updated to accommodate API changes in nRF Fuel Gauge library v1.0.0. diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0.rst b/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0.rst index 1a0682f7428d..28c390a8f46b 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-3.0.0.rst @@ -903,7 +903,7 @@ PMIC samples * The :ref:`npm2100_one_button` sample that demonstrates how to support wake-up, shutdown, and user interactions through a single button connected to the nPM2100 PMIC. * The :ref:`npm2100_fuel_gauge` sample that demonstrates how to calculate the battery state of charge of primary cell batteries using the :ref:`nrfxlib:nrf_fuel_gauge`. -* :ref:`npm1300_fuel_gauge` sample: +* :ref:`nPM1300: Fuel gauge ` sample: * Updated to accommodate API changes in nRF Fuel Gauge library v1.0.0. diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-3.1.0.rst b/doc/nrf/releases_and_maturity/releases/release-notes-3.1.0.rst index 9675c7ae943a..70f648600457 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-3.1.0.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-3.1.0.rst @@ -769,7 +769,7 @@ Peripheral samples PMIC samples ------------ -* :ref:`npm1300_fuel_gauge` sample: +* :ref:`nPM1300: Fuel gauge ` sample: * Updated current sign when calling the ``nrf_fuel_gauge`` lib functions. In the Zephyr sensor API the convention for the gauge current is ``negative=discharging``, while the :ref:`nrfxlib:nrf_fuel_gauge` lib uses the opposite. diff --git a/samples/pmic/native/npm1300_fuel_gauge/CMakeLists.txt b/samples/pmic/native/npm13xx_fuel_gauge/CMakeLists.txt similarity index 83% rename from samples/pmic/native/npm1300_fuel_gauge/CMakeLists.txt rename to samples/pmic/native/npm13xx_fuel_gauge/CMakeLists.txt index 21a69a349848..7f4fa2db1156 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/CMakeLists.txt +++ b/samples/pmic/native/npm13xx_fuel_gauge/CMakeLists.txt @@ -5,10 +5,8 @@ cmake_minimum_required(VERSION 3.20.0) list(APPEND BOARD_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) -set(SHIELD npm1300_ek) - find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(npm1300_fuel_gauge) +project(npm13xx_fuel_gauge) add_subdirectory(src) diff --git a/samples/pmic/native/npm1300_fuel_gauge/README.rst b/samples/pmic/native/npm13xx_fuel_gauge/README.rst similarity index 55% rename from samples/pmic/native/npm1300_fuel_gauge/README.rst rename to samples/pmic/native/npm13xx_fuel_gauge/README.rst index a53124e4d365..7001f528a36a 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/README.rst +++ b/samples/pmic/native/npm13xx_fuel_gauge/README.rst @@ -1,15 +1,15 @@ -.. _npm1300_fuel_gauge: +.. _npm13xx_fuel_gauge: -nPM1300: Fuel gauge -################### +nPM1300 and nPM1304: Fuel gauge +############################### .. contents:: :local: :depth: 2 -The Fuel gauge sample demonstrates how to calculate the state of charge of a development kit battery using `nPM1300 `_ and the :ref:`nrfxlib:nrf_fuel_gauge`. +The Fuel gauge sample demonstrates how to calculate the state of charge of a development kit battery using `nPM1300 `_ or `nPM1304 `_ and the :ref:`nrfxlib:nrf_fuel_gauge`. -For more information about fuel gauging with the nPM1300, see `Using the nPM1300 Fuel Gauge`_. +For more information about fuel gauging with the nPM1300 or nPM1304, see `Using the nPM1300 Fuel Gauge`_. Requirements ************ @@ -18,27 +18,27 @@ The sample supports the following development kits: .. table-from-sample-yaml:: -The sample also requires an `nPM1300 EK `_ that you need to connect to the development kit as described in `Wiring`_. +The sample also requires an `nPM1300 EK `_ or nPM1304 EK that you need to connect to the development kit as described in `Wiring`_. Overview ******** -This sample allows to calculate the state of charge, time to empty, and time to full information from a battery on the development kit connected to the nPM1300 PMIC. +This sample allows to calculate the state of charge, time to empty, and time to full information from a battery on the development kit connected to the nPM1300 or nPM1304 PMIC. -.. _npm1300_fuel_gauge_wiring: +.. _npm13xx_fuel_gauge_wiring: Wiring ****** -To connect your DK to the nPM1300 EK, complete the following steps: +To connect your DK to the nPM1300 or nPM1304 EK, complete the following steps: -#. Connect the TWI interface between the chosen DK and the nPM1300 EK as in the following table: +#. Connect the TWI interface between the chosen DK and the nPM1300 or nPM1304 EK as in the following table: - .. list-table:: nPM1300 EK connections. + .. list-table:: nPM1300/nPM1304 EK connections. :widths: auto :header-rows: 1 - * - nPM1300 EK pins + * - EK pins - nRF52 DK pins - nRF52840 DK pins - nRF5340 DK pins @@ -50,7 +50,7 @@ To connect your DK to the nPM1300 EK, complete the following steps: - P0.26 - P1.02 - P1.11 - - P0.04 + - P0.05 - P0.30 * - SCL - P0.27 @@ -60,12 +60,12 @@ To connect your DK to the nPM1300 EK, complete the following steps: - P0.00 - P0.31 * - GPIO3 - - P0.22 - - P1.12 - - P1.12 - - P1.10 - - P0.05 - - P0.10 + - P0.04 + - P0.04 + - P0.04 + - P0.04 + - P0.04 + - P0.04 * - VDDIO - VDD - VDD @@ -81,26 +81,52 @@ To connect your DK to the nPM1300 EK, complete the following steps: - GND - GND -#. Make the following connections on the nPM1300 EK: +#. Make the following connections on the nPM1300 or nPM1304 EK: * Remove all existing connections. - * Connect a USB power supply to the **J3** connector. + * Connect a USB power supply to the connector **J3** (on nPM1300) or **J4** (on nPM1304). * Connect a suitable battery to the **J2** connector. - * On the **P2** pin header, connect **VBAT** and **VBATIN** pins with a jumper. + * On the **P1** pin header, connect **VBAT** and **VBATIN** pins with a jumper. * On the **P17** pin header, connect all LEDs with jumpers. * On the **P13** pin header, connect **RSET1** and **VSET1** pins with a jumper. * On the **P14** pin header, connect **RSET2** and **VSET2** pins with a jumper. .. note:: - When using the :zephyr:board:`nrf54l15dk`, the nPM1300 **GPIO3** interrupt pin assignment uses the DK's **LED 1** pin. + When using the :zephyr:board:`nrf54l15dk`, the PMIC **GPIO3** interrupt pin assignment uses the DK's **BUTTON 3** pin. Building and running ******************** -.. |sample path| replace:: :file:`samples/pmic/native/npm1300_fuel_gauge` +.. |sample path| replace:: :file:`samples/pmic/native/npm13xx_fuel_gauge` .. include:: /includes/build_and_run.txt +To build this sample for either nPM1300 or nPM1304, you need to apply an appropriate build configuration. +The build configuration consist of choosing a Zephyr shield (``npm1300_ek`` or ``npm1304_ek``) and +applying an extra devicetree overlay file (``npm1300.overlay`` or ``npm1304.overlay``) +You can use either the nRF Connect for VS Code extension or the command line. + +.. tabs:: + + .. group-tab:: nRF Connect for VS Code + + To choose a shield, add an **Extra CMake argument** in your build configuration, for example: + + .. code-block:: bash + + -DSHIELD=npm1300_ek + + To apply an extra overlay, choose the respective file from the **Extra Devicetree overlays** drop-down menu + + .. group-tab:: Command line + + To apply the appropriate configuration, use the ``-T`` argument of the ``west build`` command. + For example, to build for an nRF54L15 DK and an nPM1300 EK use the following command: + + .. code-block:: bash + + west build -b nrf54l15dk/nrf54l15/cpuapp samples/pmic/native/npm13xx_fuel_gauge -T sample.npm1300_fuel_gauge_compile + Testing ******* diff --git a/samples/pmic/native/npm1300_fuel_gauge/boards/extensions/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/pmic/native/npm13xx_fuel_gauge/boards/extensions/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.overlay similarity index 89% rename from samples/pmic/native/npm1300_fuel_gauge/boards/extensions/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.overlay rename to samples/pmic/native/npm13xx_fuel_gauge/boards/extensions/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.overlay index 68b6b80af762..d0d7a0496981 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/boards/extensions/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/pmic/native/npm13xx_fuel_gauge/boards/extensions/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -7,14 +7,14 @@ &pinctrl { i2c130_default: i2c130_default { group1 { - psels = , + psels = , ; }; }; i2c130_sleep: i2c130_sleep { group1 { - psels = , + psels = , ; low-power-enable; }; diff --git a/samples/pmic/native/npm1300_fuel_gauge/boards/extensions/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.overlay b/samples/pmic/native/npm13xx_fuel_gauge/boards/extensions/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.overlay similarity index 100% rename from samples/pmic/native/npm1300_fuel_gauge/boards/extensions/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.overlay rename to samples/pmic/native/npm13xx_fuel_gauge/boards/extensions/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.overlay diff --git a/samples/pmic/native/npm1300_fuel_gauge/boards/extensions/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/pmic/native/npm13xx_fuel_gauge/boards/extensions/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.overlay similarity index 100% rename from samples/pmic/native/npm1300_fuel_gauge/boards/extensions/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.overlay rename to samples/pmic/native/npm13xx_fuel_gauge/boards/extensions/nrf54lm20dk/nrf54lm20dk_nrf54lm20a_cpuapp.overlay diff --git a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf52840dk_nrf52840.overlay b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf52840dk_nrf52840.overlay similarity index 67% rename from samples/pmic/native/npm1300_fuel_gauge/boards/nrf52840dk_nrf52840.overlay rename to samples/pmic/native/npm13xx_fuel_gauge/boards/nrf52840dk_nrf52840.overlay index 2dc7fe65e438..60b9b3d47b55 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf52840dk_nrf52840.overlay +++ b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf52840dk_nrf52840.overlay @@ -9,8 +9,3 @@ bias-pull-up; }; }; - -&npm1300_ek_pmic { - host-int-gpios = <&gpio1 12 0>; - pmic-int-pin = <3>; -}; diff --git a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf52dk_nrf52832.overlay b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf52dk_nrf52832.overlay similarity index 67% rename from samples/pmic/native/npm1300_fuel_gauge/boards/nrf52dk_nrf52832.overlay rename to samples/pmic/native/npm13xx_fuel_gauge/boards/nrf52dk_nrf52832.overlay index 568414aab186..60b9b3d47b55 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf52dk_nrf52832.overlay +++ b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf52dk_nrf52832.overlay @@ -9,8 +9,3 @@ bias-pull-up; }; }; - -&npm1300_ek_pmic { - host-int-gpios = <&gpio0 22 0>; - pmic-int-pin = <3>; -}; diff --git a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf5340dk_nrf5340_cpuapp.overlay similarity index 67% rename from samples/pmic/native/npm1300_fuel_gauge/boards/nrf5340dk_nrf5340_cpuapp.overlay rename to samples/pmic/native/npm13xx_fuel_gauge/boards/nrf5340dk_nrf5340_cpuapp.overlay index aa75bfc8aef5..fb6cd151aafe 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -9,8 +9,3 @@ bias-pull-up; }; }; - -&npm1300_ek_pmic { - host-int-gpios = <&gpio1 12 0>; - pmic-int-pin = <3>; -}; diff --git a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf54h20dk_nrf54h20_cpuapp.overlay similarity index 65% rename from samples/pmic/native/npm1300_fuel_gauge/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to samples/pmic/native/npm13xx_fuel_gauge/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index e3a4423d2f48..e8c428029474 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,8 +4,6 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ - #include - &i2c130_default { group1 { bias-pull-up; @@ -19,8 +17,3 @@ &gpio0 { status = "okay"; }; - -&npm1300_ek_pmic { - host-int-gpios = <&gpio0 5 0>; - pmic-int-pin = <3>; -}; diff --git a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf54l15dk_nrf54l15_cpuapp.overlay similarity index 71% rename from samples/pmic/native/npm1300_fuel_gauge/boards/nrf54l15dk_nrf54l15_cpuapp.overlay rename to samples/pmic/native/npm13xx_fuel_gauge/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index e7db754bc3db..40e33d53af6b 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -13,8 +13,3 @@ &i2c21 { status = "okay"; }; - -&npm1300_ek_pmic { - host-int-gpios = <&gpio1 10 0>; - pmic-int-pin = <3>; -}; diff --git a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay similarity index 71% rename from samples/pmic/native/npm1300_fuel_gauge/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay rename to samples/pmic/native/npm13xx_fuel_gauge/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index e837506671b6..4160d7eb8867 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -13,8 +13,3 @@ &i2c21 { status = "okay"; }; - -&npm1300_ek_pmic { - host-int-gpios = <&gpio1 10 0>; - pmic-int-pin = <3>; -}; diff --git a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf9160dk_nrf9160.overlay b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf9160dk_nrf9160.overlay similarity index 67% rename from samples/pmic/native/npm1300_fuel_gauge/boards/nrf9160dk_nrf9160.overlay rename to samples/pmic/native/npm13xx_fuel_gauge/boards/nrf9160dk_nrf9160.overlay index 712b425a3246..9edab9897d69 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/boards/nrf9160dk_nrf9160.overlay +++ b/samples/pmic/native/npm13xx_fuel_gauge/boards/nrf9160dk_nrf9160.overlay @@ -9,8 +9,3 @@ bias-pull-up; }; }; - -&npm1300_ek_pmic { - host-int-gpios = <&gpio0 10 0>; - pmic-int-pin = <3>; -}; diff --git a/samples/pmic/native/npm13xx_fuel_gauge/npm1300.overlay b/samples/pmic/native/npm13xx_fuel_gauge/npm1300.overlay new file mode 100644 index 000000000000..9cba28ae8bc2 --- /dev/null +++ b/samples/pmic/native/npm13xx_fuel_gauge/npm1300.overlay @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&npm1300_ek_pmic { + host-int-gpios = <&gpio0 4 0>; + pmic-int-pin = <3>; +}; diff --git a/samples/pmic/native/npm13xx_fuel_gauge/npm1304.overlay b/samples/pmic/native/npm13xx_fuel_gauge/npm1304.overlay new file mode 100644 index 000000000000..0cb6213f1c36 --- /dev/null +++ b/samples/pmic/native/npm13xx_fuel_gauge/npm1304.overlay @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&npm1304_ek_pmic { + host-int-gpios = <&gpio0 4 0>; + pmic-int-pin = <3>; +}; diff --git a/samples/pmic/native/npm1300_fuel_gauge/prj.conf b/samples/pmic/native/npm13xx_fuel_gauge/prj.conf similarity index 100% rename from samples/pmic/native/npm1300_fuel_gauge/prj.conf rename to samples/pmic/native/npm13xx_fuel_gauge/prj.conf diff --git a/samples/pmic/native/npm1300_fuel_gauge/sample.yaml b/samples/pmic/native/npm13xx_fuel_gauge/sample.yaml similarity index 67% rename from samples/pmic/native/npm1300_fuel_gauge/sample.yaml rename to samples/pmic/native/npm13xx_fuel_gauge/sample.yaml index 95a21450bdee..c162acf8b5a6 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/sample.yaml +++ b/samples/pmic/native/npm13xx_fuel_gauge/sample.yaml @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause sample: - name: nPM1300 fuel gauge + name: nPM13xx fuel gauge common: integration_platforms: @@ -23,19 +23,18 @@ common: tags: - pmic - ci_samples_pmic + - shield + - sysbuild tests: sample.npm1300_fuel_gauge_compile: sysbuild: true build_only: true - platform_allow: - - nrf52dk/nrf52832 - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54lm20dk/nrf54lm20a/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf9160dk/nrf9160 - tags: - - shield - - sysbuild - - ci_samples_pmic + extra_args: + - SHIELD=npm1300_ek + - EXTRA_DTC_OVERLAY_FILE=npm1300.overlay + sample.npm1304_fuel_gauge_compile: + sysbuild: true + build_only: true + extra_args: + - SHIELD=npm1304_ek + - EXTRA_DTC_OVERLAY_FILE=npm1304.overlay diff --git a/samples/pmic/native/npm1300_fuel_gauge/src/CMakeLists.txt b/samples/pmic/native/npm13xx_fuel_gauge/src/CMakeLists.txt similarity index 100% rename from samples/pmic/native/npm1300_fuel_gauge/src/CMakeLists.txt rename to samples/pmic/native/npm13xx_fuel_gauge/src/CMakeLists.txt diff --git a/samples/pmic/native/npm1300_fuel_gauge/src/battery_model.inc b/samples/pmic/native/npm13xx_fuel_gauge/src/battery_model.inc similarity index 100% rename from samples/pmic/native/npm1300_fuel_gauge/src/battery_model.inc rename to samples/pmic/native/npm13xx_fuel_gauge/src/battery_model.inc diff --git a/samples/pmic/native/npm13xx_fuel_gauge/src/battery_model_20mAh.inc b/samples/pmic/native/npm13xx_fuel_gauge/src/battery_model_20mAh.inc new file mode 100644 index 000000000000..2262988e0c55 --- /dev/null +++ b/samples/pmic/native/npm13xx_fuel_gauge/src/battery_model_20mAh.inc @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +.param_1 = {0.0, 0.005, 0.01, 0.015, 0.02, 0.025, 0.03, 0.035, 0.04, 0.045, 0.05, 0.055, 0.06, 0.065, 0.07, 0.075, 0.08, 0.085, 0.09, 0.095, 0.1, 0.105, 0.11, 0.115, 0.12, 0.125, 0.13, 0.135, 0.14, 0.145, 0.15, 0.155, 0.16, 0.165, 0.17, 0.17500000000000002, 0.18, 0.185, 0.19, 0.195, 0.2, 0.20500000000000002, 0.21, 0.215, 0.22, 0.225, 0.23, 0.23500000000000001, 0.24, 0.245, 0.25, 0.255, 0.26, 0.265, 0.27, 0.275, 0.28, 0.28500000000000003, 0.29, 0.295, 0.3, 0.305, 0.31, 0.315, 0.32, 0.325, 0.33, 0.335, 0.34, 0.34500000000000003, 0.35000000000000003, 0.355, 0.36, 0.365, 0.37, 0.375, 0.38, 0.385, 0.39, 0.395, 0.4, 0.405, 0.41000000000000003, 0.41500000000000004, 0.42, 0.425, 0.43, 0.435, 0.44, 0.445, 0.45, 0.455, 0.46, 0.465, 0.47000000000000003, 0.47500000000000003, 0.48, 0.485, 0.49, 0.495, 0.5, 0.505, 0.51, 0.515, 0.52, 0.525, 0.53, 0.535, 0.54, 0.545, 0.55, 0.555, 0.56, 0.5650000000000001, 0.5700000000000001, 0.5750000000000001, 0.58, 0.585, 0.59, 0.595, 0.6, 0.605, 0.61, 0.615, 0.62, 0.625, 0.63, 0.635, 0.64, 0.645, 0.65, 0.655, 0.66, 0.665, 0.67, 0.675, 0.68, 0.685, 0.6900000000000001, 0.6950000000000001, 0.7000000000000001, 0.705, 0.71, 0.715, 0.72, 0.725, 0.73, 0.735, 0.74, 0.745, 0.75, 0.755, 0.76, 0.765, 0.77, 0.775, 0.78, 0.785, 0.79, 0.795, 0.8, 0.805, 0.81, 0.8150000000000001, 0.8200000000000001, 0.8250000000000001, 0.8300000000000001, 0.835, 0.84, 0.845, 0.85, 0.855, 0.86, 0.865, 0.87, 0.875, 0.88, 0.885, 0.89, 0.895, 0.9, 0.905, 0.91, 0.915, 0.92, 0.925, 0.93, 0.935, 0.9400000000000001, 0.9450000000000001, 0.9500000000000001, 0.9550000000000001, 0.96, 0.965, 0.97, 0.975, 0.98, 0.985, 0.99, 0.995, 1.0}, +.temps = {25.0}, +.param_2 = {2.79, 2.8016528925619837, 2.813305785123967, 2.8249586776859505, 2.8366115702479338, 2.8482644628099174, 2.859917355371901, 2.8715702479338843, 2.883223140495868, 2.894876033057851, 2.906528925619835, 2.918181818181818, 2.9298347107438016, 2.9414876033057853, 2.9531404958677685, 2.964793388429752, 2.976446280991736, 2.988099173553719, 2.9997520661157027, 3.011404958677686, 3.0230578512396695, 3.0347107438016527, 3.0463636363636364, 3.05801652892562, 3.0696694214876032, 3.081322314049587, 3.0929752066115705, 3.1046280991735538, 3.1162809917355374, 3.1279338842975206, 3.1395867768595043, 3.1512396694214875, 3.162892561983471, 3.174545454545455, 3.186198347107438, 3.1978512396694216, 3.209504132231405, 3.2211570247933885, 3.2328099173553717, 3.2444628099173554, 3.256115702479339, 3.267768595041322, 3.279421487603306, 3.2910743801652895, 3.3027272727272727, 3.3143801652892564, 3.3260330578512396, 3.3376859504132232, 3.3493388429752065, 3.36099173553719, 3.3726446280991738, 3.384297520661157, 3.3959504132231406, 3.4076033057851243, 3.4192561983471075, 3.430909090909091, 3.4425619834710743, 3.454214876033058, 3.465867768595041, 3.477520661157025, 3.4891735537190085, 3.5008264462809917, 3.5124793388429754, 3.524132231404959, 3.5357851239669422, 3.5474380165289254, 3.559090909090909, 3.5707438016528927, 3.582396694214876, 3.5940495867768596, 3.6057024793388432, 3.6173553719008265, 3.62900826446281, 3.6406611570247933, 3.652314049586777, 3.66396694214876, 3.675619834710744, 3.6872727272727275, 3.6989256198347107, 3.7105785123966943, 3.722231404958678, 3.733884297520661, 3.745537190082645, 3.757190082644628, 3.7688429752066117, 3.780495867768595, 3.7921487603305786, 3.8038016528925622, 3.8154545454545454, 3.827107438016529, 3.8387603305785127, 3.850413223140496, 3.862066115702479, 3.873719008264463, 3.8853719008264465, 3.8970247933884297, 3.9086776859504133, 3.920330578512397, 3.93198347107438, 3.943636363636364, 3.9552892561983475, 3.9669421487603307, 3.978595041322314, 3.9902479338842975, 4.001900826446281, 4.013553719008264, 4.025206611570248, 4.036859504132232, 4.048512396694215, 4.060165289256198, 4.071818181818182, 4.083471074380165, 4.095123966942149, 4.106776859504132, 4.118429752066116, 4.130082644628099, 4.141735537190083, 4.1533884297520665, 4.16504132231405, 4.176694214876033, 4.188347107438016, 4.2}, +.param_3 = {0.07198947887701433, 0.10240062928344941, 0.12102887897303838, 0.13071167718068935, 0.13428647314131043, 0.1345907160898097, 0.134443240828135, 0.1353854309638388, 0.13688030983101654, 0.1382225880297271, 0.13916563440038304, 0.13989125116800824, 0.14058593151085658, 0.1412931278733713, 0.1419607440664955, 0.14254495099216136, 0.14306224410857993, 0.14355159713890514, 0.14404167495424133, 0.14452812895719364, 0.14500004056667443, 0.14544649225688114, 0.1458568516015221, 0.14622115543648598, 0.14652953652717093, 0.14677223858663546, 0.14694895771094604, 0.14707592513200665, 0.14717103998596637, 0.14725198435635317, 0.14732773387143205, 0.1473957963150603, 0.14745289696861497, 0.14749600117746403, 0.14752757452462792, 0.1475555710598347, 0.1475881825426108, 0.1476331654325787, 0.14769192691899766, 0.1477610691053464, 0.14783707516962608, 0.14791660274657864, 0.14799803118638413, 0.14808072058271515, 0.1481640424137825, 0.14824738393049697, 0.1483302421420439, 0.14841216070703947, 0.14849268345480285, 0.14857173773668242, 0.14865117263921102, 0.1487334379030074, 0.14882098344453693, 0.1489152902444429, 0.14901431145810315, 0.1491151975832977, 0.1492151014192856, 0.1493124674747434, 0.1494091815402419, 0.14950769622944138, 0.14961044148755015, 0.14971692238564033, 0.14982086283954751, 0.14991530828642552, 0.1499934425196914, 0.1500558213357508, 0.15011392255831996, 0.15018010694508765, 0.15026638118813387, 0.15037465799858304, 0.15049553653145584, 0.15061901696591196, 0.1507354466898218, 0.15084119660759415, 0.15093773838476646, 0.1510267047434328, 0.1511098207985611, 0.15118986706369916, 0.15127029619370097, 0.1513545716586617, 0.15144568809328113, 0.15154293429721846, 0.151643838943591, 0.1517459200421911, 0.15184697920253956, 0.15194641461500522, 0.15204418271492431, 0.15214024052553202, 0.1522349875752401, 0.15233062573724132, 0.15242981569897132, 0.15253521698019565, 0.1526479858369192, 0.1527648263584383, 0.1528816222991686, 0.15299426474697642, 0.15310006934518908, 0.15319946845942636, 0.15329330677629346, 0.15338242838557184, 0.15346763613291212, 0.15354966559781344, 0.15362924616494705, 0.15370713230492322, 0.15378493478282998, 0.15386531243197235, 0.15395098801804655, 0.15404449010316262, 0.1541444539568464, 0.154245915740059, 0.15434377636086044, 0.15443331947540292, 0.15451475706499768, 0.15459172390377446, 0.154667923807415, 0.1547468293567792, 0.15482882413703916, 0.15491209032255826, 0.154994762780127, 0.15507527923300227, 0.1551548355644934, 0.15523610132954585, 0.1553217599530665, 0.1554139891548402, 0.15551171416846807, 0.1556125727253928, 0.15571419935546735, 0.15581460782611772, 0.15591356588252223, 0.1560113479974672, 0.1561082287280851, 0.15620467746557296, 0.15630181578903118, 0.15640090158422748, 0.15650318767463356, 0.15660821221662194, 0.15671131080402703, 0.15680718698403318, 0.1568905862380488, 0.15696030002581332, 0.1570224777753007, 0.15708404846803933, 0.1571518498383355, 0.15722875623486154, 0.15731223884260692, 0.15739938094742265, 0.15748741535636346, 0.15757718801244663, 0.1576732574765397, 0.1577803517316926, 0.15790292543076248, 0.15804129201734352, 0.15819255053983305, 0.15835371581687588, 0.15852201709635663, 0.15869686265324812, 0.15887893067230596, 0.15906891515717358, 0.15926746810488282, 0.15947494226875103, 0.159691560544969, 0.15991754530323105, 0.16015204515936562, 0.1603887218632139, 0.16061948915034546, 0.16083626005216523, 0.16103350540373246, 0.16121516585062007, 0.1613873731106976, 0.16155625515879718, 0.16172563622419123, 0.16189311953563637, 0.16205526866978728, 0.162208672795011, 0.16235333504658442, 0.1624960669391052, 0.16264448764719566, 0.16280610929806133, 0.16298267603468267, 0.16316734912126415, 0.1633525917679805, 0.1635310352302122, 0.16370008129801747, 0.16386246719918582, 0.16402121163108718, 0.16417930087347446, 0.16433916484793254, 0.16450276552121793, 0.1646720502892629, 0.16484864777706434, 0.1650305865250543, 0.16521362163022013, 0.16539347244882588, 0.1655663748145788, 0.16573258871111524, 0.16589426209182592, 0.16605355377983905, 0.16621262259828284, 0.1663736273702854, 0.16653872691897495, 0.16671008006747964}, +.param_4 = {0.002879579155080574, 0.004096025171337977, 0.004841155158921536, 0.005228467087227575, 0.0053714589256524175, 0.005383628643592388, 0.005377729633125401, 0.0054154172385535515, 0.005475212393240662, 0.005528903521189085, 0.0055666253760153234, 0.005595650046720331, 0.005623437260434265, 0.005651725114934853, 0.005678429762659821, 0.005701798039686455, 0.005722489764343199, 0.005742063885556207, 0.005761666998169654, 0.0057811251582877456, 0.005800001622666978, 0.0058178596902752466, 0.0058342740640608855, 0.005848846217459441, 0.005861181461086839, 0.005870889543465419, 0.005877958308437842, 0.0058830370052802665, 0.005886841599438656, 0.005890079374254129, 0.005893109354857284, 0.005895831852602413, 0.0058981158787445994, 0.005899840047098562, 0.005901102980985118, 0.005902222842393389, 0.0059035273017044336, 0.00590532661730315, 0.0059076770767599075, 0.005910442764213857, 0.005913483006785044, 0.005916664109863147, 0.005919921247455366, 0.005923228823308607, 0.005926561696551301, 0.00592989535721988, 0.005933209685681757, 0.00593648642828158, 0.005939707338192115, 0.005942869509467299, 0.005946046905568441, 0.005949337516120297, 0.005952839337781479, 0.005956611609777716, 0.005960572458324128, 0.005964607903331909, 0.005968604056771425, 0.0059724986989897364, 0.005976367261609677, 0.005980307849177656, 0.005984417659502007, 0.005988676895425614, 0.005992834513581902, 0.0059966123314570225, 0.005999737700787658, 0.006002232853430033, 0.0060045569023328, 0.006007204277803508, 0.006010655247525356, 0.0060149863199433235, 0.0060198214612582355, 0.00602476067863648, 0.006029417867592873, 0.006033647864303768, 0.006037509535390659, 0.006041068189737313, 0.006044392831942446, 0.006047594682547968, 0.00605081184774804, 0.0060541828663464685, 0.006057827523731246, 0.00606171737188874, 0.0060657535577436405, 0.006069836801687645, 0.006073879168101583, 0.006077856584600211, 0.006081767308596974, 0.006085609621021282, 0.006089399503009605, 0.0060932250294896545, 0.006097192627958854, 0.006101408679207826, 0.006105919433476769, 0.006110593054337534, 0.006115264891966745, 0.006119770589879057, 0.006124002773807565, 0.006127978738377055, 0.006131732271051741, 0.006135297135422875, 0.006138705445316485, 0.006141986623912538, 0.006145169846597884, 0.00614828529219693, 0.006151397391313201, 0.006154612497278896, 0.006158039520721863, 0.006161779604126506, 0.006165778158273856, 0.006169836629602361, 0.006173751054434419, 0.006177332779016117, 0.006180590282599908, 0.006183668956150979, 0.006186716952296602, 0.00618987317427117, 0.006193152965481568, 0.0061964836129023305, 0.006199790511205082, 0.006203011169320091, 0.0062061934225797356, 0.0062094440531818345, 0.006212870398122661, 0.006216559566193609, 0.006220468566738724, 0.006224502909015712, 0.006228567974218695, 0.00623258431304471, 0.00623654263530089, 0.006240453919898689, 0.0062443291491234044, 0.006248187098622919, 0.006252072631561249, 0.0062560360633690994, 0.006260127506985344, 0.006264328488664879, 0.006268452432161082, 0.006272287479361328, 0.006275623449521953, 0.006278412001032535, 0.006280899111012029, 0.006283361938721574, 0.006286073993533421, 0.006289150249394463, 0.006292489553704278, 0.0062959752378969076, 0.006299496614254539, 0.006303087520497866, 0.006306930299061589, 0.006311214069267705, 0.006316117017230501, 0.006321651680693741, 0.006327702021593323, 0.006334148632675037, 0.006340880683854266, 0.006347874506129925, 0.006355157226892239, 0.006362756606286944, 0.006370698724195314, 0.006378997690750043, 0.0063876624217987605, 0.0063967018121292435, 0.006406081806374626, 0.006415548874528557, 0.006424779566013819, 0.00643345040208661, 0.006441340216149299, 0.006448606634024804, 0.006455494924427904, 0.006462250206351888, 0.00646902544896765, 0.006475724781425456, 0.006482210746791494, 0.006488346911800442, 0.006494133401863378, 0.006499842677564208, 0.006505779505887828, 0.006512244371922454, 0.006519307041387308, 0.006526693964850568, 0.006534103670719222, 0.00654124140920849, 0.0065480032519207, 0.0065544986879674345, 0.006560848465243489, 0.00656717203493898, 0.006573566593917304, 0.006580110620848719, 0.006586882011570518, 0.006593945911082574, 0.006601223461002174, 0.0066085448652088066, 0.006615738897953037, 0.006622654992583154, 0.006629303548444611, 0.006635770483673039, 0.006642142151193563, 0.006648504903931315, 0.006654945094811418, 0.0066615490767589994, 0.006668403202699188}, +.param_5 = {0.24328920325148065, 0.19615760038409621, 0.11324419158895972, 0.05303037667308812, 0.015516155636481361, 0.0006270707472983902, 0.0031788594961163277, 0.009748276011526096, 0.011348628263553335, 0.009141298277466105, 0.0066746525531246464, 0.005681188441894122, 0.005607506821452175, 0.005499250222555652, 0.005007292475160165, 0.0044060001683377675, 0.004026584586975211, 0.003917723382645521, 0.00390612727315387, 0.0038334624497323756, 0.0036734531987501, 0.0034272441393907657, 0.0030986527184194076, 0.0026907397025953406, 0.0022043326005978525, 0.0016776847351003196, 0.0012147461814847327, 0.0008883291000814052, 0.0007042368973862387, 0.000626775541862773, 0.0005752478348284087, 0.0005006523887315581, 0.00040081944961490104, 0.0002987102240518437, 0.00023827952948269476, 0.0002424320719315691, 0.00031037749097613185, 0.000414977505547396, 0.0005116146910707012, 0.0005805930025136116, 0.0006221345649289403, 0.0006438240670322316, 0.0006564713445460398, 0.0006640449095935384, 0.0006666533911272622, 0.0006647989130455743, 0.0006591071061700163, 0.0006497652510357652, 0.0006383081185719168, 0.0006339567376326648, 0.000646800665299839, 0.0006792432213037318, 0.0007274093657418448, 0.0007733120542648998, 0.0007996293554192804, 0.0008031598447297283, 0.0007890795657827798, 0.0007763204838252304, 0.0007809150187919507, 0.0008050397892330093, 0.0008369046247957979, 0.0008416854079894287, 0.0007935436031408609, 0.0006903187205756049, 0.0005620521973010405, 0.00048192015451422113, 0.0004971424373475045, 0.0006098345192556351, 0.0007782042139815523, 0.0009166213732879173, 0.0009774358693156494, 0.0009596406334637549, 0.0008887185667287925, 0.000809166779778582, 0.0007420325433544865, 0.0006883296551787529, 0.0006526492810654885, 0.0006419015805593509, 0.0006588183798500805, 0.0007015675983206016, 0.0007534505542271253, 0.0007926034012394577, 0.0008119429798905675, 0.0008125610357942459, 0.0008019782912565242, 0.0007888140495390661, 0.000775303642107112, 0.0007632194412631431, 0.000761540846837272, 0.0007793124949248727, 0.0008183649718171773, 0.000872680551791509, 0.0009184375129707434, 0.0009345458489976033, 0.0009177535541523424, 0.0008737881840819965, 0.0008208148497997753, 0.0007729497244176112, 0.0007318397045819915, 0.0006973174264743656, 0.0006689488489663477, 0.0006464401281399031, 0.0006298668284391434, 0.0006227544715317265, 0.0006327205081966582, 0.0006642129408662018, 0.0007167106847609517, 0.0007738637551993159, 0.0008057025475855482, 0.0007972896160562612, 0.0007496149413755739, 0.000683922816548891, 0.0006336177134862349, 0.0006126669696694328, 0.0006204218120190418, 0.0006436013184966428, 0.0006610438631160682, 0.0006637545723513563, 0.000652755641776092, 0.0006402911374653666, 0.0006432883861743136, 0.0006676975542925685, 0.00071155130117748, 0.0007598168616063106, 0.000794334282210301, 0.0008099407479970899, 0.0008081404028997818, 0.0007974661082195064, 0.0007869606853979152, 0.0007786513822514128, 0.0007733178724230079, 0.0007743482437844174, 0.0007848964746180048, 0.0008054875424095588, 0.0008292425295779518, 0.0008324925175737762, 0.0007958990696449106, 0.0007171017360870814, 0.0006124521671206813, 0.0005275661490076154, 0.0004949937689039015, 0.0005174882521392053, 0.0005788310672888951, 0.0006415560170856816, 0.0006824988502444722, 0.0007007060550260832, 0.000711228260095835, 0.0007433684807050742, 0.0008126548769839259, 0.000918671816891193, 0.0010437611426035963, 0.0011585004362821456, 0.0012496951981295738, 0.0013178662260943108, 0.00137258734548883, 0.0014276543037972794, 0.001488210015701888, 0.0015541497303075448, 0.0016241084463099013, 0.001696369760344641, 0.0017704121379200424, 0.0018419384575865498, 0.0018847062399313802, 0.0018697759639193373, 0.0017901527558052653, 0.0016560650135479839, 0.0015156231938194022, 0.0014154708278604766, 0.0013643572327083978, 0.0013530524539746153, 0.0013474575073568057, 0.0013185297823843471, 0.0012622130374986308, 0.0011922655071884038, 0.001149576576376602, 0.0011646104024450217, 0.0012401694358245806, 0.0013527535499479985, 0.0014449592928113437, 0.0014796629331913919, 0.0014547444357922157, 0.0013899581201477947, 0.0013257278758944772, 0.0012845213322789165, 0.0012673346971545617, 0.0012718128673814763, 0.0012938585909738794, 0.0013315417653213951, 0.0013835290233855414, 0.0014341449431656134, 0.001459895412623223, 0.001451543695086318, 0.0014110127374347518, 0.0013564650491574431, 0.0013115491089885079, 0.0012838602748951704, 0.0012734420258275585, 0.0012802943617854987, 0.0013044172827684705, 0.0013458107887769945, 0.0013708251880377095}, +.param_6 = {6.082230081287015, 4.903940009602405, 2.831104789723994, 1.3257594168272047, 0.3879038909120336, 0.015676768682457154, 0.0794714874029101, 0.24370690028815423, 0.28371570658883016, 0.22853245693665036, 0.16686631382811512, 0.1420297110473534, 0.14018767053630699, 0.13748125556389268, 0.12518231187900464, 0.11015000420844245, 0.10066461467437837, 0.09794308456614054, 0.09765318182884952, 0.0958365612433093, 0.09183632996875024, 0.08568110348476654, 0.07746631796048398, 0.06726849256488421, 0.055108315014948395, 0.04194211837751094, 0.03036865453711901, 0.02220822750203244, 0.017605922434651977, 0.01566938854656863, 0.014381195870713515, 0.012516309718291208, 0.01002048624037244, 0.007467755601295312, 0.005956988237065808, 0.006060801798288273, 0.007759437274401648, 0.010374437638685508, 0.012790367276768744, 0.014514825062841852, 0.015553364123224722, 0.016095601675805704, 0.016411783613651254, 0.01660112273983716, 0.01666633477818147, 0.01661997282614014, 0.016477677654250233, 0.016244131275894302, 0.015957702964294884, 0.015848918440816706, 0.016170016632496842, 0.016981080532590953, 0.01818523414355011, 0.01933280135662241, 0.01999073388548045, 0.020078996118244596, 0.019726989144569496, 0.019408012095631366, 0.019522875469799028, 0.020125994730824104, 0.020922615619894946, 0.02104213519973641, 0.01983859007851918, 0.01725796801438917, 0.014051304932527486, 0.012048003862855095, 0.01242856093368605, 0.015245862981391745, 0.01945510534953898, 0.022915534332196286, 0.02443589673289115, 0.023991015836596907, 0.02221796416821964, 0.02022916949446507, 0.018550813583864678, 0.017208241379465528, 0.016316232026636346, 0.016047539513985853, 0.01647045949625392, 0.017539189958015733, 0.01883626385567605, 0.019815085030985835, 0.0202985744972628, 0.020314025894857535, 0.020049457281412497, 0.019720351238475264, 0.019382591052680143, 0.01908048603157797, 0.01903852117093041, 0.01948281237312277, 0.02045912429543273, 0.02181701379478651, 0.022960937824265115, 0.02336364622494147, 0.022943838853811682, 0.02184470460204757, 0.02052037124499473, 0.019323743110438718, 0.018295992614547618, 0.017432935661865212, 0.016723721224159993, 0.016161003203493673, 0.01574667071097824, 0.015568861788292643, 0.015818012704912898, 0.01660532352165678, 0.01791776711902726, 0.01934659387998472, 0.020142563689637405, 0.01993224040140462, 0.01874037353439273, 0.017098070413723576, 0.015840442837153357, 0.015316674241733219, 0.015510545300473355, 0.01609003296241529, 0.016526096577906824, 0.016593864308783735, 0.016318891044400652, 0.01600727843663885, 0.01608220965435836, 0.01669243885731031, 0.017788782529434832, 0.018995421540157764, 0.019858357055260734, 0.020248518699927942, 0.02020351007249177, 0.019936652705487834, 0.01967401713494632, 0.019466284556288183, 0.019332946810576845, 0.01935870609460766, 0.01962241186545255, 0.020137188560237496, 0.020731063239445846, 0.020812312939347266, 0.019897476741123632, 0.01792754340217695, 0.015311304178014518, 0.013189153725190472, 0.012374844222601267, 0.012937206303478832, 0.014470776682221076, 0.016038900427142733, 0.017062471256110157, 0.017517651375653642, 0.017780706502398824, 0.018584212017624946, 0.020316371924597454, 0.02296679542227731, 0.026094028565090688, 0.02896251090705737, 0.03124237995323631, 0.03294665565235777, 0.034314683637223786, 0.035691357594933026, 0.03720525039254685, 0.03885374325768576, 0.0406027111577445, 0.042409244008617675, 0.04426030344800158, 0.04604846143966279, 0.047117655998285546, 0.04674439909798378, 0.04475381889513241, 0.04140162533869951, 0.037890579845484273, 0.0353867706965133, 0.03410893081771116, 0.03382631134936365, 0.0336864376839191, 0.03296324455960564, 0.03155532593746291, 0.029806637679713477, 0.028739414409420516, 0.029115260061124415, 0.03100423589561252, 0.0338188387487004, 0.036123982320282466, 0.036991573329783756, 0.0363686108948047, 0.034748953003696514, 0.03314319689736167, 0.03211303330697135, 0.03168336742886413, 0.03179532168453569, 0.03234646477434655, 0.03328854413303661, 0.03458822558464192, 0.03585362357914068, 0.03649738531557867, 0.03628859237715665, 0.03527531843586784, 0.03391162622893573, 0.03278872772471131, 0.03209650687238108, 0.03183605064569217, 0.03200735904463625, 0.03261043206921055, 0.03364526971942339, 0.03427062970093875}, +.param_7 = {0.0002963797224320547, 0.0003013681428378439, 0.000306356563243633, 0.0003113449836494222, 0.0003163334040552112, 0.0003213218244610004, 0.0003263102448667896, 0.00033129866527257867, 0.0003362870856783679, 0.0003412755060841569, 0.00034626392648994615, 0.00035125234689573515, 0.00035624076730152437, 0.0003612291877073136, 0.0003662176081131026, 0.0003712060285188918, 0.000376194448924681, 0.00038118286933047006, 0.0003861712897362593, 0.00039115971014204833, 0.00039614813054783754, 0.0004027768727398232, 0.00041237384449146586, 0.0004219708162431085, 0.00043156778799475083, 0.0004411647597463935, 0.0004507617314980361, 0.00046035870324967834, 0.000469955675001321, 0.0004795526467529633, 0.000489149618504606, 0.0004987465902562482, 0.0005083435620078909, 0.0005179405337595335, 0.0005275375055111758, 0.0005371344772628184, 0.0005467314490144607, 0.0005563284207661034, 0.0005659253925177455, 0.0005755223642693883, 0.0005851193360210309, 0.0005947163077726732, 0.0006133207408267341, 0.0006393153827305864, 0.0006653100246344377, 0.0006913046665382901, 0.0007172993084421413, 0.0007432939503459936, 0.000769288592249845, 0.0007952832341536972, 0.0012504387870397218, 0.0013490659508724955, 0.0014292330957975448, 0.0014913956849651338, 0.001553558274132721, 0.0016177987096876033, 0.0016870284274651448, 0.0017562581452426889, 0.0018374952440381803, 0.0019360328597558957, 0.0020458867906328576, 0.00217395100444617, 0.002306714801915466, 0.002439697832505642, 0.0025710977460250573, 0.0027088205517245534, 0.0028555038632682556, 0.0030170707283588625, 0.0031968127561947104, 0.0033867074439090654, 0.003576332919049865, 0.0037672258196462124, 0.00396331593588847, 0.004169730768168166, 0.004394251469242655, 0.0046596064302951165, 0.005012002301812083, 0.005799476678395546, 0.007670873523681251, 0.008838653961630239, 0.009984611253161519, 0.010985601017358489, 0.011925859472508155, 0.012952683110020137, 0.014005711655534665, 0.01486732782840385, 0.015969953813323494, 0.016897733048617986, 0.017859653378737378, 0.018698387648399765, 0.01959516934799887, 0.02072971628127887, 0.021745399903146858, 0.022847884952693152, 0.023990591323100753, 0.024998197285207784, 0.02593604780097341, 0.026870381099434237, 0.02797348525049048, 0.029166810803726028, 0.030032762869828613, 0.030634752507798138, 0.03116135081218045, 0.03163371591013632, 0.03206265434096598, 0.032460998312441876, 0.03286880407748972, 0.033348115682755385, 0.03389401497844894, 0.03446468043206038, 0.035100798300133275, 0.03564611310739987, 0.03615664740550683, 0.036725426343990945, 0.03730518484491729, 0.037839221550459254, 0.03835170984491413, 0.038907912949018464, 0.03948947500911114, 0.0399361022364217, 0.0399361022364217, 0.0399361022364217}, +.param_8 = {1.1855188897282191e-05, 1.205472571351376e-05, 1.2254262529745322e-05, 1.2453799345976889e-05, 1.2653336162208449e-05, 1.2852872978440018e-05, 1.3052409794671587e-05, 1.325194661090315e-05, 1.3451483427134719e-05, 1.3651020243366277e-05, 1.385055705959785e-05, 1.4050093875829408e-05, 1.4249630692060975e-05, 1.4449167508292546e-05, 1.4648704324524104e-05, 1.4848241140755675e-05, 1.5047777956987243e-05, 1.5247314773218807e-05, 1.5446851589450372e-05, 1.5646388405681938e-05, 1.5845925221913503e-05, 1.611107490959293e-05, 1.6494953779658637e-05, 1.6878832649724343e-05, 1.7262711519790035e-05, 1.764659038985574e-05, 1.8030469259921446e-05, 1.841434812998714e-05, 1.8798227000052844e-05, 1.9182105870118536e-05, 1.9565984740184242e-05, 1.9949863610249934e-05, 2.033374248031564e-05, 2.0717621350381342e-05, 2.1101500220447034e-05, 2.1485379090512743e-05, 2.1869257960578432e-05, 2.225313683064414e-05, 2.2637015700709826e-05, 2.3020894570775532e-05, 2.340477344084124e-05, 2.3788652310906933e-05, 2.4532829633069375e-05, 2.557261530922346e-05, 2.6612400985377517e-05, 2.7652186661531608e-05, 2.8691972337685662e-05, 2.9731758013839753e-05, 3.077154368999381e-05, 3.181132936614789e-05, 5.001755148158888e-05, 5.396263803489983e-05, 5.71693238319018e-05, 5.965582739860537e-05, 6.214233096530886e-05, 6.471194838750415e-05, 6.748113709860581e-05, 7.025032580970757e-05, 7.349980976152722e-05, 7.744131439023584e-05, 8.183547162531433e-05, 8.695804017784681e-05, 9.226859207661867e-05, 9.75879133002257e-05, 0.00010284390984100232, 0.00010835282206898215, 0.00011422015453073024, 0.00012068282913435452, 0.00012787251024778845, 0.00013546829775636264, 0.00014305331676199462, 0.00015068903278584855, 0.00015853263743553883, 0.00016678923072672668, 0.00017577005876970623, 0.0001863842572118047, 0.00020048009207248332, 0.0002319790671358219, 0.0003068349409472501, 0.0003535461584652097, 0.00039938445012646076, 0.00043942404069433966, 0.00047703437890032625, 0.0005181073244008056, 0.0005602284662213867, 0.0005946931131361542, 0.0006387981525329398, 0.0006759093219447195, 0.0007143861351494951, 0.0007479355059359907, 0.0007838067739199549, 0.0008291886512511549, 0.0008698159961258744, 0.0009139153981077262, 0.0009596236529240304, 0.0009999278914083116, 0.0010374419120389364, 0.0010748152439773696, 0.0011189394100196194, 0.0011666724321490415, 0.0012013105147931447, 0.0012253901003119257, 0.0012464540324872183, 0.001265348636405453, 0.0012825061736386394, 0.0012984399324976752, 0.0013147521630995887, 0.0013339246273102157, 0.001355760599137958, 0.0013785872172824153, 0.0014040319320053312, 0.001425844524295995, 0.0014462658962202733, 0.001469017053759638, 0.0014922073937966916, 0.0015135688620183706, 0.0015340683937965654, 0.0015563165179607388, 0.001579579000364446, 0.0015974440894568685, 0.0015974440894568685, 0.0015974440894568685}, +.param_9 = {4.557091307248733}, +.param_10 = {349.1762839971575, 1490.676499180144}, +.param_11 = {1.223415849376096, 0.9152887684109168}, +.param_12 = {0.020003348891683875}, +.name = {'L', 'P', '1', '8', 'l', '9', '1', '7'}, diff --git a/samples/pmic/native/npm1300_fuel_gauge/src/fuel_gauge.c b/samples/pmic/native/npm13xx_fuel_gauge/src/fuel_gauge.c similarity index 86% rename from samples/pmic/native/npm1300_fuel_gauge/src/fuel_gauge.c rename to samples/pmic/native/npm13xx_fuel_gauge/src/fuel_gauge.c index 43d3b92e8466..06258a22cc87 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/src/fuel_gauge.c +++ b/samples/pmic/native/npm13xx_fuel_gauge/src/fuel_gauge.c @@ -14,16 +14,20 @@ #include -/* nPM1300 CHARGER.BCHGCHARGESTATUS register bitmasks */ -#define NPM1300_CHG_STATUS_COMPLETE_MASK BIT(1) -#define NPM1300_CHG_STATUS_TRICKLE_MASK BIT(2) -#define NPM1300_CHG_STATUS_CC_MASK BIT(3) -#define NPM1300_CHG_STATUS_CV_MASK BIT(4) +/* nPM13xx CHARGER.BCHGCHARGESTATUS register bitmasks */ +#define NPM13XX_CHG_STATUS_COMPLETE_MASK BIT(1) +#define NPM13XX_CHG_STATUS_TRICKLE_MASK BIT(2) +#define NPM13XX_CHG_STATUS_CC_MASK BIT(3) +#define NPM13XX_CHG_STATUS_CV_MASK BIT(4) static int64_t ref_time; static const struct battery_model battery_model = { +#if DT_NODE_EXISTS(DT_NODELABEL(npm1300_ek_pmic)) #include "battery_model.inc" +#elif DT_NODE_EXISTS(DT_NODELABEL(npm1304_ek_pmic)) +#include "battery_model_20mAh.inc" +#endif }; static int read_sensors(const struct device *charger, float *voltage, float *current, float *temp, @@ -56,16 +60,16 @@ static int charge_status_inform(int32_t chg_status) { union nrf_fuel_gauge_ext_state_info_data state_info; - if (chg_status & NPM1300_CHG_STATUS_COMPLETE_MASK) { + if (chg_status & NPM13XX_CHG_STATUS_COMPLETE_MASK) { printk("Charge complete\n"); state_info.charge_state = NRF_FUEL_GAUGE_CHARGE_STATE_COMPLETE; - } else if (chg_status & NPM1300_CHG_STATUS_TRICKLE_MASK) { + } else if (chg_status & NPM13XX_CHG_STATUS_TRICKLE_MASK) { printk("Trickle charging\n"); state_info.charge_state = NRF_FUEL_GAUGE_CHARGE_STATE_TRICKLE; - } else if (chg_status & NPM1300_CHG_STATUS_CC_MASK) { + } else if (chg_status & NPM13XX_CHG_STATUS_CC_MASK) { printk("Constant current charging\n"); state_info.charge_state = NRF_FUEL_GAUGE_CHARGE_STATE_CC; - } else if (chg_status & NPM1300_CHG_STATUS_CV_MASK) { + } else if (chg_status & NPM13XX_CHG_STATUS_CV_MASK) { printk("Constant voltage charging\n"); state_info.charge_state = NRF_FUEL_GAUGE_CHARGE_STATE_CV; } else { @@ -158,6 +162,10 @@ int fuel_gauge_update(const struct device *charger, bool vbus_connected) printk("Error: Could not read from charger device\n"); return ret; } + /* Zephyr sensor API convention for Gauge current is negative=discharging, + * while nrf_fuel_gauge lib expects the opposite negative=charging + */ + current = -current; ret = nrf_fuel_gauge_ext_state_update( vbus_connected ? NRF_FUEL_GAUGE_EXT_STATE_INFO_VBUS_CONNECTED diff --git a/samples/pmic/native/npm1300_fuel_gauge/src/fuel_gauge.h b/samples/pmic/native/npm13xx_fuel_gauge/src/fuel_gauge.h similarity index 100% rename from samples/pmic/native/npm1300_fuel_gauge/src/fuel_gauge.h rename to samples/pmic/native/npm13xx_fuel_gauge/src/fuel_gauge.h diff --git a/samples/pmic/native/npm1300_fuel_gauge/src/main.c b/samples/pmic/native/npm13xx_fuel_gauge/src/main.c similarity index 79% rename from samples/pmic/native/npm1300_fuel_gauge/src/main.c rename to samples/pmic/native/npm13xx_fuel_gauge/src/main.c index 2735a5323b73..cce895a6eb61 100644 --- a/samples/pmic/native/npm1300_fuel_gauge/src/main.c +++ b/samples/pmic/native/npm13xx_fuel_gauge/src/main.c @@ -3,8 +3,6 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -#include - #include #include #include @@ -16,8 +14,16 @@ #define SLEEP_TIME_MS 1000 -static const struct device *pmic = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_pmic)); -static const struct device *charger = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_charger)); +#if DT_NODE_EXISTS(DT_NODELABEL(npm1300_ek_pmic)) +#define NPM13XX_DEVICE(dev) DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_ ## dev)) +#elif DT_NODE_EXISTS(DT_NODELABEL(npm1304_ek_pmic)) +#define NPM13XX_DEVICE(dev) DEVICE_DT_GET(DT_NODELABEL(npm1304_ek_ ## dev)) +#else +#error "neither npm1300 nor npm1304 found in devicetree" +#endif + +static const struct device *pmic = NPM13XX_DEVICE(pmic); +static const struct device *charger = NPM13XX_DEVICE(charger); static volatile bool vbus_connected; static void event_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) diff --git a/scripts/quarantine_integration.yaml b/scripts/quarantine_integration.yaml index a96aff81f589..aec4553f27b1 100644 --- a/scripts/quarantine_integration.yaml +++ b/scripts/quarantine_integration.yaml @@ -338,7 +338,8 @@ comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: - - sample.npm1300_fuel_gauge + - sample.npm1300_fuel_gauge_compile + - sample.npm1304_fuel_gauge_compile - sample.npm1300_one_button platforms: - nrf52840dk/nrf52840