Skip to content

Commit

Permalink
Merge #19944
Browse files Browse the repository at this point in the history
19944: cpu/esp32: add low-level LCD parallel interface using LCD peripheral r=benpicco a=gschorcht

### Contribution description

This PR the implementation of the LCD low-level MCU 8080 parallel interface using the LCD peripheral for ESP32, ESP32-S2 and ESP32-S3 or `periph_gpio_ll` for the ESP32-C3.

### Testing procedure

```
BOARD=esp32s3-wt32-sc01-plus make -C tests/drivers/st77xx flash
```
should work on top of PR #19941. Drawing operations should be much faster.

### Issues/PRs references

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
  • Loading branch information
bors[bot] and gschorcht authored Nov 4, 2023
2 parents 4250c15 + ad9e936 commit 6e7b19f
Show file tree
Hide file tree
Showing 17 changed files with 722 additions and 0 deletions.
1 change: 1 addition & 0 deletions boards/esp32s3-wt32-sc01-plus/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ config BOARD_ESP32S3_WT32_SC01_PLUS

select HAVE_FT5X06
select HAVE_LCD_PARALLEL if MODULE_ST7796
select HAVE_LCD_PARALLEL_LL_MCU if MODULE_ST7796
select HAVE_MTD_SDCARD_DEFAULT
select HAVE_ST7796

Expand Down
1 change: 1 addition & 0 deletions boards/esp32s3-wt32-sc01-plus/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ endif

ifneq (,$(filter st7796,$(USEMODULE)))
USEMODULE += lcd_parallel
USEMODULE += lcd_parallel_ll_mcu
endif

ifneq (,$(filter touch_dev,$(USEMODULE)))
Expand Down
1 change: 1 addition & 0 deletions cpu/esp32/Kconfig.common
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ rsource "bootloader/Kconfig"
rsource "esp-ble-nimble/Kconfig"
rsource "esp-idf/Kconfig"
rsource "esp-idf-api/Kconfig"
rsource "esp-lcd/Kconfig"
rsource "periph/Kconfig"

endif
4 changes: 4 additions & 0 deletions cpu/esp32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ ifneq (, $(filter esp_freertos, $(USEMODULE)))
DIRS += freertos
endif

ifneq (, $(filter esp_lcd, $(USEMODULE)))
DIRS += esp-lcd
endif

ifneq (, $(filter stdio_usb_serial_jtag, $(USEMODULE)))
DIRS += stdio_usb_serial_jtag
endif
Expand Down
6 changes: 6 additions & 0 deletions cpu/esp32/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ ifneq (,$(filter esp_idf_heap,$(USEMODULE)))
USEPKG += tlsf
endif

ifneq (,$(filter lcd_parallel_ll_mcu,$(USEMODULE)))
USEMODULE += esp_lcd
USEMODULE += esp_idf_lcd
USEMODULE += esp_idf_heap
endif

ifneq (,$(filter mtd periph_flashpage,$(USEMODULE)))
USEMODULE += esp_idf_spi_flash
endif
Expand Down
5 changes: 5 additions & 0 deletions cpu/esp32/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ PSEUDOMODULES += esp_hw_counter
PSEUDOMODULES += esp_idf_gpio_hal
PSEUDOMODULES += esp_i2c_hw
PSEUDOMODULES += esp_jtag
PSEUDOMODULES += esp_lcd_gpio
PSEUDOMODULES += esp_rtc_timer_32k
PSEUDOMODULES += esp_spi_ram
PSEUDOMODULES += esp_spi_oct
Expand Down Expand Up @@ -167,6 +168,10 @@ ifneq (,$(filter esp_spi_ram,$(USEMODULE)))
INCLUDES += -I$(ESP32_SDK_DIR)/components/esp_hw_support/include/soc/$(CPU_FAM)
endif

ifneq (,$(filter esp_idf_lcd,$(USEMODULE)))
INCLUDES += -I$(ESP32_SDK_DIR)/components/esp_lcd/include
endif

ifneq (,$(filter esp_idf_spi_flash,$(USEMODULE)))
INCLUDES += -I$(ESP32_SDK_DIR)/components/spi_flash/include
endif
Expand Down
4 changes: 4 additions & 0 deletions cpu/esp32/esp-idf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ ifneq (,$(filter esp_idf_heap,$(USEMODULE)))
DIRS += heap
endif

ifneq (,$(filter esp_idf_lcd,$(USEMODULE)))
DIRS += lcd
endif

ifneq (,$(filter esp_idf_nvs_flash,$(USEMODULE)))
DIRS += nvs_flash
endif
Expand Down
16 changes: 16 additions & 0 deletions cpu/esp32/esp-idf/lcd/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2022 Gunar Schorcht
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#

config MODULE_ESP_IDF_LCD
bool
depends on TEST_KCONFIG
depends on MODULE_ESP_IDF && HAS_ESP_LCD

default y if MODULE_LCD_PARALLEL_LL_MCU

help
ESP-IDF code for peripheral GPIO.
36 changes: 36 additions & 0 deletions cpu/esp32/esp-idf/lcd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
MODULE = esp_idf_lcd

# source files to be compiled for this module
ESP32_SDK_SRC = \
components/esp_lcd/src/esp_lcd_common.c \
components/esp_lcd/src/esp_lcd_panel_io.c \
components/esp_pm/pm_locks.c \
components/soc/$(CPU_FAM)/lcd_periph.c \
#

ifeq (esp32s3,$(CPU_FAM))
ESP32_SDK_SRC += \
components/driver/gdma.c \
components/esp_lcd/src/esp_lcd_panel_io_i80.c \
components/hal/gdma_hal.c \
components/hal/lcd_hal.c \
components/soc/$(CPU_FAM)/gdma_periph.c \
#
else ifneq (,$(filter esp32 esp32s2,$(CPU_FAM)))
ESP32_SDK_SRC = \
components/driver/i2s.c \
components/esp_lcd/src/esp_lcd_panel_io_i2s.c \
components/hal/i2s_hal.c \
#
endif

# additional include pathes required by this module
INCLUDES += -I$(ESP32_SDK_DIR)/components/esp_lcd/include
INCLUDES += -I$(ESP32_SDK_DIR)/components/esp_lcd/interface

include $(RIOTBASE)/Makefile.base

ESP32_SDK_BIN = $(BINDIR)/$(MODULE)

include ../esp_idf.mk
include ../esp_idf_cflags.mk
54 changes: 54 additions & 0 deletions cpu/esp32/esp-lcd/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (c) 2023 Gunar Schorcht
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#

menuconfig MODULE_ESP_LCD
bool "Enable LCD low-level parallel interface driver"
depends on MODULE_LCD
default y if HAVE_LCD_PARALLEL_LL_MCU
help
Enabe the MCU-driven low-level MCU 8080 8-/16-bit parallel interface
driver.

if MODULE_ESP_LCD

config MODULE_ESP_LCD_GPIO
bool "GPIO-driven low-level parallel interface driver"
depends on !CPU_FAM_ESP32 && !CPU_FAM_ESP32S2 && !CPU_FAM_ESP32S3
default y
help
The ESP32x SoC variant used does not have a peripheral for the parallel
low-level interface. However, it can be emulated with special low-level
GPIO operations. It is faster than the GPIO-driven 8-/16-bit parallel
interface implemented in the LCD driver, but requires 4 kByte RAM for
8-bit data bus width and 8 kByte RAM for 16-bit data bus width.

config LCD_WRITE_CLOCK_MHZ
int "LCD write clock rate in MHz"
range 1 80
depends on CPU_FAM_ESP32 || CPU_FAM_ESP32S2 || CPU_FAM_ESP32S3
default 10 if CPU_FAM_ESP32
default 40 if CPU_FAM_ESP32S2
default 20 if CPU_FAM_ESP32S3
help
Defines the clock rate that is used for the LCD write signal. It
depends on used ESP32x SoC variant and used display interface.

config LCD_DATA_BUF_SIZE
int "LCD data buffer size in byte"
depends on CPU_FAM_ESP32 || CPU_FAM_ESP32S2 || CPU_FAM_ESP32S3
default 512
help
Defines the size of the buffers used to write data to the LCD
screen. Since double buffering is used, there are two buffers
of this size. One buffer is used first by the LCD driver to
write the data that needs to be transferred to the LCD, and
one buffer from which the DMA then transfers the data to the
LCD peripherals. This allows data to be written before the
DMA transfer is complete. The larger the buffers, the better
the performance, but the higher the memory requirements.

endif
9 changes: 9 additions & 0 deletions cpu/esp32/esp-lcd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MODULE = esp_lcd

ifneq (,$(filter esp32 esp32s2 esp32s3,$(CPU_FAM)))
SRC = esp_lcd_mcu.c
else
SRC = esp_lcd_gpio.c
endif

include $(RIOTBASE)/Makefile.base
Loading

0 comments on commit 6e7b19f

Please sign in to comment.