128x64 Serial LCD

Hi, does anybody have a class that works with a Serial Graphic 128x64 LCD.

I’m trying to make this LCD works but I can’t find any reference to any squirrel library for this.

I’m using the following LCD with a universal adapter.

Adapter

Thanks in advanced for any help.

Eddie.

simply do it yourself… :wink:
Digole_Serial_Display_Adapter-Manual.pdf

example:
display <- hardware.uart57; display.configure(9600, 8, PARITY_NONE, 1, NO_RX); display.write("CL"); display.write(0x01); //Clear display display.write("CS0"); display.write(0x01); //Cursor off

put everything in nice functions and upload it to GitHub for the rest of us. :wink:

I already made a bit already. :slight_smile:

Thanks both for your help.

@Chrischi that’s a good idea. I just didn’t wanted to reinvent the wheels if someone else had already done it.

I will try to write that library and share it with the community. It will be a great way to learn something new :slight_smile:

Best regards,

Eddie.

@eddieespinal - if you end up writing a class for the device you would like to share, let us know and we’ll see about pulling it into our reference library (which is a great place to check for whether there’s any existing code for a particular device or webservice):

http://github.com/electricimp/reference

Hey,

i did some functions for the Digole Serial Adapter:

`function setFont(value) {
display.write(“SF”);
display.write(value);
}

function setXY(x,y) {
display.write(“TP”);
display.write(y);
display.write(x);
}

function displayText(value) {
display.write(“TT” + value);
display.write(0x00);
}

function print(value) {
display.write(“TT” + value);
display.write(0x00);
}

function drawCircle(x, y, r, f) {
display.write(“CC”);
display.write(x);
display.write(y);
display.write®;
display.write(f);
}

function setContrast(value) {
display.write(“CT” + value);
}

function powerOn() {
display.write(“SOO1”);
}

function powerOff() {
display.write(“SOO0”);
}

function directData(value) {
display.write(“MDT” + value);
}

function moveArea(x0, y0, w, h, xoffset, yoffset) {
display.write(“MA”);
display.write(x0);
display.write(y0);
display.write(w);
display.write(h);
display.write(xoffset);
display.write(yoffset);
}

function setMode(m) {
display.write(“DM”);
display.write(m);
}

function setTextPosAbs(x, y) {
display.write(“ETP”);
display.write(x);
display.write(y);
}

function drawLine(x, y, x1, y1) {
display.write(“LN”);
display.write(x);
display.write(y);
display.write(x1);
display.write(y1);
}

function drawLineTo(x, y) {
display.write(“LT”);
display.write(x);
display.write(y);
}

function drawHLine(x, y, w) {
drawLine(x, y, x + w, y);
}

function drawVLine(x, y, h) {
drawLine(x, y, x, y + h);
}

function drawBitmap(x, y, w, h, data) {
local i = 0;
if ((w & 7) != 0)
i = 1;
display.write(“DIM”);
display.write(x);
display.write(y);
display.write(w);
display.write(h);
for (local j = 0; j < h * ((w >> 3) + i); j++) {
display.write(data[j]);
}
}

function resetPrintPos() {
display.write(“GP”);
display.write(0);
display.write(0);
}`

Image Data is looking like this:

`const implogo = “\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x00\x08\x00\x00\x70\x80\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x0c\x00\x00\x71\xc0\x00\x00\x00\x00\x00\x00\x30\x00\x00\x00\x00\x0e\x00\x00\xf1\xc0\x00\x00\x00\x00\x00\x00\x70\x00\x00\x00\x00\x0e\x00\x00\xf3\xc0\x00\x00\x00\x00\x00\x00\x70\x00\x00\x00\x00\x0f\x00\x00\xe3\xc6\x00\x00\x00\x00\x00\x00\xf0\x00\x00\x00\x00\x0f\x00\x01\xe3\x8f\x00\x00\x00\x00\x00\x00\xf8\x00\x3f\xfc\x00\x0f\x80\x01\xe7\x8f\x00\x00\x00\x00\x00\x01\xf8\x01\xff\xff\x80\x0f\x80\x01\xc7\x8e\x00\x00\x10\x00\x00\x01\xf8\x07\xff\xff\xf0\x1f\x80\x03\xc7\x1e\x00\x00\x10\x00\x00\x01\xfc\x1f\xff\xff\xf8\x3f\x80\x0f\x8f\x1c\x00\x00\x38\x00\x00\x01\xfe\x7f\xff\xff\xfe\x7f\x80\x0f\x8f\x3c\x00\x00\x7c\x00\x00\x01\xff\xff\xff\xff\xff\xff\x80\x1f\xde\x3c\x00\x00\x7c\x00\x00\x01\xff\xff\xff\xff\xff\xff\x80\x1f\xfe\x38\x00\x00\xfe\x00\x00\x01\xff\xff\xf8\x1f\xff\xff\x80\x1f\xff\x78\x00\x00\xfe\x00\x00\x00\xff\xff\x80\x01\xff\xff\x80\x3f\xff\xf8\x00\x01\xff\x00\x00\x00\xff\xfe\x00\x00\x7f\xff\x00\x3f\xff\xf8\x00\x01\xff\x00\x00\x00\x7f\xfc\x00\x00\x1f\xff\x00\x3f\xff\xfc\x00\x03\xff\x80\x00\x00\x7f\xf0\x00\x00\x0f\xfe\x00\x7f\xff\xf8\x00\x03\xff\x80\x00\x00\x3f\xe0\x00\x00\x07\xfc\x00\x7f\xff\xf8\x00\x07\xff\xc0\x00\x00\x7f\xc0\x00\x00\x03\xfe\x00\x3f\xff\xf8\x00\x0f\xff\xe0\x00\x00\x7f\x80\x00\x00\x01\xfe\x00\x3f\xff\xf0\x00\x0f\xff\xe0\x00\x00\xff\x80\x00\x00\x00\xff\x00\x3f\xff\xf0\x00\x1f\xff\xf0\x00\x00\xff\x00\x00\x00\x00\xff\x00\x1f\xff\xf0\x00\x1e\x7c\xf0\x00\x01\xfe\x00\x00\x00\x10\x7f\x80\x1f\xff\xe0\x00\x30\x7c\x18\x00\x01\xfe\x20\x00\x00\xfc\x7f\x80\x0f\xff\xc0\x00\x00\x7c\x00\x00\x01\xfe\x3c\x00\x03\xfe\x3f\x80\x03\xff\x80\x00\x00\x7c\x00\x00\x01\xfc\x3f\x80\x07\xfe\x3f\xc0\x03\xff\x00\x00\x00\x3c\x00\x00\x03\xfc\x3f\xe0\x07\xfe\x3f\xc0\x03\xc0\x00\x00\x00\x3c\x00\x00\x03\xfc\x3f\xf0\x0f\xfc\x3f\xc0\x07\x80\x00\x00\x00\x3e\x00\x00\x03\xfc\x1f\xf8\x0f\xf8\x1f\xc0\x07\x80\x00\x00\x00\x3e\x00\x00\x03\xf8\x0f\xf8\x0f\xf0\x1f\xc0\x07\x80\x00\x00\x00\x1e\x00\x00\x03\xf8\x03\xf0\x0f\xe0\x1f\xc0\x0f\x00\x00\x00\x00\x1f\x00\x00\x03\xf8\x00\xe0\x03\x00\x1f\xc0\x0f\x00\x00\x00\x00\x1f\x00\x00\x03\xf8\x00\x00\x00\x00\x1f\xe0\x1f\x00\x00\x00\x00\x0f\x00\x00\x1f\xfc\x00\x00\x00\x00\x1f\xfc\x1e\x00\x00\x00\x00\x0f\x80\x00\xff\xfc\x00\x00\x00\x00\x3f\xff\x9e\x00\x00\x00\x00\x0f\xc0\x07\xff\xfc\x00\x00\x00\x00\x3f\xff\xfc\x00\x00\x00\x00\x07\xc0\x1f\xff\xfc\x00\x00\x00\x00\x3f\xff\xfc\x00\x00\x00\x00\x03\xe0\x1f\xff\xfe\x00\x00\x00\x00\x7f\xff\xfc\x00\x00\x00\x00\x03\xf0\x3f\xff\xfe\x00\x00\x00\x00\x7f\xff\xfe\x00\x00\x00\x00\x01\xf0\x3f\xff\xff\x00\x00\x00\xc0\x7f\xff\xfe\x00\x00\x00\x00\x00\xf8\x3f\xfe\xff\x00\x00\x03\x80\xff\x3f\xfe\x00\x00\x00\x00\x00\xfc\x1f\xf0\xff\x80\x00\x3e\x01\xff\x07\xfc\x00\x00\x00\x00\x00\x7e\x0f\x80\x7f\xc0\x03\xf8\x01\xfe\x01\xf8\x00\x00\x00\x00\x00\x3f\x80\x00\x7f\xc0\x00\x00\x03\xfe\x00\xf0\x00\x00\x00\x00\x00\x1f\xc0\x00\x3f\xe0\x00\x00\x07\xfc\x01\xe0\x00\x00\x00\x00\x00\x0f\xe0\x00\x1f\xf8\x00\x00\x0f\xfc\x01\xe0\x00\x00\x00\x00\x00\x07\xf8\x00\x1f\xfc\x00\x00\x3f\xf8\x03\xe0\x00\x00\x00\x00\x00\x03\xfe\x00\x0f\xff\x00\x00\xff\xf0\x03\xc0\x00\x00\x00\x00\x00\x00\xff\xc0\x07\xff\xc0\x03\xff\xe0\x03\xc0\x00\x00\x00\x00\x00\x00\x7f\xfc\x03\xff\xfc\x3f\xff\xc0\x07\x80\x00\x00\x00\x00\x00\x00\x1f\xff\xff\xff\xff\xff\xff\x80\x07\x80\x00\x00\x00\x00\x00\x00\x07\xff\xff\xff\xff\xff\xff\x00\x07\x80\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xfe\x00\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x1f\xff\xff\xff\xff\xf8\x00\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xff\xff\xe0\x00\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\xff\x80\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1f\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00”;

drawBitmap(0, 0, 128, 64, implogo);
`

edit: changed as @hugo suggested.

Note that storing the imp logo as an array (vs a string) is rather inefficient as each entry takes up 32 bits (vs 8 bits) as every squirrel int is 32 bit.

You can also make it a const string, which means it’ll not take any RAM space (just flash space), eg:

const implogo = "\\x00\\x00\\x00 ...