/Multi_OLED

Control multiple OLED displays on one or more I2C buses simultaneously

Primary LanguageC++GNU General Public License v3.0GPL-3.0

Multi OLED library
Project started 1/1/2019
Copyright (c) 2019 BitBank Software, Inc.
Written by Larry Bank
bitbank@pobox.com

Multi_OLED
The purpose of this code is to easily control mulitple SH1106/SSD1306 OLED displays using a minimum of GPIO lines. The number of displays is not tied to the number of I2C buses if they have unique addresses. For example, if you have 4 displays that all use address 0x3C, then you'll need 4 I2C buses to control them. This can be done with as few as 5 GPIO lines if you arrange them to share the SCL wire. In the other extreme, you can control 16 unique OLED displays with 9 wires (8 I2C buses) if you have 8 set to address 0x3C and 8 set to address 0x3D. The library addresses each display individually by bus and I2C address.

Here is a Youtube video of it in action on an nRF52840 Feather. The line draw function is very efficient, so even driving 2 displays over a bit-banged I2C bus, it can draw quite quickly.

Line drawing video

Features:
---------

  • Supports 64x32, 128x32, 128x64 and 132x64 (SH1106) display sizes
  • Includes 3 sizes of fixed fonts (6x8, 8x8, 16x32)
  • Includes a function to load a Windows BMP file
  • Optional backing RAM for drawing lines and pixels for systems with enough RAM
  • Light enough to run on an ATtiny85

To initialize the library, you pass lists of the following:

1) Bus number
2) I2C Address
3) Boolean indicating to flip the display 180 degrees
4) Boolean indicating to invert the display
5) The total display count

Each access function (e.g. drawing text) takes the display number as the first parameter. This will index the correct bus number and I2C address based on the lists you provided to the initialization function.

See the example sketch for more info on how to call the functions.

This code depends on the Multi_BitBang library. You can download it here:

https://github.com/bitbank2/Multi_BitBang

If you find this code useful, please consider buying me a cup of coffee

paypal