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

📄 t100.lst

📁 TFT 驱动 T100DEMO程序.做protable DVD的朋友可以参考一下.
💻 LST
📖 第 1 页 / 共 4 页
字号:
 496          {
 497   1              uCHAR cAddr,cReg,cNum0,cNum1,cINC;
 498   1        while(*pString != EOT)
 499   1        {
 500   2                      cAddr   =       *pString++;
 501   2                      cNum0   =       *pString++;
 502   2                      while(cNum0)
 503   2                      {
 504   3                              cReg    =       *pString++;
 505   3                              cNum1   =       *pString++;
 506   3                              cNum0  -=       (cNum1+2);
 507   3                              if(cNum1!=1)
 508   3                              {
 509   4                                      cINC    =       *pString++;
 510   4                                      cNum1  -=       1;
 511   4                              }
 512   3                              while(cNum1--)
 513   3                              {
 514   4                                      I2CWriteByte(cAddr,cReg,*pString++);
 515   4                                      cReg+=cINC;
 516   4                              }
 517   3                      }
 518   2        }
 519   1      }
 520          
 521          //****************************************************************
 522          #ifdef OSD_EN
 523          void OSDShowLine(uCHAR *string,uCHAR x,uCHAR y,uCHAR cColor);
 524          void OSDDrawGauge(uCHAR cVal, uCHAR x, uCHAR y, uCHAR cColor);
 525          void LoadFont(void);
 526          void LoadMenu(void);
 527          void ShowOSDData(void);
 528          void LoadData(void);
 529          void SaveData(void);
 530          void InitOSD(void)
 531          {
 532   1          LoadFont();
 533   1          LoadMenu();
 534   1          LoadData();
 535   1          ShowOSDData();
 536   1          OSDDisable();
 537   1      }
 538          void LoadFont(void)
 539          {
 540   1              unsigned int i;
 541   1              StartCondition();
 542   1              Send_Byte(0x50);
 543   1              Send_Byte(0xA4);
 544   1              for(i=0; i<35*18; i++){
 545   2                      Send_Byte(font_00[2*i]);
 546   2                      Send_Byte(font_00[2*i+1]);
 547   2                     }
 548   1         //0xc00==1024*3;
 549   1              for(; i<0x360; i++){
C51 COMPILER V7.06   T100                                                                  06/10/2005 16:07:14 PAGE 10  

 550   2                      Send_Byte(0x00);
 551   2                      Send_Byte(0x00);
 552   2              }//*/
 553   1              StopCondition();
 554   1      }
 555          void LoadMenu(void)
 556          {
 557   1          uCHAR i;
 558   1          for(i=0;i<4;i++)
 559   1          {
 560   2              OSDShowLine(iBlankLine,0,i,COL_NORMAL);
 561   2          }
 562   1              OSDShowLine(iBright_ICON,0,0,COL_NORMAL);
 563   1      
 564   1              OSDShowLine(iColor_ICON,0,1,COL_NORMAL);
 565   1      
 566   1              OSDShowLine(iScreen_ICON,0,2,COL_NORMAL);
 567   1      
 568   1              OSDShowLine(iScreen_ICON,0,3,COL_NORMAL);
 569   1      
 570   1              OSDShowLine(iFULL_ICON,LINE_LENGTH-2,3,COL_NORMAL);
 571   1      
 572   1              OSDShowLine(i4_3_ICON,LINE_LENGTH-3,2,COL_NORMAL);
 573   1                        OSDDrawGauge(cColor,3,1,COL_GAUGE);
 574   1                        OSDDrawGauge(cBright,3,0,COL_GAUGE);
 575   1      }
 576          void ShowOSDData(void)
 577          {
 578   1          switch(cOSDFunc)
 579   1          {
 580   2              case 1:
 581   2                        OSDDrawGauge(cBright,3,0,COL_GAUGE);
 582   2                      break;
 583   2              case 2:
 584   2                        OSDDrawGauge(cColor,3,1,COL_GAUGE);
 585   2                      break;
 586   2              case 3: break;
 587   2              }
 588   1      }
 589          
 590          void OSDSetRamAddr(int address)
 591          {
 592   1              I2CWriteByte(TW100,0xA3,(uCHAR)(address>>8));
 593   1              I2CWriteByte(TW100,0xA2,(uCHAR)(address & 0xff));
 594   1      }
 595          void OSDShowLine(uCHAR *string,uCHAR x,uCHAR y,uCHAR cColor)
 596          {
 597   1              if((x < 30) && ( y < 0x28))
 598   1              {
 599   2              OSDSetRamAddr(MENU_START_ADDR+((int)y << 5)+x);
 600   2              StartCondition();
 601   2              Send_Byte(0x50);
 602   2              Send_Byte(0xA4);
 603   2              while((*string) != EOL && (x < LINE_LENGTH))
 604   2              {
 605   3                      Send_Byte(*string++);
 606   3                      Send_Byte(cColor );
 607   3                      x++;
 608   3                      }
 609   2              StopCondition();
 610   2              }
 611   1      }
C51 COMPILER V7.06   T100                                                                  06/10/2005 16:07:14 PAGE 11  

 612          
 613          void OSDDrawGauge(uCHAR cVal,  uCHAR x, uCHAR y, uCHAR cColor)
 614          {
 615   1           uCHAR cTemp1,cTemp2,i=8;
 616   1           cTemp1=cVal/2;
 617   1           cTemp2=cVal%2;
 618   1           OSDSetRamAddr(MENU_START_ADDR+((int)y << 5)+x);
 619   1              StartCondition();
 620   1              Send_Byte(0x50);
 621   1              Send_Byte(0xA4);
 622   1           while(i)
 623   1           {
 624   2              if(cTemp1==0)
 625   2              {
 626   3                if(i==8)Send_Byte(0x0A+cTemp2);
 627   3                else if(i==1)Send_Byte(0x10+cTemp2);
 628   3                else Send_Byte(0x0D+cTemp2);
 629   3               Send_Byte(cColor);
 630   3                i--;
 631   3                break;
 632   3               }
 633   2               else
 634   2               {
 635   3                if(i==8)Send_Byte(0x0C);
 636   3                else if(i==1)Send_Byte(0x12);
 637   3                else Send_Byte(0x0F);
 638   3               }
 639   2               Send_Byte(cColor);
 640   2               cTemp1--;
 641   2               i--;
 642   2            }
 643   1            while(i)
 644   1            {
 645   2               if(i>1)Send_Byte(0x0D);
 646   2               else   Send_Byte(0x10);
 647   2               Send_Byte(cColor);
 648   2               i--;
 649   2            }
 650   1            StopCondition();
 651   1            //Num
 652   1           cTemp1=cVal/10;
 653   1           cTemp2=cVal%10;
 654   1           i=cVal/10;
 655   1      /*     cTemp1=(cVal%100)/10;
 656   1           cTemp2=cVal%10;//*/
 657   1              OSDSetRamAddr(MENU_START_ADDR+((int)(y) << 5)+(LINE_LENGTH-2));
 658   1              StartCondition();
 659   1              Send_Byte(0x50);
 660   1              Send_Byte(0xA4);
 661   1              if(i)Send_Byte(i+0x13);
 662   1              else Send_Byte(BLANK);
 663   1               Send_Byte(cColor);
 664   1              Send_Byte(cTemp2+0x13);
 665   1               Send_Byte(cColor);
 666   1            StopCondition();
 667   1      
 668   1      }
 669          void  OSDDisable(void)
 670          {
 671   1         I2CWriteTbl(OSDDisableTbl);
 672   1      }
 673          void OSDEnable(void)
C51 COMPILER V7.06   T100                                                                  06/10/2005 16:07:14 PAGE 12  

 674          {
 675   1         uCHAR cTemp[8];
 676   1         cTemp[0]=TW100;
 677   1         cTemp[1]=5;
 678   1         cTemp[2]=0xa0;
 679   1         cTemp[3]=3;
 680   1         cTemp[4]=Y_INC;
 681   1         cTemp[5]=0x05;
 682   1         cTemp[6]=23+(cOSDFunc-1);
 683   1         if((cOSDFunc==3)&&bFULL_43)cTemp[6]+=1;
 684   1         cTemp[7]=EOT;
 685   1         I2CWriteTbl(cTemp);
 686   1         cTemp[5]=0x1E;
 687   1         I2CWriteTbl(cTemp);
 688   1         I2CWriteTbl(OSDEnableTbl);
 689   1      }
 690          void OSDCtrl(char cDir)
 691          {
 692   1              uCHAR cTemp;
 693   1              switch(cOSDFunc)
 694   1              {
 695   2                      case 0: OSDDisable();return;
 696   2                      case 1:
 697   2                            if((cBright==0x10)&&(cDir==1))return;
 698   2                            if((cBright==0x00)&&(cDir==-1))return;
 699   2                            cBright+=cDir;
 700   2                                               if(cBright<16)cTemp=cBright*16;
 701   2                                               else cTemp=0xff;
 702   2                            I2CWriteByte(TW100,0x69,cTemp);
 703   2                            break;
 704   2                      case 2:
 705   2                            if((cColor==0xfc)&&(cDir==1))return;
 706   2                            if((cColor==0x00)&&(cDir==-1))return;
 707   2                            cColor+=cDir*4;
 708   2                                               if(cColor<16)cTemp=cColor*16;
 709   2                                               else cTemp=0xff;
 710   2                            I2CWriteByte(TW100,0x6c,cTemp);
 711   2                            break;
 712   2                      case 3:
 713   2                            if(Repeat_Times==0)return;
 714   2                            if(cDir)
 715   2                            {
 716   3                                bFULL_43=!bFULL_43;
 717   3                                SetMode();
 718   3                             }
 719   2                            break;
 720   2              }
 721   1              SaveData();
 722   1              ShowOSDData();
 723   1              OSDEnable();
 724   1      }
 725          
 726          
 727          void LoadData(void)
 728          {
 729   1      #ifdef NVRAM
              
              #else
 732   1              cBright=BRIGHT;
 733   1              cColor=COLOR;
 734   1      #endif
 735   1      }
C51 COMPILER V7.06   T100                                                                  06/10/2005 16:07:14 PAGE 13  

 736          void SaveData(void)
 737          {
 738   1      #ifdef NVRAM
              
              #endif
 741   1      }
 742          #endif
 743          bit m_bBKPowerOn                =1;
 744          bit m_bKyPowerOn                =1;
 745          bit m_bChipPowerOn              =1;
 746          void PowerManage(void)
 747          {
 748   1              if(m_bKyPowerOn) //Power on

⌨️ 快捷键说明

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