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

📄 ir.h

📁 mcu for gm5621带遥控,键盘输入的单片机代码.供学习参考使用.谢谢.
💻 H
字号:
#ifndef _IR_H
#define _IR_H

extern BYTE IR_ErrTimeCount;
extern BYTE IR_Status;
extern WORD code IR_Parameter_Table[];
extern BYTE code IR_Customer_Code[];
extern BYTE code IR_Key_Table[];

#define IR_Count_Per_us CPU_CLOCK_KHZ/12000
#define IR_ErrTimeCountTorlance	15		//jt update 2004-04-27
#define IR_Lead_Periodus          13500 //us
#define IR_Repeat_Lead_Periodus   11250 //us		
#define IR_0_Periodus             1125  //us
#define IR_1_Periodus             2250  //us

#define IR_Timer_Periodus         20000 //us

#define IR_Torlanceus     ((unsigned long)(IR_1_Periodus-IR_0_Periodus)/2)     //ms

#define IR_0_MinCount     (DWORD)((unsigned long)(IR_0_Periodus-IR_Torlanceus)*IR_Count_Per_us)
#define IR_0_MaxCount     (DWORD)((unsigned long)(IR_0_Periodus+IR_Torlanceus)*IR_Count_Per_us)

#define IR_1_MinCount     (DWORD)((unsigned long)(IR_1_Periodus-IR_Torlanceus)*IR_Count_Per_us)
#define IR_1_MaxCount     (DWORD)((unsigned long)(IR_1_Periodus+IR_Torlanceus)*IR_Count_Per_us)

#define IR_Lead_MinCount  (DWORD)((unsigned long)(IR_Lead_Periodus-IR_Torlanceus)*IR_Count_Per_us)
#define IR_Lead_MaxCount  (DWORD)((unsigned long)(IR_Lead_Periodus+IR_Torlanceus)*IR_Count_Per_us)

#define IR_Repeat_MinCount     (DWORD)((unsigned long)(IR_Repeat_Lead_Periodus-IR_Torlanceus)*IR_Count_Per_us)
#define IR_Repeat_MaxCount     (DWORD)((unsigned long)(IR_Repeat_Lead_Periodus+IR_Torlanceus)*IR_Count_Per_us)

#define IR_Timer_Counter  (DWORD)(0x10000-(unsigned long)IR_Timer_Periodus*IR_Count_Per_us)		//jt update 2004-04-05
#if RC500T
#define CustomerCode0 0x00
#define CustomerCode1 0xff//0x99
#elif RC503
#define CustomerCode0  0x02           //km for new ir code 20041126
#define CustomerCode1  0xfd
#elif RC100
#define CustomerCode0  0x20           
#define CustomerCode1  0xdf
#elif TO002
#define CustomerCode0  0x50//0x00        
#define CustomerCode1  0xad//0xff
#elif TO011
#define CustomerCode0  0x86        
#define CustomerCode1  0x6b
#endif

#define bIR_ResetBit         BIT0
#define bIR_Data_OKBit       BIT1
#define bIR_DebugCustomerCode0_OKBit BIT2
#define bIR_DebugCustomerCode1_OKBit BIT3
#define bIR_DebugData_OKBit          BIT4


#define IR_ResetFlag          (IR_Status&bIR_ResetBit)
#define IR_Data_OKFlag        (IR_Status&bIR_Data_OKBit)
#define IR_DebugCustomerCode0_OKFlag  (IR_Status&bIR_DebugCustomerCode0_OKBit)
#define IR_DebugCustomerCode1_OKFlag  (IR_Status&bIR_DebugCustomerCode1_OKBit)
#define IR_DebugData_OKFlag           (IR_Status&bIR_DebugData_OKBit)

#define Set_IR_ResetFlag()    (IR_Status|=bIR_ResetBit)
#define Clr_IR_ResetFlag()    (IR_Status&=~bIR_ResetBit)

#define Set_IR_Data_OKFlag()  (IR_Status|=bIR_Data_OKBit)
#define Clr_IR_Data_OKFlag()  (IR_Status&=~bIR_Data_OKBit)

#define Set_IR_DebugCustomerCode0_OKFlag()  (IR_Status|=bIR_DebugCustomerCode0_OKBit)
#define Clr_IR_DebugCustomerCode0_OKFlag()  (IR_Status&=~bIR_DebugCustomerCode0_OKBit)

#define Set_IR_DebugCustomerCode1_OKFlag()  (IR_Status|=bIR_DebugCustomerCode1_OKBit)
#define Clr_IR_DebugCustomerCode1_OKFlag()  (IR_Status&=~bIR_DebugCustomerCode1_OKBit)

#define Set_IR_DebugData_OKFlag()  (IR_Status|=bIR_DebugData_OKBit)
#define Clr_IR_DebugData_OKFlag()  (IR_Status&=~bIR_DebugData_OKBit)


extern void IR_Init(void);
extern BYTE Get_IR_Key(void);
//extern void Reset_Ir_Key(void);
//extern void DebugIRHandler(void);

#if 0
typedef enum
{
	Key_None,
	Key_Info,
	Key_MenuEnter,
	Key_ADC_2_MENUEXIT,
	Key_Teletext_CC,
	Key_IR_SWAP,
	Key_PIP_Size,
	Key_F4,
	Key_Sub,
	Key_Aspect,
	Key_IR_Zero,
	Key_IR_One,
	Key_IR_Two,
	Key_IR_Three,
	Key_IR_Four,
	Key_IR_Five,
	Key_IR_Six,
	Key_IR_Seven,
	Key_IR_Eight,
	Key_IR_Nine,
	Key_ChannelUp,
	Key_ADC_1_CHANNEL_UP,
	Key_ChannelDown,
	Key_ADC_2_CHANNEL_DOWN,
	Key_Enter_Jump,
	Key_VolumeUp,
	Key_ADC_1_VOLUME_UP,
	Key_VolumeDown,
	Key_ADC_2_VOLUME_DOWN,
	Key_Up,
	Key_ADC_2_UP,
	Key_Down,
	Key_ADC_2_DOWN,
	Key_Exit,
	Key_SourceKey,
	Key_ADC_1_SOURCE,
	Key_Left,
	Key_ADC_2_LEFT,
	Key_Right,
	Key_ADC_2_RIGHT,
	Key_EnterKey,
	Key_ADC_2_ENTER,
	Key_Freeze,
	Key_ADC_1_KEYSTONE,
	Key_IR_PIP,
	Key_ADC_1_PIP,
	Key_PowerKey,
	Key_ADC_1_POWER,
	Key_ADC_1_AUTO,
	Key_F1,
	Key_F2,
	Key_F3,
	Key_Hold,
	Key_Reveal,
	Key_Size,
	Key_Cancel,
	Key_Mode,
	Key_Index,
	Key_Mute,
	Key_ADC_1_SWITCH,
	WBK_NUMBER_OF_KEYS = 59
}WBK_Keys;
#else
typedef enum 
{
	Key_None,			// 0
	Key_Info,			// 1
	Key_MenuEnter,		// 2	
	Key_ADC_2_MENUEXIT,  // 3
	Key_Teletext_CC,	// 4
	Key_IR_SWAP,		// 5
	Key_PIP_Size,		// 6
	Key_Sub,			// 7
	Key_Aspect,			// 8
	Key_IR_Zero,			// 9
	Key_IR_One,			//10
	Key_IR_Two,			//11
	Key_IR_Three,		//12
	Key_IR_Four,		//13
	Key_IR_Five,			//14
	Key_IR_Six,			//15
	Key_IR_Seven,		//16	
	Key_IR_Eight,		//17
	Key_IR_Nine,		//18
	Key_ChannelUp,		//19
	Key_ChannelDown,	//20	
	Key_Enter_Jump,		//21
	Key_VolumeUp,		//22
	Key_ADC_1_VOLUME_UP,		//23
	Key_VolumeDown,		//24
	Key_ADC_2_VOLUME_DOWN,		//25
	Key_Up,		//26
	Key_ADC_2_UP,		//27
	Key_Down,		//28
	Key_ADC_2_DOWN,	//29
	Key_Exit,	//30
	Key_SourceKey,		//31
	Key_ADC_1_SOURCE,		//32
	Key_Left,		//33
	Key_ADC_2_LEFT,		//34
	Key_Right,		//35
	Key_ADC_2_RIGHT,	//36
	Key_EnterKey,		//37
	Key_ADC_2_ENTER,	//38
	Key_Freeze,			//39
	Key_ADC_1_KEYSTONE,	//40
	Key_IR_PIP,		//41
	Key_ADC_1_PIP,		//42
	Key_PowerKey,		//43
	Key_ADC_1_POWER,		//44
	Key_ADC_1_AUTO,		//45
	Key_ADC_1_CHANNEL_UP,		//46
	Key_ADC_2_CHANNEL_DOWN,		//47
	Key_F1,			//48
	Key_F2,			//49
	Key_F3,			//50
	Key_F4,			//51
	Key_Hold,
	Key_Reveal,
	Key_Size,
	Key_Cancel,
	Key_Mode,
	Key_Index,
	Key_Mute,
	Key_ADC_1_SWITCH,
	WBK_NUMBER_OF_KEYS = 59
} WBK_Keys;
#endif

#endif

⌨️ 快捷键说明

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