1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

Stop using uint8_t to determine if bytes are available from USB. If we buffer more than that we'll never be able to read it all.

This commit is contained in:
Scott Shawcroft 2016-06-25 10:48:24 -07:00
parent fefd34d05a
commit a4e5e30152
4 changed files with 11 additions and 11 deletions

View file

@ -62,7 +62,7 @@ typedef struct serialPort_s {
struct serialPortVTable {
void (*serialWrite)(serialPort_t *instance, uint8_t ch);
uint8_t (*serialTotalRxWaiting)(serialPort_t *instance);
uint32_t (*serialTotalRxWaiting)(serialPort_t *instance);
uint8_t (*serialTotalTxFree)(serialPort_t *instance);
uint8_t (*serialRead)(serialPort_t *instance);

View file

@ -292,7 +292,7 @@ void uartStartTxDMA(uartPort_t *s)
#endif
}
uint8_t uartTotalRxBytesWaiting(serialPort_t *instance)
uint32_t uartTotalRxBytesWaiting(serialPort_t *instance)
{
uartPort_t *s = (uartPort_t*)instance;
#ifdef STM32F4

View file

@ -65,7 +65,7 @@ serialPort_t *uartOpen(USART_TypeDef *USARTx, serialReceiveCallbackPtr callback,
// serialPort API
void uartWrite(serialPort_t *instance, uint8_t ch);
uint8_t uartTotalRxBytesWaiting(serialPort_t *instance);
uint32_t uartTotalRxBytesWaiting(serialPort_t *instance);
uint8_t uartTotalTxBytesFree(serialPort_t *instance);
uint8_t uartRead(serialPort_t *instance);
void uartSetBaudRate(serialPort_t *s, uint32_t baudRate);

View file

@ -66,11 +66,11 @@ static bool isUsbVcpTransmitBufferEmpty(serialPort_t *instance)
return true;
}
static uint8_t usbVcpAvailable(serialPort_t *instance)
static uint32_t usbVcpAvailable(serialPort_t *instance)
{
UNUSED(instance);
return receiveLength & 0xFF; // FIXME use uint32_t return type everywhere
return receiveLength;
}
static uint8_t usbVcpRead(serialPort_t *instance)