Skip to content

Commit

Permalink
drivers: sensor: add ScioSense ENS160 driver
Browse files Browse the repository at this point in the history
Add driver for ScioSense ENS160 multi-gas sensor. The driver includes
support for I2C and SPI, attributes for setting temperature and
humidity compensation and data ready trigger.
Also add ScioSense to the list of vendor prefixes.

Signed-off-by: Gustavo Silva <gustavograzs@gmail.com>
  • Loading branch information
ggrs committed Jan 22, 2024
1 parent 6df6935 commit f63121c
Show file tree
Hide file tree
Showing 20 changed files with 999 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/sensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ add_subdirectory_ifdef(CONFIG_CURRENT_AMP current_amp)
add_subdirectory_ifdef(CONFIG_DHT dht)
add_subdirectory_ifdef(CONFIG_DPS310 dps310)
add_subdirectory_ifdef(CONFIG_DS18B20 ds18b20)
add_subdirectory_ifdef(CONFIG_ENS160 ens160)
add_subdirectory_ifdef(CONFIG_ENS210 ens210)
add_subdirectory_ifdef(CONFIG_ESP32_TEMP esp32_temp)
add_subdirectory_ifdef(CONFIG_EXPLORIR_M explorir_m)
Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ source "drivers/sensor/current_amp/Kconfig"
source "drivers/sensor/dht/Kconfig"
source "drivers/sensor/dps310/Kconfig"
source "drivers/sensor/ds18b20/Kconfig"
source "drivers/sensor/ens160/Kconfig"
source "drivers/sensor/ens210/Kconfig"
source "drivers/sensor/esp32_temp/Kconfig"
source "drivers/sensor/explorir_m/Kconfig"
Expand Down
8 changes: 8 additions & 0 deletions drivers/sensor/ens160/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2024 Gustavo Silva
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_sources(ens160.c)
zephyr_library_sources(ens160_i2c.c)
zephyr_library_sources(ens160_spi.c)
zephyr_library_sources_ifdef(CONFIG_ENS160_TRIGGER ens160_trigger.c)
53 changes: 53 additions & 0 deletions drivers/sensor/ens160/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright (c) 2024 Gustavo Silva
# SPDX-License-Identifier: Apache-2.0

menuconfig ENS160
bool "ENS160 multi-gas sensor"
default y
depends on DT_HAS_SCIOSENSE_ENS160_ENABLED
select I2C if $(dt_compat_on_bus,$(DT_COMPAT_SCIOSENSE_ENS160),i2c)
select SPI if $(dt_compat_on_bus,$(DT_COMPAT_SCIOSENSE_ENS160),spi)
help
Enable driver for ENS160 Digital Metal Oxide Multi-Gas Sensor.

if ENS160

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

config ENS160_TRIGGER_NONE
bool "No trigger"

config ENS160_TRIGGER_GLOBAL_THREAD
bool "Use global thread"
depends on GPIO
select ENS160_TRIGGER

config ENS160_TRIGGER_OWN_THREAD
bool "Use own thread"
depends on GPIO
select ENS160_TRIGGER

endchoice # Trigger Mode

config ENS160_TRIGGER
bool

config ENS160_THREAD_PRIORITY
int "Thread priority"
depends on ENS160_TRIGGER_OWN_THREAD && ENS160_TRIGGER
default 10
help
Priority of thread used by the driver to handle interrupts.

config ENS160_THREAD_STACK_SIZE
int "Thread stack size"
depends on ENS160_TRIGGER_OWN_THREAD && ENS160_TRIGGER
default 1024
help
Stack size of thread used by the driver to handle interrupts.

endif # ENS160

0 comments on commit f63121c

Please sign in to comment.