FT800 Series Programmer Guide - FTDI

Transcription

FT800 Series Programmer GuideDocument Reference No.: FT 000793Version 2.0Issue Date: 1 July 2014This document is a programmer guide for the FT800 series chip. This guidedetails the chip features and procedures for use. For FT801 specific featuresand procedures, please see the chapter FT801.Product PageDocument Feedback1Copyright 2014 Future Technology Devices International Limited

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#349Table of Content1 Introduction . 111.1Overview . 111.2Scope . 111.3API reference definitions . 112 Programming Model . 132.1General Software architecture . 132.2Display configuration and initialization . 142.2.1Horizontal timing . 152.2.2Vertical timing . 162.2.3Signals updating timing control . 162.2.4Timing example: 480x272 at 60Hz . 172.2.5Initialization Sequence . 182.3Sound Synthesizer . 192.4Audio playback . 192.5Graphics routines . 212.5.1Getting started. 212.5.2Coordinate Plane . 222.5.3Drawing pattern . 232.5.4Writing display lists . 272.5.5Bitmap transformation matrix . 282.5.6Color and transparency . 282.5.7VERTEX2II and VERTEX2F . 292.5.8Screenshot . 312.5.9Performance . 313 Register Description . 333.1Graphics Engine Registers . 33Copyright 2014 Future Technology Devices International Limited2

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#3493.2Touch Engine Registers (FT800 only) . 473.3Audio Engine Registers . 623.4Co-processor Engine Registers. 683.5Miscellaneous Registers . 704 Display list commands. 804.1Graphics State . 804.2Command encoding. 814.3Command groups. 824.3.1Setting Graphics state . 824.3.2Drawing actions . 834.3.3Execution control. 834.4ALPHA FUNC . 844.5BEGIN . 854.6BITMAP HANDLE . 874.7BITMAP LAYOUT . 884.8BITMAP SIZE . 934.9BITMAP SOURCE . 964.10BITMAP TRANSFORM A . 984.11BITMAP TRANSFORM B . 1004.12BITMAP TRANSFORM C . 1014.13BITMAP TRANSFORM D. 1024.14BITMAP TRANSFORM E . 1034.15BITMAP TRANSFORM F . 1054.16BLEND FUNC. 1064.17CALL. 1084.18CELL . 1094.19CLEAR . 1104.20CLEAR COLOR A . 1124.21CLEAR COLOR RGB . 113Copyright 2014 Future Technology Devices International Limited3

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#3494.22CLEAR STENCIL. 1154.23CLEAR TAG . 1164.24COLOR A . 1174.25COLOR MASK . 1184.26COLOR RGB . 1204.27DISPLAY . 1214.28END . 1224.29JUMP . 1234.30LINE WIDTH . 1244.31MACRO . 1254.32POINT SIZE . 1264.33RESTORE CONTEXT . 1274.34RETURN . 1284.35SAVE CONTEXT . 1294.36SCISSOR SIZE . 1304.37SCISSOR XY . 1314.38STENCIL FUNC . 1324.39STENCIL MASK. 1334.40STENCIL OP . 1344.41TAG . 1364.42TAG MASK . 1374.43VERTEX2F . 1384.44VERTEX2II . 1395 Co-Processor Engine commands .1405.1Co-processor handling of Display list commands . 1415.2Synchronization . 1425.3ROM and RAM Fonts . 1425.4Cautions . 1445.5Fault Scenarios . 145Copyright 2014 Future Technology Devices International Limited4

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#3495.6widgets physical dimension . 1455.7widgets color settings . 1455.8Co-processor engine graphics state . 1465.9Definition of parameter OPTION . 1475.10Co-processor engine resources . 1485.11Command groups . 1485.12CMD DLSTART - start a new display list . 1515.13CMD SWAP - swap the current display list . 1525.14CMD COLDSTART - set co-processor engine state to default values 1525.15CMD INTERRUPT - trigger interrupt INT CMDFLAG . 1535.16CMD APPEND - append memory to display list . 1545.17CMD REGREAD - read a register value . 1555.18CMD MEMWRITE - write bytes into memory . 1565.19CMD INFLATE - decompress data into memory . 1575.20CMD LOADIMAGE - load a JPEG image . 1585.21CMD MEMCRC - compute a CRC-32 for memory . 1605.22CMD MEMZERO - write zero to a block of memory . 1615.23CMD MEMSET - fill memory with a byte value . 1625.24CMD MEMCPY - copy a block of memory . 1635.25CMD BUTTON - draw a button . 1645.26CMD CLOCK - draw an analog clock . 1675.27CMD FGCOLOR - set the foreground color . 1725.28CMD BGCOLOR - set the background color . 1735.29CMD GRADCOLOR - set the 3D button highlight color . 1745.30CMD GAUGE - draw a gauge . 1765.31CMD GRADIENT - draw a smooth color gradient . 1835.32CMD KEYS - draw a row of keys . 1865.33CMD PROGRESS - draw a progress bar. 1915.34CMD SCROLLBAR – draw a scroll bar . 194Copyright 2014 Future Technology Devices International Limited5

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#3495.35CMD SLIDER – draw a slider . 1975.36CMD DIAL – draw a rotary dial control . 2005.37CMD TOGGLE – draw a toggle switch . 2035.38CMD TEXT - draw text . 2065.39CMD NUMBER - draw a decimal number . 2105.40CMD SETMATRIX - write the current matrix to the display list . 2135.41CMD GETMATRIX - retrieves the current matrix coefficients . 2135.42CMD GETPTR - get the end memory address of inflated data . 2155.43CMD GETPROPS - get the image properties decompressed byCMD LOADIMAGE . 2165.44CMD SCALE - apply a scale to the current matrix. 2165.45CMD ROTATE - apply a rotation to the current matrix . 2195.46CMD TRANSLATE - apply a translation to the current matrix . 2215.47CMD CALIBRATE - execute the touch screen calibration routine . 2235.48CMD SPINNER - start an animated spinner . 2245.49CMD SCREENSAVER - start an animated screensaver . 2285.50CMD SKETCH - start a continuous sketch update . 2295.51CMD STOP - stop any of spinner, screensaver or sketch . 2315.52CMD SETFONT - set up a custom font . 2325.53CMD TRACK - track touches for a graphics object . 2335.54CMD SNAPSHOT - take a snapshot of the current screen . 2375.55CMD LOGO - play FTDI logo animation . 2376 FT801 operation .2396.1FT801 introduction . 2396.2FT801 touch engine . 2396.3FT801 touch registers . 2396.4Register summary . 2446.5Calibration . 2456.6CMD CSKETCH – Capacitive touch specific sketch . 245Copyright 2014 Future Technology Devices International Limited6

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#349Appendix A – Document References .248Appendix B – Acronyms and Abbreviations .249Appendix C – Memory Map .250Appendix D – Revision History .251Revision History .252List of Code ETSNIPPETSNIPPET1 INITIALIZATION SEQUENCE . 182 SOUND SYNTHESIZER PLAY C8 ON THE XYLOPHONE . 193 SOUND SYNTHESIZER CHECK THE STATUS OF SOUND PLAYING . 194 SOUND SYNTHESIZER STOP PLAYING SOUND . 195 AUDIO PLAYBACK . 206 CHECK THE STATUS OF AUDIO PLAYBACK . 207 STOP THE AUDIO PLAYBACK . 208 GETTING STARTED . 219 DL FUNCTION DEFINITION . 2710 COLOR AND TRANSPARENCY . 2811 NEGATIVE SCREEN COORDINATES EXAMPLE . 3012 SCREENSHOT WITH FULL PIXEL VALUE . 3113 CMD GETPTR COMMAND EXAMPLE . 21514 CMD CALIBRATE EXAMPLE . 22315 CMD SCREENSAVER EXAMPLE . 22816 CMD SKETCH EXAMPLE . 23017 CMD SETFONT EXAMPLE . 23218 CMD SNAPSHOT 160X120–SCREEN . 23719 CMD LOGO COMMAND EXAMPLE . 238List of IGUREFIGUREFIGUREFIGUREFIGURE1: SOFTWARE ARCHITECTURE . 142: HORIZONTAL TIMING . 153: VERTICAL TIMING . 164: PIXEL CLOCKING WITH NO CSPREAD . 165: PIXEL CLOCKING WITH CSPREAD . 167: GETTING START EXAMPLE IMAGE . 216: FT800 GRAPHICS COORDINATES PLANE IN PIXEL PRECISION . 228: THE CONSTANTS OF ALPHA FUNC . 849: PIXEL FORMAT FOR L1/L4/L8 . 9110: PIXEL FORMAT FOR ARGB2/1555 . 9111: PIXEL FORMAT FOR ARGB4, RGB332, RGB565 AND PALETTE . 9212: STENCIL OP CONSTANTS DEFINITION . 134Copyright 2014 Future Technology Devices International Limited7

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#349List of ETABLETABLETABLETABLE1 BITMAP RENDERING PERFORMANCE . 322 REG SWIZZLE AND RGB PINS MAPPING TABLE . 353 GRAPHICS CONTEXT . 804 FT800 GRAPHICS PRIMITIVES LIST . 815 GRAPHICS BITMAP FORMAT TABLE . 826 FT800 GRAPHICS PRIMITIVE OPERATION DEFINITION . 857 BITMAP LAYOUT FORMAT LIST . 888 BLEND FUNC CONSTANT VALUE DEFINITION . 1069 FT800 FONT METRICS BLOCK FORMAT . 14410 WIDGETS COLOR SETUP TABLE . 14511 CO-PROCESSOR ENGINE GRAPHICS STATE . 14612 PARAMETER OPTION DEFINITION . 14713 TOUCH REGISTERS MAP TABLE . 245List of 2930313233REG PCLK DEFINITION . 33REG PCLK POL DEFINITION . 34REG CSPREAD DEFINITION. 34REG SWIZZLE DEFINITION . 35REG DITHER DEFINITION . 35REG OUTBITS DEFINITION . 36REG ROTATE DEFINITION. 37REG VSYNC1 DEFINITION . 37REG VSYNC0 DEFINITION . 38REG VSIZE DEFINITION . 38REG VOFFSET DEFINITION . 39REG VCYCLE DEFINITION . 39REG HSYNC1 DEFINITION . 40REG HSYNC0 DEFINITION . 40REG HSIZE DEFINITION . 41REG HOFFSET DEFINITION . 41REG HCYCLE . 42REG TAP MASK . 42REG TAP CRC DEFINITION . 43REG DLSWAP DEFINITION . 44REG TAG DEFINITION . 45REG TAG Y DEFINITION . 45REG TAG X DEFINITION. 46REG TOUCH DIRECT Z1Z2 DEFINITION . 47REG TOUCH DIRECT XY . 48REG TOUCH TRANSFORM F DEFINITION . 49REG TOUCH TRANSFORM E DEFINITION . 50REG TOUCH TRANSFORM D DEFINITION . 51REG TOUCH TRANSFORM C DEFINITION . 52REG TOUCH TRANSFORM B DEFINITION . 53REG TOUCH TRANSFORM A DEFINITION . 54REG TOUCH TAG DEFINITION . 55REG TOUCH TAG XY DEFINITION . 56Copyright 2014 Future Technology Devices International Limited8

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 818283Clearance No.: FTDI#349REG TOUCH SCREEN XY DEFINITION. 57REG TOUCH RZ DEFINITION . 58REG TOUCH RAW XY DEFINITION . 58REG TOUCH RZTHRESH DEFINITION . 59REG TOUCH OVERSAMPLE DEFINITION . 59REG TOUCH SETTLE DEFINITION . 60REG TOUCH CHARGE DEFINITION . 60REG TOUCH ADC MODE DEFINITION . 61REG TOUCH MODE DEFINITION . 61REG PLAY DEFINITION . 62REG SOUND DEFINITION . 62REG VOL SOUND DEFINITION . 63REG VOL PB DEFINITION . 63REG PLAYBACK PLAY DEFINITION . 64REG PLAYBACK LOOP DEFINITION . 65REG PLAYBACK FORMAT DEFINITION . 65REG PLAYBACK FREQ DEFINITION . 66REG PLAYBACK READPTR DEFINITION . 66REG PLAYBACK LENGTH DEFINITION . 67REG PLAYBACK START DEFINITION. 67REG CMD DL DEFINITION . 68REG CMD WRITE DEFINITION . 68REG CMD READ DEFINITION . 69REG TRACKER DEFINITION . 69REG PWM DUTY DEFINITION . 70REG PWM HZ DEFINITION . 71REG INT MASK DEFINITION . 71REG INT EN DEFINITION . 72REG INT FLAGS DEFINITION . 73REG GPIO DEFINITION . 73REG GPIO DIR DEFINITION . 74REG CPURESET DEFINITION . 74REG SCREENSHOT READ DEFINITION . 75REG SCREENSHOT BUSY DEFINITION. 75REG SCREENSHOT START DEFINITION . 75REG SCREENSHOT Y DEFINITION . 76REG SCREENSHOT EN DEFINITION . 76REG FREQUENCY DEFINITION . 76REG CLOCK DEFINITION. 77REG FRAMES DEFINITION . 78REG ID DEFINITION . 78REG TRIM DEFINITION . 79REG CTOUCH MODE DEFINITION . 239REG CTOUCH EXTENDED DEFINITION . 240REG CTOUCH TOUCH0 XY DEFINITION . 240REG CTOUCH TOUCH1 XY DEFINITION . 241REG CTOUCH TOUCH2 XY DEFINITION . 241REG CTOUCH TOUCH3 XY DEFINITION . 242REG CTOUCH TOUCH4 X DEFINITION . 242REG CTOUCH TOUCH4 Y DEFINITION . 243Copyright 2014 Future Technology Devices International Limited9

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#349Copyright 2014 Future Technology Devices International Limited10

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#3491 IntroductionThis document captures programming details of FT800 series chips including graphicscommands, widget commands and configurations to control FT800 series chips forsmooth and vibrant screen effects.The FT800 series chips are graphics controllers with add-on features such as audioplayback and touch capabilities. They consist of a rich set of graphics objects (primitiveand widgets) that can be used for displaying various menus and screen shots for a rangeof products including home appliances, toys, industrial machinery, home automation,elevators, and many more.1.1 OverviewThis document will be useful to understand the command set and demonstrate the easeof usage in the examples given for each specific instruction. In addition, it also coversvarious power modes, audio, and touch features as well as their usage.Information on pin settings, hardware model and hardware configuration can be found intheFT800 data sheet (DS FT800 Embedded Video Engine) or FT801 datasheet(DS FT801).1.2 ScopeThis document is targeted for software programmers and system designers to developgraphical user interface (GUI) applications on any system processor with either an SPI orI2C master port.1.3 API reference definitionsFunctionality and nomenclature of the APIs used in this document.wr8() – write 8 bits to intended address locationwr16() – write 16 bits to intended address locationwr32() – write 32 bits to intended address locationwr8s() – write 8 bits string to intended address locationrd8() – read 8 bits from intended address locationrd16() – read 16 bits from intended address locationrd32() – read 32 bits from intended address locationrd8s() – read 8 bits string from intended address locationcmd() – write 32 bits command to co-processor engine FIFO RAM CMDcmd *() – Write 32 bits co-processor engine command with its necessary parameters tothe co-processor engine FIFO (RAM CMD).Copyright 2014 Future Technology Devices International Limited11

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#349dl() – Write the specified 32 bits display list command to RAM DL. Refer to section 2.5.4Writing display lists for more information.host command() – send host command to FT800. Refer to the FT800 data sheet formore information.Copyright 2014 Future Technology Devices International Limited12

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: FTDI#3492 Programming ModelThe FT800 appears to the host MCU as a memory-mapped SPI or I2C device. The hostcommunicates with the FT800 using Read or Write to 8MB address space.Within this document, endianness of DL commands, co-processor engine commands,register values read/write, input RGB bitmap data and ADPCM input data are in ‘LittleEndian’ format.2.1 General Software architectureThe software architecture can be broadly classified into layers such as customapplications, graphics/GUI manager, video manger, audio manager, drivers etc. FT800higher level graphics engine commands and co-processor engine widget commands arepart of the graphics/GUI manager. Control & data paths of video and audio are part ofvideo manager and audio manager. Communication between graphics/GUI manager andthe hardware is via the SPI or I2C driver.Typically the display screen shot is constructed by the custom application based on theframework exposed by the graphics/GUI manager.Copyright 2014 Future Technology Devices International Limited13

FT800 Series Programmer GuideVersion 2.0Document Reference No.: FT 000793Clearance No.: GUI managerVideo ManagerAudio ManagerFT800 graphicsobjects &widgets to bepart ofgraphicsmanagerHostsoftwarestackSPI/I2C DriverFT800HardwareFigure 1: Software Architecture2.2 Display configuration and initializationTo configure the display, load the timing control registers with values for the particulardisplay. These registers control horizontal timing: REG PCL

FT800 Series Programmer Guide Version 2.0 Document Reference No.: FT_000793 Clearance No.: FTDI#349