key.lst

来自「myson的MTV332的DEMO程序 主要功能有菜单的设计和无线遥控以及视频」· LST 代码 · 共 280 行

LST
280
字号
C51 COMPILER V7.09   KEY                                                                   09/06/2006 13:39:48 PAGE 1   


C51 COMPILER V7.09, COMPILATION OF MODULE KEY
OBJECT MODULE PLACED IN ..\OUTPUT\KEY.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\code\KEY.C LARGE ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND PRINT(.\KEY.lst)
                    - OBJECT(..\OUTPUT\KEY.obj)

line level    source

   1          #include "global.h"
   2          
   3          BIT i2c_flag=0;
   4          BYTE HoldKeyIndex = 0 ;
   5          BYTE FactoryKeyIndex= 0 ;
   6          BYTE RecoveryKeyIndex= 0;
   7          
   8          #define KeyCount        5
   9          /****************************************************************************/
  10          void Initial_Key(void)
  11          {
  12   1              OldKey = 0x00;
  13   1              KeyStep = 0;
  14   1              IR_Key = IR_No_Key;
  15   1      }
  16          
  17          /****************************************************************************/
  18          #ifdef _BAUO070_CS7110_M3_
              BYTE ReadKeyPort(void)
              {
                      BYTE tempkey;
                      if(PressPOWERKey)
                              tempkey = POWERKEY;
                      else if(PressMENUKey)
                              tempkey = MENUKEY;
                      else if(PressSELECTKey)
                              tempkey = SELECTKEY;
                      else if(PressUPKey)
                              tempkey = UPKEY;
                      else if(PressDOWNKey)
                              tempkey = DOWNKEY;
                      else
                              tempkey = NOKEY;
                      return tempkey;
              }
              #else
  37          BYTE ReadKeyPort(void)
  38          {
  39   1         BYTE ADPort0; 
  40   1      
  41   1         byMTV_ADC = 0x81;            //Use P5.0 ADC0 pin
  42   1         Short_Delay(500);            //    DELAY10ms(1);//DoWait(2);
  43   1         ADPort0 = byMTV_ADC; //         ADPort0 <<=2;
  44   1      
  45   1              //tempkey = NOKEY;
  46   1              if(KEYPIN0)             
  47   1                      return  SELECTKEY;       
  48   1              else if(KEYPIN1)                
  49   1                      return  UPKEY;
  50   1               else if(KEYPIN2)               
  51   1                      return   MENUKEY;
  52   1               else if(KEYPIN3)               
  53   1                      return  DOWNKEY; 
  54   1               else if(KEYPIN4)
C51 COMPILER V7.09   KEY                                                                   09/06/2006 13:39:48 PAGE 2   

  55   1                      return SHUNTDOWN;
  56   1              else 
  57   1                      return  NOKEY;
  58   1      
  59   1      }
  60          #endif
  61          
  62          /****************************************************************************/
  63          BYTE GetKey(void)
  64          {
  65   1              BYTE temp, keyno;
  66   1      
  67   1              keyno = NOKEY;
  68   1      
  69   1              switch(KeyStep)
  70   1              {
  71   2                      case 0 :   // check key change
  72   2                              
  73   2                              temp = ReadKeyPort();
  74   2                              if( temp != OldKey)
  75   2                              {
  76   3                                      OldKey = temp;
  77   3                                      KeyStep = 1;
  78   3                                      KeyReChkCnt = KEY_STABLE_TIME;
  79   3                              }
  80   2                              
  81   2                      break;  
  82   2                      case 1 :  // wait key stable
  83   2                              if(KeyReChkCnt == 0)
  84   2                              {
  85   3                                      KeyStep = 0;
  86   3                                      temp = ReadKeyPort();
  87   3                                      //keytest = temp;
  88   3                                      if( temp == OldKey)
  89   3                                      {
  90   4                                              keyno = temp;
  91   4                                              if(keyno == UPKEY || keyno == DOWNKEY )
  92   4                                              {
  93   5                                                      KeyStep = 2;
  94   5                                                      KeyReChkCnt = KEY_REPEAT_TIME1;
  95   5                                              }
  96   4                                              else if(keyno == DEBUGKEY)  // i2c debug mode
  97   4                                              {
  98   5                                                      KeyStep = 2;
  99   5                                                      KeyReChkCnt = KEY_DEBUG_TIME;
 100   5                                              }
 101   4                                              else if(keyno == SHUNTDOWN)  // i2c debug mode
 102   4                                              {
 103   5                                                      KeyStep = 2;
 104   5                                                      KeyReChkCnt = 2000;  //Wait 3Second then power off
 105   5                                                      
 106   5                                                      PowerFlag = ~PowerFlag;                                 
 107   5                                                      if(PowerFlag)   
 108   5                                                      {
 109   6                                                              DisableOSD();                           
 110   6                                                              MenuProcess = Disp_Entry;
 111   6                                                              bMenuFlag=0;
 112   6                                                              Res_BKLT;
 113   6                                                              Res_PowerLED;
 114   6                                                      }
 115   5                                                      else    
 116   5                                                      {
C51 COMPILER V7.09   KEY                                                                   09/06/2006 13:39:48 PAGE 3   

 117   6                                                             bVsyncChange = 1;
 118   6                                                             Get_VideoSync();
 119   6                                                              Set_BKLT; //panel on
 120   6                                                              Set_PowerLED;
 121   6                                                      }
 122   5                                              }
 123   4                                      }
 124   3                              }
 125   2                              
 126   2                      break;
 127   2                      case 2 :  // check key repeat
 128   2                              temp = ReadKeyPort();
 129   2                              if( temp != OldKey)
 130   2                                      KeyStep = 0;
 131   2                              
 132   2                              if(KeyReChkCnt == 0)
 133   2                              {
 134   3                                      keyno = temp;
 135   3                                      KeyReChkCnt = KEY_REPEAT_TIME2;         
 136   3                                      if(keyno == DEBUGKEY)  // i2c debug mode
 137   3                                      {
 138   4                                              KeyStep = 0;
 139   4                                              i2c_flag = ~i2c_flag;
 140   4                                              /*
 141   4                                              if(i2c_flag)
 142   4                                                      MenuProcess = Disp_IICHold;
 143   4                                              else
 144   4                                                      MenuProcess = Disp_Entry;
 145   4                                              */
 146   4                                              bMenuFlag = 0;
 147   4                                      }       
 148   3                              }
 149   2                              
 150   2                      break;
 151   2              }
 152   1              
 153   1              return keyno;
 154   1      }
 155          
 156          void CheckIICHoldKey()
 157          {
 158   1              //BYTE code HoldKey[KeyCount]={SELECTKEY,DOWNKEY,SELECTKEY,DOWNKEY,DOWNKEY};
 159   1              BYTE code HoldKey[]={SELECTKEY,SELECTKEY,SELECTKEY,SELECTKEY,SELECTKEY};
 160   1              BYTE code FactoryKey[]={MENUKEY,DOWNKEY,MENUKEY,SELECTKEY,SELECTKEY};
 161   1              BYTE code RecoveryKey[]={SELECTKEY,SELECTKEY,SELECTKEY,SELECTKEY,DOWNKEY};
 162   1              if(KeyNo==NOKEY)
 163   1                      return;
 164   1      
 165   1              if(KeyNo==HoldKey[HoldKeyIndex])
 166   1                      HoldKeyIndex++; 
 167   1              else
 168   1                      HoldKeyIndex=0;
 169   1                      
 170   1              if(KeyNo==FactoryKey[FactoryKeyIndex])
 171   1                      FactoryKeyIndex++;              
 172   1              else
 173   1                      FactoryKeyIndex = 0;
 174   1      
 175   1              if(KeyNo==RecoveryKey[RecoveryKeyIndex])
 176   1                      RecoveryKeyIndex++;             
 177   1              else
 178   1                      RecoveryKeyIndex = 0;
C51 COMPILER V7.09   KEY                                                                   09/06/2006 13:39:48 PAGE 4   

 179   1      
 180   1              
 181   1              if(RecoveryKeyIndex>=KeyCount)
 182   1              {
 183   2                      RecoveryKeyIndex = 0;
 184   2                      Initial_EEPData();
 185   2                      Read_EEPData();
 186   2                      Initial_SystemSetting();
 187   2                      #ifdef _CS7111_
 188   2                      Initial_Video();
 189   2                      #endif
 190   2              }
 191   1      
 192   1              if(HoldKeyIndex>=KeyCount)
 193   1              {
 194   2                      i2c_flag=~i2c_flag;
 195   2                      HoldKeyIndex = 0;
 196   2                      if(i2c_flag)
 197   2                      {
 198   3                              gotoxy(0,0);
 199   3                              PrintChar(_D,Cyan);
 200   3                              PrintChar(_e,Cyan);
 201   3                              PrintChar(_b,Cyan);
 202   3                              PrintChar(_u,Cyan);
 203   3                              PrintChar(_g,Cyan);
 204   3                              EnableOSD();
 205   3                              SetSDA;
 206   3                              SetSCL;
 207   3                      }
 208   2                      else
 209   2                      {
 210   3                              gotoxy(0,0);
 211   3                              PrintChar(__,Cyan);
 212   3                              PrintChar(__,Cyan);
 213   3                              PrintChar(__,Cyan);
 214   3                              PrintChar(__,Cyan);
 215   3                              PrintChar(__,Cyan);
 216   3                              EnableOSD();
 217   3                      }
 218   2              }
 219   1      
 220   1              if(FactoryKeyIndex>=KeyCount)
 221   1              {
 222   2                      FactoryFg=~FactoryFg;
 223   2                      FactoryKeyIndex = 0;
 224   2                      if(FactoryFg)
 225   2                      {
 226   3                              gotoxy(0,0);
 227   3                              PrintChar(_F,Cyan);
 228   3                              PrintChar(_A,Cyan);
 229   3                              PrintChar(_C,Cyan);
 230   3                              PrintChar(_T,Cyan);
 231   3                              PrintChar(_O,Cyan);
 232   3                              EnableOSD();
 233   3                      }
 234   2                      else
 235   2                      {
 236   3                              gotoxy(0,0);
 237   3                              PrintChar(__,Cyan);
 238   3                              PrintChar(__,Cyan);
 239   3                              PrintChar(__,Cyan);
 240   3                              PrintChar(__,Cyan);
C51 COMPILER V7.09   KEY                                                                   09/06/2006 13:39:48 PAGE 5   

 241   3                              PrintChar(__,Cyan);
 242   3                              EnableOSD();
 243   3                      }
 244   2              }
 245   1              
 246   1      }
 247          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    840    ----
   CONSTANT SIZE    =     15    ----
   XDATA SIZE       =      3       2
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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