zephyr/samples/sensor/lsm6dso
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
..
src samples, tests, boards: Switch main return type from void to int 2023-04-14 07:49:41 +09:00
CMakeLists.txt cmake: increase minimal required version to 3.20.0 2021-08-20 09:47:34 +02:00
prj.conf sensors: Remove unnecessary Kconfig setting of sensors 2022-07-25 15:18:56 +02:00
README.rst samples: sensor: add sample application for lsm6dso 2020-11-18 14:33:52 -05:00
sample.yaml samples: sensors: lsm6dso: Fix regex filter following unit fix 2022-09-02 11:24:08 +00:00

.. _lsm6dso:

LSM6DSO: IMU Sensor Monitor
###########################

Overview
********
This sample sets the date rate of LSM6DSO accelerometer and gyroscope to
12.5Hz and enables a trigger on data ready. It displays on the console
the values for accelerometer and gyroscope.

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

This sample uses the LSM6DSO sensor controlled using the I2C interface.
It has been tested on the :ref:`stm32l562e_dk_board`.

References
**********

- LSM6DSO http://www.st.com/en/mems-and-sensors/lsm6dso.html

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

 This project outputs sensor data to the console. It requires an LSM6DSO
 sensor, which is present on the :ref:`stm32l562e_dk_board`.

Building on stm32l562e_dk board
===============================

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/lsm6dso
   :host-os: unix
   :board: stm32l562e_dk
   :goals: build
   :compact:

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

.. code-block:: console

    Testing LSM6DSO sensor in trigger mode.

    accel x:-0.650847 ms/2 y:-5.300102 ms/2 z:-8.163114 ms/2
    gyro x:-0.167835 dps y:-0.063377 dps z:0.002367 dps
    trig_cnt:1

    accel x:0.341575 ms/2 y:5.209773 ms/2 z:-7.938787 ms/2
    gyro x:-0.034284 dps y:-0.004428 dps z:-0.003512 dps
    trig_cnt:2

    <repeats endlessly>