Example #1
0
void sense(int x, int y)
{
	if( (x > 545 && x < 600) && (y > 15 && y < 49) )//Record Button
		startRec();
	else if( (x > 476 && x < 545) && (y > 15 && y < 49) )//Play
		startPlay();
	else if( (x > 426 && x < 476) && (y > 15 && y < 49) )//Back
		goBack();
	else if( (x > 452 && x < 574) && (y > 115 && y < 160) )//Back
		playRest();
	else if( (x > 50 && x < 325) && (y > 534 && y < 711) )//Snare
		playSnare();
	else if( (x > 0 && x < 270) && (y > 340 && y < 480) )//Hihat
		playHihat();
	else if( (x > 365 && x < 665) && (y > 550 && y < 715) )//Bass
		playBass();
	else if( (x > 288 && x < 468) && (y > 255 && y < 387) )//Hi tom
		playHi();
	else if( (x > 547 && x < 741) && (y > 241 && y < 381) )//Low tom
		playLow();
	else if( (x > 718 && x < 1024) && (y > 502 && y < 692) )//Floor tom
		playFloor();
	else if( (x > 773 && x < 1024) && (y > 100 && y < 390) )//Crash
		playCrash();
	else if( (x > 0 && x < 325) && (y > 100 && y < 275) )//Ride
		playRide();
}
Example #2
0
int buildCommand(uint8_t* buffer, uint8_t* command){
	static int currentPos = 0;
	static int commandPos = 0;
	static uint8_t reciving = 0;
	uint8_t currentChar = 0;
	static uint8_t gotStart = 0;
	uint8_t done = 0;
	int i;
	int recCount = ptrUSART->GetRxCount();
	while((recCount > currentPos || currentPos > recCount) && !done){
		currentChar = buffer[currentPos];
		if(currentChar == 0x02 && !gotStart){
			gotStart = 1;
			for( i = 0; i < BUFFERSIZE_COM; i++){
				command[i] = 0;
			}
			commandPos = 0;
		}else if(!gotStart){
			puts("out of massage :(");
		}else if(currentChar == 0x03  && (command[0]!='x' || commandPos > 3)){
			gotStart = 0;
			if(commandPos > 0)
				done = 1;
		}else if(commandPos < BUFFERSIZE_COM){
			command[commandPos] = currentChar;
			commandPos++;
		}else{
			puts("command not closed :(");
		}
		currentPos++;
		if(currentPos >= 100){
			currentPos = 0;
		}
	}

	if(!reciving){
		startRec(buffer);
		reciving = 1;
	}		
	return done;
}
Example #3
0
void myUSART_callback(uint32_t event){
	switch (event)
	{
	case ARM_USART_EVENT_RECEIVE_COMPLETE: 
		startRec(input_buf);
		break;
	case ARM_USART_EVENT_TRANSFER_COMPLETE:
	case ARM_USART_EVENT_SEND_COMPLETE:
	case ARM_USART_EVENT_TX_COMPLETE:
		break;

	case ARM_USART_EVENT_RX_TIMEOUT:
		break;

	case ARM_USART_EVENT_RX_OVERFLOW:
		puts("Lost data");
		break;
	case ARM_USART_EVENT_TX_UNDERFLOW:
		break;
	}
}
Example #4
0
void menuFn(char dByte)
{
    void        (*restart_vector)(void) = 0;

    switch(dByte){
		case '\\':
			restart_vector = NULL;
            printf("Restarting...");
            udelay(3000);
            restart_vector();
            break;
        case 'R':
        case 'r':
            startRec();
            break;
        case 'P':
        case 'p':
            startPlay();
            break;
        case 'E':
        case 'e':
            if(audioMode != A_STOP)
                erD_sndstr("Error: audio machine is running\n\r");
            else{
                memset(audioBuffer, 0, sizeof(audioBuffer));
                recFlg = 0;
            }
            break;
        case 'S':
        case 's':
            audioMode = A_STOP;
            audioIoChnnlStop();
            erD_sndstr("\n\rSTOP\n\r");
            break;
        case 'M':
        case 'm':
            erD_hwDump((void*)audioBuffer+512 , 512);
            break;
        case 'X':
        case 'x':
            erD_hwDump((void*)inChnnlNxtBuf() , 128);
            erD_hwDump((void*)inChnnlBufInUse() , 128);
            break;
        case 'Y':
        case 'y':
            erD_hwDump((void*)outChnnlNxtBuf() , 128);
            erD_hwDump((void*)outChnnlBufInUse() , 128);
            break;
        case 'I':
        case 'i':
            erD_sndstr("\n\rS5 info\n\r");
            erD_sndstr("\n\rCerfPDA audio demo\n\r");
            break;
        case 'H':
        case 'h':
            erD_sndstr("\n\n\rHELP\n\r");
            erD_sndstr("R: record\n\r");
            erD_sndstr("P: play\n\r");
            erD_sndstr("E: erase\n\r");
            erD_sndstr("S: stop\n\r");
            erD_sndstr("M: encoded audio buffer memory dump\n\r");
            erD_sndstr("X: input audio buffer memory dump\n\r");
            erD_sndstr("Y: output audio buffer memory dump\n\r");
            erD_sndstr("V: version\n\r");
            erD_sndstr("\\: restart unit\n\r");
            erD_sndstr("H: help\n\r");
            break;

	}
}