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

📄 1574.c

📁 AU 3.5" TFT-LCD 源代码
💻 C
字号:


#include "datatype.h"
#include "uart.h"
#include "i2c.h"
#include "i2l.h"
#include "1575.h"
#include "gamma.h"
#include "reg52.h"		 
#include "misc.h"

#include "c072i2c.h"
// LCD default data
//#include "ntscau9.h"
//#include "panasonic.h"
//#include "samsung.h"
//#include "LG7.h"
#include "AU85.h"
//#include "AU35.h"


#include <ctype.h>
#include <stdio.h>
#include <intrins.h> 
#include <math.h>

//sbit LED0 = P4^0;
Bool searchchar(U8 *s_privte,U8 chipaddr)
{
	U8 *stemp;
	stemp=s_privte;
	while(*stemp!='\0')
	{
		if(*stemp==chipaddr)
		return 1;
		stemp++;
 	}
	return 0;
}



main()
{

	U8 temp=0;
	U8 clist[6],chipaddr,chipdata;
	U16 i;
	U8 *mydefault;
	Bool founderror;
    initUart(BAUD_RATE_19200);
    clist[5]='\0';
	
///	LED0=0;
   	TMOD = ( TMOD & 0xF0 ) | 0x01;
   	ET0=1;
   	TR0=1;
   	EA=1;

   	I2CWrite(0x00,0x00);	//DAC clock no invert; hsync active low; vsync active low; video stream no delay;  input clock no inversion; input data mode CCIR-601; 
   	I2CWrite(0x3F,0x03);	//3F:63;
   	I2CWrite(0x3A,0x09); 	//horizontal valid duration low byte
   	I2CWrite(0x6A,0x0c);

//     	mydefault=au35;
//    	mydefault=au656n43;
//    	mydefault=au;
//		mydefault=aunew;
 		mydefault=au656;
//		mydefault=lgnormal;
//		mydefault=lgfull;
//		mydefault=au656pal;
// write data 
	while(!(mydefault[i]==0xFF && mydefault[i+1]==0xFF))
	{
	C072I2CWrite(mydefault[i+1],mydefault[i]);
	i=i+2;
	}

while(1)
{
		temp=getchar();
		P2++;
		if(temp=='v' || temp == 'V')
			printf("%s",s_moduleInfo);
		else if(temp=='h' || temp == 'H')
			printf("%s",s_modulehelp);
	//	else if(temp=='g' || temp == 'G')
	//		gammafunc();
		else if(temp=='w' || temp == 'W')
			{
			founderror=0;
			for(i=0;i<4;i++)
				{
				clist[i]=getchar();
				if(isxdigit(clist[i])==0)
					{
					printf("ERROR!");
					founderror=1;
					}
				}
			if(founderror)
				continue;

				chipaddr=(chartohex(clist[0])<<4)|chartohex(clist[1]);
				chipdata=(chartohex(clist[2])<<4)|chartohex(clist[3]);
				clist[4]=getchar();
				switch(clist[4])
					{
					case '?':
						I2CWrite(chipdata,chipaddr);
						if(!searchchar(s_privte,chipaddr)){
						I2CRead(&chipdata,chipaddr);}
						temp=chipdata&0xF0;
						temp=temp>>4;
						clist[2]=hextochar(temp);
						temp=chipdata&0x0F;
						clist[3]=hextochar(temp);
						clist[4]='!';
						printf("R%s",clist);					 			 
						break;
					case '/':
						I2LWrite(chipdata,chipaddr);
						if(!searchchar(s_privte,chipaddr))
						I2LRead(&chipdata,chipaddr);
						temp=chipdata&0xF0;
						temp=temp>>4;
						clist[2]=hextochar(temp);
						temp=chipdata&0x0F;
						clist[3]=hextochar(temp);
						clist[4]='!';
						printf("R%s",clist);
						break;
					default:
						break;	
					}
			
			}

		else if(temp== 'r' || temp == 'R')
			{
			founderror=0;
			for(i=0;i<4;i++)
				{
				clist[i]=getchar();
				if(isxdigit(clist[i])==0)
					{
					printf("ERROR!");
					founderror=1;
					}
				}
			if(founderror)
				continue;
				chipaddr=(chartohex(clist[0])<<4)|chartohex(clist[1]);
				clist[4]=getchar();
				switch(clist[4])
					{
					case '?':	
						I2CRead(&chipdata,chipaddr);
						temp=chipdata&0xF0;
						temp=temp>>4;
						clist[2]=hextochar(temp);
						temp=chipdata&0x0F;
						clist[3]=hextochar(temp);
						clist[4]='!';
						printf("R%s",clist);				 			 
						break;
					case '/':
						I2LRead(&chipdata,chipaddr);
						temp=chipdata&0xF0;
						temp=temp>>4;
						clist[2]=hextochar(temp);
						temp=chipdata&0x0F;
						clist[3]=hextochar(temp);
						clist[4]='!';
						printf("R%s",clist);				 			 
						break;
					default:
						break;	
					}
			
			}

		else if(temp=='S' || temp == 's')
			{
			founderror=0;
			for(i=0;i<4;i++)
				{
				clist[i]=getchar();
				if(isxdigit(clist[i])==0)
					{
					printf("ERROR!");
					founderror=1;
					}
				}
			if(founderror)
				continue;

				chipaddr=(chartohex(clist[0])<<4)|chartohex(clist[1]);
				chipdata=(chartohex(clist[2])<<4)|chartohex(clist[3]);
				clist[4]=getchar();
				switch(clist[4])
					{
					case '?':
						C072I2CWrite(chipdata,chipaddr);
						if(!searchchar(s_privte,chipaddr)){
						C072I2CRead(&chipdata,chipaddr);}
						temp=chipdata&0xF0;
						temp=temp>>4;
						clist[2]=hextochar(temp);
						temp=chipdata&0x0F;
						clist[3]=hextochar(temp);
						clist[4]='!';
						printf("T%s",clist);					 			 
						break;
					case '/':
						I2LWrite(chipdata,chipaddr);
						if(!searchchar(s_privte,chipaddr))
						I2LRead(&chipdata,chipaddr);
						temp=chipdata&0xF0;
						temp=temp>>4;
						clist[2]=hextochar(temp);
						temp=chipdata&0x0F;
						clist[3]=hextochar(temp);
						clist[4]='!';
						printf("R%s",clist);
						break;
					default:
						break;	
					}
			
			}

		else if(temp== 't' || temp == 'T')
			{
			founderror=0;
			for(i=0;i<4;i++)
				{
				clist[i]=getchar();
				if(isxdigit(clist[i])==0)
					{
					printf("ERROR!");
					founderror=1;
					}
				}
			if(founderror)
				continue;
				chipaddr=(chartohex(clist[0])<<4)|chartohex(clist[1]);
				clist[4]=getchar();
				switch(clist[4])
					{
					case '?':	
						C072I2CRead(&chipdata,chipaddr);
						temp=chipdata&0xF0;
						temp=temp>>4;
						clist[2]=hextochar(temp);
						temp=chipdata&0x0F;
						clist[3]=hextochar(temp);
						clist[4]='!';
						printf("T%s",clist);				 			 
						break;
					case '/':
						I2LRead(&chipdata,chipaddr);
						temp=chipdata&0xF0;
						temp=temp>>4;
						clist[2]=hextochar(temp);
						temp=chipdata&0x0F;
						clist[3]=hextochar(temp);
						clist[4]='!';
						printf("R%s",clist);				 			 
						break;
					default:
						break;	
					}
			
			}
			else
			printf("ERROR!");
};
}

⌨️ 快捷键说明

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