📄 keypad.lst
字号:
C51 COMPILER V7.50 KEYPAD 07/06/2006 10:40:57 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE KEYPAD
OBJECT MODULE PLACED IN .\obj\Keypad.obj
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE Keypad.c BROWSE DEBUG OBJECTEXTEND PRINT(.\lst\Keypad.lst) OBJECT(.\obj\Key
-pad.obj)
line level source
1 #include "board.h"
2 #include "global.h"
3 #include "misc.h"
4 #include "keypaddef.h"
5 #include "ir.h"
6 #include "power.h"
7 #include "Gm_rwreg.h"
8 #include "debug.h"
9 #include "keypad.h"
10 //#include ""
11 #if DebugIRCode
extern BYTE xdata IRDebugCode0;
extern BYTE xdata IRDebugCode1;
extern BYTE xdata IRDebugData;
#endif
16
17 #if TEST_IR_KEY
extern BYTE IR_Data_Backup;
#endif
20
21 BYTE KeypadButton = BTN_Nothing;
22
23 BYTE Key_GetKeypadStatus(void)
24 {
25 1 return hwKeyPort;
26 1 }
27
28
29 void Key_ScanKeypad(void)
30 {
31 1 BYTE keypadStatus,keypadStatus2;
32 1
33 1
34 1 keypadStatus=(Key_GetKeypadStatus()^KeypadMask)&KeypadMask;
35 1
36 1 if(keypadStatus)//remove jitter
37 1 {
38 2 ForceDelay1ms(20);
39 2
40 2 keypadStatus2=(Key_GetKeypadStatus()^KeypadMask)&KeypadMask;
41 2
42 2 if(keypadStatus!=keypadStatus2)
43 2 keypadStatus = 0;
44 2
45 2 Clr_IRKeyReceiveFlag();
46 2
47 2 }
48 1 else
49 1 {
50 2
51 2
52 2 keypadStatus = Get_IR_Key();
53 2 //printData("IR-Key=0x%x", keypadStatus);
54 2 //Tom added it to solve the ir value is not zero when there is no input
C51 COMPILER V7.50 KEYPAD 07/06/2006 10:40:57 PAGE 2
55 2 //so the ir value can't be defined as zero
56 2 //if (keypadStatus == KEY_NOTHING)
57 2 // keypadStatus = 0;
58 2 //end
59 2
60 2 #if TEST_IR_KEY
printData("IR_Data_Backup=0x%x", IR_Data_Backup);
#endif
63 2
64 2 //if(keypadStatus)
65 2 if (keypadStatus != KEY_NOTHING)
66 2 {
67 3 printData("IR-Key=0x%x", keypadStatus);
68 3 Set_IRKeyReceiveFlag();
69 3 }
70 2 else
71 2 Clr_IRKeyReceiveFlag();
72 2 }
73 1
74 1
75 1
76 1
77 1 //if (keypadStatus)
78 1 if (keypadStatus != KEY_NOTHING)
79 1 {
80 2 if (keypadStatus==KEY_PLUS)
81 2 {
82 3 gm_sendByte(Key_VolumeUp|CMD_HEAD_KEY);
83 3 }
84 2 else if (keypadStatus==KEY_MINUS)
85 2 {
86 3 gm_sendByte(Key_VolumeDown|CMD_HEAD_KEY);
87 3 }
88 2 else if (keypadStatus==KEY_MENUENTER)
89 2 {
90 3 //if (KeypadButton==BTN_MenuEnter|| KeypadButton==BTN_Repeat)
91 3 // KeypadButton=BTN_Repeat;
92 3 //else
93 3 //{
94 3 // KeypadButton=BTN_MenuEnter;
95 3 gm_sendByte(Key_MenuEnter|CMD_HEAD_KEY);
96 3 //}
97 3 }
98 2 else if (keypadStatus==KEY_SOURCESWITCH)
99 2 {
100 3 //if (KeypadButton==BTN_SourceSwitch|| KeypadButton==BTN_Repeat)
101 3 // KeypadButton=BTN_Repeat;
102 3 //else
103 3 //{
104 3 //KeypadButton=BTN_SourceSwitch;
105 3 gm_sendByte(Key_SourceKey|CMD_HEAD_KEY);
106 3 //}
107 3 }
108 2 else if (keypadStatus==KEY_POWER)
109 2 {
110 3 if (KeypadButton == BTN_Power || KeypadButton == BTN_Repeat)
111 3 KeypadButton = BTN_Repeat;
112 3 else
113 3 {
114 4
115 4 #if 1
116 4 if (gm_StandbyHi())
C51 COMPILER V7.50 KEYPAD 07/06/2006 10:40:57 PAGE 3
117 4 //if (!PowerOnFlag)
118 4 {
119 5 // printMsg("standby high, standby high");
120 5 Clr_gm_Standby();
121 5 Set_DoPowerOnFlag();
122 5 Set_PowerOnStatus();
123 5 ForceDelay1ms(1);
124 5 // cmd_Power_Handler = POWER_ON_SYSTEM;
125 5 }
126 4 else
127 4 {
128 5 Clr_DoPowerOnFlag();
129 5 }
130 4 #endif
131 4
132 4 KeypadButton=BTN_Power;
133 4 gm_sendByte(Key_PowerKey|CMD_HEAD_KEY);
134 4 #if 0
if (!PowerOnFlag)
{
//Set_gm_Standby();
Set_PowerOnFlag();
ForceDelay1ms(1);
cmd_Power_Handler = POWER_ON_SYSTEM;
}
#endif
143 4 }
144 3 }
145 2 else if (keypadStatus==KEY_UP)
146 2 {
147 3 //if (KeypadButton == BTN_Up||KeypadButton == BTN_Repeat)
148 3 // KeypadButton = BTN_Repeat;
149 3 //else
150 3 //{
151 3 // KeypadButton = BTN_Up;
152 3 gm_sendByte(Key_ChannelUp|CMD_HEAD_KEY);
153 3 //}
154 3 }
155 2 else if (keypadStatus==KEY_DOWN)
156 2 {
157 3 //if (KeypadButton == BTN_Down||KeypadButton == BTN_Repeat)
158 3 // KeypadButton = BTN_Repeat;
159 3 //else
160 3 //{
161 3 // KeypadButton = BTN_Down;
162 3 gm_sendByte(Key_ChannelDown|CMD_HEAD_KEY);
163 3 //}
164 3
165 3 }
166 2 else if (keypadStatus == KEY_ENTERKEY)
167 2 {
168 3 //if (KeypadButton == BTN_EnterKey || KeypadButton == BTN_Repeat)
169 3 // KeypadButton = BTN_Repeat;
170 3 //else
171 3 //{
172 3 // KeypadButton=BTN_EnterKey;
173 3 gm_sendByte(Key_EnterKey|CMD_HEAD_KEY);
174 3 //}
175 3 }
176 2
177 2
178 2 //IR KEY----------------
C51 COMPILER V7.50 KEYPAD 07/06/2006 10:40:57 PAGE 4
179 2 else if (keypadStatus == KEY_IR_0)
180 2 {
181 3 //if (KeypadButton==BTN_IR_0 || KeypadButton==BTN_Repeat)
182 3 // KeypadButton=BTN_Repeat;
183 3 //else
184 3 //{
185 3 // KeypadButton=BTN_IR_0;
186 3 gm_sendByte(Key_IR_Zero);
187 3 //}
188 3 }
189 2 else if (keypadStatus == KEY_IR_1)
190 2 {
191 3
192 3 //if (KeypadButton==BTN_IR_1 || KeypadButton==BTN_Repeat)
193 3 // KeypadButton=BTN_Repeat;
194 3 //else
195 3 //{
196 3 // KeypadButton=BTN_IR_1;
197 3 gm_sendByte(Key_IR_One);
198 3 //}
199 3 }
200 2 else if (keypadStatus == KEY_IR_2)
201 2 {
202 3 //if (KeypadButton==BTN_IR_2 || KeypadButton==BTN_Repeat)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -