Second Display
A utility for controlling a secondary SPI display (ST7789V3) on Linux systems.
Overview
This tool allows you to display images, animations, and a digital clock on a 320x170 pixel SPI display. It supports:
- Displaying single PNG images
- Showing a digital clock with customizable digits
- Playing animations from a sequence of PNG files
- Setting the display to solid black or white
Requirements
- Linux system with SPI display support
- libpng development libraries
- pthread support
Installation
-
Clone this repository:
git clone https://github.com/yourusername/secondDisplay.git cd secondDisplay -
Compile the program:
gcc -o secondDisplay secondDisplay.c -lpng -lpthread
Usage
Display a Single Image
./secondDisplay /path/to/image.png
The image should be a PNG file with dimensions 320x170 pixels.
Display a Black Screen
./secondDisplay --black
Display a White Screen
./secondDisplay --white
Display a Digital Clock
./secondDisplay --clock /path/to/digits/folder
The digits folder should contain PNG images named:
0.pngthrough9.png- For the digits 0-9colon.png- For the separator between hours and minutes
Each digit image should be 60x80 pixels, and the colon should be 60x80 pixels.
Display an Animation
./secondDisplay --animation /path/to/frames/folder [delay_ms]
/path/to/frames/folder: Directory containing PNG frames for the animationdelay_ms: Optional delay between frames in milliseconds (default: 100ms)
The PNG files in the frames folder will be displayed in alphabetical order.
Image Requirements
- All images should be in PNG format
- For full-screen display: 320x170 pixels
- For clock digits: 60x80 pixels
- For colon: 60x80 pixels
Examples
Display a clock using Art Deco style digits:
./secondDisplay --clock ./digits/art_deco
Play an animation with a 200ms delay between frames:
./secondDisplay --animation ./animations/fireworks 200
Troubleshooting
If you encounter issues:
- Ensure the SPI display device is available at
/dev/st7789v3 - Check that your PNG files have the correct dimensions
- Verify that you have read/write permissions for the SPI device