Skip to content

Commit

Permalink
examples: Add depends on
Browse files Browse the repository at this point in the history
Signed-off-by: zhangshoukui <[email protected]>
  • Loading branch information
Zhangshoukui authored and xiaoxiang781216 committed Jan 3, 2025
1 parent 3668657 commit d404b84
Show file tree
Hide file tree
Showing 26 changed files with 51 additions and 58 deletions.
1 change: 1 addition & 0 deletions examples/adxl372_test/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions examples/apa102/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_APA102
tristate "APA102 LED Strip example"
default n
depends on LCD_APA102
---help---
Enable the APA102 example

Expand Down
1 change: 1 addition & 0 deletions examples/battery/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions examples/bmi160/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_SIXAXIS
bool "BMI160 sensor example"
default n
depends on SENSORS_BMG160
---help---
Enable the 6 axis sensor example

Expand All @@ -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.
Expand Down
1 change: 1 addition & 0 deletions examples/camera/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_CAMERA
tristate "Camera example"
default n
depends on DRIVERS_VIDEO
---help---
Enable the camera example

Expand Down
1 change: 1 addition & 0 deletions examples/chrono/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_CHRONO
tristate "Chronometer example to use with STM32LDiscover"
default n
depends on SLCD
---help---
Enable the Chronometer example

Expand Down
1 change: 1 addition & 0 deletions examples/dhtxx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_DHTXX
tristate "Dhtxx sensor example"
default n
depends on SENSORS_DHTXX
---help---
Enable the dhtxx sensor example

Expand Down
1 change: 1 addition & 0 deletions examples/hdc1008_demo/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_HDC1008
tristate "HDC1008 driver example"
default n
depends on SENSORS_HDC1008
---help---
Enable the example application

1 change: 1 addition & 0 deletions examples/hidkbd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions examples/ina219/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_INA219
tristate "INA219 example"
default n
depends on SENSORS_INA219
---help---
Enable the INA219 example

Expand Down
1 change: 1 addition & 0 deletions examples/ina226/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_INA226
tristate "INA226 example"
default n
depends on SENSORS_INA226
---help---
Enable the INA226 example

Expand Down
1 change: 1 addition & 0 deletions examples/isl29023/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_ISL29023
tristate "ISL29023 driver example"
default n
depends on SENSORS_ISL29023
---help---
Enable the example application

1 change: 1 addition & 0 deletions examples/lp503x/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_LP503X
tristate "LP503X PWM LED example"
default n
depends on LP503X
---help---
Enable the LP503X example

Expand Down
1 change: 1 addition & 0 deletions examples/lsm330spi_test/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions examples/pca9635/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_PCA9635
tristate "PCA9635 PWM LED example"
default n
depends on PCA9635PW
---help---
Enable the PCA9635 example

Expand Down
2 changes: 2 additions & 0 deletions examples/powerled/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 0 additions & 15 deletions examples/powerled/powerled_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -778,4 +764,3 @@ int main(int argc, char *argv[])
return 0;
}

#endif /* CONFIG_EXAMPLE_POWERLED */
1 change: 1 addition & 0 deletions examples/powermonitor/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_POWERMONITOR
tristate "LTC4151 powermonitor example"
default n
depends on SENSORS_LTC4151

if EXAMPLES_POWERMONITOR
endif # EXAMPLES_POWERMONITOR
1 change: 1 addition & 0 deletions examples/rfid_readuid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 0 additions & 5 deletions examples/rfid_readuid/rfid_readuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
****************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions examples/slcd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions examples/smps/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

config EXAMPLES_SMPS
tristate "Smps example"
depends on DRIVERS_SMPS
depends on LIBC_FLOATINGPOINT

if EXAMPLES_SMPS

Expand Down
11 changes: 0 additions & 11 deletions examples/smps/smps_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -637,4 +627,3 @@ int main(int argc, char *argv[])
return 0;
}

#endif /* CONFIG_EXAMPLE_SMPS */
1 change: 1 addition & 0 deletions examples/ws2812/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
config EXAMPLES_WS2812
tristate "ws2812 Demo Program"
default n
depends on WS2812
---help---
Enable the ws2812 demo

Expand Down
2 changes: 2 additions & 0 deletions examples/xbc_test/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
52 changes: 25 additions & 27 deletions examples/xbc_test/xbc_test_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand All @@ -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.
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d404b84

Please sign in to comment.