zephyr/drivers/sensor/sht3xd/Kconfig
Ulf Magnusson eddd98f811 kconfig: Replace some single-symbol 'if's with 'depends on'
I think people might be reading differences into 'if' and 'depends on'
that aren't there, like maybe 'if' being needed to "hide" a symbol,
while 'depends on' just adds a dependency.

There are no differences between 'if' and 'depends on'. 'if' is just a
shorthand for 'depends on'. They work the same when it comes to creating
implicit menus too.

The way symbols get "hidden" is through their dependencies not being
satisfied ('if'/'depends on' get copied up as a dependency on the
prompt).

Since 'if' and 'depends on' are the same, an 'if' with just a single
symbol in it can be replaced with a 'depends on'. IMO, it's best to
avoid 'if' there as a style choice too, because it confuses people into
thinking there's deep Kconfig magic going on that requires 'if'.

Going for 'depends on' can also remove some nested 'if's, which
generates nicer symbol information and docs, because nested 'if's really
are so simple/dumb that they just add the dependencies from both 'if's
to all symbols within.

Replace a bunch of single-symbol 'if's with 'depends on' to despam the
Kconfig files a bit and make it clearer how things work. Also do some
other minor related dependency refactoring.

The replacement isn't complete. Will fix up the rest later. Splitting it
a bit to make it more manageable.

(Everything above is true for choices, menus, and comments as well.)

Detected by tweaking the Kconfiglib parsing code. It's impossible to
detect after parsing, because 'if' turns into 'depends on'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-08 08:32:42 -05:00

107 lines
1.9 KiB
Plaintext

# SHT3xD temperature and humidity sensor configuration options
# Copyright (c) 2016 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
menuconfig SHT3XD
bool "SHT3xD Temperature and Humidity Sensor"
depends on I2C
help
Enable driver for SHT3xD temperature and humidity sensors.
if SHT3XD
choice
prompt "Trigger mode"
default SHT3XD_TRIGGER_NONE
help
Specify the type of triggering to be used by the driver.
config SHT3XD_TRIGGER_NONE
bool "No trigger"
config SHT3XD_TRIGGER_GLOBAL_THREAD
bool "Use global thread"
depends on GPIO
select SHT3XD_TRIGGER
config SHT3XD_TRIGGER_OWN_THREAD
bool "Use own thread"
depends on GPIO
select SHT3XD_TRIGGER
endchoice
config SHT3XD_TRIGGER
bool
config SHT3XD_THREAD_PRIORITY
int "Thread priority"
depends on SHT3XD_TRIGGER_OWN_THREAD
default 10
help
Priority of thread used by the driver to handle interrupts.
config SHT3XD_THREAD_STACK_SIZE
int "Thread stack size"
depends on SHT3XD_TRIGGER_OWN_THREAD
default 1024
help
Stack size of thread used by the driver to handle interrupts.
choice
prompt "Measurement repeatability"
default SHT3XD_REPEATABILITY_HIGH
help
Repeatability modes differ with respect to measurement duration,
noise level and energy consumption.
config SHT3XD_REPEATABILITY_LOW
bool "low"
config SHT3XD_REPEATABILITY_MEDIUM
bool "medium"
config SHT3XD_REPEATABILITY_HIGH
bool "high"
endchoice
choice
prompt "Measurement mode"
default SHT3XD_PERIODIC_MODE
config SHT3XD_SINGLE_SHOT_MODE
bool "single shot"
config SHT3XD_PERIODIC_MODE
bool "periodic data acquisition"
endchoice
choice
prompt "Measurements per second"
default SHT3XD_MPS_1
depends on SHT3XD_PERIODIC_MODE
help
Number of measurements per second.
config SHT3XD_MPS_05
bool "0.5"
config SHT3XD_MPS_1
bool "1"
config SHT3XD_MPS_2
bool "2"
config SHT3XD_MPS_4
bool "4"
config SHT3XD_MPS_10
bool "10"
endchoice
endif # SHT3XD