stmhal: Fix bug with USB CDC transmit buffer wrap around.

This commit is contained in:
Damien George 2014-03-24 12:23:03 +00:00
parent a82d7ef29d
commit 2f8beb8d88
1 changed files with 1 additions and 1 deletions

View File

@ -363,7 +363,7 @@ void USBD_CDC_SetInterrupt(int chr, void *data) {
void USBD_CDC_Tx(const char *str, uint32_t len) { void USBD_CDC_Tx(const char *str, uint32_t len) {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
uint timeout = 200; uint timeout = 200;
while (UserTxBufPtrIn + 1 == UserTxBufPtrOut) { while (((UserTxBufPtrIn + 1) & (APP_TX_DATA_SIZE - 1)) == UserTxBufPtrOut) {
if (timeout-- == 0) { if (timeout-- == 0) {
break; break;
} }