Java driver toolkit for the Adafruit 128x64 OLED bonnet for Raspberry Pi, with buttons and D-pad.
(This code is not associated with or endorsed by Adafruit. Adafruit is a trademark of Limor "Ladyada" Fried.)
Hardware assembly: The OLED bonnet mounted on a Raspberry Pi Zero,
which is further mounted on an (optional) Zero4U USB hub.
The USB copier demo application, showing highlighted menus arranged using the built-in
UI layout system, and limited support for internationalization (Latin1 and Korean fonts included).
This toolkit has support for drawing text or pixels on the OLED screen of the bonnet, through the OLED screen's SSD1306 chipset, and for receiving events from the D-pad and buttons through the GPIO interface. It also includes a UI layout library, and some task scheduling classes to make it easy to build an asynchronous application that does not block the screen update thread.
The code is currently designed only for a text UI, although you can write individual pixels to the display, so you could use a Java rendering library
to create a BufferedImage
, and copy the image over to the display a pixel at a time.
Make sure your /boot/config.txt
file contains the following two lines (to enable I2C, and increase the baudrate to 1Mbaud, to dramatically increase the display update rate).
dtparam=i2c_arm=on
dtparam=i2c_baudrate=1000000
See a simple demo application here.
For a complete working example of an asynchronous UI application powered by this toolkit, see the usb-copier project.
- OLED driver code and 4x5/5x8 fonts from Pi-OLED by Florian Frankenberger, which is a port of the Adafruit_SSD1306 Python driver for the SSD1306 OLED driver.
- Latin1/Korean 16x16 font by Dalgona.
- WenQuanYi Song Unicode bitmap font for Latin1, unified CJK ideographs, and Hangeul.