zephyr/samples/sensor/fxos8700
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
README.rst samples: fxos8700: add accelerometer devices to README.rst 2018-10-17 14:16:02 -05:00
overlay-motion.conf samples: fxos8700: add motion detection overlay and test 2018-10-17 14:16:02 -05:00
prj.conf drivers: sensor: Migrate to new logger 2018-10-16 08:49:53 -04:00
prj_accel.conf samples: fxos8700: add config for accelerometer devices 2018-10-17 14:16:02 -05:00
sample.yaml samples: fxos8700: enable pulse and motion detection in sample.yaml 2018-10-17 14:16:02 -05:00

README.rst

.. _fxos8700:

FXOS8700 Accelerometer/Magnetometer Sensor
##########################################

Overview
********

This sample application shows how to use the FXOS8700 driver.
The driver supports FXOS8700 accelerometer/magnetometer and
MMA8451Q, MMA8652FC, MMA8653FC accelerometers.

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

This project outputs sensor data to the console. FXOS8700
sensor is present on the :ref:`frdm_k64f`, :ref:`frdm_kw41z`, and
:ref:`hexiwear_k64` boards. Accelerometer only devices are
present on the :ref:`frdm_kl25z`, :ref:`bbc_microbit`, and
:ref:`reel_board` boards. It does not work on QEMU.

Building and Running for FRDM-K64F
==================================
FRDM-K64F is equipped with FXOS8700CQ accelerometer and magnetometer.
Sample can be built and executed for the FRDM-K64F as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/fxos8700
   :board: frdm_k64f
   :goals: build flash
   :compact:

Example building for the FRDM-K64F with motion detection support:

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/fxos8700
   :board: frdm_k64f
   :conf: "prj.conf overlay-motion.conf"
   :goals: build flash
   :compact:

Building and Running for FRDM-KL25Z
===================================
FRDM-KL25Z is equipped with MMA8451Q accelerometer.
Sample can be built and executed for the FRDM-KL25Z as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/fxos8700
   :board: frdm_kl25z
   :conf: "prj_accel.conf"
   :goals: build flash
   :compact:

Building and Running for Micro Bit
==================================
Micro Bit is equipped with MMA8653FC accelerometer.
Sample can be built and executed for the Micro Bit as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/fxos8700
   :board: bbc_microbit
   :conf: "prj_accel.conf"
   :goals: build flash
   :compact:

Building and Running for reel board
===================================
The reel board is equipped with MMA8652FC accelerometer.
Sample can be built and executed for the reel board as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/fxos8700
   :board: reel_board
   :conf: "prj_accel.conf"
   :goals: build flash
   :compact:

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

.. code-block:: console

   AX= -0.191537 AY=  0.067037 AZ=  9.902418 MX=  0.379000 MY=  0.271000 MZ= -0.056000 T= 22.080000
   AX= -0.162806 AY=  0.143652 AZ=  9.940725 MX=  0.391000 MY=  0.307000 MZ= -0.058000 T= 22.080000
   AX= -0.172383 AY=  0.134075 AZ=  9.969455 MX=  0.395000 MY=  0.287000 MZ= -0.017000 T= 22.080000
   AX= -0.210690 AY=  0.105344 AZ=  9.911994 MX=  0.407000 MY=  0.306000 MZ= -0.068000 T= 22.080000
   AX= -0.153229 AY=  0.124498 AZ=  9.950302 MX=  0.393000 MY=  0.301000 MZ= -0.021000 T= 22.080000
   AX= -0.153229 AY=  0.095768 AZ=  9.921571 MX=  0.398000 MY=  0.278000 MZ= -0.040000 T= 22.080000
   AX= -0.162806 AY=  0.105344 AZ=  9.902418 MX=  0.372000 MY=  0.300000 MZ= -0.046000 T= 22.080000

<repeats endlessly>