Skip to content

Installing GUIslice on Raspberry Pi

Calvin Hass edited this page Feb 11, 2019 · 14 revisions

Overview >

Installing & Running on Raspberry Pi

Installing Prerequisites

Installing GUIslice

  • Download the GUIslice library
    • Clone the repository: git clone https://github.com/ImpulseAdventure/GUIslice
  • 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)

QuickStart Guide

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"
  • 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
  • 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

Compiling GUIslice

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

Method 1: Compiling with built-in Makefile

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 or GSLC_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.

Method 2: Auto-generating Makefile with cmake

cmake .
make
  • TODO: Fix the recommendations here to include a make target and include examples/CMakeLists.txt

Running GUIslice

  • Compile the examples as in the previous step
  • Run the examples:
sudo ./ex02_lnx_btn_txt
Clone this wiki locally