Skip to content

Commit

Permalink
Kconfig: Simplify WANT_XXX definitions
Browse files Browse the repository at this point in the history
Use WANT_ADXL345 and WANT_MPU9250 instead of WANT_SENSOR_ADXL345 and
WANT_SENSOR_MPU9250.  This makes these definitions similar to the
other accelerometer defintions.

Order menu so accelerometers are close to each other in the menu.

Simplify Makefile as Kconfig already assures a symbol will only be
defined if its dependencies are met.

Signed-off-by: Kevin O'Connor <[email protected]>
  • Loading branch information
KevinOConnor committed Dec 12, 2024
1 parent 2b9e041 commit 383b83d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 31 deletions.
44 changes: 21 additions & 23 deletions src/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,15 @@ config WANT_THERMOCOUPLE
bool
depends on HAVE_GPIO_SPI
default y
config WANT_SENSOR_ADXL345
config WANT_ADXL345
bool
depends on HAVE_GPIO_SPI
default y
config WANT_SENSOR_ANGLE
bool
depends on HAVE_GPIO_SPI
default y
config WANT_SENSOR_MPU9250
bool
depends on HAVE_GPIO_I2C
default y
config WANT_LIS2DW
bool
depends on HAVE_GPIO_SPI || HAVE_GPIO_I2C
default y
config WANT_LDC1612
config WANT_MPU9250
bool
depends on HAVE_GPIO_I2C
default y
Expand All @@ -128,6 +120,14 @@ config WANT_ADS1220
bool
depends on HAVE_GPIO_SPI
default y
config WANT_LDC1612
bool
depends on HAVE_GPIO_I2C
default y
config WANT_SENSOR_ANGLE
bool
depends on HAVE_GPIO_SPI
default y
config WANT_SOFTWARE_I2C
bool
depends on HAVE_GPIO && HAVE_GPIO_I2C
Expand All @@ -138,10 +138,8 @@ config WANT_SOFTWARE_SPI
default y
config NEED_SENSOR_BULK
bool
depends on WANT_LIS2DW || WANT_LDC1612 || WANT_HX71X \
|| WANT_ADS1220 || WANT_THERMOCOUPLE \
|| WANT_SENSOR_ADXL345 || WANT_SENSOR_ANGLE \
|| WANT_SENSOR_MPU9250
depends on WANT_ADXL345 || WANT_LIS2DW || WANT_MPU9250 \
|| WANT_HX71X || WANT_ADS1220 || WANT_LDC1612 || WANT_SENSOR_ANGLE
default y
menu "Optional features (to reduce code size)"
depends on HAVE_LIMITED_CODE_SIZE
Expand All @@ -154,27 +152,27 @@ config WANT_DISPLAYS
config WANT_THERMOCOUPLE
bool "Support thermocouple MAX sensors"
depends on HAVE_GPIO_SPI
config WANT_SENSOR_ADXL345
config WANT_ADXL345
bool "Support adxl accelerometers"
depends on HAVE_GPIO_SPI
config WANT_SENSOR_ANGLE
bool "Support angle sensors"
depends on HAVE_GPIO_SPI
config WANT_SENSOR_MPU9250
bool "Support MPU accelerometers"
depends on HAVE_GPIO_I2C
config WANT_LIS2DW
bool "Support lis2dw and lis3dh 3-axis accelerometers"
depends on HAVE_GPIO_SPI || HAVE_GPIO_I2C
config WANT_LDC1612
bool "Support ldc1612 eddy current sensor"
config WANT_MPU9250
bool "Support MPU accelerometers"
depends on HAVE_GPIO_I2C
config WANT_HX71X
bool "Support HX711 and HX717 ADC chips"
depends on WANT_GPIO_BITBANGING
config WANT_ADS1220
bool "Support ADS 1220 ADC chip"
depends on HAVE_GPIO_SPI
config WANT_LDC1612
bool "Support ldc1612 eddy current sensor"
depends on HAVE_GPIO_I2C
config WANT_SENSOR_ANGLE
bool "Support angle sensors"
depends on HAVE_GPIO_SPI
config WANT_SOFTWARE_I2C
bool "Support software based I2C \"bit-banging\""
depends on HAVE_GPIO && HAVE_GPIO_I2C
Expand Down
13 changes: 5 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ src-$(CONFIG_WANT_GPIO_BITBANGING) += buttons.c tmcuart.c neopixel.c \
src-$(CONFIG_WANT_DISPLAYS) += lcd_st7920.c lcd_hd44780.c
src-$(CONFIG_WANT_SOFTWARE_SPI) += spi_software.c
src-$(CONFIG_WANT_SOFTWARE_I2C) += i2c_software.c
src-thermocouple-$(CONFIG_WANT_THERMOCOUPLE) := thermocouple.c
src-adxl345-$(CONFIG_WANT_SENSOR_ADXL345) := sensor_adxl345.c
src-angle-$(CONFIG_WANT_SENSOR_ANGLE) := sensor_angle.c
src-mpu9250-$(CONFIG_WANT_SENSOR_MPU9250) := sensor_mpu9250.c
src-$(CONFIG_HAVE_GPIO_SPI) += $(src-thermocouple-y) $(src-adxl345-y) \
$(src-angle-y)
src-$(CONFIG_HAVE_GPIO_I2C) += $(src-mpu9250-y)
src-$(CONFIG_WANT_THERMOCOUPLE) += thermocouple.c
src-$(CONFIG_WANT_ADXL345) += sensor_adxl345.c
src-$(CONFIG_WANT_LIS2DW) += sensor_lis2dw.c
src-$(CONFIG_WANT_LDC1612) += sensor_ldc1612.c
src-$(CONFIG_WANT_MPU9250) += sensor_mpu9250.c
src-$(CONFIG_WANT_HX71X) += sensor_hx71x.c
src-$(CONFIG_WANT_ADS1220) += sensor_ads1220.c
src-$(CONFIG_WANT_LDC1612) += sensor_ldc1612.c
src-$(CONFIG_WANT_SENSOR_ANGLE) += sensor_angle.c
src-$(CONFIG_NEED_SENSOR_BULK) += sensor_bulk.c

0 comments on commit 383b83d

Please sign in to comment.