Library for FT810 EVE chip

Fork of FT810 by Curtis Mattull

Committer:
cpm219
Date:
Wed Sep 07 21:53:53 2016 +0000
Revision:
0:2d0ef4830603
Child:
7:3b4d59de6398
first version

Who changed what in which revision?

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