Library for FTDI FT800, Support up to 512 x 512 pixel resolution.

Dependents:   FT800-Demo-Sliders FT800-Clock FT800-Demo-Bitmap

Hardware

https://os.mbed.com/media/uploads/nz/display-43.jpg

Info

Committer:
nz
Date:
Sun Dec 20 23:27:17 2020 +0000
Revision:
4:5bcc69cb157a
Parent:
0:b699e59d925b
Child:
5:b28ce8616b41
add function writeGraphRAM8

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nz 0:b699e59d925b 1 /* mbed Library for FTDI FT800 */
nz 0:b699e59d925b 2
nz 0:b699e59d925b 3 #ifndef FT800_FUNCTIONS_H
nz 0:b699e59d925b 4 #define FT800_FUNCTIONS_H
nz 0:b699e59d925b 5
nz 0:b699e59d925b 6 class FT800
nz 0:b699e59d925b 7 {
nz 0:b699e59d925b 8 public:
nz 0:b699e59d925b 9 FT800(PinName mosi,
nz 0:b699e59d925b 10 PinName miso,
nz 0:b699e59d925b 11 PinName sck,
nz 0:b699e59d925b 12 PinName ss,
nz 0:b699e59d925b 13 PinName intr,
nz 0:b699e59d925b 14 PinName pd);
nz 0:b699e59d925b 15 private:
nz 0:b699e59d925b 16 SPI _spi;
nz 0:b699e59d925b 17 DigitalOut _ss;
nz 0:b699e59d925b 18 DigitalOut _pd;
nz 0:b699e59d925b 19 InterruptIn _f800_isr;
nz 0:b699e59d925b 20
nz 0:b699e59d925b 21 public:
nz 0:b699e59d925b 22 uint16_t CMD_Offset = 0;
nz 0:b699e59d925b 23 //-----------------------------CMD Offset----------------------------------------
nz 0:b699e59d925b 24 void CMD_Offset_Inc(uint8_t command_size);
nz 0:b699e59d925b 25 void set_CMD_Offset(uint16_t offset);
nz 0:b699e59d925b 26 uint16_t get_CMD_Offset(void);
nz 0:b699e59d925b 27 //-------------------------------WRITE-------------------------------------------
nz 0:b699e59d925b 28 void WriteAddress(uint32_t addr, uint8_t mode);
nz 0:b699e59d925b 29 void Write08(uint32_t addr, uint8_t data);
nz 0:b699e59d925b 30 void Write16(uint32_t addr, uint16_t data);
nz 0:b699e59d925b 31 void Write32(uint32_t addr, uint32_t data);
nz 0:b699e59d925b 32 //--------------------------------READ-------------------------------------------
nz 0:b699e59d925b 33 uint8_t Read08(uint32_t addr);
nz 0:b699e59d925b 34 uint16_t Read16(uint32_t addr);
nz 0:b699e59d925b 35 uint32_t Read32(uint32_t addr);
nz 0:b699e59d925b 36 //----------------------------CONFIGURATION--------------------------------------
nz 0:b699e59d925b 37 void HostCommand(uint8_t cmd);
nz 0:b699e59d925b 38 //---------------------------------MEM-------------------------------------------
nz 0:b699e59d925b 39 //void FT800_writeMemZero(uint32_t pointer, uint32_t number);
nz 0:b699e59d925b 40 //void FT800_writeMemSet(uint32_t pointer, uint32_t value, uint32_t number);
nz 0:b699e59d925b 41 //void FT800_writeMemCpy(uint32_t source, uint32_t destination);
nz 0:b699e59d925b 42 //--------------------------------INIT-------------------------------------------
nz 0:b699e59d925b 43 void Init();
nz 0:b699e59d925b 44 void Sleep(uint16_t ms);
nz 0:b699e59d925b 45 void setBacklight(uint8_t brightnes);
nz 0:b699e59d925b 46 void setGPU_Frequency(uint8_t freq); // 36=GPU_PLL_36M, 48=GPU_PLL_48M MHz
nz 0:b699e59d925b 47 void clearIntFlags(void);
nz 0:b699e59d925b 48
nz 0:b699e59d925b 49 void DLstart(void);
nz 0:b699e59d925b 50 void DLstart(uint32_t color);
nz 0:b699e59d925b 51 void DLstart(uint32_t color, uint8_t br);
nz 0:b699e59d925b 52 void DLend(void);
nz 0:b699e59d925b 53 void clear(uint8_t clr);
nz 0:b699e59d925b 54 void finishList(void);
nz 0:b699e59d925b 55 //void executeCommands(void);
nz 0:b699e59d925b 56 //-----------------------------GRAPHICS STATE------------------------------------
nz 0:b699e59d925b 57 void setColor(uint32_t color); // color 0xRRGGBB, default White (0xFFFFFF)
nz 0:b699e59d925b 58 void setColorA(uint8_t alpha); // alpha [0-255], default 255, transparency off
nz 0:b699e59d925b 59 void setClearColor(uint32_t color); // color 0xRRGGBB, default Black (0x000000)
nz 0:b699e59d925b 60 void setClearColorA(uint8_t alpha); // alpha [0-255], default 0
nz 0:b699e59d925b 61 void setLineWidth(uint16_t width); // width [1-255], default 1
nz 0:b699e59d925b 62 void setPointSize(uint16_t size); // size [1-512], default 1
nz 0:b699e59d925b 63 void setScissorSize(uint16_t width, uint16_t height); // w & h [0-512], default (512,512)
nz 0:b699e59d925b 64 void setScissorXY(int16_t x, int16_t y); // x & y [-512-+511], default (0,0)
nz 0:b699e59d925b 65 void setBlendFunc(uint8_t src, uint8_t dst);// src & dst [0-7]
nz 0:b699e59d925b 66 void align(uint8_t n);
nz 0:b699e59d925b 67 //----------------------CO-PROCESSOR ENGINE GRAPHICS STATE-----------------------
nz 0:b699e59d925b 68 void setFgColor(uint32_t color); // Foreground, default light blue (0x003870)
nz 0:b699e59d925b 69 void setBgColor(uint32_t color); // Background, default dark blue (0x002040)
nz 0:b699e59d925b 70 void setGrColor(uint32_t color); // Gradient, default white (0xFFFFFF)
nz 0:b699e59d925b 71 //---------------------------DRAWING BASE FUNCTIONS------------------------------
nz 0:b699e59d925b 72 void beginBitmap(); void drawBitmapXY(int16_t x, int16_t y);
nz 0:b699e59d925b 73 void beginPoint(); void drawPointXY(int16_t x, int16_t y);
nz 0:b699e59d925b 74 void beginLine(); void drawLineXY(int16_t x1, int16_t y1, int16_t x2, int16_t y2);
nz 0:b699e59d925b 75 void beginRect();
nz 0:b699e59d925b 76 void beginLineStrip();
nz 0:b699e59d925b 77 void Vertex2F(int16_t x, int16_t y); // x & y [-1024-+1023]
nz 0:b699e59d925b 78 void Vertex2II(uint16_t x, uint16_t y, uint8_t handle, uint8_t cell); // x & y [0-511]
nz 0:b699e59d925b 79 void end(); // End drawing a graphics primitive.
nz 0:b699e59d925b 80 //------------------------DRAWING GRAPHICS PRIMITIVE-----------------------------
nz 0:b699e59d925b 81 void drawPoint(int16_t x, int16_t y, uint32_t color, uint16_t radius);
nz 0:b699e59d925b 82 void drawLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t color, uint16_t width);
nz 0:b699e59d925b 83 void drawRect(int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t color, uint16_t width);
nz 0:b699e59d925b 84 void drawLineStrips(int16_t x[], int16_t y[], uint16_t num_of_points, uint16_t width, uint32_t color);
nz 0:b699e59d925b 85 void drawEdgeStrips(int16_t x[], int16_t y[], uint16_t num_of_points, uint8_t choice, uint32_t color);
nz 0:b699e59d925b 86 //---------------------------------DRAW TEXT-------------------------------------
nz 0:b699e59d925b 87 void drawChar(uint16_t x, uint16_t y, uint8_t font, uint32_t color, char c);
nz 0:b699e59d925b 88 void drawString(const char *s);
nz 0:b699e59d925b 89 void drawText (int16_t x, int16_t y, uint8_t font, uint32_t color, uint16_t option, const char *s);
nz 0:b699e59d925b 90 void drawNumber(int16_t x, int16_t y, uint8_t font, uint32_t color, uint16_t option, uint32_t n);
nz 0:b699e59d925b 91 //----------------------------DRAW GRAPHICS OBJECTS------------------------------
nz 0:b699e59d925b 92 void drawButton(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t option, uint32_t colorBG, uint32_t colorTXT, uint8_t font, const char*s, uint8_t tag);
nz 0:b699e59d925b 93 void drawClock(int16_t x, int16_t y, uint16_t r, uint16_t option, uint32_t colorBG, uint32_t colorNeedle, uint16_t h, uint16_t m, uint16_t s, uint16_t ms, uint8_t tag);
nz 0:b699e59d925b 94 void drawDial (int16_t x, int16_t y, uint16_t r, uint16_t option, uint32_t colorMarker, uint32_t colorKnob, uint16_t value, uint8_t tag);
nz 0:b699e59d925b 95 void drawGauge(int16_t x, int16_t y, uint16_t r, uint16_t option, uint32_t colorBCG, uint32_t colorNeedle, uint8_t major, uint8_t minor, uint16_t value, uint16_t range, uint8_t tag);
nz 0:b699e59d925b 96 void drawGradient(int16_t x0, int16_t y0, uint32_t color0, int16_t x1, int16_t y1, uint32_t color1);
nz 0:b699e59d925b 97 void drawKeys(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t option, uint32_t colorBG, uint32_t colorTXT, uint8_t font, const char *s, uint8_t tag);
nz 0:b699e59d925b 98 void drawScrollBar(int16_t x, int16_t y, uint16_t w, uint16_t h, uint32_t colorBG, uint32_t colorSCR, uint16_t option, uint16_t value, uint16_t size, uint16_t range, uint8_t tag);
nz 0:b699e59d925b 99 void drawToggle(int16_t x, int16_t y, uint16_t w, uint8_t font, uint16_t option, uint32_t colorKnob, uint32_t colorBCG, uint32_t colorTXT, uint16_t state, const char *s, uint8_t tag);
nz 0:b699e59d925b 100 void drawSlider(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t option, uint32_t colorR, uint32_t colorKnob, uint32_t colorL, uint16_t value, uint16_t range, uint8_t tag);
nz 0:b699e59d925b 101 void drawProgress(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t option, uint32_t colorBCG, uint32_t colorPRO, uint16_t value, uint16_t range, uint8_t tag);
nz 0:b699e59d925b 102 //----------------------------------TAG------------------------------------------
nz 0:b699e59d925b 103 void track(int16_t x, int16_t y, uint16_t w, uint16_t h, uint8_t tag);
nz 0:b699e59d925b 104 void tagMask(uint8_t mask);
nz 0:b699e59d925b 105 uint8_t readTag(void);
nz 0:b699e59d925b 106 uint16_t readValue(void);
nz 0:b699e59d925b 107 //----------------------------------ANIM-----------------------------------------
nz 0:b699e59d925b 108 void runTouchCalibration(void);
nz 0:b699e59d925b 109 void drawAnimSpinner(int16_t x, int16_t y, uint8_t style, uint8_t scale);
nz 0:b699e59d925b 110 void drawLogo(void);
nz 0:b699e59d925b 111 void waitLogo(void);
nz 0:b699e59d925b 112 void drawScreensaver(void);
nz 0:b699e59d925b 113 void drawSketch(int16_t x, int16_t y, uint16_t w, uint16_t h, uint32_t pointer, uint16_t format);
nz 0:b699e59d925b 114 void macro(uint8_t m);
nz 0:b699e59d925b 115 void stop(void);
nz 0:b699e59d925b 116 //---------------------------------BITMAP----------------------------------------
nz 0:b699e59d925b 117 void bitmapHandle(uint8_t handle); // default 0
nz 0:b699e59d925b 118 void bitmapSource(uint32_t add); //
nz 0:b699e59d925b 119 void bitmapLayout(uint8_t format, int16_t linestride, int16_t heigth);
nz 0:b699e59d925b 120 void bitmapSize(uint8_t filter, uint8_t wrapx, uint8_t wrapy, int16_t width, int16_t heigth);
nz 0:b699e59d925b 121 void bitmapTransformA(int32_t value);
nz 0:b699e59d925b 122 void bitmapTransformB(int32_t value);
nz 0:b699e59d925b 123 void bitmapTransformC(int32_t value);
nz 0:b699e59d925b 124 void bitmapTransformD(int32_t value);
nz 0:b699e59d925b 125 void bitmapTransformE(int32_t value);
nz 0:b699e59d925b 126 void bitmapTransformF(int32_t value);
nz 0:b699e59d925b 127 void loadIdentity(void);
nz 0:b699e59d925b 128 void setMatrix(void);
nz 0:b699e59d925b 129 void scale(int16_t sx, int16_t sy);
nz 0:b699e59d925b 130 void translate(int16_t tx, int16_t ty);
nz 0:b699e59d925b 131 void rotate(int16_t a);
nz 0:b699e59d925b 132 void loadJpgCMD(uint32_t ptr, uint32_t opt);
nz 0:b699e59d925b 133 //---------------------------------TEST------------------------------------------
nz 4:5bcc69cb157a 134 void writeGraphRAM8 (uint32_t addr, const uint8_t data[], uint16_t lng);
nz 0:b699e59d925b 135 void writeGraphRAM16(uint32_t addr, const uint16_t data[], uint16_t lng);
nz 0:b699e59d925b 136 void drawChar16(int16_t x, int16_t y, const uint16_t font[], uint16_t n);
nz 0:b699e59d925b 137 void drawChar16(int16_t x, int16_t y, uint32_t color, int16_t scl, uint16_t n);
nz 0:b699e59d925b 138 }; // end of class
nz 0:b699e59d925b 139
nz 0:b699e59d925b 140 #endif /* FT800_FUNCTIONS_H */