Pass a uint32_t buffer to the driver write uint16_t pixel in unconventional positions

Hi kisvegabor,

I did a test with a buffer copy but it did almost 800 us to copy 7680 pixels (15360 bytes).

And this corresponds to 1/20 of the display size.

So if i want to reach 30 frames per second on full display size: 20 * 30 = 600 copy / second.

600 * 800us = 480 ms.

Apparently would work but it’s a grand overhead.

Could you give me some tips on how to change the driver to write directly to a 32 bit buffer byte by byte ?

I think it would look something like this:

file: i2s_parallel_driver.c

DMA_ATTR uint32_t buf_a[ pixels_size_in_bytes ];  // pixels_size_in_bytes = 15360 bytes. 
DMA_ATTR uint32_t buf_b[ pixels_size_in_bytes ];

********************************************************************************
file: my_app.c 

static lv_disp_buf_t disp_buf;
     
lv_disp_buf_init ( &disp_buf,  ( uint32_t* ) buf_a, ( uint32_t* ) buf_b, 7680 );  // 7680 pixels = 15360 bytes. pixel size = lv_color_t = 2 bytes / pixel.

********************************************************************************
file: lvgl_driver.c 

uint8_t* ptr; 

ptr = (uint8_t *) &pixel0;    // pixel0 provided by the littlevgl driver library. pixel0 are of type lv_color_t = uint16_t.
 
for ( uint32_t i = 0 ; i < length ; i = i + 2 )    // length <= 15360 bytes.  loop max 15360/2 = 7680 times.
{      
    buf_a[ i ] = ptr[ i ];   
    buf_a[ i + 1 ] = ptr[ i + 1 ];
} 

Thank’s for your help.