does anyone know how i can screenshot only a specific predefined part of my buffer using u8g2 library
the lcd is operating in SPI with u8g2 in full buffer mode
parts list:
ST7920 graphic lcd
arduino uno
does anyone know how i can screenshot only a specific predefined part of my buffer using u8g2 library
the lcd is operating in SPI with u8g2 in full buffer mode
parts list:
ST7920 graphic lcd
arduino uno
What display?
What Arduino?
Why take a screenshot?
im using a 128x64 display with an arduino uno,
theres a feature in the library that allows me to screenshot the buffer
but i want a function that allows me to screenshot part of the buffer to save memory
i also want to take screenshot for my software to interpret which bits of the display are on and which ones aren't (im creating a game).
Probably better to read the screen buffer directly. Problem is, on an Arduino with so little RAM memory, I guess you won't have a full size buffer?
yes i cant read the entire buffer since there isnt enough space (some 500 bytes left), so i thought maybe if i can only read a small area of the buffer and not the entire thing. I tried making my own function that can do this in the u8g2 library but i have no idea on how to do so
i already have a full size buffer though (thats why i have 500 bytes left).
Ok, so you need to know where the buffer is stored and how the data is formatted. Maybe @olikraus can help.
@olikraus is there a way i can read part of my buffer using u8g2
do you know a way i can directly access the buffer and read write the pixel values?
Take a look at the DirectAccess.ino example sketch.
i have been having a look at directaccess trying to make it work, only to find out that this does not work with my graphic microcontroller.
edit: i believe this sketch attempts to read off from the graphic lcd memory, but my lcd does not support this feature when operating in serial communication (which is the only suitable communication protocol i can use).
i need a function that will read my memory buffer that is stored in my arduino microcontroller
It's hard for the forum to help when you are so vague about the parts you are using. What is this "graphic microcontroller"? I thought you said you were using an Uno?
i have a 128x64 graphic lcd sitting next to me printing the pictures with which the uno creates the pictures to print on the lcd
Sorry, I can't help if you can't provide more precise description of your parts. I suggest you read the forum guide in the sticky post at the top of most forum sections. This will help you know what you need to post in order for anyone on the forum to be able to help you.
i have updated the post with the parts list and operation methods
Thanks. I'm pretty certain U8g2 supports st7920 displays and the examples sketch should work ok. I don't think it reads data from the display, just from the be Uno's memory.
on the example sketch it states that that particular sketch wont work with st7920 displays
As pointed out by PaulRB, the function "uint8_t *U8G2::getBufferPtr()" from the direct access API will return a pointer to local uC memory containing the graphics data for the LCD. Indeed it is a pointer to the internal memory, so you can just read from that memory).
The direct access API also describes the memory layout for 80% of the displays, however the ST7920 belongs to the 20% percent of displays, which have a different memory layout (for details on the memory layout, see the ST7920 datasheet).
I don't follow discussions much here on Arduino Forum, but usually I read and answer discussions in the u8g2 github project (olikraus/u8g2 · Discussions · GitHub).
Oliver
Edit: Fixed function name: getBufferPtr, moreover cast is not required.