# esp-idf-lvgl-esp32c3-st7789 **Repository Path**: lai-shanhai/esp-idf-lvgl-esp32c3-st7789 ## Basic Information - **Project Name**: esp-idf-lvgl-esp32c3-st7789 - **Description**: ESP-IDF v5.0 ST7789 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 2 - **Created**: 2022-11-19 - **Last Updated**: 2026-01-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # esp-idf lvgl ## LVGL Template adaptation to ST7789 on RBG not RGB on ESP-C3-32S-Kit ![demo photo](https://gitee.com/lai-shanhai/esp-idf-lvgl-esp32c3-st7789/raw/master/resource/jpg/IMG_1182.jpg) ## 修改步骤 ### 测试平台 Windows 11 ESP-IDF v5.0 1. 使用git clone --recursive 递归克隆 [梦程MI](https://github.com/dreamcmi) 大佬的git repositories `git clone --recursive https://github.com/dreamcmi/espidf-lvgl-template.git` 如果连接 GitHub 不方便,可以 克隆本仓库 `git clone --recursive https://gitee.com/lai-shanhai/esp-idf-lvgl-esp32c3-st7789.git` 2. 打开 ESP-IDF 5.0 PowerShell 进入到项目目录,设置编码目标 `cd .\esp-idf-lvgl-template` `idf.py set-target esp32c3` 3. idf.py menuconfig 设置开发板的flash 大小, 修改完按S保存,Q退出 ![Serial Flasher config](https://gitee.com/lai-shanhai/esp-idf-lvgl-esp32c3-st7789/raw/master/resource/jpg/01_Serial_flasher_config.png) ![Flash size](https://gitee.com/lai-shanhai/esp-idf-lvgl-esp32c3-st7789/raw/master/resource/jpg/02_Flash_size.png) 4. 使用VS code 打开项目目录,打开main\main.c, 光标移动到 #include "lv_port.h",按F12定位到lv_port.h文件,修改屏幕分辨率,接线引脚 和 显示旋转角度 ![定位lv_port.h](https://gitee.com/lai-shanhai/esp-idf-lvgl-esp32c3-st7789/raw/master/resource/jpg/03_locate_lv_port_h.png) ![修改lv_port.h](https://gitee.com/lai-shanhai/esp-idf-lvgl-esp32c3-st7789/raw/master/resource/jpg/04_edit_lv_port_h.png) 如果屏幕是 RBG像素显示而不是RGB像素的, 需要在 lv_port.c 中,第80行,esp_lcd_panel_invert_color 函数 把 true 改为 false, 是否需要可先编译上传后看效果再改 `#80 esp_lcd_panel_invert_color(panel_handle, false);` 5. 在 ESP-IDF 5.0 PowerShell 中,输入下面的 命令开始编译,并且上传,com8 为开发板连接电脑的端口。 `idf.py build flash -p com8` fork from [梦程MI 的espidf-lvgl-template](https://github.com/dreamcmi/espidf-lvgl-template) [演示视频](https://www.bilibili.com/video/BV1Wg41197ay/?vd_source=4adf53cdbea086b1f796c2090d629855) >本项目参考了 [ESP-BOX](https://github.com/espressif/esp-box)和[ESP-IDF](https://github.com/espressif/esp-idf)。 > >通过使用ESP_LCD组件移植LVGL,总体思路是使用lvgl的图形库绘制bitmap,然后使用`esp_lcd_panel_draw_bitmap`向屏幕发送数据,这样看起来很方便~ > >注意: ESP_LCD组件在ESP-IDF V4.4才开始集成,建议使用4.4分支开发。 > >## LICENSE > >MIT License