stmhal: Replace magic number 3 with CDC_IN_EP define.

pull/506/merge
Damien George 2014-04-16 23:17:29 +01:00
rodzic 3f2f28981b
commit 28817725fc
3 zmienionych plików z 8 dodań i 5 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -13,6 +13,11 @@
#define MSC_IN_EP (0x81)
#define MSC_OUT_EP (0x01)
// Need to define here for usbd_cdc_interface.c (it needs CDC_IN_EP)
#define CDC_IN_EP (0x83)
#define CDC_OUT_EP (0x03)
#define CDC_CMD_EP (0x82)
// only CDC_MSC and CDC_HID are available
#define USBD_MODE_CDC (0x01)
#define USBD_MODE_MSC (0x02)

Wyświetl plik

@ -4,9 +4,6 @@
#define USB_CDC_MSC_CONFIG_DESC_SIZ (98)
#define USB_CDC_HID_CONFIG_DESC_SIZ (100)
#define CDC_IFACE_NUM (1)
#define CDC_IN_EP (0x83)
#define CDC_OUT_EP (0x03)
#define CDC_CMD_EP (0x82)
#define MSC_IFACE_NUM (0)
#define HID_IFACE_NUM_WITH_CDC (0)
#define HID_IFACE_NUM_WITH_MSC (1)