#ifndef __TP_H__
#define __TP_H__

 #include "type.h"
#include "i2c_drv.h"
#include "i2c_hal.h"
#include "ioctrl_hal.h"
#include "delay.h"
#include "ft5216.h"

#define HW_I2C 1

#define  CTP_I2C_ID         I2C1



#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))


extern void InitTouch(void);
extern unsigned char IsTouchPressed(void);
extern void ReadTouchData(unsigned int *x,unsigned int *y);
void ReadTouchData2(void);
#endif

