⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tft_sunplus_t112_auo_panel.h

📁 TFT显示的源码,附了使用说明书 要下载的速度了
💻 H
📖 第 1 页 / 共 3 页
字号:
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x70,0x60,0x78,0x60,0x7c,
0x60,0x6e,0x60,0x67,0xe0,0x63,0xe0,0x61,0xe0,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00
};
const unsigned char font_4F[]={ // O
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x1f,0xc0,0x3f,0xe0,0x70,0x60,0x60,0x60,0x60,
0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0x70,0xc0,0x3f,0x80,0x1f,0x00,0x00,0x00,0x00
};
const unsigned char font_50[]={ // P
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x7f,0xc0,0x7f,0xe0,0x60,0x60,0x60,0xe0,0x60,
0xc0,0x7f,0x80,0x7f,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00
};
const unsigned char font_51[]={ // Q
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x1f,0xc0,0x3f,0xe0,0x70,0x60,0x60,0x60,0x60,
0x60,0x60,0x60,0x60,0x60,0x67,0xe0,0x73,0xc0,0x3f,0xe0,0x1e,0x60,0x00,0x00,0x00,0x00,0x00
};
const unsigned char font_52[]={ // R
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x7f,0xc0,0x7f,0xe0,0x60,0x60,0x60,0xe0,0x60,
0xc0,0x7f,0x80,0x7f,0x00,0x6e,0x00,0x67,0x80,0x63,0xc0,0x61,0xe0,0x60,0x00,0x00,0x00,0x00
};
const unsigned char font_53[]={ // S
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x1f,0xc0,0x3f,0xe0,0x70,0x60,0x60,0x00,0x70,
0x80,0x3f,0xc0,0x1f,0xe0,0x00,0x60,0x60,0xe0,0x70,0xc0,0x3f,0x80,0x1f,0x00,0x00,0x00,0x00
};
const unsigned char font_54[]={ // T
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x7f,0xe0,0x7f,0x00,0x06,0x00,0x06,0x00,0x06,
0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00
};
const unsigned char font_55[]={ // U
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xe0,0x70,0xc0,0x3f,0x80,0x1f,0x00,0x00,0x00,0x00
};
const unsigned char font_56[]={ // V
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
0x60,0x60,0x60,0x60,0xe0,0x70,0xc0,0x39,0x80,0x1f,0x00,0x0f,0x00,0x06,0x00,0x00,0x00,0x00
};
const unsigned char font_57[]={ // W
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
0x60,0x60,0x60,0x66,0x60,0x6f,0xe0,0x7f,0xe0,0x79,0xe0,0x70,0x60,0x60,0x00,0x00,0x00,0x00
};
const unsigned char font_58[]={ // X
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0xe0,0x70,0xc0,0x39,0x80,0x1f,
0x00,0x0f,0x00,0x0f,0x80,0x1f,0xc0,0x39,0xe0,0x70,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00
};
const unsigned char font_59[]={ // Y
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0xe0,0x70,0xc0,0x30,0xc0,0x39,
0x80,0x19,0x80,0x1f,0x00,0x0f,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00
};
const unsigned char font_5A[]={ // Z
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x7f,0xe0,0x7f,0xe0,0x00,0xc0,0x01,0x80,0x03,
0x00,0x07,0x00,0x0e,0x00,0x1c,0x00,0x38,0x00,0x70,0xe0,0x7f,0xe0,0x7f,0x00,0x00,0x00,0x00
};
const unsigned char font_Blank[]={ //Digital 1
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};

const unsigned char font_00[]={
  0x00,0x00,0xC0,0x03,0xF0,0x0F,0xF8,0x1C,0xFC,0x30,0xFC,0x30,0xFE,0x60,0xFE,0x60,
  0xFE,0x60,0xFE,0x60,0xFC, 0x30,0xFC,0x30,0xF8,0x1C,0xF0,0x0F,0xC0,0x03,0x00,0x00  
};
const unsigned char font_01[]={
  0x80,0x01,0x80,0x01,0x0C,0x30,0xCC,0x33,0xE0,0x07,0x30,0x0C,0x18,0x18,0x1B,0xD8,
  0x1B,0xD8,0x18,0x18,0x30,0x0C,0xE0,0x07,0xCC,0x33,0x0C,0x30,0x80,0x01,0x80,0x01  
};
const unsigned char font_02[]={
  0x00,0x00,0x00,0x1F,0xE0,0x20,0x10,0x43,0x08,0x83,0x64,0x98,0x62,0x98,0x01,0x81,
  0x19,0x86,0x19,0x6C,0x01,0x1F,0x8D,0x30,0x41,0x60,0x22, 0xC0,0x1C,0x80,0x00,0x00
};
const unsigned char font_03[]={
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};

const unsigned char font_04[]={ //Gauge_M_1 I  FULL
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00
};

const unsigned char font_05[]={ //Gauge_M_0 empty
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00
};

const unsigned char font_06[]={ //Gauge_M_1 I  1/4
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0xf0,
0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00
};

const unsigned char font_07[]={ //Gauge_M_1 I  2/4
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,
0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00
};

const unsigned char font_08[]={ //Gauge_M_1 I  3/4
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0xf0,0xff,0xf0,0xff,0xf0,0xff,0xf0,0xff,
0xf0,0xff,0xf0,0xff,0xf0,0xff,0xf0,0xff,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00
};

const unsigned char *AllFonts[]={
font_Blank,font_04,font_05,font_06,font_07,font_08,
font_30,font_31,font_32,font_33,font_34,font_35,font_36,font_37,font_38,font_39,
font_41,font_42,font_43,font_44,font_45,font_46,font_47,font_48,font_49,font_4A,
font_4B,font_4C,font_4D,font_4E,font_4F,font_50,font_51,font_52,font_53,font_54,
font_55,font_56,font_57//,font_58,font_59,font_5A
};

/* OSD register definition */
#define OSD_CFG_INDEX 			0xA0
#define OSD_CFG_DATA  			0xA1
#define OSD_RAM_AL    			0xA2
#define OSD_RAM_AH    			0xA3
#define OSD_RAM_DL    			0xA4
#define OSD_RAM_DH    			0xA5

#define OSD_CTRL         	0x00
#define CHAR_DLY_0       	0x01
#define CHAR_DLY_1       	0x02
#define CHAR_DLY_2       	0x03
#define CHAR_FONT_SIZE   	0x04
#define CHAR_RAM_BASE_A  	0x05
#define CHAR_BS_CTRL     	0x06
#define CHAR_BS_COLOR    	0x07
#define CHAR_HEIGHT_CTRL 	0x08
#define BLINK_CTRL       	0x09
#define BW_WH_UPPER      	0x0a
#define BW_W             	0x0b
#define BW_H             	0x0c
#define BD_ENLARGE       	0x0d
#define OSD_LUT_RAM_DATA 	0x0e
#define WIN1_Y_START     	0x10
#define WIN1_Y_END       	0x11
#define WIN1_X_START     	0x12
#define WIN1_X_END       	0x13
#define WIN1_SHADOW_SIZE 	0x14
#define ALPHA_BLD_CTRL   	0x1c
#define CHAR_RAM_END_A   	0x1e

#define	FONT_SIZE6W16H		0x83
#define	FONT_SIZE8W16H		0x84
#define	FONT_SIZE10W16H		0x00
#define	FONT_SIZE12W16H		0x01
#define	FONT_SIZE14W16H		0x02
#define	FONT_SIZE16W16H		0x03
#define	FONT_SIZE10W18H		0x08
#define	FONT_SIZE12W18H		0x09
#define	FONT_SIZE14W18H		0x0a
#define	FONT_SIZE16W18H		0x0b

#define HEIGHT16			16
#define HEIGHT18			18
#define HEIGHT20			20
#define HEIGHT24			24

#define	FONT_SIZE			FONT_SIZE12W18H
#define FONT_WIDTH			WIDTH12
#define FONT_HEIGHT			HEIGHT18
#define TOTAL_FONT_NUM					128
#define FONT_DATA_START_ADDRESS			0x0000
#define CHAR_MAIN_MENU_START			((MENU_RAM_START_ADDRESS>>5)&0x7F)	
#define MENU_RAM_START_ADDRESS			((TOTAL_FONT_NUM*FONT_HEIGHT)/32+1)*32	
#define IndexNumOffset				0
#define IndexCharacterOffset		0

#define CHAR_RAM_END               		0x60

#define OSD_LINE_NUM			10
#define NOSIGNAL_LENGTH			13
#define NOSUPPORT_LENGTH 		14
#define COLORCAL_LENGTH	 		23
#define CALDOING_LENGTH	 		18
#define ICON_STAT				0
#define TXT_STAT				3
#define NUM_STAT				25
#define FCTRY_OSD_LENGTH		25
#define FCTRY_NUM_STAT			20
#define GAUGE_Y  7
//OSD number draw attabite
#define DRAW_BLANK				0x10
#define DRAW_ZERO				0x20

const BYTE ucaSignalStdRegP2[]={
0x0c, 0x18, 0x19, 0x1a, 0x1b, 0x82
};
const BYTE ucaSignalStdValP2[]={
//NTSC
0x8a, 0x21, 0xf0, 0x7c, 0x0f, 0x42 ,
//PAL
0x67, 0x2a, 0x09, 0x8a, 0xcb, 0x52 ,
//SECAM
0x80, 0x28, 0xb3, 0x3b, 0xb2, 0x52 ,
};
const BYTE ucaZoomAdrP0[]={
0x40, 0x70, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x84, 0x85, 0x88, 0x89, 0x8a, 0x8b, 0xc8,
0xb0, 0xb2, 0xb6, 0xb8, 0xbe, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0x30, 0x79 , 0xe2
};
const BYTE ucaZoomAdrP2[]={
0x2e, 0x2f, 0x30, 0x31
};
const BYTE ucaZoomDataP0_NTSC[]={	
//0x40, 0x70, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x84, 0x85, 0x88, 0x89, 0x8a, 0x8b, 0xc8,
//0xb0, 0xb2, 0xb6, 0xb8, 0xbe, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0x30, 0x79 , 0xe2
//full
  0x10, 0xb1, 0x66, 0x2E, 0x00, 0x20, 0x00, 0x00, 0xC7, 0x02, 0x00, 0x00, 0x00, 0x00, 0x15,
  0x3A, 0x10, 0xea, 0x70, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xea, 0x00, 0x83, 0x00, 0x11,
//Zoom 1
  0x10, 0xb1, 0x66, 0x2E, 0x00, 0x20, 0x00, 0x82, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x15,
  0x3A, 0x11, 0xea, 0x68, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xea, 0x00, 0x83, 0x00, 0x11,
//Zoom 2, zoom wide 1 in Himax8806A
  0x10, 0xb1, 0x66, 0x2E, 0x00, 0x20, 0x00, 0xc3, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x15,
  0x3A, 0x11, 0xea, 0x68, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xea, 0x00, 0x83, 0x00, 0x11,
//_4:3
//0x40, 0x70, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x84, 0x85, 0x88, 0x89, 0x8a, 0x8b, 0xc8,
//0xb0, 0xb2, 0xb6, 0xb8, 0xbe, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0x30, 0x79 , 0xe2
  0x0c, 0xb1, 0xdd, 0x3d, 0x00, 0x20, 0x00, 0x00, 0xec, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x15,
  0x3A, 0x11, 0xea, 0x68, 0x03, 0x3c, 0x00, 0x00, 0x00, 0x68, 0x01, 0xea, 0x00, 0x83, 0x00, 0x11,
//Zoom 3, zoom 2 in Himax
  0x10, 0xb1, 0x88, 0xb8, 0x80, 0x76, 0x00, 0x00, 0x8d, 0x80, 0x00, 0x00, 0x00, 0x00, 0x15,
  0x16, 0x0f, 0xea, 0x36, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xea, 0x00, 0x83, 0x00, 0x11,
//Zoom 4, wide in Himax 8806A
  0x10, 0xb1, 0x00, 0xbb, 0xd0, 0x7f, 0x00, 0xc8, 0x8d, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x15,
  0x3A, 0x11, 0xea, 0x66, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xea, 0x00, 0x83, 0x00, 0x11,
//Zoom5 , zoom wide 2 in Himax 8806A
  0x10, 0xb1, 0x88, 0xb8, 0x80, 0x76, 0x00, 0x84, 0x8d, 0x80, 0x00, 0x00, 0x00, 0x00, 0x15,
  0x16, 0x0f, 0xea, 0x36, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xea, 0x00, 0x83, 0x00, 0x11,
//Zoom6, zoom 3 in Himax 8806A
  0x10, 0xb1, 0x88, 0xb8, 0x60, 0x76, 0x00, 0x00, 0x8d, 0x49, 0x00, 0x00, 0x00, 0x00, 0x15,
  0x16, 0x0f, 0xea, 0x3e, 0x05, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xea, 0x00, 0x83, 0x00, 0x11,
//Zoom7
  0x3c, 0xb1, 0xA9, 0x3A, 0x29, 0x64, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x17,
  0x10, 0x1f, 0xea, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0xEA, 0x00, 0x03, 0x20, 0x11,
};
const BYTE ucaZoomDataP2_NTSC[]={
//full
  0x88, 0x50, 0x26, 0x69, 
// Zoom 1
  0x88, 0x50, 0x26, 0x69, 
// Zoom 2
  0x88, 0x50, 0x26, 0x69, 
//_4:3
  0x82, 0x50, 0x26, 0x69,
// Zoom 3, Zoom2 in Himax
  0x88, 0x50, 0x20, 0x69,
// Zoom 4
  0x88, 0x50, 0x26, 0x69,
// Zoom 5, zoom wide 2 in Himax 8806A
  0x88, 0x50, 0x20, 0x69,
// Zoom 6, zoom 3 in Himax 8806A
  0x88, 0x50, 0x38, 0x69,
// Zoom 7
  0xD8, 0x00, 0x5A, 0x61  
};

#define PanelSpecP0Cnt		sizeof(ucaPanelSpecAdrP0)/sizeof(BYTE)
#define PanelSpecP2Cnt		sizeof(ucaPanelSpecAdrP2)/sizeof(BYTE)
#define SignalStdRegP2Cnt  	sizeof(ucaSignalStdRegP2)/sizeof(BYTE)
#define P0ScaleAdrCnt		sizeof(ucaZoomAdrP0)/sizeof(BYTE)
#define	P2ScaleAdrCnt		sizeof(ucaZoomAdrP2)/sizeof(BYTE)     

#define PSYNC_STR			0x10
#define EN_SAVE_REC		0x04
#define IGNORE_VSYNC		0x02
typedef enum{
		itypeCVBS=0x00,
		itypeSVIDEO,
		itypeYPBPR
}Source_Type;

#define PATTERN_CTRL  			0x91
BYTE m_cSource;
BYTE NoSignal=0;
#define ENYPbPr						0x40
UINT16 	uiaSrcMux[]={
	0x0000, itypeCVBS, 	// Reserved
	0x0100,	itypeCVBS, 	// CVBS1		
	0x0404,	itypeCVBS, 	// CVBS2		 
	0x0001,	itypeSVIDEO,// Svideo0    
}; // set the input mux values here, P0_18, P0_19
int I2CWriteByte(int cDevAddr, int cReg, BYTE cData)
{
	int res = -1;

	res = WriteToI2c(cDevAddr,cReg,&cData,1);
	/*
	if(res == -1)
		io_write_wait("---- <write t112 fail> ----\n");  //tcf added for debug
	else
		printf("---- write t112 success<%02x,%02x,%02x> ----\n",cDevAddr,cReg,cData);//tcf added for debug//io_write_wait("---- <write t112 success> ----\n");  //tcf added for debug
	*/return res;
}

int I2CWriteBytes(int cDevAddr,int cReg, BYTE cData,int cNum)
{
    int res = -1;

//	res = WriteToI2c(cDevAddr,cReg,&cData,cNum);
	if(res == -1)
		io_write_wait("---- <writes t112 fail> ----\n");  //tcf added for debug
	else
		printf("---- <writes  t112 success> ----\n");//tcf added for debug//io_write_wait("---- <write t112 success> ----\n");  //tcf added for debug
	return res;
 }


int I2CReadByte(int cDevAddr, int cReg)
{
	BYTE puData;

	if(ReadFromI2c(cDevAddr,cReg,&puData,1)==1)
	{
		//printf("---- read t112 success<%02x,%02x,%02x> ----\n",cDevAddr,cReg,puData);//tcf added for debug//io_write_wait("---- <read t112 success> ----\n");  //tcf added for debug
		printf("0x%02x,",puData);//tcf added for debug//io_write_wait("---- <read t112 success> ----\n");  //tcf added for debug
		return puData;
	}
	else
	{
		io_write_wait("---- <read t112 fail> ----\n");  //tcf added for debug
		return 0;
	}
}

const BYTE ScanMode[]={
//TopLeft,TopRight,BottomRight,BottomLeft
    0xf4 ,   0xe0 ,    0xa8   ,    0xbc   };
typedef enum{
  TOP_LEFT,
  TOP_RIGHT,
  BOTTOM_RIGHT,
  BOTTOM_LEFT,
  VALID_DIR
}Dis_Direction;



void OSDCfgWr(BYTE index,BYTE dat)
{
 	I2CWriteByte(TW101,OSD_CFG_INDEX,index);
 	I2CWriteByte(TW101,OSD_CFG_DATA,dat);
}
void OSDSetRamAddr(UINT16 address)
{
	I2CWriteByte(TW101,OSD_RAM_AH,(BYTE)(address>>8));
  	I2CWriteByte(TW101,OSD_RAM_AL,(BYTE)(address & 0xff));

}
void t112OSDInit(void)
{
#if 0
	unsigned int i,j;

	OSDCfgWr(OSD_CTRL,0x18);             			   //disable osd and width*1
	OSDSetRamAddr(FONT_DATA_START_ADDRESS);
	OSDCfgWr(CHAR_FONT_SIZE,FONT_SIZE);
	// add by Sherman 06'02'06
	#if (defined T102)|(defined T112)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -