drivers/bmx280: rework Kconfig model

This commit is contained in:
Leandro Lanzieri 2021-11-12 14:57:37 +01:00
parent 07ce49e25e
commit ab84ec5134
No known key found for this signature in database
GPG Key ID: F4E9A721761C7593
2 changed files with 32 additions and 8 deletions

View File

@ -5,19 +5,25 @@
# directory for more details. # directory for more details.
# #
choice menuconfig MODULE_BMX280
bool "BMx280 Temperature, pressure and humidity sensors" bool "BMx280 Temperature, pressure and humidity sensors"
optional
depends on TEST_KCONFIG depends on TEST_KCONFIG
help help
The driver supports both BME280 and BMP280 connected either via SPI or The driver supports both BME280 and BMP280 connected either via SPI or
I2C bus. Select one combination. I2C bus. Select one combination.
choice
bool "Sensor variant"
depends on MODULE_BMX280
default MODULE_BME280_I2C if HAVE_BME280_I2C
default MODULE_BME280_SPI if HAVE_BME280_SPI
default MODULE_BMP280_I2C if HAVE_BMP280_I2C
default MODULE_BMP280_SPI if HAVE_BMP280_SPI
config MODULE_BME280_I2C config MODULE_BME280_I2C
bool "BME280 on I2C" bool "BME280 on I2C"
depends on HAS_PERIPH_I2C depends on HAS_PERIPH_I2C
select MODULE_PERIPH_I2C select MODULE_PERIPH_I2C
select MODULE_BMX280
config MODULE_BME280_SPI config MODULE_BME280_SPI
bool "BME280 on SPI" bool "BME280 on SPI"
@ -25,13 +31,11 @@ config MODULE_BME280_SPI
depends on HAS_PERIPH_GPIO depends on HAS_PERIPH_GPIO
select MODULE_PERIPH_SPI select MODULE_PERIPH_SPI
select MODULE_PERIPH_GPIO select MODULE_PERIPH_GPIO
select MODULE_BMX280
config MODULE_BMP280_I2C config MODULE_BMP280_I2C
bool "BMP280 on I2C" bool "BMP280 on I2C"
depends on HAS_PERIPH_I2C depends on HAS_PERIPH_I2C
select MODULE_PERIPH_I2C select MODULE_PERIPH_I2C
select MODULE_BMX280
config MODULE_BMP280_SPI config MODULE_BMP280_SPI
bool "BMP280 on SPI" bool "BMP280 on SPI"
@ -39,10 +43,29 @@ config MODULE_BMP280_SPI
depends on HAS_PERIPH_GPIO depends on HAS_PERIPH_GPIO
select MODULE_PERIPH_SPI select MODULE_PERIPH_SPI
select MODULE_PERIPH_GPIO select MODULE_PERIPH_GPIO
select MODULE_BMX280
endchoice endchoice
config MODULE_BMX280 config HAVE_BME280_I2C
bool bool
depends on TEST_KCONFIG select MODULE_BMX280 if MODULE_SAUL_DEFAULT
help
Indicates that a bme280 is present on the I2C bus.
config HAVE_BME280_SPI
bool
select MODULE_BMX280 if MODULE_SAUL_DEFAULT
help
Indicates that a bme280 is present on the SPI bus.
config HAVE_BMP280_I2C
bool
select MODULE_BMX280 if MODULE_SAUL_DEFAULT
help
Indicates that a bmp280 is present on the I2C bus.
config HAVE_BMP280_SPI
bool
select MODULE_BMX280 if MODULE_SAUL_DEFAULT
help
Indicates that a bmp280 is present on the SPI bus.

View File

@ -1,5 +1,6 @@
# this file enables modules defined in Kconfig. Do not use this file for # this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration. # application configuration. This is only needed during migration.
CONFIG_MODULE_BMX280=y
CONFIG_MODULE_BME280_I2C=y CONFIG_MODULE_BME280_I2C=y
CONFIG_MODULE_FMT=y CONFIG_MODULE_FMT=y
CONFIG_MODULE_XTIMER=y CONFIG_MODULE_XTIMER=y