-
Notifications
You must be signed in to change notification settings - Fork 219
Installing GUIslice on Raspberry Pi
Calvin Hass edited this page Feb 11, 2019
·
14 revisions
Overview >
-
Installing Raspbian and PiTFT configuration
- The following was written for the PiTFT 2.8" display, but a similar setup should accommodate other displays (such as WaveShare)
- Installing PiTFT on Raspberry Pi
-
Installing SDL1.2
-
Installing tslib
- In my experience, it seems that the native SDL touch handling is not very reliable. Instead, I recommend that the tslib library is installed instead:
- Installing tslib for Raspberry Pi
-
Old Archived Installation pages
- The original installation guide pages can be located at:
- Installing PiTFT in LINUX
- Installing SDL 1.2 for Raspberry Pi
- Installing tslib for Raspberry Pi
- Download the GUIslice library
- Clone the repository:
git clone https://github.com/ImpulseAdventure/GUIslice
- Clone the repository:
- Modify the GUIslice config file (
GUIslice_config.h
) in the /src folder- See the section Configuring GUIslice for details (*** NOTE: this guide is currently being rewritten, see below)
While the RPI config guide is being rewritten, here are some basic steps to get started:
- First, ensure SDL1.2 and tslib are installed (see above)
- We need to select the RPi display configuration. For the moment, let's assume we want the RPi running SDL1.2 using tslib for touch handling:
- Edit
/src/GUIslice_config.h
and uncomment the following line in the Raspberry Pi / LINUX section: #include "../configs/rpi-sdl1-default-tslib.h"
- Edit
- Now, let's test the display:
cd examples/linux
make test_sdl1
sudo ./test_sdl1
- If all works well, this should produce a color gradient on the display and then automatically exit after 2 seconds. Note that this test is using a simple example of SDL drawing without using the GUIslice library. If this example doesn't work, then GUIslice won't work, so it is important that we first ensure the basic SDL graphics library is operational.
- Now, let's build the first GUIslice example: (this will default to SDL1.2 and tslib -- see the Compiling GUIslice section to see alternate build options)
make ex01_lnx_basic
sudo ./ex01_lnx_basic
- If all works well, this should produce a grey background, white-framed black box that automatically exits after 2 seconds.
- Now we are ready to test touch support: build and run
ex02_lnx_btn_txt
.- If all works well, you will see a similar screen but with a blue button. Pressing the blue button should highlight it and then exit the program.
- Finally, we can run many of the other GUIslice examples: eg. ex07_ard_slider
GUIslice comes with a Makefile that can be used directly with the make command. However, it is also possible to auto-generate a Makefile via cmake
. The following summarizes the two approaches.
For the following, start by entering the GUIslice linux examples folder: cd examples/linux
By default, the GUIslice makefile defaults to SDL1.2 graphics mode and using the tslib touch driver. If no other options are provided to make, these defaults will be used.
- To build all examples with default SDL1.2 graphics & tslib touch:
make all
- To build a specific example with default SDL1.2 graphics & tslib touch:
make ex04_lnx_ctrls
- To change the graphics driver (eg. SDL1.2 vs SDL2), you can pass a
GSLC_DRV=SDL1
or GSLC_DRV=SDL2` parameter:make ex02_lnx_btn_txt GSLC_DRV=SDL2
- To change the touch driver (eg. SDL or tslib), you can pass a
GSLC_TOUCH=SDL
orGSLC_TOUCH=TSLIB
parameter:make ex07_lnx_slider GSLC_TOUCH=SDL
- The options can be combined, for example:
make ex06_lnx_callback GSLC_TOUCH=TSLIB GSLC_DRV=SDL2
make all GSLC_TOUCH=TSLIB
Note regarding SDL2 graphics mode:
- In general, I have found configuring LINUX to work with SDL2 mode from the console (ie. without X / desktop) to be tricky. Therefore, users are strongly recommended to use SDL1.2 mode if possible.
- At a later stage I may publish a more detailed guide explaining how to run SDL2 from the shell (without X)
Note regarding SDL touch mode:
- In my experience, I have found that the RPi SDL touch handling drivers are not very reliable. I strongly recommend users select tslib as shown above.
cmake .
make
- TODO: Fix the recommendations here to include a make target and include
examples/CMakeLists.txt
- Compile the examples as in the previous step
- Run the examples:
sudo ./ex02_lnx_btn_txt