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

📄 t515.c

📁 Terawins的芯片T112的源程序
💻 C
字号:
#include <reg51.h>
#include "math.h"
#include "common.h"
#include "system.h"
#include "struct.h"
#include "T101_Util.h"
#include "TW10xReg.h"
#include "twowire.h"

#ifdef T515
#include "T515.h"

extern uCHAR idata m_cStandard;
extern uCHAR idata m_cSource;
void T515_CVIDEO_NTSC();
void T515_CVIDEO_PAL();
void T515_SVIDEO_NTSC();
void T515_SVIDEO_PAL();
void T515_NTSC_PAL();

void Init_T515(void)
{
	I2CWriteByte(TW515, 0xE0, 0xB0);
	I2CWriteByte(TW515, 0x00, 0x00);
	I2CWriteByte(TW515, 0x01, 0x00);
	I2CWriteByte(TW515, 0x0A, 0x60);
	I2CWriteByte(TW515, 0x0B, 0x60);
	I2CWriteByte(TW515, 0x0D, 0x20);
	I2CWriteByte(TW515, 0x1A, 0x87);
	I2CWriteByte(TW515, 0x0F, 0x02);
	I2CWriteByte(TW515, 0x11, 0x02);
	I2CWriteByte(TW515, 0x28, 0x50);
	I2CWriteByte(TW515, 0x29, 0x20);  //0x50 0x20 2005 02 23 if too high color will blind
	I2CWriteByte(TW515, 0x2A, 0x78);  //0x50 0x78 2005 02 23
	I2CWriteByte(TW515, 0x2B, 0x00);
	I2CWriteByte(TW515, 0x2c, 0x80);  //0x50 0x80 2005 02 23 if too high color will blind
	I2CWriteByte(TW515, 0x2f, 0x0c);
	I2CWriteByte(TW515, 0xD1, 0xc8);
	I2CWriteByte(TW515, 0xD2, 0x27);
	I2CWriteByte(TW515, 0x04, 0x2f);
	I2CWriteByte(TW515, 0xa0, 0x05);
	I2CWriteByte(TW515, 0x5f, 0x00);  
	I2CWriteByte(TW515, 0x30, 0x27);  
	I2CWriteByte(TW515, 0x1A, 0x87);
	I2CWriteByte(TW515, 0x22, 0x4B);	   
	I2CWriteByte(TW515, 0x27, 0x22);
	I2CWriteByte(TW515, 0x1C, 0xe7);
}

void SRC_656(void)
{
	Init_T515();
    I2CWriteByte(TW101, 0x30, 0x02);
	I2CWriteByte(TW101, 0x31, 0x10);
	I2CWriteByte(TW101, 0x40, 0x00);
    I2CWriteByte(TW101+2, 0xdf, 0x0c);
    switch_T515();
	I2CWriteByte(TW101,0xc2, 00);
	I2CWriteByte(TW101,0x88, 00); 
	I2CWriteByte(TW101,0x89, 00);  
	I2CWriteByte(TW101,0x8a, 00); 
	I2CWriteByte(TW101,0x8b, 00);
}
void  switch_T515()
{
	T515_NTSC_PAL();
	switch (m_cSource&0x0f)
     {
        case isrc_T515_CVIDEO1:
		case isrc_T515_CVIDEO2:
			I2CWriteByte(TW515, 0x18, 0x00);
    		if ((m_cSource&0x0f)==isrc_T515_CVIDEO1)
        		I2CWriteByte(TW515, 0x19, 0x04);
   			else 
        		I2CWriteByte(TW515, 0x19, 0x00);
			I2CWriteByte(TW515, 0x11, 0x00);
			I2CWriteByte(TW515, 0x23, 0x00);
			I2CWriteByte(TW515, 0x27, 0x21);
			I2CWriteByte(TW515, 0x20,I2CReadByte(TW515, 0x20)&0xFE);
	       	break;
		
	    case isrc_T515_SVIDEO:
			I2CWriteByte(TW515, 0x18, 0x05);
		    I2CWriteByte(TW515, 0x19, 0x01);
			I2CWriteByte(TW515, 0x11, 0x02);
			I2CWriteByte(TW515, 0x20,I2CReadByte(TW515, 0x20)|0x01);
			I2CWriteByte(TW515, 0x23, 0x03);
			I2CWriteByte(TW515, 0x27, 0x25);
	        I2CWriteByte(TW515, 0x21,I2CReadByte(TW515, 0x21)|0x10);
        	break;
		
    }     


}


void  T515_NTSC_PAL(void)
{
    if(m_cStandard==S_NTSC){//NTSC
	I2CWriteByte(TW101+2, 0xDb, 0xf4);//0xf0);  // change by Sherman 06'01'03
	I2CWriteByte(TW101+2, 0xDc, 0x00);
	I2CWriteByte(TW515, 0x38, 0x21);  
	I2CWriteByte(TW515, 0x39, 0xf0);  
	I2CWriteByte(TW515, 0x3a, 0x7c);  
	I2CWriteByte(TW515, 0x3b, 0x1f); 
	I2CWriteByte(TW515, 0x44, 0x00);
	I2CWriteByte(TW515, 0x45, 0x08);
	I2CWriteByte(TW515, 0x4e, 0x88);  
	I2CWriteByte(TW515, 0xa2, 0x46); 
	I2CWriteByte(TW515, 0xC1, 0x2a);
	I2CWriteByte(TW515, 0xC2, 0x03);	
	I2CWriteByte(TW515, 0x50, 0x26);  
	I2CWriteByte(TW515, 0x51, 0x61);  
	I2CWriteByte(TW515, 0x20,I2CReadByte(TW515, 0x20)&0x01|0x00);
	//I2CWriteByte(TW515, 0x20, 0x00);
	I2CWriteByte(TW515, 0x21, 0x09);
    }else{
	I2CWriteByte(TW101+2, 0xDb, 0x28);//0x20); // change by Sherman 06'01'03
	I2CWriteByte(TW101+2, 0xDc, 0x01);
	I2CWriteByte(TW515, 0x38, 0x2a);
	I2CWriteByte(TW515, 0x39, 0x09);
	I2CWriteByte(TW515, 0x3a, 0x8a);
	I2CWriteByte(TW515, 0x3b, 0xcb);
	I2CWriteByte(TW515, 0x44, 0xe9);
	I2CWriteByte(TW515, 0x45, 0x0f);
	I2CWriteByte(TW515, 0x4e, 0x88);  
	I2CWriteByte(TW515, 0xa2, 0x52);
	I2CWriteByte(TW515, 0xC1, 0x2f);
	I2CWriteByte(TW515, 0xC2, 0x03);
	I2CWriteByte(TW515, 0x50, 0x2A);
	I2CWriteByte(TW515, 0x51, 0xc1);
	I2CWriteByte(TW515, 0x20,I2CReadByte(TW515, 0x20)&0x01|0x32);
	//I2CWriteByte(TW515, 0x20, 0x32);
	I2CWriteByte(TW515, 0x21, 0x08);
     }   
}



#endif

⌨️ 快捷键说明

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