add lcd suport

This commit is contained in:
halyssonJr 2025-06-19 17:15:34 -03:00 committed by Xiang Xiao
parent 2ddfab618b
commit 3ecdcf556e
6 changed files with 233 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 */

View file

@ -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.

View file

@ -0,0 +1,101 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_lcd.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#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>
#include "esp32s3_gpio.h"
#include "esp32s3-8048S043.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* External Functions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_lcd_initialize
*
* Description:
* Initialize LCD.
*
* Input Parameters:
* None.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
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
return 0;
}