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

📄 key_process.c

📁 p89lpc915程序
💻 C
字号:
#if 1
#include "comm.h"
#include "key_process.h"
#include "ir.h"
#include "debug.h"

extern uchar user_key;
extern bit ir_enable;
extern int linear_timer;
extern bit power_flag;

#if 0
void power_off()
{
	if(power_flag)
		{
		linear_timer = 30;
		while(linear_timer > 0);
		power_flag = 0;	/*POWER OFF*/
		key_type = KEY_165;
		STANDBY_LED = LED_STANDBY;
		STANDBY_CTRL = CTRL_POWER_OFF;

		linear_timer = 200;
		while(linear_timer > 0);
		ir_enable = 0;
		}
}
#endif

void Rest_Mast_TvBox()
{
	//linear_timer = 30;  /*300Ms  后产生一个复位*/
	//while(linear_timer > 0);
	RST_N = 0;
	delay(1000);/*10MS*/
	RST_N = 1;
	delay(1000);/*10MS*/
	RST_N = 0;
	delay(2000);/*20MS*/
	RST_N = 1;
	delay(500);/*5MS*/

}
void proc_power_key()
{
	if(power_flag)
		{
             /*灯闪烁  在接收POWER OFF 的过程当中*/
		send_ir(MUTE_KEY);
	       //send_ir(_POWER_KEY);  //add zxl 07-10-23
//	       P1M1 = 0x04;//0x04  jian   输出jian add in 08-01-23
//		STANDBY_LED = LED_POWER_ON;

	       P1M1 = 0x06;//0x04  jian   开漏   jian add in 08-01-23	
		STANDBY_LED = LED_STANDBY;


		STANDBY_CTRL = CTRL_POWER_OFF;
		linear_timer = 10;
		while(linear_timer  > 0)
			{
			}
		power_flag = 0;	/*POWER OFF*/
//		proc_ir_sel_disp(4);
		RST_N = 0;  /*复位脚先拉低*/
		}
	else
		{
//	       P1M1 = 0x06;//0x04  jian   开漏   jian add in 08-01-23	
//		STANDBY_LED = LED_STANDBY;
	       P1M1 = 0x04;//0x04  jian   输出jian add in 08-01-23
		STANDBY_LED = LED_POWER_ON;
		
		RST_N = 0;  /*复位脚先拉低*/
		STANDBY_CTRL = CTRL_POWER_ON;				
		//proc_ir_sel_disp(6);  //delete zxl 07-10-09  去除灯闪烁
		Rest_Mast_TvBox();	
		power_flag = 1;	/*POWER ON*/
		
		}
	//linear_timer = 200;
	//while(linear_timer > 0);
	ir_enable = 0;
	user_key = _NO_KEY;
}
void key_service(unsigned char key)
{     
#if 1
	if(key == _POWER_KEY)
		/*||((key == IR_POWER_OFF_KEY)&&(power_flag == 1))||((key == IR_POWER_ON_KEY)&&(power_flag == 0)))*/
		{
		proc_power_key();
		}
	else
		{
		//STANDBY_LED = ~STANDBY_LED;
//		proc_power_key();
	#ifdef DEBUG_PRINTF
		     //  tvbox_printf("send code : ",key, 1);
	#endif	
		//if((key <= MAX_IR_KEY) && (key >= MIN_IR_KEY))	/*CSG 2005-09-06修改,保证让user_key只在规定的key码范围有效*/
			{
			if(power_flag)
				{				
				send_ir(key);
				}
			}
		}
#endif
//send_ir(key);  //add zxl 07-10-23
}

#if 0
void proc_ir_sel_disp(unsigned char i)  /*POWRER 灯闪烁*/
{
       unsigned char j;
	for(j = 0; i > j; j++)
		{
		#if 1
		linear_timer = 30;
		while(linear_timer  > 0)
			{
			}
		#endif
		STANDBY_LED = ~STANDBY_LED;
        
		}
}
#endif

#endif

⌨️ 快捷键说明

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