03/25/17
Goof Morning All:
Sorry, I see that I was a little to brief on my discussion. Here is what I have done and what I want to do.
I am running two ADA Part Nr. 250 GLCD displays (the displays use a ST7565 controller) with the same processor (Mega 2560). Since the library provided for the displays does not allow for this. I had to get creative.
First, I made a copy of the library and renamed it ST7565A. With that done, I went into the library and changed every reference of "ST7565" to "ST7565A" and every reference of "GLCD" to "GLCDA".
The next thing I had to do was to change the names of all of the functions in the library using the same technique (ie from Drawstring to DrawstringA, from "Set_Pixel to Set_PixalA).
Basically, now I effectively have two different displays to work with ST7565 glcd and ST7565A glcdA.
This allows me to declare them separately using:
ST7565 glcd(MOSI, SCLK, DC, RST, CS); and
ST7565A glcdA(MOSI, SCLK, DC, RST, CS);
It also means that I can send each of them data as desired separately using their own function calls.
The Problem:
As with most LCD, GLCD and OLED displays, the processor is require to provide a buffer for the display. Since these displays are 128/64 bit displays, they requires a 1024 byte buffer (128*64/8 = 1024).
Additionally, since these libraries were designed to run on their own, they setup their own buffers (ST7565 Buffer and ST7565A Buffer). This effectively consumes 2048 byte of Variable RAM.
Because we cannot write to both of the displays at the same time and when we do write to the displays, we first have to write to the buffer (i.e. glcd.drawstring(30, 0, " Screen1"); ) followed by a command to send the data in the buffer to the display (i.e. glcd.display()
there really is no need for two buffers.
What I want to do is to setup one buffer that both libraries can see and use. I suspect the main program would also have to see the buffer but I am not sure of that. If I could get this done, I would save 1024 bytes of very valuable Variable RAM.
I know this can be done and I suspect that it would be done through some kind of #Include statement but I have no idea of how to do that. (I am not a programmer and have never been one).
I hope this helps and provides enough detail to allow someone to get me pointed in the right direction.
I know that this is a real "Brute Force" method to get the job done but I am no programmer and really don't understand a lot of what is going on in the library and this technique albeit inefficient, worked.
If you want to see the libraries, I can include them but that would make this a really long post. If you want to see them so you can use them, I don't have a problem with that, just let me know where to send them.
Any help you can provide will be greatly appreciated.
Ken