
unit motor
{
	public const uint16 ID = 0;
	
	#include "$run$.txt"
	
	public link unit A {}
	public link unit B {}
	
	//[i] interface_motor motor0;
	public unit motor0
	{
		public link void Right() {}
		public link void Left() {}
		public link void Stop() {}
	}
	motor0.Right = run_right;
	motor0.Left = run_left;
	motor0.Stop = stop;
	
	//[i] function_void OS_init;
	public void OS_init()
	{
		//PORT.A_DIR = 1;
		//PORT.A_OUT = 0;
		//PORT.B_DIR = 1;
		//PORT.B_OUT = 0;
		
		stop();
	}
	
	//[i] function_void set_power int32;
	public void set_power( int32 p )
	{
		if( p < 0 ) {
			p = 0;
		}
		if( p > 100 ) {
			p = 100;
		}
		A.power = (int8)(int16)p;
		//B.power = (int8)(int16)p;
	}
	
	//[i] function_void run_right;
	
	//[i] function_void run_left;
	
	//[i] function_void stop;

	//[i] function_void_old short_stop;
}







