nopnop2002 / Raspberry-ili9340spi

ILI9340 SPI TFT Library & XPT2046 Touch Screen Library for Raspberry
MIT License
39 stars 16 forks source link

Best way to write data to the Framebuffer? #22

Closed thatsitipl closed 3 years ago

thatsitipl commented 3 years ago

I want to do a raw(rgb565) picture viewer what would be the best way to write it to the framebuffer?

nopnop2002 commented 3 years ago

row is raw(rgb565)

  uint16_t row[ScreenWidth*ScreenHeight];

  Set raw data here.

  lcdWriteCommandByte(0x2A); // set column(x) address
  lcdWriteDataWord(0);
  lcdWriteDataWord(ScrremWidth-1);
  lcdWriteCommandByte(0x2B); // set row(y) address
  lcdWriteDataWord(0);
  lcdWriteDataWord(ScreenHeight-1);
  lcdWriteCommandByte(0x2C); // Memory Write
  for(i=0;i<sizeof(row);i++){
    lcdWriteDataWord(row[i]);
  }
thatsitipl commented 3 years ago

Thank you for your quick answer gonna try this