• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

boards/18-Mar-2025-1917

src/18-Mar-2025-149112

CMakeLists.txtD18-Mar-2025190 85

README.rstD18-Mar-20251.4 KiB6041

prj.confD18-Mar-2025128 76

sample.yamlD18-Mar-2025268 1110

README.rst

1.. zephyr:code-sample:: vcml4040
2   :name: VCNL4040 Proximity and Ambient Light Sensor
3   :relevant-api: sensor_interface
4
5   Get proximity and ambient light data from a VCNL4040 sensor (polling & trigger mode).
6
7Overview
8********
9
10 This sample periodically measures proximity and light for
11 5 sec in the interval of 300msec in polling mode. Then threshold trigger mode
12 is enabled with the high threshold value of 127 and data is fetched based
13 on interrupt. The result is displayed on the console.
14
15Requirements
16************
17
18 This sample uses the VCNL4040 sensor controlled using the I2C interface.
19 Connect sensor INT for interrupt to Feather D5 pin on the Adafruit STM32F405 Feather.
20
21References
22**********
23
24 - VCNL4040: https://www.vishay.com/docs/84274/vcnl4040.pdf
25
26Building and Running
27********************
28
29 This project outputs sensor data to the console. It requires a VCNL4040
30 sensor to be connected to the desired board.
31
32 .. zephyr-app-commands::
33    :zephyr-app: samples/sensor/vcnl4040/
34    :goals: build flash
35
36
37Sample Output
38=============
39
40 .. code-block:: console
41
42    get device vcnl4040
43    Testing the polling mode.
44    Proximity: 31
45    Light (lux): 288
46
47    <repeats for 5sec every 300ms>
48
49    Polling mode test finished.
50    Testing the trigger mode.
51    Testing proximity trigger.
52    ...
53    Triggered.
54    Proximity: 122
55
56    <repeats whenever triggered for 5sec>
57
58    Threshold trigger test finished.
59    Trigger mode test finished.
60