Skip to content

Commit

Permalink
drivers: sensor: Add VCNL4040 driver
Browse files Browse the repository at this point in the history
Add support for Vishay VCNL4040 proximity and light sensor

Signed-off-by: Richard Osterloh <[email protected]>
  • Loading branch information
rosterloh authored and MaureenHelm committed Sep 4, 2020
1 parent 2be0086 commit 0a0026a
Show file tree
Hide file tree
Showing 10 changed files with 981 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/sensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ add_subdirectory_ifdef(CONFIG_TH02 th02)
add_subdirectory_ifdef(CONFIG_TMP007 tmp007)
add_subdirectory_ifdef(CONFIG_TMP112 tmp112)
add_subdirectory_ifdef(CONFIG_TMP116 tmp116)
add_subdirectory_ifdef(CONFIG_VCNL4040 vcnl4040)
add_subdirectory_ifdef(CONFIG_VL53L0X vl53l0x)
add_subdirectory_ifdef(CONFIG_TEMP_KINETIS nxp_kinetis_temp)
add_subdirectory_ifdef(CONFIG_TACH_XEC mchp_tach_xec)
Expand Down
2 changes: 2 additions & 0 deletions drivers/sensor/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ source "drivers/sensor/tmp112/Kconfig"

source "drivers/sensor/tmp116/Kconfig"

source "drivers/sensor/vcnl4040/Kconfig"

source "drivers/sensor/vl53l0x/Kconfig"

source "drivers/sensor/nxp_kinetis_temp/Kconfig"
Expand Down
6 changes: 6 additions & 0 deletions drivers/sensor/vcnl4040/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()

zephyr_library_sources_ifdef(CONFIG_VCNL4040 vcnl4040.c)
zephyr_library_sources_ifdef(CONFIG_VCNL4040_TRIGGER vcnl4040_trigger.c)
57 changes: 57 additions & 0 deletions drivers/sensor/vcnl4040/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# VCNL4040 Proximity and Ambient Light Sensor configuration options

# Copyright (c) 2020 Richard Osterloh
# SPDX-License-Identifier: Apache-2.0

menuconfig VCNL4040
bool "VCNL4040 Proximity and Ambient Light Sensor"
depends on I2C && HAS_DTS_I2C && HAS_DTS_GPIO
help
Enable driver for VCNL4040 sensors.

if VCNL4040

config VCNL4040_ENABLE_ALS
bool "Enable ambient light sensor"
help
Enable Ambient Light Sense (ALS).

config VCNL4040_TRIGGER
bool

choice
prompt "Trigger mode"
default VCNL4040_TRIGGER_NONE
help
Specify the type of triggering to be used by the driver.

config VCNL4040_TRIGGER_NONE
bool "No trigger"

config VCNL4040_TRIGGER_GLOBAL_THREAD
bool "Use global thread"
depends on GPIO
select VCNL4040_TRIGGER

config VCNL4040_TRIGGER_OWN_THREAD
bool "Use own thread"
depends on GPIO
select VCNL4040_TRIGGER

endchoice

config VCNL4040_THREAD_PRIORITY
int "Thread priority"
depends on VCNL4040_TRIGGER_OWN_THREAD
default 10
help
Priority of thread used by the driver to handle interrupts.

config VCNL4040_THREAD_STACK_SIZE
int "Thread stack size"
depends on VCNL4040_TRIGGER_OWN_THREAD
default 1024
help
Stack size of thread used by the driver to handle interrupts.

endif # VCNL4040
Loading

0 comments on commit 0a0026a

Please sign in to comment.