drivers/lcd: Add ST7796 TFT LCD framebuffer driver

Add support for ST7796 TFT LCD controller (320x480). The driver
implements the NuttX framebuffer interface for SPI-connected displays.

Features:
- SPI interface with CONFIG_SPI_CMDDATA for D/C pin control;
- RGB565 (16-bit) and RGB666 (18-bit) color formats;
- Runtime rotation support (0, 90, 180, 270 degrees) via MADCTL;
- Board-provided configuration via st7796_config_s structure;
- Partial screen update via updatearea for efficient rendering;
- Persistent swap buffer to avoid per-frame allocations;
- Proper ST7796S initialization sequence with documented timing;

The driver uses a board-provided configuration structure allowing
flexible setup of resolution, SPI frequency, color depth, and
initial MADCTL value without requiring Kconfig options in the
generic driver.

Architecture changes in this revision as per request:

- Moved internal register commands to .c file (private)
- Moved MADCTL bit definitions to .c file (private)
- Moved struct st7796_cmd_s to .c file (private)
- Converted MADCTL orientation macros to absolute values
- Moved CONFIG_SPI_CMDDATA error check to beginning of file
- Removed duplicated CONFIG_SPI_CMDDATA guards
- Public header contains only board configuration API
- Changed the Kconfig auto-select FB from 'select' to 'depends on'

Tested with LVGL graphics library on STM32H753ZI board (my own port).

Signed-off-by: Vinicius May <vmay.sweden@gmail.com>
This commit is contained in:
vrmay23
2026-02-01 20:38:48 +01:00
committed by Alan C. Assis
parent fc1ae9b7be
commit 96a49bc7f7
6 changed files with 1199 additions and 0 deletions
+4
View File
@@ -145,6 +145,10 @@ if(CONFIG_LCD)
list(APPEND SRCS st7789.c)
endif()
if(CONFIG_LCD_ST7796)
list(APPEND SRCS st7796.c)
endif()
if(CONFIG_LCD_GC9A01)
list(APPEND SRCS gc9a01.c)
endif()
+8
View File
@@ -827,6 +827,14 @@ config LCD_ST7789_DATA_ENDIAN_LITTLE
endif # LCD_ST7789
config LCD_ST7796
bool "ST7796 LCD Display"
default n
depends on SPI
depends on LCD_FRAMEBUFFER
---help---
Enable support for ST7796 LCD display driver.
config LCD_GC9A01
bool "Galaxycore GC9A01 TFT Controller"
default n
+4
View File
@@ -143,6 +143,10 @@ ifeq ($(CONFIG_LCD_ST7789),y)
CSRCS += st7789.c
endif
ifeq ($(CONFIG_LCD_ST7796),y)
CSRCS += st7796.c
endif
ifeq ($(CONFIG_LCD_GC9A01),y)
CSRCS += gc9a01.c
endif
File diff suppressed because it is too large Load Diff