This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 3ecdcf556e add lcd suport 3ecdcf556e is described below commit 3ecdcf556e68c127598347fb27bc06c190454d69 Author: halyssonJr <halysson1...@gmail.com> AuthorDate: Thu Jun 19 17:15:34 2025 -0300 add lcd suport --- boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig | 7 ++ .../esp32s3/esp32s3-8048S043/configs/lcd/defconfig | 90 +++++++++++++++ .../xtensa/esp32s3/esp32s3-8048S043/src/Make.defs | 4 + .../esp32s3-8048S043/src/esp32s3-8048S043.h | 26 ++++- .../esp32s3/esp32s3-8048S043/src/esp32s3_bringup.c | 8 ++ .../src/{esp32s3-8048S043.h => esp32s3_lcd.c} | 127 +++++++-------------- 6 files changed, 172 insertions(+), 90 deletions(-) diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig b/boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig index c4319bfc56..b74da2e168 100644 --- a/boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig @@ -5,6 +5,13 @@ if ARCH_BOARD_ESP32S3_8048S043 +config ESP32S3_BOARD_LCD + bool "Enable Board LCD" + default n + depends on ESP32S3_LCD + ---help--- + Enable board LCD support. + config ESP32S3_BOARD_TOUCHSCREEN bool "Enable Board Touchscreen" default n diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/configs/lcd/defconfig b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/lcd/defconfig new file mode 100644 index 0000000000..b57872857c --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/configs/lcd/defconfig @@ -0,0 +1,90 @@ +# +# 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_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ARCH="xtensa" +CONFIG_ARCH_BOARD="esp32s3-8048S043" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32S3_8048S043=y +CONFIG_ARCH_CHIP="esp32s3" +CONFIG_ARCH_CHIP_ESP32S3=y +CONFIG_ARCH_CHIP_ESP32S3WROOM1N4=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_XTENSA=y +CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_ESP32S3_BOARD_LCD=y +CONFIG_ESP32S3_DMA=y +CONFIG_ESP32S3_FLASH_FREQ_80M=y +CONFIG_ESP32S3_FLASH_MODE_QIO=y +CONFIG_ESP32S3_LCD=y +CONFIG_ESP32S3_LCD_CLOCK_MHZ=18 +CONFIG_ESP32S3_LCD_DATA0_PIN=8 +CONFIG_ESP32S3_LCD_DATA10_PIN=4 +CONFIG_ESP32S3_LCD_DATA11_PIN=45 +CONFIG_ESP32S3_LCD_DATA12_PIN=48 +CONFIG_ESP32S3_LCD_DATA13_PIN=47 +CONFIG_ESP32S3_LCD_DATA14_PIN=21 +CONFIG_ESP32S3_LCD_DATA15_PIN=14 +CONFIG_ESP32S3_LCD_DATA1_PIN=3 +CONFIG_ESP32S3_LCD_DATA2_PIN=46 +CONFIG_ESP32S3_LCD_DATA3_PIN=9 +CONFIG_ESP32S3_LCD_DATA4_PIN=1 +CONFIG_ESP32S3_LCD_DATA5_PIN=5 +CONFIG_ESP32S3_LCD_DATA6_PIN=6 +CONFIG_ESP32S3_LCD_DATA7_PIN=7 +CONFIG_ESP32S3_LCD_DATA8_PIN=15 +CONFIG_ESP32S3_LCD_DATA9_PIN=16 +CONFIG_ESP32S3_LCD_HBACKPORCH=16 +CONFIG_ESP32S3_LCD_HE_PIN=40 +CONFIG_ESP32S3_LCD_HFRONTPORCH=20 +CONFIG_ESP32S3_LCD_HPULSEWIDTH=30 +CONFIG_ESP32S3_LCD_HRES=800 +CONFIG_ESP32S3_LCD_HSYNC_PIN=39 +CONFIG_ESP32S3_LCD_PCLK_PIN=42 +CONFIG_ESP32S3_LCD_REGDEBUG=y +CONFIG_ESP32S3_LCD_VBACKPORCH=10 +CONFIG_ESP32S3_LCD_VFRONTPORCH=22 +CONFIG_ESP32S3_LCD_VSYNC_PIN=41 +CONFIG_ESP32S3_PSRAM_8M=y +CONFIG_ESP32S3_SPEED_UP_ISR=y +CONFIG_ESP32S3_SPIRAM=y +CONFIG_ESP32S3_SPIRAM_MODE_OCT=y +CONFIG_ESP32S3_SPIRAM_SPEED_80M=y +CONFIG_ESP32S3_UART0=y +CONFIG_EXAMPLES_FB=y +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=3072 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=3072 +CONFIG_INTELHEX_BINARY=y +CONFIG_LINE_MAX=64 +CONFIG_MM_REGIONS=2 +CONFIG_NDEBUG=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=114688 +CONFIG_RAM_START=0x20000000 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=6 +CONFIG_START_MONTH=12 +CONFIG_START_YEAR=2011 +CONFIG_SYSLOG_BUFFER=y +CONFIG_SYSTEM_NSH=y +CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/Make.defs b/boards/xtensa/esp32s3/esp32s3-8048S043/src/Make.defs index bfc8c015b1..2a6a16151c 100644 --- a/boards/xtensa/esp32s3/esp32s3-8048S043/src/Make.defs +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/Make.defs @@ -41,6 +41,10 @@ ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += esp32s3_gpio.c endif +ifeq ($(CONFIG_ESP32S3_BOARD_LCD),y) +CSRCS += esp32s3_lcd.c +endif + ifeq ($(CONFIG_ESP32S3_BOARD_TOUCHSCREEN),y) CSRCS += esp32s3_board_touchsceen.c endif diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h index bdef352e00..43364f0833 100644 --- a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h @@ -44,9 +44,11 @@ * SDA: 19 */ -#define TOUCHSCEEN_ADDR (0x5D) -#define TOUCHSCEEN_CLOCK (400 * 1000) -#define TOUCHSCEEN_INT (-1) +#define TOUCHSCEEN_ADDR (0x5D) +#define TOUCHSCEEN_CLOCK (400 * 1000) +#define TOUCHSCEEN_INT (-1) + +#define ESP32S3_DISPLAY_BCKL (2) /* BOOT Button */ @@ -144,5 +146,23 @@ int board_i2c_init(void); int board_touchscreen_initialize(void); #endif +/**************************************************************************** + * Name: board_lcd_initialize + * + * Description: + * Initialize LCD. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ESP32S3_BOARD_LCD +int board_lcd_initialize(void); +#endif + #endif /* __ASSEMBLY__ */ #endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_SRC_ESP32S3_8048S043_H */ \ No newline at end of file diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_bringup.c index 6aa63bb405..e19570155b 100644 --- a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_bringup.c @@ -255,6 +255,14 @@ int esp32s3_bringup(void) } #endif +#ifdef CONFIG_ESP32S3_BOARD_LCD + ret = board_lcd_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize the LCD\n"); + } +#endif + /* If we got here then perhaps not all initialization was successful, but * at least enough succeeded to bring-up NSH with perhaps reduced * capabilities. diff --git a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_lcd.c similarity index 52% copy from boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h copy to boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_lcd.c index bdef352e00..7c378fd5af 100644 --- a/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h +++ b/boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_lcd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h + * boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_lcd.c * * SPDX-License-Identifier: Apache-2.0 * @@ -20,117 +20,54 @@ * ****************************************************************************/ -#ifndef __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_SRC_ESP32S3_8048S043_H -#define __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_SRC_ESP32S3_8048S043_H - /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> -#include <nuttx/compiler.h> -#include <stdint.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* ESP32-S3-8048S043 GPIOs **************************************************/ -/* Touchpad */ -#define TOUCHSCEEN_I2C 0 +#include <unistd.h> +#include <stdlib.h> +#include <debug.h> +#include <assert.h> +#include <sys/param.h> +#include <nuttx/arch.h> +#include <nuttx/board.h> +#include <nuttx/video/fb.h> +#include <nuttx/signal.h> -/* SCL: 20 - * SDA: 19 - */ - -#define TOUCHSCEEN_ADDR (0x5D) -#define TOUCHSCEEN_CLOCK (400 * 1000) -#define TOUCHSCEEN_INT (-1) - -/* BOOT Button */ - -#define BUTTON_BOOT 0 +#include "esp32s3_gpio.h" +#include "esp32s3-8048S043.h" /**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Data + * Pre-processor Definitions ****************************************************************************/ -#ifndef __ASSEMBLY__ - /**************************************************************************** - * Public Function Prototypes + * Private Types ****************************************************************************/ /**************************************************************************** - * Name: esp32s3_bringup - * - * Description: - * Perform architecture-specific initialization - * - * CONFIG_BOARD_LATE_INITIALIZE=y : - * Called from board_late_initialize(). - * - * CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_BOARDCTL=y : - * Called from the NSH library via board_app_initialize() - * + * External Functions ****************************************************************************/ -int esp32s3_bringup(void); - /**************************************************************************** - * Name: esp32s3_gpio_init - * - * Description: - * Configure the GPIO driver. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * + * Private Data ****************************************************************************/ -#ifdef CONFIG_DEV_GPIO -int esp32s3_gpio_init(void); -#endif - /**************************************************************************** - * Name: board_spiflash_init - * - * Description: - * Initialize the SPIFLASH and register the MTD device. - * + * Private Functions ****************************************************************************/ -#ifdef CONFIG_ESP32S3_SPIFLASH -int board_spiflash_init(void); -#endif - /**************************************************************************** - * Name: board_i2c_init - * - * Description: - * Configure the I2C driver. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * + * Public Functions ****************************************************************************/ -#ifdef CONFIG_I2C_DRIVER -int board_i2c_init(void); -#endif - /**************************************************************************** - * Name: board_touchscreen_initialize + * Name: board_lcd_initialize * * Description: - * Initialize touchscreen. + * Initialize LCD. * * Input Parameters: * None. @@ -140,9 +77,25 @@ int board_i2c_init(void); * ****************************************************************************/ -#ifdef CONFIG_ESP32S3_BOARD_TOUCHSCREEN -int board_touchscreen_initialize(void); +int board_lcd_initialize(void) +{ + int ret; + + esp32s3_configgpio(ESP32S3_DISPLAY_BCKL, OUTPUT); + esp32s3_gpiowrite(ESP32S3_DISPLAY_BCKL, true); + +#ifdef CONFIG_VIDEO_FB + /* Initialize and register the framebuffer driver */ + + ret = fb_register(0, 0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret); + return ret; + } +#else + UNUSED(ret); #endif -#endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_SRC_ESP32S3_8048S043_H */ \ No newline at end of file + return 0; +}