示例#1
0
void AW5306_User_Cfg1(void)
{
	unsigned char i;
		
	for(i=0;i<AWTPCfg.TX_LOCAL;i++)
	{
		AW_I2C_WriteByte(SA_TX_INDEX0+i,AWTPCfg.TX_ORDER[i]);			//TX REVERT
	}

	AW_I2C_WriteByte(SA_TX_NUM,AWTPCfg.TX_LOCAL);
	AW_I2C_WriteByte(SA_RX_NUM,AWTPCfg.RX_LOCAL);

	if(1 == AWTPCfg.MULTI_SCANFREQ)
	{
		AW_I2C_WriteByte(SA_SCANFREQ1,AWTPCfg.BASE_FREQ);
		AW_I2C_WriteByte(SA_SCANFREQ2,AWTPCfg.BASE_FREQ);
		AW_I2C_WriteByte(SA_SCANFREQ3,AWTPCfg.BASE_FREQ);
	}
	else
	{
		AW_I2C_WriteByte(SA_SCANFREQ1,AWTPCfg.BASE_FREQ);		//3-5
	}
	//AW_I2C_WriteByte(SA_TCLKDLY,1);
	AW_I2C_WriteByte(SA_RX_START,AWTPCfg.RX_START);
	AW_I2C_WriteByte(SA_SCANTIM,4);		// set to 32 TX cycles mode

	AW_I2C_WriteByte(SA_PAGE,1);
	AW_I2C_WriteByte(SA_CHAMPCFG,0x2b);	//
	AW_I2C_WriteByte(SA_OSCCFG1,AWTPCfg.FREQ_OFFSET);			//
	AW_I2C_WriteByte(SA_PAGE,0);

	AW5306_CLB_WriteCfg();	
}
void AW5306_User_Cfg1(void)			//yikong
{
	unsigned char i;
		
	AWTPCfg.TX_LOCAL = 15;		//TX number of TP
	AWTPCfg.RX_LOCAL = 10;		//RX number of TP
	AWTPCfg.RX_INV_ORDER = 0;	//RX mapping in inverted order

	AWTPCfg.HAVE_KEY_LINE = 0;

	for(i = 0; i < 16; i++)
	{
		AWTPCfg.KeyLineValid[i] = 1;
	}
	
	AWTPCfg.K_X = ((AWTPCfg.MAPPING_MAX_X - 1)*256)/(AWTPCfg.RX_LOCAL*POS_PRECISION - 1);  //192
	AWTPCfg.K_Y = ((AWTPCfg.MAPPING_MAX_Y - 1)*256)/(AWTPCfg.TX_LOCAL*POS_PRECISION - 1);   //195 

	//auto calibration para
	AWTPCfg.GainClbDeltaMin = 600;	// Expected minimum delta for GAIN calibration
	AWTPCfg.GainClbDeltaMax = 700;	// Expected maximum delta for GAIN calibration
	AWTPCfg.OffsetClbExpectedMin = 8300;	// Expected minimum data for OFFSET calibration
	AWTPCfg.OffsetClbExpectedMax = 8500;	// Expected minimum data for OFFSET calibration
	AWTPCfg.RawDataDeviation = 300;	// Maximum deviation in a frame
	AWTPCfg.CacMultiCoef = 8;

	for(i=0;i<AWTPCfg.TX_LOCAL;i++)
	{
		I2C_WriteByte(SA_TX_INDEX0+i,4+i);			//TX REVERT
	}

	I2C_WriteByte(SA_TX_NUM,AWTPCfg.TX_LOCAL);
	I2C_WriteByte(SA_RX_NUM,AWTPCfg.RX_LOCAL);

	AWTPCfg.MULTI_SCANFREQ = 1;

	
    if(1 == AWTPCfg.MULTI_SCANFREQ)
	{
		I2C_WriteByte(SA_SCANFREQ1,5);		//3-5
		I2C_WriteByte(SA_SCANFREQ2,5);		//3-5
		I2C_WriteByte(SA_SCANFREQ3,5);		//3-5
	}
	else
	{
		I2C_WriteByte(SA_SCANFREQ1,10);		//3-5
	}
	//I2C_WriteByte(SA_TCLKDLY,1);
	I2C_WriteByte(SA_RX_START,0);
	I2C_WriteByte(SA_SCANTIM,4);		// set to 32 TX cycles mode

	I2C_WriteByte(SA_PAGE,1);
	I2C_WriteByte(SA_CHAMPCFG,0x2b);	//
	I2C_WriteByte(SA_OSCCFG1,0xab);		// 
	I2C_WriteByte(SA_PAGE,0);

	if (1 == AW_Cali.FirstFlag)
	{
		memcpy(&AW_Cali,&Default_Cali1,sizeof(STRUCTCALI));		//load default cali value
		AW_Cali.FirstFlag = 0;
	}
	AW5306_CLB_WriteCfg();
	
}