make userleds work on Arduino Due

- makes the 'leds' example command work:
  - adds code to initialize the /dev/userleds device
  - adds defconfig and docs
This commit is contained in:
Adam Feuer
2023-03-17 17:05:40 -07:00
committed by Xiang Xiao
parent 49fa611fad
commit 447a0bce95
6 changed files with 80 additions and 2 deletions
+6
View File
@@ -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.
@@ -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
@@ -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
@@ -74,4 +74,5 @@ void board_late_initialize(void)
sam_bringup();
}
#endif
@@ -29,13 +29,22 @@
#include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <nuttx/leds/userled.h>
#include "arduino-due.h"
#include <arch/board/board.h>
/****************************************************************************
* 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;
}
@@ -28,12 +28,12 @@
#include <stdbool.h>
#include <debug.h>
#include <arch/board/board.h>
#include "chip.h"
#include "sam_gpio.h"
#include "arduino-due.h"
#include <arch/board/board.h>
#ifndef CONFIG_ARCH_LEDS
/****************************************************************************