zephyr/samples/sensor/vcnl4040
Radoslaw Koppel d1a93c1426 drivers: sensor: Const sensor trigger data in trigger handler
This commit adds const modifier in second argument for
sensor trigger handler.
There is no reason to modify this data and this change
would allow to store trigger configuration also in FLASH.

Fixes: #38929

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2021-10-27 15:09:35 -04:00
..
boards
src drivers: sensor: Const sensor trigger data in trigger handler 2021-10-27 15:09:35 -04:00
CMakeLists.txt
README.rst
prj.conf
sample.yaml

README.rst

.. _vcnl4040_sample:

VCNL4040: proximity and ambient light sensor
############################################

Overview
********
 This sample periodically measures proximity and light for
 5 sec in the interval of 300msec in polling mode. Then threshold trigger mode
 is enabled with the high threshold value of 127 and data is fetched based
 on interrupt. The result is displayed on the console.

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

 This sample uses the VCNL4040 sensor controlled using the I2C interface.
 Connect sensor INT for interrupt to Feather D5 pin on the Adafruit STM32F405 Feather.

References
**********

 - VCNL4040: https://www.vishay.com/docs/84274/vcnl4040.pdf

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

 This project outputs sensor data to the console. It requires a VCNL4040
 sensor to be connected to the desired board.

 .. zephyr-app-commands::
    :app: samples/sensor/vcnl4040/
    :goals: build flash


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

 .. code-block:: console

    get device vcnl4040
    Testing the polling mode.
    Proximity: 31
    Light (lux): 288

    <repeats for 5sec every 300ms>

    Polling mode test finished.
    Testing the trigger mode.
    Testing proximity trigger.
    ...
    Triggered.
    Proximity: 122

    <repeats whenever triggered for 5sec>

    Threshold trigger test finished.
    Trigger mode test finished.