The other part of the oven control panel is the OLED Display 128×64 Twig, which has an I2C interface. Since the Seeeduino168 I’m using has only 1KB of RAM, and since the screen has 1024×8 pixels, I do not have the RAM to maintain a framebuffer, like some other approaches. But I wanted to have a general purpose library that would allow me to write text and basic graphics (boxes, etc.) to the display without rendering them to a framebuffer and then updating the display.
So I created an SSD1308 library as another module for Jeff Rowberg’s i2cdevlib library. It has a basic text model, which uses a fixed-width font and divides the screen (along page boundaries, according to the page model of the SSD1308′s display RAM) into 8 rows and 16 columns of 8×8 character blocks. You can write text to an arbitrary X, Y position on this grid, and it will wrap around the end of one line to the next, and around the bottom of the screen to the top. There is some example code included in the library.
It is also possible to write graphical data directly to the screen, but if you cannot maintain an internal buffer or some other record of what is on the screen, it is not possible to draw graphics without overwriting the data underneath the area on which you are drawing. Still, I hope it will prove useful as a way to use these displays with processors that don’t have RAM to spare. It would be nice to add optional support for a framebuffer, or for an SPI interface (instead of just I2C) to have a more high-performance project, so if you’re interested in contributing, feel free to start on those.
My next goal for the OLED library is basic support for drawing boxes and other shapes to the display, stay tuned for more on that.