lvgl_esp32_drivers icon indicating copy to clipboard operation
lvgl_esp32_drivers copied to clipboard

ILI9488 driver modification

Open JoachimF opened this issue 1 year ago • 0 comments

Hello,

Here is my code modification to use "Swap the 2 bytes of RGB565 color" or not, it is working for me :

` uint32_t j = 0;

/* uint16_t blue : 5; uint16_t green : 6; uint16_t red : 5;

	BBBB BGGG GGGR RRRR

*/ #if LV_COLOR_16_SWAP != 1 uint32_t LD = 0; for (uint32_t i = 0; i < size; i++) { LD = buffer_16bit[i].full; mybuf[j] = (uint8_t) (((LD & 0xF800) >> 8) | ((LD & 0x8000) >> 13)); // B j++; mybuf[j] = (uint8_t) ((LD & 0x07E0) >> 3); // G j++; mybuf[j] = (uint8_t) (((LD & 0x001F) << 3) | ((LD & 0x0010) >> 2)); //R 0001 0000 -> 0000 0100 j++; } #endif

/* B = 0000 0000 BBBB B100 G = 0000 0000 GGGG GG00 R = 0000 0000 RRRR R100 */

/* uint16_t green_h : 3; 0000 0000 0000 0111 uint16_t red : 5; 0000 0000 0001 1111 uint16_t blue : 5; 0000 0000 0001 1111 uint16_t green_l : 3; 0000 0000 0000 0111

	GGGR RRRR BBBB BGGG
	0000 0000 000G GG00
	*/

#if LV_COLOR_16_SWAP == 1 for (uint32_t i = 0; i < size; i++) { mybuf[j] = (uint8_t)((buffer_16bit[i].ch.red << 3) | ((buffer_16bit[i].ch.red & 0x0010) >> 2)); j++; mybuf[j] = (uint8_t)((buffer_16bit[i].ch.green_h << 5) | ((buffer_16bit[i].ch.green_l) << 2)); j++; mybuf[j] = (uint8_t)((buffer_16bit[i].ch.blue << 3) | ((buffer_16bit[i].ch.blue & 0x0010) >> 2));; j++; } #endif

/* Column addresses  */

`

I leave my comment for those wants to understand how bits are shifted.

I didn't understand while des MSB bits of red and blue are copied to LSB, if someone can explain to me.

Regards,

JoachimF avatar Sep 29 '24 14:09 JoachimF