/** * @brief Main program. * @param None * @retval None */ void main(void) { u8 l_cnt; disableInterrupts(); Config(); Errors_Init(); enableInterrupts(); Goto_HALT(); while (1) { if((btn_pressed != BUTTON1) && (btn_pressed != BUTTON2)) { DELAY_STOP; goto sleep; } while(!DELAY_EXPIRED); // wait for power-up delay to expire (~20ms) DELAY_STOP; disableInterrupts(); if(btn_pressed == BUTTON1) { RF_Send(RFCMD_HEATING_ON); } else if(btn_pressed = BUTTON2) { RF_Send(RFCMD_HEATING_OFF); } enableInterrupts(); sleep: Goto_HALT(); } }
void playVGuitar() { unsigned char usrExit[] = {0}; char keyNote = 0; unsigned int xCoord = 0; unsigned int yCoord = 0; unsigned char sendBuf[3] = {0}; while(1) { if (RF_gets_nblk(usrExit) != 0) { if (strncmp (usrExit, "STOP", 4) == 0) { break; } } else { getTsXY(&xCoord, &yCoord); keyNote = guitar_key_match(xCoord, yCoord); halMcuWaitMs(20); if (keyNote) { //send the note over rf and serial sendBuf[0] = 0; //Channel sendBuf[1] = keyNote; //Note sendBuf[2] = 0x7f; //Attack Velocity //TODO: use pressure halMcuWaitMs(50); RF_Send(sendBuf, 3); } } }//while(1) }
/*********************************************************************************** * @fn getTsXY * * @brief Send X and Y Coordinates to Host * * @param unsigned int xCoord * X-Coordinate * unsigned int yCoord * Y-Coordinate * * @return none */ void sendData(unsigned int xCoord, unsigned int yCoord) { //static char byte[5]; // xCoord -= 1100; // yCoord -= 700; unsigned char keyNote = 0; if((signed int)xCoord < 0) xCoord = 0; if((signed int)yCoord < 0) yCoord = 0; sprintf(str_buf, "X: %d, Y:%d\n\r",xCoord, yCoord); tx1_send(str_buf,strlen(str_buf)); keyNote = piano_key_match(xCoord, yCoord); //keyNote = drum_key_match(xCoord, yCoord); tx1_send(&keyNote, 1); RF_Send(&keyNote, 1); }
/******************************************************************************* * Description : RF_test * Syntax : * Parameters I: * Parameters O: * return : *******************************************************************************/ void RF_test(void) { RF_Send(); delay_s(12); RF_Recv(); }