You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2025/01/03 13:28:27 UTC

(nuttx-apps) 01/02: examples: Add depends on

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit d404b846f984e5a452cdd9de56a92f4a9fca04a0
Author: zhangshoukui <zh...@xiaomi.com>
AuthorDate: Tue Dec 31 14:48:22 2024 +0800

    examples: Add depends on
    
    Signed-off-by: zhangshoukui <zh...@xiaomi.com>
---
 examples/adxl372_test/Kconfig        |  1 +
 examples/apa102/Kconfig              |  1 +
 examples/battery/Kconfig             |  1 +
 examples/bmi160/Kconfig              |  2 ++
 examples/camera/Kconfig              |  1 +
 examples/chrono/Kconfig              |  1 +
 examples/dhtxx/Kconfig               |  1 +
 examples/hdc1008_demo/Kconfig        |  1 +
 examples/hidkbd/Kconfig              |  1 +
 examples/ina219/Kconfig              |  1 +
 examples/ina226/Kconfig              |  1 +
 examples/isl29023/Kconfig            |  1 +
 examples/lp503x/Kconfig              |  1 +
 examples/lsm330spi_test/Kconfig      |  1 +
 examples/pca9635/Kconfig             |  1 +
 examples/powerled/Kconfig            |  2 ++
 examples/powerled/powerled_main.c    | 15 -----------
 examples/powermonitor/Kconfig        |  1 +
 examples/rfid_readuid/Kconfig        |  1 +
 examples/rfid_readuid/rfid_readuid.c |  5 ----
 examples/slcd/Kconfig                |  1 +
 examples/smps/Kconfig                |  2 ++
 examples/smps/smps_main.c            | 11 --------
 examples/ws2812/Kconfig              |  1 +
 examples/xbc_test/Kconfig            |  2 ++
 examples/xbc_test/xbc_test_main.c    | 52 +++++++++++++++++-------------------
 26 files changed, 51 insertions(+), 58 deletions(-)

diff --git a/examples/adxl372_test/Kconfig b/examples/adxl372_test/Kconfig
index 9f04a5797..80189ea34 100644
--- a/examples/adxl372_test/Kconfig
+++ b/examples/adxl372_test/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_ADXL372_TEST
 	tristate "ADXL372 test program"
 	default n
+	depends on SENSORS_ADXL372
 	---help---
 		Enable the ADXL372 sensor SPI test program.
 
diff --git a/examples/apa102/Kconfig b/examples/apa102/Kconfig
index 9494a7446..6a896cf83 100644
--- a/examples/apa102/Kconfig
+++ b/examples/apa102/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_APA102
 	tristate "APA102 LED Strip example"
 	default n
+	depends on LCD_APA102
 	---help---
 		Enable the APA102 example
 
diff --git a/examples/battery/Kconfig b/examples/battery/Kconfig
index 3e532d3e6..c96e2ec07 100644
--- a/examples/battery/Kconfig
+++ b/examples/battery/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_BATTERY
 	tristate "Battery monitor example"
 	default n
+	depends on BATTERY_CHARGER || BATTERY_GAUGE || BATTERY_MONITOR
 	---help---
 		Enable the battery monitor example
 
diff --git a/examples/bmi160/Kconfig b/examples/bmi160/Kconfig
index a850a5887..f97b18f44 100644
--- a/examples/bmi160/Kconfig
+++ b/examples/bmi160/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_SIXAXIS
 	bool "BMI160 sensor example"
 	default n
+	depends on SENSORS_BMG160
 	---help---
 		Enable the 6 axis sensor example
 
@@ -14,6 +15,7 @@ if EXAMPLES_SIXAXIS
 config EXAMPLES_SIXAXIS_UORB
 	bool "BMI160 sensor uorb example"
 	default n
+	depends on SENSORS_BMI160_UORB
 	---help---
 		Enables Work with the UORB or Character Device interface.
 		If not set, the Character Device is used by default.
diff --git a/examples/camera/Kconfig b/examples/camera/Kconfig
index ab9532f47..4c29ed082 100644
--- a/examples/camera/Kconfig
+++ b/examples/camera/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_CAMERA
 	tristate "Camera example"
 	default n
+	depends on DRIVERS_VIDEO
 	---help---
 		Enable the camera example
 
diff --git a/examples/chrono/Kconfig b/examples/chrono/Kconfig
index 26c02ee44..866bc660a 100644
--- a/examples/chrono/Kconfig
+++ b/examples/chrono/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_CHRONO
 	tristate "Chronometer example to use with STM32LDiscover"
 	default n
+	depends on SLCD
 	---help---
 		Enable the Chronometer example
 
diff --git a/examples/dhtxx/Kconfig b/examples/dhtxx/Kconfig
index 7489520a2..f664637f4 100644
--- a/examples/dhtxx/Kconfig
+++ b/examples/dhtxx/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_DHTXX
 	tristate "Dhtxx sensor example"
 	default n
+	depends on SENSORS_DHTXX
 	---help---
 		Enable the dhtxx sensor example
 
diff --git a/examples/hdc1008_demo/Kconfig b/examples/hdc1008_demo/Kconfig
index a52b254f4..f23482606 100644
--- a/examples/hdc1008_demo/Kconfig
+++ b/examples/hdc1008_demo/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_HDC1008
 	tristate "HDC1008 driver example"
 	default n
+	depends on SENSORS_HDC1008
 	---help---
 		Enable the example application
 
diff --git a/examples/hidkbd/Kconfig b/examples/hidkbd/Kconfig
index 0046c36bd..c80d40943 100644
--- a/examples/hidkbd/Kconfig
+++ b/examples/hidkbd/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_HIDKBD
 	tristate "USB HID keyboard example"
 	default n
+	depends on USBHOST_HIDKBD
 	---help---
 		Enable the USB HID keyboard example
 
diff --git a/examples/ina219/Kconfig b/examples/ina219/Kconfig
index c5fd86059..bdb3a2561 100644
--- a/examples/ina219/Kconfig
+++ b/examples/ina219/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_INA219
 	tristate "INA219 example"
 	default n
+	depends on SENSORS_INA219
 	---help---
 		Enable the INA219 example
 
diff --git a/examples/ina226/Kconfig b/examples/ina226/Kconfig
index 289b30b5b..55e24b0e8 100644
--- a/examples/ina226/Kconfig
+++ b/examples/ina226/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_INA226
 	tristate "INA226 example"
 	default n
+	depends on SENSORS_INA226
 	---help---
 		Enable the INA226 example
 
diff --git a/examples/isl29023/Kconfig b/examples/isl29023/Kconfig
index 3999d8f33..001570c08 100644
--- a/examples/isl29023/Kconfig
+++ b/examples/isl29023/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_ISL29023
 	tristate "ISL29023 driver example"
 	default n
+	depends on SENSORS_ISL29023
 	---help---
 		Enable the example application
 
diff --git a/examples/lp503x/Kconfig b/examples/lp503x/Kconfig
index e2ce1cf1d..394105d47 100644
--- a/examples/lp503x/Kconfig
+++ b/examples/lp503x/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_LP503X
 	tristate "LP503X PWM LED example"
 	default n
+	depends on LP503X
 	---help---
 		Enable the LP503X example
 
diff --git a/examples/lsm330spi_test/Kconfig b/examples/lsm330spi_test/Kconfig
index 5f5efee8d..a245ba02a 100644
--- a/examples/lsm330spi_test/Kconfig
+++ b/examples/lsm330spi_test/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_LSM330SPI_TEST
 	tristate "LSM330 SPI test program"
 	default n
+	depends on SENSORS_LSM330SPI
 	---help---
 		Enable the LSM330 sensor SPI test program.
 
diff --git a/examples/pca9635/Kconfig b/examples/pca9635/Kconfig
index b406017a5..631420d78 100644
--- a/examples/pca9635/Kconfig
+++ b/examples/pca9635/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_PCA9635
 	tristate "PCA9635 PWM LED example"
 	default n
+	depends on PCA9635PW
 	---help---
 		Enable the PCA9635 example
 
diff --git a/examples/powerled/Kconfig b/examples/powerled/Kconfig
index f3056adb0..f625d0da4 100644
--- a/examples/powerled/Kconfig
+++ b/examples/powerled/Kconfig
@@ -6,6 +6,8 @@
 config EXAMPLES_POWERLED
 	tristate "Powerled example"
 	default n
+	depends on DRIVERS_POWERLED
+	depends on LIBC_FLOATINGPOINT
 	---help---
 		Enable the powerled driver example
 
diff --git a/examples/powerled/powerled_main.c b/examples/powerled/powerled_main.c
index 4df021b4b..d2eda1707 100644
--- a/examples/powerled/powerled_main.c
+++ b/examples/powerled/powerled_main.c
@@ -42,24 +42,10 @@
 
 #include <nuttx/power/powerled.h>
 
-#if defined(CONFIG_EXAMPLES_POWERLED)
-
-#ifndef CONFIG_DRIVERS_POWERLED
-#  error "Powerled example requires powerled support"
-#endif
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
 
-#ifndef CONFIG_EXAMPLES_POWERLED_CURRENT_LIMIT
-#  error "LED current limit must be set!"
-#endif
-
-#ifndef CONFIG_LIBC_FLOATINGPOINT
-#  error "CONFIG_LIBC_FLOATINGPOINT must be set!"
-#endif
-
 #define DEMO_CONT_BRIGHTNESS_MAX   100.0
 #define DEMO_CONT_BRIGHTNESS_MIN   0.0
 #define DEMO_CONT_BRIGHTNESS_STEP  10.0
@@ -778,4 +764,3 @@ errout:
   return 0;
 }
 
-#endif /* CONFIG_EXAMPLE_POWERLED */
diff --git a/examples/powermonitor/Kconfig b/examples/powermonitor/Kconfig
index e483247c0..05abcb523 100644
--- a/examples/powermonitor/Kconfig
+++ b/examples/powermonitor/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_POWERMONITOR
 	tristate "LTC4151 powermonitor example"
 	default n
+	depends on SENSORS_LTC4151
 
 if EXAMPLES_POWERMONITOR
 endif # EXAMPLES_POWERMONITOR
diff --git a/examples/rfid_readuid/Kconfig b/examples/rfid_readuid/Kconfig
index e117062b9..1c08ba6cc 100644
--- a/examples/rfid_readuid/Kconfig
+++ b/examples/rfid_readuid/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_RFID_READUID
 	tristate "RFID Read UID example"
 	default n
+	depends on CL_MFRC522
 	---help---
 		Enable the RFID READUID example
 
diff --git a/examples/rfid_readuid/rfid_readuid.c b/examples/rfid_readuid/rfid_readuid.c
index d97c058da..0f1521d3e 100644
--- a/examples/rfid_readuid/rfid_readuid.c
+++ b/examples/rfid_readuid/rfid_readuid.c
@@ -37,15 +37,10 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#ifndef CONFIG_CL_MFRC522
-#  error "CONFIG_CL_MFRC522 is not defined in the configuration"
-#endif
-
 #ifndef CONFIG_EXAMPLES_RFID_READUID_DEVNAME
 #  define CONFIG_EXAMPLES_RFID_READUID_DEVNAME "/dev/rfid0"
 #endif
 
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
diff --git a/examples/slcd/Kconfig b/examples/slcd/Kconfig
index 98b25c5da..c55478b33 100644
--- a/examples/slcd/Kconfig
+++ b/examples/slcd/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_SLCD
 	tristate "Segment LCD test"
 	default n
+	depends on SLCD
 	---help---
 		Enables a simple test of an alphanumer, segment LCD
 
diff --git a/examples/smps/Kconfig b/examples/smps/Kconfig
index 2d45b0ebd..a89936405 100644
--- a/examples/smps/Kconfig
+++ b/examples/smps/Kconfig
@@ -5,6 +5,8 @@
 
 config EXAMPLES_SMPS
 	tristate "Smps example"
+	depends on DRIVERS_SMPS
+	depends on LIBC_FLOATINGPOINT
 
 if EXAMPLES_SMPS
 
diff --git a/examples/smps/smps_main.c b/examples/smps/smps_main.c
index 994331558..5c12651ef 100644
--- a/examples/smps/smps_main.c
+++ b/examples/smps/smps_main.c
@@ -42,20 +42,10 @@
 #include <nuttx/fs/fs.h>
 #include <nuttx/power/smps.h>
 
-#if defined(CONFIG_EXAMPLES_SMPS)
-
-#ifndef CONFIG_DRIVERS_SMPS
-#  error "Smps example requires smps support"
-#endif
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
 
-#ifndef CONFIG_LIBC_FLOATINGPOINT
-#  error "CONFIG_LIBC_FLOATINGPOINT must be set!"
-#endif
-
 #ifndef CONFIG_EXAMPLES_SMPS_TIME_DEFAULT
 #  define CONFIG_EXAMPLES_SMPS_TIME_DEFAULT 10
 #endif
@@ -637,4 +627,3 @@ errout:
   return 0;
 }
 
-#endif /* CONFIG_EXAMPLE_SMPS */
diff --git a/examples/ws2812/Kconfig b/examples/ws2812/Kconfig
index c01fb20f2..67e6248b9 100644
--- a/examples/ws2812/Kconfig
+++ b/examples/ws2812/Kconfig
@@ -6,6 +6,7 @@
 config EXAMPLES_WS2812
 	tristate "ws2812 Demo Program"
 	default n
+	depends on WS2812
 	---help---
 		Enable the ws2812 demo
 
diff --git a/examples/xbc_test/Kconfig b/examples/xbc_test/Kconfig
index 99f99f7e4..d7b3d572a 100644
--- a/examples/xbc_test/Kconfig
+++ b/examples/xbc_test/Kconfig
@@ -6,6 +6,8 @@
 config EXAMPLES_XBC_TEST
 	tristate "XBox Controller Test example"
 	default n
+	depends on USBHOST
+	depends on !USBHOST_INT_DISABLE
 	---help---
 		Enable the XBox Controller Test example
 
diff --git a/examples/xbc_test/xbc_test_main.c b/examples/xbc_test/xbc_test_main.c
index 691747e06..28096c606 100644
--- a/examples/xbc_test/xbc_test_main.c
+++ b/examples/xbc_test/xbc_test_main.c
@@ -53,17 +53,6 @@
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
-/* Configuration ************************************************************/
-
-/* Sanity checking */
-
-#ifndef CONFIG_USBHOST
-#  error "CONFIG_USBHOST is not defined"
-#endif
-
-#ifdef CONFIG_USBHOST_INT_DISABLE
-#  error "Interrupt endpoints are disabled (CONFIG_USBHOST_INT_DISABLE)"
-#endif
 
 /* Provide some default values for other configuration settings */
 
@@ -89,7 +78,7 @@ int main(int argc, FAR char *argv[])
    * controller test.
    */
 
-  for (;;)
+  for (; ; )
     {
       /* Open the controller device.  Loop until the device is successfully
        * opened.
@@ -122,24 +111,33 @@ int main(int argc, FAR char *argv[])
             {
               /* On success, echo the buffer to stdout */
 
-	      printf("%d bytes read\n", nbytes);
-	      if (nbytes == sizeof(struct xbox_controller_buttonstate_s))
-		{
-		  struct xbox_controller_buttonstate_s *rpt = (struct xbox_controller_buttonstate_s*)buffer;
-		  printf("guide: %d  sync: %d  start: %d  back: %d  a: %d  b: %d  x: %d  y: %d\n",
-			 rpt->guide, rpt->sync, rpt->start, rpt->back, rpt->a, rpt->b, rpt->x, rpt->y);
-		  printf("dpad_u: %d  d: %d  l: %d  r: %d  bump_l: %d  r: %d  stick_l: %d  r: %d\n",
-			 rpt->dpad_up, rpt->dpad_down, rpt->dpad_left, rpt->dpad_right,
-			 rpt->bumper_left, rpt->bumper_right, rpt->stick_click_left, rpt->stick_click_right);
-		  printf("stick_left_x: %d  y: %d  right_x: %d  y: %d  trigger_l: %d  r: %d\n",
-			 rpt->stick_left_x, rpt->stick_left_y, rpt->stick_right_x, rpt->stick_right_y,
-			 rpt->trigger_left, rpt->trigger_right);
-		}
-	    }
+              printf("%zd bytes read\n", nbytes);
+              if (nbytes == sizeof(struct xbox_controller_buttonstate_s))
+                {
+                  struct xbox_controller_buttonstate_s *rpt =
+                         (FAR struct xbox_controller_buttonstate_s *)buffer;
+                  printf("guide: %d  sync: %d  start: %d  back: %d
+                          a: %d  b: %d  x: %d  y: %d\n",
+                          rpt->guide, rpt->sync, rpt->start,
+                          rpt->back, rpt->a, rpt->b, rpt->x, rpt->y);
+                  printf("dpad_u: %d  d: %d  l: %d  r: %d  bump_l: %d
+                          r: %d  stick_l: %d  r: %d\n",
+                          rpt->dpad_up, rpt->dpad_down, rpt->dpad_left,
+                          rpt->dpad_right, rpt->bumper_left,
+                          rpt->bumper_right, rpt->stick_click_left,
+                          rpt->stick_click_right);
+                  printf("stick_left_x: %d  y: %d  right_x: %d  y: %d
+                          trigger_l: %d  r: %d\n",
+                          rpt->stick_left_x, rpt->stick_left_y,
+                          rpt->stick_right_x, rpt->stick_right_y,
+                          rpt->trigger_left, rpt->trigger_right);
+                }
+            }
         }
       while (nbytes > 0);
 
-      printf("Closing device %s: %d\n", CONFIG_EXAMPLES_XBC_DEVNAME, (int)nbytes);
+      printf("Closing device %s: %zd\n", CONFIG_EXAMPLES_XBC_DEVNAME,
+              nbytes);
       fflush(stdout);
       close(fd);
       break;