A simple demonstration program for the Seeed Studio TFT Touch Shield V2.0

Dependencies:   SeeedStudioTFTv2 TFT_fonts mbed

Files at this revision

API Documentation at this revision

Comitter:
neilt6
Date:
Tue Oct 29 04:24:55 2013 +0000
Commit message:
Initial commit

Changed in this revision

SeeedStudioTFTv2.lib Show annotated file Show diff for this revision Revisions of this file
TFT_fonts.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SeeedStudioTFTv2.lib	Tue Oct 29 04:24:55 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mazgch/code/SeeedStudioTFTv2/#f2aaffad7d38
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT_fonts.lib	Tue Oct 29 04:24:55 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/dreschpe/code/TFT_fonts/#76774250fcec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 29 04:24:55 2013 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+#include "SeeedStudioTFTv2.h"
+#include "Arial12x12.h"
+#include "Arial24x23.h"
+#include "Arial28x28.h"
+#include "font_big.h"
+
+SeeedStudioTFTv2 TFT(PTB3, PTB1, PTB2, PTB0, PTD2, PTD3, PTD1, PTA5, PTC8, PTC9, PTA4);
+
+int main()
+{
+    //Configure the display driver
+    TFT.background(Black);
+    TFT.foreground(White);
+    TFT.cls();
+
+    //Print a welcome message
+    TFT.set_font((unsigned char*) Arial12x12);
+    TFT.locate(0,0);
+    TFT.printf("Hello Mbed");
+
+    //Wait for 5 seconds
+    wait(5.0);
+
+    //Draw some graphics
+    TFT.cls();
+    TFT.set_font((unsigned char*) Arial24x23);
+    TFT.locate(100,100);
+    TFT.printf("Graphic");
+
+    TFT.line(0,0,100,0,Green);
+    TFT.line(0,0,0,200,Green);
+    TFT.line(0,0,100,200,Green);
+
+    TFT.rect(100,50,150,100,Red);
+    TFT.fillrect(180,25,220,70,Blue);
+
+    TFT.circle(80,150,33,White);
+    TFT.fillcircle(160,190,20,Yellow);
+
+    double s;
+    for (int i = 0; i < 320; i++) {
+        s = 20 * sin((long double)i / 10);
+        TFT.pixel(i, 100 + (int)s, Red);
+    }
+
+    //Wait for 5 seconds
+    wait(5.0);
+
+    //Multiple fonts
+    TFT.foreground(White);
+    TFT.background(Blue);
+    TFT.cls();
+    TFT.set_font((unsigned char*) Arial24x23);
+    TFT.locate(0,0);
+    TFT.printf("Different Fonts :");
+    TFT.set_font((unsigned char*) Neu42x35);
+    TFT.locate(0,30);
+    TFT.printf("Hello Mbed 1");
+    TFT.set_font((unsigned char*) Arial24x23);
+    TFT.locate(20,80);
+    TFT.printf("Hello Mbed 2");
+    TFT.set_font((unsigned char*) Arial12x12);
+    TFT.locate(35,120);
+    TFT.printf("Hello Mbed 3");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 29 04:24:55 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/f37f3b9c9f0b
\ No newline at end of file