Modified to work with two displays
Dependencies: SPI_TFTx2 TFT_fonts TOUCH_TFTx2 mbed
Fork of touch by
Based on original code by Peter Dreshner at http://mbed.org/users/dreschpe/notebook/micro-paint/
Uses two LCD panels connected as per the following schematic:
Diff: main.cpp
- Revision:
- 6:9f5fd9246b1e
- Parent:
- 5:f5c67520d147
- Child:
- 8:bea9d962940f
--- a/main.cpp Thu Feb 14 00:26:59 2013 +0000 +++ b/main.cpp Sat Mar 02 14:20:06 2013 +0000 @@ -34,12 +34,13 @@ tt.fillrect(100,0,118,24,Green); tt.fillrect(120,0,138,24,Red); tt.fillrect(140,0,158,24,Blue); - tt.line(179,0,179,24,White); + tt.fillrect(160,0,178,24,Yellow); + tt.line(199,0,199,24,White); // the brushes - tt.fillcircle(190,12,2,White); - tt.fillcircle(210,12,4,White); - tt.fillcircle(230,12,6,White); - tt.fillcircle(250,12,brush,color); + tt.fillcircle(210,12,2,White); + tt.fillcircle(230,12,4,White); + tt.fillcircle(250,12,6,White); + tt.fillcircle(270,12,brush,color); while (1) { if (tt.is_touched()) { // touched p = tt.get_touch(); @@ -63,24 +64,27 @@ if (p.x > 140 && p.x < 160) { // Blue color = Blue; } - if (p.x > 160 && p.x < 180) { // Black + if (p.x > 160 && p.x < 180) { // Yellow + color = Yellow; + } + if (p.x > 180 && p.x < 200) { // Black color = Black; } - if (p.x > 180 && p.x < 200) { // brush 2 + if (p.x > 200 && p.x < 220) { // brush 2 brush = 2; } - if (p.x > 200 && p.x < 220) { // brush 4 + if (p.x > 220 && p.x < 240) { // brush 4 brush = 4; } - if (p.x > 220 && p.x < 240) { // brush 6 + if (p.x > 240 && p.x < 260) { // brush 6 brush = 6; } if (color != Black) { - tt.fillrect(240,0,260,24,Black); + tt.fillrect(260,0,280,24,Black); } else { - tt.fillrect(240,0,260,24,White); + tt.fillrect(260,0,280,24,White); } - tt.fillcircle(250,12,brush,color); + tt.fillcircle(270,12,brush,color); if (p.x > 300) { tt.fillrect(0,26,319,239,Black); }