?? keypad.lst
字號:
C51 COMPILER V7.50 KEYPAD 06/16/2006 15:29:44 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE KEYPAD
OBJECT MODULE PLACED IN .\Obj\KEYPAD.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Source\T100\KEYPAD.C BROWSE INCDIR(.\Include\;.\Source\;.\Include\Panel\;.\
-Include\GammaTable\) DEFINE(T112) DEBUG OBJECTEXTEND PRINT(.\KEYPAD.lst) OBJECT(.\Obj\KEYPAD.obj)
line level source
1 //---------------------------------------------------------------------------
2 // Terawins Inc. Company Confidential Strictly Private
3 //
4 // $Archive: Keypad.c $
5 // $Revision: 0.01 $
6 // $Author: jwang $
7 // $Date: 2002/06/19 23:49:23 $
8 //
9 // --------------------------------------------------------------------------
10 // >>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
11 // --------------------------------------------------------------------------
12 // Copyright 2002 (c) Terawins Inc.
13 // This is an unpublished work.
14 // --------------------------------------------------------------------------
15 #include "reg51.h"
16 #include "common.h"
17 #include "System.h"
18 #include "Struct.h"
19 #include "Keypad.h"
20 #include "TW10xReg.h"
21 #include "OSDDraw.h"
22 #include "OSDCtrl.h"
23 #include "TwoWire.h"
24 #include "Display.h"
25 #include "T101_Util.h"
26
27 extern void CVBS_S1(void);
28 extern void CVBS_S2(void);
29 extern void CVBS_S3(void);
30 extern void CVBS_S4(void);
31 extern void SVideo_S(void);
32
33
34 #ifdef T515
void switch_T515(uCHAR);
#endif
37
38
39 #ifdef TIMER0
40 extern void Timer0Reset(void);
41 extern void Timer0Stop(void);
42 extern void Timer0Start(void);
43 #endif
44
45
46 extern bit m_bKyPowerOn;
47 extern uWORD code ucaZoomDataP0_NTSC[];
48 extern uCHAR SignalDefine; // add by Sherman 06'02'23
49
50 typedef struct tag_sKEYPAD_FLD
51 {
52 uCHAR cAddress; // Address of field
53 uCHAR cMask; // Mask for field after shifted right
54 uCHAR cFlagsShift; // Flags & Shift byte:
C51 COMPILER V7.50 KEYPAD 06/16/2006 15:29:44 PAGE 2
55 // [7] Type: 1=external, 0=internal
56 // [6] Polarity: 1=high true, 0=low true
57 // [4] Shift direction: 1=left, 0=right
58 // [2:0] Shift to Right Justify
59 } sKEYPADFLD;
60
61 #define nKEYFLDS 1
62
63 sKEYPADFLD code sKeyFlds={
64 //PORT MASK FLAGS/SHIFT
65 KEYPORT2, 0x3f, 0x00
66 };
67
68 uCHAR idata m_cCurreKey;
69 uCHAR idata m_cPreKey;
70 uWORD idata m_wAccelPollCnt;
71 uCHAR idata m_cItem;
72
73 extern uCHAR idata m_cTV_Num;
74 extern bit m_bTV_Num_Bits;
75
76 extern bit m_bFactryReady;
77 extern bit m_bFactryMode;
78 extern uCHAR m_cFactryCnt;
79
80 extern bit m_bRelease;
81 extern bit m_bChipPowerOn;
82 extern bit m_bKyBlocked;
83 extern uCHAR idata m_cOSDEvent;
84 extern uCHAR idata m_cOSDFunc;
85 extern uCHAR idata m_cOSDMenu;
86 extern uCHAR idata m_cSource;
87
88 extern uWORD idata m_wBuff[3];
89 extern uCHAR idata m_cBuff[5];
90 extern uDWORD m_dwBuff[2];
91 extern uCHAR idata m_cScaleratio;
92 extern uWORD m_wHRes;
93 extern uWORD m_wVRes;
94 extern uWORD idata m_wVTotal;
95 extern uCHAR idata m_cStandard;
96 extern uCHAR idata m_cChroma;
97 void kyKeypadInit(void)
98 {
99 1 m_wAccelPollCnt=0;
100 1 m_cCurreKey=m_cPreKey=0xFF;
101 1 m_cOSDEvent=0;
102 1 m_cOSDFunc=0;
103 1 m_cOSDMenu=idNULLMENU;
104 1 m_cItem=1;
105 1 }
106
107 void kyKeypad(void)
108 {
109 1 if(kyKeypadScan())
110 1 {
111 2 Timer0Reset();
112 2 kyFindFunc();
113 2 }
114 1 else
115 1 m_cPreKey=m_cCurreKey;
116 1 }
C51 COMPILER V7.50 KEYPAD 06/16/2006 15:29:44 PAGE 3
117
118 bit kyKeypadScan(void)
119 {
120 1 uCHAR cTemp;
121 1 while(1)
122 1 {
123 2 cTemp=ReadPort();
124 2 m_cCurreKey=sKeyFlds.cMask&(0xFF-cTemp);
125 2 #if 1
126 2 if(m_cCurreKey==kySOURCE || m_cCurreKey==kyMENU || m_cCurreKey==kyPOWER)
127 2 {
128 3 if(!m_bRelease)
129 3 {
130 4 m_bRelease=1;
131 4 return 1;
132 4 }
133 3 }
134 2 else
135 2 {
136 3 m_bRelease=0;
137 3 if(m_cCurreKey)
138 3 return 1;
139 3 if(!m_cCurreKey) //no key pressed
140 3 return 0;
141 3 }
142 2 #else
if(m_cCurreKey==m_cPreKey)
return 0;
else
return 1;
#endif
148 2 }
149 1 }
150
151 void kyFindFunc(void)
152 {
153 1 #if 1
154 1 if(m_cCurreKey==m_cPreKey)
155 1 {
156 2 if(!kyIncPollCount())
157 2 {
158 3 if(kyFindEvent())
159 3 OSDEventMgr();
160 3 }
161 2 }
162 1 else
163 1 {
164 2 if(kyFindEvent())
165 2 {
166 3 if(m_cOSDEvent!=FUNCOUNT)
167 3 OSDEventMgr();
168 3 m_cPreKey=m_cCurreKey;
169 3 m_wAccelPollCnt=0;
170 3 kyIncPollCount();
171 3 }
172 2 }
173 1 #else
kyFindEvent();
#endif
176 1 }
177
178 uCHAR ReadPort(void)
C51 COMPILER V7.50 KEYPAD 06/16/2006 15:29:44 PAGE 4
179 {
180 1 uCHAR cKey;
181 1 switch(sKeyFlds.cAddress){
182 2 case 0: cKey=P0; break;
183 2 case 1: cKey=P1; break;
184 2 case 2: cKey=P2; break;
185 2 case 3: cKey=P3; break;
186 2 }
187 1 return cKey;
188 1 }
189
190
191 extern bit m_bAdjRGBColor;
192 bit kyFindEvent(void)
193 {
194 1 if(m_cCurreKey==kySOURCE)
195 1 {
196 2 return IRSourceSelKeyCtrl();//kyEXITEvent();
197 2 }
198 1 else if(m_cCurreKey==kyMENU)
199 1 {
200 2 return kyMENUEvent();
201 2 }
202 1 else if(m_cCurreKey==kyINCREASE)
203 1 {
204 2 return kyINCREASEEvent();
205 2 }
206 1 else if(m_cCurreKey==kyDECREASE)
207 1 {
208 2 return kyDECREASEEvent();
209 2 }
210 1 else if(m_cCurreKey==kyEXIT)
211 1 {
212 2 if(m_cOSDFunc == 0)
213 2 {
214 3 return IRNTSC_PALCtrl();
215 3 }
216 2 else
217 2 {
218 3 return IRDownKeyCtrl();
219 3 }
220 2
221 2 }
222 1 else if(m_cCurreKey==kyPOWER)
223 1 {
224 2 return kyPOWEREvent();
225 2 }
226 1 }
227
228 //Ruby add 2004-06-07
229 bit kySCALEREvent(void)
230 {
231 1 uCHAR SlaveAddr,RegAddrShift;
232 1 m_cScaleratio++;
233 1 if(m_cScaleratio>=ScaleEnd)
234 1 m_cScaleratio=ScaleFULL;
235 1 #ifdef T515
if(m_cSource >= isrc_T515_CVIDEO1){
SlaveAddr=0xb8;
RegAddrShift=0x20;
}else{
SlaveAddr=0x54;
C51 COMPILER V7.50 KEYPAD 06/16/2006 15:29:44 PAGE 5
RegAddrShift=0x00;
}
#else
244 1 SlaveAddr=0x54;
245 1 RegAddrShift=0x00;
246 1 #endif
247 1
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -