Skip to content

Commit 89d1c52

Browse files
pyhyskartben
authored andcommitted
boards: shields: Add Adafruit VCNL4040 proximity sensor shield
Product photo from https://learn.adafruit.com/assets/78982 with license CC BY-SA 3.0 Tested with command mentioned in the index.rst page. Signed-off-by: Jonas Berg <[email protected]>
1 parent a5107fb commit 89d1c52

File tree

6 files changed

+96
-1
lines changed

6 files changed

+96
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 Jonas Berg
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SHIELD_ADAFRUIT_VCNL4040
5+
def_bool $(shields_list_contains,adafruit_vcnl4040)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (c) 2025 Jonas Berg
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&zephyr_i2c {
8+
status = "okay";
9+
10+
adafruit_vcnl4040: vcnl4040@60 {
11+
compatible = "vishay,vcnl4040";
12+
reg = <0x60>;
13+
};
14+
};
37 KB
Loading
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.. _adafruit_vcnl4040:
2+
3+
Adafruit VCNL4040 Shield
4+
########################
5+
6+
Overview
7+
********
8+
9+
The `Adafruit VCNL4040 Proximity and Lux Sensor Shield`_ features
10+
a `Vishay VCNL4040 Proximity and Lux Sensor`_ and two STEMMA QT connectors.
11+
12+
.. figure:: adafruit_vcnl4040.webp
13+
:align: center
14+
:alt: Adafruit VCNL4040 Shield
15+
16+
Adafruit VCNL4040 Shield (Credit: Adafruit)
17+
18+
19+
Requirements
20+
************
21+
22+
This shield can be used with boards which provide an I2C connector, for
23+
example STEMMA QT or Qwiic connectors.
24+
The target board must define a ``zephyr_i2c`` node label.
25+
See :ref:`shields` for more details.
26+
27+
28+
Pin Assignments
29+
===============
30+
31+
+--------------+------------------------+
32+
| Shield Pin | Function |
33+
+==============+========================+
34+
| SDA | VCNL4040 I2C SDA |
35+
+--------------+------------------------+
36+
| SCL | VCNL4040 I2C SCL |
37+
+--------------+------------------------+
38+
| INT | VCNL4040 interrupt out |
39+
+--------------+------------------------+
40+
41+
In order to use interrupts you need to connect a separate wire from the
42+
shield to a GPIO pin on your microcontroller board. See
43+
:dtcompatible:`vishay,vcnl4040` for documentation on how to adjust the
44+
devicetree file.
45+
46+
Programming
47+
***********
48+
49+
Set ``--shield adafruit_vcnl4040`` when you invoke ``west build``. For example
50+
when running the :zephyr:code-sample:`vcnl4040` proximity and light sample:
51+
52+
.. zephyr-app-commands::
53+
:zephyr-app: samples/sensor/vcnl4040/
54+
:board: adafruit_qt_py_rp2040
55+
:shield: adafruit_vcnl4040
56+
:goals: build
57+
58+
.. _Adafruit VCNL4040 Proximity and Lux Sensor Shield:
59+
https://learn.adafruit.com/adafruit-vcnl4040-proximity-sensor
60+
61+
.. _Vishay VCNL4040 Proximity and Lux Sensor:
62+
https://www.vishay.com/en/product/84274/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) 2025, Jonas Berg
4+
5+
shield:
6+
name: adafruit_vcnl4040
7+
full_name: Adafruit VCNL4040 Proximity and Lux Sensor Shield
8+
vendor: adafruit
9+
supported_features:
10+
- sensor

samples/sensor/vcnl4040/sample.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ sample:
33
tests:
44
sample.sensor.vcnl4040:
55
harness: sensor
6-
platform_allow: adafruit_feather_stm32f405
6+
platform_allow:
7+
- adafruit_feather_stm32f405
8+
- adafruit_qt_py_rp2040/rp2040
79
integration_platforms:
810
- adafruit_feather_stm32f405
11+
extra_args:
12+
- platform:adafruit_qt_py_rp2040/rp2040:SHIELD="adafruit_vcnl4040"
913
tags: sensors
1014
filter: dt_compat_enabled("vishay,vcnl4040")

0 commit comments

Comments
 (0)