Lib FT800 Modifiee

Dependents:   FT800_Lib_perso

Committer:
schnf30
Date:
Tue Feb 08 08:17:31 2022 +0000
Revision:
0:7ea2f058a713
Librairie FT800 adaptee avec drawline, Brigntness etc...

Who changed what in which revision?

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