Very simple SW using FT800 graphic lib [NO TOUCHSCREEN USED]

Dependencies:   FT800_2 mbed

Demo for FT800 graphic lib. There is only one screen with seconds counter and Clock widget, no touchscreen functionality.

https://habrastorage.org/files/053/a28/a1a/053a28a1a81c47f4b24eb61d92d8bb37

Hardware

Connection

MCU-board is connected to TFT-module via Break Out Board. You need 6 signals to connect: SCK, MOSI and MISO are connected to a SPI channel, SS is the chip select signal, PD work as powerdown and INT for interrupts from TFT to MCU.

You have to connect VDD to BLVDD at Break Out Board if you use the board:

/media/uploads/Ksenia/4_-5-.jpg

Photo

/media/uploads/Ksenia/p1010069_.png

Проект для статьи "Как перестать бояться и полюбить mbed.[Часть 2]" См. https://habrahabr.ru/users/uuuulala/topics/

Files at this revision

API Documentation at this revision

Comitter:
Ksenia
Date:
Fri Sep 16 12:55:01 2016 +0000
Commit message:
Initial commit

Changed in this revision

FT800_2.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
diff -r 000000000000 -r f3c452ce44ed FT800_2.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FT800_2.lib	Fri Sep 16 12:55:01 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/dreschpe/code/FT800_2/#16e22c789f7d
diff -r 000000000000 -r f3c452ce44ed main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Sep 16 12:55:01 2016 +0000
@@ -0,0 +1,70 @@
+#include "mbed.h"
+#include "FT_Platform.h"
+
+Ticker timeKeeping;
+volatile uint64_t seconds = 0;
+
+/***********************************************************************************************************************/
+/* Declare and initialize FTDI FT800 controller according to SPI lines connected */
+ 
+// SLSTK3400A
+FT800 TFT (PE10, PE11, PE12, PE13, PB11, PD4); // mosi, miso, sck, ss, int, pd
+
+// WIZwiki-W7500P
+//FT800 TFT (D11, D12, D13, D10, D9, D8); // mosi, miso, sck, ss, int, pd
+
+// ATSAMD21-XPRO
+//FT800 TFT (PA18, PA16, PA19, PA17, PA20, PA21); // mosi, miso, sck, ss, int, pd
+
+
+/***********************************************************************************************************************/
+/* Seconds counter */
+void secondsCallback(void)
+{
+    seconds ++;
+}
+
+/***********************************************************************************************************************/
+/* Construct the screen and downloasd it to the TFT */
+void drawTimeScreen(void)
+{
+    TFT.DLstart();
+    TFT.DL(CLEAR_COLOR_RGB(255, 255, 255));
+    TFT.DL(CLEAR(1, 1, 1));
+
+    TFT.DL(COLOR_RGB(0, 0, 0));
+    TFT.Text(11, 15, 30, 0, "Demo-project for habrahabr.ru");
+    TFT.Text(13, 15 + 40, 28, 0, "Using FT800 library");
+
+    TFT.DL(COLOR_RGB(9, 35, 5));
+    TFT.DL(BEGIN(RECTS));
+    TFT.DL(VERTEX2II(11, 105, 0, 0));
+    TFT.DL(VERTEX2II(11 + 275, 105 + 100, 0, 0));
+
+    TFT.DL(COLOR_RGB(255, 255, 255));
+    TFT.Text(11 + 10, 105 + 10, 29, 0, "Number of seconds:");
+    TFT.Number(11 + 10, 105 + 10 + 30, 31, 0, seconds);
+    
+    TFT.Clock(390, 105 + 70, 70, 0, 4, 20, (seconds % 60), 0);
+    
+    TFT.DL(COLOR_RGB(0, 0, 0));
+    TFT.Text(11, 240, 28, 0, "e-mail: xk@efo.ru");
+    
+    TFT.DL(BEGIN(LINES));
+    TFT.DL(LINE_WIDTH(8));
+    TFT.DL(VERTEX2II(11, 15 + 40 + 30, 0, 0));
+    TFT.DL(VERTEX2II(460, 15 + 40 + 30, 0, 0));
+    
+    TFT.DL(DISPLAY());
+    TFT.Swap();
+}
+
+/***********************************************************************************************************************/
+/* Main function */
+int main()
+{
+    timeKeeping.attach(&secondsCallback, 1.0f);
+    while(1) {
+        drawTimeScreen();
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r f3c452ce44ed mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Sep 16 12:55:01 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34
\ No newline at end of file