apps/exampels/rgb: Make path to driver a configuration option

This commit is contained in:
Gregory Nutt 2016-02-23 07:04:54 -06:00
parent 855d2e70bf
commit 4c10341269
2 changed files with 9 additions and 3 deletions

View File

@ -11,6 +11,10 @@ config EXAMPLES_RGBLED
if EXAMPLES_RGBLED if EXAMPLES_RGBLED
config EXAMPLES_RGBLED_DEVNAME
string "RGB LED device name"
default "/dev/rgbled0"
config EXAMPLES_RGBLED_PROGNAME config EXAMPLES_RGBLED_PROGNAME
string "Program name" string "Program name"
default "rgbled" default "rgbled"

View File

@ -47,7 +47,9 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define RGBLED "/dev/rgb0" #ifndef CONFIG_EXAMPLES_RGBLED_DEVNAME
# define CONFIG_EXAMPLES_RGBLED_DEVNAME "/dev/rgbled0"
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -72,11 +74,11 @@ int rgbled_main(int argc, char *argv[])
int fd; int fd;
char buffer[8]; char buffer[8];
fd = open(RGBLED, O_WRONLY); fd = open(CONFIG_EXAMPLES_RGBLED_DEVNAME, O_WRONLY);
if (fd < 0) if (fd < 0)
{ {
printf("Error opening %s!\n", RGBLED); printf("Error opening %s!\n", CONFIG_EXAMPLES_RGBLED_DEVNAME);
return -1; return -1;
} }