1.. zephyr:code-sample:: x-nucleo-iks01a3-shub
2   :name: X-NUCLEO-IKS01A3 shield - SensorHub (Mode 2)
3   :relevant-api: sensor_interface
4
5   Interact with all the sensors of an X-NUCLEO-IKS01A3 shield using Sensor Hub mode.
6
7Overview
8********
9This sample is provided as an example to test the X-NUCLEO-IKS01A3 shield
10configured in Sensor Hub mode (Mode 2).
11Please refer to :ref:`x-nucleo-iks01a3` for more info on this configuration.
12
13This sample enables LIS2DW12 and LSM6DSO sensors. Since all other shield
14devices are connected to LSM6DSO, the LSM6DSO driver is configured in sensorhub
15mode (CONFIG_LSM6DSO_SENSORHUB=y) with a selection of two maximum slaves
16among LPS22HH, HTS221 and LIS2MDL (default is LIS2MDL + LPS22HH).
17
18Then sensor data are displayed periodically
19
20- LIS2DW12 3-Axis acceleration
21- LSM6DSO 6-Axis acceleration and angular velocity
22- LSM6DSO (from LIS2MDL) 3-Axis magnetic field intensity
23- LSM6DSO (from LPS22HH) ambient temperature and atmospheric pressure
24
25Optionally HTS221 can substitute one between LIS2MDL and LPS22HH
26
27- LSM6DSO (from HTS221): ambient temperature and relative humidity
28
29
30Requirements
31************
32
33This sample communicates over I2C with the X-NUCLEO-IKS01A3 shield
34stacked on a board with an Arduino connector. The board's I2C must be
35configured for the I2C Arduino connector (both for pin muxing
36and devicetree). See for example the :ref:`nucleo_f401re_board` board
37source code:
38
39- :file:`$ZEPHYR_BASE/boards/arm/nucleo_f401re/nucleo_f401re.dts`
40- :file:`$ZEPHYR_BASE/boards/arm/nucleo_f401re/pinmux.c`
41
42Please note that this sample can't be used with boards already supporting
43one of the sensors available on the shield (such as disco_l475_iot1)
44as sensors multiple instances are not supported.
45
46References
47**********
48
49- X-NUCLEO-IKS01A3: https://www.st.com/en/ecosystems/x-nucleo-iks01a3.html
50
51Building and Running
52********************
53
54This sample runs with X-NUCLEO-IKS01A3 stacked on any board with a matching
55Arduino connector. For this example, we use a :ref:`nucleo_f401re_board` board.
56
57.. zephyr-app-commands::
58   :zephyr-app: samples/shields/x_nucleo_iks01a3/sensorhub/
59   :host-os: unix
60   :board: nucleo_f401re
61   :goals: build
62   :compact:
63
64Sample Output
65=============
66
67 .. code-block:: console
68
69
70    X-NUCLEO-IKS01A3 sensor dashboard
71
72    LIS2DW12: Accel (m.s-2): x: -0.077, y: 0.536, z: 9.648
73    LSM6DSO: Accel (m.s-2): x: -0.062, y: -0.028, z: 10.035
74    LSM6DSO: GYro (dps): x: -0.003, y: -0.001, z: 0.000
75    LSM6DSO: Magn (gauss): x: -0.052, y: -0.222, z: -0.059
76    LSM6DSO: Temperature: 27.9 C
77    LSM6DSO: Pressure:100.590 kpa
78    1:: lsm6dso acc trig 208
79    1:: lsm6dso gyr trig 208
80
81    <updated endlessly every 2 seconds>
82