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
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. 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.
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.
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/
Revision 2:ab74a9a05970, committed 2014-01-04
- Comitter:
- dreschpe
- Date:
- Sat Jan 04 13:56:38 2014 +0000
- Parent:
- 1:bd671a31e765
- Child:
- 3:392d2c733c68
- Commit message:
- add doku
Changed in this revision
--- a/FT_CoPro_Cmds.cpp Fri Jan 03 23:08:43 2014 +0000 +++ b/FT_CoPro_Cmds.cpp Sat Jan 04 13:56:38 2014 +0000 @@ -1,6 +1,9 @@ +/* mbed Library for FTDI FT800 Enbedded Video Engine "EVE" + * based on Original Code Sample from FTDI + * ported to mbed by Peter Drescher, DC2PD 2014 + * Released under the MIT License: http://mbed.org/license/mit */ #include "FT_Platform.h" -//#include "FT_Gpu_Hal.h" ft_void_t FT800::Ft_Gpu_Copro_SendCmd( ft_uint32_t cmd)
--- a/FT_CoPro_Cmds.h Fri Jan 03 23:08:43 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -#ifndef _FT_COPRO_CMDS_H_ -#define _FT_COPRO_CMDS_H_ - -/* -ft_void_t Ft_Gpu_CoCmd_Text(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t font, ft_uint16_t options, const ft_char8_t* s); -ft_void_t Ft_Gpu_CoCmd_Number(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t font, ft_uint16_t options, ft_int32_t n); -ft_void_t Ft_Gpu_CoCmd_LoadIdentity(Ft_Gpu_Hal_Context_t *phost); -ft_void_t Ft_Gpu_CoCmd_Toggle(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t font, ft_uint16_t options, ft_uint16_t state, const ft_char8_t* s); -ft_void_t Ft_Gpu_CoCmd_Gauge(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t r, ft_uint16_t options, ft_uint16_t major, ft_uint16_t minor, ft_uint16_t val, ft_uint16_t range); -ft_void_t Ft_Gpu_CoCmd_RegRead(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ptr, ft_uint32_t result); -ft_void_t Ft_Gpu_CoCmd_GetProps(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ptr, ft_uint32_t w, ft_uint32_t h); -ft_void_t Ft_Gpu_CoCmd_Memcpy(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t dest, ft_uint32_t src, ft_uint32_t num); -ft_void_t Ft_Gpu_CoCmd_Spinner(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_uint16_t style, ft_uint16_t scale); -ft_void_t Ft_Gpu_CoCmd_BgColor(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t c); -ft_void_t Ft_Gpu_CoCmd_Swap(Ft_Gpu_Hal_Context_t *phost); -ft_void_t Ft_Gpu_CoCmd_Inflate(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ptr); -ft_void_t Ft_Gpu_CoCmd_Translate(Ft_Gpu_Hal_Context_t *phost,ft_int32_t tx, ft_int32_t ty); -ft_void_t Ft_Gpu_CoCmd_Stop(Ft_Gpu_Hal_Context_t *phost); -ft_void_t Ft_Gpu_CoCmd_Slider(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_uint16_t options, ft_uint16_t val, ft_uint16_t range); -ft_void_t Ft_Gpu_CoCmd_Interrupt(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ms); -ft_void_t Ft_Gpu_CoCmd_FgColor(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t c); -ft_void_t Ft_Gpu_CoCmd_Rotate(Ft_Gpu_Hal_Context_t *phost,ft_int32_t a); -ft_void_t Ft_Gpu_CoCmd_Button(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_int16_t font, ft_uint16_t options, const ft_char8_t* s); -ft_void_t Ft_Gpu_CoCmd_MemWrite(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ptr, ft_uint32_t num); -ft_void_t Ft_Gpu_CoCmd_Scrollbar(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_uint16_t options, ft_uint16_t val, ft_uint16_t size, ft_uint16_t range); -ft_void_t Ft_Gpu_CoCmd_GetMatrix(Ft_Gpu_Hal_Context_t *phost,ft_int32_t a, ft_int32_t b, ft_int32_t c, ft_int32_t d, ft_int32_t e, ft_int32_t f); -ft_void_t Ft_Gpu_CoCmd_Sketch(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_uint16_t w, ft_uint16_t h, ft_uint32_t ptr, ft_uint16_t format); -ft_void_t Ft_Gpu_CoCmd_MemSet(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ptr, ft_uint32_t value, ft_uint32_t num); -ft_void_t Ft_Gpu_CoCmd_Calibrate(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t result); -ft_void_t Ft_Gpu_CoCmd_SetFont(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t font, ft_uint32_t ptr); -ft_void_t Ft_Gpu_CoCmd_Bitmap_Transform(Ft_Gpu_Hal_Context_t *phost,ft_int32_t x0, ft_int32_t y0, ft_int32_t x1, ft_int32_t y1, ft_int32_t x2, ft_int32_t y2, ft_int32_t tx0, ft_int32_t ty0, ft_int32_t tx1, ft_int32_t ty1, ft_int32_t tx2, ft_int32_t ty2, ft_uint16_t result); -ft_void_t Ft_Gpu_CoCmd_GradColor(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t c); -ft_void_t Ft_Gpu_CoCmd_Append(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ptr, ft_uint32_t num); -ft_void_t Ft_Gpu_CoCmd_MemZero(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ptr, ft_uint32_t num); -ft_void_t Ft_Gpu_CoCmd_Scale(Ft_Gpu_Hal_Context_t *phost,ft_int32_t sx, ft_int32_t sy); -ft_void_t Ft_Gpu_CoCmd_Clock(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t r, ft_uint16_t options, ft_uint16_t h, ft_uint16_t m, ft_uint16_t s, ft_uint16_t ms); -ft_void_t Ft_Gpu_CoCmd_Gradient(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x0, ft_int16_t y0, ft_uint32_t rgb0, ft_int16_t x1, ft_int16_t y1, ft_uint32_t rgb1); -ft_void_t Ft_Gpu_CoCmd_SetMatrix(Ft_Gpu_Hal_Context_t *phost); -ft_void_t Ft_Gpu_CoCmd_Track(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_int16_t tag); -ft_void_t Ft_Gpu_CoCmd_GetPtr(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t result); -ft_void_t Ft_Gpu_CoCmd_Progress(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_uint16_t options, ft_uint16_t val, ft_uint16_t range); -ft_void_t Ft_Gpu_CoCmd_ColdStart(Ft_Gpu_Hal_Context_t *phost); -ft_void_t Ft_Gpu_CoCmd_Keys(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_int16_t font, ft_uint16_t options, const ft_char8_t* s); -ft_void_t Ft_Gpu_CoCmd_Dial(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t r, ft_uint16_t options, ft_uint16_t val); -ft_void_t Ft_Gpu_CoCmd_LoadImage(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ptr, ft_uint32_t options); -ft_void_t Ft_Gpu_CoCmd_Dlstart(Ft_Gpu_Hal_Context_t *phost); -ft_void_t Ft_Gpu_CoCmd_Snapshot(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ptr); -ft_void_t Ft_Gpu_CoCmd_ScreenSaver(Ft_Gpu_Hal_Context_t *phost); -ft_void_t Ft_Gpu_CoCmd_Memcrc(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result); - - -ft_void_t Ft_Gpu_CoCmd_Logo(Ft_Gpu_Hal_Context_t *phost); -ft_void_t Ft_Gpu_CoCmd_Calibrate(Ft_Gpu_Hal_Context_t *phost,ft_uint32_t result); -ft_void_t Ft_Gpu_CoCmd_Text(Ft_Gpu_Hal_Context_t *phost,ft_int16_t x, ft_int16_t y, ft_int16_t font, ft_uint16_t options, const ft_char8_t* s); -*/ -#endif /*FT_COPRO_CMDS_H*/ - - -
--- a/FT_DataTypes.h Fri Jan 03 23:08:43 2014 +0000 +++ b/FT_DataTypes.h Sat Jan 04 13:56:38 2014 +0000 @@ -1,3 +1,8 @@ +/* mbed Library for FTDI FT800 Enbedded Video Engine "EVE" + * based on Original Code Sample from FTDI + * ported to mbed by Peter Drescher, DC2PD 2014 + * Released under the MIT License: http://mbed.org/license/mit */ + #ifndef _FT_DATATYPES_H_ #define _FT_DATATYPES_H_ @@ -35,7 +40,6 @@ #define ft_prog_uint16_t ft_uint16_t #define ft_random(x) (rand() % (x)) -//#define ft_millis() GetTickCount() #define ft_pgm_read_byte_near(x) (*(x)) #define ft_pgm_read_byte(x) (*(x))
--- a/FT_Gpu.h Fri Jan 03 23:08:43 2014 +0000 +++ b/FT_Gpu.h Sat Jan 04 13:56:38 2014 +0000 @@ -1,3 +1,8 @@ +/* mbed Library for FTDI FT800 Enbedded Video Engine "EVE" + * based on Original Code Sample from FTDI + * ported to mbed by Peter Drescher, DC2PD 2014 + * Released under the MIT License: http://mbed.org/license/mit */ + #ifndef _FT_GPU_H_ #define _FT_GPU_H_ @@ -17,14 +22,6 @@ #define BARGRAPH 11UL #define BILINEAR 1UL #define BITMAPS 1UL -#define POINTS 2UL -#define LINES 3UL -#define LINE_STRIP 4UL -#define EDGE_STRIP_R 5UL -#define EDGE_STRIP_L 6UL -#define EDGE_STRIP_A 7UL -#define EDGE_STRIP_B 8UL -#define RECTS 9UL #define BORDER 0UL #define CMDBUF_SIZE 4096UL @@ -137,6 +134,7 @@ #define OPT_RIGHTX 2048UL #define OPT_SIGNED 256UL #define PALETTED 8UL +#define POINTS 2UL #define FTPOINTS 2UL #define RECTS 9UL
--- a/FT_Gpu_Hal.cpp Fri Jan 03 23:08:43 2014 +0000 +++ b/FT_Gpu_Hal.cpp Sat Jan 04 13:56:38 2014 +0000 @@ -1,8 +1,12 @@ +/* mbed Library for FTDI FT800 Enbedded Video Engine "EVE" + * based on Original Code Sample from FTDI + * ported to mbed by Peter Drescher, DC2PD 2014 + * Released under the MIT License: http://mbed.org/license/mit */ + #include "FT_Platform.h" #include "mbed.h" #include "FT_LCD_Type.h" - FT800::FT800(PinName mosi, PinName miso, PinName sck, @@ -58,7 +62,7 @@ // Speed up - _spi.frequency(30000000); // 30 Mhz SPI clock + _spi.frequency(16000000); // 20 Mhz SPI clock /* Configuration of LCD display */ FT_DispHCycle = my_DispHCycle;
--- a/FT_Gpu_Hal.h Fri Jan 03 23:08:43 2014 +0000 +++ b/FT_Gpu_Hal.h Sat Jan 04 13:56:38 2014 +0000 @@ -9,11 +9,12 @@ * Project: FT800 or EVE compatible silicon * File Description: * This file defines the generic APIs of host access layer for the FT800 or EVE compatible silicon. - * Application shall access FT800 or EVE resources over these APIs,regardless of I2C or SPI protocol. - * I2C and SPI is selected by compiler switch "FT_I2C_MODE" and "FT_SPI_MODE". In addition, there are + * Application shall access FT800 or EVE resources over these APIs. In addition, there are * some helper functions defined for FT800 coprocessor engine as well as host commands. * Rivision History: + * ported to mbed by Peter Drescher, DC2PD 2014 */ + #ifndef FT_GPU_HAL_H #define FT_GPU_HAL_H @@ -231,8 +232,6 @@ ft_void_t Ft_Gpu_CoCmd_Memcrc(ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result); ft_void_t Ft_Gpu_CoCmd_Logo(); -//ft_void_t Ft_Gpu_CoCmd_Calibrate( ft_uint32_t result); -//ft_void_t Ft_Gpu_CoCmd_Text( ft_int16_t x, ft_int16_t y, ft_int16_t font, ft_uint16_t options, const ft_char8_t* s); ft_void_t Ft_Gpu_Copro_SendCmd( ft_uint32_t cmd); ft_void_t Ft_Gpu_CoCmd_SendStr( const ft_char8_t *s);
--- a/FT_Hal_Utils.h Fri Jan 03 23:08:43 2014 +0000 +++ b/FT_Hal_Utils.h Sat Jan 04 13:56:38 2014 +0000 @@ -1,20 +1,25 @@ -#ifndef _FT_HAL_UTILS_H_ -#define _FT_HAL_UTILS_H_ - - -#define RGB(r, g, b) ((((vc_int32_t)(r)) << 16) | (((vc_int32_t)(g)) << 8) | (b)) -#define SQ(v) ((v) * (v)) -#define MIN(x,y) ((x) > (y) ? (y) : (x)) -#define MAX(x,y) ((x) > (y) ? (x) : (y)) -#define PLAYCOLOR 0x00A0A080 -#define NOTE(n, sharp) (((n) - 'C') + ((sharp) * 128)) -#define F16(s) ((vc_int32_t)((s) * 65536)) -#define INVALID_TOUCH_XY 0x8000 -#define ABS(x) ((x) > (0) ? (x) : (-x)) - - -#endif /* _FT_HAL_UTILS_H_ */ - - +/* mbed Library for FTDI FT800 Enbedded Video Engine "EVE" + * based on Original Code Sample from FTDI + * ported to mbed by Peter Drescher, DC2PD 2014 + * Released under the MIT License: http://mbed.org/license/mit */ + +#ifndef _FT_HAL_UTILS_H_ +#define _FT_HAL_UTILS_H_ +#define RGB(r, g, b) ((((vc_int32_t)(r)) << 16) | (((vc_int32_t)(g)) << 8) | (b)) +#define SQ(v) ((v) * (v)) +#define MIN(x,y) ((x) > (y) ? (y) : (x)) +#define MAX(x,y) ((x) > (y) ? (x) : (y)) +#define PLAYCOLOR 0x00A0A080 +#define NOTE(n, sharp) (((n) - 'C') + ((sharp) * 128)) +#define F16(s) ((vc_int32_t)((s) * 65536)) +#define INVALID_TOUCH_XY 0x8000 +#define ABS(x) ((x) > (0) ? (x) : (-x)) + + +#endif /* _FT_HAL_UTILS_H_ */ + + + +
--- a/FT_LCD_Type.h Fri Jan 03 23:08:43 2014 +0000 +++ b/FT_LCD_Type.h Sat Jan 04 13:56:38 2014 +0000 @@ -1,3 +1,9 @@ +/* mbed Library for FTDI FT800 Enbedded Video Engine "EVE" + * ported to mbed by Peter Drescher, DC2PD 2014 + * Released under the MIT License: http://mbed.org/license/mit */ + + /* change this file to adapt other LCD screens */ + #ifndef FT_LCD_TYPE_H #define FT_LCD_TYPE_H
--- a/FT_Platform.h Fri Jan 03 23:08:43 2014 +0000 +++ b/FT_Platform.h Sat Jan 04 13:56:38 2014 +0000 @@ -1,12 +1,14 @@ +/* mbed Library for FTDI FT800 Enbedded Video Engine "EVE" + * based on Original Code Sample from FTDI + * ported to mbed by Peter Drescher, DC2PD 2014 + * Released under the MIT License: http://mbed.org/license/mit */ + #ifndef _FT_PLATFORM_H_ #define _FT_PLATFORM_H_ #include "FT_DataTypes.h" #include "FT_Gpu_Hal.h" #include "FT_Gpu.h" -//#include "FT_CoPro_Cmds.h" -//#include "FT_LCD_Type.h" - #endif /*_FT_PLATFORM_H_*/ /* Nothing beyond this*/