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

📄 tft_sunplus_el8332_hsd070i651_panel.c

📁 TFT显示的源码,附了使用说明书 要下载的速度了
💻 C
字号:


void set_el8332_format(UINT8 panelfmt) //set pal or ntsc register map
{
    if (panelfmt==TV_FORMAT_PAL)
    {        
        WriteI2c(TCONT_I2C_ADDR,0x21,0xc1,1);     WriteI2c(TCONT_I2C_ADDR,0x26,0x28,1);
        WriteI2c(TCONT_I2C_ADDR,0x27,0xd3,1);     WriteI2c(TCONT_I2C_ADDR,0x28,0x0f,1);
		WriteI2c(TCONT_I2C_ADDR,0x29,0x98,1);     WriteI2c(TCONT_I2C_ADDR,0x2b,0x4e,1);
        
        WriteI2c(TCONT_I2C_ADDR,0x47,0x25,1);	  WriteI2c(TCONT_I2C_ADDR,0x48,0x33,1); 
		WriteI2c(TCONT_I2C_ADDR,0x4b,0x72,1);     WriteI2c(TCONT_I2C_ADDR,0x4c,0x2d,1);
		WriteI2c(TCONT_I2C_ADDR,0x4d,0xb2,1);     WriteI2c(TCONT_I2C_ADDR,0x4e,0x2f,1);
		WriteI2c(TCONT_I2C_ADDR,0x4f,0x01,1);
		
		WriteI2c(TCONT_I2C_ADDR,0x59,0x02,1);     WriteI2c(TCONT_I2C_ADDR,0x5c,0x00,1);     
		
		WriteI2c(TCONT_I2C_ADDR,0x62,0x3a,1);     WriteI2c(TCONT_I2C_ADDR,0x63,0xd0,1);
		WriteI2c(TCONT_I2C_ADDR,0x65,0x5f,1);     WriteI2c(TCONT_I2C_ADDR,0x66,0x5f,1);

		WriteI2c(TCONT_I2C_ADDR,0x82,0xff,1);     					
    }
    else if ((panelfmt==TV_FORMAT_NTSC)||(panelfmt==TV_FORMAT_PAL60))
    {
		WriteI2c(TCONT_I2C_ADDR,0x21,0xc0,1);     WriteI2c(TCONT_I2C_ADDR,0x26,0x25,1);
        WriteI2c(TCONT_I2C_ADDR,0x27,0xd0,1);     WriteI2c(TCONT_I2C_ADDR,0x28,0x0d,1);
		WriteI2c(TCONT_I2C_ADDR,0x29,0x83,1);     WriteI2c(TCONT_I2C_ADDR,0x2b,0x41,1);

        WriteI2c(TCONT_I2C_ADDR,0x47,0x20,1);	  WriteI2c(TCONT_I2C_ADDR,0x48,0x00,1);     
		WriteI2c(TCONT_I2C_ADDR,0x4b,0x04,1);     WriteI2c(TCONT_I2C_ADDR,0x4c,0x26,1);
		WriteI2c(TCONT_I2C_ADDR,0x4d,0x04,1);     WriteI2c(TCONT_I2C_ADDR,0x4e,0x26,1);
		WriteI2c(TCONT_I2C_ADDR,0x4f,0x08,1);
		
		WriteI2c(TCONT_I2C_ADDR,0x59,0x00,1);     WriteI2c(TCONT_I2C_ADDR,0x5c,0xca,1);     

		WriteI2c(TCONT_I2C_ADDR,0x62,0x60,1);     WriteI2c(TCONT_I2C_ADDR,0x63,0xf0,1);
		WriteI2c(TCONT_I2C_ADDR,0x65,0x59,1);     WriteI2c(TCONT_I2C_ADDR,0x66,0x59,1);
		
		WriteI2c(TCONT_I2C_ADDR,0x82,0x00,1);    
    }
}

void init_ntsc_pal(UINT8 tv_format)
{
	if(tv_format==TV_FORMAT_PAL)
    {
		WriteToI2c(TCONT_I2C_ADDR,0x00,(BYTE*)(&el8332_PAL_table),256);
	}
	else if ((tv_format==TV_FORMAT_NTSC)||(tv_format==TV_FORMAT_PAL60))
	{
	    WriteToI2c(TCONT_I2C_ADDR,0x00,(BYTE*)(&el8332_NTSC_table),256);
    }
}

void DownLoad_EL8832_HSD070i651_Gamma(unsigned char Mode,unsigned int Offset)
{ 
    UINT16 GammaValue;
    int i;
    Mode=0;
    Offset=0;
    
    WriteI2c(TCONT_I2C_ADDR,0x58,0x21,1);
    
    WriteI2c(TCONT_I2C_ADDR,0x59,0x00,1);                //set Gamma LUT Address
    WriteI2c(TCONT_I2C_ADDR,0x5a,0x01,1);          //set channel
    for(i=0;i<256;i++)
    {
        GammaValue=el8332_HSD070I651_GAMMA_R_table[i];
        if(GammaValue>32768) GammaValue=0;
        if(GammaValue>1023) GammaValue=1023;
		//WriteI2c(0x7a,0x59,i,1); 	
		WriteI2c(TCONT_I2C_ADDR,0x5c,(GammaValue>>2),1); 
    } 
    
    WriteI2c(TCONT_I2C_ADDR,0x59,0x00,1);                //set Gamma LUT Address
    WriteI2c(TCONT_I2C_ADDR,0x5a,0x02,1);          //set channel
    for(i=0;i<256;i++)
    {
        GammaValue=el8332_HSD070I651_GAMMA_G_table[i];
        if(GammaValue>32768) GammaValue=0;
        if(GammaValue>1023) GammaValue=1023;
		//WriteI2c(0x7a,0x59,i,1); 	
		WriteI2c(TCONT_I2C_ADDR,0x5c,(GammaValue>>2),1); 
    }
    WriteI2c(TCONT_I2C_ADDR,0x59,0x00,1);                //set Gamma LUT Address
    WriteI2c(TCONT_I2C_ADDR,0x5a,0x03,1);          //set channel
    for(i=0;i<256;i++)
    {
        GammaValue=el8332_HSD070I651_GAMMA_B_table[i];
		if(GammaValue>32768) GammaValue=0;
        if(GammaValue>1023) GammaValue=1023;
		//WriteI2c(0x7a,0x59,i,1); 	
		WriteI2c(TCONT_I2C_ADDR,0x5c,(GammaValue>>2),1); 
    }                 
    WriteI2c(TCONT_I2C_ADDR,0x58,0x01,1);                                              
}

void download_gamma_table(void)
{
    DownLoad_EL8832_HSD070i651_Gamma(0,0);
}


⌨️ 快捷键说明

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