
Integrating LVGL embedded graphics library with SSD1306 OLED display on ESP32.
Project goal
Get LVGL working on a 128x64 monochrome OLED display connected to ESP32 with I2C. Quick googling resulted only in outdated libraries. This implementation uses the latest libraries to ensure future proofing.
Main challenge
LVGL outputs pixels in a linear framebuffer format but the display uses page addressing where the screen is divided into 8 horizontal pages of 128x8 pixels. Required implementing a custom flush callback to convert between these formats.
Implementation
- Custom I2C driver for SSD1306 using ESP-IDF’s master driver API
- Multi-threaded FreeRTOS architecture separating rendering, display updates and application logic
- Pixel format conversion algorithm for transforming LVGL’s I1 framebuffer to SSD1306 page format
- Queue based page transmission system for non blocking I2C operations
- Semaphore protected flush pipeline ensuring thread safe rendering