main.lst

来自「显示屏驱动源代码」· LST 代码 · 共 721 行 · 第 1/3 页

LST
721
字号
                              WriteI2C(TW88I2CAddress, 0xf2, GammaBlue[0]); //  
                              WriteI2Cn(TW88I2CAddress, 0xf2, &GammaBlue[1], 255);
              
              }
              #endif
 231          
 232          void I2CDeviceInitialize( CODE_P BYTE *RegSet)
 233          {
 234   1              int     cnt=0;
 235   1              BYTE addr, index, val;
 236   1      
 237   1              addr = *RegSet;
 238   1              #ifdef DEBUG_TW88
                      dPrintf("\r\nI2C address : %02x", (WORD)addr);
                      #endif
C51 COMPILER V7.06   MAIN                                                                  02/21/2008 14:00:27 PAGE 5   

 241   1              cnt = *(RegSet+1);
 242   1              RegSet+=2;
 243   1      
 244   1              while (( RegSet[0] != 0xFF ) || ( RegSet[1]!= 0xFF )) {                 // 0xff, 0xff is end of data
 245   2                      index = *RegSet;
 246   2                      val = *(RegSet+1);
 247   2                      WriteI2C(addr, index, val);
 248   2      
 249   2                      #ifdef DEBUG_TW88
                              dPrintf("\r\n    addr=%02x  index=%02x   val=%02x", (WORD)addr, (WORD)index, (WORD)val );
                              #endif
 252   2      
 253   2                      RegSet+=2;
 254   2              }
 255   1              WriteTW88(0xff, 0x00);          // set page 0
 256   1      }
 257          
 258          extern CODE struct RegisterInfo UserRange;
 259          extern CODE struct RegisterInfo VideoContrastRange;
 260          extern CODE struct RegisterInfo VideoBrightnessRange;
 261          extern CODE struct RegisterInfo VideoSaturationRange;
 262          extern CODE struct RegisterInfo VideoHueRange;
 263          extern CODE struct RegisterInfo VideoSharpnessRange;
 264          extern CODE struct RegisterInfo DigitalVideoSaturationRange;
 265          
 266          #ifdef ADD_ANALOGPANEL
              BYTE IsAnalogOn(void)
              {
                      if(DIP_PANEL_SWITCH==0) return 1;
                      else return 0;
              }
              #endif
 273          
 274          /*********************************/
 275          BYTE IsNoInput(void)
 276          {
 277   1              if( ReadDecoder(CSTATUS) & 0x80 ) return 1;
 278   1              return 0;
 279   1      }
 280          
 281          #ifdef ID_CHECK_BY_FW
              BYTE Is50Hz(void)
              {
                      if( ReadDecoder(CSTATUS) & 0x01 ) return 1;
                      return 0;
              }
              
              BYTE Slock(void)
              {
                      if( ReadDecoder(CSTATUS) & 0x20 ) return 1;
                      return 0;
              }
              #endif  // ID_CHECK_BY_FW
 294          
 295          BYTE ReadVInputSTD(void)
 296          {
 297   1              BYTE std;
 298   1              
 299   1              if( IsNoInput() ) return 1; // Noinput!!
 300   1              
 301   1              std = ReadDecoder(0x1c) & 0xf0;
 302   1              if( std & 0x80 ) return 1; // Detection in progress..
C51 COMPILER V7.06   MAIN                                                                  02/21/2008 14:00:27 PAGE 6   

 303   1              else 
 304   1                      return ((( std & 0x70 ) >> 4 ) + 1 );
 305   1      }
 306          
 307          BYTE GetVInputStdInx(void)
 308          {
 309   1              BYTE i, std;
 310   1      
 311   1              std = ReadVInputSTD();
 312   1      
 313   1              switch( std ) {
 314   2      
 315   2              case NTSC4:
 316   2              case PALM:
 317   2              case PAL60:
 318   2              case NTSC:              IVF = 60;               IHF = 15723;    break;  // 15734
 319   2      
 320   2              case SECAM:
 321   2              case PALN:
 322   2              case PAL:               IVF = 50;               IHF = 15723;    break;  // 15625
 323   2              default:                IVF = 0;                IHF = 0;                break;
 324   2              }
 325   1      
 326   1              for(i=0; ; i++) {
 327   2                      if( struct_VInputStd[i].Id ==std )
 328   2                              return i;
 329   2                      if( struct_VInputStd[i].Id ==0 )
 330   2                              break;
 331   2              }
 332   1              return 0;
 333   1      }
 334          
 335          void SetVInputStd(BYTE newd)
 336          {
 337   1              VInputStd = newd;
 338   1      
 339   1              #ifdef DEBUG
 340   1              ePrintf("\r\n(SetVInputStd) VInputStd:(%s)", struct_VInputStd[GetVInputStdInx()].Name);
 341   1              #endif
 342   1      
 343   1              switch( VInputStd ) {
 344   2      
 345   2              #ifdef SUPPORT_NTSC4
 346   2              case NTSC4:
 347   2              #endif
 348   2              #ifdef SUPPORT_PALM
 349   2              case PALM:
 350   2              #endif
 351   2              #ifdef SUPPORT_PAL60
 352   2              case PAL60:
 353   2              #endif
 354   2              case NTSC:              IVF = 60;               IHF = 15723;    break;  // 15734
 355   2      
 356   2              #ifdef SUPPORT_SECAM
 357   2              case SECAM:
 358   2              #endif
 359   2              #ifdef SUPPORT_PALN
 360   2              case PALN:
 361   2              #endif
 362   2              #ifdef SUPPORT_PAL
 363   2              case PAL:               IVF = 50;               IHF = 15723;    break;  // 15625
 364   2              #endif
C51 COMPILER V7.06   MAIN                                                                  02/21/2008 14:00:27 PAGE 7   

 365   2      
 366   2              default:                IVF = 0;                IHF = 0;                break;
 367   2              }
 368   1      }
 369          
 370          BYTE GetInputSelection(void)
 371          {
 372   1              return InputSelection;
 373   1      }
 374          
 375          BYTE GetNextInputSelection(void)
 376          {
 377   1              BYTE i;
 378   1      
 379   1              for (i=1; ;i++)
 380   1                      if( struct_InputSelection[i].Id==InputSelection )  break;
 381   1              i++;
 382   1              if( struct_InputSelection[i].Id == 0 ) i=1;
 383   1      
 384   1              return struct_InputSelection[i].Id;
 385   1      }
 386          
 387          void PowerDown_XTAL(bit flag)
 388          {
 389   1              if( flag ) P3_7 = 1;
 390   1              else      P3_7 = 0;
 391   1      }
 392          
 393          void ChangeInput(BYTE newsel)
 394          {
 395   1              #ifdef DEBUG
 396   1              BYTE i;
 397   1              #endif
 398   1      
 399   1              if( InputSelection==newsel ) return;
 400   1      
 401   1              DisplayInputHold = 0; // Refresh Input info.
 402   1              ClearOSDInfo();
 403   1      
 404   1              //PanelMute(1);
 405   1      
 406   1              InputSelection = newsel;
 407   1      
 408   1             cSourceState = ssInputSetup; // start input setup
 409   1      
 410   1              #ifdef DEBUG
 411   1              for (i=1; ;i++)
 412   1                      if( struct_InputSelection[i].Id==InputSelection )  break;
 413   1              Printf("\r\n ->->->->->->->->->->-> Changed Input: %s(%02x)", struct_InputSelection[i].Name, (WORD)InputS
             -election);
 414   1              #endif
 415   1      
 416   1      }
 417          
 418          void PowerOff(void)
 419          {
 420   1              dPuts("\r\n++(PowerOff)__");
 421   1      //      PowerMode = OFF;
 422   1      
 423   1              AudioOff();
 424   1              
 425   1              ClearOSDInfo();
C51 COMPILER V7.06   MAIN                                                                  02/21/2008 14:00:27 PAGE 8   

 426   1              LCDPowerOFF();
 427   1              PowerLED(OFF);
 428   1      }
 429          
 430          void WaitPowerOn(void)
 431          {
 432   1      
 433   1              BYTE ikey;
 434   1              BYTE AutoKey, _RemoDataCode;
 435   1      
 436   1              while(1) {
 437   2                      if( (ikey = GetKey(0)) ) {
 438   3                              #ifdef POWERKEY
 439   3                              if( ikey==POWERKEY ) 
 440   3                                      break;          //poweron
 441   3                              #endif
 442   3                      }
 443   2                      if( IsRemoDataReady(&_RemoDataCode, &AutoKey) ) {
 444   3                              if( _RemoDataCode==REMO_STANDBY && !AutoKey )           //POWERON
 445   3                                      break;          //poweron
 446   3                      }
 447   2      
 448   2              }
 449   1      
 450   1              #ifdef DEBUG_MAIN
                      dPuts("\r\n++(PowerOn)__");
                      #endif
 453   1      //      PowerMode = ON;
 454   1              PowerLED(ON);
 455   1      
 456   1              AudioOn();                      //SetMSPVol();
 457   1              LCDPowerON(0);

⌨️ 快捷键说明

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