
unit LED
{
	public link unit DN {}
	public link unit DP {}
	
	bit DN_D0_OUT;
	bit DP_D0_OUT;
	
	//[i] function_void OS_init;
	public void OS_init()
	{
		if( DN.TYPE >= 10 ) DN.D0_DIR = 1;
		if( DP.TYPE >= 10 ) DP.D0_DIR = 1;
		
		close();
	}
	
	//[i] function_void open;
	public void open()
	{
		if( DN.TYPE >= 10 ) { DN.D0_OUT = 0; DN_D0_OUT = 0; }
		if( DP.TYPE >= 10 ) { DP.D0_OUT = 1; DP_D0_OUT = 1; }
	}
	
	//[i] function_void close;
	public void close()
	{
		if( DN.TYPE >= 10 ) { DN.D0_OUT = 1; DN_D0_OUT = 1; return; }
		if( DP.TYPE >= 10 ) { DP.D0_OUT = 0; DP_D0_OUT = 0; return; }
	}
	//[i] function_void swap;
	public void swap()
	{
		if( DN.TYPE >= 10 ) {
			if( DP.TYPE >= 10 ) { DP.D0_OUT = 1; DP_D0_OUT = 1; }
			DN_D0_OUT = ~DN_D0_OUT;
			DN.D0_OUT = DN_D0_OUT;
			return;
		}
		if( DP.TYPE >= 10 ) {
			DP_D0_OUT = ~DP_D0_OUT;
			DP.D0_OUT = DP_D0_OUT;
			return;
		}
	}
}


