
	I2C.SDA = SDA;
	I2C.SCL = SCL;
	I2C =
	#include <system\common\I2C\driver.txt>
	
	const uint8 DeviceAddr = 0xD0;
	
	int32 aX_g;
	
	int32 aY_g;
	
	//--------------------------------------------
	//[i] function_void OS_init;
	public void OS_init()
	{
		I2C.Init();
		
		loop( 200 ) loop( 200 ) {}
		
		I2C.A1_set_uint8( DeviceAddr, 0x6B, 0 );
		
		Coor.OS_init();
		
		aX_g = 1296900;
		aY_g = 1296900;
		
		OS_time = 5;
	}
	
	//[i] function_void OS_run;
	public void OS_run()
	{
		uint16 d;
		
		I2C.A1_get_byte6( DeviceAddr, 0x3B );
		
		d.0(uint8) = I2C.byte1;
		d.8(uint8) = I2C.byte0;
		accelX = (int)d;
		
		d.0(uint8) = I2C.byte3;
		d.8(uint8) = I2C.byte2;
		accelY = (int)d;
		
		d.0(uint8) = I2C.byte5;
		d.8(uint8) = I2C.byte4;
		accelZ = (int)d;
		
		I2C.A1_get_byte6( DeviceAddr, 0x43 );
		
		d.0(uint8) = I2C.byte1;
		d.8(uint8) = I2C.byte0;
		gyroX = (int)d + 435;
		
		d.0(uint8) = I2C.byte3;
		d.8(uint8) = I2C.byte2;
		gyroY = (int)d;
		
		d.0(uint8) = I2C.byte5;
		d.8(uint8) = I2C.byte4;
		gyroZ = (int)d;
		
		int32 a;
		
		//13100
		
		Coor.SetCoor( accelX, accelZ );
		a = Coor.Angle * 15500;
		aX_g += gyroY;
		aX_g = (a + aX_g * 99) / 100;
		//aX = aX_g / 13100 - 90;
		aX = aX_g / 131;
		
		Coor.SetCoor( accelY, accelZ );
		a = Coor.Angle * 15500;
		aY_g += -gyroX;
		aY_g = (a + aY_g * 99) / 100;
		//aY = aY_g / 13100 - 90;
		aY = aY_g / 131;
		
		//#.PID();
	}
	
	
	
	