Comments (8)
Hi,
Great, I should add a contribution guide to add support for drivers, it's a easy but laborious process.
I think is best if we add the support for the ILI9486 controller and add the MPI3501 as predefined display, what do you think?
To do so:
- In
components/lvgl_esp32_drivers/lvgl_tft/
copyili9341.h
and rename it after the display controller, soili9486.h
, replace the textILI9341
withILI9486
, this is the bare minimal, you can add register definitions, etc. it will end up something like this:
#ifndef ILI9486_H
#define ILI9486_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "lvgl/lvgl.h"
/*********************
* DEFINES
*********************/
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#define ILI9486_DC CONFIG_LVGL_DISP_PIN_DC
#define ILI9486_RST CONFIG_LVGL_DISP_PIN_RST
#define ILI9486_BCKL CONFIG_LVGL_DISP_PIN_BCKL
#define ILI9486_ENABLE_BACKLIGHT_CONTROL CONFIG_LVGL_ENABLE_BACKLIGHT_CONTROL
#if CONFIG_LVGL_BACKLIGHT_ACTIVE_LVL
#define ILI9486_BCKL_ACTIVE_LVL 1
#else
#define ILI9486_BCKL_ACTIVE_LVL 0
#endif
// if text/images are backwards, try setting this to 1
#define ILI9486_INVERT_DISPLAY CONFIG_LVGL_INVERT_DISPLAY
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void ili9486_init(void);
void ili9486_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
void ili9486_enable_backlight(bool backlight);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*ILI9486_H*/
-
Same for the c file, copy
ili9341.c
and rename it toili9486.c
, rename the functionsinit
,flush
andenable_backlight
so they start withili9486
. Also rename all theILI9341
references toILI9486
.
Edit the functions so they match your init configuration sequence, flush function. -
Open
disp_driver.h
and edit it so it end up like this:
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "lvgl/lvgl.h"
#include "ili9341.h"
#include "ili9488.h"
#include "st7789.h"
#include "hx8357.h"
#include "ili9486.h"
/*********************
* DEFINES
*********************/
/* Add a new define entry at the end for new controllers */
#define TFT_CONTROLLER_ILI9341 0
#define TFT_CONTROLLER_ILI9488 1
#define TFT_CONTROLLER_ST7789 2
#define TFT_CONTROLLER_HX8357 3
#define TFT_CONTROLLER_ILI9486 4
- Edit
disp_driver.c
and add the init and flush functions of your display:
void disp_driver_init(bool init_spi)
{
if (init_spi) {
disp_spi_init();
}
#if CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == TFT_CONTROLLER_ILI9341
ili9341_init();
#elif CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == TFT_CONTROLLER_ILI9488
ili9488_init();
#elif CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == TFT_CONTROLLER_ST7789
st7789_init();
#elif CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == TFT_CONTROLLER_HX8357
hx8357_init(HX8357D);
#elif CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == TFT_CONTROLLER_ILI9486
ili9486_init();
#endif
}
void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
{
#if CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == TFT_CONTROLLER_ILI9341
ili9341_flush(drv, area, color_map);
#elif CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == TFT_CONTROLLER_ILI9488
ili9488_flush(drv, area, color_map);
#elif CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == TFT_CONTROLLER_ST7789
st7789_flush(drv, area, color_map);
#elif CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == TFT_CONTROLLER_HX8357
hx8357_flush(drv, area, color_map);
#elif CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == TFT_CONTROLLER_ILI9486
ili9486_flush(drv, area, color_map);
#endif
}
-
In
disp_spi.c
you can edit thespi_bus_config_t
andspi_device_interface_config_t
struct members if the ili9486 can handle higher spi clock or spi mode, you can see the current implementation and add the necesary code easily. -
Open the
Kconfig
file and add the necessary code so it end up like this:
choice LVGL_PREDEFINED_DISPLAY
prompt "Select predefined display configuration"
default LVGL_PREDEFINED_DISPLAY_NONE
help
Select predefined display configuration
config LVGL_PREDEFINED_DISPLAY_NONE
bool "None"
config LVGL_PREDEFINED_DISPLAY_WROVER4
bool "ESP-Wrover-KIT v4.1"
config LVGL_PREDEFINED_DISPLAY_M5STACK
bool "M5Stack"
config LVGL_PREDEFINED_DISPLAY_ERTFT0356
bool "ER-TFT035-6"
config LVGL_PREDEFINED_DISPLAY_ADA_FEATHERWING
bool "Adafruit 3.5 Featherwing"
config LVGL_PREDEFINED_DISPLAY_MPI3501
bool "Raspberry Pi MPI3501"
endchoice
config LVGL_TFT_DISPLAY_CONTROLLER
int
default 0 if LVGL_TFT_DISPLAY_CONTROLLER_ILI9341
default 1 if LVGL_TFT_DISPLAY_CONTROLLER_ILI9488 || LVGL_PREDEFINED_DISPLAY_ERTFT0356
default 2 if LVGL_TFT_DISPLAY_CONTROLLER_ST7789
default 3 if LVGL_TFT_DISPLAY_CONTROLLER_HX8357
default 4 if LVGL_TFT_DISPLAY_CONTROLLER_ILI9486
choice
prompt "Select a display controller model." if LVGL_PREDEFINED_DISPLAY_NONE
default LVGL_TFT_DISPLAY_CONTROLLER_ILI9341
default LVGL_TFT_DISPLAY_CONTROLLER_ILI9341 if LVGL_PREDEFINED_DISPLAY_WROVER4
default LVGL_TFT_DISPLAY_CONTROLLER_ILI9341 if LVGL_PREDEFINED_DISPLAY_M5STACK
default LVGL_TFT_DISPLAY_CONTROLLER_ILI9488 if LVGL_PREDEFINED_DISPLAY_ERTFT0356
default LVGL_TFT_DISPLAY_CONTROLLER_HX8357 if LVGL_PREDEFINED_DISPLAY_ADA_FEATHERWING
default LVGL_TFT_DISPLAY_CONTROLLER_ILI9486 if LVGL_PREDEFINED_DISPLAY_MPI3501
help
Select the controller for your display.
config LVGL_TFT_DISPLAY_CONTROLLER_ILI9341
bool "ILI9341"
config LVGL_TFT_DISPLAY_CONTROLLER_ILI9488
bool "ILI9488"
config LVGL_TFT_DISPLAY_CONTROLLER_ST7789
bool "ST7789"
config LVGL_TFT_DISPLAY_CONTROLLER_HX8357
bool "HX8357"
config LVGL_TFT_DISPLAY_CONTROLLER_ILI9486
bool "ILI9486"
endchoice
Then edit the LVGL_DISPLAY_WIDTH and LVGL_DISPLAY_HEIGHT with the size of the display, replace the XXX with the actual numbers:
config LVGL_DISPLAY_WIDTH
int "TFT display width in pixels." if LVGL_PREDEFINED_DISPLAY_NONE
default 240 if LVGL_PREDEFINED_DISPLAY_M5STACK
default 480 if LVGL_PREDEFINED_DISPLAY_ERTFT0356 || LVGL_PREDEFINED_DISPLAY_ADA_FEATHERWING
default XXX if LVGL_PREDEFINED_DISPLAY_MPI3501
default 320
config LVGL_DISPLAY_HEIGHT
int "TFT display height in pixels." if LVGL_PREDEFINED_DISPLAY_NONE
default 320 if LVGL_PREDEFINED_DISPLAY_M5STACK || LVGL_PREDEFINED_DISPLAY_ERTFT0356 || LVGL_PREDEFINED_DISPLAY_ADA_FEATHERWING
default XXX if LVGL_PREDEFINED_DISPLAY_MPI3501
default 240
If the display have a backlight enable pin edit the LVGL_ENABLE_BACKLIGHT_CONTROL config, add a field for the LVGL_PREDEFINED_DISPLAY_MPI3501 as we did with the width and heigth before.
I think that's everything you need to do, please let me know if you have any questions.
from lv_port_esp32.
Hi @C47D,
thank you very much for the detailed explanation.
I had already made the changes you indicated.
This is the output of the git status command:
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: components/lv_examples/lv_ex_conf.h
modified: components/lvgl/lv_conf.h
modified: components/lvgl_esp32_drivers/lvgl_driver.c
modified: components/lvgl_esp32_drivers/lvgl_tft/Kconfig
modified: components/lvgl_esp32_drivers/lvgl_tft/disp_driver.c
modified: components/lvgl_esp32_drivers/lvgl_tft/disp_driver.h
modified: components/lvgl_esp32_drivers/lvgl_tft/disp_spi.c
modified: components/lvgl_esp32_drivers/lvgl_touch/xpt2046.c
modified: sdkconfig
Untracked files:
(use "git add <file>..." to include in what will be committed)
.project
components/lvgl_esp32_drivers/lvgl_tft/mpi3501.c
components/lvgl_esp32_drivers/lvgl_tft/mpi3501.h
no changes added to commit (use "git add" and/or "git commit -a")
Also I created mpi3501.c and mpi3501.h in components\lvgl_esp32_drivers\lvgl_tft directory.
So I wanted to know how to publish the changes for the community. I'm novice with the git :-(
Do I have to send you an email with the patch file?
Ciao
from lv_port_esp32.
I can help you to create a pull request if you want, or if you prefer you can send me your files, my mail is in my user main page.
To create a pull request:
you need to move those changes into a new branch, go to where youre working on, then create a new branch:
git checkout -b rpi_display
Add all the edited files:
git add .
Then remove the sdkconfig from the staging area:
git reset sdkconfig
Do a commit:
git commit -m "Initial support for MPI3501"
Then push the commit to your fork:
git push origin rpi_display
Go to your fork and you will see a button to create a pull request with your additions into this repo, click it and that should be it.
from lv_port_esp32.
I tried with the pull request, but the last command fails!
git status
On branch rpi_display
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: components/lv_examples/lv_ex_conf.h
modified: components/lvgl/lv_conf.h
modified: components/lvgl_esp32_drivers/lvgl_driver.c
modified: components/lvgl_esp32_drivers/lvgl_tft/Kconfig
modified: components/lvgl_esp32_drivers/lvgl_tft/disp_driver.c
modified: components/lvgl_esp32_drivers/lvgl_tft/disp_driver.h
modified: components/lvgl_esp32_drivers/lvgl_tft/disp_spi.c
modified: components/lvgl_esp32_drivers/lvgl_touch/xpt2046.c
modified: sdkconfig
Untracked files:
(use "git add <file>..." to include in what will be committed)
.project
add_mpi3501_support.patch
no changes added to commit (use "git add" and/or "git commit -a")
C:\projects\esp32\lv_port_esp32>git push origin rpi_display
remote: Permission to littlevgl/lv_port_esp32.git denied to ndunello.
fatal: unable to access 'https://github.com/littlevgl/lv_port_esp32.git/': The requested URL returned error: 403
I sent you an email with the patch of the modified files and the new files.
Thanks
from lv_port_esp32.
Hi,
Just checked my email and I don't see your email, did you sent the email to [email protected]?
from lv_port_esp32.
@ndunello You tried to push to https://github.com/littlevgl/lv_port_esp32 (which you don't have write access to). You need to fork that repository, clone the fork, and apply your changes there.
Here's the blog post we routinely link to for the main LittlevGL repository. The process is basically identical except you want to clone lv_port_esp32
instead of lvgl
.
from lv_port_esp32.
the pins that I used for the connection are the following (shared spi):
display
- MISO 19
- MOSI 23
- CLK 18
- CS 15
- DC 2
- RST 4
touch
- MISO 19
- MOSI 23
- CLK 18
- CS 22
- IRQ 25
the display maybe has some problems
I also attach the pinout of the display hoping it will be useful
from lv_port_esp32.
Thanks for the information @ndunello, I will update the README with it :)
from lv_port_esp32.
Related Issues (20)
- Cannot build project with LVGL as component HOT 1
- SPI display drivers do not play nice with other spi devices
- esp32-s3 invalid dma channel HOT 1
- Portrait mode of demos doesn't display correctly
- The link to the forum when you write a PR/issue is incorrect HOT 1
- build with esp-idf-4.4.3 fails HOT 1
- failed to run idf.py menuconfig HOT 2
- updated LVGL+squareline studio+ ESP32 HOT 2
- Demo on older esp-wrover-kit board ( not v4.1) HOT 2
- Display not showing the correct windows while running this example HOT 2
- Sunton ESP32-8048S070 board HOT 8
- How can I add my own components to the project
- Unable to compile on esp-idf version 5.0 HOT 4
- undefined reference to `lv_obj_set_scroll_propagation'
- Cant turn off LV_USE_FLEX
- Horizontal scrolling HOT 4
- fatal error: Arduino_H7_Video.h: No such file or directory
- ESP32C3 - non-LVGL task (temp reading) causes TFT display to go blank and stay blank on second run of task HOT 1
- ssd1306 driver
- ssd1306
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lv_port_esp32.