📄 keypad.lst
字号:
C51 COMPILER V7.50 KEYPAD 10/30/2006 16:14:45 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\T103\KEYPAD.C LARGE OPTIMIZE(6,SPEED) BROWSE INCDIR(.\Include\;.\Sou
-rce\;.\Include\Panel\;.\Include\GammaTable\;.\Include\tuner\) DEFINE(T103) 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
18 #include "Struct.h"
19 #include "System.h"
20
21 #include "SRC_ctrl.h"
22 #include "Keypad.h"
23 #include "TW803Reg.h"
24 #include "OSDDraw.h"
25 #include "OSDCtrl.h"
26 #include "TwoWire.h"
27 #include "Display.h"
28 #include "T803_Util.h"
29 #include "timer0.h"
30 #include "Global.h"
31
32 extern uWORD code ucaZoomDataP0_NTSC[];
33
34 typedef struct tag_sKEYPAD_FLD
35 {
36 uCHAR cAddress; // Address of field
37 uCHAR cMask; // Mask for field after shifted right
38 uCHAR cFlagsShift; // Flags & Shift byte:
39 // [7] Type: 1=external, 0=internal
40 // [6] Polarity: 1=high true, 0=low true
41 // [4] Shift direction: 1=left, 0=right
42 // [2:0] Shift to Right Justify
43 } sKEYPADFLD;
44
45 #define nKEYFLDS 1
46
47 sKEYPADFLD code sKeyFlds={
48 //PORT MASK FLAGS/SHIFT
49 KEYPORT2, 0x3f, 0x00
50 };
51
52 void kyKeypadInit(void)
53 {
C51 COMPILER V7.50 KEYPAD 10/30/2006 16:14:45 PAGE 2
54 1 m_wAccelPollCnt=0;
55 1 m_cCurreKey=m_cPreKey=0xFF;
56 1 m_cOSDEvent=0;
57 1 m_cOSDFunc=0;
58 1 m_cOSDMenu=idNULLMENU;
59 1 m_cItem=1;
60 1 }
61
62 void kyKeypad(void)
63 {
64 1 if(kyKeypadScan())
65 1 {
66 2 Timer0Reset();
67 2 kyFindFunc();
68 2 }
69 1 else
70 1 m_cPreKey=m_cCurreKey;
71 1 }
72
73 bit kyKeypadScan(void)
74 {
75 1 uCHAR cTemp;
76 1 while(1)
77 1 {
78 2 cTemp=ReadPort();
79 2 m_cCurreKey=sKeyFlds.cMask&(0xFF-cTemp);
80 2 #if 1
81 2 if(m_cCurreKey==kySOURCE || m_cCurreKey==kyMENU || m_cCurreKey==kyPOWER)
82 2 {
83 3 if(!m_bRelease)
84 3 {
85 4 m_bRelease=1;
86 4 return 1;
87 4 }
88 3 }
89 2 else
90 2 {
91 3 m_bRelease=0;
92 3 if(m_cCurreKey)
93 3 return 1;
94 3 if(!m_cCurreKey) //no key pressed
95 3 return 0;
96 3 }
97 2 #else
if(m_cCurreKey==m_cPreKey)
return 0;
else
return 1;
#endif
103 2 }
104 1 }
105
106 void kyFindFunc(void)
107 {
108 1 #if 1
109 1 if(m_cCurreKey==m_cPreKey)
110 1 {
111 2 if(!kyIncPollCount())
112 2 {
113 3 if(kyFindEvent())
114 3 OSDEventMgr();
115 3 }
C51 COMPILER V7.50 KEYPAD 10/30/2006 16:14:45 PAGE 3
116 2 }
117 1 else
118 1 {
119 2 if(kyFindEvent())
120 2 {
121 3 if(m_cOSDEvent!=FUNCOUNT)
122 3 OSDEventMgr();
123 3 m_cPreKey=m_cCurreKey;
124 3 m_wAccelPollCnt=0;
125 3 kyIncPollCount();
126 3 }
127 2 }
128 1 #else
kyFindEvent();
#endif
131 1 }
132
133 uCHAR ReadPort(void)
134 {
135 1 uCHAR cKey;
136 1 switch(sKeyFlds.cAddress){
137 2 case 0: cKey=P0; break;
138 2 case 1: cKey=P1; break;
139 2 case 2: cKey=P2; break;
140 2 case 3: cKey=P3; break;
141 2 }
142 1 return cKey;
143 1 }
144
145
146 //extern bit m_bAdjRGBColor;
147 bit kyFindEvent(void)
148 {
149 1 if(m_cCurreKey==kySOURCE)
150 1 {
151 2 return IRSourceSelKeyCtrl();//kyEXITEvent();
152 2 }
153 1 else if(m_cCurreKey==kyMENU)
154 1 {
155 2 return kyMENUEvent();
156 2 }
157 1 else if(m_cCurreKey==kyINCREASE)
158 1 {
159 2 return kyINCREASEEvent();
160 2 }
161 1 else if(m_cCurreKey==kyDECREASE)
162 1 {
163 2 return kyDECREASEEvent();
164 2 }
165 1 else if(m_cCurreKey==kyEXIT)
166 1 {
167 2 if(m_cOSDFunc == 0)
168 2 {
169 3 return IRNTSC_PALCtrl();
170 3 }
171 2 else
172 2 {
173 3 return IRDownKeyCtrl();
174 3 }
175 2
176 2 }
177 1 else if(m_cCurreKey==kyPOWER)
C51 COMPILER V7.50 KEYPAD 10/30/2006 16:14:45 PAGE 4
178 1 {
179 2 return kyPOWEREvent();
180 2 }
181 1 }
182
183 //Ruby add 2004-06-07
184 bit kySCALEREvent(void)
185 {
186 1 uCHAR SlaveAddr,RegAddrShift;
187 1 m_cScaleratio++;
188 1 if(m_cScaleratio>=ScaleEnd)
189 1 m_cScaleratio=ScaleFULL;
190 1 #ifdef T515
if(m_cSource >= isrc_T515_CVIDEO1){
SlaveAddr=0xb8;
RegAddrShift=0x20;
}else{
SlaveAddr=0x54;
RegAddrShift=0x00;
}
#else
199 1 SlaveAddr=0x54;
200 1 RegAddrShift=0x00;
201 1 #endif
202 1
203 1 if(I2CReadByte(SlaveAddr, 0x3A+RegAddrShift)&0x06){
204 2 SetOPTiming(); // Add by Sherman 05'11'18
205 2 OSDShowRatio();
206 2 }
207 1 return 1;
208 1 }
209
210 bit kyMENUEvent(void)
211 {
212 1 if(m_bKyBlocked)
213 1 return 0;
214 1
215 1 switch(m_cOSDMenu)
216 1 {
217 2 case idNULLMENU:
218 2 m_cOSDMenu=idVIDEOMENU;m_cOSDFunc=idBRIGHTMENU;m_cOSDEvent=OPENMENU;m_cItem=1;break;
219 2
220 2 #ifdef TV
case idVIDEOMENU:
if((m_cSource&0x0F)==(isrcTV))
{
m_cOSDMenu=idTVMENU;m_cOSDFunc=idBRIGHTMENU;m_cOSDEvent=OPENMENU;m_cItem=1;break;}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -