Library for FT810 EVE chip

Fork of FT810 by Curtis Mattull

Files at this revision

API Documentation at this revision

Comitter:
mozillain
Date:
Sat Sep 16 23:40:11 2017 +0000
Parent:
10:4c10e6aeb239
Commit message:
test2

Changed in this revision

inc/FT_Gpu.h Show annotated file Show diff for this revision Revisions of this file
inc/FT_Gpu_Hal.h Show annotated file Show diff for this revision Revisions of this file
inc/FT_Hal_Utils.h Show annotated file Show diff for this revision Revisions of this file
inc/FT_LCD_Type.h Show annotated file Show diff for this revision Revisions of this file
inc/FT_Platform.h Show annotated file Show diff for this revision Revisions of this file
src/FT_GPU_Hal.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/inc/FT_Gpu.h	Sat Sep 16 18:34:14 2017 +0000
+++ b/inc/FT_Gpu.h	Sat Sep 16 23:40:11 2017 +0000
@@ -1,3 +1,36 @@
+/*
+
+Copyright (c) Future Technology Devices International 2014
+
+THIS SOFTWARE IS PROVIDED BY FUTURE TECHNOLOGY DEVICES INTERNATIONAL LIMITED "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+FUTURE TECHNOLOGY DEVICES INTERNATIONAL LIMITED BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+FTDI DRIVERS MAY BE USED ONLY IN CONJUNCTION WITH PRODUCTS BASED ON FTDI PARTS.
+
+FTDI DRIVERS MAY BE DISTRIBUTED IN ANY FORM AS LONG AS LICENSE INFORMATION IS NOT MODIFIED.
+
+IF A CUSTOM VENDOR ID AND/OR PRODUCT ID OR DESCRIPTION STRING ARE USED, IT IS THE
+RESPONSIBILITY OF THE PRODUCT MANUFACTURER TO MAINTAIN ANY CHANGES AND SUBSEQUENT WHQL
+RE-CERTIFICATION AS A RESULT OF MAKING THESE CHANGES.
+
+Author : FTDI 
+
+Revision History: 
+0.1 - date 2013.04.24 - Initial Version
+0.2 - date 2013.08.19 - added few registers.
+1.0 - date 2013.12.10 - Version 1.0.
+2.0 - date 2014.11.24 - version 2.0 which includes support for FT81x series.
+
+ 
+*/
+
 #ifndef _FT_GPU_H_
 #define _FT_GPU_H_
 
@@ -11,6 +44,306 @@
 #define CTOUCH_MODE_COMPATIBILITY 1
 #define CTOUCH_MODE_EXTENDED 0
 
+#ifndef FT_81X_ENABLE
+
+/* For FT801 enable the switch in platform.h file */
+/* Lower boundary of trimming */
+#define LOW_FREQ_BOUND  47040000L//98% of 48Mhz
+
+#define FT800_VERSION "1.9.0".
+#define RAM_G_SIZE          256*1024L
+#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 BILINEAR             1UL
+#define BITMAPS              1UL
+#define BORDER               0UL
+
+#define CMDBUF_SIZE          4096UL
+#define CMD_APPEND           4294967070UL
+#define CMD_BGCOLOR          4294967049UL
+#define CMD_BITMAP_TRANSFORM 4294967073UL
+#define CMD_BUTTON           4294967053UL
+#define CMD_CALIBRATE        4294967061UL
+#define CMD_CSKETCH          4294967093UL
+#define CMD_CLOCK            4294967060UL
+#define CMD_COLDSTART        4294967090UL
+#define CMD_CRC              4294967043UL
+#define CMD_DIAL             4294967085UL
+#define CMD_DLSTART          4294967040UL
+#define CMD_EXECUTE          4294967047UL
+#define CMD_FGCOLOR          4294967050UL
+#define CMD_GAUGE            4294967059UL
+#define CMD_GETMATRIX        4294967091UL
+#define CMD_GETPOINT         4294967048UL
+#define CMD_GETPROPS         4294967077UL
+#define CMD_GETPTR           4294967075UL
+#define CMD_GRADCOLOR        4294967092UL
+#define CMD_GRADIENT         4294967051UL
+#define CMD_HAMMERAUX        4294967044UL
+#define CMD_IDCT             4294967046UL
+#define CMD_INFLATE          4294967074UL
+#define CMD_INTERRUPT        4294967042UL
+#define CMD_KEYS             4294967054UL
+#define CMD_LOADIDENTITY     4294967078UL
+#define CMD_LOADIMAGE        4294967076UL
+#define CMD_LOGO             4294967089UL
+#define CMD_MARCH            4294967045UL
+#define CMD_MEMCPY           4294967069UL
+#define CMD_MEMCRC           4294967064UL
+#define CMD_MEMSET           4294967067UL
+#define CMD_MEMWRITE         4294967066UL
+#define CMD_MEMZERO          4294967068UL
+#define CMD_NUMBER           4294967086UL
+#define CMD_PROGRESS         4294967055UL
+#define CMD_REGREAD          4294967065UL
+#define CMD_ROTATE           4294967081UL
+#define CMD_SCALE            4294967080UL
+#define CMD_SCREENSAVER      4294967087UL
+#define CMD_SCROLLBAR        4294967057UL
+#define CMD_SETFONT          4294967083UL
+#define CMD_SETMATRIX        4294967082UL
+#define CMD_SKETCH           4294967088UL
+#define CMD_SLIDER           4294967056UL
+#define CMD_SNAPSHOT         4294967071UL
+#define CMD_SPINNER          4294967062UL
+#define CMD_STOP             4294967063UL
+#define CMD_SWAP             4294967041UL
+#define CMD_TEXT             4294967052UL
+#define CMD_TOGGLE           4294967058UL
+#define CMD_TOUCH_TRANSFORM  4294967072UL
+#define CMD_TRACK            4294967084UL
+#define CMD_TRANSLATE        4294967079UL
+
+#define DECR                 4UL
+#define DECR_WRAP            7UL
+#define DLSWAP_DONE          0UL
+#define DLSWAP_FRAME         2UL
+#define DLSWAP_LINE          1UL
+#define DST_ALPHA            3UL
+#define EDGE_STRIP_A         7UL
+#define EDGE_STRIP_B         8UL
+#define EDGE_STRIP_L         6UL
+#define EDGE_STRIP_R         5UL
+#define EQUAL                5UL
+#define GEQUAL               4UL
+#define GREATER              3UL
+#define INCR                 3UL
+#define INCR_WRAP            6UL
+#define INT_CMDEMPTY         32UL
+#define INT_CMDFLAG          64UL
+#define INT_CONVCOMPLETE     128UL
+#define INT_PLAYBACK         16UL
+#define INT_SOUND            8UL
+#define INT_SWAP             1UL
+#define INT_TAG              4UL
+#define INT_TOUCH            2UL
+#define INVERT               5UL
+
+#define KEEP                 1UL
+#define L1                   1UL
+#define L4                   2UL
+#define L8                   3UL
+#define LEQUAL               2UL
+#define LESS                 1UL
+#define LINEAR_SAMPLES       0UL
+#define LINES                3UL
+#define LINE_STRIP           4UL
+#define NEAREST              0UL
+#define NEVER                0UL
+#define NOTEQUAL             6UL
+#define ONE                  1UL
+#define ONE_MINUS_DST_ALPHA  5UL
+#define ONE_MINUS_SRC_ALPHA  4UL
+#define OPT_CENTER           1536UL
+#define OPT_CENTERX          512UL
+#define OPT_CENTERY          1024UL
+#define OPT_FLAT             256UL
+#define OPT_MONO             1UL
+#define OPT_NOBACK           4096UL
+#define OPT_NODL             2UL
+#define OPT_NOHANDS          49152UL
+#define OPT_NOHM             16384UL
+#define OPT_NOPOINTER        16384UL
+#define OPT_NOSECS           32768UL
+#define OPT_NOTICKS          8192UL
+#define OPT_RIGHTX           2048UL
+#define OPT_SIGNED           256UL
+#define PALETTED             8UL
+#define FTPOINTS             2UL
+#define RECTS                9UL
+
+#define RAM_CMD              1081344UL
+#define RAM_DL               1048576UL
+#define RAM_G                0UL
+#define RAM_PAL              1056768UL
+#define RAM_REG              1057792UL
+
+#define ROMFONT_TABLEADDRESS 1048572UL
+
+#define REG_ANALOG           1058104UL
+#define REG_ANA_COMP         1058160UL
+#define REG_CLOCK            1057800UL
+#define REG_CMD_DL           1058028UL
+#define REG_CMD_READ         1058020UL
+#define REG_CMD_WRITE        1058024UL
+#define REG_CPURESET         1057820UL
+#define REG_CRC              1058152UL
+#define REG_CSPREAD          1057892UL
+#define REG_CYA0             1058000UL
+#define REG_CYA1             1058004UL
+#define REG_CYA_TOUCH        1058100UL
+#define REG_DATESTAMP        1058108UL
+#define REG_DITHER           1057884UL
+#define REG_DLSWAP           1057872UL
+#define REG_FRAMES           1057796UL
+#define REG_FREQUENCY        1057804UL
+#define REG_GPIO             1057936UL
+#define REG_GPIO_DIR         1057932UL
+#define REG_HCYCLE           1057832UL
+#define REG_HOFFSET          1057836UL
+#define REG_HSIZE            1057840UL
+#define REG_HSYNC0           1057844UL
+#define REG_HSYNC1           1057848UL
+#define REG_ID               1057792UL
+#define REG_INT_EN           1057948UL
+#define REG_INT_FLAGS        1057944UL
+#define REG_INT_MASK         1057952UL
+#define REG_MACRO_0          1057992UL
+#define REG_MACRO_1          1057996UL
+#define REG_OUTBITS          1057880UL
+#define REG_PCLK             1057900UL
+#define REG_PCLK_POL         1057896UL
+#define REG_PLAY             1057928UL
+#define REG_PLAYBACK_FORMAT  1057972UL
+#define REG_PLAYBACK_FREQ    1057968UL
+#define REG_PLAYBACK_LENGTH  1057960UL
+#define REG_PLAYBACK_LOOP    1057976UL
+#define REG_PLAYBACK_PLAY    1057980UL
+#define REG_PLAYBACK_READPTR 1057964UL
+#define REG_PLAYBACK_START   1057956UL
+#define REG_PWM_DUTY         1057988UL
+#define REG_PWM_HZ           1057984UL
+#define REG_RENDERMODE       1057808UL
+#define REG_ROMSUB_SEL       1058016UL
+#define REG_ROTATE           1057876UL
+#define REG_SNAPSHOT         1057816UL
+#define REG_SNAPY            1057812UL
+#define REG_SOUND            1057924UL
+#define REG_SWIZZLE          1057888UL
+#define REG_TAG              1057912UL
+#define REG_TAG_X            1057904UL
+#define REG_TAG_Y            1057908UL
+#define REG_TAP_CRC          1057824UL
+#define REG_TAP_MASK         1057828UL
+#define REG_TOUCH_ADC_MODE   1058036UL
+#define REG_TOUCH_CHARGE     1058040UL
+#define REG_TOUCH_DIRECT_XY  1058164UL
+#define REG_TOUCH_DIRECT_Z1Z2 1058168UL
+#define REG_TOUCH_MODE       1058032UL
+#define REG_TOUCH_OVERSAMPLE 1058048UL
+#define REG_TOUCH_RAW_XY     1058056UL
+#define REG_TOUCH_RZ         1058060UL
+#define REG_TOUCH_RZTHRESH   1058052UL
+#define REG_TOUCH_SCREEN_XY  1058064UL
+#define REG_TOUCH_SETTLE     1058044UL
+#define REG_TOUCH_TAG        1058072UL
+#define REG_TOUCH_TAG_XY     1058068UL
+#define REG_TOUCH_TRANSFORM_A 1058076UL
+#define REG_TOUCH_TRANSFORM_B 1058080UL
+#define REG_TOUCH_TRANSFORM_C 1058084UL
+#define REG_TOUCH_TRANSFORM_D 1058088UL
+#define REG_TOUCH_TRANSFORM_E 1058092UL
+#define REG_TOUCH_TRANSFORM_F 1058096UL
+#define REG_TRACKER          1085440UL
+#define REG_TRIM             1058156UL
+#define REG_VCYCLE           1057852UL
+#define REG_VOFFSET          1057856UL
+#define REG_VOL_PB           1057916UL
+#define REG_VOL_SOUND        1057920UL
+#define REG_VSIZE            1057860UL
+#define REG_VSYNC0           1057864UL
+#define REG_VSYNC1           1057868UL
+/* FT801 Registers */
+#define REG_CTOUCH_EXTENDED 1058036UL
+#define REG_CTOUCH_GESTURE 1058104UL
+#define REG_CTOUCH_IDS 1058060UL
+#define REG_CTOUCH_TOUCH0_XY 1058064UL
+#define REG_CTOUCH_TOUCH1_XY 1058056UL
+#define REG_CTOUCH_TOUCH2_XY 1058164UL
+#define REG_CTOUCH_TOUCH3_XY 1058168UL
+#define REG_CTOUCH_TOUCH4_X 1058104UL
+#define REG_CTOUCH_TOUCH4_Y 1058060UL
+
+
+#define REPEAT               1UL
+#define REPLACE              2UL
+#define RGB332               4UL
+#define RGB565               7UL
+#define SRC_ALPHA            2UL
+#define TEXT8X8              9UL
+#define TEXTVGA              10UL
+#define TOUCHMODE_CONTINUOUS 3UL
+#define TOUCHMODE_FRAME      2UL
+#define TOUCHMODE_OFF        0UL
+#define TOUCHMODE_ONESHOT    1UL
+#define ULAW_SAMPLES         1UL
+#define ZERO                 0UL
+
+
+#define VERTEX2F(x,y) ((1UL<<30)|(((x)&32767UL)<<15)|(((y)&32767UL)<<0))
+#define VERTEX2II(x,y,handle,cell) ((2UL<<30)|(((x)&511UL)<<21)|(((y)&511UL)<<12)|(((handle)&31UL)<<7)|(((cell)&127UL)<<0))
+#define BITMAP_SOURCE(addr) ((1UL<<24)|(((addr)&1048575UL)<<0))
+#define CLEAR_COLOR_RGB(red,green,blue) ((2UL<<24)|(((red)&255UL)<<16)|(((green)&255UL)<<8)|(((blue)&255UL)<<0))
+#define TAG(s) ((3UL<<24)|(((s)&255UL)<<0))
+#define COLOR_RGB(red,green,blue) ((4UL<<24)|(((red)&255UL)<<16)|(((green)&255UL)<<8)|(((blue)&255UL)<<0))
+#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_SIZE(filter,wrapx,wrapy,width,height) ((8UL<<24)|(((filter)&1UL)<<20)|(((wrapx)&1UL)<<19)|(((wrapy)&1UL)<<18)|(((width)&511UL)<<9)|(((height)&511UL)<<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))
+#define STENCIL_OP(sfail,spass) ((12UL<<24)|(((sfail)&7UL)<<3)|(((spass)&7UL)<<0))
+#define POINT_SIZE(size) ((13UL<<24)|(((size)&8191UL)<<0))
+#define LINE_WIDTH(width) ((14UL<<24)|(((width)&4095UL)<<0))
+#define CLEAR_COLOR_A(alpha) ((15UL<<24)|(((alpha)&255UL)<<0))
+#define COLOR_A(alpha) ((16UL<<24)|(((alpha)&255UL)<<0))
+#define CLEAR_STENCIL(s) ((17UL<<24)|(((s)&255UL)<<0))
+#define CLEAR_TAG(s) ((18UL<<24)|(((s)&255UL)<<0))
+#define STENCIL_MASK(mask) ((19UL<<24)|(((mask)&255UL)<<0))
+#define TAG_MASK(mask) ((20UL<<24)|(((mask)&1UL)<<0))
+#define BITMAP_TRANSFORM_A(a) ((21UL<<24)|(((a)&131071UL)<<0))
+#define BITMAP_TRANSFORM_B(b) ((22UL<<24)|(((b)&131071UL)<<0))
+#define BITMAP_TRANSFORM_C(c) ((23UL<<24)|(((c)&16777215UL)<<0))
+#define BITMAP_TRANSFORM_D(d) ((24UL<<24)|(((d)&131071UL)<<0))
+#define BITMAP_TRANSFORM_E(e) ((25UL<<24)|(((e)&131071UL)<<0))
+#define BITMAP_TRANSFORM_F(f) ((26UL<<24)|(((f)&16777215UL)<<0))
+#define SCISSOR_XY(x,y) ((27UL<<24)|(((x)&511UL)<<9)|(((y)&511UL)<<0))
+#define SCISSOR_SIZE(width,height) ((28UL<<24)|(((width)&1023UL)<<10)|(((height)&1023UL)<<0))
+#define CALL(dest) ((29UL<<24)|(((dest)&65535UL)<<0))
+#define JUMP(dest) ((30UL<<24)|(((dest)&65535UL)<<0))
+#define BEGIN(prim) ((31UL<<24)|(((prim)&15UL)<<0))
+#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 END() ((33UL<<24))
+#define SAVE_CONTEXT() ((34UL<<24))
+#define RESTORE_CONTEXT() ((35UL<<24))
+#define RETURN() ((36UL<<24))
+#define MACRO(m) ((37UL<<24)|(((m)&1UL)<<0))
+#define DISPLAY() ((0UL<<24))
+
+
+
+
+
+#else
+
 #define LOW_FREQ_BOUND  58800000L//98% of 60Mhz
 
 #define RAM_G_SIZE          1024*1024L
@@ -371,7 +704,7 @@
 }FT_Gpu_Fonts_t;
 
 
-
+#endif /* #ifndef _FT_GPU_H_ */
 
 /* Nothing beyond this */
 
--- a/inc/FT_Gpu_Hal.h	Sat Sep 16 18:34:14 2017 +0000
+++ b/inc/FT_Gpu_Hal.h	Sat Sep 16 23:40:11 2017 +0000
@@ -1,26 +1,3 @@
-/*!
- * \file FT_GPU_HAL.h
- *
- 
- Curt added Load_raw 7/22/16
- 
- 
- 
- * \author FTDI
- * \date 2013.04.24
- *
- * Copyright 2013 Future Technology Devices International Limited
- *
- * Project: FT800 or EVE compatible silicon
- * File Description:
- *    This file defines the generic APIs of host access layer for the FT800 or EVE compatible silicon.
- *    Application shall access FT800 or EVE resources over these APIs. In addition, there are
- *    some helper functions defined for FT800 coprocessor engine as well as host commands.
- * Rivision History:
- * ported to mbed by Peter Drescher, DC2PD 2014
- *
- */
- 
 #ifndef FT_GPU_HAL_H
 #define FT_GPU_HAL_H
  
@@ -173,8 +150,87 @@
         FT_GPU_SLEEP_M =   0x42,
         FT_GPU_POWERDOWN_M = 0x50,
     } FT_GPU_POWER_MODE_T;
+    
+    #ifdef FT_81X_ENABLE
+    typedef enum {
+        FT_GPU_SYSCLK_DEFAULT = 0x00,  //default 60mhz
+        FT_GPU_SYSCLK_72M = 0x06, 
+        FT_GPU_SYSCLK_60M = 0x05,  
+        FT_GPU_SYSCLK_48M = 0x04,  
+        FT_GPU_SYSCLK_36M = 0x03,
+        FT_GPU_SYSCLK_24M = 0x02,
+    }FT_GPU_81X_PLL_FREQ_T;
+
+    typedef enum{
+        FT_GPU_MAIN_ROM = 0x80,  //main graphicas ROM used 
+        FT_GPU_RCOSATAN_ROM = 0x40,  //line slope table used for 
+        FT_GPU_SAMPLE_ROM = 0x20,  //JA samples
+        FT_GPU_JABOOT_ROM = 0x10, //JA microcode
+        FT_GPU_J1BOOT_ROM = 0x08, //J1 microcode
+        FT_GPU_ADC = 0x01,  //
+        FT_GPU_POWER_ON_ROM_AND_ADC = 0x00,  //specify this element to power on all ROMs and ADCs
+    }FT_GPU_81X_ROM_AND_ADC_T;
+
+    typedef enum{
+        FT_GPU_5MA = 0x00,  //default current
+        FT_GPU_10MA = 0x01,
+        FT_GPU_15MA = 0x02,
+        FT_GPU_20MA = 0x03,
+    }FT_GPU_81X_GPIO_DRIVE_STRENGTH_T;
+
+    typedef enum{
+        FT_GPU_GPIO0 = 0x00,
+        FT_GPU_GPIO1 = 0x04,
+        FT_GPU_GPIO2 = 0x08,
+        FT_GPU_GPIO3 = 0x0C,
+        FT_GPU_GPIO4 = 0x10,
+        FT_GPU_DISP = 0x20,
+        FT_GPU_DE = 0x24,
+        FT_GPU_VSYNC_HSYNC = 0x28,
+        FT_GPU_PCLK = 0x2C,
+        FT_GPU_BACKLIGHT = 0x30,
+        FT_GPU_R_G_B = 0x34,
+        FT_GPU_AUDIO_L = 0x38,
+        FT_GPU_INT_N = 0x3C,
+        FT_GPU_TOUCHWAKE = 0x40,
+        FT_GPU_SCL = 0x44,
+        FT_GPU_SDA = 0x48,
+        FT_GPU_SPI_MISO_MOSI_IO2_IO3 = 0x4C,
+    }FT_GPU_81X_GPIO_GROUP_T;
+
+    #define FT_GPU_81X_RESET_ACTIVE 0x000268
+
+    #define FT_GPU_81X_RESET_REMOVAL 0x002068
+#endif 
  
 #define FT_GPU_CORE_RESET  (0x68)
+
+/* Enums for number of SPI dummy bytes and number of channels */
+typedef enum {
+    FT_GPU_SPI_SINGLE_CHANNEL = 0,
+    FT_GPU_SPI_DUAL_CHANNEL = 1,
+    FT_GPU_SPI_QUAD_CHANNEL = 2,
+}FT_GPU_SPI_NUMCHANNELS_T;
+typedef enum {
+    FT_GPU_SPI_ONEDUMMY = 1,
+    FT_GPU_SPI_TWODUMMY = 2,
+}FT_GPU_SPI_NUMDUMMYBYTES;
+
+#define FT_SPI_ONE_DUMMY_BYTE   (0x00)
+#define FT_SPI_TWO_DUMMY_BYTE   (0x04)
+#define FT_SPI_SINGLE_CHANNEL   (0x00)
+#define FT_SPI_DUAL_CHANNEL     (0x01)
+#define FT_SPI_QUAD_CHANNEL     (0x02)  
+
+/*
+#ifdef FT_81X_ENABLE
+ft_void_t Ft_Gpu_81X_SelectSysCLK(Ft_Gpu_Hal_Context_t *host, FT_GPU_81X_PLL_FREQ_T freq);
+ft_void_t Ft_GPU_81X_PowerOffComponents(Ft_Gpu_Hal_Context_t *host, ft_uint8_t val);
+ft_void_t Ft_GPU_81X_PadDriveStrength(Ft_Gpu_Hal_Context_t *host, FT_GPU_81X_GPIO_DRIVE_STRENGTH_T strength, FT_GPU_81X_GPIO_GROUP_T group);
+ft_void_t Ft_Gpu_81X_ResetActive(Ft_Gpu_Hal_Context_t *host);
+ft_void_t Ft_Gpu_81X_ResetRemoval(Ft_Gpu_Hal_Context_t *host);
+#endif
+*/  
  
     ft_int32_t hal_strlen(const ft_char8_t *s);
     ft_void_t Sleep(ft_uint16_t ms);
--- a/inc/FT_Hal_Utils.h	Sat Sep 16 18:34:14 2017 +0000
+++ b/inc/FT_Hal_Utils.h	Sat Sep 16 23:40:11 2017 +0000
@@ -1,7 +1,32 @@
-/* mbed Library for FTDI FT800  Enbedded Video Engine "EVE"
- * based on Original Code Sample from FTDI 
- * ported to mbed by Peter Drescher, DC2PD 2014
- * Released under the MIT License: http://mbed.org/license/mit */
+/*
+
+Copyright (c) Future Technology Devices International 2014
+
+THIS SOFTWARE IS PROVIDED BY FUTURE TECHNOLOGY DEVICES INTERNATIONAL LIMITED "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+FUTURE TECHNOLOGY DEVICES INTERNATIONAL LIMITED BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+FTDI DRIVERS MAY BE USED ONLY IN CONJUNCTION WITH PRODUCTS BASED ON FTDI PARTS.
+
+FTDI DRIVERS MAY BE DISTRIBUTED IN ANY FORM AS LONG AS LICENSE INFORMATION IS NOT MODIFIED.
+
+IF A CUSTOM VENDOR ID AND/OR PRODUCT ID OR DESCRIPTION STRING ARE USED, IT IS THE
+RESPONSIBILITY OF THE PRODUCT MANUFACTURER TO MAINTAIN ANY CHANGES AND SUBSEQUENT WHQL
+RE-CERTIFICATION AS A RESULT OF MAKING THESE CHANGES.
+
+Author : FTDI 
+
+Revision History: 
+0.1 - date 2013.04.24 - Initial Version
+0.2 - date 2013.08.19 - made few changes.
+0.3 - date 2015.03.16 - Added ALIGN_TWO_POWER_N() macro.
+*/
 
 #ifndef _FT_HAL_UTILS_H_
 #define _FT_HAL_UTILS_H_
@@ -16,9 +41,9 @@
 #define F16(s)           ((vc_int32_t)((s) * 65536))
 #define INVALID_TOUCH_XY   0x8000
 #define ABS(x)  ((x) > (0) ? (x) : (-x))
+#define ALIGN_TWO_POWER_N(Value,alignval) (((Value) + (alignval - 1))&(~(alignval - 1)))
 
 #endif /* _FT_HAL_UTILS_H_ */
 
 
 
-
--- a/inc/FT_LCD_Type.h	Sat Sep 16 18:34:14 2017 +0000
+++ b/inc/FT_LCD_Type.h	Sat Sep 16 23:40:11 2017 +0000
@@ -1,39 +1,21 @@
 #ifndef FT_LCD_TYPE_H
 #define FT_LCD_TYPE_H
-/* Global variables for display resolution to support various display panels */
-//OLD
 
 #define my_DispWidth  800
 #define my_DispHeight 480
-#define my_DispHCycle 1056
-#define my_DispHOffset 46
-#define my_DispHSync0  210
-#define my_DispHSync1  230
-#define my_DispVCycle  525
-#define my_DispVOffset  23
-#define my_DispVSync0  22
-#define my_DispVSync1  32
-#define my_DispPCLK  1
-#define my_DispSwizzle  0
-#define my_DispPCLKPol  1
-
-/*
-//NEW
-#define my_DispWidth  800
-#define my_DispHeight 480
 #define my_DispHCycle 928
 #define my_DispHOffset 88
+
 #define my_DispHSync0  0
 #define my_DispHSync1  48
 #define my_DispVCycle  525
 #define my_DispVOffset  32
 #define my_DispVSync0  0
 #define my_DispVSync1  3
-#define my_DispPCLK  2
+#define my_DispPCLK  5 //2
 #define my_DispSwizzle  0
 #define my_DispPCLKPol  1
-
 #define my_DispCSpread 0
 #define my_DispDither 1
-*/
+
 #endif
\ No newline at end of file
--- a/inc/FT_Platform.h	Sat Sep 16 18:34:14 2017 +0000
+++ b/inc/FT_Platform.h	Sat Sep 16 23:40:11 2017 +0000
@@ -1,5 +1,33 @@
 #ifndef _FT_PLATFORM_H_
 #define _FT_PLATFORM_H_
+
+//#define ARDUINO_PLATFORM
+
+/* Module specific configurations */
+#define VM800P43_50
+
+#ifdef VM800P43_50
+
+#define DISPLAY_RESOLUTION_WVGA                     (1)
+#define FT_811_ENABLE                           (1)
+#define ENABLE_SPI_SINGLE                       (1)
+#define FT_ARDUINO_ATMEGA328P_I2C               (1)
+#define RTC_PRESENT                             (1)
+#define FT800_CS                                (9)
+#define FT_SDCARD_CS                            (8)
+#define FT800_INT                               (3)
+#define FT800_PD_N                              (4)
+#define FT_ARDUINO_PRO_SPI_CS FT800_CS
+#define ARDUINO_PLATFORM_SPI
+#define ARDUINO_PLATFORM_COCMD_BURST
+#define RESISTANCE_THRESHOLD                    (1200)
+#endif
+
+#if (defined(FT_810_ENABLE) || defined(FT_811_ENABLE) || defined(FT_812_ENABLE) || defined(FT_813_ENABLE))
+#define FT_81X_ENABLE                               (1)
+#endif
+
+
 /* HAL inclusions */
 #include "FT_DataTypes.h"
 #include "FT_Gpu_Hal.h"
@@ -8,5 +36,10 @@
 #include "FT_LCD_Type.h"
 #include "FT_color.h"
 
+
 #endif /*_FT_PLATFORM_H_*/
-/* Nothing beyond this*/
\ No newline at end of file
+/* Nothing beyond this*/
+
+
+
+
--- a/src/FT_GPU_Hal.cpp	Sat Sep 16 18:34:14 2017 +0000
+++ b/src/FT_GPU_Hal.cpp	Sat Sep 16 23:40:11 2017 +0000
@@ -37,34 +37,14 @@
     ft_uint8_t chipid;
     /* Do a power cycle for safer side */
     Powercycle( FT_TRUE);
-    /*
-    7/8/16: Curt added the sleep delay below...
-    */
-//  Sleep(30);
-    
-    /* Set the clk to external clock */
-    HostCommand( FT_GPU_EXTERNAL_OSC);
-    Sleep(10);
-    
-    /* Access address 0 to wake up the FT800 */
+    HostCommand(FT_GPU_EXTERNAL_OSC);
     HostCommand( FT_GPU_ACTIVE_M);
-    Sleep(500);
 
-    /* Switch PLL output to 48MHz */
-//  HostCommand( FT_GPU_PLL_48M);
-    Sleep(10);
-
-    /* Do a core reset for safer side */
-    HostCommand( FT_GPU_CORE_RESET);
-    Sleep(500);
-    //Read Register ID to check if FT800 is ready.
-    chipid = Rd8(  REG_ID);
+    //Read Register ID to check if FT811 is ready.
+    chipid = Rd8(REG_ID);
     while(chipid != 0x7C)
     
-    // Speed up
-    _spi.frequency(30000000);           // 30 Mhz SPI clock DC
-//    _spi.frequency(20000000);           // 20 Mhz SPI clock DC
-//  _spi.frequency(12000000);           // 12 Mhz SPI clock
+
     /* Configuration of LCD display */
     DispHCycle = my_DispHCycle;
     Wr16(  REG_HCYCLE, DispHCycle);
@@ -94,6 +74,11 @@
     DispPCLK = my_DispPCLK;
     Wr8(  REG_PCLK, DispPCLK);//after this display is visible on the LCD
     
+    // Speed up
+    _spi.frequency(30000000);           // 30 Mhz SPI clock DC
+//    _spi.frequency(20000000);           // 20 Mhz SPI clock DC
+//  _spi.frequency(12000000);           // 12 Mhz SPI clock
+    
     ft_uint8_t temp = Rd8(REG_PCLK);
     if (temp!=DispPCLK){DigitalOut led(LED1); led=1;}
     Serial pc(SERIAL_TX, SERIAL_RX);
@@ -102,13 +87,12 @@
 
     Wr16(  REG_PWM_HZ, 10000);
     pc.printf("ID:%08X\n", Rd16(REG_PWM_HZ));
-//#ifdef Inv_Backlite               // turn on backlite
-    //Wr16(  REG_PWM_DUTY, 0);
-//#else
+
     Wr16(  REG_PWM_DUTY, 127);
-//#endif
-    Wr8(  REG_GPIO_DIR,0x82);  //| Rd8( REG_GPIO_DIR));
-    Wr8(  REG_GPIO,0x080);     //| Rd8( REG_GPIO));
+    //Wr8(  REG_GPIO_DIR,0x82);  //| Rd8( REG_GPIO_DIR));
+    //Wr8(  REG_GPIO,0x080);     //| Rd8( REG_GPIO));
+    Wr8(  REG_GPIO_DIR,0x82| Rd8( REG_GPIO_DIR));
+    Wr8(  REG_GPIO,0x80| Rd8( REG_GPIO));
 
     Wr32(  RAM_DL, CLEAR(1,1,1));
     Wr32(  RAM_DL+4, DISPLAY());
@@ -118,8 +102,6 @@
 
     /* Touch configuration - configure the resistance value to 1200 - this value is specific to customer requirement and derived by experiment */
     Wr16(  REG_TOUCH_RZTHRESH,1200);
-//    Wr16(  REG_TOUCH_RZTHRESH,0xFFFF);
-
 }