Lib for FTDI FT800 graphic controller "EVE" The API is changed from the FTDI original names. It use smaller names now. DL() will add something to the display list instead of Ft_App_WrCoCmd_Buffer ... The FTDI programmer Guide is also using this commands.

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/

Committer:
dreschpe
Date:
Sat Sep 20 11:35:43 2014 +0000
Revision:
4:363ec27cdfaa
Child:
5:c0ffdb08b8a5
change API

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dreschpe 4:363ec27cdfaa 1 #include "FT_Platform.h"
dreschpe 4:363ec27cdfaa 2 #include "mbed.h"
dreschpe 4:363ec27cdfaa 3
dreschpe 4:363ec27cdfaa 4 /* function to load jpg file from filesystem */
dreschpe 4:363ec27cdfaa 5 /* return 0 if jpg is ok */
dreschpe 4:363ec27cdfaa 6 /* return x_size and y_size of jpg */
dreschpe 4:363ec27cdfaa 7
dreschpe 4:363ec27cdfaa 8 int FT800::Load_jpg(char* filename, ft_int16_t* x_size, ft_int16_t* y_size)
dreschpe 4:363ec27cdfaa 9 {
dreschpe 4:363ec27cdfaa 10 unsigned char pbuff[8291];
dreschpe 4:363ec27cdfaa 11 unsigned short marker;
dreschpe 4:363ec27cdfaa 12 unsigned short length;
dreschpe 4:363ec27cdfaa 13 unsigned char data[4];
dreschpe 4:363ec27cdfaa 14
dreschpe 4:363ec27cdfaa 15 ft_uint16_t blocklen;
dreschpe 4:363ec27cdfaa 16
dreschpe 4:363ec27cdfaa 17 FILE *fp = fopen(filename, "r");
dreschpe 4:363ec27cdfaa 18 if(fp == NULL) return (-1); // connot open file
dreschpe 4:363ec27cdfaa 19
dreschpe 4:363ec27cdfaa 20 // search for 0xFFC0 marker
dreschpe 4:363ec27cdfaa 21 fseek(fp, 0, SEEK_END);
dreschpe 4:363ec27cdfaa 22 unsigned int Fsize = ftell(fp);
dreschpe 4:363ec27cdfaa 23 fseek(fp, 2, SEEK_SET);
dreschpe 4:363ec27cdfaa 24 fread(data,4,1,fp);
dreschpe 4:363ec27cdfaa 25 marker = data[0] << 8 | data[1];
dreschpe 4:363ec27cdfaa 26 length = data[2] << 8 | data[3];
dreschpe 4:363ec27cdfaa 27 do {
dreschpe 4:363ec27cdfaa 28 if(marker == 0xFFC0) break;
dreschpe 4:363ec27cdfaa 29 if(marker & 0xFF00 != 0xFF00) break;
dreschpe 4:363ec27cdfaa 30 if (fseek(fp, length - 2,SEEK_CUR) != 0) break;
dreschpe 4:363ec27cdfaa 31 fread(data,4,1,fp);
dreschpe 4:363ec27cdfaa 32 marker = data[0] << 8 | data[1];
dreschpe 4:363ec27cdfaa 33 length = data[2] << 8 | data[3];
dreschpe 4:363ec27cdfaa 34 } while(1);
dreschpe 4:363ec27cdfaa 35 if(marker != 0xFFC0) return (-2); // no FFC0 Marker, wrong format no baseline DCT-based JPEG
dreschpe 4:363ec27cdfaa 36 fseek(fp, 1,SEEK_CUR);
dreschpe 4:363ec27cdfaa 37 fread(data,4,1,fp);
dreschpe 4:363ec27cdfaa 38 *y_size = (data[0] << 8 | data[1]);
dreschpe 4:363ec27cdfaa 39 *x_size = (data[2] << 8 | data[3]);
dreschpe 4:363ec27cdfaa 40
dreschpe 4:363ec27cdfaa 41 //if(*x_size > DispWidth || *y_size > DispHeight) return (-3); // to big to fit on screen
dreschpe 4:363ec27cdfaa 42
dreschpe 4:363ec27cdfaa 43 fseek(fp, 0, SEEK_SET);
dreschpe 4:363ec27cdfaa 44 WrCmd32(CMD_LOADIMAGE); // load a JPEG image
dreschpe 4:363ec27cdfaa 45 WrCmd32(0); //destination address of jpg decode
dreschpe 4:363ec27cdfaa 46 WrCmd32(0); //output format of the bitmap - default is rgb565
dreschpe 4:363ec27cdfaa 47 while(Fsize > 0) {
dreschpe 4:363ec27cdfaa 48 /* download the data into the command buffer by 8kb one shot */
dreschpe 4:363ec27cdfaa 49 blocklen = Fsize>8192?8192:Fsize;
dreschpe 4:363ec27cdfaa 50 /* copy the data into pbuff and then transfter it to command buffer */
dreschpe 4:363ec27cdfaa 51 fread(pbuff,1,blocklen,fp);
dreschpe 4:363ec27cdfaa 52 Fsize -= blocklen;
dreschpe 4:363ec27cdfaa 53 /* copy data continuously into command memory */
dreschpe 4:363ec27cdfaa 54 WrCmdBuf(pbuff, blocklen); //alignment is already taken care by this api
dreschpe 4:363ec27cdfaa 55 }
dreschpe 4:363ec27cdfaa 56 fclose(fp);
dreschpe 4:363ec27cdfaa 57
dreschpe 4:363ec27cdfaa 58 return(0);
dreschpe 4:363ec27cdfaa 59 }
dreschpe 4:363ec27cdfaa 60
dreschpe 4:363ec27cdfaa 61
dreschpe 4:363ec27cdfaa 62 /* calibrate touch */
dreschpe 4:363ec27cdfaa 63 ft_void_t FT800::Calibrate()
dreschpe 4:363ec27cdfaa 64 {
dreschpe 4:363ec27cdfaa 65 /*************************************************************************/
dreschpe 4:363ec27cdfaa 66 /* Below code demonstrates the usage of calibrate function. Calibrate */
dreschpe 4:363ec27cdfaa 67 /* function will wait untill user presses all the three dots. Only way to*/
dreschpe 4:363ec27cdfaa 68 /* come out of this api is to reset the coprocessor bit. */
dreschpe 4:363ec27cdfaa 69 /*************************************************************************/
dreschpe 4:363ec27cdfaa 70 {
dreschpe 4:363ec27cdfaa 71
dreschpe 4:363ec27cdfaa 72 DLstart(); // start a new display command list
dreschpe 4:363ec27cdfaa 73 DL(CLEAR_COLOR_RGB(64,64,64)); // set the clear color R, G, B
dreschpe 4:363ec27cdfaa 74 DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer
dreschpe 4:363ec27cdfaa 75 DL(COLOR_RGB(0xff,0xff,0xff)); // set the current color R, G, B
dreschpe 4:363ec27cdfaa 76 Text((DispWidth/2), (DispHeight/2), 27, OPT_CENTER, "Please Tap on the dot"); // draw Text at x,y, font 27, centered
dreschpe 4:363ec27cdfaa 77 Calibrate(0); // start the calibration of touch screen
dreschpe 4:363ec27cdfaa 78 Flush_Co_Buffer(); // download the commands into FT800 FIFO
dreschpe 4:363ec27cdfaa 79 WaitCmdfifo_empty(); // Wait till coprocessor completes the operation
dreschpe 4:363ec27cdfaa 80 }
dreschpe 4:363ec27cdfaa 81 }
dreschpe 4:363ec27cdfaa 82