-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Driver for 3.5inch RPi Display (MPI3501) #90
Comments
Hi, Great, I should add a contribution guide to add support for drivers, it's a easy but laborious process. To do so:
#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*/
/*********************
* 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
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
}
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. |
Hi @C47D,
Also I created mpi3501.c and mpi3501.h in components\lvgl_esp32_drivers\lvgl_tft directory. Ciao |
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:
Add all the edited files:
Then remove the sdkconfig from the staging area:
Do a commit:
Then push the commit to your fork:
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. |
I tried with the pull request, but the last command fails!
I sent you an email with the patch of the modified files and the new files. |
Hi, Just checked my email and I don't see your email, did you sent the email to carlos.santiago.diaz@gmail.com? |
@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 |
Thanks for the information @ndunello, I will update the README with it :) |
I developed and tested driver for the tft MPI3501.
It's based on ILI9486 with custom circuit to convert 3-line SPI to 16-bit parallel. Touch controller is XPT2046.
Can I release it? If yes, how to proceed?
ESP32 Chip version: ESP32D0WDQ6 (revision 1)
ESP-IDF version: 4.0
Development kit used: DevKitC
Development machine OS: Windows 10
The text was updated successfully, but these errors were encountered: