stmhal: Fix USB CDC not flushing packets when an exact multiple of 64.

Need to send a zero-sized packet after sending an exact multiple of 64
bytes (not just after sending 64 bytes exactly).

Addresses issue #494, part 2.
This commit is contained in:
Damien George 2014-05-10 18:56:16 +01:00
parent 0fb80c303a
commit 09bbe7215a
1 changed files with 1 additions and 1 deletions

View File

@ -313,7 +313,7 @@ void USBD_CDC_HAL_TIM_PeriodElapsedCallback(void) {
// the host waits for all data to arrive (ie, waits for a packet < max packet size).
// To flush a packet of exactly max packet size, we need to send a zero-size packet.
// See eg http://www.cypress.com/?id=4&rID=92719
UserTxNeedEmptyPacket = (buffsize == CDC_DATA_FS_MAX_PACKET_SIZE && UserTxBufPtrOutShadow == UserTxBufPtrIn);
UserTxNeedEmptyPacket = (buffsize > 0 && buffsize % CDC_DATA_FS_MAX_PACKET_SIZE == 0 && UserTxBufPtrOutShadow == UserTxBufPtrIn);
}
}
}