zephyr/samples/boards/96b_argonkey
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
..
src dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig 2018-11-13 10:44:42 -06:00
CMakeLists.txt samples, tests: Use semi-accurate project names 2018-10-27 21:31:25 -04:00
prj.conf samples: board: 96b_argonkey: Add testing of 12 on-board leds 2018-07-03 12:20:51 -05:00
README.rst samples/boards: Add ArgonKey test 2018-05-18 13:10:33 -05:00
sample.yaml samples/boards: Add ArgonKey test 2018-05-18 13:10:33 -05:00

.. _ArgonKey:

ArgonKey sensor board
#####################

Overview
********
This sample provides an example of how to read sensor data
from the ArgonKey board. The result is displayed on the console.
It makes use of both the trigger and poll methods.

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

This sample just requires the ArgonKey board.
The user may select or unselect the sensors from
:file:`samples/boards/96b_argonkey/prj.conf`.

Please note that all sensor related code is conditionally compiled
using the `#ifdef` directive, so this sample is supposed to always
build correctly. Example:

 .. code-block:: c

    #ifdef CONFIG_HTS221
      struct device *hum_dev = device_get_binding("HTS221");

      if (!hum_dev) {
        printk("Could not get pointer to %s sensor\n", "HTS221");
        return;
      }
    #endif

References
**********

- :ref:`96b_argonkey`

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

 .. zephyr-app-commands::
    :zephyr-app: samples/boards/96b_argonkey
    :host-os: unix
    :board: 96b_argonkey
    :goals: run
    :compact:

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

 .. code-block:: console

    temp: 24.78 C; press: 101.448535
    humidity: 43.000000
    accel (4.121000 -6.859000 -5.384000) m/s2
    gyro (-0.008000 0.270000 0.161000) dps
    magn (0.021000 -0.552000 0.271500) gauss
    - (6) (trig_cnt: 254)

    <repeats endlessly every 2s>

In this example the output is generated polling the sensor every 2 seconds.
Sensor data is printed in the following order (no data is printed for
sensors that are not enabled):

#. *LPS22HB* baro/temp
#. *HTS221* humidity
#. *LSM6DSL* accel
#. *LSM6DSL* gyro
#. *LIS2MDL* magnetometer (attached to *LSM6DSL*)

The last line displays a counter of how many trigger interrupts
has been received.  It is possible to display the sensor data
read for each trigger by enabling the **ARGONKEY_TEST_LOG** macro.