/** * @brief This function handles External USB interrupt requests. * @param None * @retval None */ void USB_LP_IRQHandler(void) { uint8_t c; SdkEvalVCIntServRoutine(); if(__io_getcharNonBlocking(&c)) { if(c=='i' || c=='I') Set_DOWNStatus(); else if(c=='l' || c=='L') Set_UPStatus(); else// if(c=='d') Set_RightStatus(); } }
/******************************************************************************* * Function Name : sendSerialData * Description : It processes serial commands * Input : None * Output : None * Return : None *******************************************************************************/ void processSerialInput(void) { static u8 buffer[BUFFER_SIZE]; static u8 bufferSize = 0; static u32 bufferTimeout = TIMEOUT_VALUE; if (bufferSize ==0) bufferTimeout = TIMEOUT_VALUE; if (__io_getcharNonBlocking(buffer+bufferSize)) { bufferSize+=1; } bufferTimeout--; if ((bufferTimeout == 0) || (bufferSize == BUFFER_SIZE)) { if (bufferSize > 0) { sendSerialData(bufferSize, buffer); bufferSize = 0; } } }/* end processSerialInput() */
/** * @brief Processes serial input and button preses * @param None * @retval None */ void processInput(void) { static uint8_t buffer[BUFFER_SIZE]; static uint8_t bufferSize = 0; static uint32_t bufferTimeout = TIMEOUT_VALUE; if (bufferSize ==0) { bufferTimeout = TIMEOUT_VALUE; } if (__io_getcharNonBlocking(buffer+bufferSize)) { bufferSize+=1; } if (getButtonStatus(BUTTON_S1) == BUTTON_CLICKED) { buttonAction(BUTTON_ACTION_1); } #ifdef USE_MB950 else if (getButtonStatus(BUTTON_S2) == BUTTON_CLICKED) { buttonAction(BUTTON_ACTION_2); } else if (getButtonStatus(BUTTON_S3) == BUTTON_CLICKED) { buttonAction(BUTTON_ACTION_3); } else if (getButtonStatus(BUTTON_S4) == BUTTON_CLICKED) { buttonAction(BUTTON_ACTION_4); } else if (getButtonStatus(BUTTON_S5) == BUTTON_CLICKED) { buttonAction(BUTTON_ACTION_5); } #endif /* USE_MB950 */ else { bufferTimeout--; if ((bufferTimeout == 0) || (bufferSize == BUFFER_SIZE)) { if (bufferSize > 0) { sendData(bufferSize, buffer, TYPE_SERIAL); /*if (0==mz_t_) { mz_t_=1; printf("MZ Start\n"); //ST_RadioStartTransmitTone(); ST_RadioStartTransmitStream(); } else { mz_t_=0; printf("MZ Stop\n"); //ST_RadioStopTransmitTone(); ST_RadioStopTransmitStream(); }*/ bufferSize = 0; } } } }