viewtopic.php?f=47&t=25303
I swear there was another post with someone inspiring me to dig deeper in the datasheets and talking about teaching someone to fish instead of just telling them the answer that is right in front of them, even though they are frustrated... lol
Bottom line was this:
I had a touch screen. One of the demos was kind of like the most basic version of mspaint that could exist. basic colors to pick and then draw on the screen with a fixed pen size.
So I added more colors and sizes and other things and was showing it off to my son who was very young at the time maybe 6ish. He started drawing and he made a cool picture.
Then he said ok, save it. I looked at him and wanted to cry. So I took out my phone and took a picture and told him it wasn't finished yet, but I would add that to the next version...
I made many dozen versions. cool "screen savers" etc.
I hoped I thanked whoever helped me. It was like 10 years ago now...
So this is where the magic happens:
Code: Select all
unsigned int getPixel(int x, int y){
tft.writeRegister(0x0020, x); // GRAM Address Set (Horizontal Address) (R20h)
tft.writeRegister(0x0021, y); // GRAM Address Set (Vertical Address) (R21h)
unsigned int junk = tft.readRegister(0x0022);
unsigned int c = tft.readRegister(0x0022);
return c;
}
in my save function, I iterate through the coordinates of the screen, rectangle or whatever area I wanted saved, one pixel at a time and saved that color data. It was never formatted in any way, just raw color data. Then to reload, I set each pixel color from the saved list.
I don't remember exactly how I figured out those 3 register addresses, but now you don't have to ;)
I also don't remember why you have to read from that address twice. Just do it...