keyproc.lst

来自「philip RTC 芯片的驱动程序 8563」· LST 代码 · 共 806 行 · 第 1/4 页

LST
806
字号
 383   4                                      if((flash_counter > 280 ) && (flash_counter < 330))                     
 384   4                                      clear_lcd();                                    
 385   4                                      if(flash_counter > 330) 
 386   4                                      flash_counter = 0;                                                              
 387   4                                      DelayX1ms(255); 
 388   4                                      DelayX1ms(125);                                 
 389   4                              
 390   4                                      if(IR_KeyAct == 1 )
 391   4                                      {
 392   5                                              Current_Key  =  IR_KEY_TBL[Remote_Key];
 393   5                                              IR_KeyAct = 0;                                  
 394   5                                              if(Current_Key == VOLUME_UP_KEY) 
 395   5                                              {
 396   6                                                      if(h < 13)
 397   6                                                      {
 398   7                                                              h++;
 399   7                                                              if(h == 13)
 400   7                                                              h = 1;                                                  
 401   7                                                              display_18(h / 10);                     
 402   7                                                      display_28(h % 10);     
 403   7                                                              set_pcf8563(0x04,((h / 10)<<4)  | (h % 10));                    
 404   7                                                      }
 405   6                                              }
 406   5                                              if(Current_Key == VOLUME_DOWN_KEY)
 407   5                                              {
 408   6                                                      if(m < 60)
 409   6                                                      {                                       
 410   7                                                              m++;
 411   7                                                              if(m == 60)
 412   7                                                              m = 0;                                                  
 413   7                                                      display_38(m / 10);                     
 414   7                                                      display_48(m % 10);
 415   7                                                              set_pcf8563(0x03,((m / 10)<<4)  | (m % 10));                                            
 416   7                                                      }
 417   6                                              }
 418   5                                              if(Current_Key == CLOCK_KEY) 
 419   5                                          clock_flag = 0;             
 420   5                                      }                                                                               
 421   4                      }
 422   3                      }
 423   2                      //add ir clock end              
 424   2                      Current_Key = NO_KEY;   
 425   2                      if(Need_Button_up == 0)
 426   2                      {
C51 COMPILER V7.50   KEYPROC                                                               10/18/2005 14:13:29 PAGE 8   

 427   3                              Keypointer = KeyBound_TBL;
 428   3                              SendKeyToiPod();                                                
 429   3                      }               
 430   2              }
 431   1      }
 432          
 433                                      
 434          void    Panel_SearchKey()
 435          {
 436   1              BYTE Key_Temp;  
 437   1              P3 |= 0xf0;
 438   1              _nop_();
 439   1              Key_Temp = P3 & 0xf0;
 440   1              if( Key_Temp == 0xf0)
 441   1              {
 442   2                      Key_Rebound = 0;
 443   2                      Key_LongTimer = 0;
 444   2                      Key_ShortTimer = 0;
 445   2                      Save_Key      = NO_KEY;
 446   2                      return;
 447   2              }       
 448   1              DelayX1ms(15);
 449   1              P3 |= 0xf0;
 450   1              _nop_();
 451   1              
 452   1              Key_Temp = P3 & 0xf0;
 453   1              
 454   1              if( Key_Temp == 0xf0)
 455   1                      return;
 456   1              
 457   1              if(Key_Rebound == 0)
 458   1              {
 459   2                      Panel_KeyAct = 1;
 460   2                      Key_Rebound  = 1;
 461   2                      
 462   2                      switch(Key_Temp)
 463   2                      {
 464   3                              case  0x70:
 465   3                                        Panel_Key = POWER_KEY;
 466   3                                        break;
 467   3                              case  0xb0:
 468   3                                        Panel_Key = Source_Select;
 469   3                                        Save_Key  = Panel_Key;
 470   3                                        Key_LongTimer = 1;
 471   3                                        break;
 472   3                              case  0xd0:
 473   3                            Panel_Key = VOLUME_DOWN_KEY;
 474   3                                        Save_Key  = Panel_Key;
 475   3                                        Key_LongTimer = 1;
 476   3                                        break;
 477   3                              case  0xe0:
 478   3                                    Panel_Key = VOLUME_UP_KEY;
 479   3                                        Save_Key  = Panel_Key;
 480   3                                        Key_LongTimer = 1;
 481   3                                        break;
 482   3                              default:
 483   3                                        Panel_Key = NO_KEY;
 484   3                                        Panel_KeyAct = 0;
 485   3                                        break;
 486   3                      }
 487   2              }
 488   1              else if(Key_Rebound == 1)
C51 COMPILER V7.50   KEYPROC                                                               10/18/2005 14:13:29 PAGE 9   

 489   1              {
 490   2                      if((Key_LongTimer == 130)) //130
 491   2                      {
 492   3                              Key_Rebound = 2;
 493   3                              Panel_KeyAct = 1;
 494   3                              Panel_Key = Save_Key;
 495   3                              Key_LongTimer = 0;
 496   3                              Key_ShortTimer = 1;
 497   3                      }
 498   2              }
 499   1              else if(Key_Rebound == 2)
 500   1              {
 501   2                      if((Key_ShortTimer == 25))// 25
 502   2                      {
 503   3                              Panel_KeyAct = 1;
 504   3                              Panel_Key = Save_Key;
 505   3                              Key_ShortTimer = 1;
 506   3                      }
 507   2              }
 508   1              
 509   1              //校时
 510   1              if(POWER_Status == 0)//关机状态校时
 511   1              {
 512   2                      P3 |= 0xf0;     
 513   2                      if((P3 & 0xf0) == 0xc0)
 514   2                      { 
 515   3                              adj_counter++;
 516   3                      h = hour;
 517   3                              m = minute;
 518   3                      
 519   3                              if(adj_counter > 80)    
 520   3                              {
 521   4                                      adj_counter = 0;
 522   4                                      while((P3 & 0xf0) != 0xb0)//按source键退出
 523   4                                      {
 524   5                                              //set_pcf8563(0x02,0); //清零秒,()                                      
 525   5                                      //对时闪烁
 526   5                                              if((flash_counter > 0 ) && (flash_counter < 280))
 527   5                                              {
 528   6                                              display_18(h / 10);                     
 529   6                                              display_28(h % 10);     
 530   6                                                  display_38(m / 10);                 
 531   6                                              display_48(m % 10);
 532   6                                                  display_maohao();   
 533   6                                              
 534   6                                              }       
 535   5                                              if((flash_counter > 280 ) && (flash_counter < 330))                     
 536   5                                              clear_lcd();                                    
 537   5                                              if(flash_counter > 330) 
 538   5                                              flash_counter = 0;                                                              
 539   5                                              DelayX1ms(255); 
 540   5                                              DelayX1ms(125); 
 541   5                      
 542   5                                              switch(P3 & 0xf0)
 543   5                                              {
 544   6                                                      case 0xd0:    //调小时
 545   6                                                      if(h < 13)
 546   6                                                      {
 547   7                                                              h++;
 548   7                                                              if(h == 13)
 549   7                                                              h = 1;                                                  
 550   7                                                              display_18(h / 10);                     
C51 COMPILER V7.50   KEYPROC                                                               10/18/2005 14:13:29 PAGE 10  

 551   7                                                      display_28(h % 10);     
 552   7                                                              set_pcf8563(0x04,((h / 10)<<4)  | (h % 10));                    
 553   7                                                      }
 554   6                                                      break;
 555   6                                                      
 556   6                                                      case 0xe0:     //调分钟
 557   6                                                      if(m < 60)
 558   6                                                      {                                       
 559   7                                                              m++;
 560   7                                                              if(m == 60)
 561   7                                                              m = 0;                                                  
 562   7                                                      display_38(m / 10);                     
 563   7                                                      display_48(m % 10);
 564   7                                                              set_pcf8563(0x03,((m / 10)<<4)  | (m % 10));                                            
 565   7                                                      }
 566   6                                                      break;
 567   6                              
 568   6                                                      default:                                        
 569   6                                                  break;      
 570   6                                          }
 571   5                                      }
 572   4                              }               
 573   3                      }   
 574   2              }
 575   1      }
 576          
 577          void    SendKeyToiPod(void)
 578          {

⌨️ 快捷键说明

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