Skip to content

Commit 3ecdcf5

Browse files
halyssonJrxiaoxiang781216
authored andcommitted
add lcd suport
1 parent 2ddfab6 commit 3ecdcf5

File tree

6 files changed

+233
-3
lines changed

6 files changed

+233
-3
lines changed

boards/xtensa/esp32s3/esp32s3-8048S043/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55

66
if ARCH_BOARD_ESP32S3_8048S043
77

8+
config ESP32S3_BOARD_LCD
9+
bool "Enable Board LCD"
10+
default n
11+
depends on ESP32S3_LCD
12+
---help---
13+
Enable board LCD support.
14+
815
config ESP32S3_BOARD_TOUCHSCREEN
916
bool "Enable Board Touchscreen"
1017
default n
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#
2+
# This file is autogenerated: PLEASE DO NOT EDIT IT.
3+
#
4+
# You can use "make menuconfig" to make any modifications to the installed .config file.
5+
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
6+
# modifications.
7+
#
8+
# CONFIG_NSH_ARGCAT is not set
9+
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
10+
CONFIG_ARCH="xtensa"
11+
CONFIG_ARCH_BOARD="esp32s3-8048S043"
12+
CONFIG_ARCH_BOARD_COMMON=y
13+
CONFIG_ARCH_BOARD_ESP32S3_8048S043=y
14+
CONFIG_ARCH_CHIP="esp32s3"
15+
CONFIG_ARCH_CHIP_ESP32S3=y
16+
CONFIG_ARCH_CHIP_ESP32S3WROOM1N4=y
17+
CONFIG_ARCH_INTERRUPTSTACK=2048
18+
CONFIG_ARCH_STACKDUMP=y
19+
CONFIG_ARCH_XTENSA=y
20+
CONFIG_BOARD_LOOPSPERMSEC=16717
21+
CONFIG_BUILTIN=y
22+
CONFIG_DEBUG_ASSERTIONS=y
23+
CONFIG_DEBUG_FEATURES=y
24+
CONFIG_DEBUG_FULLOPT=y
25+
CONFIG_DEBUG_SYMBOLS=y
26+
CONFIG_ESP32S3_BOARD_LCD=y
27+
CONFIG_ESP32S3_DMA=y
28+
CONFIG_ESP32S3_FLASH_FREQ_80M=y
29+
CONFIG_ESP32S3_FLASH_MODE_QIO=y
30+
CONFIG_ESP32S3_LCD=y
31+
CONFIG_ESP32S3_LCD_CLOCK_MHZ=18
32+
CONFIG_ESP32S3_LCD_DATA0_PIN=8
33+
CONFIG_ESP32S3_LCD_DATA10_PIN=4
34+
CONFIG_ESP32S3_LCD_DATA11_PIN=45
35+
CONFIG_ESP32S3_LCD_DATA12_PIN=48
36+
CONFIG_ESP32S3_LCD_DATA13_PIN=47
37+
CONFIG_ESP32S3_LCD_DATA14_PIN=21
38+
CONFIG_ESP32S3_LCD_DATA15_PIN=14
39+
CONFIG_ESP32S3_LCD_DATA1_PIN=3
40+
CONFIG_ESP32S3_LCD_DATA2_PIN=46
41+
CONFIG_ESP32S3_LCD_DATA3_PIN=9
42+
CONFIG_ESP32S3_LCD_DATA4_PIN=1
43+
CONFIG_ESP32S3_LCD_DATA5_PIN=5
44+
CONFIG_ESP32S3_LCD_DATA6_PIN=6
45+
CONFIG_ESP32S3_LCD_DATA7_PIN=7
46+
CONFIG_ESP32S3_LCD_DATA8_PIN=15
47+
CONFIG_ESP32S3_LCD_DATA9_PIN=16
48+
CONFIG_ESP32S3_LCD_HBACKPORCH=16
49+
CONFIG_ESP32S3_LCD_HE_PIN=40
50+
CONFIG_ESP32S3_LCD_HFRONTPORCH=20
51+
CONFIG_ESP32S3_LCD_HPULSEWIDTH=30
52+
CONFIG_ESP32S3_LCD_HRES=800
53+
CONFIG_ESP32S3_LCD_HSYNC_PIN=39
54+
CONFIG_ESP32S3_LCD_PCLK_PIN=42
55+
CONFIG_ESP32S3_LCD_REGDEBUG=y
56+
CONFIG_ESP32S3_LCD_VBACKPORCH=10
57+
CONFIG_ESP32S3_LCD_VFRONTPORCH=22
58+
CONFIG_ESP32S3_LCD_VSYNC_PIN=41
59+
CONFIG_ESP32S3_PSRAM_8M=y
60+
CONFIG_ESP32S3_SPEED_UP_ISR=y
61+
CONFIG_ESP32S3_SPIRAM=y
62+
CONFIG_ESP32S3_SPIRAM_MODE_OCT=y
63+
CONFIG_ESP32S3_SPIRAM_SPEED_80M=y
64+
CONFIG_ESP32S3_UART0=y
65+
CONFIG_EXAMPLES_FB=y
66+
CONFIG_FS_PROCFS=y
67+
CONFIG_HAVE_CXX=y
68+
CONFIG_HAVE_CXXINITIALIZE=y
69+
CONFIG_IDLETHREAD_STACKSIZE=3072
70+
CONFIG_INIT_ENTRYPOINT="nsh_main"
71+
CONFIG_INIT_STACKSIZE=3072
72+
CONFIG_INTELHEX_BINARY=y
73+
CONFIG_LINE_MAX=64
74+
CONFIG_MM_REGIONS=2
75+
CONFIG_NDEBUG=y
76+
CONFIG_NSH_ARCHINIT=y
77+
CONFIG_NSH_BUILTIN_APPS=y
78+
CONFIG_NSH_FILEIOSIZE=512
79+
CONFIG_NSH_READLINE=y
80+
CONFIG_PREALLOC_TIMERS=4
81+
CONFIG_RAM_SIZE=114688
82+
CONFIG_RAM_START=0x20000000
83+
CONFIG_RR_INTERVAL=200
84+
CONFIG_SCHED_WAITPID=y
85+
CONFIG_START_DAY=6
86+
CONFIG_START_MONTH=12
87+
CONFIG_START_YEAR=2011
88+
CONFIG_SYSLOG_BUFFER=y
89+
CONFIG_SYSTEM_NSH=y
90+
CONFIG_UART0_SERIAL_CONSOLE=y

boards/xtensa/esp32s3/esp32s3-8048S043/src/Make.defs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ ifeq ($(CONFIG_DEV_GPIO),y)
4141
CSRCS += esp32s3_gpio.c
4242
endif
4343

44+
ifeq ($(CONFIG_ESP32S3_BOARD_LCD),y)
45+
CSRCS += esp32s3_lcd.c
46+
endif
47+
4448
ifeq ($(CONFIG_ESP32S3_BOARD_TOUCHSCREEN),y)
4549
CSRCS += esp32s3_board_touchsceen.c
4650
endif

boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3-8048S043.h

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@
4444
* SDA: 19
4545
*/
4646

47-
#define TOUCHSCEEN_ADDR (0x5D)
48-
#define TOUCHSCEEN_CLOCK (400 * 1000)
49-
#define TOUCHSCEEN_INT (-1)
47+
#define TOUCHSCEEN_ADDR (0x5D)
48+
#define TOUCHSCEEN_CLOCK (400 * 1000)
49+
#define TOUCHSCEEN_INT (-1)
50+
51+
#define ESP32S3_DISPLAY_BCKL (2)
5052

5153
/* BOOT Button */
5254

@@ -144,5 +146,23 @@ int board_i2c_init(void);
144146
int board_touchscreen_initialize(void);
145147
#endif
146148

149+
/****************************************************************************
150+
* Name: board_lcd_initialize
151+
*
152+
* Description:
153+
* Initialize LCD.
154+
*
155+
* Input Parameters:
156+
* None.
157+
*
158+
* Returned Value:
159+
* Zero (OK) on success; a negated errno value on failure.
160+
*
161+
****************************************************************************/
162+
163+
#ifdef CONFIG_ESP32S3_BOARD_LCD
164+
int board_lcd_initialize(void);
165+
#endif
166+
147167
#endif /* __ASSEMBLY__ */
148168
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_8048S043_SRC_ESP32S3_8048S043_H */

boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_bringup.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@ int esp32s3_bringup(void)
255255
}
256256
#endif
257257

258+
#ifdef CONFIG_ESP32S3_BOARD_LCD
259+
ret = board_lcd_initialize();
260+
if (ret < 0)
261+
{
262+
syslog(LOG_ERR, "Failed to initialize the LCD\n");
263+
}
264+
#endif
265+
258266
/* If we got here then perhaps not all initialization was successful, but
259267
* at least enough succeeded to bring-up NSH with perhaps reduced
260268
* capabilities.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/****************************************************************************
2+
* boards/xtensa/esp32s3/esp32s3-8048S043/src/esp32s3_lcd.c
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one or more
7+
* contributor license agreements. See the NOTICE file distributed with
8+
* this work for additional information regarding copyright ownership. The
9+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
10+
* "License"); you may not use this file except in compliance with the
11+
* License. You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18+
* License for the specific language governing permissions and limitations
19+
* under the License.
20+
*
21+
****************************************************************************/
22+
23+
/****************************************************************************
24+
* Included Files
25+
****************************************************************************/
26+
27+
#include <nuttx/config.h>
28+
29+
#include <unistd.h>
30+
#include <stdlib.h>
31+
#include <debug.h>
32+
#include <assert.h>
33+
#include <sys/param.h>
34+
#include <nuttx/arch.h>
35+
#include <nuttx/board.h>
36+
#include <nuttx/video/fb.h>
37+
#include <nuttx/signal.h>
38+
39+
#include "esp32s3_gpio.h"
40+
#include "esp32s3-8048S043.h"
41+
42+
/****************************************************************************
43+
* Pre-processor Definitions
44+
****************************************************************************/
45+
46+
/****************************************************************************
47+
* Private Types
48+
****************************************************************************/
49+
50+
/****************************************************************************
51+
* External Functions
52+
****************************************************************************/
53+
54+
/****************************************************************************
55+
* Private Data
56+
****************************************************************************/
57+
58+
/****************************************************************************
59+
* Private Functions
60+
****************************************************************************/
61+
62+
/****************************************************************************
63+
* Public Functions
64+
****************************************************************************/
65+
66+
/****************************************************************************
67+
* Name: board_lcd_initialize
68+
*
69+
* Description:
70+
* Initialize LCD.
71+
*
72+
* Input Parameters:
73+
* None.
74+
*
75+
* Returned Value:
76+
* Zero (OK) on success; a negated errno value on failure.
77+
*
78+
****************************************************************************/
79+
80+
int board_lcd_initialize(void)
81+
{
82+
int ret;
83+
84+
esp32s3_configgpio(ESP32S3_DISPLAY_BCKL, OUTPUT);
85+
esp32s3_gpiowrite(ESP32S3_DISPLAY_BCKL, true);
86+
87+
#ifdef CONFIG_VIDEO_FB
88+
/* Initialize and register the framebuffer driver */
89+
90+
ret = fb_register(0, 0);
91+
if (ret < 0)
92+
{
93+
syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
94+
return ret;
95+
}
96+
#else
97+
UNUSED(ret);
98+
#endif
99+
100+
return 0;
101+
}

0 commit comments

Comments
 (0)