x

Dependents:   20180621_FT813

Fork of FT810 by Curtis Mattull

Committer:
cpm219
Date:
Tue Nov 15 03:32:56 2016 +0000
Revision:
7:3b4d59de6398
Parent:
0:2d0ef4830603
Child:
10:6a81aeca25e3
added function RomFont

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 7:3b4d59de6398 322 //Curtis Mattull added this function on 11/14/16, copied from above...
cpm219 7:3b4d59de6398 323 ft_void_t FT800::RomFont( ft_uint32_t rom_slot, ft_uint32_t font)
cpm219 7:3b4d59de6398 324 {
cpm219 7:3b4d59de6398 325 StartFunc( FT_CMD_SIZE*3);
cpm219 7:3b4d59de6398 326 SendCmd( CMD_ROMFONT);
cpm219 7:3b4d59de6398 327 SendCmd( rom_slot);
cpm219 7:3b4d59de6398 328 SendCmd( font);
cpm219 7:3b4d59de6398 329 EndFunc( (FT_CMD_SIZE*3));
cpm219 7:3b4d59de6398 330 }
cpm219 7:3b4d59de6398 331
cpm219 7:3b4d59de6398 332
cpm219 0:2d0ef4830603 333 ft_void_t FT800::Logo( )
cpm219 0:2d0ef4830603 334 {
cpm219 0:2d0ef4830603 335 StartFunc( FT_CMD_SIZE*1);
cpm219 0:2d0ef4830603 336 SendCmd( CMD_LOGO);
cpm219 0:2d0ef4830603 337 EndFunc( FT_CMD_SIZE*1);
cpm219 0:2d0ef4830603 338 }
cpm219 0:2d0ef4830603 339 ft_void_t FT800::Append( ft_uint32_t ptr, ft_uint32_t num)
cpm219 0:2d0ef4830603 340 {
cpm219 0:2d0ef4830603 341 StartFunc( FT_CMD_SIZE*3);
cpm219 0:2d0ef4830603 342 SendCmd( CMD_APPEND);
cpm219 0:2d0ef4830603 343 SendCmd( ptr);
cpm219 0:2d0ef4830603 344 SendCmd( num);
cpm219 0:2d0ef4830603 345 EndFunc( (FT_CMD_SIZE*3));
cpm219 0:2d0ef4830603 346 }
cpm219 0:2d0ef4830603 347 ft_void_t FT800::MemZero( ft_uint32_t ptr, ft_uint32_t num)
cpm219 0:2d0ef4830603 348 {
cpm219 0:2d0ef4830603 349 StartFunc( FT_CMD_SIZE*3);
cpm219 0:2d0ef4830603 350 SendCmd( CMD_MEMZERO);
cpm219 0:2d0ef4830603 351 SendCmd( ptr);
cpm219 0:2d0ef4830603 352 SendCmd( num);
cpm219 0:2d0ef4830603 353 EndFunc( (FT_CMD_SIZE*3));
cpm219 0:2d0ef4830603 354 }
cpm219 0:2d0ef4830603 355 ft_void_t FT800::Scale( ft_int32_t sx, ft_int32_t sy)
cpm219 0:2d0ef4830603 356 {
cpm219 0:2d0ef4830603 357 StartFunc( FT_CMD_SIZE*3);
cpm219 0:2d0ef4830603 358 SendCmd( CMD_SCALE);
cpm219 0:2d0ef4830603 359 SendCmd( sx);
cpm219 0:2d0ef4830603 360 SendCmd( sy);
cpm219 0:2d0ef4830603 361 EndFunc( (FT_CMD_SIZE*3));
cpm219 0:2d0ef4830603 362 }
cpm219 0:2d0ef4830603 363 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 364 {
cpm219 0:2d0ef4830603 365 StartFunc( FT_CMD_SIZE*5);
cpm219 0:2d0ef4830603 366 SendCmd( CMD_CLOCK);
cpm219 0:2d0ef4830603 367 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
cpm219 0:2d0ef4830603 368 SendCmd( (((ft_uint32_t)options<<16)|r));
cpm219 0:2d0ef4830603 369 SendCmd( (((ft_uint32_t)m<<16)|h));
cpm219 0:2d0ef4830603 370 SendCmd( (((ft_uint32_t)ms<<16)|s));
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::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 375 {
cpm219 0:2d0ef4830603 376 StartFunc( FT_CMD_SIZE*5);
cpm219 0:2d0ef4830603 377 SendCmd( CMD_GRADIENT);
cpm219 0:2d0ef4830603 378 SendCmd( (((ft_uint32_t)y0<<16)|(x0 & 0xffff)));
cpm219 0:2d0ef4830603 379 SendCmd( rgb0);
cpm219 0:2d0ef4830603 380 SendCmd( (((ft_uint32_t)y1<<16)|(x1 & 0xffff)));
cpm219 0:2d0ef4830603 381 SendCmd( rgb1);
cpm219 0:2d0ef4830603 382 EndFunc( (FT_CMD_SIZE*5));
cpm219 0:2d0ef4830603 383 }
cpm219 0:2d0ef4830603 384
cpm219 0:2d0ef4830603 385 ft_void_t FT800::SetMatrix( )
cpm219 0:2d0ef4830603 386 {
cpm219 0:2d0ef4830603 387 StartFunc( FT_CMD_SIZE*1);
cpm219 0:2d0ef4830603 388 SendCmd( CMD_SETMATRIX);
cpm219 0:2d0ef4830603 389 EndFunc( (FT_CMD_SIZE*1));
cpm219 0:2d0ef4830603 390 }
cpm219 0:2d0ef4830603 391
cpm219 0:2d0ef4830603 392 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 393 {
cpm219 0:2d0ef4830603 394 StartFunc( FT_CMD_SIZE*4);
cpm219 0:2d0ef4830603 395 SendCmd( CMD_TRACK);
cpm219 0:2d0ef4830603 396 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
cpm219 0:2d0ef4830603 397 SendCmd( (((ft_uint32_t)h<<16)|w));
cpm219 0:2d0ef4830603 398 SendCmd( tag);
cpm219 0:2d0ef4830603 399 EndFunc( (FT_CMD_SIZE*4));
cpm219 0:2d0ef4830603 400 }
cpm219 0:2d0ef4830603 401
cpm219 0:2d0ef4830603 402 ft_void_t FT800::GetPtr( ft_uint32_t result)
cpm219 0:2d0ef4830603 403 {
cpm219 0:2d0ef4830603 404 StartFunc( FT_CMD_SIZE*2);
cpm219 0:2d0ef4830603 405 SendCmd( CMD_GETPTR);
cpm219 0:2d0ef4830603 406 SendCmd( result);
cpm219 0:2d0ef4830603 407 EndFunc( (FT_CMD_SIZE*2));
cpm219 0:2d0ef4830603 408 }
cpm219 0:2d0ef4830603 409
cpm219 0:2d0ef4830603 410 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 411 {
cpm219 0:2d0ef4830603 412 StartFunc( FT_CMD_SIZE*5);
cpm219 0:2d0ef4830603 413 SendCmd( CMD_PROGRESS);
cpm219 0:2d0ef4830603 414 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
cpm219 0:2d0ef4830603 415 SendCmd( (((ft_uint32_t)h<<16)|w));
cpm219 0:2d0ef4830603 416 SendCmd( (((ft_uint32_t)val<<16)|options));
cpm219 0:2d0ef4830603 417 SendCmd( range);
cpm219 0:2d0ef4830603 418 EndFunc( (FT_CMD_SIZE*5));
cpm219 0:2d0ef4830603 419 }
cpm219 0:2d0ef4830603 420
cpm219 0:2d0ef4830603 421 ft_void_t FT800::ColdStart( )
cpm219 0:2d0ef4830603 422 {
cpm219 0:2d0ef4830603 423 StartFunc( FT_CMD_SIZE*1);
cpm219 0:2d0ef4830603 424 SendCmd( CMD_COLDSTART);
cpm219 0:2d0ef4830603 425 EndFunc( (FT_CMD_SIZE*1));
cpm219 0:2d0ef4830603 426 }
cpm219 0:2d0ef4830603 427
cpm219 0:2d0ef4830603 428 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 429 {
cpm219 0:2d0ef4830603 430 StartFunc( FT_CMD_SIZE*4 + strlen(s) + 1);
cpm219 0:2d0ef4830603 431 SendCmd( CMD_KEYS);
cpm219 0:2d0ef4830603 432 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
cpm219 0:2d0ef4830603 433 SendCmd( (((ft_uint32_t)h<<16)|w));
cpm219 0:2d0ef4830603 434 SendCmd( (((ft_uint32_t)options<<16)|font));
cpm219 0:2d0ef4830603 435 SendStr( s);
cpm219 0:2d0ef4830603 436 EndFunc( (FT_CMD_SIZE*4 + strlen(s) + 1));
cpm219 0:2d0ef4830603 437 }
cpm219 0:2d0ef4830603 438
cpm219 0:2d0ef4830603 439 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 440 {
cpm219 0:2d0ef4830603 441 StartFunc( FT_CMD_SIZE*4);
cpm219 0:2d0ef4830603 442 SendCmd( CMD_DIAL);
cpm219 0:2d0ef4830603 443 SendCmd( (((ft_uint32_t)y<<16)|(x & 0xffff)));
cpm219 0:2d0ef4830603 444 SendCmd( (((ft_uint32_t)options<<16)|r));
cpm219 0:2d0ef4830603 445 SendCmd( val);
cpm219 0:2d0ef4830603 446 EndFunc( (FT_CMD_SIZE*4));
cpm219 0:2d0ef4830603 447 }
cpm219 0:2d0ef4830603 448
cpm219 0:2d0ef4830603 449 ft_void_t FT800::LoadImage( ft_uint32_t ptr, ft_uint32_t options)
cpm219 0:2d0ef4830603 450 {
cpm219 0:2d0ef4830603 451 StartFunc( FT_CMD_SIZE*3);
cpm219 0:2d0ef4830603 452 SendCmd( CMD_LOADIMAGE);
cpm219 0:2d0ef4830603 453 SendCmd( ptr);
cpm219 0:2d0ef4830603 454 SendCmd( options);
cpm219 0:2d0ef4830603 455 EndFunc( (FT_CMD_SIZE*3));
cpm219 0:2d0ef4830603 456 }
cpm219 0:2d0ef4830603 457
cpm219 0:2d0ef4830603 458 ft_void_t FT800::DLstart( )
cpm219 0:2d0ef4830603 459 {
cpm219 0:2d0ef4830603 460 StartFunc( FT_CMD_SIZE*1);
cpm219 0:2d0ef4830603 461 SendCmd( CMD_DLSTART);
cpm219 0:2d0ef4830603 462 EndFunc( (FT_CMD_SIZE*1));
cpm219 0:2d0ef4830603 463 }
cpm219 0:2d0ef4830603 464
cpm219 0:2d0ef4830603 465 ft_void_t FT800::Snapshot( ft_uint32_t ptr)
cpm219 0:2d0ef4830603 466 {
cpm219 0:2d0ef4830603 467 StartFunc( FT_CMD_SIZE*2);
cpm219 0:2d0ef4830603 468 SendCmd( CMD_SNAPSHOT);
cpm219 0:2d0ef4830603 469 SendCmd( ptr);
cpm219 0:2d0ef4830603 470 EndFunc( (FT_CMD_SIZE*2));
cpm219 0:2d0ef4830603 471 }
cpm219 0:2d0ef4830603 472
cpm219 0:2d0ef4830603 473 ft_void_t FT800::ScreenSaver( )
cpm219 0:2d0ef4830603 474 {
cpm219 0:2d0ef4830603 475 StartFunc( FT_CMD_SIZE*1);
cpm219 0:2d0ef4830603 476 SendCmd( CMD_SCREENSAVER);
cpm219 0:2d0ef4830603 477 EndFunc( (FT_CMD_SIZE*1));
cpm219 0:2d0ef4830603 478 }
cpm219 0:2d0ef4830603 479
cpm219 0:2d0ef4830603 480 ft_void_t FT800::MemCrc( ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result)
cpm219 0:2d0ef4830603 481 {
cpm219 0:2d0ef4830603 482 StartFunc( FT_CMD_SIZE*4);
cpm219 0:2d0ef4830603 483 SendCmd( CMD_MEMCRC);
cpm219 0:2d0ef4830603 484 SendCmd( ptr);
cpm219 0:2d0ef4830603 485 SendCmd( num);
cpm219 0:2d0ef4830603 486 SendCmd( result);
cpm219 0:2d0ef4830603 487 EndFunc( (FT_CMD_SIZE*4));
cpm219 0:2d0ef4830603 488 }
cpm219 0:2d0ef4830603 489
cpm219 0:2d0ef4830603 490
cpm219 0:2d0ef4830603 491 ft_void_t FT800::DL(ft_uint32_t cmd)
cpm219 0:2d0ef4830603 492 {
cpm219 0:2d0ef4830603 493 WrCmd32(cmd);
cpm219 0:2d0ef4830603 494 /* Increment the command index */
cpm219 0:2d0ef4830603 495 CmdBuffer_Index += FT_CMD_SIZE;
cpm219 0:2d0ef4830603 496 }
cpm219 0:2d0ef4830603 497
cpm219 0:2d0ef4830603 498 ft_void_t FT800::WrDlCmd_Buffer(ft_uint32_t cmd)
cpm219 0:2d0ef4830603 499 {
cpm219 0:2d0ef4830603 500 Wr32((RAM_DL+DlBuffer_Index),cmd);
cpm219 0:2d0ef4830603 501 /* Increment the command index */
cpm219 0:2d0ef4830603 502 DlBuffer_Index += FT_CMD_SIZE;
cpm219 0:2d0ef4830603 503 }
cpm219 0:2d0ef4830603 504
cpm219 0:2d0ef4830603 505 ft_void_t FT800::Flush_DL_Buffer()
cpm219 0:2d0ef4830603 506 {
cpm219 0:2d0ef4830603 507 DlBuffer_Index = 0;
cpm219 0:2d0ef4830603 508
cpm219 0:2d0ef4830603 509 }
cpm219 0:2d0ef4830603 510
cpm219 0:2d0ef4830603 511 ft_void_t FT800::Flush_Co_Buffer()
cpm219 0:2d0ef4830603 512 {
cpm219 0:2d0ef4830603 513 CmdBuffer_Index = 0;
cpm219 0:2d0ef4830603 514 }
cpm219 0:2d0ef4830603 515
cpm219 0:2d0ef4830603 516
cpm219 0:2d0ef4830603 517 /* API to check the status of previous DLSWAP and perform DLSWAP of new DL */
cpm219 0:2d0ef4830603 518 /* Check for the status of previous DLSWAP and if still not done wait for few ms and check again */
cpm219 0:2d0ef4830603 519 ft_void_t FT800::DLSwap(ft_uint8_t DL_Swap_Type)
cpm219 0:2d0ef4830603 520 {
cpm219 0:2d0ef4830603 521 ft_uint8_t Swap_Type = DLSWAP_FRAME,Swap_Done = DLSWAP_FRAME;
cpm219 0:2d0ef4830603 522
cpm219 0:2d0ef4830603 523 if(DL_Swap_Type == DLSWAP_LINE)
cpm219 0:2d0ef4830603 524 {
cpm219 0:2d0ef4830603 525 Swap_Type = DLSWAP_LINE;
cpm219 0:2d0ef4830603 526 }
cpm219 0:2d0ef4830603 527
cpm219 0:2d0ef4830603 528 /* Perform a new DL swap */
cpm219 0:2d0ef4830603 529 Wr8(REG_DLSWAP,Swap_Type);
cpm219 0:2d0ef4830603 530
cpm219 0:2d0ef4830603 531 /* Wait till the swap is done */
cpm219 0:2d0ef4830603 532 while(Swap_Done)
cpm219 0:2d0ef4830603 533 {
cpm219 0:2d0ef4830603 534 Swap_Done = Rd8(REG_DLSWAP);
cpm219 0:2d0ef4830603 535
cpm219 0:2d0ef4830603 536 if(DLSWAP_DONE != Swap_Done)
cpm219 0:2d0ef4830603 537 {
cpm219 0:2d0ef4830603 538 Sleep(10);//wait for 10ms
cpm219 0:2d0ef4830603 539 }
cpm219 0:2d0ef4830603 540 }
cpm219 0:2d0ef4830603 541 }
cpm219 0:2d0ef4830603 542
cpm219 0:2d0ef4830603 543
cpm219 0:2d0ef4830603 544
cpm219 0:2d0ef4830603 545 /* Nothing beyond this */
cpm219 0:2d0ef4830603 546
cpm219 0:2d0ef4830603 547
cpm219 0:2d0ef4830603 548
cpm219 0:2d0ef4830603 549