Пример #1
0
void YKEnterISR(void) {
	YKEnterMutex();
	ISRCallDepth++;
	YKExitMutex();
}
Пример #2
0
void cornerPieceHandler()
{
	//designates which orientation and location it must be placed
	unsigned pieceorientation, pieceid, piecelocation;
	YKEnterMutex();
	piecelocation = NewPieceColumn;
	pieceorientation = NewPieceOrientation;
	pieceid = NewPieceID;
	YKExitMutex();
	
	//if the piece is vertical on the very right move it one to the left
	if(piecelocation >= 5)
	{
		postSimptrisMsg(pieceid, 0, -1);
		piecelocation--;
	}
	// if its on the left side move it over one so it can rotate
	else if(piecelocation <= 0)
	{
		postSimptrisMsg(pieceid, 1, -1);
		piecelocation++;
	}
	if (orientation == 0)
	{
		if (pieceorientation == 3)
		{
			postSimptrisMsg(pieceid, -1, 0);
		}
		else
		{
			while (pieceorientation > 0)
			{
				postSimptrisMsg(pieceid, -1, 1);
				pieceorientation--;
			}
		}
	}
	else
	{
		if (pieceorientation > 2)
		{
			postSimptrisMsg(pieceid, -1, 1);
		}
		else
		{
			while (pieceorientation < 2)
			{
				postSimptrisMsg(pieceid, -1, 0);
				pieceorientation++;
			}
		}
	}
	
	if (orientation == 0)
	{
		while (piecelocation > 0)
		{
			postSimptrisMsg(pieceid, 0,-1);
			piecelocation--;
		}
	}
	else
	{
		if (piecelocation < 2)
		{
			postSimptrisMsg(pieceid, 1, -1);
		}
		else
		{
			while (piecelocation > 2)
			{
				postSimptrisMsg(pieceid, 0, -1);
				piecelocation--;
			}
		}
	}
	
	YKEnterMutex();
	if (orientation)
	{
		orientation++;
	}
	else
	{
		orientation--;
	}
	YKExitMutex();
	
}