uint8_t receiveUARTF0(void) { uint8_t receivedData; while(!USART_IsRXComplete(&UARTF0)); receivedData = USART_GetChar(&UARTF0); return receivedData; }
uint8_t get_USART_char() { do { } while(!USART_IsRXComplete(&IMU_USART)); return USART_GetChar(&IMU_USART); }
/*! \brief Get UART data with timeout (8 bit character). * * \param usart The USART module. * \param timout The timeout.. * \param data The data to receive. */ bool USART_GetByte_Timeout(USART_t * usart, uint16_t timeout, uint8_t *pdata) { uint32_t ms_old_time, ms_time; RTC_GetCurrentTime(&ms_old_time); ms_time = ms_old_time; while( !USART_IsRXComplete(usart) && ms_time-ms_old_time < timeout ) { RTC_GetCurrentTime(&ms_time); //timeout_reg++; } if (!USART_IsRXComplete(usart) && ms_time-ms_old_time>=timeout) return 0; else *pdata = USART_GetChar(usart); return 1; }