diff options
author | Damien George <damien.p.george@gmail.com> | 2014-05-10 18:56:16 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-05-10 18:56:16 +0100 |
commit | 09bbe7215a70dbe9105a48865a1545e6c095baef (patch) | |
tree | fd9b7a7c587b57ec2928893cf26f26b3218e6f64 | |
parent | 0fb80c303a2685372fe93ff23cecad9f7dfc67fe (diff) | |
download | micropython-09bbe7215a70dbe9105a48865a1545e6c095baef.tar.gz micropython-09bbe7215a70dbe9105a48865a1545e6c095baef.zip |
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.
-rw-r--r-- | stmhal/usbd_cdc_interface.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/stmhal/usbd_cdc_interface.c b/stmhal/usbd_cdc_interface.c index d01d13e1ca..323ca74382 100644 --- a/stmhal/usbd_cdc_interface.c +++ b/stmhal/usbd_cdc_interface.c @@ -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); } } } |