#ifndef __FT5216_H
#define __FT5216_H

#include "LT768_Lib.h"
#include "delay.h"
#include "data.h"
#include "bsp.h"
#include "i2c.h"


#if FT_TOUCH
#define  CTP_SLAVE_ADDR     0x70
#endif
#if GT_TOUCH
#define  CTP_SLAVE_ADDR     0x28
#endif

#define Hardware_IIC 0

/************************错误代码*****************************/
#define 		CT_COM_OK               (0)
#define 		CT_ACK_FAIL             (1)

#define 		FT6X06_ID               (0x6206)
#define 		CT_IC                   (FT6X06_ID)              //使用的控制IC
#define 		CT_ADDR                 (0x70)                   //器件地址
//#define 		CT_WRITE_MASK           (0x00)
//#define 		CT_READ_MASK            (0x01)

#define 		CT_CACK_TIMEOUT         (3000)                   //等待ACK超时时间

//#define FT5216_ID_G_CIPHER 			0xA3
//#define FT5216_ID_G_FIRMWARE_ID 	0xA6
//#define FT5216_ID_G_LIB_VERSION_L	0xA2
//#define FT5216_ID_G_LIB_VERSION_H	0xA1

//#define EPORT0_EPDDR      (*(volatile unsigned char *)(0x40019000+0x03))
//#define EPORT0_EPPDR      (*(volatile unsigned char *)(0x40019000+0x04))
//#define EPORT0_EPDR 		  (*(volatile unsigned char *)(0x40019000+0x05))

//#define EPORT1_EPDDR      (*(volatile unsigned char *)(0x4001A000+0x03))
//#define EPORT1_EPPDR      (*(volatile unsigned char *)(0x4001A000+0x04))
//#define EPORT1_EPDR 		  (*(volatile unsigned char *)(0x4001A000+0x05))

//#define INT_INPUT         (EPORT0_EPDDR&= ~(1<<5))	//GINT5
//#define INT_OUTPUT         (EPORT0_EPDDR|= (1<<5))	//GINT5
//#define INT_HIGH          (EPORT0_EPDR |=  (1<<5))
//#define INT_LOW          (EPORT0_EPDR &= ~(1<<5))
//#define INT_LEVEL         (EPORT0_EPPDR&(1<<5))

//#define RESET_OUTPUT       (EPORT1_EPDDR|=  (1<<2)) //GINT10
//#define RESET_HIGH          (EPORT1_EPDR |=  (1<<2))
//#define RESET_LOW          (EPORT1_EPDR &= ~(1<<2))

u8 TP_Get_INT(void);
void CTP_Init(void);
//u8 CTI2C_write_byte(const u8 s);
//u8 CTI2C_read_byte(u8 ack);
//u8 CT_Read_Nbyte(u8 sla_add,u16 add,u16 n,u8 *s);
//uint8_t CT_Write_Nbyte(uint8_t sla_add,uint16_t add,uint16_t n,uint8_t *s);//TP写nbyte函数，写数据由形参数组传入，成功返回1，失败返回0
void TP_read_XY(void);
u8 FT5216_Scan(void);

extern 	u8 ctp_active_index ;

//extern UINT8 First_press;
//extern UINT16 First_pressX,First_pressY;

#endif






