Ejemplo n.º 1
0
void receivedHandler(void) {
	/*	This function needs to signal to the communication task that the last
		command was received and completed. We will do this using a semaphore. 
	*/

	YKSemPost(CommSem);
	
}
Ejemplo n.º 2
0
void TaskWord(void)
{
    while (1)
    {
        YKSemPend(WSemPtr);
        printString("Hey");
        YKSemPost(PSemPtr);
                
        YKSemPend(WSemPtr); 
        printString("it");
        YKSemPost(SSemPtr);
                
        YKSemPend(WSemPtr); 
        printString("works");
        YKSemPost(PSemPtr);
    }
}
Ejemplo n.º 3
0
void TaskSpace(void)
{
    while (1)
    {
        YKSemPend(SSemPtr);
        printChar(' ');
        YKSemPost(WSemPtr);
    }
}
Ejemplo n.º 4
0
void TaskPunc(void)
{
    while (1)
    {
        YKSemPend(PSemPtr);
        printChar('"');
        YKSemPost(WSemPtr);
                
        YKSemPend(PSemPtr);
        printChar(',');
        YKSemPost(SSemPtr);
                
        YKSemPend(PSemPtr);
        printString("!\"\r\n");
        YKSemPost(PSemPtr);
                
        YKDelayTask(6);
    }
}
Ejemplo n.º 5
0
int YKQPost(YKQ *queue, void *msg){
	//check if head == index
	if(queue->head == queue->tail){ // full
		//YKSemPost(queue->sem);
		return 0;
	}else{ //not full
		if(queue->head == -1) // empty
			queue->head = queue->tail;
		queue->queue[queue->tail++] = msg;
		if(queue->tail == queue->length)
			queue->tail = 0;
		YKSemPost(queue->sem);
		return 1;
	}

}
Ejemplo n.º 6
0
void handleRC(){ /* Received Command */
	/* Releases semaphore */
	YKSemPost(RCSem);
}
Ejemplo n.º 7
0
void recievedHandler(void)
{
	YKEnterMutex();
	YKSemPost(MoveSemPtr);
	YKEnterMutex();
}