diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-16 23:17:29 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-16 23:17:29 +0100 |
commit | 28817725fc42df64b409853e002eb1c9d0476cd5 (patch) | |
tree | c85e4d25c3127daea37aa59999941248f78f7bf3 /stmhal/usbd_cdc_interface.c | |
parent | 3f2f28981b3b8d4653736a27696f76cda4ae694f (diff) | |
download | micropython-28817725fc42df64b409853e002eb1c9d0476cd5.tar.gz micropython-28817725fc42df64b409853e002eb1c9d0476cd5.zip |
stmhal: Replace magic number 3 with CDC_IN_EP define.
Diffstat (limited to 'stmhal/usbd_cdc_interface.c')
-rw-r--r-- | stmhal/usbd_cdc_interface.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/stmhal/usbd_cdc_interface.c b/stmhal/usbd_cdc_interface.c index 552f7cc9ec..b81ab11b24 100644 --- a/stmhal/usbd_cdc_interface.c +++ b/stmhal/usbd_cdc_interface.c @@ -265,10 +265,11 @@ void USBD_CDC_HAL_TIM_PeriodElapsedCallback(void) { if (UserTxBufPtrOut != UserTxBufPtrOutShadow) { // We have sent data and are waiting for the low-level USB driver to // finish sending it over the USB in-endpoint. - if (UserTxBufPtrWaitCount < 10) { + // We have a 15 * 10ms = 150ms timeout + if (UserTxBufPtrWaitCount < 15) { PCD_HandleTypeDef *hpcd = hUSBDDevice.pData; USB_OTG_GlobalTypeDef *USBx = hpcd->Instance; - if (USBx_INEP(3)->DIEPTSIZ & USB_OTG_DIEPTSIZ_XFRSIZ) { + if (USBx_INEP(CDC_IN_EP & 0x7f)->DIEPTSIZ & USB_OTG_DIEPTSIZ_XFRSIZ) { // USB in-endpoint is still reading the data UserTxBufPtrWaitCount++; return; |