Exemplo n.º 1
0
void handleSendMovementTask()
{
    struct movement *tmp;  //movement vs Movement capitalized -> don't know which

    while(1) 
	{
		
		YKSemPend(receivedSEM);
		
        tmp = (struct movement*) YKQPend(MsgQPtr); // get next msg
		/*printString("send id = ");
		printInt(tmp->id);
		printString(" slide = ");
		printInt(tmp->slide);
		printString(" rotate = ");
		printInt(tmp->rotate);
		printNewLine();//*/
		if(tmp->slide > -1) //slide the piece
		{
			SlidePiece(tmp->id, tmp->slide);
		}
		else // rotate the piece
		{
			RotatePiece(tmp->id, tmp->rotate);
		}
    }

}
Exemplo n.º 2
0
/*
 * Communicates with simptris
 */
void CommunicationTask(void) {
	scmd* ncmd;

	SeedSimptris((long) SEED);
	StartSimptris();
	printString("\nSimptris Started!\n");
	
	while(1) {

		ncmd = (scmd*) YKQPend(CmdQPtr);
		if (ncmd->command == ROTATE) {
			RotatePiece(ncmd->id, ncmd->parameter);
		}
		else {
			SlidePiece(ncmd->id, ncmd->parameter);
		}
		YKSemPend(commandReceivedSem);
	}
}