-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Implemented ST7789 LCD driver #5020
Conversation
…nclude paths need to be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, Zoltan. It looks good in general, just a few minor issue caught by the CI should be fixed.
Please run code-format.py
in the scripts folder to format the code.
@@ -0,0 +1,54 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As these are specific to st7789, please move these commands in lv_st7789.c
.
List only the really used commands should be enough. If someone needs to use a custom command they need to look into the datasheet anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These commands are common for various controllers, not ST7789 specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But not all, so we can't put it into a generic LCD file.
It seems roughly 10 commands are really used in st7789.c. I think it's okay to define them locally to avoid any conflicts later.
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
We need some feedback on this pull request. Now we mark this as "stale" because there was no activity here for 14 days. Remove the "stale" label or comment else this will be closed in 7 days. |
Not stale, will be finished in January. |
…trollers that use the same command set. Added drivers for ST7789, ST7796, ILI9341. Initialization command lists are based on LovyanGFX drivers. These improved the color reproduction quite much. Changed API to be able to supply additional flags for panel-dependent mirroring X and/or Y coordinates, and setting RGB order at create time.
…anGFX did not work well on my board).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the update.
Please also run scripts/code-format.py
.
* INCLUDES | ||
*********************/ | ||
#include "lv_ili9341.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add LV_USE_ILI9341
guard here and and also in lv_conf_template.h
(scripts/lv_conf_internal_gen.py needs to run as well)
src/dev/display/ili9341/lv_ili9341.c
Outdated
* STATIC CONSTANTS | ||
**********************/ | ||
|
||
// init commands based on LovyanGFX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use /**/
comemnts
src/dev/display/ili9341/lv_ili9341.h
Outdated
* @param param parameter buffer | ||
* @param param_size number of bytes of the parameters | ||
*/ | ||
typedef void (*lv_ili9341_send_cmd_cb_t)(lv_display_t *disp, uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typedef void (*lv_ili9341_send_cmd_cb_t)(lv_display_t *disp, uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size); | |
typedef lv_ili9341_send_cmd_cb_t lv_lcd_send_cmd_cb_t; |
src/dev/display/st7735/lv_st7735.c
Outdated
**********************/ | ||
|
||
static const uint8_t init_cmd_list[] = { | ||
#if 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if 0
s should be removed and only the final code should remain.
If the other options might be used by the users as well, and API functions or other direct way to adjust shall be provided.
#define LV_LCD_FLAG_RGB666 0x00000010UL | ||
|
||
/* command list */ | ||
#define LV_LCD_CMD_SPECIAL 0xff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it's used only as a delay:
#define LV_LCD_CMD_SPECIAL 0xff | |
#define LV_LCD_CMD_DELAY_MS 0xfe |
…ror and BGR settings. Improved init commands for the available LCD drivers. Formatted code. Added LV_USE_ flags and compiler guards.
Hello! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometime the code formatter needs to be tun multiple times to remove all double empty lines.
As these controllers don't contain any HW dependent parts we can enable them for the CI, so that they will be built and we will see if there are any compile time warnings,
So please enable the controllers here.
Please add docs for each controller. In an example section some dummy callbacks shall be added well.
*********************/ | ||
#include "lv_st7796.h" | ||
|
||
#if LV_USE_ST7796 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add these guards to the header files as well.
I will add the documentation soon.
I will include a sample implementation. Currently the drivers have been implemented only on STM32, but ESP32 will be added soon.
On the STM32 platform the SPI controller can swap the bytes. I need to check how the ESP32 SPI controller handles this. We may need to do it in software. |
As it depends on the periphery if it can swap the bytes, |
Well, I'm a bit lost. ... so at the moment I see 3 different approaches:
I prefer having C display drivers due to high performance requirement (and less C <-> MicroPython context switch during display flushes) |
The ESP-LCD driver was an initial attempt to implement a unified LCD driver architecture for LVGL. However, we decided to develop the idea further, and the current PR is the result of this. The ESP-LCD driver is now obsolete, and will be replaced by an example implementation of the current driver model. |
Overview | ||
------------- | ||
|
||
The `ST7789 <>`__ SOC is a popular TFT LCD controller chip made by Sitronix. It supports TFT LCD panels with a maximum resolution of 240x320 pixels, and 262k (18 bit) colors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to the datasheet?
…ample and chip specific parts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated docs looks good!
/********************* | ||
* INCLUDES | ||
*********************/ | ||
#include "lv_st7735.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs is still missing for this one.
Please enable these controllers for tests, so they can be built by the CI. |
…th text from the actual datasheet. Added datasheet links.
… Fixed wrong parameter in the call of lv_lcd_generic_mipi_send_cmd_list().
…k. Change callback function buffer parameters to const pointers (except the color array) in order to avoid compiler warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you.
If anything comes up probably we can extend these without API braking the API.
Implemented driver model for LCD controllers connected via SPI/parallel port. Implemented support for ST7789.