void LoopScheduler()
{
	// The heartbeat timer controls how often the green LED blinks
	if(rdint(I_LSC_HEARTBEAT) <= 0)
	{
		wrint(I_LSC_HEARTBEAT, rdint(I_LSD_HEARTBEAT)); 	
		HeliosSetLED1(!HeliosReadLED1());
	}
	


	// the state data timer controls how often the state register data is 
	// sent to the GUI. 
	if(rdint(I_LSC_STATE_DATA) <= 0)
	{
		wrint(I_LSC_STATE_DATA, rdint(I_LSD_STATE_DATA)); 	
		wrchar(C_REQ_STATE_DATA,TRUE);	
	}
	


	// The read button timer controls how often we read the button.
	// This is done to "de-bounce" the button
	
	if(rdint(I_LSC_READ_BUTTON) <= 0)
	{
		wrint(I_LSC_READ_BUTTON, 100); // Hard code to the button to be read every 100ms

		if(HeliosReadBTN())
		{
			xil_printf("BUTTON!");
			// Do something in response to button push
			Game_Shoot(GAME_KILL_SHOT);
			wrint(I_LSC_READ_BUTTON, 750); // if the button was pushed then we want to wait longer before reading it again to avoid double pushing
		}
	}
	
	int stat = CameraStatus(XPAR_PLB_VISION_0_BASEADDR);
	if(stat == 0xD1) //capture done but FIFO not empty
	{
		stallTimes++;
		if(stallTimes > 1000)
		{
		  //xil_printf("Reboot");
			ResetCameraCore();
			FT_StartCapture(g_capture_fte->next);
			//StartFrameCapture(XPAR_PLB_VISION_0_BASEADDR);
			stallTimes = 0;
		}
	}

	
	//These should also be calculated every so many ms
	// but i don't need them right now so i am not implementing them
	//calculateSpeed();
	//TruckControlInterruptRoutine();
}
char* sillaba(char* str) {
    int len = strlen(str)+1;
    char* dest = (char*)malloc(sizeof(char)*len);
    int pos = 0;
    for (; *str != '\0'; str++) {
        //printf("pos %i, str[0] %c\n", pos, *str);
        wrchar(dest, *str, &pos);
        if (chinstr(*str, VOW)) {
            // vocale seguita da doppia consonante
            if (chinstr(str[1], CON) && str[1] == str[2]) {
                str++;
                wrchar(dest, *str, &pos);
            }
            // vocale non seguita da spazio/terminatore
            if (str[1] != '\0' && !chinstr(str[1], WSP)) {
                dest = (char*)realloc(dest, (++len)*sizeof(char));
                wrchar(dest, SEP, &pos);
            }
        }
    }
    wrchar(dest, '\0', &pos);
    return dest;
}
Beispiel #3
0
// saves the map item to the current file
void Tmap_item::save()
{
  wrchar( options );
}