30 FPS Hack
The 30 FPS Hack is a low-level graphics driver hack. It optimizes the TouchShield’s painting function to allow faster drawing routines.
Parts for 30 FPS Hack:
This code can be uploaded to the TouchShield to draw full frame at up to 30 frames a second (FPS). The screen fades quickly between two colors.
Make sure you switch to the TouchShield core before compiling!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#define WIDTH 128 #define HEIGHT 128 #define NUMPIXELS (WIDTH*HEIGHT) #define PIXEL(x,y) (y*WIDTH+x) #define SETCOLOR(r,g,b) { LCD_DATA_HIGH = (r); LCD_DATA_MED = (g); LCD_DATA_LOW = (b); } void setup() { } void loop() { int pix = 0; char colR = 0, colG = 0, colB = 0; lcd_setRow(0,127); lcd_setColumn(0,127); lcd_write_C(0x5C); //enable write RAM while(1) { SETBIT(LCD_CTRL_PORT,LCD_DC); CLRBIT(LCD_CTRL_PORT,LCD_CS); for(pix = 0; pix < NUMPIXELS; pix++) { CLRBIT(LCD_CTRL_PORT,LCD_WR); SETCOLOR(colR,colG,colB); SETBIT(LCD_CTRL_PORT,LCD_WR); } colB++; if (!colB) { colG++; if (!colG) colR++; } } } |
I’ve uploaded the rest of the TouchShield’s built-in commands are over at the function reference wiki.






