cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX - SPI - PartialBuffer: Can I set the Position/Width/Height to a multiple of 2?

IHei?
Associate

Hello,

I have a STM32F723 Application with TouchGFX (4.16.1) Graphics over SPI and a Display with RM69330 Controler (454x454x2Bpp).

I use PartitialBuffer Configuration, because internal RAM is too small for whole Framebuffer. I've implemented the Transmit Function ("touchgfxDisplayDriverTransmitBlock( uint8_t* pixels, uint16_t x, uint16_t y, uint16_t w, uint16_t h)") where I set Position Rectangle in Display Controler and write Pixels to the Display. That works fine if x/y/w/h are a multiple of 2 otherwise it looks weired.

Problem is: In RM69330 DataSheet it says that Column and Row Startaddress and Width / Height "must can be divisible by 2".

Question: Is there any way to tell TouchGFX to only supply framebuffer parts with x/y/w/h as a multiple of 2? Or is there any other Known solution?

1 ACCEPTED SOLUTION

Accepted Solutions
Alexandre RENOUX
Principal

Hello IHei?,

This problem can happen and we discovered this is a common limitation for several SPI displays.

To fix it, you have to modify FrontendApplication.hpp and .cpp as below :

FrontendApplication.hpp

virtual void draw(Rect& rect);

FrontendApplication.cpp

void FrontendApplication::draw(Rect& rect)
{
    if (drawCacheEnabled)
    {
        Rect even(rect);
        //ensure start x is even number, or move left
        if (even.x&1)
        {
            even.x--;
            even.width++;
        }
        //ensure width is even number of pixels
        even.width = (even.width+1)&~0x01;
 
        //ensure start y is even number, or move up
        if (even.y&1)
        {
            even.y--;
            even.height++;
        }
        //ensure height is even number of pixels
        even.height = (even.height+1)&~0x01;
        
        Application::draw(even);
    }
    else
    {
        Application::draw(rect);
    }
}

You basically overwrite the draw function to ensure even numbers for the rectangle to draw.

When your question is answered, please close this topic by choosing Select as Best.

/Alexandre

View solution in original post

2 REPLIES 2
MM..1
Chief III

Maybe you can in your transmit function extend x,y,w,h to multiple 2 with read data from display , but yes this is more overhead as send only.

Alexandre RENOUX
Principal

Hello IHei?,

This problem can happen and we discovered this is a common limitation for several SPI displays.

To fix it, you have to modify FrontendApplication.hpp and .cpp as below :

FrontendApplication.hpp

virtual void draw(Rect& rect);

FrontendApplication.cpp

void FrontendApplication::draw(Rect& rect)
{
    if (drawCacheEnabled)
    {
        Rect even(rect);
        //ensure start x is even number, or move left
        if (even.x&1)
        {
            even.x--;
            even.width++;
        }
        //ensure width is even number of pixels
        even.width = (even.width+1)&~0x01;
 
        //ensure start y is even number, or move up
        if (even.y&1)
        {
            even.y--;
            even.height++;
        }
        //ensure height is even number of pixels
        even.height = (even.height+1)&~0x01;
        
        Application::draw(even);
    }
    else
    {
        Application::draw(rect);
    }
}

You basically overwrite the draw function to ensure even numbers for the rectangle to draw.

When your question is answered, please close this topic by choosing Select as Best.

/Alexandre