diff --git a/boards/arm/sam34/arduino-due/README.txt b/boards/arm/sam34/arduino-due/README.txt index 18e0b0e3064..6d07cc46e3c 100644 --- a/boards/arm/sam34/arduino-due/README.txt +++ b/boards/arm/sam34/arduino-due/README.txt @@ -861,3 +861,9 @@ Configuration sub-directories STATUS: 2013-7-2: TSC is not responding. All 0's received on SPI. + + nsh-leds: + This configuration directory will build the NuttX Shell and enable the user + LEDS (/dev/userleds). It will also enable the LED example program (leds). + Running the leds command will start up an LED daemon which will light up the + L (user), TX, and RX LEDs in a binary sequence. \ No newline at end of file diff --git a/boards/arm/sam34/arduino-due/configs/nsh-leds/defconfig b/boards/arm/sam34/arduino-due/configs/nsh-leds/defconfig new file mode 100644 index 00000000000..539d5cf8bfc --- /dev/null +++ b/boards/arm/sam34/arduino-due/configs/nsh-leds/defconfig @@ -0,0 +1,47 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_ARCH_LEDS is not set +# CONFIG_ARCH_RAMFUNCS is not set +# CONFIG_READLINE_ECHO is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="arduino-due" +CONFIG_ARCH_BOARD_ARDUINO_DUE=y +CONFIG_ARCH_CHIP="sam34" +CONFIG_ARCH_CHIP_ATSAM3X8E=y +CONFIG_ARCH_CHIP_SAM34=y +CONFIG_ARCH_CHIP_SAM3X=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARD_LATE_INITIALIZE=y +CONFIG_BOARD_LOOPSPERMSEC=6965 +CONFIG_BUILTIN=y +CONFIG_DEV_ZERO=y +CONFIG_EXAMPLES_LEDS=y +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_MM_REGIONS=3 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=65536 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=28 +CONFIG_START_MONTH=6 +CONFIG_START_YEAR=2013 +CONFIG_SYSTEM_NSH=y +CONFIG_TASK_NAME_SIZE=32 +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_USERLED=y +CONFIG_USERLED_LOWER=y diff --git a/boards/arm/sam34/arduino-due/include/board.h b/boards/arm/sam34/arduino-due/include/board.h index ddb88d84181..dab441f593e 100644 --- a/boards/arm/sam34/arduino-due/include/board.h +++ b/boards/arm/sam34/arduino-due/include/board.h @@ -147,6 +147,8 @@ * GPIO output to low. */ +#define LED_DRIVER_PATH "/dev/userleds" + /* LED index values for use with board_userled() */ #define BOARD_LED_L 0 diff --git a/boards/arm/sam34/arduino-due/src/sam_boot.c b/boards/arm/sam34/arduino-due/src/sam_boot.c index d7419eed8bb..b49578bfaa9 100644 --- a/boards/arm/sam34/arduino-due/src/sam_boot.c +++ b/boards/arm/sam34/arduino-due/src/sam_boot.c @@ -74,4 +74,5 @@ void board_late_initialize(void) sam_bringup(); } + #endif diff --git a/boards/arm/sam34/arduino-due/src/sam_bringup.c b/boards/arm/sam34/arduino-due/src/sam_bringup.c index 7641ac32c3a..ab173232925 100644 --- a/boards/arm/sam34/arduino-due/src/sam_bringup.c +++ b/boards/arm/sam34/arduino-due/src/sam_bringup.c @@ -29,13 +29,22 @@ #include #include +#include #include "arduino-due.h" +#include + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +#undef HAVE_LEDS + +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) +# define HAVE_LEDS 1 +#endif + #if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ defined(CONFIG_MMCSD_SPI) @@ -116,6 +125,19 @@ int sam_bringup(void) } #endif +#ifdef HAVE_LEDS + board_userled_initialize(); + + /* Register the LED driver */ + + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + return ret; + } +#endif + UNUSED(ret); return OK; } diff --git a/boards/arm/sam34/arduino-due/src/sam_userleds.c b/boards/arm/sam34/arduino-due/src/sam_userleds.c index 23cf0294906..d044ec5fcb6 100644 --- a/boards/arm/sam34/arduino-due/src/sam_userleds.c +++ b/boards/arm/sam34/arduino-due/src/sam_userleds.c @@ -28,12 +28,12 @@ #include #include -#include - #include "chip.h" #include "sam_gpio.h" #include "arduino-due.h" +#include + #ifndef CONFIG_ARCH_LEDS /****************************************************************************