zephyr/samples/sensor/isl29035
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
..
boards
src
CMakeLists.txt
README.rst
prj.conf
sample.yaml

README.rst

.. _isl29035:

ISL29035: Digital Light Sensor
##############################

Overview
********

If trigger is not enabled the sample displays measured light intensity
every 2 seconds.

If trigger is enabled the sample displays light intensity from the
ISL29035 sensor every 10 seconds if it is within +/- 50 lux of the last
read sample.  If the sensor detects an intensity outside that range the
application wakes, displays the intensity, resets the intensity range
window to center on the new value, then continues as before.

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

This sample uses an external breakout for the sensor.  A devicetree
overlay must be provided to connect the sensor to the I2C bus and
identify the interrupt signal.

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

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/isl29035
   :board: nrf52dk_nrf52832
   :goals: build
   :compact:

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

.. code-block:: console

   *** Booting Zephyr OS build zephyr-v2.1.0-335-gfe020d937d43  ***
   ALERT 365 lux outside range centered on 0 lux.
   Next alert outside 315 .. 415
   [0:00:00.018] Ambient light sense: 365.234
   [0:00:10.023] Ambient light sense: 361.084
   ALERT 302 lux outside range centered on 365 lux.
   Next alert outside 252 .. 352
   [0:00:13.276] Ambient light sense: 302.734
   ALERT 247 lux outside range centered on 302 lux.
   Next alert outside 197 .. 297
   [0:00:14.619] Ambient light sense: 247.62
   ALERT 187 lux outside range centered on 247 lux.
   Next alert outside 137 .. 237
   [0:00:16.141] Ambient light sense: 187.927
   ALERT 126 lux outside range centered on 187 lux.
   Next alert outside 76 .. 176
   [0:00:16.410] Ambient light sense: 126.953
   ALERT 181 lux outside range centered on 126 lux.
   Next alert outside 131 .. 231
   [0:00:17.843] Ambient light sense: 181.03
   ALERT 235 lux outside range centered on 181 lux.
   Next alert outside 185 .. 285
   [0:00:18.022] Ambient light sense: 235.779
   ALERT 301 lux outside range centered on 235 lux.
   Next alert outside 251 .. 351
   [0:00:23.126] Ambient light sense: 301.758
   ALERT 353 lux outside range centered on 301 lux.
   Next alert outside 303 .. 403
   [0:00:23.305] Ambient light sense: 353.333
   [0:00:33.310] Ambient light sense: 365.112

   <repeats as necessary>