Liquidware TouchSlide/Stealth programming hints

by Mark Sproul
Dec 2009

Hardware Overview

This document is intended to help programers that want to program the LiquidWare TouchShield Stealth and TouchShield slide.

The first thing to understand is that both the TouchShield (128 x 128) and the TouchSlide (320 x 240) have their own Atmel processors. They both are fully Arduino complient and can be easily programmed in their own right as apposed to a display for the Arduino that they are plugged into.

Below is a comparison of the 2 dispays.

TouchShield TouchSlide
Size (Pixels) 128 x 128 320 x 240
Size (inches) 1.50 inch diagonal 3.00 inch diagonal
Technology OLED - Organic LED
On board CPU ATMEGA 645 ATMEGA 2560
Program Memory 64K 256K
Interface Only Uses Arduino Pins: 2 and 3
Data Storage 16 megbit (2 megbyte) on board FLASH For storing images or data Holds 40 128 x 128 bitmap images ATMEL AT45DB161D chip
Colors 262K (6 bit-R 6 bit-G 6 bit-B)

Connecting the display to the Arduino

The TouchShield and TouchSlide are normal Arduino shields, the only pins they use besides power are 2 and 3 for serial communications. The cpu on the shields have hardware serial uarts. The Arduino does not have a hardware uart on these pins so softserial is used

The demo programs (sketches) are demo_arduino.pde and demo_slide.pde. These 2 files establish a grpahics command protocol that the Arduino sends data to the Slide and it does the drawing. It works quite well except for the limitation of baud rate. The demos work at 9600 bps and it can be difficult to get softserial to work reliably above that.

Who's the boss, The Display or the Arduino

When deciding what to do with your TouchShield or TouchSlide it is important to consider who is controlling who.

As of this writting (January 2010) most customers are using the display as the boss and the arduino simply passes data from some place such as the input shield or the button shield. With Arduinos using the 128 or 328, that made sense. The TouchSlide has far more memory than either of them

I will be documenting both options.

General programming guidelines

Below is the programming style guidelines that I have used for 25 years of programming C, both for myself and for large corporations. I encourage programmers to use this style, it makes for much easier code to read.

Programming the TouchShield and TouchSlide

There have been many changes in this release that will cause some compile errors for anyone that has done extensive programming on the Stealth or Slide.

The main issue is global variable names. Many global variable names have been changed due to confusion in the code. For example, the global variables width and height have been changed to gWidth and gHheight. This is for 2 reasons, first the variables width and height were used as argument names and as variable names within various routines. This makes it VERY difficult to know for sure what the original programmer wanted. The second reason is consistent programming style for clarity.

Earlier releases of the libraries had 2 separate libraires, one for the TouchShield and one for the TouchSlide. As of version 8.13 of the Antipasto release, the libraries are merged as one. The file Hardwaredef.h does the work of figuring out which unit is being compiled.

Project COMPILE TIME options

As anyone who has done a much programming on the Arduino knows, there are memory limitiations both for program space and for RAM runtime space. Features that may be very important to one person might be totally useless to another and occupy valuable memory space. For that reason, there are a lot of COMPILE TIME options built into the graphics library for the touchSlide and stealth. For example, Hershey fonts take LOTS of memory. If you dont need them, they can be turned toally off.

These options are found in the following files:

For example, if you want to turn off the Hershey, open font.h and you will find
comment out the line by putting "//" in front of the line
Here is a list of most of the current compile options. More details can be found in the various .h files.
Program space
_ENABLE_LARGE_NUMBERS_ font.h Larger fonts Numbers only 1138 bytes
_ENABLE_XLARGE_NUMBERS_ font.h Very large fonts Numbers only 6974 bytes
_ENABLE_HERSHEY_FONTS_ font.h Vector fonts, fully scalable. base fonts and code 3984 bytes
_ENABLE_HERSHEY_GREEK_ HersheyFonts.h One of many Hershey Fonts
There are many more fonts, refer to HersheyFonts.h
3426 bytes
_ENABLE_HERSHEY_GOTHIC_ENGLISH_ HersheyFonts.h One of many Hershey Fonts 9752 bytes
_ENABLE_TAHOMA_FONTS_ font.h Fonts by TWH 20454 bytes
_ENABLE_SCREEN_ROTATION_ HardwareDef.h The ability to put the screen in any of 4 orientations, 672 bytes
_ENABLE_PEN_TAP_ SubPGraphics.h Pen tap and hold support (written by TWH) 379 bytes
_ENABLE_SMOOTHING_ SubPGraphics.h Line smoothing (anti-aliasing) (written by TWH) 7784 bytes
_ENABLE_CLIPPING_ graphics.h Window bounds clipping (By TWH) 686 bytes
_ENABLE_HARDWARE_SCROLL_ graphics.h The TouchSlide has hardware scrolling capabilites
_ENABLE_TOUCHSHIELD_DEBUG_ SubPOptions.h This allows you to do serial printing out the normal serial port thru the Arduino. It puts the Arduino into RESET, you can specify the baudrate. 120 bytes
_SUBP_OPTION_KEYBOARD_ SubPOptions.h Not finished
_SUBP_OPTION_QUICKDRAW_ SubPOptions.h Macintosh style function names
_SUBP_OPTION_7_SEGMENT_ SubPOptions.h 7 segment number display for clocks and calculators etc
_SUPPORT_OLD_LCD_ROUTINE_NAMES_ SubPOptions.h Support the names of the original function calls in the first version of the library 602 bytes

Screen Rotation

With the latest version, the TouchSlide screen can be rotated to any of 4 positions. the constants and functions can be found in HardwareDef.h

Here is my latest creation,