Dependents:   FT800_RGB_demo FT800_RGB_demo2 FT800_demo_for_habr Temp_&_RH_at_TFT-demo ... more

Fork of FT800 by Peter Drescher

The mbed is talking thru the SPI interface with the graphic engine. We have to set up a list of Commands and send them to the FT800 to get graphics.

Hardware

1. VM800C development modules from FTDI : http://www.ftdichip.com/Products/Modules/VM800C.html

The modules come with different size lcd. 3.5", 4.3" or 5" or without. /media/uploads/dreschpe/ftdi_eve.jpg The picture shows a modified board, because my lcd had a different pinout. The mbed is connected to the pin header on the bottom.

2. EVBEVE-FT800 board from GLYN: http://www.glyn.com/News-Events/Newsletter/Newsletter-2013/October-2013/A-quick-start-for-EVE-Requires-no-basic-knowledge-graphics-sound-and-touch-can-all-be-learned-in-minutes

The module has a 40 pin flex cable connector to connect a display out of the EDT series.

/media/uploads/dreschpe/glyn_eve.jpg

The mbed is connected via the pin header on the left. If you use this board with a EDT display you have to uncomment the #define Inv_Backlite in FT_LCD_Type.h, because the backlight dimming is inverted.

3. ConnectEVE board from MikroElektronika http://www.mikroe.com/add-on-boards/display/connecteve/#headers_10 The board has also a pin header to connect the mbed. - not tested, but it looks like the other boards.

4. ADAM arduino shield http://www.4dsystems.com.au/product/4DLCD_FT843/ Component page : http://mbed.org/components/ADAM/

Works with the NUCLEO boards, but you have to patch three wires.

/media/uploads/dreschpe/adam.jpg

Connection

We need 5 signals to connect to the mbed. SCK, MOSI and MISO are connected to a SPI channel. SS is the chip select signal and PD work as powerdown. The additional INT signal is not used at the moment. It is possible to generate a interrupt signal, but at the moment you have to poll the status register of the FT800 to see if a command is finished.

Software

This lib is based on the demo code from FTDI. If you want to use it, you have to read the programming manual : http://www.ftdichip.com/Support/Documents/ProgramGuides/FT800%20Programmers%20Guide.pdf

See my demo : http://mbed.org/users/dreschpe/code/FT800_RGB_demo/

Files at this revision

API Documentation at this revision

Comitter:
dreschpe
Date:
Tue Feb 10 23:32:22 2015 +0000
Parent:
5:c0ffdb08b8a5
Commit message:
Add function to read/write touch calibration data.; Add color names ; Add a patch from Ivano Pelicella to draw flat buttons

Changed in this revision

FT_CoPro_Cmds.cpp Show annotated file Show diff for this revision Revisions of this file
FT_Gpu_Hal.cpp Show annotated file Show diff for this revision Revisions of this file
FT_Gpu_Hal.h Show annotated file Show diff for this revision Revisions of this file
FT_Hal_Utils.cpp Show annotated file Show diff for this revision Revisions of this file
FT_Platform.h Show annotated file Show diff for this revision Revisions of this file
FT_color.h Show annotated file Show diff for this revision Revisions of this file
diff -r c0ffdb08b8a5 -r 16e22c789f7d FT_CoPro_Cmds.cpp
--- a/FT_CoPro_Cmds.cpp	Thu Sep 25 20:32:21 2014 +0000
+++ b/FT_CoPro_Cmds.cpp	Tue Feb 10 23:32:22 2015 +0000
@@ -219,7 +219,7 @@
   SendCmd(  CMD_BUTTON);
   SendCmd(  (((ft_uint32_t)y<<16)|(x & 0xffff)));
   SendCmd(  (((ft_uint32_t)h<<16)|w));
-  SendCmd(  (((ft_uint32_t)y<<16)|font));
+  SendCmd( (((ft_uint32_t)options<<16)|font));       // patch from Ivano Pelicella to draw flat buttons
   SendStr(  s);
   EndFunc( (FT_CMD_SIZE*4 + strlen(s) + 1));
 }
diff -r c0ffdb08b8a5 -r 16e22c789f7d FT_Gpu_Hal.cpp
--- a/FT_Gpu_Hal.cpp	Thu Sep 25 20:32:21 2014 +0000
+++ b/FT_Gpu_Hal.cpp	Tue Feb 10 23:32:22 2015 +0000
@@ -23,7 +23,7 @@
 	 _f800_isr(InterruptIn(intr))
 	 {
 	 	 _spi.format(8,0);                  // 8 bit spi mode 0
-    	 _spi.frequency(4000000);          // start with 10 Mhz SPI clock
+    	 _spi.frequency(2000000);          // start with 10 Mhz SPI clock
     	 _ss = 1;                           // cs high
     	 _pd = 1;                           // PD high
 		 Bootup();
diff -r c0ffdb08b8a5 -r 16e22c789f7d FT_Gpu_Hal.h
--- a/FT_Gpu_Hal.h	Thu Sep 25 20:32:21 2014 +0000
+++ b/FT_Gpu_Hal.h	Tue Feb 10 23:32:22 2015 +0000
@@ -256,6 +256,11 @@
 	
 	int Load_jpg(char* filename, ft_int16_t* x_size, ft_int16_t* y_size);
 	ft_void_t Calibrate();
+	ft_void_t read_calibrate(ft_uint8_t data[24]);
+	ft_void_t write_calibrate(ft_uint8_t data[24]);
+	
+	ft_uint32_t color_rgb(ft_uint8_t red,ft_uint8_t green, ft_uint8_t blue);
+	ft_uint32_t clear_color_rgb(ft_uint8_t red,ft_uint8_t green, ft_uint8_t blue);
 
 };  // end of class
 
diff -r c0ffdb08b8a5 -r 16e22c789f7d FT_Hal_Utils.cpp
--- a/FT_Hal_Utils.cpp	Thu Sep 25 20:32:21 2014 +0000
+++ b/FT_Hal_Utils.cpp	Tue Feb 10 23:32:22 2015 +0000
@@ -108,3 +108,25 @@
     Wr8(REG_PWM_DUTY,i);
 }
 
+ft_void_t FT800::read_calibrate(ft_uint8_t data[24]){
+    unsigned int i;
+    for(i=0;i<24;i++){
+        data[i] = Rd8(REG_TOUCH_TRANSFORM_A + i);
+        }
+}
+
+ft_void_t FT800::write_calibrate(ft_uint8_t data[24]){
+    unsigned int i;
+    for(i=0;i<24;i++) {
+        Wr8(REG_TOUCH_TRANSFORM_A + i,data[i]);
+        }
+}
+
+ft_uint32_t FT800::color_rgb(ft_uint8_t red,ft_uint8_t green, ft_uint8_t blue){
+    return ((4UL<<24)|(((red)&255UL)<<16)|(((green)&255UL)<<8)|(((blue)&255UL)<<0));
+    }
+    
+ft_uint32_t FT800::clear_color_rgb(ft_uint8_t red,ft_uint8_t green, ft_uint8_t blue){
+    return ((2UL<<24)|(((red)&255UL)<<16)|(((green)&255UL)<<8)|(((blue)&255UL)<<0));
+    }    
+    
\ No newline at end of file
diff -r c0ffdb08b8a5 -r 16e22c789f7d FT_Platform.h
--- a/FT_Platform.h	Thu Sep 25 20:32:21 2014 +0000
+++ b/FT_Platform.h	Tue Feb 10 23:32:22 2015 +0000
@@ -10,6 +10,7 @@
 #include "FT_Gpu_Hal.h"
 #include "FT_Gpu.h"
 #include "FT_LCD_Type.h"
+#include "FT_color.h"
 
 #endif /*_FT_PLATFORM_H_*/
 /* Nothing beyond this*/
diff -r c0ffdb08b8a5 -r 16e22c789f7d FT_color.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FT_color.h	Tue Feb 10 23:32:22 2015 +0000
@@ -0,0 +1,38 @@
+// color definitions for FT800 controler
+
+#define Red         255,0,0
+#define Pink        255,192,203
+#define DarkRed     139,0,0
+#define OrangeRed   255,69,0
+#define Orange      255,165,0
+#define Gold        255,215,ß
+#define Yellow      255,255,0
+#define LightYellow 255,255,224
+#define Magenta     255,0,255
+#define Indigo      75,0,130
+#define SlateBlue   106,90,205
+#define Blue        0,0,255
+#define DarkBlue    0,0,139
+#define SkyBlue     135,206,235
+#define LightBlue   173,216,230
+#define White       255,255,255
+#define Black       0,0,0
+#define Gray        128,128,128
+#define DarkGray    169,169,169
+#define Silver      192,192,192
+#define Brown       165,42,42
+#define Green       0,128,0
+#define DarkGreen   0,100,0
+#define YellowGreen 154,205,50
+#define Olive       128,128,0
+#define Lime        0,255,0
+#define Purple      128,0,128
+#define Tomato      255,99,71
+#define Violet      235,130,238
+#define Plum        221,160,221
+#define GreenYellow 173,255,47
+#define Cyan        0,255,255
+#define Aquamarine  127,255,212
+#define LightGray   211,211,211
+
+