$ show Bodmer/TFT_eSPI
TFT_eSPI is a high-performance, feature-rich graphics library for TFT and ePaper displays on embedded microcontrollers, primarily targeting Arduino-compatible platforms such as ESP8266, ESP32, STM32, and RP2040. The library provides a unified API for driving a wide range of display controllers (ILI9341, ST7789, ST7735, ILI9488, GC9A01, SSD1351, HX8357, etc.) over SPI, 8-bit parallel, or 16-bit parallel interfaces. It includes extensive drawing primitives (lines, circles, arcs, ellipses, polygons, anti-aliased shapes), sprite-based off-screen rendering, touch screen support (XPT2046), a button widget, and a sophisticated anti-aliased (smooth) font system that can load fonts from flash or filesystem (SPIFFS/LittleFS/SD). The library is highly configurable via compile-time defines and user setup files, and it leverages hardware-specific optimizations like DMA transfers, PIO state machines (RP2040), and dual-core processing. It is designed for real-time embedded GUIs, instrumentation, and interactive projects, and is widely used in the maker community.
The LLM identified 4 files worth highlighting for reuse:
Provides a self-contained off-screen framebuffer (sprite) class that supports multiple color depths (1, 4, 8, 16 bits), transparency, rotation, and palette management. It can be used independently of the main TFT display for creating flicker-free animations, complex compositions, and efficient rendering. The code is well-encapsulated with a clean API and can be extracted into other projects with minimal adaptation.
Implements a complete anti-aliased font rendering system that loads .vlw font files from flash, SPIFFS, LittleFS, or SD card. Supports Unicode, variable glyph metrics, gradient backgrounds, and a callback mechanism for custom rendering. The font loading and rendering pipeline is modular, with clear separation between file I/O, glyph caching, and pixel drawing, making it reusable across different display libraries.
A reusable button widget class that handles touch detection, press/release states, and flexible label rendering with any font. It supports datum alignment, rounded corners, and custom colors. The implementation is decoupled from the display driver (uses only basic drawing primitives) and can be ported to any graphics library with minimal changes.
A PIO program for the RP2040 microcontroller that implements an 8-bit parallel display interface using programmable I/O state machines. It offloads timing-critical data writes from the CPU, enabling high-throughput rendering. The program is self-contained, well-commented, and can be reused in other RP2040 projects requiring parallel communication with TFT or other peripherals.