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:
Fri Sep 19 15:56:15 2014 +0000
Revision:
3:392d2c733c68
Parent:
2:ab74a9a05970
Child:
4:363ec27cdfaa
change function names !

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dreschpe 2:ab74a9a05970 1 /* mbed Library for FTDI FT800 Enbedded Video Engine "EVE"
dreschpe 3:392d2c733c68 2 * based on Original Code Sample from FTDI
dreschpe 2:ab74a9a05970 3 * ported to mbed by Peter Drescher, DC2PD 2014
dreschpe 2:ab74a9a05970 4 * Released under the MIT License: http://mbed.org/license/mit */
dreschpe 0:5e013296b353 5
dreschpe 0:5e013296b353 6 #include "FT_Platform.h"
dreschpe 0:5e013296b353 7
dreschpe 0:5e013296b353 8
dreschpe 3:392d2c733c68 9 ft_void_t FT800::SendCmd( ft_uint32_t cmd)
dreschpe 3:392d2c733c68 10 {
dreschpe 3:392d2c733c68 11 Transfer32( cmd);
dreschpe 0:5e013296b353 12 }
dreschpe 0:5e013296b353 13
dreschpe 3:392d2c733c68 14 ft_void_t FT800::SendStr( const ft_char8_t *s)
dreschpe 0:5e013296b353 15 {
dreschpe 3:392d2c733c68 16 TransferString( s);
dreschpe 0:5e013296b353 17 }
dreschpe 0:5e013296b353 18
dreschpe 0:5e013296b353 19
dreschpe 3:392d2c733c68 20 ft_void_t FT800::StartFunc( ft_uint16_t count)
dreschpe 0:5e013296b353 21 {
dreschpe 3:392d2c733c68 22 CheckCmdBuffer( count);
dreschpe 3:392d2c733c68 23 StartCmdTransfer( FT_GPU_WRITE,count);
dreschpe 0:5e013296b353 24 }
dreschpe 0:5e013296b353 25
dreschpe 3:392d2c733c68 26 ft_void_t FT800::EndFunc( ft_uint16_t count)
dreschpe 0:5e013296b353 27 {
dreschpe 3:392d2c733c68 28 EndTransfer( );
dreschpe 3:392d2c733c68 29 Updatecmdfifo( count);
dreschpe 0:5e013296b353 30 }
dreschpe 0:5e013296b353 31
dreschpe 3:392d2c733c68 32 ft_void_t FT800::Text( ft_int16_t x, ft_int16_t y, ft_int16_t font, ft_uint16_t options, const ft_char8_t* s)
dreschpe 0:5e013296b353 33 {
dreschpe 3:392d2c733c68 34 StartFunc( FT_CMD_SIZE*3 + strlen(s) + 1);
dreschpe 3:392d2c733c68 35 SendCmd( CMD_TEXT);
dreschpe 3:392d2c733c68 36 //Copro_SendCmd( (((ft_uint32_t)y<<16)|(ft_uint32_t)x));
dreschpe 3:392d2c733c68 37 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 38 SendCmd( (((ft_uint32_t)options<<16)|(ft_uint32_t)font));
dreschpe 3:392d2c733c68 39 SendStr( s);
dreschpe 3:392d2c733c68 40 EndFunc( (FT_CMD_SIZE*3 + strlen(s) + 1));
dreschpe 0:5e013296b353 41 }
dreschpe 0:5e013296b353 42
dreschpe 3:392d2c733c68 43 ft_void_t FT800::Number( ft_int16_t x, ft_int16_t y, ft_int16_t font, ft_uint16_t options, ft_int32_t n)
dreschpe 0:5e013296b353 44 {
dreschpe 3:392d2c733c68 45 StartFunc( FT_CMD_SIZE*4);
dreschpe 3:392d2c733c68 46 SendCmd( CMD_NUMBER);
dreschpe 3:392d2c733c68 47 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 48 SendCmd( (((ft_uint32_t)options<<16)|font));
dreschpe 3:392d2c733c68 49 SendCmd( n);
dreschpe 3:392d2c733c68 50 EndFunc( (FT_CMD_SIZE*4));
dreschpe 0:5e013296b353 51 }
dreschpe 0:5e013296b353 52
dreschpe 3:392d2c733c68 53 ft_void_t FT800::LoadIdentity( )
dreschpe 0:5e013296b353 54 {
dreschpe 3:392d2c733c68 55 StartFunc( FT_CMD_SIZE*1);
dreschpe 3:392d2c733c68 56 SendCmd( CMD_LOADIDENTITY);
dreschpe 3:392d2c733c68 57 EndFunc( (FT_CMD_SIZE*1));
dreschpe 0:5e013296b353 58 }
dreschpe 0:5e013296b353 59
dreschpe 3:392d2c733c68 60 ft_void_t FT800::Toggle( 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)
dreschpe 0:5e013296b353 61 {
dreschpe 3:392d2c733c68 62 StartFunc( FT_CMD_SIZE*4 + strlen(s) + 1);
dreschpe 3:392d2c733c68 63 SendCmd( CMD_TOGGLE);
dreschpe 3:392d2c733c68 64 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 65 SendCmd( (((ft_uint32_t)font<<16)|w));
dreschpe 3:392d2c733c68 66 SendCmd( (((ft_uint32_t)state<<16)|options));
dreschpe 3:392d2c733c68 67 SendStr( s);
dreschpe 3:392d2c733c68 68 EndFunc( (FT_CMD_SIZE*4 + strlen(s) + 1));
dreschpe 0:5e013296b353 69 }
dreschpe 0:5e013296b353 70
dreschpe 0:5e013296b353 71 /* Error handling for val is not done, so better to always use range of 65535 in order that needle is drawn within display region */
dreschpe 3:392d2c733c68 72 ft_void_t FT800::Gauge( 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)
dreschpe 0:5e013296b353 73 {
dreschpe 3:392d2c733c68 74 StartFunc( FT_CMD_SIZE*5);
dreschpe 3:392d2c733c68 75 SendCmd( CMD_GAUGE);
dreschpe 3:392d2c733c68 76 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 77 SendCmd( (((ft_uint32_t)options<<16)|r));
dreschpe 3:392d2c733c68 78 SendCmd( (((ft_uint32_t)minor<<16)|major));
dreschpe 3:392d2c733c68 79 SendCmd( (((ft_uint32_t)range<<16)|val));
dreschpe 3:392d2c733c68 80 EndFunc( (FT_CMD_SIZE*5));
dreschpe 0:5e013296b353 81 }
dreschpe 0:5e013296b353 82
dreschpe 3:392d2c733c68 83 ft_void_t FT800::RegRead( ft_uint32_t ptr, ft_uint32_t result)
dreschpe 0:5e013296b353 84 {
dreschpe 3:392d2c733c68 85 StartFunc( FT_CMD_SIZE*3);
dreschpe 3:392d2c733c68 86 SendCmd( CMD_REGREAD);
dreschpe 3:392d2c733c68 87 SendCmd( ptr);
dreschpe 3:392d2c733c68 88 SendCmd( 0);
dreschpe 3:392d2c733c68 89 EndFunc( (FT_CMD_SIZE*3));
dreschpe 3:392d2c733c68 90
dreschpe 0:5e013296b353 91 }
dreschpe 0:5e013296b353 92
dreschpe 3:392d2c733c68 93 ft_void_t FT800::GetProps( ft_uint32_t ptr, ft_uint32_t w, ft_uint32_t h)
dreschpe 0:5e013296b353 94 {
dreschpe 3:392d2c733c68 95 StartFunc( FT_CMD_SIZE*4);
dreschpe 3:392d2c733c68 96 SendCmd( CMD_GETPROPS);
dreschpe 3:392d2c733c68 97 SendCmd( ptr);
dreschpe 3:392d2c733c68 98 SendCmd( w);
dreschpe 3:392d2c733c68 99 SendCmd( h);
dreschpe 3:392d2c733c68 100 EndFunc( (FT_CMD_SIZE*4));
dreschpe 0:5e013296b353 101 }
dreschpe 0:5e013296b353 102
dreschpe 3:392d2c733c68 103 ft_void_t FT800::Memcpy( ft_uint32_t dest, ft_uint32_t src, ft_uint32_t num)
dreschpe 0:5e013296b353 104 {
dreschpe 3:392d2c733c68 105 StartFunc( FT_CMD_SIZE*4);
dreschpe 3:392d2c733c68 106 SendCmd( CMD_MEMCPY);
dreschpe 3:392d2c733c68 107 SendCmd( dest);
dreschpe 3:392d2c733c68 108 SendCmd( src);
dreschpe 3:392d2c733c68 109 SendCmd( num);
dreschpe 3:392d2c733c68 110 EndFunc( (FT_CMD_SIZE*4));
dreschpe 0:5e013296b353 111 }
dreschpe 0:5e013296b353 112
dreschpe 3:392d2c733c68 113 ft_void_t FT800::Spinner( ft_int16_t x, ft_int16_t y, ft_uint16_t style, ft_uint16_t scale)
dreschpe 0:5e013296b353 114 {
dreschpe 3:392d2c733c68 115 StartFunc( FT_CMD_SIZE*3);
dreschpe 3:392d2c733c68 116 SendCmd( CMD_SPINNER);
dreschpe 3:392d2c733c68 117 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 118 SendCmd( (((ft_uint32_t)scale<<16)|style));
dreschpe 3:392d2c733c68 119 EndFunc( (FT_CMD_SIZE*3));
dreschpe 0:5e013296b353 120 }
dreschpe 0:5e013296b353 121
dreschpe 3:392d2c733c68 122 ft_void_t FT800::BgColor( ft_uint32_t c)
dreschpe 0:5e013296b353 123 {
dreschpe 3:392d2c733c68 124 StartFunc( FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 125 SendCmd( CMD_BGCOLOR);
dreschpe 3:392d2c733c68 126 SendCmd( c);
dreschpe 3:392d2c733c68 127 EndFunc( (FT_CMD_SIZE*2));
dreschpe 0:5e013296b353 128 }
dreschpe 0:5e013296b353 129
dreschpe 3:392d2c733c68 130 ft_void_t FT800::Swap()
dreschpe 0:5e013296b353 131 {
dreschpe 3:392d2c733c68 132 StartFunc( FT_CMD_SIZE*1);
dreschpe 3:392d2c733c68 133 SendCmd( CMD_SWAP);
dreschpe 3:392d2c733c68 134 EndFunc( (FT_CMD_SIZE*1));
dreschpe 0:5e013296b353 135 }
dreschpe 0:5e013296b353 136
dreschpe 3:392d2c733c68 137 ft_void_t FT800::Inflate( ft_uint32_t ptr)
dreschpe 0:5e013296b353 138 {
dreschpe 3:392d2c733c68 139 StartFunc( FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 140 SendCmd( CMD_INFLATE);
dreschpe 3:392d2c733c68 141 SendCmd( ptr);
dreschpe 3:392d2c733c68 142 EndFunc( (FT_CMD_SIZE*2));
dreschpe 0:5e013296b353 143 }
dreschpe 0:5e013296b353 144
dreschpe 3:392d2c733c68 145 ft_void_t FT800::Translate( ft_int32_t tx, ft_int32_t ty)
dreschpe 0:5e013296b353 146 {
dreschpe 3:392d2c733c68 147 StartFunc( FT_CMD_SIZE*3);
dreschpe 3:392d2c733c68 148 SendCmd( CMD_TRANSLATE);
dreschpe 3:392d2c733c68 149 SendCmd( tx);
dreschpe 3:392d2c733c68 150 SendCmd( ty);
dreschpe 3:392d2c733c68 151 EndFunc( (FT_CMD_SIZE*3));
dreschpe 0:5e013296b353 152 }
dreschpe 0:5e013296b353 153
dreschpe 3:392d2c733c68 154 ft_void_t FT800::Stop()
dreschpe 0:5e013296b353 155 {
dreschpe 3:392d2c733c68 156 StartFunc( FT_CMD_SIZE*1);
dreschpe 3:392d2c733c68 157 SendCmd( CMD_STOP);
dreschpe 3:392d2c733c68 158 EndFunc( (FT_CMD_SIZE*1));
dreschpe 0:5e013296b353 159 }
dreschpe 0:5e013296b353 160
dreschpe 3:392d2c733c68 161 ft_void_t FT800::Slider( 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)
dreschpe 0:5e013296b353 162 {
dreschpe 3:392d2c733c68 163 StartFunc( FT_CMD_SIZE*5);
dreschpe 3:392d2c733c68 164 SendCmd( CMD_SLIDER);
dreschpe 3:392d2c733c68 165 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 166 SendCmd( (((ft_uint32_t)h<<16)|w));
dreschpe 3:392d2c733c68 167 SendCmd( (((ft_uint32_t)val<<16)|options));
dreschpe 3:392d2c733c68 168 SendCmd( range);
dreschpe 3:392d2c733c68 169 EndFunc( (FT_CMD_SIZE*5));
dreschpe 0:5e013296b353 170 }
dreschpe 0:5e013296b353 171
dreschpe 3:392d2c733c68 172 ft_void_t FT800::TouchTransform( 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)
dreschpe 0:5e013296b353 173 {
dreschpe 3:392d2c733c68 174 StartFunc( FT_CMD_SIZE*6*2+FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 175 SendCmd( CMD_TOUCH_TRANSFORM);
dreschpe 3:392d2c733c68 176 SendCmd( x0);
dreschpe 3:392d2c733c68 177 SendCmd( y0);
dreschpe 3:392d2c733c68 178 SendCmd( x1);
dreschpe 3:392d2c733c68 179 SendCmd( y1);
dreschpe 3:392d2c733c68 180 SendCmd( x2);
dreschpe 3:392d2c733c68 181 SendCmd( y2);
dreschpe 3:392d2c733c68 182 SendCmd( tx0);
dreschpe 3:392d2c733c68 183 SendCmd( ty0);
dreschpe 3:392d2c733c68 184 SendCmd( tx1);
dreschpe 3:392d2c733c68 185 SendCmd( ty1);
dreschpe 3:392d2c733c68 186 SendCmd( tx2);
dreschpe 3:392d2c733c68 187 SendCmd( ty2);
dreschpe 3:392d2c733c68 188 SendCmd( result);
dreschpe 3:392d2c733c68 189 EndFunc( (FT_CMD_SIZE*6*2+FT_CMD_SIZE*2));
dreschpe 0:5e013296b353 190 }
dreschpe 0:5e013296b353 191
dreschpe 3:392d2c733c68 192 ft_void_t FT800::Interrupt( ft_uint32_t ms)
dreschpe 0:5e013296b353 193 {
dreschpe 3:392d2c733c68 194 StartFunc( FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 195 SendCmd( CMD_INTERRUPT);
dreschpe 3:392d2c733c68 196 SendCmd( ms);
dreschpe 3:392d2c733c68 197 EndFunc( (FT_CMD_SIZE*2));
dreschpe 0:5e013296b353 198 }
dreschpe 0:5e013296b353 199
dreschpe 3:392d2c733c68 200 ft_void_t FT800::FgColor( ft_uint32_t c)
dreschpe 0:5e013296b353 201 {
dreschpe 3:392d2c733c68 202 StartFunc( FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 203 SendCmd( CMD_FGCOLOR);
dreschpe 3:392d2c733c68 204 SendCmd( c);
dreschpe 3:392d2c733c68 205 EndFunc( (FT_CMD_SIZE*2));
dreschpe 0:5e013296b353 206 }
dreschpe 0:5e013296b353 207
dreschpe 3:392d2c733c68 208 ft_void_t FT800::Rotate( ft_int32_t a)
dreschpe 0:5e013296b353 209 {
dreschpe 3:392d2c733c68 210 StartFunc( FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 211 SendCmd( CMD_ROTATE);
dreschpe 3:392d2c733c68 212 SendCmd( a);
dreschpe 3:392d2c733c68 213 EndFunc( (FT_CMD_SIZE*2));
dreschpe 0:5e013296b353 214 }
dreschpe 0:5e013296b353 215
dreschpe 3:392d2c733c68 216 ft_void_t FT800::Button( 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)
dreschpe 0:5e013296b353 217 {
dreschpe 3:392d2c733c68 218 StartFunc( FT_CMD_SIZE*4 + strlen(s) + 1);
dreschpe 3:392d2c733c68 219 SendCmd( CMD_BUTTON);
dreschpe 3:392d2c733c68 220 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 221 SendCmd( (((ft_uint32_t)h<<16)|w));
dreschpe 3:392d2c733c68 222 SendCmd( (((ft_uint32_t)y<<16)|font));
dreschpe 3:392d2c733c68 223 SendStr( s);
dreschpe 3:392d2c733c68 224 EndFunc( (FT_CMD_SIZE*4 + strlen(s) + 1));
dreschpe 0:5e013296b353 225 }
dreschpe 0:5e013296b353 226
dreschpe 3:392d2c733c68 227 ft_void_t FT800::MemWrite( ft_uint32_t ptr, ft_uint32_t num)
dreschpe 0:5e013296b353 228 {
dreschpe 3:392d2c733c68 229 StartFunc( FT_CMD_SIZE*3);
dreschpe 3:392d2c733c68 230 SendCmd( CMD_MEMWRITE);
dreschpe 3:392d2c733c68 231 SendCmd( ptr);
dreschpe 3:392d2c733c68 232 SendCmd( num);
dreschpe 3:392d2c733c68 233 EndFunc( (FT_CMD_SIZE*3));
dreschpe 0:5e013296b353 234 }
dreschpe 0:5e013296b353 235
dreschpe 3:392d2c733c68 236 ft_void_t FT800::Scrollbar( 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)
dreschpe 0:5e013296b353 237 {
dreschpe 3:392d2c733c68 238 StartFunc( FT_CMD_SIZE*5);
dreschpe 3:392d2c733c68 239 SendCmd( CMD_SCROLLBAR);
dreschpe 3:392d2c733c68 240 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 241 SendCmd( (((ft_uint32_t)h<<16)|w));
dreschpe 3:392d2c733c68 242 SendCmd( (((ft_uint32_t)val<<16)|options));
dreschpe 3:392d2c733c68 243 SendCmd( (((ft_uint32_t)range<<16)|size));
dreschpe 3:392d2c733c68 244 EndFunc( (FT_CMD_SIZE*5));
dreschpe 0:5e013296b353 245 }
dreschpe 0:5e013296b353 246
dreschpe 3:392d2c733c68 247 ft_void_t FT800::GetMatrix( ft_int32_t a, ft_int32_t b, ft_int32_t c, ft_int32_t d, ft_int32_t e, ft_int32_t f)
dreschpe 0:5e013296b353 248 {
dreschpe 3:392d2c733c68 249 StartFunc( FT_CMD_SIZE*7);
dreschpe 3:392d2c733c68 250 SendCmd( CMD_GETMATRIX);
dreschpe 3:392d2c733c68 251 SendCmd( a);
dreschpe 3:392d2c733c68 252 SendCmd( b);
dreschpe 3:392d2c733c68 253 SendCmd( c);
dreschpe 3:392d2c733c68 254 SendCmd( d);
dreschpe 3:392d2c733c68 255 SendCmd( e);
dreschpe 3:392d2c733c68 256 SendCmd( f);
dreschpe 3:392d2c733c68 257 EndFunc( (FT_CMD_SIZE*7));
dreschpe 0:5e013296b353 258 }
dreschpe 0:5e013296b353 259
dreschpe 3:392d2c733c68 260 ft_void_t FT800::Sketch( ft_int16_t x, ft_int16_t y, ft_uint16_t w, ft_uint16_t h, ft_uint32_t ptr, ft_uint16_t format)
dreschpe 0:5e013296b353 261 {
dreschpe 3:392d2c733c68 262 StartFunc( FT_CMD_SIZE*5);
dreschpe 3:392d2c733c68 263 SendCmd( CMD_SKETCH);
dreschpe 3:392d2c733c68 264 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 265 SendCmd( (((ft_uint32_t)h<<16)|w));
dreschpe 3:392d2c733c68 266 SendCmd( ptr);
dreschpe 3:392d2c733c68 267 SendCmd( format);
dreschpe 3:392d2c733c68 268 EndFunc( (FT_CMD_SIZE*5));
dreschpe 0:5e013296b353 269 }
dreschpe 3:392d2c733c68 270 ft_void_t FT800::MemSet( ft_uint32_t ptr, ft_uint32_t value, ft_uint32_t num)
dreschpe 0:5e013296b353 271 {
dreschpe 3:392d2c733c68 272 StartFunc( FT_CMD_SIZE*4);
dreschpe 3:392d2c733c68 273 SendCmd( CMD_MEMSET);
dreschpe 3:392d2c733c68 274 SendCmd( ptr);
dreschpe 3:392d2c733c68 275 SendCmd( value);
dreschpe 3:392d2c733c68 276 SendCmd( num);
dreschpe 3:392d2c733c68 277 EndFunc( (FT_CMD_SIZE*4));
dreschpe 0:5e013296b353 278 }
dreschpe 3:392d2c733c68 279 ft_void_t FT800::GradColor( ft_uint32_t c)
dreschpe 0:5e013296b353 280 {
dreschpe 3:392d2c733c68 281 StartFunc( FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 282 SendCmd( CMD_GRADCOLOR);
dreschpe 3:392d2c733c68 283 SendCmd( c);
dreschpe 3:392d2c733c68 284 EndFunc( (FT_CMD_SIZE*2));
dreschpe 0:5e013296b353 285 }
dreschpe 3:392d2c733c68 286 ft_void_t FT800::BitmapTransform( 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)
dreschpe 0:5e013296b353 287 {
dreschpe 3:392d2c733c68 288 StartFunc( FT_CMD_SIZE*6*2+FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 289 SendCmd( CMD_BITMAP_TRANSFORM);
dreschpe 3:392d2c733c68 290 SendCmd( x0);
dreschpe 3:392d2c733c68 291 SendCmd( y0);
dreschpe 3:392d2c733c68 292 SendCmd( x1);
dreschpe 3:392d2c733c68 293 SendCmd( y1);
dreschpe 3:392d2c733c68 294 SendCmd( x2);
dreschpe 3:392d2c733c68 295 SendCmd( y2);
dreschpe 3:392d2c733c68 296 SendCmd( tx0);
dreschpe 3:392d2c733c68 297 SendCmd( ty0);
dreschpe 3:392d2c733c68 298 SendCmd( tx1);
dreschpe 3:392d2c733c68 299 SendCmd( ty1);
dreschpe 3:392d2c733c68 300 SendCmd( tx2);
dreschpe 3:392d2c733c68 301 SendCmd( ty2);
dreschpe 3:392d2c733c68 302 SendCmd( result);
dreschpe 3:392d2c733c68 303 EndFunc( (FT_CMD_SIZE*6*2+FT_CMD_SIZE*2));
dreschpe 0:5e013296b353 304 }
dreschpe 3:392d2c733c68 305 ft_void_t FT800::Calibrate( ft_uint32_t result)
dreschpe 0:5e013296b353 306 {
dreschpe 3:392d2c733c68 307 StartFunc( FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 308 SendCmd( CMD_CALIBRATE);
dreschpe 3:392d2c733c68 309 SendCmd( result);
dreschpe 3:392d2c733c68 310 EndFunc( (FT_CMD_SIZE*2));
dreschpe 3:392d2c733c68 311 WaitCmdfifo_empty( );
dreschpe 3:392d2c733c68 312
dreschpe 0:5e013296b353 313 }
dreschpe 3:392d2c733c68 314 ft_void_t FT800::SetFont( ft_uint32_t font, ft_uint32_t ptr)
dreschpe 0:5e013296b353 315 {
dreschpe 3:392d2c733c68 316 StartFunc( FT_CMD_SIZE*3);
dreschpe 3:392d2c733c68 317 SendCmd( CMD_SETFONT);
dreschpe 3:392d2c733c68 318 SendCmd( font);
dreschpe 3:392d2c733c68 319 SendCmd( ptr);
dreschpe 3:392d2c733c68 320 EndFunc( (FT_CMD_SIZE*3));
dreschpe 0:5e013296b353 321 }
dreschpe 3:392d2c733c68 322 ft_void_t FT800::Logo( )
dreschpe 0:5e013296b353 323 {
dreschpe 3:392d2c733c68 324 StartFunc( FT_CMD_SIZE*1);
dreschpe 3:392d2c733c68 325 SendCmd( CMD_LOGO);
dreschpe 3:392d2c733c68 326 EndFunc( FT_CMD_SIZE*1);
dreschpe 0:5e013296b353 327 }
dreschpe 3:392d2c733c68 328 ft_void_t FT800::Append( ft_uint32_t ptr, ft_uint32_t num)
dreschpe 0:5e013296b353 329 {
dreschpe 3:392d2c733c68 330 StartFunc( FT_CMD_SIZE*3);
dreschpe 3:392d2c733c68 331 SendCmd( CMD_APPEND);
dreschpe 3:392d2c733c68 332 SendCmd( ptr);
dreschpe 3:392d2c733c68 333 SendCmd( num);
dreschpe 3:392d2c733c68 334 EndFunc( (FT_CMD_SIZE*3));
dreschpe 0:5e013296b353 335 }
dreschpe 3:392d2c733c68 336 ft_void_t FT800::MemZero( ft_uint32_t ptr, ft_uint32_t num)
dreschpe 0:5e013296b353 337 {
dreschpe 3:392d2c733c68 338 StartFunc( FT_CMD_SIZE*3);
dreschpe 3:392d2c733c68 339 SendCmd( CMD_MEMZERO);
dreschpe 3:392d2c733c68 340 SendCmd( ptr);
dreschpe 3:392d2c733c68 341 SendCmd( num);
dreschpe 3:392d2c733c68 342 EndFunc( (FT_CMD_SIZE*3));
dreschpe 0:5e013296b353 343 }
dreschpe 3:392d2c733c68 344 ft_void_t FT800::Scale( ft_int32_t sx, ft_int32_t sy)
dreschpe 0:5e013296b353 345 {
dreschpe 3:392d2c733c68 346 StartFunc( FT_CMD_SIZE*3);
dreschpe 3:392d2c733c68 347 SendCmd( CMD_SCALE);
dreschpe 3:392d2c733c68 348 SendCmd( sx);
dreschpe 3:392d2c733c68 349 SendCmd( sy);
dreschpe 3:392d2c733c68 350 EndFunc( (FT_CMD_SIZE*3));
dreschpe 0:5e013296b353 351 }
dreschpe 3:392d2c733c68 352 ft_void_t FT800::Clock( 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)
dreschpe 0:5e013296b353 353 {
dreschpe 3:392d2c733c68 354 StartFunc( FT_CMD_SIZE*5);
dreschpe 3:392d2c733c68 355 SendCmd( CMD_CLOCK);
dreschpe 3:392d2c733c68 356 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 357 SendCmd( (((ft_uint32_t)options<<16)|r));
dreschpe 3:392d2c733c68 358 SendCmd( (((ft_uint32_t)m<<16)|h));
dreschpe 3:392d2c733c68 359 SendCmd( (((ft_uint32_t)ms<<16)|s));
dreschpe 3:392d2c733c68 360 EndFunc( (FT_CMD_SIZE*5));
dreschpe 0:5e013296b353 361 }
dreschpe 0:5e013296b353 362
dreschpe 3:392d2c733c68 363 ft_void_t FT800::Gradient( ft_int16_t x0, ft_int16_t y0, ft_uint32_t rgb0, ft_int16_t x1, ft_int16_t y1, ft_uint32_t rgb1)
dreschpe 0:5e013296b353 364 {
dreschpe 3:392d2c733c68 365 StartFunc( FT_CMD_SIZE*5);
dreschpe 3:392d2c733c68 366 SendCmd( CMD_GRADIENT);
dreschpe 3:392d2c733c68 367 SendCmd( (((ft_uint32_t)y0<<16)|(x0 & 0xffff)));
dreschpe 3:392d2c733c68 368 SendCmd( rgb0);
dreschpe 3:392d2c733c68 369 SendCmd( (((ft_uint32_t)y1<<16)|(x1 & 0xffff)));
dreschpe 3:392d2c733c68 370 SendCmd( rgb1);
dreschpe 3:392d2c733c68 371 EndFunc( (FT_CMD_SIZE*5));
dreschpe 0:5e013296b353 372 }
dreschpe 0:5e013296b353 373
dreschpe 3:392d2c733c68 374 ft_void_t FT800::SetMatrix( )
dreschpe 0:5e013296b353 375 {
dreschpe 3:392d2c733c68 376 StartFunc( FT_CMD_SIZE*1);
dreschpe 3:392d2c733c68 377 SendCmd( CMD_SETMATRIX);
dreschpe 3:392d2c733c68 378 EndFunc( (FT_CMD_SIZE*1));
dreschpe 0:5e013296b353 379 }
dreschpe 0:5e013296b353 380
dreschpe 3:392d2c733c68 381 ft_void_t FT800::Track( ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_int16_t tag)
dreschpe 0:5e013296b353 382 {
dreschpe 3:392d2c733c68 383 StartFunc( FT_CMD_SIZE*4);
dreschpe 3:392d2c733c68 384 SendCmd( CMD_TRACK);
dreschpe 3:392d2c733c68 385 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 386 SendCmd( (((ft_uint32_t)h<<16)|w));
dreschpe 3:392d2c733c68 387 SendCmd( tag);
dreschpe 3:392d2c733c68 388 EndFunc( (FT_CMD_SIZE*4));
dreschpe 0:5e013296b353 389 }
dreschpe 0:5e013296b353 390
dreschpe 3:392d2c733c68 391 ft_void_t FT800::GetPtr( ft_uint32_t result)
dreschpe 0:5e013296b353 392 {
dreschpe 3:392d2c733c68 393 StartFunc( FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 394 SendCmd( CMD_GETPTR);
dreschpe 3:392d2c733c68 395 SendCmd( result);
dreschpe 3:392d2c733c68 396 EndFunc( (FT_CMD_SIZE*2));
dreschpe 0:5e013296b353 397 }
dreschpe 0:5e013296b353 398
dreschpe 3:392d2c733c68 399 ft_void_t FT800::Progress( 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)
dreschpe 0:5e013296b353 400 {
dreschpe 3:392d2c733c68 401 StartFunc( FT_CMD_SIZE*5);
dreschpe 3:392d2c733c68 402 SendCmd( CMD_PROGRESS);
dreschpe 3:392d2c733c68 403 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 404 SendCmd( (((ft_uint32_t)h<<16)|w));
dreschpe 3:392d2c733c68 405 SendCmd( (((ft_uint32_t)val<<16)|options));
dreschpe 3:392d2c733c68 406 SendCmd( range);
dreschpe 3:392d2c733c68 407 EndFunc( (FT_CMD_SIZE*5));
dreschpe 0:5e013296b353 408 }
dreschpe 0:5e013296b353 409
dreschpe 3:392d2c733c68 410 ft_void_t FT800::ColdStart( )
dreschpe 0:5e013296b353 411 {
dreschpe 3:392d2c733c68 412 StartFunc( FT_CMD_SIZE*1);
dreschpe 3:392d2c733c68 413 SendCmd( CMD_COLDSTART);
dreschpe 3:392d2c733c68 414 EndFunc( (FT_CMD_SIZE*1));
dreschpe 0:5e013296b353 415 }
dreschpe 0:5e013296b353 416
dreschpe 3:392d2c733c68 417 ft_void_t FT800::Keys( 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)
dreschpe 0:5e013296b353 418 {
dreschpe 3:392d2c733c68 419 StartFunc( FT_CMD_SIZE*4 + strlen(s) + 1);
dreschpe 3:392d2c733c68 420 SendCmd( CMD_KEYS);
dreschpe 3:392d2c733c68 421 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 422 SendCmd( (((ft_uint32_t)h<<16)|w));
dreschpe 3:392d2c733c68 423 SendCmd( (((ft_uint32_t)options<<16)|font));
dreschpe 3:392d2c733c68 424 SendStr( s);
dreschpe 3:392d2c733c68 425 EndFunc( (FT_CMD_SIZE*4 + strlen(s) + 1));
dreschpe 0:5e013296b353 426 }
dreschpe 0:5e013296b353 427
dreschpe 3:392d2c733c68 428 ft_void_t FT800::Dial( ft_int16_t x, ft_int16_t y, ft_int16_t r, ft_uint16_t options, ft_uint16_t val)
dreschpe 0:5e013296b353 429 {
dreschpe 3:392d2c733c68 430 StartFunc( FT_CMD_SIZE*4);
dreschpe 3:392d2c733c68 431 SendCmd( CMD_DIAL);
dreschpe 3:392d2c733c68 432 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
dreschpe 3:392d2c733c68 433 SendCmd( (((ft_uint32_t)options<<16)|r));
dreschpe 3:392d2c733c68 434 SendCmd( val);
dreschpe 3:392d2c733c68 435 EndFunc( (FT_CMD_SIZE*4));
dreschpe 0:5e013296b353 436 }
dreschpe 0:5e013296b353 437
dreschpe 3:392d2c733c68 438 ft_void_t FT800::LoadImage( ft_uint32_t ptr, ft_uint32_t options)
dreschpe 0:5e013296b353 439 {
dreschpe 3:392d2c733c68 440 StartFunc( FT_CMD_SIZE*3);
dreschpe 3:392d2c733c68 441 SendCmd( CMD_LOADIMAGE);
dreschpe 3:392d2c733c68 442 SendCmd( ptr);
dreschpe 3:392d2c733c68 443 SendCmd( options);
dreschpe 3:392d2c733c68 444 EndFunc( (FT_CMD_SIZE*3));
dreschpe 0:5e013296b353 445 }
dreschpe 0:5e013296b353 446
dreschpe 3:392d2c733c68 447 ft_void_t FT800::Dlstart( )
dreschpe 0:5e013296b353 448 {
dreschpe 3:392d2c733c68 449 StartFunc( FT_CMD_SIZE*1);
dreschpe 3:392d2c733c68 450 SendCmd( CMD_DLSTART);
dreschpe 3:392d2c733c68 451 EndFunc( (FT_CMD_SIZE*1));
dreschpe 0:5e013296b353 452 }
dreschpe 0:5e013296b353 453
dreschpe 3:392d2c733c68 454 ft_void_t FT800::Snapshot( ft_uint32_t ptr)
dreschpe 0:5e013296b353 455 {
dreschpe 3:392d2c733c68 456 StartFunc( FT_CMD_SIZE*2);
dreschpe 3:392d2c733c68 457 SendCmd( CMD_SNAPSHOT);
dreschpe 3:392d2c733c68 458 SendCmd( ptr);
dreschpe 3:392d2c733c68 459 EndFunc( (FT_CMD_SIZE*2));
dreschpe 0:5e013296b353 460 }
dreschpe 0:5e013296b353 461
dreschpe 3:392d2c733c68 462 ft_void_t FT800::ScreenSaver( )
dreschpe 0:5e013296b353 463 {
dreschpe 3:392d2c733c68 464 StartFunc( FT_CMD_SIZE*1);
dreschpe 3:392d2c733c68 465 SendCmd( CMD_SCREENSAVER);
dreschpe 3:392d2c733c68 466 EndFunc( (FT_CMD_SIZE*1));
dreschpe 0:5e013296b353 467 }
dreschpe 0:5e013296b353 468
dreschpe 3:392d2c733c68 469 ft_void_t FT800::MemCrc( ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result)
dreschpe 0:5e013296b353 470 {
dreschpe 3:392d2c733c68 471 StartFunc( FT_CMD_SIZE*4);
dreschpe 3:392d2c733c68 472 SendCmd( CMD_MEMCRC);
dreschpe 3:392d2c733c68 473 SendCmd( ptr);
dreschpe 3:392d2c733c68 474 SendCmd( num);
dreschpe 3:392d2c733c68 475 SendCmd( result);
dreschpe 3:392d2c733c68 476 EndFunc( (FT_CMD_SIZE*4));
dreschpe 0:5e013296b353 477 }
dreschpe 0:5e013296b353 478
dreschpe 0:5e013296b353 479
dreschpe 3:392d2c733c68 480 ft_void_t FT800::WrCoCmd_Buffer(ft_uint32_t cmd)
dreschpe 0:5e013296b353 481 {
dreschpe 3:392d2c733c68 482 WrCmd32(cmd);
dreschpe 0:5e013296b353 483 /* Increment the command index */
dreschpe 3:392d2c733c68 484 CmdBuffer_Index += FT_CMD_SIZE;
dreschpe 0:5e013296b353 485 }
dreschpe 0:5e013296b353 486
dreschpe 3:392d2c733c68 487 ft_void_t FT800::WrDlCmd_Buffer(ft_uint32_t cmd)
dreschpe 0:5e013296b353 488 {
dreschpe 3:392d2c733c68 489 Wr32((RAM_DL+DlBuffer_Index),cmd);
dreschpe 0:5e013296b353 490 /* Increment the command index */
dreschpe 3:392d2c733c68 491 DlBuffer_Index += FT_CMD_SIZE;
dreschpe 0:5e013296b353 492 }
dreschpe 0:5e013296b353 493
dreschpe 3:392d2c733c68 494 ft_void_t FT800::Flush_DL_Buffer()
dreschpe 0:5e013296b353 495 {
dreschpe 3:392d2c733c68 496 DlBuffer_Index = 0;
dreschpe 3:392d2c733c68 497
dreschpe 0:5e013296b353 498 }
dreschpe 0:5e013296b353 499
dreschpe 3:392d2c733c68 500 ft_void_t FT800::Flush_Co_Buffer()
dreschpe 0:5e013296b353 501 {
dreschpe 3:392d2c733c68 502 CmdBuffer_Index = 0;
dreschpe 0:5e013296b353 503 }
dreschpe 0:5e013296b353 504
dreschpe 0:5e013296b353 505
dreschpe 0:5e013296b353 506 /* API to check the status of previous DLSWAP and perform DLSWAP of new DL */
dreschpe 0:5e013296b353 507 /* Check for the status of previous DLSWAP and if still not done wait for few ms and check again */
dreschpe 3:392d2c733c68 508 ft_void_t FT800::DLSwap(ft_uint8_t DL_Swap_Type)
dreschpe 0:5e013296b353 509 {
dreschpe 0:5e013296b353 510 ft_uint8_t Swap_Type = DLSWAP_FRAME,Swap_Done = DLSWAP_FRAME;
dreschpe 0:5e013296b353 511
dreschpe 0:5e013296b353 512 if(DL_Swap_Type == DLSWAP_LINE)
dreschpe 0:5e013296b353 513 {
dreschpe 0:5e013296b353 514 Swap_Type = DLSWAP_LINE;
dreschpe 0:5e013296b353 515 }
dreschpe 0:5e013296b353 516
dreschpe 0:5e013296b353 517 /* Perform a new DL swap */
dreschpe 3:392d2c733c68 518 Wr8(REG_DLSWAP,Swap_Type);
dreschpe 0:5e013296b353 519
dreschpe 0:5e013296b353 520 /* Wait till the swap is done */
dreschpe 0:5e013296b353 521 while(Swap_Done)
dreschpe 0:5e013296b353 522 {
dreschpe 3:392d2c733c68 523 Swap_Done = Rd8(REG_DLSWAP);
dreschpe 0:5e013296b353 524
dreschpe 0:5e013296b353 525 if(DLSWAP_DONE != Swap_Done)
dreschpe 0:5e013296b353 526 {
dreschpe 3:392d2c733c68 527 Sleep(10);//wait for 10ms
dreschpe 0:5e013296b353 528 }
dreschpe 3:392d2c733c68 529 }
dreschpe 0:5e013296b353 530 }
dreschpe 0:5e013296b353 531
dreschpe 0:5e013296b353 532
dreschpe 0:5e013296b353 533
dreschpe 0:5e013296b353 534 /* Nothing beyond this */
dreschpe 0:5e013296b353 535
dreschpe 0:5e013296b353 536
dreschpe 0:5e013296b353 537
dreschpe 0:5e013296b353 538