Giter Site home page Giter Site logo

sukesh-ak / esp32-lvgl8x-sdspi Goto Github PK

View Code? Open in Web Editor NEW
36.0 5.0 7.0 2.73 MB

ESP32 / ESP32-S3 with LVGL widgets using LovyanGFX + SD SPI working with multiple display size support

License: MIT License

CMake 2.62% C++ 57.69% C 38.29% Dockerfile 1.40%
esp-idf esp32 esp32-s3 lovyangfx lvgl

esp32-lvgl8x-sdspi's Introduction

ESP32/ESP32-S3 + ESP-IDF + LVGL8.X + LOVYANGFX

Design adapts to all 3 screen resolution without any code changes.

3 sample configuration included already with just a header file to show how its done easily.

  1. Unexpected Maker FeatherS3 (ESP32-S3) + Adafruit 2.4" TFT Featherwing
  2. Unexpected Maker TinyS3 (ESP32-S3) + 1.3" TFT - ST7789 240x240
  3. Wireless Tag WT32-SC01 (3.5" TFT Touch Display)

Some features included

  • Support for updating UI from different tasks lvgl_acquire/lvgl_release
  • UI code separation into gui.hpp
  • Same UI code which adapts to different resolutions - here
  • Supports shared SPI bus for SD Card - here
  • This Readme below explains how to have same project target different ESP32 controller.
  • Switch between devices using just a header file inclusion - here
  • Add your own controller/display with just a header change - here
  • Shows battery meter animation using timer - here
  • Shows SD card status change with icon
  • Switch theme between Light & Dark - here
  • Scrolling long message in footer - here
  • Rotate screen 180deg here

Demo of LVGL Widgets + SD SPI working together

  1. Unexpected Maker FeatherS3
  2. Adafruit 2.4" TFT Featherwing
  3. LovyanGFX Display & Touch Driver
  4. LVGL 8.3.0 UI Widgets
    photo_2022-09-01_00-25-23

Demo of LVGL Widgets

  1. Unexpected Maker TinyS3
  2. 1.3" TFT - ST7789 240x240
  3. LovyanGFX Display & Touch Driver
  4. LVGL 8.3.0 UI Widgets
    photo_2022-09-01_00-25-01

Demo of LVGL Widgets using Wireless Tag WT32-SC01 with Capacitive Touch

  1. Wireless Tag WT32-SC01 (3.5" TFT Touch Display)
  2. LovyanGFX Display & Touch Driver
  3. LVGL 8.3.0 UI Widgets
    photo_2022-09-01_00-25-07

Get Started

Git clone and recursively update submodule

# Clone repo and update submodules (LovyanGFX + LVGL)
git clone https://github.com/sukesh-ak/LVGL8x-SDSPI.git
cd LVGL8x-SDSPI-Template
git submodule update --init --recursive

# Update submodules (LovyanGFX + LVGL)
git submodule foreach git pull

Separate build folder for ESP32 & ESP32-S3

Check settings in CMakeLists.txt here

WT32-SC01 - ESP32

# set target and build,flash,monitor
idf.py -B build-esp32 set-target esp32 build
idf.py -B build-esp32 -p COM6 flash monitor

FeatherS3 - ESP32-S3

# set target and build,flash,monitor
idf.py -B build-esp32s3 set-target esp32s3 build
idf.py -B build-esp32s3 -p COM3 app-flash monitor

Setup custom lvgl config - ESP-IDF

Check settings in CMakeLists.txt here

#LVGL custom config file setup
idf_build_set_property(COMPILE_OPTIONS "-DLV_CONF_INCLUDE_SIMPLE=1" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-I../main" APPEND)

Display Compile Time Information

Check settings in CMakeLists.txt here

# Display Compile Time Information
message(STATUS "--------------Compile Info------------")
message(STATUS "IDF_PATH = ${IDF_PATH}")
message(STATUS "IDF_TARGET = ${IDF_TARGET}")
message(STATUS "PROJECT_NAME = ${PROJECT_NAME}")
message(STATUS "PROJECT_DIR = ${PROJECT_DIR}")
message(STATUS "BUILD_DIR = ${BUILD_DIR}")
message(STATUS "SDKCONFIG = ${SDKCONFIG}")
message(STATUS "SDKCONFIG_DEFAULTS = ${SDKCONFIG_DEFAULTS}")
message(STATUS "CONFIG_LV_CONF_SKIP = ${CONFIG_LV_CONF_SKIP}")
message(STATUS "COMPILE_OPTIONS = ${COMPILE_OPTIONS}")
message(STATUS "---------------------------------------")
message(STATUS "CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}")
message(STATUS "CMAKE_BINARY_DIR = ${CMAKE_BINARY_DIR}")
message(STATUS "---------------------------------------")

esp32-lvgl8x-sdspi's People

Contributors

sukesh-ak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

esp32-lvgl8x-sdspi's Issues

trying to get LVGL8.X + LOVYANGFX + SD card with ESP32 S3 up and running ( VSC-PlatformIO-Arduino )

Hi,
I'm trying to get all together up and running.
Bord: ESP32 S3 N16R8
Display: 3.5"TFT 320x480 V2.2 / ILI9488 FT6236 / SD card socket
LovyanGFX version=1.1.12
lvgl version=8.3.11
Environment: VSC-PlatformIO-Arduino ( latest version )

Hardware connections ( PCB, soldered, no breadboard )
CS_LCD = GPIO_10

  cfg.pin_sclk = 12;            // SPIのSCLK
  cfg.pin_mosi = 11;            // SPIのMOSI
  cfg.pin_miso = 13;            // SPIのMISO
  cfg.pin_dc   = 41;            // SPIのD/C (-1 = disable)

  cfg.i2c_port = 1;
  cfg.i2c_addr = 0x38;
  cfg.pin_sda  = 38;
  cfg.pin_scl  = 39;
  cfg.pin_cs   = -1;
  cfg.freq     = 200000;

  cfg.bus_shared       =  true;

CS_SD card = GPIO_47

Status:
LCD and touch are working fine.
SD card is connected on same SPI, CS is separated on GPIO 47.

With oscilloscope ( THS730A ) I can see activities on GPIO 47, and SPI bus.
But it fails to mount the SD card ( 3.3V power is there, can't find any diode in CS_LCD, so I expect, there is no conflict with MISO.
I tried out a 3 wire SPI to LCD without MISO connected to LCD, LCD still works fine, SD card doesn't work.

Think there is something else wrong and I spent already x nights without any success.
If I use the SD card alone in minimized testcase with SdFat.h, the card works fine ( same SPI connections, without LCD connected ).. BTW, finally I have to use exFAT with 64GB SD card.

Question: Is there an existing example / template available for VSC-PlatformIO-Arduino and ESP32 S3?

May be it is also a good solution, to use SPI3 for the SD card instead shared SPI ....

Thanks in advance for any useful hint

how to modify the setup in PlatformIO environment?

Hi,
I'm working in VSC/PlatformIO environment on ESP32 S3.
LovyanGFX 1.1.12
lvgl 8.3.11
ILI9488 LCD 320x480
Touch_FT5x06 (I2C)
works fine.
Now I'm trying to use the SD Card attached on the LCD module.
Shared with SPI of the LCD, SD_CS is separated to GPIO 47

cfg.bus_shared = true; // shared SPI bus

But it's not possible to mount the SD ( 64GB, FAT32 format )
#ifndef SDCARD_SS_PIN
#define SDCARD_SS_PIN 47 // CS für SD Karte
#endif

#ifndef SDCARD_SPI
#define SDCARD_SPI SPI
#endif

setup()
{
....
....
pinMode(SDCARD_SS_PIN, OUTPUT); // CS SD Karte
digitalWrite(SDCARD_SS_PIN, HIGH); // Inaktiv
if ( ! SD.begin(SDCARD_SS_PIN, SDCARD_SPI, 25000000)) //
{
Serial.println("Fehler: SD Card Mount fehlgeschlagen");
}
else
{
.....
...

If I set
#define LV_USE_FS_FATFS 1
the following error occurs:
Compiling .pio/build/esp32-s3-devkitc-1/lib7f8/lvgl/extra/widgets/animimg/lv_animimg.c.o
.pio/libdeps/esp32-s3-devkitc-1/lvgl/src/extra/libs/fsdrv/lv_fs_fatfs.c: In function 'fs_dir_open':
.pio/libdeps/esp32-s3-devkitc-1/lvgl/src/extra/libs/fsdrv/lv_fs_fatfs.c:228:5: error: unknown type name 'DIR'; did you mean 'DDR'?
DIR * d = lv_mem_alloc(sizeof(DIR));
^~~
DDR

At the moment, I didn't find any useful hint to solve that.
Was already thinking to use a second, separated SPI channel, but I need the GPIOs for other things ...
Thanks for any useful hint
Peter

SD card support

The SD card support https://github.com/sukesh-ak/ESP32-LVGL8x-SDSPI/blob/master/main/helper_storage.hpp seems not finished: it lacks SPI initialization (spi_bus_initialize) prior mounting an SD card with SPI interface.

I (1425) lvgl_gui: Initializing SD card
I (1425) lvgl_gui: Mounting filesystem
E (1425) spi_master: spi_master_init_driver(202): host_id not initialized
E (1435) vfs_fat_sdmmc: Failed to attach sdspi device onto an SPI bus (rc=0x103), please initialize the bus first and check the device parameters.
E (1445) vfs_fat_sdmmc: slot init failed (0x103).
E (1455) lvgl_gui: Failed to initialize the card (ESP_ERR_INVALID_STATE). Make sure SD card lines have pull-up resistors in place.

But I also don't know how to wire an external SD card slot to WT32-SC01 with SPI. Since it should be shared with the TFT LCD, I first used

TFT_SCLK=14
TFT_CS=15
TFT_MOSI=13
TFT_MISO=-1

but then I noticed #define PIN_NUM_CS GPIO_NUM_33 in helper_storage.hpp. So I need to know the correct MISO and CS pins to finish SD card wiring. And get SPI initialization fixed, of course.

I'm using an HW-125 SD card slot, not an expansion board.

lv_disp_set_bg_color not working

hello bro, i wanna change the background color this using code
lv_disp_set_bg_color(NULL, lv_color_hex3(0x000));
or
lv_disp_set_bg_color(disp, lv_color_hex3(0x000));

but not working . how to change background color ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.