mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 09:49:21 +08:00
arm/stm32f401rc-rs485: Add support to WS2812 addressable LED
Signed-off-by: Rodrigo Sim <rcsim10@gmail.com>
This commit is contained in:
parent
60e7a0074d
commit
e16d1218ae
4 changed files with 108 additions and 1 deletions
|
@ -748,6 +748,27 @@ NSH commands::
|
|||
WRITING:
|
||||
0000: 1b5b471b5b30304c1b5b4548656c6c6f 204e75747458 .[G.[00L.[EHello NuttX
|
||||
Test complete
|
||||
nsh>
|
||||
nsh>
|
||||
|
||||
ws2812
|
||||
------
|
||||
|
||||
This configuration sets up the NuttShell (NSH) interface over USB Serial (refer to the usbserial
|
||||
configuration for details). It also enables the driver for an addressable LED WS2812 and the SPI1.
|
||||
The MOSI pin from SPI must be connected to DIN on WS2812 module and the number of LEDs can be
|
||||
configured using CONFIG_WS2812_LED_COUNT.
|
||||
|
||||
|
||||
======= ====
|
||||
WS2812 PINS
|
||||
======= ====
|
||||
DIN PA7
|
||||
======= ====
|
||||
|
||||
NSH commands::
|
||||
|
||||
NuttShell (NSH) NuttX-12.7.0-RC0
|
||||
nsh> ws2812
|
||||
|
||||
|
||||
|
||||
|
|
68
boards/arm/stm32/stm32f401rc-rs485/configs/ws2812/defconfig
Normal file
68
boards/arm/stm32/stm32f401rc-rs485/configs/ws2812/defconfig
Normal file
|
@ -0,0 +1,68 @@
|
|||
#
|
||||
# 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_FPU is not set
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
# CONFIG_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32f401rc-rs485"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_STM32F401RC_RS485=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32"
|
||||
CONFIG_ARCH_CHIP_STM32=y
|
||||
CONFIG_ARCH_CHIP_STM32F401RC=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_IRQBUTTONS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARDCTL_USBDEVCTRL=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=8499
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_CDCACM=y
|
||||
CONFIG_CDCACM_CONSOLE=y
|
||||
CONFIG_EXAMPLES_BUTTONS=y
|
||||
CONFIG_EXAMPLES_BUTTONS_NAME0="SW3"
|
||||
CONFIG_EXAMPLES_BUTTONS_NAME1="SW4"
|
||||
CONFIG_EXAMPLES_BUTTONS_NAME2="SW5"
|
||||
CONFIG_EXAMPLES_BUTTONS_NAMES=y
|
||||
CONFIG_EXAMPLES_BUTTONS_QTD=3
|
||||
CONFIG_EXAMPLES_WS2812=y
|
||||
CONFIG_EXAMPLES_WS2812_DEFAULT_DEV="/dev/leddrv0"
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INPUT=y
|
||||
CONFIG_INPUT_BUTTONS=y
|
||||
CONFIG_INPUT_BUTTONS_LOWER=y
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=98304
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_START_DAY=5
|
||||
CONFIG_START_MONTH=5
|
||||
CONFIG_START_YEAR=2014
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_OTGFS=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
CONFIG_STM32_USART6=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USBDEV=y
|
||||
CONFIG_WS2812=y
|
||||
CONFIG_WS2812_FREQUENCY=9000000
|
||||
CONFIG_WS2812_LED_COUNT=10
|
|
@ -83,6 +83,10 @@
|
|||
#include "stm32_lcd_backpack.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WS2812
|
||||
#include "stm32_ws2812.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -328,5 +332,15 @@ int stm32_bringup(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_WS2812) && defined(CONFIG_WS2812_LED_COUNT)
|
||||
/* Configure and initialize the WS2812 LEDs. */
|
||||
|
||||
ret = board_ws2812_initialize(0, WS2812_SPI, CONFIG_WS2812_LED_COUNT);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: board_ws2812_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -124,6 +124,10 @@
|
|||
GPIO_OUTPUT_SET | GPIO_PORTB | GPIO_PIN5)
|
||||
#endif
|
||||
|
||||
/* WS2812 LEDs SPI */
|
||||
|
||||
#define WS2812_SPI 1
|
||||
|
||||
/* PWM
|
||||
*
|
||||
* The STM32F401RC-RS485 has no real on-board PWM devices, but the board can
|
||||
|
|
Loading…
Reference in a new issue