808

Dependents:   Chromatograph_Mobile

Committer:
nikmaos
Date:
Tue Sep 01 10:52:05 2020 +0000
Revision:
13:5959af2ac87a
Parent:
10:6a81aeca25e3
1.09.2020

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JackB 10:6a81aeca25e3 1 /* mbed Library for FTDI FT813 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
JackB 10:6a81aeca25e3 8 ft_void_t FT813::SendCmd(ft_uint32_t cmd)
cpm219 0:2d0ef4830603 9 {
JackB 10:6a81aeca25e3 10 Transfer32(cmd);
cpm219 0:2d0ef4830603 11 }
cpm219 0:2d0ef4830603 12
JackB 10:6a81aeca25e3 13 ft_void_t FT813::SendStr(const ft_char8_t *s)
cpm219 0:2d0ef4830603 14 {
JackB 10:6a81aeca25e3 15 TransferString(s);
cpm219 0:2d0ef4830603 16 }
cpm219 0:2d0ef4830603 17
JackB 10:6a81aeca25e3 18 ft_void_t FT813::StartFunc(ft_uint16_t count)
cpm219 0:2d0ef4830603 19 {
JackB 10:6a81aeca25e3 20 _count = count;
JackB 10:6a81aeca25e3 21 CheckCmdBuffer(_count);
JackB 10:6a81aeca25e3 22 StartCmdTransfer(FT_GPU_WRITE, _count);
cpm219 0:2d0ef4830603 23 }
cpm219 0:2d0ef4830603 24
JackB 10:6a81aeca25e3 25 ft_void_t FT813::EndFunc()
cpm219 0:2d0ef4830603 26 {
JackB 10:6a81aeca25e3 27 EndTransfer();
JackB 10:6a81aeca25e3 28 Updatecmdfifo(_count);
JackB 10:6a81aeca25e3 29 }
JackB 10:6a81aeca25e3 30
JackB 10:6a81aeca25e3 31 // Start a new display list
JackB 10:6a81aeca25e3 32 // FT81x Series Programmers Guide Section 5.11
JackB 10:6a81aeca25e3 33 ft_void_t FT813::DLstart()
JackB 10:6a81aeca25e3 34 {
JackB 10:6a81aeca25e3 35 // _address = 0;
JackB 10:6a81aeca25e3 36 StartFunc(FT_CMD_SIZE);
JackB 10:6a81aeca25e3 37 SendCmd(CMD_DLSTART);
JackB 10:6a81aeca25e3 38 EndFunc();
cpm219 0:2d0ef4830603 39 }
cpm219 0:2d0ef4830603 40
JackB 10:6a81aeca25e3 41 // Swap the current display list with the new display list
JackB 10:6a81aeca25e3 42 // FT81x Series Programmers Guide Section 5.12
JackB 10:6a81aeca25e3 43 ft_void_t FT813::Swap()
cpm219 0:2d0ef4830603 44 {
JackB 10:6a81aeca25e3 45 StartFunc(FT_CMD_SIZE);
JackB 10:6a81aeca25e3 46 SendCmd(CMD_SWAP);
JackB 10:6a81aeca25e3 47 EndFunc();
JackB 10:6a81aeca25e3 48 }
JackB 10:6a81aeca25e3 49
JackB 10:6a81aeca25e3 50 // Set co-processor engine state to default values
JackB 10:6a81aeca25e3 51 // FT81x Series Programmers Guide Section 5.13
JackB 10:6a81aeca25e3 52 ft_void_t FT813::ColdStart()
JackB 10:6a81aeca25e3 53 {
JackB 10:6a81aeca25e3 54 StartFunc(FT_CMD_SIZE);
JackB 10:6a81aeca25e3 55 SendCmd(CMD_COLDSTART);
JackB 10:6a81aeca25e3 56 EndFunc();
cpm219 0:2d0ef4830603 57 }
cpm219 0:2d0ef4830603 58
JackB 10:6a81aeca25e3 59 // Trigger interrupt INT_CMDFLAG
JackB 10:6a81aeca25e3 60 // FT81x Series Programmers Guide Section 5.14
JackB 10:6a81aeca25e3 61 ft_void_t FT813::Interrupt(ft_uint32_t ms)
cpm219 0:2d0ef4830603 62 {
JackB 10:6a81aeca25e3 63 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 64 SendCmd(CMD_INTERRUPT);
JackB 10:6a81aeca25e3 65 SendCmd(ms);
JackB 10:6a81aeca25e3 66 EndFunc();
cpm219 0:2d0ef4830603 67 }
cpm219 0:2d0ef4830603 68
JackB 10:6a81aeca25e3 69 // Append more commands to current display list
JackB 10:6a81aeca25e3 70 // FT81x Series Programmers Guide Section 5.15
JackB 10:6a81aeca25e3 71 ft_void_t FT813::Append(ft_uint32_t ptr, ft_uint32_t num)
cpm219 0:2d0ef4830603 72 {
JackB 10:6a81aeca25e3 73 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 74 SendCmd(CMD_APPEND);
JackB 10:6a81aeca25e3 75 SendCmd(ptr);
JackB 10:6a81aeca25e3 76 SendCmd(num);
JackB 10:6a81aeca25e3 77 EndFunc();
JackB 10:6a81aeca25e3 78 }
JackB 10:6a81aeca25e3 79
JackB 10:6a81aeca25e3 80 // Read a register value
JackB 10:6a81aeca25e3 81 // FT81x Series Programmers Guide Section 5.16
JackB 10:6a81aeca25e3 82 ft_void_t FT813::RegRead(ft_uint32_t ptr, ft_uint32_t result)
JackB 10:6a81aeca25e3 83 {
JackB 10:6a81aeca25e3 84 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 85 SendCmd(CMD_REGREAD);
JackB 10:6a81aeca25e3 86 SendCmd(ptr);
JackB 10:6a81aeca25e3 87 SendCmd(0);
JackB 10:6a81aeca25e3 88 EndFunc();
cpm219 0:2d0ef4830603 89 }
cpm219 0:2d0ef4830603 90
JackB 10:6a81aeca25e3 91 /* commands to operate on memory: */
JackB 10:6a81aeca25e3 92
JackB 10:6a81aeca25e3 93 // Write bytes into memory
JackB 10:6a81aeca25e3 94 // FT81x Series Programmers Guide Section 5.17
JackB 10:6a81aeca25e3 95 ft_void_t FT813::MemWrite(ft_uint32_t ptr, ft_uint32_t num)
cpm219 0:2d0ef4830603 96 {
JackB 10:6a81aeca25e3 97 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 98 SendCmd(CMD_MEMWRITE);
JackB 10:6a81aeca25e3 99 SendCmd(ptr);
JackB 10:6a81aeca25e3 100 SendCmd(num);
JackB 10:6a81aeca25e3 101 EndFunc();
cpm219 0:2d0ef4830603 102 }
cpm219 0:2d0ef4830603 103
JackB 10:6a81aeca25e3 104 // Decompress data into memory
JackB 10:6a81aeca25e3 105 // FT81x Series Programmers Guide Section 5.18
JackB 10:6a81aeca25e3 106 ft_void_t FT813::Inflate(ft_uint32_t ptr)
cpm219 0:2d0ef4830603 107 {
JackB 10:6a81aeca25e3 108 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 109 SendCmd(CMD_INFLATE);
JackB 10:6a81aeca25e3 110 SendCmd(ptr);
JackB 10:6a81aeca25e3 111 EndFunc();
cpm219 0:2d0ef4830603 112 }
cpm219 0:2d0ef4830603 113
JackB 10:6a81aeca25e3 114 // Load a JPEG or PNG image
JackB 10:6a81aeca25e3 115 // FT81x Series Programmers Guide Section 5.19
JackB 10:6a81aeca25e3 116 ft_void_t FT813::LoadImage(ft_uint32_t ptr, ft_uint32_t options)
cpm219 0:2d0ef4830603 117 {
JackB 10:6a81aeca25e3 118 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 119 SendCmd(CMD_LOADIMAGE);
JackB 10:6a81aeca25e3 120 SendCmd(ptr);
JackB 10:6a81aeca25e3 121 SendCmd(options);
JackB 10:6a81aeca25e3 122 EndFunc();
cpm219 0:2d0ef4830603 123 }
cpm219 0:2d0ef4830603 124
JackB 10:6a81aeca25e3 125 // Set up a streaming media FIFO in RAM_G
JackB 10:6a81aeca25e3 126 // FT81x Series Programmers Guide Section 5.20
JackB 10:6a81aeca25e3 127 ft_void_t FT813::MediaFifo(ft_uint32_t ptr, ft_uint32_t size)
cpm219 0:2d0ef4830603 128 {
JackB 10:6a81aeca25e3 129 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 130 SendCmd(CMD_MEDIAFIFO);
JackB 10:6a81aeca25e3 131 SendCmd(ptr);
JackB 10:6a81aeca25e3 132 SendCmd(size);
JackB 10:6a81aeca25e3 133 EndFunc();
JackB 10:6a81aeca25e3 134 }
JackB 10:6a81aeca25e3 135
JackB 10:6a81aeca25e3 136 // Video playback
JackB 10:6a81aeca25e3 137 // FT81x Series Programmers Guide Section 5.21
JackB 10:6a81aeca25e3 138 ft_void_t FT813::PlayVideo(ft_uint32_t opts)
JackB 10:6a81aeca25e3 139 {
JackB 10:6a81aeca25e3 140 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 141 SendCmd(CMD_PLAYVIDEO);
JackB 10:6a81aeca25e3 142 SendCmd(opts);
JackB 10:6a81aeca25e3 143 EndFunc();
cpm219 0:2d0ef4830603 144 }
cpm219 0:2d0ef4830603 145
JackB 10:6a81aeca25e3 146 // Initialize video frame decoder
JackB 10:6a81aeca25e3 147 // FT81x Series Programmers Guide Section 5.22
JackB 10:6a81aeca25e3 148 ft_void_t FT813::VideoStart()
cpm219 0:2d0ef4830603 149 {
JackB 10:6a81aeca25e3 150 StartFunc(FT_CMD_SIZE);
JackB 10:6a81aeca25e3 151 SendCmd(CMD_VIDEOSTART);
JackB 10:6a81aeca25e3 152 EndFunc();
cpm219 0:2d0ef4830603 153 }
cpm219 0:2d0ef4830603 154
JackB 10:6a81aeca25e3 155 // Load the next frame of video
JackB 10:6a81aeca25e3 156 // FT81x Series Programmers Guide Section 5.23
JackB 10:6a81aeca25e3 157 ft_void_t FT813::VideoFrame(ft_uint32_t dst, ft_uint32_t ptr)
cpm219 0:2d0ef4830603 158 {
JackB 10:6a81aeca25e3 159 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 160 SendCmd(CMD_VIDEOFRAME);
JackB 10:6a81aeca25e3 161 SendCmd(dst);
JackB 10:6a81aeca25e3 162 SendCmd(ptr);
JackB 10:6a81aeca25e3 163 EndFunc();
cpm219 0:2d0ef4830603 164 }
cpm219 0:2d0ef4830603 165
JackB 10:6a81aeca25e3 166 // Compute a CRC-32 for memory
JackB 10:6a81aeca25e3 167 // FT81x Series Programmers Guide Section 5.24
JackB 10:6a81aeca25e3 168 ft_void_t FT813::MemCrc(ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result)
cpm219 0:2d0ef4830603 169 {
JackB 10:6a81aeca25e3 170 StartFunc(FT_CMD_SIZE*4);
JackB 10:6a81aeca25e3 171 SendCmd(CMD_MEMCRC);
JackB 10:6a81aeca25e3 172 SendCmd(ptr);
JackB 10:6a81aeca25e3 173 SendCmd(num);
JackB 10:6a81aeca25e3 174 SendCmd(result);
JackB 10:6a81aeca25e3 175 EndFunc();
cpm219 0:2d0ef4830603 176 }
cpm219 0:2d0ef4830603 177
JackB 10:6a81aeca25e3 178 // Write zero to a block of memory
JackB 10:6a81aeca25e3 179 // FT81x Series Programmers Guide Section 5.25
JackB 10:6a81aeca25e3 180 ft_void_t FT813::MemZero(ft_uint32_t ptr, ft_uint32_t num)
cpm219 0:2d0ef4830603 181 {
JackB 10:6a81aeca25e3 182 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 183 SendCmd(CMD_MEMZERO);
JackB 10:6a81aeca25e3 184 SendCmd(ptr);
JackB 10:6a81aeca25e3 185 SendCmd(num);
JackB 10:6a81aeca25e3 186 EndFunc();
cpm219 0:2d0ef4830603 187 }
cpm219 0:2d0ef4830603 188
JackB 10:6a81aeca25e3 189 // Fill memory with a byte value
JackB 10:6a81aeca25e3 190 // FT81x Series Programmers Guide Section 5.26
JackB 10:6a81aeca25e3 191 ft_void_t FT813::MemSet(ft_uint32_t ptr, ft_uint32_t value, ft_uint32_t num)
cpm219 0:2d0ef4830603 192 {
JackB 10:6a81aeca25e3 193 StartFunc(FT_CMD_SIZE*4);
JackB 10:6a81aeca25e3 194 SendCmd(CMD_MEMSET);
JackB 10:6a81aeca25e3 195 SendCmd(ptr);
JackB 10:6a81aeca25e3 196 SendCmd(value);
JackB 10:6a81aeca25e3 197 SendCmd(num);
JackB 10:6a81aeca25e3 198 EndFunc();
cpm219 0:2d0ef4830603 199 }
cpm219 0:2d0ef4830603 200
JackB 10:6a81aeca25e3 201 // Cmd_Memcpy - background copy a block of data
JackB 10:6a81aeca25e3 202 // FT81x Series Programmers Guide Section 5.27
JackB 10:6a81aeca25e3 203 ft_void_t FT813::Memcpy(ft_uint32_t dest, ft_uint32_t src, ft_uint32_t num)
cpm219 0:2d0ef4830603 204 {
JackB 10:6a81aeca25e3 205 StartFunc(FT_CMD_SIZE*4);
JackB 10:6a81aeca25e3 206 SendCmd(CMD_MEMCPY);
JackB 10:6a81aeca25e3 207 SendCmd(dest);
JackB 10:6a81aeca25e3 208 SendCmd(src);
JackB 10:6a81aeca25e3 209 SendCmd(num);
JackB 10:6a81aeca25e3 210 EndFunc();
cpm219 0:2d0ef4830603 211 }
cpm219 0:2d0ef4830603 212
JackB 10:6a81aeca25e3 213 /* commands to draw graphics objects: */
JackB 10:6a81aeca25e3 214 // ******************** Screen Object Creation CoProcessor Command Functions ******************************
cpm219 0:2d0ef4830603 215
JackB 10:6a81aeca25e3 216 // Draw a button
JackB 10:6a81aeca25e3 217 // FT81x Series Programmers Guide Section 5.28
JackB 10:6a81aeca25e3 218 ft_void_t FT813::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 219 {
JackB 10:6a81aeca25e3 220 StartFunc(FT_CMD_SIZE*4 + strlen(s) + 1);
JackB 10:6a81aeca25e3 221 SendCmd(CMD_BUTTON);
JackB 10:6a81aeca25e3 222 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 223 SendCmd((((ft_uint32_t)h<<16)|w));
JackB 10:6a81aeca25e3 224 SendCmd((((ft_uint32_t)options<<16)|font)); // patch from Ivano Pelicella to draw flat buttons
JackB 10:6a81aeca25e3 225 SendStr(s);
JackB 10:6a81aeca25e3 226 EndFunc();
cpm219 0:2d0ef4830603 227 }
cpm219 0:2d0ef4830603 228
JackB 10:6a81aeca25e3 229 // Draw an analog clock
JackB 10:6a81aeca25e3 230 // FT81x Series Programmers Guide Section 5.29
JackB 10:6a81aeca25e3 231 ft_void_t FT813::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 232 {
JackB 10:6a81aeca25e3 233 StartFunc(FT_CMD_SIZE*5);
JackB 10:6a81aeca25e3 234 SendCmd(CMD_CLOCK);
JackB 10:6a81aeca25e3 235 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 236 SendCmd((((ft_uint32_t)options<<16)|r));
JackB 10:6a81aeca25e3 237 SendCmd((((ft_uint32_t)m<<16)|h));
JackB 10:6a81aeca25e3 238 SendCmd((((ft_uint32_t)ms<<16)|s));
JackB 10:6a81aeca25e3 239 EndFunc();
JackB 10:6a81aeca25e3 240 }
JackB 10:6a81aeca25e3 241
JackB 10:6a81aeca25e3 242 // Set the foreground color
JackB 10:6a81aeca25e3 243 // FT81x Series Programmers Guide Section 5.30
JackB 10:6a81aeca25e3 244 ft_void_t FT813::FgColor(ft_uint32_t c)
JackB 10:6a81aeca25e3 245 {
JackB 10:6a81aeca25e3 246 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 247 SendCmd(CMD_FGCOLOR);
JackB 10:6a81aeca25e3 248 SendCmd(c);
JackB 10:6a81aeca25e3 249 EndFunc();
JackB 10:6a81aeca25e3 250 }
JackB 10:6a81aeca25e3 251
JackB 10:6a81aeca25e3 252 // Set the background color
JackB 10:6a81aeca25e3 253 // FT81x Series Programmers Guide Section 5.31
JackB 10:6a81aeca25e3 254 ft_void_t FT813::BgColor(ft_uint32_t c)
JackB 10:6a81aeca25e3 255 {
JackB 10:6a81aeca25e3 256 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 257 SendCmd(CMD_BGCOLOR);
JackB 10:6a81aeca25e3 258 SendCmd(c);
JackB 10:6a81aeca25e3 259 EndFunc();
cpm219 0:2d0ef4830603 260 }
cpm219 0:2d0ef4830603 261
JackB 10:6a81aeca25e3 262 // Set the 3D button highlight color - Set Highlight Gradient Color
JackB 10:6a81aeca25e3 263 // FT81x Series Programmers Guide Section 5.32
JackB 10:6a81aeca25e3 264 ft_void_t FT813::GradColor(ft_uint32_t c)
cpm219 0:2d0ef4830603 265 {
JackB 10:6a81aeca25e3 266 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 267 SendCmd(CMD_GRADCOLOR);
JackB 10:6a81aeca25e3 268 SendCmd(c);
JackB 10:6a81aeca25e3 269 EndFunc();
JackB 10:6a81aeca25e3 270 }
JackB 10:6a81aeca25e3 271
JackB 10:6a81aeca25e3 272 // Draw a gauge
JackB 10:6a81aeca25e3 273 // FT81x Series Programmers Guide Section 5.33
JackB 10:6a81aeca25e3 274 /* Error handling for val is not done, so better to always use range of 65535 in order that needle is drawn within display region */
JackB 10:6a81aeca25e3 275 ft_void_t FT813::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)
JackB 10:6a81aeca25e3 276 {
JackB 10:6a81aeca25e3 277 StartFunc(FT_CMD_SIZE*5);
JackB 10:6a81aeca25e3 278 SendCmd(CMD_GAUGE);
JackB 10:6a81aeca25e3 279 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 280 SendCmd((((ft_uint32_t)options<<16)|r));
JackB 10:6a81aeca25e3 281 SendCmd((((ft_uint32_t)minor<<16)|major));
JackB 10:6a81aeca25e3 282 SendCmd((((ft_uint32_t)range<<16)|val));
JackB 10:6a81aeca25e3 283 EndFunc();
cpm219 0:2d0ef4830603 284 }
cpm219 0:2d0ef4830603 285
JackB 10:6a81aeca25e3 286 // Draw a smooth color gradient
JackB 10:6a81aeca25e3 287 // FT81x Series Programmers Guide Section 5.34
JackB 10:6a81aeca25e3 288 ft_void_t FT813::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 289 {
JackB 10:6a81aeca25e3 290 StartFunc(FT_CMD_SIZE*5);
JackB 10:6a81aeca25e3 291 SendCmd(CMD_GRADIENT);
JackB 10:6a81aeca25e3 292 SendCmd((((ft_uint32_t)y0<<16)|(x0 & 0xffff)));
JackB 10:6a81aeca25e3 293 SendCmd(rgb0);
JackB 10:6a81aeca25e3 294 SendCmd((((ft_uint32_t)y1<<16)|(x1 & 0xffff)));
JackB 10:6a81aeca25e3 295 SendCmd(rgb1);
JackB 10:6a81aeca25e3 296 EndFunc();
cpm219 0:2d0ef4830603 297 }
cpm219 0:2d0ef4830603 298
JackB 10:6a81aeca25e3 299 // Draw a row of keys
JackB 10:6a81aeca25e3 300 // FT81x Series Programmers Guide Section 5.35
JackB 10:6a81aeca25e3 301 ft_void_t FT813::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 302 {
JackB 10:6a81aeca25e3 303 StartFunc(FT_CMD_SIZE*4 + strlen(s) + 1);
JackB 10:6a81aeca25e3 304 SendCmd(CMD_KEYS);
JackB 10:6a81aeca25e3 305 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 306 SendCmd((((ft_uint32_t)h<<16)|w));
JackB 10:6a81aeca25e3 307 SendCmd((((ft_uint32_t)options<<16)|font));
JackB 10:6a81aeca25e3 308 SendStr(s);
JackB 10:6a81aeca25e3 309 EndFunc();
cpm219 0:2d0ef4830603 310 }
cpm219 0:2d0ef4830603 311
JackB 10:6a81aeca25e3 312 // Draw a progress bar
JackB 10:6a81aeca25e3 313 // FT81x Series Programmers Guide Section 5.36
JackB 10:6a81aeca25e3 314 ft_void_t FT813::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 315 {
JackB 10:6a81aeca25e3 316 StartFunc(FT_CMD_SIZE*5);
JackB 10:6a81aeca25e3 317 SendCmd(CMD_PROGRESS);
JackB 10:6a81aeca25e3 318 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 319 SendCmd((((ft_uint32_t)h<<16)|w));
JackB 10:6a81aeca25e3 320 SendCmd((((ft_uint32_t)val<<16)|options));
JackB 10:6a81aeca25e3 321 SendCmd(range);
JackB 10:6a81aeca25e3 322 EndFunc();
cpm219 0:2d0ef4830603 323 }
cpm219 0:2d0ef4830603 324
JackB 10:6a81aeca25e3 325 // Draw a scroll bar
JackB 10:6a81aeca25e3 326 // FT81x Series Programmers Guide Section 5.37
JackB 10:6a81aeca25e3 327 ft_void_t FT813::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 328 {
JackB 10:6a81aeca25e3 329 StartFunc(FT_CMD_SIZE*5);
JackB 10:6a81aeca25e3 330 SendCmd(CMD_SCROLLBAR);
JackB 10:6a81aeca25e3 331 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 332 SendCmd((((ft_uint32_t)h<<16)|w));
JackB 10:6a81aeca25e3 333 SendCmd((((ft_uint32_t)val<<16)|options));
JackB 10:6a81aeca25e3 334 SendCmd((((ft_uint32_t)range<<16)|size));
JackB 10:6a81aeca25e3 335 EndFunc();
cpm219 0:2d0ef4830603 336 }
cpm219 0:2d0ef4830603 337
JackB 10:6a81aeca25e3 338 // Draw a slider
JackB 10:6a81aeca25e3 339 // FT81x Series Programmers Guide Section 5.38
JackB 10:6a81aeca25e3 340 ft_void_t FT813::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 341 {
JackB 10:6a81aeca25e3 342 StartFunc(FT_CMD_SIZE*5);
JackB 10:6a81aeca25e3 343 SendCmd(CMD_SLIDER);
JackB 10:6a81aeca25e3 344 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 345 SendCmd((((ft_uint32_t)h<<16)|w));
JackB 10:6a81aeca25e3 346 SendCmd((((ft_uint32_t)val<<16)|options));
JackB 10:6a81aeca25e3 347 SendCmd(range);
JackB 10:6a81aeca25e3 348 EndFunc();
JackB 10:6a81aeca25e3 349 }
JackB 10:6a81aeca25e3 350
JackB 10:6a81aeca25e3 351 // Draw a rotary dial control
JackB 10:6a81aeca25e3 352 // FT81x Series Programmers Guide Section 5.39
JackB 10:6a81aeca25e3 353 // This is much like a Gauge except for the helpful range parameter. For some reason, all dials are 65535 around.
JackB 10:6a81aeca25e3 354 ft_void_t FT813::Dial(ft_int16_t x, ft_int16_t y, ft_int16_t r, ft_uint16_t options, ft_uint16_t val)
JackB 10:6a81aeca25e3 355 {
JackB 10:6a81aeca25e3 356 StartFunc(FT_CMD_SIZE*4);
JackB 10:6a81aeca25e3 357 SendCmd(CMD_DIAL);
JackB 10:6a81aeca25e3 358 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 359 SendCmd((((ft_uint32_t)options<<16)|r));
JackB 10:6a81aeca25e3 360 SendCmd(val);
JackB 10:6a81aeca25e3 361 EndFunc();
cpm219 0:2d0ef4830603 362 }
cpm219 0:2d0ef4830603 363
JackB 10:6a81aeca25e3 364 // Draw a toggle switch
JackB 10:6a81aeca25e3 365 // FT81x Series Programmers Guide Section 5.40
JackB 10:6a81aeca25e3 366 ft_void_t FT813::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 367 {
JackB 10:6a81aeca25e3 368 StartFunc(FT_CMD_SIZE*4 + strlen(s) + 1);
JackB 10:6a81aeca25e3 369 SendCmd(CMD_TOGGLE);
JackB 10:6a81aeca25e3 370 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 371 SendCmd((((ft_uint32_t)font<<16)|w));
JackB 10:6a81aeca25e3 372 SendCmd((((ft_uint32_t)state<<16)|options));
JackB 10:6a81aeca25e3 373 SendStr(s);
JackB 10:6a81aeca25e3 374 EndFunc();
cpm219 0:2d0ef4830603 375 }
JackB 10:6a81aeca25e3 376
JackB 10:6a81aeca25e3 377 // Draw Text
JackB 10:6a81aeca25e3 378 // FT81x Series Programmers Guide Section 5.41
JackB 10:6a81aeca25e3 379 ft_void_t FT813::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 380 {
JackB 10:6a81aeca25e3 381 StartFunc(FT_CMD_SIZE*3 + strlen(s) + 1);
JackB 10:6a81aeca25e3 382 SendCmd(CMD_TEXT);
JackB 10:6a81aeca25e3 383 //Copro_SendCmd((((ft_uint32_t)y<<16)|(ft_uint32_t)x));
JackB 10:6a81aeca25e3 384 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 385 SendCmd((((ft_uint32_t)options<<16)|(ft_uint32_t)font));
JackB 10:6a81aeca25e3 386 SendStr(s);
JackB 10:6a81aeca25e3 387 EndFunc();
cpm219 0:2d0ef4830603 388 }
JackB 10:6a81aeca25e3 389
JackB 10:6a81aeca25e3 390 // Set the base for number output
JackB 10:6a81aeca25e3 391 // FT81x Series Programmers Guide Section 5.42
JackB 10:6a81aeca25e3 392 ft_void_t FT813::SetBase(ft_uint32_t base)
cpm219 0:2d0ef4830603 393 {
JackB 10:6a81aeca25e3 394 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 395 SendCmd(CMD_SETBASE);
JackB 10:6a81aeca25e3 396 SendCmd(base);
JackB 10:6a81aeca25e3 397 EndFunc();
cpm219 0:2d0ef4830603 398 }
JackB 10:6a81aeca25e3 399
JackB 10:6a81aeca25e3 400 // Draw number
JackB 10:6a81aeca25e3 401 // FT81x Series Programmers Guide Section 5.43
JackB 10:6a81aeca25e3 402 ft_void_t FT813::Number(ft_int16_t x, ft_int16_t y, ft_int16_t font, ft_uint16_t options, ft_int32_t n)
cpm219 0:2d0ef4830603 403 {
JackB 10:6a81aeca25e3 404 StartFunc(FT_CMD_SIZE*4);
JackB 10:6a81aeca25e3 405 SendCmd(CMD_NUMBER);
JackB 10:6a81aeca25e3 406 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 407 SendCmd((((ft_uint32_t)options<<16)|font));
JackB 10:6a81aeca25e3 408 SendCmd(n);
JackB 10:6a81aeca25e3 409 EndFunc();
cpm219 0:2d0ef4830603 410 }
JackB 10:6a81aeca25e3 411
JackB 10:6a81aeca25e3 412 // Set the current matrix to the identity matrix
JackB 10:6a81aeca25e3 413 // FT81x Series Programmers Guide Section 5.44
JackB 10:6a81aeca25e3 414 ft_void_t FT813::LoadIdentity()
cpm219 0:2d0ef4830603 415 {
JackB 10:6a81aeca25e3 416 StartFunc(FT_CMD_SIZE);
JackB 10:6a81aeca25e3 417 SendCmd(CMD_LOADIDENTITY);
JackB 10:6a81aeca25e3 418 EndFunc();
JackB 10:6a81aeca25e3 419 }
cpm219 0:2d0ef4830603 420
JackB 10:6a81aeca25e3 421 // Write the current matrix to the display list
JackB 10:6a81aeca25e3 422 // FT81x Series Programmers Guide Section 5.45
JackB 10:6a81aeca25e3 423 ft_void_t FT813::SetMatrix()
cpm219 0:2d0ef4830603 424 {
JackB 10:6a81aeca25e3 425 StartFunc(FT_CMD_SIZE);
JackB 10:6a81aeca25e3 426 SendCmd(CMD_SETMATRIX);
JackB 10:6a81aeca25e3 427 EndFunc();
cpm219 0:2d0ef4830603 428 }
JackB 10:6a81aeca25e3 429
JackB 10:6a81aeca25e3 430 // Retrieves the current matrix coefficients
JackB 10:6a81aeca25e3 431 // FT81x Series Programmers Guide Section 5.46
JackB 10:6a81aeca25e3 432 ft_void_t FT813::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 7:3b4d59de6398 433 {
JackB 10:6a81aeca25e3 434 StartFunc(FT_CMD_SIZE*7);
JackB 10:6a81aeca25e3 435 SendCmd(CMD_GETMATRIX);
JackB 10:6a81aeca25e3 436 SendCmd(a);
JackB 10:6a81aeca25e3 437 SendCmd(b);
JackB 10:6a81aeca25e3 438 SendCmd(c);
JackB 10:6a81aeca25e3 439 SendCmd(d);
JackB 10:6a81aeca25e3 440 SendCmd(e);
JackB 10:6a81aeca25e3 441 SendCmd(f);
JackB 10:6a81aeca25e3 442 EndFunc();
cpm219 7:3b4d59de6398 443 }
cpm219 7:3b4d59de6398 444
JackB 10:6a81aeca25e3 445 // Get the end memory address of data inflated by CMD_INFLATE - Get the last used address from CoPro operation
JackB 10:6a81aeca25e3 446 // FT81x Series Programmers Guide Section 5.47
JackB 10:6a81aeca25e3 447 ft_void_t FT813::GetPtr(ft_uint32_t result)
cpm219 0:2d0ef4830603 448 {
JackB 10:6a81aeca25e3 449 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 450 SendCmd(CMD_GETPTR);
JackB 10:6a81aeca25e3 451 SendCmd(result);
JackB 10:6a81aeca25e3 452 EndFunc();
cpm219 0:2d0ef4830603 453 }
JackB 10:6a81aeca25e3 454
JackB 10:6a81aeca25e3 455 // Get the image properties decompressed by CMD_LOADIMAGE
JackB 10:6a81aeca25e3 456 // FT81x Series Programmers Guide Section 5.48
JackB 10:6a81aeca25e3 457 // Jack
JackB 10:6a81aeca25e3 458 ft_void_t FT813::GetProps(ft_uint32_t ptr, ft_uint32_t w, ft_uint32_t h)
cpm219 0:2d0ef4830603 459 {
JackB 10:6a81aeca25e3 460 StartFunc(FT_CMD_SIZE*4);
JackB 10:6a81aeca25e3 461 SendCmd(CMD_GETPROPS);
JackB 10:6a81aeca25e3 462 SendCmd(ptr);
JackB 10:6a81aeca25e3 463 SendCmd(w);
JackB 10:6a81aeca25e3 464 SendCmd(h);
JackB 10:6a81aeca25e3 465 EndFunc();
cpm219 0:2d0ef4830603 466 }
JackB 10:6a81aeca25e3 467
JackB 10:6a81aeca25e3 468 // Apply a scale to the current matrix
JackB 10:6a81aeca25e3 469 // FT81x Series Programmers Guide Section 5.49
JackB 10:6a81aeca25e3 470 ft_void_t FT813::Scale(ft_int32_t sx, ft_int32_t sy)
cpm219 0:2d0ef4830603 471 {
JackB 10:6a81aeca25e3 472 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 473 SendCmd(CMD_SCALE);
JackB 10:6a81aeca25e3 474 SendCmd(sx);
JackB 10:6a81aeca25e3 475 SendCmd(sy);
JackB 10:6a81aeca25e3 476 EndFunc();
cpm219 0:2d0ef4830603 477 }
JackB 10:6a81aeca25e3 478
JackB 10:6a81aeca25e3 479 // Apply a rotation to the current matrix
JackB 10:6a81aeca25e3 480 // FT81x Series Programmers Guide Section 5.50
JackB 10:6a81aeca25e3 481 ft_void_t FT813::Rotate(ft_int32_t a)
cpm219 0:2d0ef4830603 482 {
JackB 10:6a81aeca25e3 483 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 484 SendCmd(CMD_ROTATE);
JackB 10:6a81aeca25e3 485 SendCmd(a);
JackB 10:6a81aeca25e3 486 EndFunc();
cpm219 0:2d0ef4830603 487 }
cpm219 0:2d0ef4830603 488
JackB 10:6a81aeca25e3 489 // Apply a translation to the current matrix
JackB 10:6a81aeca25e3 490 // FT81x Series Programmers Guide Section 5.51
JackB 10:6a81aeca25e3 491 ft_void_t FT813::Translate(ft_int32_t tx, ft_int32_t ty)
JackB 10:6a81aeca25e3 492 {
JackB 10:6a81aeca25e3 493 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 494 SendCmd(CMD_TRANSLATE);
JackB 10:6a81aeca25e3 495 SendCmd(tx);
JackB 10:6a81aeca25e3 496 SendCmd(ty);
JackB 10:6a81aeca25e3 497 EndFunc();
JackB 10:6a81aeca25e3 498 }
JackB 10:6a81aeca25e3 499
JackB 10:6a81aeca25e3 500 // Execute the touch screen calibration routine
JackB 10:6a81aeca25e3 501 // FT81x Series Programmers Guide Section 5.52
JackB 10:6a81aeca25e3 502 // * This business about "result" in the manual really seems to be simply leftover cruft of no purpose - send zero
JackB 10:6a81aeca25e3 503 ft_void_t FT813::Calibrate(ft_uint32_t result)
cpm219 0:2d0ef4830603 504 {
JackB 10:6a81aeca25e3 505 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 506 SendCmd(CMD_CALIBRATE);
JackB 10:6a81aeca25e3 507 SendCmd(result);
JackB 10:6a81aeca25e3 508 EndFunc();
JackB 10:6a81aeca25e3 509 WaitCmdfifo_empty();
JackB 10:6a81aeca25e3 510 }
JackB 10:6a81aeca25e3 511
JackB 10:6a81aeca25e3 512 // Rotate the screen
JackB 10:6a81aeca25e3 513 // FT81x Series Programmers Guide Section 5.53
JackB 10:6a81aeca25e3 514 ft_void_t FT813::SetRotate(ft_uint32_t r)
JackB 10:6a81aeca25e3 515 {
JackB 10:6a81aeca25e3 516 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 517 SendCmd(CMD_SETROTATE);
JackB 10:6a81aeca25e3 518 SendCmd(r);
JackB 10:6a81aeca25e3 519 EndFunc();
JackB 10:6a81aeca25e3 520 }
JackB 10:6a81aeca25e3 521
JackB 10:6a81aeca25e3 522 // Start an animated spinner
JackB 10:6a81aeca25e3 523 // FT81x Series Programmers Guide Section 5.54
JackB 10:6a81aeca25e3 524 ft_void_t FT813::Spinner(ft_int16_t x, ft_int16_t y, ft_uint16_t style, ft_uint16_t scale)
JackB 10:6a81aeca25e3 525 {
JackB 10:6a81aeca25e3 526 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 527 SendCmd(CMD_SPINNER);
JackB 10:6a81aeca25e3 528 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 529 SendCmd((((ft_uint32_t)scale<<16)|style));
JackB 10:6a81aeca25e3 530 EndFunc();
JackB 10:6a81aeca25e3 531 }
JackB 10:6a81aeca25e3 532
JackB 10:6a81aeca25e3 533 // Start an animated screensaver
JackB 10:6a81aeca25e3 534 // FT81x Series Programmers Guide Section 5.55
JackB 10:6a81aeca25e3 535 ft_void_t FT813::ScreenSaver()
JackB 10:6a81aeca25e3 536 {
JackB 10:6a81aeca25e3 537 StartFunc(FT_CMD_SIZE);
JackB 10:6a81aeca25e3 538 SendCmd(CMD_SCREENSAVER);
JackB 10:6a81aeca25e3 539 EndFunc();
cpm219 0:2d0ef4830603 540 }
cpm219 0:2d0ef4830603 541
JackB 10:6a81aeca25e3 542 // Start a continuous sketch update
JackB 10:6a81aeca25e3 543 // FT81x Series Programmers Guide Section 5.56
JackB 10:6a81aeca25e3 544 ft_void_t FT813::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 545 {
JackB 10:6a81aeca25e3 546 StartFunc(FT_CMD_SIZE*5);
JackB 10:6a81aeca25e3 547 SendCmd(CMD_SKETCH);
JackB 10:6a81aeca25e3 548 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 549 SendCmd((((ft_uint32_t)h<<16)|w));
JackB 10:6a81aeca25e3 550 SendCmd(ptr);
JackB 10:6a81aeca25e3 551 SendCmd(format);
JackB 10:6a81aeca25e3 552 EndFunc();
cpm219 0:2d0ef4830603 553 }
cpm219 0:2d0ef4830603 554
JackB 10:6a81aeca25e3 555 // Stop any of spinner, screensaver or sketch
JackB 10:6a81aeca25e3 556 // FT81x Series Programmers Guide Section 5.57
JackB 10:6a81aeca25e3 557 ft_void_t FT813::Stop()
cpm219 0:2d0ef4830603 558 {
JackB 10:6a81aeca25e3 559 StartFunc(FT_CMD_SIZE);
JackB 10:6a81aeca25e3 560 SendCmd(CMD_STOP);
JackB 10:6a81aeca25e3 561 EndFunc();
cpm219 0:2d0ef4830603 562 }
cpm219 0:2d0ef4830603 563
JackB 10:6a81aeca25e3 564 // Set up a custom font
JackB 10:6a81aeca25e3 565 // FT81x Series Programmers Guide Section 5.58
JackB 10:6a81aeca25e3 566 ft_void_t FT813::SetFont(ft_uint32_t font, ft_uint32_t ptr)
cpm219 0:2d0ef4830603 567 {
JackB 10:6a81aeca25e3 568 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 569 SendCmd(CMD_SETFONT);
JackB 10:6a81aeca25e3 570 SendCmd(font);
JackB 10:6a81aeca25e3 571 SendCmd(ptr);
JackB 10:6a81aeca25e3 572 EndFunc();
cpm219 0:2d0ef4830603 573 }
cpm219 0:2d0ef4830603 574
JackB 10:6a81aeca25e3 575 // Set up a custom font
JackB 10:6a81aeca25e3 576 // FT81x Series Programmers Guide Section 5.59
JackB 10:6a81aeca25e3 577 ft_void_t FT813::SetFont2(ft_uint32_t font, ft_uint32_t ptr, ft_uint32_t firstchar)
cpm219 0:2d0ef4830603 578 {
JackB 10:6a81aeca25e3 579 StartFunc(FT_CMD_SIZE*4);
JackB 10:6a81aeca25e3 580 SendCmd(CMD_SETFONT2);
JackB 10:6a81aeca25e3 581 SendCmd(font);
JackB 10:6a81aeca25e3 582 SendCmd(ptr);
JackB 10:6a81aeca25e3 583 SendCmd(firstchar);
JackB 10:6a81aeca25e3 584 EndFunc();
cpm219 0:2d0ef4830603 585 }
cpm219 0:2d0ef4830603 586
JackB 10:6a81aeca25e3 587 // Set the scratch bitmap for widget use
JackB 10:6a81aeca25e3 588 // FT81x Series Programmers Guide Section 5.60
JackB 10:6a81aeca25e3 589 ft_void_t FT813::SetScratch(ft_uint32_t handle)
cpm219 0:2d0ef4830603 590 {
JackB 10:6a81aeca25e3 591 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 592 SendCmd(CMD_SETSCRATCH);
JackB 10:6a81aeca25e3 593 SendCmd(handle);
JackB 10:6a81aeca25e3 594 EndFunc();
cpm219 0:2d0ef4830603 595 }
cpm219 0:2d0ef4830603 596
JackB 10:6a81aeca25e3 597 // Load a ROM font into bitmap handle
JackB 10:6a81aeca25e3 598 // FT81x Series Programmers Guide Section 5.61
JackB 10:6a81aeca25e3 599 ft_void_t FT813::RomFont(ft_uint32_t rom_slot, ft_uint32_t font)
cpm219 0:2d0ef4830603 600 {
JackB 10:6a81aeca25e3 601 StartFunc(FT_CMD_SIZE*3);
JackB 10:6a81aeca25e3 602 SendCmd(CMD_ROMFONT);
JackB 10:6a81aeca25e3 603 SendCmd(rom_slot);
JackB 10:6a81aeca25e3 604 SendCmd(font);
JackB 10:6a81aeca25e3 605 EndFunc();
cpm219 0:2d0ef4830603 606 }
cpm219 0:2d0ef4830603 607
JackB 10:6a81aeca25e3 608 // Track touches for a graphics object - Make Track (for a slider)
JackB 10:6a81aeca25e3 609 // FT81x Series Programmers Guide Section 5.62
JackB 10:6a81aeca25e3 610 // tag refers to the tag # previously assigned to the object that this track is tracking.
JackB 10:6a81aeca25e3 611 ft_void_t FT813::Track(ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_int16_t tag)
cpm219 0:2d0ef4830603 612 {
JackB 10:6a81aeca25e3 613 StartFunc(FT_CMD_SIZE*4);
JackB 10:6a81aeca25e3 614 SendCmd(CMD_TRACK);
JackB 10:6a81aeca25e3 615 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 616 SendCmd((((ft_uint32_t)h<<16)|w));
JackB 10:6a81aeca25e3 617 SendCmd(tag);
JackB 10:6a81aeca25e3 618 EndFunc();
JackB 10:6a81aeca25e3 619 }
JackB 10:6a81aeca25e3 620
JackB 10:6a81aeca25e3 621 // Take a snapshot of the current screen
JackB 10:6a81aeca25e3 622 // FT81x Series Programmers Guide Section 5.63
JackB 10:6a81aeca25e3 623 ft_void_t FT813::Snapshot(ft_uint32_t ptr)
JackB 10:6a81aeca25e3 624 {
JackB 10:6a81aeca25e3 625 StartFunc(FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 626 SendCmd(CMD_SNAPSHOT);
JackB 10:6a81aeca25e3 627 SendCmd(ptr);
JackB 10:6a81aeca25e3 628 EndFunc();
cpm219 0:2d0ef4830603 629 }
cpm219 0:2d0ef4830603 630
JackB 10:6a81aeca25e3 631 // Take a snapshot of part of the current screen
JackB 10:6a81aeca25e3 632 // FT81x Series Programmers Guide Section 5.64
JackB 10:6a81aeca25e3 633 ft_void_t FT813::Snapshot2(ft_uint32_t fmt, ft_uint32_t ptr, ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h)
cpm219 0:2d0ef4830603 634 {
JackB 10:6a81aeca25e3 635 StartFunc(FT_CMD_SIZE*5);
JackB 10:6a81aeca25e3 636 SendCmd(CMD_SNAPSHOT2);
JackB 10:6a81aeca25e3 637 SendCmd(fmt);
JackB 10:6a81aeca25e3 638 SendCmd(ptr);
JackB 10:6a81aeca25e3 639 SendCmd((((ft_uint32_t)y<<16)|(x & 0xffff)));
JackB 10:6a81aeca25e3 640 SendCmd((((ft_uint32_t)h<<16)|(w & 0xffff)));
JackB 10:6a81aeca25e3 641 EndFunc();
cpm219 0:2d0ef4830603 642 }
cpm219 0:2d0ef4830603 643
JackB 10:6a81aeca25e3 644 // Set up display list for bitmap - Cmd_SetBitmap - generate DL commands for bitmap parms
JackB 10:6a81aeca25e3 645 // FT81x Series Programmers Guide Section 5.65
JackB 10:6a81aeca25e3 646 ft_void_t FT813::SetBitmap(ft_int32_t addr, ft_int16_t fmt, ft_uint16_t width, ft_uint16_t height)
cpm219 0:2d0ef4830603 647 {
JackB 10:6a81aeca25e3 648 StartFunc(FT_CMD_SIZE*4);
JackB 10:6a81aeca25e3 649 SendCmd(CMD_SETBITMAP);
JackB 10:6a81aeca25e3 650 SendCmd(addr);
JackB 10:6a81aeca25e3 651 SendCmd((((ft_uint32_t)width<<16)|(fmt & 0xffff)));
JackB 10:6a81aeca25e3 652 SendCmd((((ft_uint32_t)0<<16)|(height & 0xffff)));
JackB 10:6a81aeca25e3 653 EndFunc();
cpm219 0:2d0ef4830603 654 }
cpm219 0:2d0ef4830603 655
JackB 10:6a81aeca25e3 656 // Play FTDI logo animation
JackB 10:6a81aeca25e3 657 // FT81x Series Programmers Guide Section 5.66
JackB 10:6a81aeca25e3 658 ft_void_t FT813::Logo()
cpm219 0:2d0ef4830603 659 {
JackB 10:6a81aeca25e3 660 StartFunc(FT_CMD_SIZE);
JackB 10:6a81aeca25e3 661 SendCmd(CMD_LOGO);
JackB 10:6a81aeca25e3 662 EndFunc();
cpm219 0:2d0ef4830603 663 }
cpm219 0:2d0ef4830603 664
JackB 10:6a81aeca25e3 665 // ******************** Miscellaneous Operation CoProcessor Command Functions ******************************
JackB 10:6a81aeca25e3 666
JackB 10:6a81aeca25e3 667 // ?
JackB 10:6a81aeca25e3 668 // FT81x Series Programmers Guide Section ?
JackB 10:6a81aeca25e3 669 ft_void_t FT813::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 670 {
JackB 10:6a81aeca25e3 671 StartFunc(FT_CMD_SIZE*6*2+FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 672 SendCmd(CMD_TOUCH_TRANSFORM);
JackB 10:6a81aeca25e3 673 SendCmd(x0);
JackB 10:6a81aeca25e3 674 SendCmd(y0);
JackB 10:6a81aeca25e3 675 SendCmd(x1);
JackB 10:6a81aeca25e3 676 SendCmd(y1);
JackB 10:6a81aeca25e3 677 SendCmd(x2);
JackB 10:6a81aeca25e3 678 SendCmd(y2);
JackB 10:6a81aeca25e3 679 SendCmd(tx0);
JackB 10:6a81aeca25e3 680 SendCmd(ty0);
JackB 10:6a81aeca25e3 681 SendCmd(tx1);
JackB 10:6a81aeca25e3 682 SendCmd(ty1);
JackB 10:6a81aeca25e3 683 SendCmd(tx2);
JackB 10:6a81aeca25e3 684 SendCmd(ty2);
JackB 10:6a81aeca25e3 685 SendCmd(result);
JackB 10:6a81aeca25e3 686 EndFunc();
cpm219 0:2d0ef4830603 687 }
cpm219 0:2d0ef4830603 688
JackB 10:6a81aeca25e3 689 // ?
JackB 10:6a81aeca25e3 690 // FT81x Series Programmers Guide Section ?
JackB 10:6a81aeca25e3 691 ft_void_t FT813::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 692 {
JackB 10:6a81aeca25e3 693 StartFunc(FT_CMD_SIZE*6*2+FT_CMD_SIZE*2);
JackB 10:6a81aeca25e3 694 SendCmd(CMD_BITMAP_TRANSFORM);
JackB 10:6a81aeca25e3 695 SendCmd(x0);
JackB 10:6a81aeca25e3 696 SendCmd(y0);
JackB 10:6a81aeca25e3 697 SendCmd(x1);
JackB 10:6a81aeca25e3 698 SendCmd(y1);
JackB 10:6a81aeca25e3 699 SendCmd(x2);
JackB 10:6a81aeca25e3 700 SendCmd(y2);
JackB 10:6a81aeca25e3 701 SendCmd(tx0);
JackB 10:6a81aeca25e3 702 SendCmd(ty0);
JackB 10:6a81aeca25e3 703 SendCmd(tx1);
JackB 10:6a81aeca25e3 704 SendCmd(ty1);
JackB 10:6a81aeca25e3 705 SendCmd(tx2);
JackB 10:6a81aeca25e3 706 SendCmd(ty2);
JackB 10:6a81aeca25e3 707 SendCmd(result);
JackB 10:6a81aeca25e3 708 EndFunc();
cpm219 0:2d0ef4830603 709 }
cpm219 0:2d0ef4830603 710
JackB 10:6a81aeca25e3 711 ft_void_t FT813::DL(ft_uint32_t cmd)
cpm219 0:2d0ef4830603 712 {
JackB 10:6a81aeca25e3 713 WrCmd32(cmd);
JackB 10:6a81aeca25e3 714 /* Increment the command index */
JackB 10:6a81aeca25e3 715 CmdBuffer_Index += FT_CMD_SIZE;
cpm219 0:2d0ef4830603 716 }
cpm219 0:2d0ef4830603 717
JackB 10:6a81aeca25e3 718 ft_void_t FT813::WrDlCmd_Buffer(ft_uint32_t cmd)
cpm219 0:2d0ef4830603 719 {
JackB 10:6a81aeca25e3 720 Wr32((RAM_DL+DlBuffer_Index), cmd);
JackB 10:6a81aeca25e3 721 /* Increment the command index */
JackB 10:6a81aeca25e3 722 DlBuffer_Index += FT_CMD_SIZE;
cpm219 0:2d0ef4830603 723 }
cpm219 0:2d0ef4830603 724
JackB 10:6a81aeca25e3 725 ft_void_t FT813::Flush_DL_Buffer()
JackB 10:6a81aeca25e3 726 {
JackB 10:6a81aeca25e3 727 DlBuffer_Index = 0;
JackB 10:6a81aeca25e3 728 }
JackB 10:6a81aeca25e3 729
JackB 10:6a81aeca25e3 730 ft_void_t FT813::Flush_Co_Buffer()
JackB 10:6a81aeca25e3 731 {
JackB 10:6a81aeca25e3 732 CmdBuffer_Index = 0;
JackB 10:6a81aeca25e3 733 }
cpm219 0:2d0ef4830603 734
cpm219 0:2d0ef4830603 735 /* API to check the status of previous DLSWAP and perform DLSWAP of new DL */
cpm219 0:2d0ef4830603 736 /* Check for the status of previous DLSWAP and if still not done wait for few ms and check again */
JackB 10:6a81aeca25e3 737 ft_void_t FT813::DLSwap(ft_uint8_t DL_Swap_Type)
cpm219 0:2d0ef4830603 738 {
JackB 10:6a81aeca25e3 739 ft_uint8_t Swap_Type = DLSWAP_FRAME, Swap_Done = DLSWAP_FRAME;
cpm219 0:2d0ef4830603 740
JackB 10:6a81aeca25e3 741 if(DL_Swap_Type == DLSWAP_LINE) {
cpm219 0:2d0ef4830603 742 Swap_Type = DLSWAP_LINE;
cpm219 0:2d0ef4830603 743 }
cpm219 0:2d0ef4830603 744
cpm219 0:2d0ef4830603 745 /* Perform a new DL swap */
JackB 10:6a81aeca25e3 746 Wr8(REG_DLSWAP, Swap_Type);
cpm219 0:2d0ef4830603 747
cpm219 0:2d0ef4830603 748 /* Wait till the swap is done */
JackB 10:6a81aeca25e3 749 while(Swap_Done) {
cpm219 0:2d0ef4830603 750 Swap_Done = Rd8(REG_DLSWAP);
cpm219 0:2d0ef4830603 751
JackB 10:6a81aeca25e3 752 if(DLSWAP_DONE != Swap_Done) {
cpm219 0:2d0ef4830603 753 Sleep(10);//wait for 10ms
cpm219 0:2d0ef4830603 754 }
cpm219 0:2d0ef4830603 755 }
cpm219 0:2d0ef4830603 756 }
cpm219 0:2d0ef4830603 757
cpm219 0:2d0ef4830603 758 /* Nothing beyond this */