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

📄 keypad.lst

📁 宏芯T102芯片驱动(51单片机作主控)
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.06   KEYPAD                                                                12/28/2004 10:14:05 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE KEYPAD
OBJECT MODULE PLACED IN .\obj\KEYPAD.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE source\new_osd\KEYPAD.C BROWSE INCDIR(.\include\;.\source\) DEBUG OBJECTEXT
                    -END PRINT(.\KEYPAD.lst) OBJECT(.\obj\KEYPAD.obj)

stmt 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 "TW101Reg.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          
  48          typedef struct tag_sKEYPAD_FLD
  49          {
  50              uCHAR cAddress;     // Address of field
  51              uCHAR cMask;        // Mask for field after shifted right
  52              uCHAR cFlagsShift;  // Flags & Shift byte:
  53                                  // [7] Type: 1=external, 0=internal
  54                                  // [6] Polarity: 1=high true, 0=low true
C51 COMPILER V7.06   KEYPAD                                                                12/28/2004 10:14:05 PAGE 2   

  55                                  // [4] Shift direction: 1=left, 0=right
  56                                  // [2:0] Shift to Right Justify
  57          } sKEYPADFLD;
  58          
  59          #define nKEYFLDS        1
  60          
  61          sKEYPADFLD code sKeyFlds={
  62              //PORT  MASK  FLAGS/SHIFT
  63              KEYPORT2, 0x3f, 0x00
  64          };
  65          
  66          uCHAR idata m_cCurreKey;
  67          uCHAR idata m_cPreKey;
  68          uWORD idata m_wAccelPollCnt;
  69          uCHAR idata m_cItem;
  70          
  71          extern uCHAR idata m_cTV_Num;
  72          extern bit m_bTV_Num_Bits;
  73          
  74          extern bit m_bFactryReady;
  75          extern bit m_bFactryMode;
  76          extern uCHAR m_cFactryCnt;
  77          
  78          extern bit m_bRelease;
  79          extern bit m_bChipPowerOn;
  80          extern bit m_bKyBlocked;
  81          extern uCHAR idata m_cOSDEvent;
  82          extern uCHAR idata m_cOSDFunc;
  83          extern uCHAR idata m_cSource;
  84          
  85          extern uWORD idata m_wBuff[3];
  86          extern uCHAR idata m_cBuff[5];
  87          extern uDWORD m_dwBuff[2];
  88          extern uCHAR idata m_cScaleratio;
  89          extern uWORD m_wHRes;
  90          extern uWORD m_wVRes;
  91          extern uWORD idata m_wVTotal;
  92          extern uCHAR idata m_cStandard;
  93          void kyKeypadInit(void)
  94          {
  95   1              m_wAccelPollCnt=0;
  96   1              m_cCurreKey=m_cPreKey=0xFF;
  97   1              m_cOSDEvent=0;
  98   1              m_cOSDFunc=0;
  99   1              m_cItem=1;
 100   1      }
 101          
 102          void kyKeypad(void)
 103          {
 104   1              if(kyKeypadScan())
 105   1              {
 106   2                      Timer0Reset();
 107   2                      kyFindFunc();
 108   2              }
 109   1              else
 110   1                      m_cPreKey=m_cCurreKey;
 111   1      }
 112          
 113          bit kyKeypadScan(void)
 114          {
 115   1              uCHAR cTemp;
 116   1              while(1)
C51 COMPILER V7.06   KEYPAD                                                                12/28/2004 10:14:05 PAGE 3   

 117   1              {
 118   2                      cTemp=ReadPort();
 119   2                      m_cCurreKey=sKeyFlds.cMask&(0xFF-cTemp);
 120   2      #if 1
 121   2                      if(m_cCurreKey==kySOURCE || m_cCurreKey==kyMENU || m_cCurreKey==kyPOWER)
 122   2                      {
 123   3                              if(!m_bRelease)
 124   3                              {
 125   4                                      m_bRelease=1;
 126   4                                      return 1;
 127   4                              }
 128   3                      }
 129   2                      else
 130   2                      {
 131   3                              m_bRelease=0;
 132   3                              if(m_cCurreKey)
 133   3                                      return 1;
 134   3                              if(!m_cCurreKey) //no key pressed
 135   3                                      return 0;
 136   3                      }
 137   2      #else
                      if(m_cCurreKey==m_cPreKey)
                              return 0;
                      else
                              return 1;
              #endif
 143   2              }
 144   1      }
 145          
 146          void kyFindFunc(void)
 147          {
 148   1      #if 1
 149   1              if(m_cCurreKey==m_cPreKey)
 150   1              {
 151   2                      if(!kyIncPollCount())
 152   2                      {
 153   3                      if(kyFindEvent())
 154   3                                      OSDEventMgr();
 155   3                      }
 156   2              }
 157   1              else
 158   1              {
 159   2                      if(kyFindEvent())
 160   2                      {
 161   3                              if(m_cOSDEvent!=FUNCOUNT)
 162   3                                      OSDEventMgr();
 163   3                              m_cPreKey=m_cCurreKey;
 164   3                              m_wAccelPollCnt=0;
 165   3                              kyIncPollCount();
 166   3                      }
 167   2              }
 168   1      #else
                      kyFindEvent();
              #endif
 171   1      }
 172          
 173          uCHAR ReadPort(void)
 174          {
 175   1          uCHAR cKey;
 176   1          switch(sKeyFlds.cAddress){
 177   2          case 0:     cKey=P0; break;
 178   2          case 1:     cKey=P1; break;
C51 COMPILER V7.06   KEYPAD                                                                12/28/2004 10:14:05 PAGE 4   

 179   2          case 2: cKey=P2; break;
 180   2          case 3: cKey=P3; break;
 181   2          }
 182   1          return cKey;
 183   1      }
 184          
 185          
 186          extern bit m_bAdjRGBColor;
 187          bit kyFindEvent(void)
 188          {
 189   1              if(m_cCurreKey==kySOURCE)
 190   1              {
 191   2                  return IRSourceSelKeyCtrl();//kyEXITEvent();
 192   2              }
 193   1              else if(m_cCurreKey==kyMENU)
 194   1              {
 195   2                      return kyMENUEvent();
 196   2              }
 197   1              else if(m_cCurreKey==kyINCREASE)
 198   1              {
 199   2                      return kyINCREASEEvent();
 200   2              }
 201   1              else if(m_cCurreKey==kyDECREASE)
 202   1              {
 203   2                      return kyDECREASEEvent();
 204   2              }
 205   1              else if(m_cCurreKey==kyEXIT)
 206   1              {
 207   2              if(m_cOSDFunc == 0)
 208   2                      {
 209   3                          return IRNTSC_PALCtrl();
 210   3                      }
 211   2                      else
 212   2                      {
 213   3                  return IRDownKeyCtrl();
 214   3                      }//Kuo
 215   2      
 216   2                      
 217   2      //kyEXITEvent();//IRSourceSelKeyCtrl();
 218   2      //              return rmP_STDEvent();
 219   2              }
 220   1              else if(m_cCurreKey==kyPOWER)
 221   1              {
 222   2                      return kyPOWEREvent();
 223   2              }
 224   1      }
 225          
 226          //Ruby add 2004-06-07
 227          bit kySCALEREvent(void)
 228          {
 229   1         m_cScaleratio++;
 230   1         if(m_cScaleratio>=ScaleEnd)
 231   1           m_cScaleratio=ScaleFULL;
 232   1         IRScaleratioCtrl();
 233   1         OSDShowRatio();
 234   1         return 1;
 235   1      }
 236          
 237          bit kyMENUEvent(void)
 238          {
 239   1              if(m_bKyBlocked)
 240   1                      return 0;
C51 COMPILER V7.06   KEYPAD                                                                12/28/2004 10:14:05 PAGE 5   

 241   1      
 242   1      #ifdef TV
 243   1      
 244   1          if((m_cOSDFunc&0xF0)==idTVMENU_VIDEO)
 245   1              {
 246   2              m_cOSDEvent=CLOSEMENU;
 247   2                      m_cItem=1;
 248   2                      return 1;
 249   2              }
 250   1      
 251   1      
 252   1      /*
 253   1          if((m_cOSDFunc&0xF0)==idTVMENU_VIDEO)
 254   1              {
 255   1                  m_cOSDFunc=idBRIGHTMENU;
 256   1                      m_cOSDEvent=FUNCENTER;
 257   1                      m_cItem=1;
 258   1                      return 1;
 259   1              }
 260   1      */
 261   1      
 262   1      #endif
 263   1      

⌨️ 快捷键说明

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