This project provides comprehensive driver support for the PiSugar Whisplay Hat, enabling easy control of the onboard LCD screen, physical buttons, LED indicators, and audio functions.
More Details please refer to Whisplay HAT Docs
The device utilizes I2C, SPI, and I2S buses. The I2S and I2C buses are used for audio and will be enabled automatically during driver installation.
After cloning the github project, navigate to the Driver directory and use the script to install.
git clone https://github.com/PiSugar/Whisplay.git --depth 1
cd Whisplay/Driver
sudo bash install_wm8960_drive.sh
sudo rebootThe program can be tested after the driver is installed.
cd Whisplay/example
sudo bash run_test.shAll driver files are located in the Driver directory and primarily include:
- Function: This script encapsulates the LCD display, physical buttons, and LED indicators into easy-to-use Python objects, simplifying hardware operations.
- Quick Verification: Refer to
example/test.pyto quickly test the LCD, LED, and button functions.
-
Source: Audio driver support is provided by Waveshare.
-
Installation: Install by running the
install_wm8960_drive.shscript:cd Driver sudo bash install_wm8960_drive.sh
The example directory contains Python examples to help you get started quickly.
- Function: This script verifies that the LCD, LEDs, and buttons are functioning correctly.
- Usage:
You can also specify an image or sound for testing:
cd example sudo bash run_test.shEffect: When executed, the script will display a test image on the LCD. Pressing any button will change the screen to a solid color, and the RGB LED will simultaneously change to match that color.sudo bash run_test.sh --image data/test2.jpg --sound data/test.mp3
- Function: This script tests the microphone functionality.
- Usage:
Effect: The script records audio from the microphone for 10 seconds and plays it back through the speaker.
cd example sudo bash mic_test.sh
- Function: This script demonstrates recording audio and playback functionality.
- Usage:
Effect: The script displays an image indicating the recording stage. Pressing the button to stop recording will switch to the playback stage, displaying a different image while playing back the recorded audio. After playback, it returns to the recording stage again.
cd example sudo python3 test2.py
- Function: This script plays an MP4 video file on the LCD screen.
- Prerequisites: Ensure that
ffmpegis installed on your system. You can install it using:sudo apt-get install ffmpeg
- Download Test Video:
download a sample MP4 video to the
example/datadirectory:cd example wget -O data/whisplay_test.mp4 https://img-storage.pisugar.uk/whisplay_test.mp4 - Usage:
execute the script in the
exampledirectory:Effect: The specified MP4 video will be played on the LCD screen.sudo python3 play_mp4.py --file data/whisplay_test.mp4
Note: This software currently only supports the official full version of the operating system.