Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some driver test bug fix #59

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion examples/camera/camera_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ int main(int argc, FAR char *argv[])
{
gettimeofday(&now, NULL);
timersub(&now, &start, &delta);
if (timercmp(&delta, &wait, >))
if (timercmp(&delta, &wait, > /* For checkpatch */))
{
printf("Expire time is pasted. GoTo next state.\n");
if (app_state == APP_STATE_BEFORE_CAPTURE)
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 @@ -40,24 +40,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 @@ -776,4 +762,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 @@ -35,15 +35,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 @@ -40,20 +40,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 @@ -635,4 +625,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
6 changes: 3 additions & 3 deletions testing/drivertest/drivertest_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ int32_t adc_read_one_sample(int fd, bool soft_trigger)
}

/****************************************************************************
* Name: test_case_adc
* Name: drivertest_adc
****************************************************************************/

static void test_case_adc(FAR void** state)
static void drivertest_adc(FAR void** state)
{
int fd;
bool succ = false;
Expand Down Expand Up @@ -226,7 +226,7 @@ int main(int argc, FAR char *argv[])
parse_commandline(&adc_state, argc, argv);

const struct CMUnitTest tests[] = {
cmocka_unit_test_prestate(test_case_adc, &adc_state),
cmocka_unit_test_prestate(drivertest_adc, &adc_state),
};

return cmocka_run_group_tests(tests, NULL, NULL);
Expand Down
Loading
Loading