Awesome
Display Library for Linux based Single Board Computers
Table of contents
Overview
- Project Name: Display_Lib_RPI
- Author: Gavin Lyons.
- Description:
- A C++ Library to connect electronic displays to linux based single board computers.
- Dynamic install-able Linux C++ library.
- 16 fonts included, new Fonts can easily be added by user
- Common graphics + print class included
- Dependency: lgpio C Library, Provides SPI,I2C, and GPIO control.
- Mutiple displays supported, see supported-devices, new components can be added.
- Tested and developed on Raspberry Pis see tool chain for more details.
Installation
- 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
- 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.0.0.tar.gz | tar xz
- 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.0.0
make
sudo make install
Test
- Next step is to test your display and installed library with the included test example files, connect up display.
- Enter the example folder.
- 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.
- Run 'make' commmand. This builds the examples file using the just installed library, and creates a test executable file in "Bin".
- Run 'make run' to run that built executable file.
- 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 name | Type | Interface | Readme URL link |
---|---|---|---|
ILI9341 | 16 bit Colour Graphic TFT LCD + touchscreen | SPI HW & SW | Readme |
ST7789 | 16 bit Colour Graphic TFT LCD | SPI HW & SW | Readme |
ST7735 | 16 bit Colour Graphic TFT LCD | SPI HW & SW | Readme |
ERM19264 UC1609 | Bi colour Graphic LCD | SPI HW & SW | Readme |
Nokia 5110 PCD8544 | Bi colour Graphic LCD | SPI HW & SW | Readme |
ERM1 CH1115 | Bi colour Graphic OLED | SPI HW & SW | Readme |
SSD1306 | Bi colour Graphic OLED | I2C | Readme |
SH1106 SH1107 | Bi colour Graphic OLED | I2C | Readme |
HD44780_PCF8574 | Character LCD | I2C | Readme |
TM1638 | LED 7 segment display | ~SPI SW | Readme |
MAX7219 | LED 7 segment display | SPI HW & SW | Readme |
API Documentation
The application programming interface documentation is at link hosted on github pages and generated by Doxygen.
Fonts
The font system readme for the graphic displays is in the 'doc' folder at link.
Software
File system
There are 2 makefiles.
- Root directory, builds and installs library at a system level.
- Example directory, 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 for example)
Library naming :
- library name = librpidisplaygl
- Linker flags for complier = -lrpidisplaygl (also needs -llgpio for lgpio library)
- Library File suffix = RDL
- Project name = Display_Lib_RPI
- Installed size = ~330 KiB
Basic project overview, see API documentation for more detailed diagrams :
Error Codes
Most functions that return a value, return a enum 'rpiDisplay_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.
- Raspberry PI 5 & Raspberry PI 3 model b
- C++, g++ (Debian 12.2.0)
- Raspbian , Debian 12 bookworm OS, 64 bit.
- lgpio library Version Number :: 131584
Notes
Older versions
The last 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.