mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 05:42:05 +08:00
xtensa/esp32s3: LCD controller driver
This commit is contained in:
@@ -715,6 +715,16 @@ config ESP32S3_WCL
|
||||
select ARCH_USE_MPU
|
||||
select XTENSA_HAVE_GENERAL_EXCEPTION_HOOKS if BUILD_PROTECTED
|
||||
|
||||
config ESP32S3_LCD
|
||||
bool "LCD"
|
||||
default n
|
||||
select DRIVERS_VIDEO
|
||||
select VIDEO_FB
|
||||
select FB_UPDATE
|
||||
help
|
||||
---help---
|
||||
LCD controller that outputs parallel data and supports RGB interface.
|
||||
|
||||
endmenu # ESP32-S3 Peripheral Selection
|
||||
|
||||
menuconfig ESP32S3_WIFI_BT_COEXIST
|
||||
@@ -1713,6 +1723,153 @@ config ESP32S3_OTG_DEBUG_REGISTER
|
||||
|
||||
endmenu # USB OTG Configuration
|
||||
|
||||
menu "LCD Controller Configuration"
|
||||
depends on ESP32S3_LCD
|
||||
|
||||
menu "LCD Pin Configuration"
|
||||
|
||||
config ESP32S3_LCD_PCLK_PIN
|
||||
int "LCD Pixel Clock Signal Pin"
|
||||
default 9
|
||||
|
||||
config ESP32S3_LCD_VSYNC_PIN
|
||||
int "LCD Vertical Synchronization Pin"
|
||||
default 3
|
||||
|
||||
config ESP32S3_LCD_HSYNC_PIN
|
||||
int "LCD Horizontal Synchronization Pin"
|
||||
default 46
|
||||
|
||||
config ESP32S3_LCD_HE_PIN
|
||||
int "LCD Horizontal Enable Pin"
|
||||
default 17
|
||||
|
||||
config ESP32S3_LCD_DATA0_PIN
|
||||
int "LCD Parallel Output Data Bit-0 Pin"
|
||||
default 10
|
||||
|
||||
config ESP32S3_LCD_DATA1_PIN
|
||||
int "LCD Parallel Output Data Bit-1 Pin"
|
||||
default 11
|
||||
|
||||
config ESP32S3_LCD_DATA2_PIN
|
||||
int "LCD Parallel Output Data Bit-2 Pin"
|
||||
default 12
|
||||
|
||||
config ESP32S3_LCD_DATA3_PIN
|
||||
int "LCD Parallel Output Data Bit-3 Pin"
|
||||
default 13
|
||||
|
||||
config ESP32S3_LCD_DATA4_PIN
|
||||
int "LCD Parallel Output Data Bit-4 Pin"
|
||||
default 14
|
||||
|
||||
config ESP32S3_LCD_DATA5_PIN
|
||||
int "LCD Parallel Output Data Bit-5 Pin"
|
||||
default 21
|
||||
|
||||
config ESP32S3_LCD_DATA6_PIN
|
||||
int "LCD Parallel Output Data Bit-6 Pin"
|
||||
default 47
|
||||
|
||||
config ESP32S3_LCD_DATA7_PIN
|
||||
int "LCD Parallel Output Data Bit-7 Pin"
|
||||
default 48
|
||||
|
||||
config ESP32S3_LCD_DATA8_PIN
|
||||
int "LCD Parallel Output Data Bit-8 Pin"
|
||||
default 45
|
||||
|
||||
config ESP32S3_LCD_DATA9_PIN
|
||||
int "LCD Parallel Output Data Bit-9 Pin"
|
||||
default 38
|
||||
|
||||
config ESP32S3_LCD_DATA10_PIN
|
||||
int "LCD Parallel Output Data Bit-10 Pin"
|
||||
default 39
|
||||
|
||||
config ESP32S3_LCD_DATA11_PIN
|
||||
int "LCD Parallel Output Data Bit-11 Pin"
|
||||
default 40
|
||||
|
||||
config ESP32S3_LCD_DATA12_PIN
|
||||
int "LCD Parallel Output Data Bit-12 Pin"
|
||||
default 41
|
||||
|
||||
config ESP32S3_LCD_DATA13_PIN
|
||||
int "LCD Parallel Output Data Bit-13 Pin"
|
||||
default 42
|
||||
|
||||
config ESP32S3_LCD_DATA14_PIN
|
||||
int "LCD Parallel Output Data Bit-14 Pin"
|
||||
default 2
|
||||
|
||||
config ESP32S3_LCD_DATA15_PIN
|
||||
int "LCD Parallel Output Data Bit-15 Pin"
|
||||
default 1
|
||||
|
||||
endmenu
|
||||
|
||||
menu "LCD Display Configuration"
|
||||
depends on ESP32S3_LCD
|
||||
|
||||
config ESP32S3_LCD_VRES
|
||||
int "LCD Vertical Resolution"
|
||||
default 480
|
||||
|
||||
config ESP32S3_LCD_HRES
|
||||
int "LCD Horizontal Resolution"
|
||||
default 480
|
||||
|
||||
config ESP32S3_LCD_CLOCK_MHZ
|
||||
int "LCD Pixel Clock Frequency in MHz"
|
||||
default 2
|
||||
|
||||
config ESP32S3_LCD_VFRONTPORCH
|
||||
int "LCD Vertical Front Porch"
|
||||
default 40
|
||||
|
||||
config ESP32S3_LCD_VBACKPORCH
|
||||
int "LCD Vertical Back Porch"
|
||||
default 20
|
||||
|
||||
config ESP32S3_LCD_VPULSEWIDTH
|
||||
int "LCD Vertical Pulse Width"
|
||||
default 13
|
||||
|
||||
config ESP32S3_LCD_HFRONTPORCH
|
||||
int "LCD Horizontal Front Porch"
|
||||
default 40
|
||||
|
||||
config ESP32S3_LCD_HBACKPORCH
|
||||
int "LCD Horizontal Back Porch"
|
||||
default 20
|
||||
|
||||
config ESP32S3_LCD_HPULSEWIDTH
|
||||
int "LCD Horizontal Pulse Width"
|
||||
default 15
|
||||
|
||||
config ESP32S3_LCD_BUFFER_LAYERS
|
||||
int "LCD Buffer Layer Number"
|
||||
default 1
|
||||
|
||||
choice
|
||||
prompt "LCD Data Width"
|
||||
default ESP32S3_LCD_DATA_16BIT
|
||||
|
||||
config ESP32S3_LCD_DATA_16BIT
|
||||
bool "16-bit"
|
||||
|
||||
endchoice # LCD Data Width
|
||||
|
||||
endmenu
|
||||
|
||||
config ESP32S3_LCD_REGDEBUG
|
||||
bool "LCD Debug Registers"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Application Image Configuration"
|
||||
|
||||
choice
|
||||
|
||||
@@ -158,6 +158,10 @@ ifeq ($(CONFIG_RTC_DRIVER),y)
|
||||
CHIP_CSRCS += esp32s3_rtc_lowerhalf.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_LCD),y)
|
||||
CHIP_CSRCS += esp32s3_lcd.c
|
||||
endif
|
||||
|
||||
#############################################################################
|
||||
# Espressif HAL for 3rd Party Platforms
|
||||
#############################################################################
|
||||
|
||||
@@ -391,6 +391,47 @@ void esp32s3_dma_wait_idle(int chan, bool tx)
|
||||
while ((waitbits & regval) == 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_dma_set_ext_memblk
|
||||
*
|
||||
* Description:
|
||||
* Configure DMA external memory block size.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
* type - block size type
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_dma_set_ext_memblk(int chan, bool tx,
|
||||
enum esp32s3_dma_ext_memblk_e type)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
if (tx)
|
||||
{
|
||||
val = ((uint32_t)type << DMA_OUT_EXT_MEM_BK_SIZE_CH0_S);
|
||||
|
||||
CLR_GDMA_CH_BITS(DMA_OUT_CONF1_CH0_REG,
|
||||
chan,
|
||||
DMA_OUT_EXT_MEM_BK_SIZE_CH0_M);
|
||||
SET_GDMA_CH_BITS(DMA_OUT_CONF1_CH0_REG, chan, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
val = ((uint32_t)type << DMA_IN_EXT_MEM_BK_SIZE_CH0_S);
|
||||
|
||||
CLR_GDMA_CH_BITS(DMA_IN_CONF1_CH0_REG,
|
||||
chan,
|
||||
DMA_IN_EXT_MEM_BK_SIZE_CH0_M);
|
||||
SET_GDMA_CH_BITS(DMA_IN_CONF1_CH0_REG, chan, val);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_dma_init
|
||||
*
|
||||
|
||||
@@ -104,6 +104,13 @@ enum esp32s3_dma_periph_e
|
||||
ESP32S3_DMA_PERIPH_NUM,
|
||||
};
|
||||
|
||||
enum esp32s3_dma_ext_memblk_e
|
||||
{
|
||||
ESP32S3_DMA_EXT_MEMBLK_16B = 0,
|
||||
ESP32S3_DMA_EXT_MEMBLK_32B = 1,
|
||||
ESP32S3_DMA_EXT_MEMBLK_64B = 2
|
||||
};
|
||||
|
||||
/* DMA descriptor type */
|
||||
|
||||
struct esp32s3_dmadesc_s
|
||||
@@ -230,6 +237,25 @@ void esp32s3_dma_disable(int chan, bool tx);
|
||||
|
||||
void esp32s3_dma_wait_idle(int chan, bool tx);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_dma_set_ext_memblk
|
||||
*
|
||||
* Description:
|
||||
* Configure DMA external memory block size.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
* type - block size type
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_dma_set_ext_memblk(int chan, bool tx,
|
||||
enum esp32s3_dma_ext_memblk_e type);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_dma_init
|
||||
*
|
||||
|
||||
@@ -63,21 +63,32 @@
|
||||
|
||||
void up_idle(void)
|
||||
{
|
||||
#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
|
||||
/* If the system is idle and there are no timer interrupts, then process
|
||||
* "fake" timer interrupts. Hopefully, something will wake up.
|
||||
*/
|
||||
/* Report loop explanation here */
|
||||
|
||||
nxsched_process_timer();
|
||||
#ifdef CONFIG_ESP32S3_SPEED_UP_ISR
|
||||
for (; ; )
|
||||
{
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
|
||||
/* If the system is idle and there are no timer interrupts, then
|
||||
* process "fake" timer interrupts. Hopefully, something will wake up.
|
||||
*/
|
||||
|
||||
nxsched_process_timer();
|
||||
#else
|
||||
|
||||
/* This would be an appropriate place to put some MCU-specific logic to
|
||||
* sleep in a reduced power mode until an interrupt occurs to save power
|
||||
*/
|
||||
/* This would be an appropriate place to put some MCU-specific logic
|
||||
* to sleep in a reduced power mode until an interrupt occurs to save
|
||||
* power.
|
||||
*/
|
||||
|
||||
#if XCHAL_HAVE_INTERRUPTS
|
||||
__asm__ __volatile__ ("waiti 0");
|
||||
#endif
|
||||
# if XCHAL_HAVE_INTERRUPTS
|
||||
__asm__ __volatile__ ("waiti 0");
|
||||
# endif
|
||||
#endif /* CONFIG_SUPPRESS_INTERRUPTS || CONFIG_SUPPRESS_TIMER_INTS */
|
||||
|
||||
#ifdef CONFIG_ESP32S3_SPEED_UP_ISR
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -11,3 +11,14 @@ config ESP32S3_MERGE_BINS
|
||||
device.
|
||||
This is only useful when the path to binary files (e.g. bootloader)
|
||||
is provided via the ESPTOOL_BINDIR variable.
|
||||
|
||||
config ESP32S3_SPEED_UP_ISR
|
||||
bool "Speed up ISR"
|
||||
default n
|
||||
---help---
|
||||
Move ESP32-S3's interrupt, OS timer tick, and scheduler functions
|
||||
from Flash to IRAM. This can speed up interrupt service processing
|
||||
and also reduce reading data from Flash.
|
||||
|
||||
If you run applications that need continue reading data from PSRAM,
|
||||
such as LCD display, please select this option.
|
||||
|
||||
@@ -27,3 +27,5 @@
|
||||
api_vhci_host_send_packet = API_vhci_host_send_packet;
|
||||
api_vhci_host_register_callback = API_vhci_host_register_callback;
|
||||
#endif
|
||||
|
||||
PROVIDE( cache_writeback_addr = Cache_WriteBack_Addr );
|
||||
@@ -88,6 +88,31 @@ SECTIONS
|
||||
*libsched.a:sched_thistask.*(.literal .text .literal.* .text.*)
|
||||
*libsched.a:spinlock.*(.literal .text .literal.* .text.*)
|
||||
|
||||
#ifdef CONFIG_ESP32S3_SPEED_UP_ISR
|
||||
*libarch.a:xtensa_irqdispatch.*(.literal.xtensa_irq_dispatch .text.xtensa_irq_dispatch)
|
||||
*libarch.a:xtensa_switchcontext.*(.literal.up_switch_context .text.up_switch_context)
|
||||
*libarch.a:xtensa_modifyreg32.*(.literal.modifyreg32 .text.modifyreg32)
|
||||
|
||||
*libarch.a:esp32s3_irq.*(.literal.xtensa_int_decode .text.xtensa_int_decode)
|
||||
*libarch.a:esp32s3_timerisr.*(.literal.systimer_isr .text.systimer_isr)
|
||||
*libarch.a:esp32s3_idle.*(.literal.up_idle .text.up_idle)
|
||||
*libarch.a:esp32s3_dma.*(.literal.esp32s3_dma_load .text.esp32s3_dma_load \
|
||||
.literal.esp32s3_dma_enable .text.esp32s3_dma_enable)
|
||||
|
||||
*libsched.a:sched_processtimer.*(.literal.nxsched_process_timer .text.nxsched_process_timer)
|
||||
*libsched.a:clock_initialize.*(.literal.clock_timer .text.clock_timer)
|
||||
*libsched.a:wd_start.*(.literal.wd_timer .text.wd_timer)
|
||||
*libsched.a:sched_roundrobin.*(.literal.nxsched_process_roundrobin .text.nxsched_process_roundrobin)
|
||||
*libsched.a:sched_reprioritizertr.*(.literal.nxsched_reprioritize_rtr .text.nxsched_reprioritize_rtr)
|
||||
*libsched.a:sched_removereadytorun.*(.literal.nxsched_remove_readytorun .text.nxsched_remove_readytorun)
|
||||
*libsched.a:sched_addreadytorun.*(.literal.nxsched_add_readytorun .text.nxsched_add_readytorun)
|
||||
*libsched.a:sched_addprioritized.*(.literal.nxsched_add_prioritized .text.nxsched_add_prioritized)
|
||||
*libsched.a:sched_mergepending.*(.literal.nxsched_merge_pending .text.nxsched_merge_pending)
|
||||
*libsched.a:sched_resumescheduler.*(.literal.nxsched_resume_scheduler .text.nxsched_resume_scheduler)
|
||||
|
||||
*libc.a:bin/sq_remfirst.*(.literal.sq_remfirst .text.sq_remfirst)
|
||||
#endif
|
||||
|
||||
*(.wifirxiram .wifirxiram.*)
|
||||
*(.wifi0iram .wifi0iram.*)
|
||||
*(.wifiorslpiram .wifiorslpiram.*)
|
||||
|
||||
@@ -49,4 +49,30 @@ config ESP32S3_SPIFLASH_LITTLEFS
|
||||
|
||||
endchoice # ESP32S3_SPIFLASH_FS
|
||||
|
||||
config ESP32S3_BOARD_I2C
|
||||
bool
|
||||
default y if ESP32S3_I2C0 || ESP32S3_I2C1
|
||||
|
||||
config ESP32S3_BOARD_IOEXPANDER
|
||||
bool "Enable Board IO Expander"
|
||||
default n
|
||||
depends on ESP32S3_BOARD_I2C
|
||||
---help---
|
||||
Enable board IO expander support, IC is TC9554.
|
||||
|
||||
config ESP32S3_BOARD_LCD
|
||||
bool "Enable Board LCD"
|
||||
default n
|
||||
depends on ESP32S3_LCD
|
||||
select ESP32S3_BOARD_IOEXPANDER
|
||||
---help---
|
||||
Enable board LCD support, IC is GC9503CV.
|
||||
|
||||
config ESP32S3_BOARD_TOUCHPAD
|
||||
bool "Enable Board Touchpad"
|
||||
default n
|
||||
depends on ESP32S3_BOARD_I2C
|
||||
---help---
|
||||
Enable board touchpad support, IC is FT5X06.
|
||||
|
||||
endif # ARCH_BOARD_ESP32S3_LCD_EV
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# 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_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="xtensa"
|
||||
CONFIG_ARCH_BOARD="esp32s3-lcd-ev"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32S3_LCD_EV=y
|
||||
CONFIG_ARCH_CHIP="esp32s3"
|
||||
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||
CONFIG_ARCH_CHIP_ESP32S3WROOM2=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_ASSERTIONS_EXPRESSION=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_ESP32S3_BOARD_LCD=y
|
||||
CONFIG_ESP32S3_DMA=y
|
||||
CONFIG_ESP32S3_I2C0=y
|
||||
CONFIG_ESP32S3_I2C0_SCLPIN=18
|
||||
CONFIG_ESP32S3_I2C0_SDAPIN=8
|
||||
CONFIG_ESP32S3_LCD=y
|
||||
CONFIG_ESP32S3_LCD_CLOCK_MHZ=3
|
||||
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_MM_REGIONS=2
|
||||
CONFIG_NDEBUG=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=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
|
||||
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# 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_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="xtensa"
|
||||
CONFIG_ARCH_BOARD="esp32s3-lcd-ev"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32S3_LCD_EV=y
|
||||
CONFIG_ARCH_CHIP="esp32s3"
|
||||
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||
CONFIG_ARCH_CHIP_ESP32S3WROOM2=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_ASSERTIONS_EXPRESSION=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_ESP32S3_BOARD_LCD=y
|
||||
CONFIG_ESP32S3_BOARD_TOUCHPAD=y
|
||||
CONFIG_ESP32S3_DMA=y
|
||||
CONFIG_ESP32S3_I2C0=y
|
||||
CONFIG_ESP32S3_I2C0_SCLPIN=18
|
||||
CONFIG_ESP32S3_I2C0_SDAPIN=8
|
||||
CONFIG_ESP32S3_LCD=y
|
||||
CONFIG_ESP32S3_LCD_CLOCK_MHZ=3
|
||||
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_LVGLDEMO=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FT5X06_POLLMODE=y
|
||||
CONFIG_FT5X06_SINGLEPOINT=y
|
||||
CONFIG_GRAPHICS_LVGL=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INIT_STACKSIZE=3072
|
||||
CONFIG_INPUT=y
|
||||
CONFIG_INPUT_FT5X06=y
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LV_FONT_MONTSERRAT_20=y
|
||||
CONFIG_LV_MEMCPY_MEMSET_STD=y
|
||||
CONFIG_LV_MEM_CUSTOM=y
|
||||
CONFIG_LV_PORT_USE_FBDEV=y
|
||||
CONFIG_LV_PORT_USE_TOUCHPAD=y
|
||||
CONFIG_LV_TICK_CUSTOM=y
|
||||
CONFIG_LV_TICK_CUSTOM_INCLUDE="port/lv_port_tick.h"
|
||||
CONFIG_LV_USE_DEMO_WIDGETS=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NDEBUG=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=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
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
|
||||
@@ -41,6 +41,18 @@ ifeq ($(CONFIG_WS2812),y)
|
||||
CSRCS += esp32s3_ws2812.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_BOARD_IOEXPANDER),y)
|
||||
CSRCS += esp32s3_ioexpander.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_BOARD_LCD),y)
|
||||
CSRCS += esp32s3_lcd.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_BOARD_TOUCHPAD),y)
|
||||
CSRCS += esp32s3_touchscreen.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
VPATH += :board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
|
||||
#define BUTTON_BOOT 0
|
||||
|
||||
/* I2C Port */
|
||||
|
||||
#define I2C_PORT 0
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
@@ -94,5 +98,99 @@ int board_spiflash_init(void);
|
||||
int board_ws2812_initialize(int devno, int spino, uint16_t nleds);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_lcd_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize LCD.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ESP32S3_LCD) && defined(CONFIG_ESP32S3_BOARD_IOEXPANDER)
|
||||
int board_lcd_initialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_touchscreen_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize touchpad.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32S3_BOARD_TOUCHPAD
|
||||
int board_touchscreen_initialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_ioexpander_set_pin
|
||||
*
|
||||
* Description:
|
||||
* Configure pin mode through the IO expander.
|
||||
*
|
||||
* Input Parameters:
|
||||
* input_mask - pin bit mask which need to be set input, if set pin 0 to
|
||||
* to be input, please make: input_mask = (1 << 0)
|
||||
* output_mask - pin bit mask which need to be set output, if set pin 1 to
|
||||
* to be input, please make: output_mask = (1 << 1)
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32S3_BOARD_IOEXPANDER
|
||||
int board_ioexpander_set_pin(uint8_t input_mask, uint8_t output_mask);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_ioexpander_output
|
||||
*
|
||||
* Description:
|
||||
* Set pin output level through the IO expander.
|
||||
*
|
||||
* Input Parameters:
|
||||
* pin - pin number
|
||||
* level - true for high level, false for low.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32S3_BOARD_IOEXPANDER
|
||||
int board_ioexpander_output(int pin, bool level);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_ioexpander_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize IO expander driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32S3_BOARD_IOEXPANDER
|
||||
int board_ioexpander_initialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_LCD_EV_SRC_ESP32S3_LCD_EV_H */
|
||||
|
||||
@@ -225,6 +225,22 @@ int esp32s3_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_BOARD_LCD
|
||||
ret = board_lcd_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize LCD driver\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_BOARD_TOUCHPAD
|
||||
ret = board_touchscreen_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize touchscreen driver\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.
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-lcd-ev/src/esp32s3_ioexpander.c
|
||||
*
|
||||
* 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 <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "esp32s3_i2c.h"
|
||||
#include "esp32s3-lcd-ev.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define BOARD_IOEXPANDER_I2C_PORT I2C_PORT
|
||||
|
||||
#define BOARD_IOEXPANDER_I2C_ADDR (0x20)
|
||||
#define BOARD_IOEXPANDER_I2C_CLOCK (400 * 1000)
|
||||
|
||||
#define BOARD_IOEXPANDER_SET_DIRECTION (3)
|
||||
#define BOARD_IOEXPANDER_SET_OUTPUT (1)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct ioexpander
|
||||
{
|
||||
struct i2c_master_s *i2c;
|
||||
uint8_t output_val;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const struct i2c_config_s g_i2c_config =
|
||||
{
|
||||
.frequency = BOARD_IOEXPANDER_I2C_CLOCK,
|
||||
.address = BOARD_IOEXPANDER_I2C_ADDR,
|
||||
.addrlen = 7
|
||||
};
|
||||
static struct ioexpander g_ioexpander;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_ioexpander_set_pin
|
||||
*
|
||||
* Description:
|
||||
* Configure pin mode through the IO expander.
|
||||
*
|
||||
* Input Parameters:
|
||||
* input_mask - pin bit mask which need to be set input, if set pin 0 to
|
||||
* to be input, please make: input_mask = (1 << 0)
|
||||
* output_mask - pin bit mask which need to be set output, if set pin 1 to
|
||||
* to be input, please make: output_mask = (1 << 1)
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_ioexpander_set_pin(uint8_t input_mask, uint8_t output_mask)
|
||||
{
|
||||
uint8_t data[2] =
|
||||
{
|
||||
BOARD_IOEXPANDER_SET_DIRECTION, 0
|
||||
};
|
||||
|
||||
if (input_mask & output_mask)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
data[1] |= input_mask;
|
||||
data[1] &= ~output_mask;
|
||||
|
||||
return i2c_write(g_ioexpander.i2c, &g_i2c_config, data, 2);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_ioexpander_output
|
||||
*
|
||||
* Description:
|
||||
* Set pin output level through the IO expander.
|
||||
*
|
||||
* Input Parameters:
|
||||
* pin - pin number
|
||||
* level - true for high level, false for low.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_ioexpander_output(int pin, bool level)
|
||||
{
|
||||
uint8_t data[2] =
|
||||
{
|
||||
BOARD_IOEXPANDER_SET_OUTPUT, 0
|
||||
};
|
||||
|
||||
DEBUGASSERT(pin < 8);
|
||||
|
||||
if (level)
|
||||
{
|
||||
g_ioexpander.output_val |= 1 << pin;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ioexpander.output_val &= ~(1 << pin);
|
||||
}
|
||||
|
||||
data[1] = g_ioexpander.output_val;
|
||||
|
||||
return i2c_write(g_ioexpander.i2c, &g_i2c_config, data, 2);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_ioexpander_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize IO expander driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_ioexpander_initialize(void)
|
||||
{
|
||||
g_ioexpander.i2c = esp32s3_i2cbus_initialize(BOARD_IOEXPANDER_I2C_PORT);
|
||||
if (!g_ioexpander.i2c)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,191 @@
|
||||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-lcd-ev/src/esp32s3_touchscreen.c
|
||||
*
|
||||
* 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 <syslog.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/input/ft5x06.h>
|
||||
|
||||
#include "esp32s3_i2c.h"
|
||||
#include "esp32s3-lcd-ev.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define BOARD_TOUCHSCREEN_I2C_PORT I2C_PORT
|
||||
|
||||
#define BOARD_TOUCHSCREEN_I2C_ADDR (0x38)
|
||||
#define BOARD_TOUCHSCREEN_I2C_CLOCK (400 * 1000)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Ptototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_FT5X06_POLLMODE
|
||||
static int esp32s3_ft5x06_attach(const struct ft5x06_config_s *config,
|
||||
xcpt_t isr, void *arg);
|
||||
static void esp32s3_ft5x06_enable(const struct ft5x06_config_s *config,
|
||||
bool enable);
|
||||
static void esp32s3_ft5x06_clear(const struct ft5x06_config_s *config);
|
||||
#endif
|
||||
static void esp32s3_ft5x06_wakeup(const struct ft5x06_config_s *config);
|
||||
static void esp32s3_ft5x06_nreset(const struct ft5x06_config_s *config,
|
||||
bool state);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const struct ft5x06_config_s g_ft5x06_config =
|
||||
{
|
||||
.address = BOARD_TOUCHSCREEN_I2C_ADDR,
|
||||
.frequency = BOARD_TOUCHSCREEN_I2C_CLOCK,
|
||||
#ifndef CONFIG_FT5X06_POLLMODE
|
||||
.attach = esp32s3_ft5x06_attach,
|
||||
.enable = esp32s3_ft5x06_enable,
|
||||
.clear = esp32s3_ft5x06_clear,
|
||||
#endif
|
||||
.wakeup = esp32s3_ft5x06_wakeup,
|
||||
.nreset = esp32s3_ft5x06_nreset
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_FT5X06_POLLMODE
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_ft5x06_attach
|
||||
*
|
||||
* Description:
|
||||
* Attach an FT5x06 interrupt handler to a GPIO interrupt
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp32s3_ft5x06_attach(const struct ft5x06_config_s *config,
|
||||
xcpt_t isr, void *arg)
|
||||
{
|
||||
/* We do not have interrupt pin in the implementation */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_ft5x06_enable
|
||||
*
|
||||
* Description:
|
||||
* Enable or disable a GPIO interrupt
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s3_ft5x06_enable(const struct ft5x06_config_s *config,
|
||||
bool enable)
|
||||
{
|
||||
/* We do not have interrupt pin in the implementation */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_ft5x06_clear
|
||||
*
|
||||
* Description:
|
||||
* Acknowledge/clear any pending GPIO interrupt
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s3_ft5x06_clear(const struct ft5x06_config_s *config)
|
||||
{
|
||||
/* We do not have interrupt pin in the implementation */
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_ft5x06_wakeup
|
||||
*
|
||||
* Description:
|
||||
* Issue WAKE interrupt to FT5x06 to change the FT5x06 from Hibernate to
|
||||
* Active mode.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s3_ft5x06_wakeup(const struct ft5x06_config_s *config)
|
||||
{
|
||||
/* We do not have access to the WAKE pin in the implementation */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_ft5x06_nreset
|
||||
*
|
||||
* Description:
|
||||
* Control the chip reset pin
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void esp32s3_ft5x06_nreset(const struct ft5x06_config_s *config,
|
||||
bool state)
|
||||
{
|
||||
/* We do not have access to the RESET pin in the implementation */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_touchscreen_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize touchpad.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_touchscreen_initialize(void)
|
||||
{
|
||||
int ret;
|
||||
struct i2c_master_s *i2c;
|
||||
|
||||
i2c = esp32s3_i2cbus_initialize(BOARD_TOUCHSCREEN_I2C_PORT);
|
||||
if (!i2c)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = ft5x06_register(i2c, &g_ft5x06_config, 0);
|
||||
if (ret != 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user