📄 display_new.c
字号:
//---------------------------------------------------------------------------
// Terawins Inc. Company Confidential Strictly Private
//
// $Archive: Display.c 702 $
// $Revision: 1.01 $
// $Author: JoannW $
// $Date: 2002/06/18 $
//
// --------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// --------------------------------------------------------------------------
// Copyright 2002 (c) Terawins Inc.
// This is an unpublished work.
// --------------------------------------------------------------------------
#include <reg51.h>
#include <math.h>
#include "common.h"
#include "system.h"
#include "Struct.h"
#include "TwoWire.h"
#include "TW101Reg.h"
#include "CfgDsply.h"
#include "Display.h"
uDWORD m_dwTemp[2];
extern uCHAR idata m_cScaleratio;
uWORD m_wDWHSZ=DWHSZ;
extern uCHAR idata m_cBuff[4];
extern uWORD idata m_wBuff[3];
extern uDWORD m_dwBuff[2];
extern uWORD m_wVRes; //as computed, used in output and scaling
extern uWORD m_wHRes; //as computed, used in scaling
extern uWORD idata m_wVTotal;
extern uCHAR idata m_cModeStatus;
extern uCHAR idata m_cSource;
extern uCHAR idata m_cStandard;
//---------------------------------------------------------------------------------
//This is for Display clock set,
//the minimum difference between input freq and out freq should be more than 5MHz
//---------------------------------------------------------------------------------
//----------------------------------------
// Local Definitions for this module
//----------------------------------------
////
void DisplayProcess_new(void)
{
#ifdef PVI_35
unsigned char Output_timing[]={ //B0~BF
0x20,0x00,0x0d,0x00,
0x40,0x01,0xEA,0x00,
0x94,0x01,0x06,0x01,
0x20,0x00,0x03,0x00
};
unsigned char Timing_index=0xB0,i=0;
for(i=0;i<16;i++)
I2CWriteByte(TW101, Timing_index+i, Output_timing[i]);
I2CWriteByte(TW101,0x84,0x6c);
if((m_cStandard==S_PAL)||(m_cStandard==S_SECAM))
{
I2CWriteByte(TW101,0x85,0x50);
} else {
I2CWriteByte(TW101,0x85,0x30);
}
I2CWriteByte(TW101, 0x70, 0x90);
#else
#ifdef AU_35
unsigned char Output_timing[]={ //B0~BF
0x10,0x00,0x0d,0x00,
0xA0,0x00,0xEA,0x00,
0xCE,0x00,0x06,0x01,
0x10,0x00,0x03,0x00
};
unsigned char Timing_index=0xB0,i=0;
for(i=0;i<16;i++)
I2CWriteByte(TW101, Timing_index+i, Output_timing[i]);
I2CWriteByte(TW101,0x84,0x00);
I2CWriteByte(TW101,0x85,0x30);
I2CWriteByte(TW101, 0x70, 0x90);
I2CWriteByte(TW101, 0x73, 0x8c);
I2CWriteByte(TW101, 0x75, 0x1f);
#ifdef T102
I2CWriteByte(TW101, 0xe2, 0x11);
#endif
#else
uWORD wDVTotal, wDHTotal,wDVBILK;
if(m_cStandard==S_NTSC)
{
wDHTotal=1716.0*m_wVRes*DNDIV_40/DWVSZ;
wDVTotal=(DNDIV_40*27000.0/(60.0*623.0))*1000.0;
}
else if((m_cStandard==S_PAL)||(m_cStandard==S_SECAM))
{
wDHTotal=1728.0*m_wVRes*DNDIV_40/DWVSZ;
wDVTotal=(DNDIV_40*27000.0/(50.0*576.0))*1000.0;
}
m_dwBuff[1]=I2CReadByte(TW101, 0x83);
m_dwBuff[1] <<= 8;
m_dwBuff[1]=I2CReadByte(TW101, 0x82);
m_dwBuff[1] <<= 8;
m_dwBuff[1] |= I2CReadByte(TW101, 0x81);
wDVBILK=m_dwBuff[1];
DisplaySetTiming1(wDHTotal, wDVTotal,wDVBILK);
#endif
#endif
#ifdef AU_7
if(m_cStandard==S_NTSC)
I2CWriteByte(TW101,0x85,0x06);
if(m_cStandard==S_PAL)
I2CWriteByte(TW101,0x85,0x0e);
#endif
I2CWriteByte(TW101+4,0x80,0x1b);
}
void DisplaySetTiming1(uWORD wDHTotal, uWORD wDVTotal,uWORD wDVBILK)
{
idata uWORD wTemp;
idata float Temp;
idata unsigned long int ttt1;
wTemp = ((wDHTotal - m_wDWHSZ - DISP_DFLT_HSWIDTH)>>1)-2;
I2CWriteByte(TW101, 0xB0, wTemp);
I2CWriteByte(TW101, 0xB1, wTemp>>8);
wTemp =wDVBILK/(wDHTotal*DNDIV_40)-DISP_DFLT_VSWIDTH;
I2CWriteByte(TW101, 0xB2, DWVSST);
I2CWriteByte(TW101, 0xB3, DWVSST>>8);
/*
/// For testing Ruby 2004 12
I2CWriteByte(TW101, 0xB2, wTemp);
I2CWriteByte(TW101, 0xB3, wTemp>>8);
*/
I2CWriteByte(TW101,0xB4,(uCHAR)(m_wDWHSZ));
I2CWriteByte(TW101,0xB5,(uCHAR)(m_wDWHSZ>>8));
I2CWriteByte(TW101, 0xB8, (unsigned char) wDHTotal);
I2CWriteByte(TW101, 0xB9, (unsigned char)(wDHTotal>>8));
/*
#ifdef LG_656
wDVTotal=262;
#endif
*/
I2CWriteByte(TW101, 0xBA, (unsigned char) wDVTotal);
I2CWriteByte(TW101, 0xBB, (unsigned char)(wDVTotal>>8));
I2CWriteByte(TW101, 0xBC, (unsigned char) DISP_DFLT_HSWIDTH);
I2CWriteByte(TW101, 0xBD, (unsigned char)(DISP_DFLT_HSWIDTH>>8));
I2CWriteByte(TW101, 0xBE, (unsigned char) DISP_DFLT_VSWIDTH);
I2CWriteByte(TW101, 0xBF, (unsigned char)(DISP_DFLT_VSWIDTH>>8));
ttt1 =wDVBILK/(wDHTotal*DNDIV_40)-DISP_DFLT_VSWIDTH;
Temp=wDVBILK/(wDHTotal*DNDIV_40)-DISP_DFLT_VSWIDTH-ttt1;
wTemp=(1.88*1716.0)+(Temp*wDHTotal/DNDIV_40);
I2CWriteByte(TW101, 0x84, wTemp);
I2CWriteByte(TW101, 0x85, wTemp>>8);
m_dwTemp[0]=(wDVTotal-m_wVRes-DWVSST-DISP_DFLT_VSWIDTH)*wDHTotal;
m_dwTemp[1]=wTemp*DNDIV_40;
#ifdef AU_7
if(m_cStandard==S_SECAM)
{
I2CWriteByte(TW101, 0xb2, 0x0d);
}
if(m_cStandard==S_PAL)
{
I2CWriteByte(TW101, 0xb2, 0x10);
//I2CWriteByte(TW101, 0xb8, 0xe6);
}
if(m_cStandard==S_NTSC)
{
I2CWriteByte(TW101, 0xb2, 0x12);
}
#endif
#ifdef AT_VGA
if(m_cStandard==S_PAL)
{
I2CWriteByte(TW101, 0xb2, 0x10);
}
#endif
#ifdef T102
I2CWriteByte(TW101, 0xe2, 0x11);
#endif
// if(m_dwTemp[0]<m_dwTemp[1])
I2CWriteByte(TW101, 0x70, I2CReadByte(TW101, 0x70)|0x30);
// else
// I2CWriteByte(TW101, 0x70, I2CReadByte(TW101, 0x70)&0xDF);
/*
#ifdef LOAD_TIME
if(m_cStandard==S_NTSC)
{
if ((I2CReadByte(EEPVIDEOBLOCK, idTIMING_FLAG_INDEX))==Panel_ID)
{
I2CWriteByte(TW101, 0xB8, (unsigned char)I2CReadByte(EEPVIDEOBLOCK, idTIMING_B8));
I2CWriteByte(TW101, 0xB2, (unsigned char)I2CReadByte(EEPVIDEOBLOCK, idTIMING_B2));
}
}
else if(m_cStandard==S_PAL)
{
if ((I2CReadByte(EEPVIDEOBLOCK, idTIMING_FLAG_INDEX1))==Panel_ID)
{
I2CWriteByte(TW101, 0xB8, (unsigned char)I2CReadByte(EEPVIDEOBLOCK, idTIMING_B8_PAL));
I2CWriteByte(TW101, 0xB2, (unsigned char)I2CReadByte(EEPVIDEOBLOCK, idTIMING_B2_PAL));
}
}
#endif
#ifdef T515
#ifdef INCH10_2
if(m_cStandard==S_PAL)
if ( (m_cSource&0x0F)>= isrc_T515_CVIDEO1)
I2CWriteByte(TW101, 0xB2, 0X22);
else
I2CWriteByte(TW101, 0xB2, 0X24);
#endif
#ifdef AU_7
if ( (m_cSource&0x0F)>= isrc_T515_CVIDEO1)
{
if(m_cStandard==S_NTSC)
{
I2CWriteByte(TW101, 0xb2, 0x12);
I2CWriteByte(TW101, 0xb8, 0x6a);
}
else if(m_cStandard==S_PAL)
{
I2CWriteByte(TW101, 0xb2, 0x12);
I2CWriteByte(TW101, 0xb8, 0xe0);
}}
#endif
#endif
#ifdef LG_7
if(m_cStandard==S_NTSC)
{
I2CWriteByte(TW101, 0xb2, 0x11);
I2CWriteByte(TW101, 0xb8, 0x6a);
}
else if(m_cStandard==S_PAL)
{
I2CWriteByte(TW101, 0xb2, 0x11);
I2CWriteByte(TW101, 0xb8, 0xef);
}
#endif
///////////////////////////
#ifdef AU_7
if(m_cStandard==S_NTSC)
{
I2CWriteByte(TW101, 0xb2, 0x11);
I2CWriteByte(TW101, 0xb8, 0x6a);
}
else if(m_cStandard==S_PAL)
{
I2CWriteByte(TW101, 0xb2, 0x11);
I2CWriteByte(TW101, 0xb8, 0xef);
}
#endif
///////////////////////////////
#ifdef INCH_17
if(m_cStandard==S_NTSC)
{
I2CWriteByte(TW101, 0xb2, 0x3e);
}
else if(m_cStandard==S_PAL)
{
I2CWriteByte(TW101, 0xb2, 0x3b);
}
#endif
#ifdef INCH10_2
if(m_cStandard==S_PAL)
{
I2CWriteByte(TW101, 0xb2, 0x23);
}
#endif
#ifdef AU_7D
if(m_cStandard==S_PAL)
{
I2CWriteByte(TW101, 0xb2, 0x23);
}
#endif
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -