The TFT screengrab...

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jkcbwpnet
 
Posts: 92
Joined: Wed Aug 10, 2011 1:37 pm

The TFT screengrab...

Post by jkcbwpnet »

So this was a post from years ago that I never followed up on.
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.
IMG_20121110_201954.jpg
IMG_20121110_201954.jpg (472.63 KiB) Viewed 82 times
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;
}
Version 16: https://arduino.cbwp.net/sketchbook/ada ... aveV16.pde

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...
IMG_20121110_203159.jpg
IMG_20121110_203159.jpg (546.43 KiB) Viewed 82 times

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”