Check TFT_init() in tft.c, this is the same as in my repository:
https://github.com/RudolphRiedel/FT800-FT813/blob/5.x/examples/EVE_Test_Arduino_PlatformIO/src/tft.cI have two images stored in tft_data.c:
https://github.com/RudolphRiedel/FT800-FT813/blob/5.x/examples/EVE_Test_Arduino_PlatformIO/src/tft_data.cThe first is a converted image in ARGB1555 format which zlib compressed with EAB and is loaded with:
EVE_cmd_inflate(MEM_LOGO, logo, sizeof(logo));
The second is a .jpg image which is loaded with:
EVE_cmd_loadimage(MEM_PIC1, EVE_OPT_NODL, pic, sizeof(pic));
Yes, loading a .png file as raw unconverted data is done with CMD_LOADIMAGE as well.
My EVE_cmd_loadimage() now looks like this (simplified):
void EVE_cmd_loadimage(uint32_t ptr, uint32_t options, const uint8_t *data, uint32_t len)
{
uint32_t ftAddress;
ftAddress = REG_CMDB_WRITE;
EVE_cs_set();
spi_transmit((uint8_t)(ftAddress >> 16) | MEM_WRITE); /* send Memory Write plus high address byte */
spi_transmit((uint8_t)(ftAddress >> 8)); /* send middle address byte */
spi_transmit((uint8_t)(ftAddress & 0x000000ff)); /* send low address byte */
spi_transmit_32(CMD_LOADIMAGE);
spi_transmit_32(ptr);
spi_transmit_32(options);
EVE_cs_clear();
block_transfer(data, len);
}
The block_transfer() function sends the data in chunks of 3840 bytes to the command FIFO and waits for the command co-processor to empty the FIFO. Why 3840? No strict binding reason, this is just 15 x 256.
But the FIFO can only hold 4096 bytes, so we need to make sure to not overshoot this.
I advise against using PNG directly though.
EVE is rather picky about the format the PNG is saved with, although this can be tested with EAB.
Then EVE needs quite some time to process PNG.
I did a test withe the ugly star image from my demo a while back.
It has 3867 bytes as .png and 3903 bytes as .jpg.
Processing with a FT813 took 53 ms for the PNG and 480 µs for the JPG, that is a factor of 110.
Maybe BT81x are better with PNG but it does not really matter since BT81x can use ASTC compressed images.
And ASTC 8x8 for example uses only 2 bits per pixel and still comes with alpha channel, so even when only running from RAM_G your images need 1/8 of storage space.
So as you are using a BT816, I recommend using ASTC instead.