summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-05-10 18:56:16 +0100
committerDamien George <damien.p.george@gmail.com>2014-05-10 18:56:16 +0100
commit09bbe7215a70dbe9105a48865a1545e6c095baef (patch)
treefd9b7a7c587b57ec2928893cf26f26b3218e6f64
parent0fb80c303a2685372fe93ff23cecad9f7dfc67fe (diff)
downloadmicropython-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.c2
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);
}
}
}