zephyr/samples/boards/sensortile_box
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
..
src includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
CMakeLists.txt
README.rst
app.overlay
prj.conf
sample.yaml

README.rst

.. _sensortile_box sensors:

ST SensorTile.box
#################

Overview
********
This sample provides an example of how to read sensors data
from the SensorTile.box board.

This sample enables all sensors of SensorTile.box board, and then
periodically reads and displays data on the console from the following
sensors:

- HTS221: ambient temperature and relative humidity
- LPS22HH: ambient temperature and atmospheric pressure
- LIS2DW12: 3-Axis acceleration
- LSM6DSOX: 6-Axis acceleration and angular velocity
- STTS751: temperature sensor

Requirements
************

The application requires a SensorTile.box board connected to the PC
through USB. The board declares itself as a USB CDC class device.

References
**********

- :ref:`sensortile_box`

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

Build and flash the sample in the following way:

.. zephyr-app-commands::
    :zephyr-app: samples/boards/sensortile_box
    :board: sensortile_box
    :goals: build flash

Please note that flashing the board requires a few preliminary steps described
in :ref:`sensortile_box`.

Then, power cycle the board by disconnecting and reconnecting the USB cable.
Run your favorite terminal program to listen for output.

.. code-block:: console

   $ minicom -D <tty_device> -b 115200

Replace :code:`<tty_device>` with the port where the SensorTile.box board
can be found. For example, under Linux, :code:`/dev/ttyUSB0`.
The ``-b`` option sets baud rate ignoring the value from config.

Sample Output
=============

The sample code outputs sensors data on the SensorTile.box console.

 .. code-block:: console

    SensorTile.box dashboard

    HTS221: Temperature: 26.4 C
    HTS221: Relative Humidity: 60.5%
    LPS22HH: Temperature: 28.4 C
    LPS22HH: Pressure:99.694 kpa
    LIS2DW12: Accel (m.s-2): x: 0.306, y: -0.459, z: 10.031
    IIS3DHHC: Accel (m.s-2): x: -0.581, y: 0.880, z: -9.933
    LSM6DSOX: Accel (m.s-2): x: -0.158, y: 0.158, z: 9.811
    LSM6DSOX: GYro (dps): x: 0.003, y: 0.000, z: -0.005
    STTS751: Temperature: 27.0 C
    1:: lps22hh trig 206
    1:: lis2dw12 trig 410
    1:: lsm6dsox acc trig 836
    1:: lsm6dsox gyr trig 836
    1:: iis3dhhc trig 2422

    <repeats endlessly every 2s>

If you move the board around or put your finger on the temperature
sensor, you will see the accelerometer, gyro, and temperature values change.