C51 COMPILER V9.02   DEBUG                                                                 12/25/2025 18:50:27 PAGE 1   


C51 COMPILER V9.02, COMPILATION OF MODULE DEBUG
OBJECT MODULE PLACED IN .\hex\debug.obj
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE TS_Lib\Sources\debug.c OMF2 ROM(COMPACT) OPTIMIZE(9,SIZE) BROWSE DEBUG PRIN
                    -T(.\lst\debug.lst) OBJECT(.\hex\debug.obj)

line level    source

   1          #ifndef _I2C_C_
   2          #define _I2C_C_
   3          
   4          /*********************************************************************************************************
             -************/
   5          #include "ca51f_config.h"
   6          #include "includes\ca51f2sfr.h"
   7          #include "includes\ca51f2xsfr.h"
   8          #include "includes\gpiodef_f2.h"
   9          
  10          #include "Library\Includes\rtc.h"               
  11          #include "Library\Includes\system_clock.h"              
  12          /*********************************************************************************************************
             -************/
  13          #include "TS_Lib\Includes\ts_configuration.h"
  14          #include "TS_Lib\Includes\ts_def.h"
  15          #include "TS_Lib\Includes\ts_api.h"
  16          #include "TS_Lib\Includes\ts_service.h"            
  17          #if DEBUG
              #include "Library\Includes\i2c.h"               
              void I2C_ISR(void);
              #endif
  21          /*********************************************************************************************************
             -************/
  22          #if DEBUG
              #define I2C_ADDR                0xCA
              unsigned char xdata TouchDebugID = '3';
              unsigned char rxOffset;
              unsigned char regAddr;
              bit iicReadMode;
              extern TSState_T                                        xdata   TS_State_Debug;
              extern unsigned char                            xdata   Key_Cnt_Debug;
              extern unsigned char                            xdata   TS_CH_Debug[OPENED_TS_COUNT];   
              extern unsigned int                             xdata   TS_RefChBaseLineData;
              extern unsigned int                             xdata   TS_RefPostData;
              extern unsigned long int   xdata        KeysFlagSN_Debug;
              code unsigned char *TS_INFO[]=
              {
                      &TouchDebugID,
                      &TS_State_Debug,
                      &Key_Cnt_Debug,
                      &TS_RefChBaseLineData,
                      &TS_RefPostData,
                      &KeysFlagSN_Debug,
                      &TS_BaseLineData[0],
              #if TOUCH_SENSITIVITY_AUTO_BALANCE_EN
                      &TS_PostData2[0],
              #else
                      &TS_PostData[0],
              #endif
                      &TSKey_FingerThd[0],
                      &TS_CH_Debug[0],
              };
              unsigned char *pTS_Info;
C51 COMPILER V9.02   DEBUG                                                                 12/25/2025 18:50:27 PAGE 2   

              void I2C_ISR(void)
              {
                      unsigned char Sta_Temp;
                      TouchDebugID = '3';                             
                      Sta_Temp = I2CSTA;                      
                      if(Sta_Temp == 0x60)                       //接收到从机地址+写位
                      {                       
                              rxOffset = 0xff;
                              iicReadMode = 0;
                              I2CCON |= AAK(1);                       
                      }
                      else if(Sta_Temp == 0x80)                          
                      {                                       
                              if(iicReadMode)                                 //发送一字节数据
                              {
                                      rxOffset++;
                                      I2CDAT = *(pTS_Info+rxOffset);                  
                              }
                              else                                                                    //接收到一字节数据
                              {                               
                                      if(rxOffset == 0xff)            //地址
                                      {
                                              regAddr=I2CDAT;  
                                              pTS_Info = TS_INFO[regAddr];
                                              rxOffset=0;
                                              I2CCON |= AAK(1);
                                      }
                                      else                                            //数据
                                      {
                                              *(pTS_Info+rxOffset) = I2CDAT;
                                              rxOffset++;     
                                              I2CCON |= AAK(1);               
                                      }
                              }       
                      }
                      else if(Sta_Temp==0xA8)                         //接收到从机地址+读位，发送ACK信号
                      {                                                               
                              I2CDAT = *(pTS_Info+rxOffset);
                              iicReadMode = 1;
                      }
                      else if(Sta_Temp == 0x88)       
                      {
                      }
                      I2CFLG  |= I2CF;
              }
              void Debug_init(void)
              {
                      I2CCON = I2CE(1) | I2CIE(1) | STA(0) | STP(0)| CKHD(0) | AAK(1)| CBSE(0) | STFE(0);             
                      I2CADR = (I2C_ADDR>>1);
                      I2CCCR = 0x20;
                      
              #ifdef I2C_SELECT_P36_P37
                      I2CIOS = 0;
                      GPIO_Init(P36F,P36_I2C_SDA_SETTING);
                      GPIO_Init(P37F,P37_I2C_SCL_SETTING);    
              #elif defined I2C_SELECT_P30_P31
                      I2CIOS = 1;
                      GPIO_Init(P30F,P30_I2C_SDA_SETTING);
                      GPIO_Init(P31F,P31_I2C_SCL_SETTING);
              #elif defined I2C_SELECT_P66_P67
                      I2CIOS = 2;
                      GPIO_Init(P66F,P66_I2C_SDA_SETTING);
C51 COMPILER V9.02   DEBUG                                                                 12/25/2025 18:50:27 PAGE 3   

                      GPIO_Init(P67F,P67_I2C_SCL_SETTING);
              #elif defined I2C_SELECT_P61_P60
                      I2CIOS = 3;
                      GPIO_Init(P66F,P61_I2C_SDA_SETTING);
                      GPIO_Init(P67F,P60_I2C_SCL_SETTING);
              #endif
                      
                      INT6EN = 1;
                      EXIP |= (1<<4);                 //优先级设置为最高
              }
              void Debug_ParamLoad(void)
              {
                      unsigned char i;
                      KeysFlagSN_Debug = (unsigned long int)KeysFlagSN;
                      TS_State_Debug = TS_State;
                      Key_Cnt_Debug = KEY_CH_COUNT;
                      for(i = 0; i < KEY_CH_COUNT; i++)
                      {
                              TS_CH_Debug[i] = TS_CH[i];
                      }
                      TS_RefPostData  = TS_PostData[OPENED_TS_COUNT]; 
                      TS_RefChBaseLineData  = TS_RefPostData; 
              }
              #endif
 138          #endif


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   ----    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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