What is your physical display resolution?
Is it 320 x 240 or
is it 240 x 320?
In other words, is it portrait or landscape mode?
That makes a difference.
And what do you want to use for the display?
If your display is physically a portrait mode display, but you want to use is it in landscape you have to rotate the output within the flusch function.
The same is true if you have landscape mode display and you want to use it in portrait mode.
You have a little confusion in setting up your LCD display driver, configuring lvgl and flush function.
my LCD driver work as landscape mode.But when i execute below code,display is wrong
for(y = area->y1; y <= area->y2 && y <disp_drv->ver_res; y++)
{
for(x = area->x1; x <= area->x2; x++)
{
FrameBuffer[(y * disp_drv->hor_res)+x] = (uint)lv_color_to16 (*color_p);
color_p++;
What is the display’s type name?
I don’t know the controller you are using, so I don’t know how the display controller can be setup.
Is it something similar to the STM32 family?
I can only find information in chinese.
Take a look into setting up the display controller.
I think there is some missmatch.
Your LCD is kind of ‘smart’ display. It has it’s own controller!?
So it’s not a ‘dump’ display which is directly connected to a microcontrollers LCD driver as with e.g. a STM32F7xx/H7xx.
In this case, you feed your LCD (via SPI) directly from flush function.
There is no need for copying the ‘working’ buffer into a frame buffer, and then into display (via SPI).
The working buffer has data for a specific area within the (full) display area.
This area is defined by the x1, y1 and x2 and y2 when the flush function is called.
Before you send the data to the display (via SPI) you have to configure the display controller (also over SPI) to accept the data for the specific area.
There should be appropriate functions for doing this.
Normally it is not necessary to always transfer the entire display data to the display controller, when there are only small changes.
There should be a manual for the display controller, or some example code.
As I don’t know your microcontroller and as I don’t know your display (with the display controller),
I cannot give you more hints.
For debug purpose,update entire display to screen is same with update area.
maybe Color_p need to make specific handle.Then call LCD driver to update these data to screen.
if i update ‘working buffer’ to screen directly.it will be show as picture.So i think ‘working buffer’ data must need to modify follow specific format.
for my LCD driver,it only transmit “FrameBuffer buffer” data to screen.i just dont know how to config ‘working buffer’ data in format.
As far as I can see, you are using a demo code for your controller board with function for using the ST7789 display.
I didn’t find anything when searching for st7789_draw_pixel (or st7789_set_cursor) within the internet.
So far, I can see, that the ST7789 controller has a lot of registers for controlling the display.
Whether the display shows from left to right or right to left, etc. Also rotation seems to be possible.
You are trying to put lvgl on top of this code. But my guess is, that you are not really experienced with it.
At first you should get familiar with that demo code and the display controller.
You should find the code which does the initialization of the display controller and does the transfer of the display data.
Don’t use the SPI_DMA on the first steps. Use simple functions.
You can see that simple functions within the st7789_draw_pixel, after the #else
These functions (and macros) write directly to the ST7789 controller.
Try to draw lines, pixels, boxes, as your demo code supports it.
Then, if you understand all the display controller stuff, you can go forward trying to use lvgl.
At first, avoid using SPI DMA, use the simple (direct) functions for writing to the ST7789.