#
# Copyright (c) 2023 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

config BME68X_IAQ
	bool "Use Bosch BSEC library"
	depends on !BME680
	depends on SETTINGS && !SETTINGS_NONE
	select I2C if $(dt_compat_on_bus,$(DT_COMPAT_BOSCH_BME680),i2c)
	select SPI if $(dt_compat_on_bus,$(DT_COMPAT_BOSCH_BME680),spi)
	help
	  Enable the use of Bosch BSEC library.
	  This configuration depends on the BME680 Zephyr driver being disabled.

if BME68X_IAQ

config BME68X_IAQ_SAVE_INTERVAL_MINUTES
	int "Period in minutes after which BSEC state is saved to flash"
	default 60

config BME68X_IAQ_THREAD_STACK_SIZE
	int "BSEC thread stack size"
	default 4096

config BME68X_IAQ_EXPECTED_AMBIENT_TEMP
	int "Expected ambient temperature in C"
	default 25

config BME68X_IAQ_TEMPERATURE_OFFSET
	int "BSEC temperature offset in centidegrees"
	default 200 if BOARD_THINGY91_NRF9160_NS
	default 200 if BOARD_THINGY53_NRF5340_CPUAPP
	default 200 if BOARD_THINGY53_NRF5340_CPUAPP_NS
	default 200 if BOARD_THINGY53_NRF5340_CPUNET
	default 100
	help
	  BSEC temperature offset. To account for external heat sources on the board.
	  The actual value is divided by 100. This is due to the Kconfig parser
	  not supporting floating point types.
	  The default value 200 is translated to 2.0 degrees celsius offset.

choice BME68X_IAQ_SAMPLE_RATE
	prompt "Bosch BSEC sample mode"
	default BME68X_IAQ_SAMPLE_RATE_LOW_POWER
	help
	  Configuration that sets how often sensor data is sampled from the BSEC library.
	  Each mode corresponds an internal preset that decides how often data is sampled from the
	  BME680.

config BME68X_IAQ_SAMPLE_RATE_ULTRA_LOW_POWER
	bool "BSEC low ultra power mode"
	help
	  Sample data from BSEC severy 300 seconds.

config BME68X_IAQ_SAMPLE_RATE_LOW_POWER
	bool "BSEC low power mode"
	help
	  Sample data from BSEC every 3 seconds.

config BME68X_IAQ_SAMPLE_RATE_CONTINUOUS
	bool "BSEC continuous mode"
	help
	  Sample data from BSEC every second.
	  This is a particularly power-hungry sample mode that should only be considered for
	  testing purposes.

config BME68X_IAQ_SAMPLE_RATE_QUICK_ULTRA_LOW_POWER
	bool "BSEC quick ultra low power mode"
	help
	  Sample Gas data every 300 seconds and Temperature, Pressure and Humidity every 3 seconds.

endchoice # BME68X_IAQ_SAMPLE_RATE

module = BME68X_IAQ
module-str = BME68X_IAQ
source "subsys/logging/Kconfig.template.log_config"

endif # BME68X_IAQ
