4D systems arduino libary (for uOLED displays)

I've been playing with one of these uOLED-128-G1 displays recently. I found Paul Karliks library, but it only supports a subset of the functions that the board is capable of. Most importantly it didn't have a method to cleanly shut down the OLED display to prevent damage. So I went about making a new one.


It is in no way optimal, but it works, and it's (nearly) complete. Important to note that it requires NewSoftSerial, so you can attach the display on any pins. Currently the serial object is passed by reference when you create the display object, see the example file. It also blocks execution until each command is acknowledged by the 4D chip (the timeout is changeable in the header file, defaults to 1 second)

It implements all of the SGC commands from the 4D reference sheet except for Polygon, Image, and Tune (which I didn't really need and have been too lazy to put in).

Wherever possible I matched 4d function names. ACKs and NAKs are returned as booleans, and the occasional flag value was changed from int to bool parameters. I also changed commands like UserBitmap which accept 8 individual bytes for data to instead take a byte array.

If you're not using the power or reset pins you can just set them to -1 and they'll be ignored by the library.


For the 4D LABS ?LCD-32PT(SGC) 3.2” Serial LCD Display, please consider this library with 2-byte coordinates for pixel addressing required by 320x240.

319 = 0x01 MSB + 0x64 LSB ;)

Just pushed some tiny minor updates to the library. Removed the dependency on NewSoftSerial, the library now works with software and hardware serial ports equally well. (if you want to use a software port you need the NewSoftSerial beta11, now called just SoftwareSerial)

If I can get enough progress done on the rest of my project the next thing I'm likely to work on is a method for doing lazy command updates to the display. So SGC commands can be buffered up and "yield" to your main loop while waiting for a response from the GOLDELOX controller.