#ifndef _SETBE6303UPGRADE_
#define _SETBE6303UPGRADE_
#include "HardwareInfo.c"
  #include <jmkernel32.h>
  #include "I2C_Soft.h"
#include <math.h>
#include <Pinformat.h>
#include <LCD_COLOR.h>

  #define _ULTRASOUND_ADDR_		0X04

void SetBe6303Upgrade(int which)
{
       u32 port1=portarray[RcuPORT[which][0]];//I2C_SCL
       u32 port2=portarray[RcuPORT[which][1]];//I2C_SDA
       u32 port3=portarray[RcuPORT[which][2]];//ADC
       u8 bit1=RcuPIN[which][0];
       u8 bit2=RcuPIN[which][1];
       u8 bit3=RcuPIN[which][2];
       
    	u32 data;
    	u8  datah=0,datal=0,vsn=0,s=0,SUM=0;
       
    	 RcuWhichMutexTake(which,1,999);//获取端口IIC使用权
    	 Soft_I2C_Typedef iic_typedef;
    	 Soft_I2C_BspInit(port2,bit2,//SDA
    				     port1,bit1,//SCL
    				     &iic_typedef);
    	
    	Soft_I2C_Start(&iic_typedef);
    	Soft_I2C_Write(&iic_typedef,_ULTRASOUND_ADDR_);
    	Soft_I2C_Write(&iic_typedef,0xFE);
    	Soft_I2C_Write(&iic_typedef,0x5A);
    	Soft_I2C_Write(&iic_typedef,0xA5);
    	Soft_I2C_Stop(&iic_typedef);
    	
    	RcuWhichMutexGive(which,1,data);//释放IIC端口使用权
}
#endif

