Skip to content

Commit

Permalink
Version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinlyonsrepo committed Dec 7, 2024
1 parent a14cea6 commit 879cf3a
Show file tree
Hide file tree
Showing 147 changed files with 8,820 additions and 6,904 deletions.
11 changes: 3 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
stuff/
bin/
build/
examples/seven_segment_displays/Bin
examples/seven_segment_displays/Build
examples/character_displays/Bin
examples/character_displays/Build
examples/bicolor_displays/Bin
examples/bicolor_displays/Build
examples/color16_displays/Bin
examples/color16_displays/Build
examples/Bin
examples/Build
display.cppcheck
run.sh

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ clean:
.PHONY: help
help:
@echo '[HELP!]'
@echo "make - Cleans then builds Library"
@echo "make clean - Removes object file folder and library folder(BIN & BUILD)"
@echo "make - Cleans then builds library"
@echo "make clean - Cleans, Removes object file folder and library folder(BIN & BUILD)"
@echo "make buildlib - Builds library"
@echo "make install - Installs library, may need sudo"
@echo "make uninstall - uninstalls library, may need sudo"
@echo "make uninstall - Uninstalls library, may need sudo"
@echo "make help - Prints help message"
@echo '***************'
81 changes: 43 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* [File-system](#file-system)
* [Tool chain](#tool-chain)
* [Notes](#notes)
* [Raspberry Pi five](#raspberry-pi-five)
* [Older versions](#older-versions)


## Overview
Expand All @@ -26,67 +26,67 @@
* Author: Gavin Lyons.
* Description:

0. A C++ Library to connect electronic displays to Raspberry Pi single board computers.
1. Dynamic install-able Raspberry Pi C++ library.
2. 15 fonts included, new Fonts can easily be added by user
0. A C++ Library to connect electronic displays to linux based single board computers.
1. Dynamic install-able Linux C++ library.
2. 16 fonts included, new Fonts can easily be added by user
3. Common graphics + print class included
4. Dependency: [bcm2835 Library](http://www.airspayce.com/mikem/bcm2835/), Provides SPI,I2C, system timer and GPIO control.
4. Dependency: [lgpio C Library](https://abyz.me.uk/lg/lgpio.html), Provides SPI,I2C, and GPIO control.
5. Mutiple displays supported, see supported-devices, new components can be added.
6. Tested and developed on Raspberry Pis see tool chain for more details.

## Installation

1. Install the dependency bcm2835 Library if not installed
* Install the C libraries of bcm2835, [Installation instructions here](http://www.airspayce.com/mikem/bcm2835/)
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](https://abyz.me.uk/lg/download.html)

```sh
cd ~/Downloads
wget http://abyz.me.uk/lg/lg.zip
unzip lg.zip
cd lg
make
sudo make install
```

2. 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.

```sh
curl -sL https://github.com/gavinlyonsrepo/Display_Lib_RPI/archive/1.3.0.tar.gz | tar xz
curl -sL https://github.com/gavinlyonsrepo/Display_Lib_RPI/archive/2.0.0.tar.gz | tar xz
```

3. Run 'make' and 'sudo make install' to run the makefile to build and then install library.
3. 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.
* You can run 'make help' here to see other make options(uninstall etc).

```sh
cd Display_Lib_RPI-1.3.0
cd Display_Lib_RPI-2.0.0
make
sudo make install
```


## Test

1. Next step is to test your display and installed library with the included test example files, connect display.
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. Enter the appropriate category sub-folder for your type of display.
4. Edit the makefile in that folder to select the desired display and example file path.
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.
5. Run 'make' commmand. This builds the examples file using the just installed library,
4. Run 'make' commmand. This builds the examples file using the just installed library,
and creates a test executable file in "Bin".
6. Run 'make run' to run that built executable file.
This wraps "sudo" as the bcm2835 requires root permissions by default.
7. User should now see the test routine in that file running on the display. Run 'make help' to see other options.
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. Run 'make help' to see other options.

```sh
cd examples
cd <your display category name path here>
// edit the makefile in examples folder by picking the "SRC" file path you want to run
make
make run
```

Display category name path table:

| # | Display category name path | Display types |
| ------ | ------ | ------ |
| 1 | seven_segment_displays | LED segment displays |
| 2 | color16_displays| 16-bit colour graphic displays|
| 3 | bicolor_displays| 1-bit colour graphic displays |
| 4 | character_displays | Character Displays |

## Documentation

### Supported devices
Expand Down Expand Up @@ -118,19 +118,19 @@ The font system readme for the graphic displays [is here at link.](extra/doc/fon

### File system

There are 5 makefiles.
There are 2 makefiles.

1. Root directory, builds and installs library at a system level.
2. Example directory (4 off) , builds a chosen example file using installed library to an executable.
which can then be run. There is one makefile in each of the four categories of components
in example folder.
2. Example directory, builds a chosen example file using installed library to an executable.
which can then be run. An editable list of file paths to examples can be found in makefile.

Library naming :

1. library name = librpidisplaygl
2. Linker flags for complier = -lrpidisplaygl (also needs -lbcm2835 for bcm2835 library)
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 = ~330 KiB

Basic project overview, see API documentation for more detailed diagrams :

Expand All @@ -139,15 +139,20 @@ Basic project overview, see API documentation for more detailed diagrams :
### Tool chain

* Development Tool chain.
1. Raspberry PI 3 model b
1. Raspberry PI 3 model b & Raspberry PI 5
2. C++, g++ (Debian 12.2.0)
3. Raspbian , Debian 12 bookworm OS, 64 bit.
4. kernel : aarch64 Linux 6.1.0-rpi7-rpi-v8
5. bcm2835 Library v1.75 dependency.
4. lgpio library Version Number :: 131584

## Notes

### Raspberry Pi five
### Older versions

The last version of Display_lib_RPI (V1.3.0) which used the bcm2835 library as a dependency 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 is generally speaking faster than the lgpio.

The lgpio library works with linux device drivers like spidev.
Using Linux device drivers allow the library to work on Raspberry 5 as well as other linux computers that lgpio can be installed on
This provides more Flexibility, portability, better API, user space access,better compatibility and other advantages.

Will not work on Raspberry 5 at present as the bcm2835 Library dependency is not updated
to work yet on Rpi5.
191 changes: 191 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
## Gavin Lyons 01 -2024
# Makefile to build example program for Display_Lib_RPI
## URL: https://github.com/gavinlyonsrepo/Display_Lib_RPI
# Run make help for options

# === SUPPORTED DISPLAY LIST ===
# Display 1 = MAX7219
# Display 2 = TM1638
# Display 3 = HD44780 LCD I2C
# Display 4 = SSD1306 OLED I2C
# Display 5 = ERM19264 LCD SPI
# Display 6 = NOKIA5110 LCD SPI
# Display 7 = CH1115 OLED I2C
# Display 8 = Sh1106 OLED I2C
# Display 9 = Sh1107 OLED I2C
# Display 10 = ST7735X TFT LCD SPI
# Display 11 = ST7789 TFT LCD SPI
# Display 12 = ILI9341 TFT LCD SPI
# ==================================

# ***********************************************
# ***********************************************
# ** User SRC directory path Option Section A ***
# 1. Pick an example file "SRC" path and ONE ONLY.
# 2. Comment out the others.

# ================= MAX7219_7SEG ================
#SRC=max7219/TESTS_HWSPI
#SRC=max7219/TESTS_SWSPI
#SRC=max7219/BCDMODE
#SRC=max7219/CLOCK_DEMO
#SRC=max7219/CASCADE_DEMO
#================================================

# ================= TM1638 ======================
#SRC=tm1638/TEST_Model_1_3
#SRC=tm1638/TEST_Model2
# ================================================

# ================= HD44780 LCD I2C ==============
#SRC=hd44780/TEST_16x02
#SRC=hd44780/TEST_20x04
#SRC=hd44780/CLOCK_16x02
#SRC=hd44780/TEST_I2C_16x02
#=================================================

# ================= SSD1306 OLED I2C =============
#SRC=ssd1306/HELLO_WORLD
#SRC=ssd1306/TEXT_GRAPHICS_FUNCTIONS
#SRC=ssd1306/SPEED_TEST
#SRC=ssd1306/BITMAP
#SRC=ssd1306/CLOCK_DEMO
#=================================================

# ========== ERM19264_UC1609 LCD SPI==============
#SRC=erm19264/HELLO_WORLD
#SRC=erm19264/TEXT_GRAPHICS_FUNCTIONS
#SRC=erm19264/FRAMERATE_PER_SEC
#SRC=erm19264/BITMAP
#SRC=erm19264/SOFTWARE_SPI
#=================================================

# ================ NOKIA5110 LCD SPI=============
#SRC=nokia5110/HELLOWORLD
#SRC=nokia5110/TEXT_GRAPHICS_FUNCTIONS
#SRC=nokia5110/SPEEDTEST
#SRC=nokia5110/SPEEDTEST_SWSPI
#SRC=nokia5110/BITMAP
#=================================================

# ============= CH1115 OLED SPI =================
#SRC=ch1115/HELLO_WORLD
#SRC=ch1115/TEXT_GRAPHICS_FUNCTIONS
#SRC=ch1115/FPS_TEST
#SRC=ch1115/FPS_TEST_SW_SPI
#SRC=ch1115/BITMAP
#================================================

# =========== SH1106 or SH1107 OLED I2C ==========
#SRC=sh1106/HELLO_WORLD
#SRC=sh1107/HELLO_WORLD
#=================================================

# =============== ST7735 TFT LCD SPI =============
#SRC=st7735/Hello_world
#SRC=st7735/Hello_world_SWSPI
#SRC=st7735/Text_Graphics_Functions
#SRC=st7735/Bitmap_Tests
#SRC=st7735/Frame_rate_test_bmp
#SRC=st7735/Frame_rate_test_two
#SRC=st7735/Multiple_displays
#=================================================

# =============== ST7789 TFT LCD SPI =============
#SRC=st7789/Hello_world
#SRC=st7789/Hello_world_SWSPI
#SRC=st7789/Bitmap_Tests
#SRC=st7789/Text_Graphics_Functions
#SRC=st7789/Frame_rate_test_bmp
#SRC=st7789/Frame_rate_test_two
#=================================================

# =============== ILI9341 TFT LCD SPI ============
#SRC=ili9341/Hello_world
#SRC=ili9341/Hello_world_SWSPI
#SRC=ili9341/Bitmap_Tests
#SRC=ili9341/Text_Graphics_Functions
#SRC=ili9341/Mandelbrot_set
#SRC=ili9341/Touch_Screen
#=================================================

# =========== XPT2046 touchscreen basic test ======
#SRC=xpt2046/xpt_Test
#=================================================

# ************************************************
# ************************************************

# The --no-print-directory option of make tells make not to print the message about entering
# and leaving the working directory.
MAKEFLAGS += --no-print-directory

# Check for SRC example file path not set with error function
ifndef SRC
$(error SRC example file path is not set, pick a SRC path in Section A, exiting nothing done)
endif

# Pre-compiler and Compiler and linker flags
LDFLAGS= -llgpio -lrpidisplaygl
CFLAGS= -Iinclude/ -c -Wall -Wextra -std=c++20

# Build directories and output
MD=mkdir
BUILD=Build
BIN=Bin
TARGET=$(BIN)/test.out

# Project directory structure
SRCS = $(wildcard $(SRC)/*.cpp)
OBJS = $(patsubst $(SRC)/%.cpp, $(BUILD)/%.o, $(SRCS))

# Main task, makes build directory, updates your objects, builds your executable
.PHONY: all
all: clean build

# Task producing target from built files
$(TARGET): $(OBJS) $(BUILD)
@echo 'MAKE EXE FILE'
$(MD) -vp $(BIN)
$(MD) -vp $(BUILD)
$(CXX) $(OBJS) -o $@ $(LDFLAGS)
@echo 'DONE!'

# Compile all cpp files
$(BUILD)/%.o : $(SRC)/%.cpp $(BUILD)
@echo 'MAKE OBJECT FILE'
$(CXX) $(CFLAGS) $< -o $@


# Build task
.PHONY: build
build:
@echo 'BUILDING: ' $(SRC)
$(MD) -vp $(BIN)
$(MD) -vp $(BUILD)
$(MAKE) $(TARGET)
@echo '***************'

# Run task
.PHONY: run
run:
$(TARGET)

# Clean task
.PHONY: clean
clean:
@echo 'CLEANUP!'
rm -rvf $(BUILD)
rm -rvf $(BIN)
@echo '****************'

# explains the options
.PHONY: help
help:
@echo 'HELP!'
@echo "make - Cleans + builds project"
@echo "make clean - Removes object file folder and executable"
@echo "make build - Complies and Builds project"
@echo "make run - Runs built executable file"
@echo "make help - Prints help message"
@echo '***************'
Loading

0 comments on commit 879cf3a

Please sign in to comment.