Display Library for Linux based Single Board Computers

May 11, 2026 ยท View on GitHub

Website Rss Donate

logo image

Table of contents

Overview

  • Project Name: Display_Lib_RPI
  • Author: Gavin Lyons.
  • Description:
  1. A C++ Library to connect electronic displays to linux based single board computers.
  2. Dynamic install-able Linux C++ library.
  3. 16 fonts included, new fonts can easily be added by user
  4. Common graphics + print class included
  5. Dependency: lgpio C Library, Provides SPI,I2C, and GPIO control.
  6. Mutiple displays supported, see supported-devices, new components can be added.
  7. Tested and developed on Raspberry Pis see tool chain for more details.

Installation

  1. Download & Install the dependency lgpio C Library, if not installed. lgpio is a C library for Linux Single Board Computers(SBC) which allows control of the General Purpose Input Output pins. Install the lgpio, Installation instructions here
cd ~/Downloads
wget http://abyz.me.uk/lg/lg.zip
unzip lg.zip
cd lg
make
sudo make install
  1. Download the Display_Lib_RPI library Open a Terminal in a folder where you want to download,build & test library Run following command to download latest release from github.
curl -sL https://github.com/gavinlyonsrepo/Display_Lib_RPI/archive/2.6.0.tar.gz | tar xz
  1. Install library : Run 'make' and 'sudo make install' to run the makefile to build and then install library. It will be installed to usr/local/lib and usr/local/include by default.
cd Display_Lib_RPI-2.6.0
make
sudo make install

Testing

  1. Next step is to test your display and installed library with the included test example files, connect up display.
  2. Enter the example folder.
  3. Edit the makefile in that folder to select the desired example file path for your Display. Simply edit "SRC" variable at top of the makefile. In the "User SRC directory Option Section" at top of file. Pick an example "SRC" directory path and One ONLY.
  4. Run 'make' commmand. This builds the examples file using the just installed library, and creates a test executable file in "Bin".
  5. Run 'make run' to run that built executable file.
  6. User should now see the test routine in that file running on the display.
cd examples
# Edit the makefile in examples folder by picking the "SRC" file path you want to run
make
make run

Documentation

Supported devices

Component nameTypeInterfaceReadme URL link
ILI934116 bit Colour Graphic TFT LCDSPI HW & SWReadme
ST778916 bit Colour Graphic TFT LCDSPI HW & SWReadme
ST773516 bit Colour Graphic TFT LCDSPI HW & SWReadme
GC9A01A16 bit Colour Graphic TFT LCDSPI HW & SWReadme
GC9D01N16 bit Colour Graphic TFT LCDSPI HW & SWReadme
GC910716 bit Colour Graphic TFT LCDSPI HW & SWReadme
SSD133116 bit Colour Graphic OLEDSPI HW & SWReadme
ERM19264 UC1609Bi colour Graphic LCDSPI HW & SWReadme
PCD8544Bi colour Graphic LCDSPI HW & SWReadme
ERM1 CH1115Bi colour Graphic OLEDSPI HW & SWReadme
SSD1306Bi colour Graphic OLEDI2CReadme
SSD1315Bi colour Graphic OLEDI2CReadme
SH1106 SH1107Bi colour Graphic OLEDI2CReadme
HD44780 PCF8574Character LCDI2CReadme
TM1638LED 7 segment displayGPIOReadme
TM1637LED 7 segment displayGPIOReadme
MAX7219LED 7 segment displaySPI HW & SWReadme
HT16K33LED segment displayI2CReadme

API Documentation

The application programming interface html documentation is at link hosted on github pages and generated by Doxygen. Detailed project overview images are available there.

Fonts

The font system readme for the graphic displays is in the 'doc' folder at link.

Software

File system

There are 2 makefiles.

  1. Root directory makefile, builds and installs library at a system level.
  2. Example directory makefile, builds a chosen example file using installed library to an executable. which can then be run. A user editable list of file paths to examples can be found in makefile.

Run 'make help' on these makefiles to see a menu of all options.(uninstall library for example)

Library naming :

  1. library name = librpidisplaygl
  2. Linker flags for complier = -lrpidisplaygl (also needs -llgpio for lgpio library)
  3. Library File suffix = RDL
  4. Project name = Display_Lib_RPI
  5. Installed size = ~700 KiB.
  6. Namespaces see API.documentation.

Project class overview :

pc img

Error Codes

Most functions that return a value, return a enum 'rdlib::Return_Codes'. Zero for success and a positive number for an error code. The error codes are listed in is in the 'doc' folder at link.

Tool chain

Development Tool chain:

  1. Raspberry PI 5 & Raspberry PI 3 model b
  2. C++ 23, g++ (Debian 14.2.0-19) 14.2.0
  3. Raspbian , Debian 12 bookworm OS, 64 bit , Debian 13 Trixie OS, 64 bit.
  4. lgpio library Version Number :: 131584
  5. Also tested on a raspberry pi 4 see issue number 2 on github.

Configuration

A configuration file can be created which is read into program by running "rdlib_config::loadConfig()" at start of program If the file is missing it will create it at "/($HOME)/.config/rdlib_config/config.cfg". In this file logging and debug modes can be enabled they are OFF by default. A path to log file can also be set. Certain functions produce debug information to console if the debug setting is enabled. Some errors conditions trigger logging if the logging setting is enabled. The logging function can also be used in user applications: see file examples/misc_test/utilities_test/main.cpp.

Config file :

cfg file

Log file example output :

log file

Notes

Older versions

A previous version of Display_lib_RPI (V1.3.0) which used the bcm2835 library as a low level interface is in releases and can still be downloaded and used. Version 1.3.0 will NOT work on raspberry pi 5 and uses direct register access. It will only work on raspberry pi < 5.