Fork of https://developer.mbed.org/users/bscott/code/STM32_USBDevice/
Fork of STM32_USBDevice by
Diff: USBDevice/USBDevice.cpp
- Revision:
- 25:7c72828865f3
- Parent:
- 18:78bdbce94509
- Child:
- 26:8ef73dd868a0
--- a/USBDevice/USBDevice.cpp Fri May 16 09:00:39 2014 +0100 +++ b/USBDevice/USBDevice.cpp Tue Jun 03 11:30:32 2014 +0100 @@ -106,7 +106,7 @@ transfer.ptr = stringImanufacturerDesc(); transfer.direction = DEVICE_TO_HOST; success = true; - break; + break; case STRING_OFFSET_IPRODUCT: #ifdef DEBUG printf("3\r\n"); @@ -115,7 +115,7 @@ transfer.ptr = stringIproductDesc(); transfer.direction = DEVICE_TO_HOST; success = true; - break; + break; case STRING_OFFSET_ISERIAL: #ifdef DEBUG printf("4\r\n"); @@ -124,7 +124,7 @@ transfer.ptr = stringIserialDesc(); transfer.direction = DEVICE_TO_HOST; success = true; - break; + break; case STRING_OFFSET_ICONFIGURATION: #ifdef DEBUG printf("5\r\n"); @@ -133,7 +133,7 @@ transfer.ptr = stringIConfigurationDesc(); transfer.direction = DEVICE_TO_HOST; success = true; - break; + break; case STRING_OFFSET_IINTERFACE: #ifdef DEBUG printf("6\r\n"); @@ -142,7 +142,7 @@ transfer.ptr = stringIinterfaceDesc(); transfer.direction = DEVICE_TO_HOST; success = true; - break; + break; } break; case INTERFACE_DESCRIPTOR: @@ -357,7 +357,7 @@ { success = true; currentInterface = transfer.setup.wIndex; - currentAlternate = transfer.setup.wValue; + currentAlternate = transfer.setup.wValue; } return success; } @@ -473,12 +473,12 @@ if (success) { - /* Send the status */ + /* Send the status */ transfer.ptr = (uint8_t *)&status; /* Assumes little endian */ transfer.remaining = sizeof(status); transfer.direction = DEVICE_TO_HOST; } - + return success; } @@ -546,7 +546,7 @@ transfer.direction = 0; transfer.zlp = false; transfer.notify = false; - + #ifdef DEBUG printf("dataTransferDirection: %d\r\nType: %d\r\nRecipient: %d\r\nbRequest: %d\r\nwValue: %d\r\nwIndex: %d\r\nwLength: %d\r\n",transfer.setup.bmRequestType.dataTransferDirection, transfer.setup.bmRequestType.Type, @@ -593,7 +593,7 @@ } else { - + /* OUT data stage is required */ if (transfer.direction != HOST_TO_DEVICE) { @@ -707,7 +707,7 @@ { /* Connect device */ USBHAL::connect(); - + if (blocking) { /* Block if not configured */ while (!configured()); @@ -793,8 +793,8 @@ USBDevice::USBDevice(uint16_t vendor_id, uint16_t product_id, uint16_t product_release){ - VENDOR_ID = vendor_id; - PRODUCT_ID = product_id; + VENDOR_ID = vendor_id; + PRODUCT_ID = product_id; PRODUCT_RELEASE = product_release; /* Set initial device state */ @@ -818,12 +818,12 @@ { return false; } - - + + if(!configured()) { return false; } - + /* Send report */ result = endpointWrite(endpoint, buffer, size); @@ -849,7 +849,7 @@ { return false; } - + if(!configured()) { return false; } @@ -872,7 +872,7 @@ bool USBDevice::readEP(uint8_t endpoint, uint8_t * buffer, uint32_t * size, uint32_t maxSize) { EP_STATUS result; - + if(!configured()) { return false; } @@ -889,13 +889,13 @@ bool USBDevice::readEP_NB(uint8_t endpoint, uint8_t * buffer, uint32_t * size, uint32_t maxSize) { EP_STATUS result; - + if(!configured()) { return false; } result = endpointReadResult(endpoint, buffer, size); - + return (result == EP_COMPLETED); }