Hello there! I've recently gotten into using the Mega 2560 and am a big fan of all the program memory available, so I wanted to store some images on it to display on a 240x240 GC9A01 TFT screen. When I stored the array in dynamic memory, it displayed just fine, but when I stored it in PROGMEM and read the RGB565 values (Of type uint16_t) it was all messed up, I managed to fix some of it by using pgm_read_byte_near(&image[y][x]), but now it's all bluescale, any idea what I could be doing wrong? Here's an image of the screen and my code.
const uint16_t* const image [73][29] PROGMEM // Imagedata on pastebin: https://pastebin.com/PdvAKR3E
void displayMocktail()
{
for (uint8_t y = 0; y < 73; y++)
{
for (uint8_t x = 0; x < 29; x++)
{
if (pgm_read_byte_near(&image[y][x]) != 0xFFFF)
{
mylcd.Fill_Rect(x*2 + 91,y*2 + 47,2,2,pgm_read_byte_near(&image[y][x]));
}
}
}
}
void setup() {
mylcd.Init_LCD();
mylcd.Fill_Screen(BLACK);
displayMocktail();
}
