Exemple #1
0
int main(int argc, char *argv[])
{
   printf("Welcome to Little Cave Adventure.\n");
   while (parseAndExecute(input) && getInput(argv[1]));
   printf("\nBye!\n");
   return 0;
}
Exemple #2
0
int cmdloop()
{
    SdrLib *sdr = sdrCreate(NULL, NULL, NULL);
    if (!sdr)
        return FALSE;
    char *inbuf = (char *)malloc(BUFLEN+1);
    while (1)
        {
        printf("sdr > ");
        fgets(inbuf, BUFLEN, stdin);
        int ret = parseAndExecute(sdr, inbuf);
        if (ret < 0)
            break;
        }
    sdrDelete(sdr);
    return TRUE;
}
Exemple #3
0
void main_loop(){

	unsigned char message[5];
	int count = 0;
	//pwmCounter = 0;
	//parse and execute loop
	while (1)
    {

    	if (UARTCharsAvail(UART0_BASE)){
    		if(count==0){
    			message[0] =  UARTCharGet(UART0_BASE);	//grab first byte
    			//toggle();
    		}
    		if(count==1){
    			message[1] = UARTCharGet(UART0_BASE);
    			//toggle();
    		}
    		if(count==2){
    			message[2] = UARTCharGet(UART0_BASE);
    			//toggle();
    		}
    		if(count==3){
    			message[3] = UARTCharGet(UART0_BASE); //grab last byte
    			//toggle();
    		}
    		if(count==4){
    			message[4] = UARTCharGet(UART0_BASE); //grab CRC
				if (crc8(0,message,4)==message[4]){
					UARTCharPut(UART0_BASE, 0xFF);	//CRC good (tell python end that)
					parseAndExecute(message);
				}else{
					UARTCharPut(UART0_BASE, 0x00);	//CRC bad
					redOn();
				}
    		}

    		count = count + 1;
    		if(count == 5)
    				count = 0;

    	}
    }
}