zephyr/samples/sensor/fdc2x1x
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
..
boards
src
CMakeLists.txt
README.rst
prj.conf
sample.yaml

README.rst

.. _fdc2x1x:

FDC2X1X: Capacitance-to-Digital Converter
#########################################

Overview
********

This sample application periodically reads frequency and capacitance data from the
FDC2X1X sensor in polling mode or optionally with data ready trigger. It is able
to read the 12-Bit and 28-Bit, as well as the 2-Channel and 4-Channel versions
(FDC2112, FDC2114, FDC2212, FDC2214). The 4-channel versions are chosen through
devicetree properties. The default in this sample is the 2-channel version.

Capacitive sensing is a low-power, low-cost, high-resolution contactless sensing
technique that can be applied to a variety of applications ranging from proximity
detection and gesture recognition to remote liquid level sensing. The sensor in
a capacitive sensing system is any metal or conductor, allowing for low cost and
highly flexible system design.
The main challenge limiting sensitivity in capacitive sensing applications is
noise susceptibility of the sensors. With the FDC2x1x innovative EMI resistant
architecture, performance can be maintained even in presence of high-noise environments.


Wiring
*******

This sample uses the FDC2X1X sensor controlled using the I2C interface.
Connect supply **VDD** and **GND**. The supply voltage can be in
the 2.7V to 3.6V range.

Connect **SD** to a GPIO to control the Shutdown Mode.

Connect Interface: **SDA**, **SCL** and optionally connect **INTB** to a
interrupt capable GPIO.

For detailed description refer to the `FDC2X1X datasheet`_
at pages 4-5.


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

This sample outputs sensor data to the console and can be read by any serial
console program. It should work with any platform featuring a I2C interface.
The platform in use requires a custom devicetree overlay.
In this example the :ref:`nrf9160dk_nrf9160` board is used. The devicetree
overlay of this board provides example settings for evaluation, which
you can use as a reference for other platforms.

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/fdc2x1x
   :board: nrf9160dk_nrf9160
   :goals: build flash
   :compact:

Sample Output: 2-Channel, 28-Bit (FDC2212)
==========================================

.. code-block:: console

        ch0: 5.318888 MHz ch1: 5.150293 MHz
        ch0: 49.742308 pF ch1: 53.052260 pF

        ch0: 5.318819 MHz ch1: 5.150307 MHz
        ch0: 49.743612 pF ch1: 53.051964 pF

        ch0: 5.318822 MHz ch1: 5.150200 MHz
        ch0: 49.743548 pF ch1: 53.054176 pF

        ch0: 5.318752 MHz ch1: 5.150265 MHz
        ch0: 49.744860 pF ch1: 53.052828 pF

        <repeats endlessly>


Sample Output: 4-Channel, 12-Bit (FDC2114)
==========================================

.. code-block:: console

        ch0: 4.966171 MHz ch1: 4.946465 MHz ch2: 4.985879 MHz ch3: 4.907051 MHz
        ch0: 57.059016 pF ch1: 57.514568 pF ch2: 56.608844 pF ch3: 58.442204 pF

        ch0: 4.966171 MHz ch1: 4.946465 MHz ch2: 4.985879 MHz ch3: 4.907051 MHz
        ch0: 57.059016 pF ch1: 57.514568 pF ch2: 56.608844 pF ch3: 58.442204 pF

        ch0: 4.966171 MHz ch1: 4.946465 MHz ch2: 4.985879 MHz ch3: 4.907051 MHz
        ch0: 57.059016 pF ch1: 57.514568 pF ch2: 56.608844 pF ch3: 58.442204 pF

        ch0: 4.966171 MHz ch1: 4.946465 MHz ch2: 4.985879 MHz ch3: 4.907051 MHz
        ch0: 57.059016 pF ch1: 57.514568 pF ch2: 56.608844 pF ch3: 58.442204 pF

        <repeats endlessly>


References
**********

FDC2X1X Datasheet and Product Info:
 https://www.ti.com/product/FDC2114

.. _FDC2X1X datasheet: https://www.ti.com/lit/gpn/fdc2114