808

Dependents:   Chromatograph_Mobile

Revision:
10:6a81aeca25e3
Parent:
0:2d0ef4830603
--- a/inc/FT_Gpu.h	Thu Dec 22 20:19:22 2016 +0000
+++ b/inc/FT_Gpu.h	Mon Jul 23 12:22:23 2018 +0000
@@ -16,14 +16,328 @@
 #define RAM_G_SIZE          1024*1024L
 #define FT81X_VERSION "1.0.4"
 
+#define DL_CLEAR        0x26000000UL /* requires OR'd arguments */
+#define DL_CLEAR_RGB    0x02000000UL /* requires OR'd arguments */
+#define DL_COLOR_RGB    0x04000000UL /* requires OR'd arguments */
+#define DL_POINT_SIZE   0x0D000000UL /* requires OR'd arguments */
+#define DL_END          0x21000000UL
+#define DL_BEGIN        0x1F000000UL /* requires OR'd arguments */
+#define DL_DISPLAY      0x00000000UL
+
+#define CLR_COL              0x4
+#define CLR_STN              0x2
+#define CLR_TAG              0x1
+
+/* Host commands */
+#define FT8_ACTIVE  0x00  /* place FT8xx in active state */
+#define FT8_STANDBY 0x41  /* place FT8xx in Standby (clk running) */
+#define FT8_SLEEP   0x42  /* place FT8xx in Sleep (clk off) */
+#define FT8_PWRDOWN 0x50  /* place FT8xx in Power Down (core off) */
+#define FT8_CLKEXT  0x44  /* select external clock source */
+#define FT8_CLKINT  0x48  /* select internal clock source */
+#define FT8_CORERST 0x68  /* reset core - all registers default and processors reset */
+#define FT8_CLK48M  0x62  /* select 48MHz PLL output */
+#define FT8_CLK36M  0x61  /* select 36MHz PLL output */
+
+
+/* defines used for graphics commands */
+#define FT8_NEVER                0UL
+#define FT8_LESS                 1UL
+#define FT8_LEQUAL               2UL
+#define FT8_GREATER              3UL
+#define FT8_GEQUAL               4UL
+#define FT8_EQUAL                5UL
+#define FT8_NOTEQUAL             6UL
+#define FT8_ALWAYS               7UL
+
+
+/* Bitmap formats */
+#define FT8_ARGB1555             0UL
+#define FT8_L1                   1UL
+#define FT8_L4                   2UL
+#define FT8_L8                   3UL
+#define FT8_RGB332               4UL
+#define FT8_ARGB2                5UL
+#define FT8_ARGB4                6UL
+#define FT8_RGB565               7UL
+#define FT8_PALETTED             8UL
+#define FT8_TEXT8X8              9UL
+#define FT8_TEXTVGA              10UL
+#define FT8_BARGRAPH             11UL
+
+
+/* Bitmap filter types */
+#define FT8_NEAREST              0UL
+#define FT8_BILINEAR             1UL
+
+
+/* Bitmap wrap types */
+#define FT8_BORDER               0UL
+#define FT8_REPEAT               1UL
+
+
+/* Stencil defines */
+#define FT8_KEEP                 1UL
+#define FT8_REPLACE              2UL
+#define FT8_INCR                 3UL
+#define FT8_DECR                 4UL
+#define FT8_INVERT               5UL
+
+
+/* Graphics display list swap defines */
+#define FT8_DLSWAP_DONE          0UL
+#define FT8_DLSWAP_LINE          1UL
+#define FT8_DLSWAP_FRAME         2UL
+
+
+/* Interrupt bits */
+#define FT8_INT_SWAP             0x01
+#define FT8_INT_TOUCH            0x02
+#define FT8_INT_TAG              0x04
+#define FT8_INT_SOUND            0x08
+#define FT8_INT_PLAYBACK         0x10
+#define FT8_INT_CMDEMPTY         0x20
+#define FT8_INT_CMDFLAG          0x40
+#define FT8_INT_CONVCOMPLETE     0x80
+
+
+/* Touch mode */
+#define FT8_TMODE_OFF           0
+#define FT8_TMODE_ONESHOT       1
+#define FT8_TMODE_FRAME         2
+#define FT8_TMODE_CONTINUOUS    3
+
+
+/* Alpha blending */
+#define FT8_ZERO                 0UL
+#define FT8_ONE                  1UL
+#define FT8_SRC_ALPHA            2UL
+#define FT8_DST_ALPHA            3UL
+#define FT8_ONE_MINUS_SRC_ALPHA  4UL
+#define FT8_ONE_MINUS_DST_ALPHA  5UL
+
+
+/* Graphics primitives */
+#define FT8_BITMAPS              1UL
+#define FT8_POINTS               2UL
+#define FT8_LINES                3UL
+#define FT8_LINE_STRIP           4UL
+#define FT8_EDGE_STRIP_R         5UL
+#define FT8_EDGE_STRIP_L         6UL
+#define FT8_EDGE_STRIP_A         7UL
+#define FT8_EDGE_STRIP_B         8UL
+#define FT8_RECTS                9UL
+
+
+/* Widget command */
+#define FT8_OPT_MONO             1
+#define FT8_OPT_NODL             2
+#define FT8_OPT_FLAT             256
+#define FT8_OPT_CENTERX          512
+#define FT8_OPT_CENTERY          1024
+#define FT8_OPT_CENTER           (FT8_OPT_CENTERX | FT8_OPT_CENTERY)
+#define FT8_OPT_NOBACK           4096
+#define FT8_OPT_NOTICKS          8192
+#define FT8_OPT_NOHM             16384
+#define FT8_OPT_NOPOINTER        16384
+#define FT8_OPT_NOSECS           32768
+#define FT8_OPT_NOHANDS          49152
+#define FT8_OPT_RIGHTX           2048
+#define FT8_OPT_SIGNED           256
+
+
+/* Defines related to inbuilt font */
+#define FT8_NUMCHAR_PERFONT         (128L)  /* number of font characters per bitmap handle */
+#define FT8_FONT_TABLE_SIZE         (148L)  /* size of the font table - utilized for loopup by the graphics engine */
+#define FT8_FONT_TABLE_POINTER  (0xFFFFCUL) /* pointer to the inbuilt font tables starting from bitmap handle 16 */
+
+
+/* Audio sample type defines */
+#define FT8_LINEAR_SAMPLES       0UL    /* 8bit signed samples */
+#define FT8_ULAW_SAMPLES         1UL    /* 8bit ulaw samples */
+#define FT8_ADPCM_SAMPLES        2UL    /* 4bit ima adpcm samples */
+
+
+/* Synthesized sound */
+#define FT8_SILENCE              0x00
+#define FT8_SQUAREWAVE           0x01
+#define FT8_SINEWAVE             0x02
+#define FT8_SAWTOOTH             0x03
+#define FT8_TRIANGLE             0x04
+#define FT8_BEEPING              0x05
+#define FT8_ALARM                0x06
+#define FT8_WARBLE               0x07
+#define FT8_CAROUSEL             0x08
+#define FT8_PIPS(n)              (0x0F + (n))
+#define FT8_HARP                 0x40
+#define FT8_XYLOPHONE            0x41
+#define FT8_TUBA                 0x42
+#define FT8_GLOCKENSPIEL         0x43
+#define FT8_ORGAN                0x44
+#define FT8_TRUMPET              0x45
+#define FT8_PIANO                0x46
+#define FT8_CHIMES               0x47
+#define FT8_MUSICBOX             0x48
+#define FT8_BELL                 0x49
+#define FT8_CLICK                0x50
+#define FT8_SWITCH               0x51
+#define FT8_COWBELL              0x52
+#define FT8_NOTCH                0x53
+#define FT8_HIHAT                0x54
+#define FT8_KICKDRUM             0x55
+#define FT8_POP                  0x56
+#define FT8_CLACK                0x57
+#define FT8_CHACK                0x58
+#define FT8_MUTE                 0x60
+#define FT8_UNMUTE               0x61
+
+
+/* Synthesized sound frequencies, midi note */
+#define FT8_MIDI_A0   21
+#define FT8_MIDI_A_0  22
+#define FT8_MIDI_B0   23
+#define FT8_MIDI_C1   24
+#define FT8_MIDI_C_1  25
+#define FT8_MIDI_D1   26
+#define FT8_MIDI_D_1  27
+#define FT8_MIDI_E1   28
+#define FT8_MIDI_F1   29
+#define FT8_MIDI_F_1  30
+#define FT8_MIDI_G1   31
+#define FT8_MIDI_G_1  32
+#define FT8_MIDI_A1   33
+#define FT8_MIDI_A_1  34
+#define FT8_MIDI_B1   35
+#define FT8_MIDI_C2   36
+#define FT8_MIDI_C_2  37
+#define FT8_MIDI_D2   38
+#define FT8_MIDI_D_2  39
+#define FT8_MIDI_E2   40
+#define FT8_MIDI_F2   41
+#define FT8_MIDI_F_2  42
+#define FT8_MIDI_G2   43
+#define FT8_MIDI_G_2  44
+#define FT8_MIDI_A2   45
+#define FT8_MIDI_A_2  46
+#define FT8_MIDI_B2   47
+#define FT8_MIDI_C3   48
+#define FT8_MIDI_C_3  49
+#define FT8_MIDI_D3   50
+#define FT8_MIDI_D_3  51
+#define FT8_MIDI_E3   52
+#define FT8_MIDI_F3   53
+#define FT8_MIDI_F_3  54
+#define FT8_MIDI_G3   55
+#define FT8_MIDI_G_3  56
+#define FT8_MIDI_A3   57
+#define FT8_MIDI_A_3  58
+#define FT8_MIDI_B3   59
+#define FT8_MIDI_C4   60
+#define FT8_MIDI_C_4  61
+#define FT8_MIDI_D4   62
+#define FT8_MIDI_D_4  63
+#define FT8_MIDI_E4   64
+#define FT8_MIDI_F4   65
+#define FT8_MIDI_F_4  66
+#define FT8_MIDI_G4   67
+#define FT8_MIDI_G_4  68
+#define FT8_MIDI_A4   69
+#define FT8_MIDI_A_4  70
+#define FT8_MIDI_B4   71
+#define FT8_MIDI_C5   72
+#define FT8_MIDI_C_5  73
+#define FT8_MIDI_D5   74
+#define FT8_MIDI_D_5  75
+#define FT8_MIDI_E5   76
+#define FT8_MIDI_F5   77
+#define FT8_MIDI_F_5  78
+#define FT8_MIDI_G5   79
+#define FT8_MIDI_G_5  80
+#define FT8_MIDI_A5   81
+#define FT8_MIDI_A_5  82
+#define FT8_MIDI_B5   83
+#define FT8_MIDI_C6   84
+#define FT8_MIDI_C_6  85
+#define FT8_MIDI_D6   86
+#define FT8_MIDI_D_6  87
+#define FT8_MIDI_E6   88
+#define FT8_MIDI_F6   89
+#define FT8_MIDI_F_6  90
+#define FT8_MIDI_G6   91
+#define FT8_MIDI_G_6  92
+#define FT8_MIDI_A6   93
+#define FT8_MIDI_A_6  94
+#define FT8_MIDI_B6   95
+#define FT8_MIDI_C7   96
+#define FT8_MIDI_C_7  97
+#define FT8_MIDI_D7   98
+#define FT8_MIDI_D_7  99
+#define FT8_MIDI_E7   100
+#define FT8_MIDI_F7   101
+#define FT8_MIDI_F_7  102
+#define FT8_MIDI_G7   103
+#define FT8_MIDI_G_7  104
+#define FT8_MIDI_A7   105
+#define FT8_MIDI_A_7  106
+#define FT8_MIDI_B7   107
+#define FT8_MIDI_C8   108
+
+
+/* GPIO bits */
+#define FT8_GPIO0   0
+#define FT8_GPIO1   1   /* default gpio pin for audio shutdown, 1 - eanble, 0 - disable */
+#define FT8_GPIO7   7   /* default gpio pin for display enable, 1 - enable, 0 - disable */
+
+
+/* Display rotation */
+#define FT8_DISPLAY_0       0   /* 0 degrees rotation */
+#define FT8_DISPLAY_180     1   /* 180 degrees rotation */
+#define FT8_DISPLAY_90      1   /* 90 degrees rotation */
+#define FT8_DISPLAY_270     1   /* 270 degrees rotation */
+
+#define FT8_DISPLAY_LANDSCAPE_0     0   /* 0 degrees rotation */
+#define FT8_DISPLAY_LANDSCAPE_180   1   /* 180 degrees rotation */
+#define FT8_DISPLAY_PORTRAIT_90CCW  2   /* 270 degrees rotation */
+#define FT8_DISPLAY_PORTRAIT_90CW   3   /* 90 degrees rotation */
+
+
+//  0 ARGB1555
+//  1 L1
+//  2 L4
+//  3 L8
+//  4 RGB332
+//  5 ARGB2
+//  6 ARGB4
+//  7 RGB565
+//  8 PALETTED
+//  9 TEXT8X8
+// 10 TEXTVGA
+// 11 BARGRAPH
+// 14 PALETTED565
+// 15 PALETTED4444
+// 16 PALETTED8
+// 17 L2
+
+    // 0 OPT_RGB565
+    // 1 OPT_MONO
+    // 2 OPT_NODL
+    // 256 OPT_FLAT
+    // 256 OPT_SIGNED
+    // 512 OPT_CENTERX
+    // 1024 OPT_CENTERY
+    // 1536 OPT_CENTER
+    // 2048 OPT_RIGHTX
+    // 4096 OPT_NOBACK
+    // 8192 OPT_NOTICKS
+
 #define ADC_DIFFERENTIAL     1UL
 #define ADC_SINGLE_ENDED     0UL
 #define ADPCM_SAMPLES        2UL
 #define ALWAYS               7UL
-#define ARGB1555             0UL
-#define ARGB2                5UL
-#define ARGB4                6UL
-#define BARGRAPH             11UL
+#define ARGB1555             0UL        // ARGB1555, L1, L4, L8, RGB332, ARGB2, ARGB4, RGB565, PALETTED, TEXT8X8, TEXTVGA, BARGRAPH, PALETTED565, PALETTED4444, PALETTED8, L2
+#define ARGB2                5UL        // ARGB1555, L1, L4, L8, RGB332, ARGB2, ARGB4, RGB565, PALETTED, TEXT8X8, TEXTVGA, BARGRAPH, PALETTED565, PALETTED4444, PALETTED8, L2
+#define ARGB4                6UL        // ARGB1555, L1, L4, L8, RGB332, ARGB2, ARGB4, RGB565, PALETTED, TEXT8X8, TEXTVGA, BARGRAPH, PALETTED565, PALETTED4444, PALETTED8, L2
+#define BARGRAPH             11UL       // ARGB1555, L1, L4, L8, RGB332, ARGB2, ARGB4, RGB565, PALETTED, TEXT8X8, TEXTVGA, BARGRAPH, PALETTED565, PALETTED4444, PALETTED8, L2
 #define BILINEAR             1UL
 #define BITMAPS              1UL
 #define BORDER               0UL
@@ -122,10 +436,10 @@
 #define INT_VGA              13UL
 #define INVERT               5UL
 #define KEEP                 1UL
-#define L1                   1UL
-#define L2                   17UL
-#define L4                   2UL
-#define L8                   3UL
+#define L1                   1UL        // ARGB1555, L1, L4, L8, RGB332, ARGB2, ARGB4, RGB565, PALETTED, TEXT8X8, TEXTVGA, BARGRAPH, PALETTED565, PALETTED4444, PALETTED8, L2
+#define L2                   17UL       // ARGB1555, L1, L4, L8, RGB332, ARGB2, ARGB4, RGB565, PALETTED, TEXT8X8, TEXTVGA, BARGRAPH, PALETTED565, PALETTED4444, PALETTED8, L2
+#define L4                   2UL        // ARGB1555, L1, L4, L8, RGB332, ARGB2, ARGB4, RGB565, PALETTED, TEXT8X8, TEXTVGA, BARGRAPH, PALETTED565, PALETTED4444, PALETTED8, L2
+#define L8                   3UL        // ARGB1555, L1, L4, L8, RGB332, ARGB2, ARGB4, RGB565, PALETTED, TEXT8X8, TEXTVGA, BARGRAPH, PALETTED565, PALETTED4444, PALETTED8, L2
 #define LEQUAL               2UL
 #define LESS                 1UL
 #define LINEAR_SAMPLES       0UL
@@ -143,6 +457,7 @@
 #define OPT_FLAT             256UL
 #define OPT_FULLSCREEN       8UL
 #define OPT_MEDIAFIFO        16UL
+#define OPT_RGB565           0UL
 #define OPT_MONO             1UL
 #define OPT_NOBACK           4096UL
 #define OPT_NODL             2UL
@@ -155,16 +470,18 @@
 #define OPT_RIGHTX           2048UL
 #define OPT_SIGNED           256UL
 #define OPT_SOUND            32UL
-#define PALETTED             8UL
-#define PALETTED4444         15UL
-#define PALETTED565          14UL
-#define PALETTED8            16UL
+#define PALETTED             8UL        // 0 ARGB1555, 1 L1, 2 L4, 3 L8, 4 RGB332, 5 ARGB2, 6 ARGB4, 7 RGB565, 8 PALETTED, 9 TEXT8X8, 10 TEXTVGA, 11 BARGRAPH
+#define PALETTED4444         15UL       // 0 ARGB1555, 1 L1, 2 L4, 3 L8, 4 RGB332, 5 ARGB2, 6 ARGB4, 7 RGB565, 8 PALETTED, 9 TEXT8X8, 10 TEXTVGA, 11 BARGRAPH
+#define PALETTED565          14UL       // 0 ARGB1555, 1 L1, 2 L4, 3 L8, 4 RGB332, 5 ARGB2, 6 ARGB4, 7 RGB565, 8 PALETTED, 9 TEXT8X8, 10 TEXTVGA, 11 BARGRAPH
+#define PALETTED8            16UL       // 0 ARGB1555, 1 L1, 2 L4, 3 L8, 4 RGB332, 5 ARGB2, 6 ARGB4, 7 RGB565, 8 PALETTED, 9 TEXT8X8, 10 TEXTVGA, 11 BARGRAPH
+#define POINTS               2UL
 #define FTPOINTS             2UL
-#define RAM_CMD              3178496UL
-#define RAM_DL               3145728UL
+#define RAM_CMD              3178496UL  // 0x30 8000
+#define RAM_DL               3145728UL  // 0x30 0000
 #define RAM_G                0UL
-#define RAM_REG              3153920UL
-#define RAM_ROMSUB           3186688UL
+#define RAM_REG              3153920UL  // 0x30 2000
+#define RAM_ROMSUB           3186688UL  // 0x30 A000
+#define RAM_SCREENSHOT       3940352UL  // 0x3C 2000 (not documented!)
 #define RECTS                9UL
 
 #define ROMFONT_TABLEADDRESS 3145724UL
@@ -284,13 +601,16 @@
 #define REG_VSIZE            3153992UL
 #define REG_VSYNC0           3153996UL
 #define REG_VSYNC1           3154000UL
+
+#define REG_TOUCH_CONFIG     3154280UL   // Jack
+#define VAL_TOUCH_CONFIG     0x0381
 #define REPEAT               1UL
 #define REPLACE              2UL
-#define RGB332               4UL
-#define RGB565               7UL
+#define RGB332               4UL        // 0 ARGB1555, 1 L1, 2 L4, 3 L8, 4 RGB332, 5 ARGB2, 6 ARGB4, 7 RGB565, 8 PALETTED, 9 TEXT8X8, 10 TEXTVGA, 11 BARGRAPH
+#define RGB565               7UL        // 0 ARGB1555, 1 L1, 2 L4, 3 L8, 4 RGB332, 5 ARGB2, 6 ARGB4, 7 RGB565, 8 PALETTED, 9 TEXT8X8, 10 TEXTVGA, 11 BARGRAPH
 #define SRC_ALPHA            2UL
-#define TEXT8X8              9UL
-#define TEXTVGA              10UL
+#define TEXT8X8              9UL        // 0 ARGB1555, 1 L1, 2 L4, 3 L8, 4 RGB332, 5 ARGB2, 6 ARGB4, 7 RGB565, 8 PALETTED, 9 TEXT8X8, 10 TEXTVGA, 11 BARGRAPH
+#define TEXTVGA              10UL       // 0 ARGB1555, 1 L1, 2 L4, 3 L8, 4 RGB332, 5 ARGB2, 6 ARGB4, 7 RGB565, 8 PALETTED, 9 TEXT8X8, 10 TEXTVGA, 11 BARGRAPH
 #define TOUCHMODE_CONTINUOUS 3UL
 #define TOUCHMODE_FRAME      2UL
 #define TOUCHMODE_OFF        0UL
@@ -306,7 +626,9 @@
 #define BITMAP_HANDLE(handle) ((5UL<<24)|(((handle)&31UL)<<0))
 #define CELL(cell) ((6UL<<24)|(((cell)&127UL)<<0))
 #define BITMAP_LAYOUT(format,linestride,height) ((7UL<<24)|(((format)&31UL)<<19)|(((linestride)&1023UL)<<9)|(((height)&511UL)<<0))
+#define BITMAP_LAYOUT_H(linestride,height) ((40UL<<24)|(((linestride)&3UL)<<2)|(((height)&3UL)<<0))
 #define BITMAP_SIZE(filter,wrapx,wrapy,width,height) ((8UL<<24)|(((filter)&1UL)<<20)|(((wrapx)&1UL)<<19)|(((wrapy)&1UL)<<18)|(((width)&511UL)<<9)|(((height)&511UL)<<0))
+#define BITMAP_SIZE_H(width,height) ((41UL<<24)|(((width)&3UL)<<2)|(((height)&3UL)<<0))
 #define ALPHA_FUNC(func,ref) ((9UL<<24)|(((func)&7UL)<<8)|(((ref)&255UL)<<0))
 #define STENCIL_FUNC(func,ref,mask) ((10UL<<24)|(((func)&7UL)<<16)|(((ref)&255UL)<<8)|(((mask)&255UL)<<0))
 #define BLEND_FUNC(src,dst) ((11UL<<24)|(((src)&7UL)<<3)|(((dst)&7UL)<<0))
@@ -333,8 +655,6 @@
 #define COLOR_MASK(r,g,b,a) ((32UL<<24)|(((r)&1UL)<<3)|(((g)&1UL)<<2)|(((b)&1UL)<<1)|(((a)&1UL)<<0))
 #define CLEAR(c,s,t) ((38UL<<24)|(((c)&1UL)<<2)|(((s)&1UL)<<1)|(((t)&1UL)<<0))
 #define VERTEX_FORMAT(frac) ((39UL<<24)|(((frac)&7UL)<<0))
-#define BITMAP_LAYOUT_H(linestride,height) ((40UL<<24)|(((linestride)&3UL)<<2)|(((height)&3UL)<<0))
-#define BITMAP_SIZE_H(width,height) ((41UL<<24)|(((width)&3UL)<<2)|(((height)&3UL)<<0))
 #define PALETTE_SOURCE(addr) ((42UL<<24)|(((addr)&4194303UL)<<0))
 #define VERTEX_TRANSLATE_X(x) ((43UL<<24)|(((x)&131071UL)<<0))
 #define VERTEX_TRANSLATE_Y(y) ((44UL<<24)|(((y)&131071UL)<<0))
@@ -370,9 +690,4 @@
     ft_uint32_t PointerToFontGraphicsData;
 }FT_Gpu_Fonts_t;
 
-
-
-
 /* Nothing beyond this */
-
-