
unit module
{
	public const uint16 ID = 0;
	
	public link unit D {}
	
	//[i] linkconst_int32_10 N;
	const int16 N = 0;
	
	[uint8*(3*N)] RGBList;
	
	bool need;
	
	//---------------------------------------------------
	//[i] function_void setR int32 int32;
	void setR( int32 i, int32 vv )
	{
		if( i < 1 || i > N ) return;
		i - 1;
		
		if( vv > 255 ) vv = 255;
		if( vv < 0 ) vv = 0;
		
		RGBList[i * 3] = (uint8)(uint16)(uint)vv;
		
		need = true;
	}
	//[i] function_void setG int32 int32;
	void setG( int32 i, int32 vv )
	{
		if( i < 1 || i > N ) return;
		i - 1;
		
		if( vv > 255 ) vv = 255;
		if( vv < 0 ) vv = 0;
		
		RGBList[i * 3 + 1] = (uint8)(uint16)(uint)vv;
		
		need = true;
	}
	//[i] function_void setB int32 int32;
	void setB( int32 i, int32 vv )
	{
		if( i < 1 || i > N ) return;
		i - 1;
		
		if( vv > 255 ) vv = 255;
		if( vv < 0 ) vv = 0;
		
		RGBList[i * 3 + 2] = (uint8)(uint16)(uint)vv;
		
		need = true;
	}
	//---------------------------------------------------
	//[i] function_int32 getR int32;
	int32 getR( int32 i )
	{
		if( i < 1 || i > N ) return 0;
		i - 1;
		
		uint32 d = RGBList[i * 3];
		return (int)d;
	}
	//[i] function_int32 getG int32;
	int32 getG( int32 i )
	{
		if( i < 1 || i > N ) return 0;
		i - 1;
		
		uint32 d = RGBList[i * 3 + 1];
		return (int)d;
	}
	//[i] function_int32 getB int32;
	int32 getB( int32 i )
	{
		if( i < 1 || i > N ) return 0;
		i - 1;
		
		uint32 d = RGBList[i * 3 + 2];
		return (int)d;
	}
	
	//---------------------------------------------------
	//[i] function_void OS_init;
	public void OS_init()
	{
		D.D0_OUT = 0;
		D.D0_DIR = 1;
		
		int16 i = 0;
		loop( N * 3 ) {
			RGBList[i] = 0;
			i + 1;
		}
		
		Refresh_init();
		
		need = false;
	}
	//---------------------------------------------------
	//[i] function_void OS_thread;
	public void OS_thread()
	{
		if( need ) {
			need = false;
			Refresh();
		}
	}
	
	#include "$run$.txt"
}




