zephyr/samples/sensor/ina219
Gerard Marull-Paretas c7b5b3c419 samples: migrate includes to contain <zephyr/...> prefix
In order to bring consistency in-tree, migrate all samples to the use
the new prefix <zephyr/...>. Note that the conversion has been scripted:

```python
from pathlib import Path
import re

EXTENSIONS = ("c", "h", "cpp", "rst")

for p in Path(".").glob("samples/**/*"):
    if not p.is_file() or p.suffix and p.suffix[1:] not in EXTENSIONS:
        continue

    content = ""
    with open(p) as f:
        for line in f:
            m = re.match(r"^(.*)#include <(.*)>(.*)$", line)
            if (m and
                not m.group(2).startswith("zephyr/") and
                (Path(".") / "include" / "zephyr" / m.group(2)).exists()):
                content += (
                    m.group(1) +
                    "#include <zephyr/" + m.group(2) +">" +
                    m.group(3) + "\n"
                )
            else:
                content += line

    with open(p, "w") as f:
        f.write(content)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 11:29:59 +02:00
..
boards samples: sensor: added sample app for INA219 2021-08-23 10:32:07 -05:00
src samples: migrate includes to contain <zephyr/...> prefix 2022-05-06 11:29:59 +02:00
CMakeLists.txt samples: sensor: added sample app for INA219 2021-08-23 10:32:07 -05:00
prj.conf samples: sensor: added sample app for INA219 2021-08-23 10:32:07 -05:00
README.rst everywhere: fix typos 2022-03-18 13:24:08 -04:00
sample.yaml samples: sensor: added sample app for INA219 2021-08-23 10:32:07 -05:00

.. _ina219:

INA219 Bidirectional Power/Current Monitor
##########################################

Overview
********

This sample application measures shunt voltage, bus voltage, power and current
every 2 seconds and prints them to console.
The calibration/configuration parameters can be set in the devicetree file.

References
**********

 - `INA219 sensor <https://www.ti.com/product/INA219>`_

Wiring
******

The supply voltage of the INA219 can be in the 3V to 5.5V range.
The common mode voltage of the measured bus can be in the 0V to 26V range.

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

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/ina219
   :board: blackpill_f411ce
   :goals: build flash

Sample Output
=============
When monitoring a 3.3 V bus with a 0.1 Ohm shunt resistor
you should get a similar output as below, repeated every 2 seconds:

.. code-block:: console

        Shunt: 0.001570 [V] -- Bus: 3.224000 [V] -- Power: 0.504000 [W] -- Current: 0.157000 [A]


A negative sign indicates current flowing in reverse direction:

.. code-block:: console

        Shunt: -0.001560 [V] -- Bus: 3.224000 [V] -- Power: 0.502000 [W] -- Current: -0.156000 [A]