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

📄 maintime.c

📁 7寸TFT电视的源程序
💻 C
字号:
//#define DEBUG_MSG
#include "target.h"
#include "key.h"

unsigned int idata count_timer = 0xffff;
unsigned int idata old_count_timer = 0xffff;
unsigned int idata TimeMessage = 0;
unsigned int idata TVCount = 1;

//bit flagp12 =0;
bit btpowerswitch=1;	//default high
bit btPowerKeyPressed=0;
bit btaccswitch = 1;
unsigned char idata count_key=20;
extern bit bPowerStatus;	 
extern unsigned char idata IrDoubleKeyTimer;
extern unsigned char idata IrDoubleKey;

#ifdef __KEY__
unsigned char TimerReadKey20ms();
unsigned char scankeycount = 0;
#endif


//1ms
void Timer1_Int() interrupt 3 using 2
{
	TR1=0;
	TH1=TIMERH;
	TL1=TIMERL;
	TR1=1;

//	if(flagp12) p12_high();
//	else p12_low();
//	flagp12 = ~flagp12;

	if(count_key!=0xff && count_key>0){
		count_key--;
	}

#ifdef __KEY__
	if(scankeycount<10)
		scankeycount++;
	else
		scankeycount = 0;
#endif

	if((count_timer!=0xffff)&&(count_timer>0))
		count_timer--;

	if((IrDoubleKeyTimer != 0xff) && (IrDoubleKeyTimer>0))
		IrDoubleKeyTimer--;

 
}

void SetTimerFunc(unsigned int count,unsigned int message)
{
	count_timer = count;
	old_count_timer = count_timer;
	TimeMessage = message;
}

/*
void ResetCount()
{
	if(count_timer!=0xff&&count_timer)
		count_timer = old_count_timer;
}

*/
extern void NotDoubleKey();
extern unsigned char ucSystemMode;//adny
void MainTimeHandle()
{
unsigned char uctemp;

#ifdef __TUNER__
	TunerTimeHandle();
#endif

	if(count_key==0){
		count_key=20;
		if(!Read_PowerSwitch()){
			if(btpowerswitch){
				btpowerswitch=0;
			}
		}
		else{
			if(!btpowerswitch){
				btpowerswitch=1;
				
				SaveKeyToBuff(POWER_KEY);
				if( bPowerStatus ){ 
					btPowerKeyPressed = 1;
					 
					//ShowLcdString(0x00,"power on ");
				}
			        
			}
		}

		if(Read_AccSwitch()){
			if(!btaccswitch){
				btaccswitch=1;
			}
		}
		else{
			if(btaccswitch){
				btaccswitch=0;
			}
		}
	}

#ifdef __KEY__
	if(scankeycount==0)
		TimerReadKey20ms();
#endif
	if(count_timer==0){
		count_timer = 0xffff;
		if(TimeMessage)
			SaveKeyToBuff(TimeMessage);
	}

	 
	if(TimeMessage==PS_TIMEOUT){
		uctemp = count_timer % TIME_1SEC;
		if( uctemp ==0){
			uctemp = count_timer / TIME_1SEC;
			uctemp &= 0x1;
			if(uctemp){
				SaveKeyToBuff(REDRAW_KEY);
			}
			else{
				SaveKeyToBuff(CLEARSCREEN_KEY);
			}
		}
	}

	if(IrDoubleKeyTimer ==0){
		NotDoubleKey();
	}
}
 

⌨️ 快捷键说明

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