Skip to content

Commit

Permalink
Version 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinlyonsrepo committed Feb 26, 2025
1 parent be720e1 commit 8c5b73c
Show file tree
Hide file tree
Showing 121 changed files with 5,942 additions and 4,197 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ build/
examples/Bin
examples/Build
display.cppcheck
geany_test_project
run.sh

493 changes: 4 additions & 489 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
MAKEFLAGS += --no-print-directory

# Pre-compiler and Compiler flags
CXX_FLAGS := -march=native -mtune=native -mcpu=native -Wall -Wextra -std=c++20
CXX_FLAGS := -march=native -mtune=native -mcpu=native -Wall -Wextra -std=c++23

# Project directory structure
SRC := src
Expand Down
40 changes: 28 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
* [Fonts](#fonts)
* [Software](#software)
* [File-system](#file-system)
* [Error Codes](#error-codes)
* [Tool chain](#tool-chain)
* [Configuration](#configuration)
* [Notes](#notes)
* [Older versions](#older-versions)

Expand Down Expand Up @@ -54,14 +56,14 @@ sudo make install
* Run following command to download latest release from github.

```sh
curl -sL /~https://github.com/gavinlyonsrepo/Display_Lib_RPI/archive/2.1.0.tar.gz | tar xz
curl -sL /~https://github.com/gavinlyonsrepo/Display_Lib_RPI/archive/2.2.0.tar.gz | tar xz
```

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.

```sh
cd Display_Lib_RPI-2.1.0
cd Display_Lib_RPI-2.2.0
make
sudo make install
```
Expand Down Expand Up @@ -95,20 +97,21 @@ make run
| ILI9341 | 16 bit Colour Graphic TFT LCD + touchscreen |SPI HW & SW| [Readme](extra/doc/ili9341/README.md)|
| ST7789 | 16 bit Colour Graphic TFT LCD |SPI HW & SW| [Readme](extra/doc/st7789/README.md)|
| ST7735 | 16 bit Colour Graphic TFT LCD |SPI HW & SW| [Readme](extra/doc/st7735/README.md)|
| SSD1331 | 16 bit Colour Graphic OLED |SPI HW & SW| [Readme](extra/doc/ssd1331/README.md)|
| ERM19264 UC1609| Bi colour Graphic LCD |SPI HW & SW| [Readme](extra/doc/erm19264/README.md) |
| Nokia 5110 PCD8544| Bi colour Graphic LCD |SPI HW & SW| [Readme](extra/doc/nokia5110/README.md) |
| ERM1 CH1115 | Bi colour Graphic OLED |SPI HW & SW| [Readme](extra/doc/ch1115/README.md) |
| SSD1306| Bi colour Graphic OLED | I2C | [Readme](extra/doc/ssd1306/README.md) |
| SH1106 SH1107| Bi colour Graphic OLED | I2C | [Readme](extra/doc/sh110x/README.md) |
| HD44780_PCF8574 | Character LCD | I2C | [Readme](extra/doc/hd44780/README.md) |
| TM1638 | LED 7 segment display| ~SPI SW | [Readme](extra/doc/tm1638/README.md) |
| TM1637 | LED 7 segment display| ~SPI SW | [Readme](extra/doc/tm1637/README.md) |
| TM1637 | LED 7 segment display| GPIO | [Readme](extra/doc/tm1637/README.md) |
| MAX7219 | LED 7 segment display | SPI HW & SW| [Readme](extra/doc/max7219/README.md) |

### API Documentation

[The application programming interface documentation is at link](https://gavinlyonsrepo.github.io/misc/software_docs/Display_Lib_RPI/index.html)
hosted on github pages and generated by Doxygen.
The application programming interface html [documentation is at link](https://gavinlyonsrepo.github.io/misc/software_docs/Display_Lib_RPI/index.html)
hosted on github pages and generated by Doxygen. Detailed project overview images are available there.

### Fonts

Expand All @@ -132,16 +135,12 @@ Library naming :
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 :


[![Overview image](/~https://github.com/gavinlyonsrepo/Display_Lib_RPI/blob/main/extra/images/diagram.png)](/~https://github.com/gavinlyonsrepo/Display_Lib_RPI/blob/main/extra/images/diagram.png)
5. Installed size = ~500 KiB.
6. Namespaces see API.documentation.

### Error Codes

Most functions that return a value, return a enum 'rpiDisplay_Return_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.](extra/doc/errors/README.md)

Expand All @@ -153,6 +152,23 @@ is in the 'doc' folder [at link.](extra/doc/errors/README.md)
3. Raspbian , Debian 12 bookworm OS, 64 bit.
4. lgpio library Version Number :: 131584

### 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 this setting is enabled.
Some errors conditions trigger logging if it is enabled.

Config file :

[![cfg file](/~https://github.com/gavinlyonsrepo/Display_Lib_RPI/blob/main/extra/images/config.png)](/~https://github.com/gavinlyonsrepo/Display_Lib_RPI/blob/main/extra/images/config.png)

Log file example output :

[![log file](/~https://github.com/gavinlyonsrepo/Display_Lib_RPI/blob/main/extra/images/logfile.png)](/~https://github.com/gavinlyonsrepo/Display_Lib_RPI/blob/main/extra/images/logfile.png)


## Notes

### Older versions
Expand Down
10 changes: 10 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# Display 11 = ST7735X TFT LCD SPI
# Display 12 = ST7789 TFT LCD SPI
# Display 13 = ILI9341 TFT LCD SPI
# Display 14 = SSD1331 LCD SPI
# ==================================

# ***********************************************
Expand Down Expand Up @@ -55,6 +56,7 @@
#SRC=ssd1306/SPEED_TEST
#SRC=ssd1306/BITMAP
#SRC=ssd1306/CLOCK_DEMO
#SRC=ssd1306/UTILS_TEST
#=================================================

# ========== ERM19264_UC1609 LCD SPI==============
Expand Down Expand Up @@ -114,6 +116,14 @@
#SRC=ili9341/Touch_Screen
#=================================================

# =============== SSD1331 TFT LCD SPI =============
#SRC=ssd1331/Hello_world
#SRC=ssd1331/Hello_world_SWSPI
#SRC=ssd1331/Bitmap_Tests
#SRC=ssd1331/Text_Graphics_Functions
#SRC=ssd1331/Clock_demo
#=================================================

# =========== XPT2046 touchscreen basic test ======
#SRC=xpt2046/xpt_Test
#=================================================
Expand Down
Binary file added examples/bitmap/bitmap16images/16pic4_96x64.bmp
Binary file not shown.
Binary file added examples/bitmap/bitmap16images/16pic5_96x64.bmp
Binary file not shown.
Binary file added examples/bitmap/bitmap24images/24pic8_96X64.bmp
Binary file not shown.
Binary file added examples/bitmap/bitmap24images/24pic9_96X64.bmp
Binary file not shown.
22 changes: 11 additions & 11 deletions examples/ch1115/BITMAP/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//GPIO
const uint8_t RES = 25; // GPIO pin number pick any you want
const uint8_t DC = 24; // GPIO pin number pick any you want
int GPIO_CHIP_DEVICE = 4; // RPI 5 = 4 , other RPIs = 0
int GPIO_CHIP_DEVICE = 0; // GPIO chip device number usually 0

// Screen
const uint8_t MY_OLED_WIDTH = 128;
Expand Down Expand Up @@ -128,10 +128,10 @@ bool Setup(void)
{
printf("OLED Begin\r\n");
printf("lgpio library Version Number :: %i\r\n",lguVersion());
printf("Display_LIB_RPI Library version number :: %u\r\n", GetRDLibVersionNum());
printf("Display_LIB_RPI Library version number :: %u\r\n", rdlib::LibraryVersion());
delayMilliSecRDL(50);

if(myOLED.OLEDbegin(OLEDcontrast, HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS, GPIO_CHIP_DEVICE ) != rpiDisplay_Success) // initialize the OLED
if(myOLED.OLEDbegin(OLEDcontrast, HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS, GPIO_CHIP_DEVICE ) != rdlib::Success) // initialize the OLED
{
printf("Error 1202: Setup : Cannot start spi, \r\n");
return false;
Expand Down Expand Up @@ -175,7 +175,7 @@ void Test302(void)
{
// Method (2) assign bitmap to a buffer at init
printf(" Test 302 OLED buffer method, assign bitmap at initialization \n");
if (myOLED.OLEDSetBufferPtr(MY_OLED_WIDTH, MY_OLED_HEIGHT, screenBuffer128x64, sizeof(screenBuffer128x64)) != rpiDisplay_Success)
if (myOLED.OLEDSetBufferPtr(MY_OLED_WIDTH, MY_OLED_HEIGHT, screenBuffer128x64) != rdlib::Success)
{
EndTest();
exit(-1);
Expand All @@ -190,9 +190,9 @@ void Test303(void)
{
printf(" Test 303 setDrawBitmapAddr method, for Bitmap Data Vertical addressed\n");
myOLED.setDrawBitmapAddr(true); // for Bitmap Data Vertical addressed
myOLED.drawBitmap(0, 0, SignalIconVa, 16, 8, RDL_BLACK, RDL_WHITE, sizeof(SignalIconVa));
myOLED.drawBitmap(30, 20, SignalIconVa, 16, 8, RDL_WHITE, RDL_BLACK, sizeof(SignalIconVa));
myOLED.drawBitmap(70, 30, TemperatureImageVA, 16, 16, RDL_WHITE, RDL_BLACK, sizeof(TemperatureImageVA));
myOLED.drawBitmap(0, 0, SignalIconVa, 16, 8, myOLED.BLACK, myOLED.WHITE);
myOLED.drawBitmap(30, 20, SignalIconVa, 16, 8, myOLED.WHITE, myOLED.BLACK);
myOLED.drawBitmap(70, 30, TemperatureImageVA, 16, 16, myOLED.WHITE, myOLED.BLACK);
myOLED.OLEDupdate();
delayMilliSecRDL(5000);
myOLED.OLEDclearBuffer();
Expand All @@ -204,15 +204,15 @@ void Test304(void)
printf(" Test 304 setDrawBitmapAddr method, for Bitmap Data Horziontal addressed\n");
myOLED.setDrawBitmapAddr(false); // for Bitmap Data Horziontal addressed

myOLED.drawBitmap(10, 25, SignalIconHa, 16, 8, RDL_BLACK, RDL_WHITE, sizeof(SignalIconHa));
myOLED.drawBitmap(100, 20, SignalIconHa, 16, 8, RDL_BLACK, RDL_WHITE, sizeof(SignalIconHa));
myOLED.drawBitmap(60, 20, SignalIconHa, 16, 8, RDL_WHITE, RDL_BLACK, sizeof(SignalIconHa));
myOLED.drawBitmap(10, 25, SignalIconHa, 16, 8, myOLED.BLACK, myOLED.WHITE);
myOLED.drawBitmap(100, 20, SignalIconHa, 16, 8, myOLED.BLACK, myOLED.WHITE);
myOLED.drawBitmap(60, 20, SignalIconHa, 16, 8, myOLED.WHITE, myOLED.BLACK);

myOLED.OLEDupdate();
delayMilliSecRDL(5000);
myOLED.OLEDclearBuffer();

myOLED.drawBitmap(0, 0, bigImage64x64, 64, 64, RDL_BLACK, RDL_WHITE, sizeof(bigImage64x64));
myOLED.drawBitmap(0, 0, bigImage64x64, 64, 64, myOLED.BLACK, myOLED.WHITE);

myOLED.OLEDupdate();
delayMilliSecRDL(5000);
Expand Down
16 changes: 8 additions & 8 deletions examples/ch1115/FPS_TEST/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//GPIO
const uint8_t RES = 25; // GPIO pin number pick any you want
const uint8_t DC = 24; // GPIO pin number pick any you want
int GPIO_CHIP_DEVICE = 4; // RPI 5 = 4 , other RPIs = 0
int GPIO_CHIP_DEVICE = 0; // GPIO chip device number usually 0

// Screen
const uint8_t MY_OLED_WIDTH = 128;
Expand Down Expand Up @@ -57,10 +57,10 @@ bool Setup(void)
{
printf("OLED Begin\r\n");
printf("lgpio library Version Number :: %i\r\n",lguVersion());
printf("Display_LIB_RPI Library version number :: %u\r\n", GetRDLibVersionNum());
printf("Display_LIB_RPI Library version number :: %u\r\n", rdlib::LibraryVersion());
delayMilliSecRDL(50);

if(myOLED.OLEDbegin(OLEDcontrast, HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS, GPIO_CHIP_DEVICE ) != rpiDisplay_Success) // initialize the OLED
if(myOLED.OLEDbegin(OLEDcontrast, HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS, GPIO_CHIP_DEVICE ) != rdlib::Success) // initialize the OLED
{
printf("Error 1202: Setup : Cannot start spi, \r\n");
return false;
Expand All @@ -82,7 +82,7 @@ void myTest() {

// Buffer setup, Define a buffer to cover whole screen
uint8_t screenBuffer[FULLSCREEN]; // 1024 bytes = 128 * 64/8
if (myOLED.OLEDSetBufferPtr(MY_OLED_WIDTH,MY_OLED_HEIGHT, screenBuffer, sizeof(screenBuffer)) != rpiDisplay_Success) return;
if (myOLED.OLEDSetBufferPtr(MY_OLED_WIDTH,MY_OLED_HEIGHT, screenBuffer) != rdlib::Success) return;

myOLED.OLEDclearBuffer(); // Clear buffer
printf("FPS HW SPI:: test ends at %u\r\n",countLimit );
Expand Down Expand Up @@ -127,13 +127,13 @@ void display(long currentFramerate, int count)
myOLED.print(fps);
myOLED.print(" fps");
myOLED.setCursor(0, 50);
myOLED.print(GetRDLibVersionNum());
myOLED.print(rdlib::LibraryVersion());

myOLED.drawFastVLine(64, 0, 63, RDL_BLACK);
myOLED.drawFastVLine(64, 0, 63, myOLED.BLACK);
myOLED.fillRect(70, 10, 20, 20, colour);
myOLED.fillCircle(110, 20, 10, !colour);
myOLED.drawRoundRect(80, 40, 40, 20, 10, RDL_BLACK);
myOLED.drawPixel(65, 60, RDL_BLACK);
myOLED.drawRoundRect(80, 40, 40, 20, 10, myOLED.BLACK);
myOLED.drawPixel(65, 60, myOLED.BLACK);

myOLED.OLEDupdate();
}
Expand Down
16 changes: 8 additions & 8 deletions examples/ch1115/FPS_TEST_SW_SPI/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const uint8_t DC = 24; // GPIO pin number pick any you want
const uint8_t DIN = 5; // GPIO pin number pick any you want
const uint8_t SCLK = 6; // GPIO pin number pick any you want
const uint8_t CS = 21; // GPIO pin number pick any you want
int GPIO_CHIP_DEVICE = 4; // RPI 5 = 4 , other RPIs = 0
int GPIO_CHIP_DEVICE = 0; // GPIO chip device number usually 0

// software SPI
ERMCH1115 myOLED(MY_OLED_WIDTH ,MY_OLED_HEIGHT , RES, DC, CS, SCLK,DIN) ;
Expand Down Expand Up @@ -56,10 +56,10 @@ bool Setup(void)
{
printf("OLED Begin\r\n");
printf("lgpio library Version Number :: %i\r\n",lguVersion());
printf("Display_LIB_RPI Library version number :: %u\r\n", GetRDLibVersionNum());
printf("Display_LIB_RPI Library version number :: %u\r\n", rdlib::LibraryVersion());
delayMilliSecRDL(50);

if(myOLED.OLEDbegin(OLEDcontrast, GPIO_CHIP_DEVICE ) != rpiDisplay_Success) // initialize the OLED
if(myOLED.OLEDbegin(OLEDcontrast, GPIO_CHIP_DEVICE ) != rdlib::Success) // initialize the OLED
{
printf("Error 1202: Setup GPIO failed, \r\n");
return false;
Expand All @@ -83,7 +83,7 @@ void myTest() {
printf("FPS SW SPI:: test ends at %u\r\n", countLimit);
// Buffer setup, Define a buffer to cover whole screen
uint8_t screenBuffer[myScreenSize ]; // 1024 bytes = 128 * 64/8
if (myOLED.OLEDSetBufferPtr(MY_OLED_WIDTH, MY_OLED_HEIGHT, screenBuffer, sizeof(screenBuffer)) != rpiDisplay_Success) return;
if (myOLED.OLEDSetBufferPtr(MY_OLED_WIDTH, MY_OLED_HEIGHT, screenBuffer) != rdlib::Success) return;

myOLED.OLEDclearBuffer(); // Clear buffer

Expand Down Expand Up @@ -128,13 +128,13 @@ void display(long currentFramerate, int count)
myOLED.print(fps);
myOLED.print(" fps");
myOLED.setCursor(0, 50);
myOLED.print(GetRDLibVersionNum());
myOLED.print(rdlib::LibraryVersion());

myOLED.drawFastVLine(64, 0, 63, RDL_BLACK);
myOLED.drawFastVLine(64, 0, 63, myOLED.BLACK);
myOLED.fillRect(70, 10, 20, 20, colour);
myOLED.fillCircle(110, 20, 10, !colour);
myOLED.drawRoundRect(80, 40, 40, 20, 10, RDL_BLACK);
myOLED.drawPixel(65, 60, RDL_BLACK);
myOLED.drawRoundRect(80, 40, 40, 20, 10, myOLED.BLACK);
myOLED.drawPixel(65, 60, myOLED.BLACK);

myOLED.OLEDupdate();
}
Expand Down
8 changes: 4 additions & 4 deletions examples/ch1115/HELLO_WORLD/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//GPIO
const uint8_t RES = 25; // GPIO pin number pick any you want
const uint8_t DC = 24; // GPIO pin number pick any you want
int GPIO_CHIP_DEVICE = 4; // RPI 5 = 4 , other RPIs = 0
int GPIO_CHIP_DEVICE = 0; // GPIO chip device number usually 0

// Screen
const uint8_t MY_OLED_WIDTH = 128;
Expand Down Expand Up @@ -54,10 +54,10 @@ bool Setup(void)
{
printf("OLED Begin\r\n");
printf("lgpio library Version Number :: %i\r\n",lguVersion());
printf("Display_LIB_RPI Library version number :: %u\r\n", GetRDLibVersionNum());
printf("Display_LIB_RPI Library version number :: %u\r\n", rdlib::LibraryVersion());
delayMilliSecRDL(50);

if(myOLED.OLEDbegin(OLEDcontrast, HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS, GPIO_CHIP_DEVICE ) != rpiDisplay_Success) // initialize the OLED
if(myOLED.OLEDbegin(OLEDcontrast, HWSPI_DEVICE, HWSPI_CHANNEL, HWSPI_SPEED, HWSPI_FLAGS, GPIO_CHIP_DEVICE ) != rdlib::Success) // initialize the OLED
{
printf("Error 1202: Setup : Cannot start spi \r\n");
return false;
Expand All @@ -80,7 +80,7 @@ void myTest() {

// Buffer setup, Define a buffer to cover whole screen
uint8_t screenBuffer[myScreenSize];
if (myOLED.OLEDSetBufferPtr(MY_OLED_WIDTH, MY_OLED_HEIGHT, screenBuffer, sizeof(screenBuffer)) != rpiDisplay_Success) return;
if (myOLED.OLEDSetBufferPtr(MY_OLED_WIDTH, MY_OLED_HEIGHT, screenBuffer) != rdlib::Success) return;
myOLED.OLEDclearBuffer(); // Clear buffer
myOLED.setFont(font_default);
myOLED.setCursor(20, 20);
Expand Down
Loading

0 comments on commit 8c5b73c

Please sign in to comment.