USB device library for Xadow M0
Dependents: xadow_m0_accelerometer xadow_m0_ada_gps xadow_m0_SD_Hello Xadow_SC16IS750_Test ... more
Fork of USBDevice by
Diff: USBMSD/USBMSD.cpp
- Revision:
- 11:eeb3cbbaa996
- Parent:
- 8:335f2506f422
- Child:
- 14:d495202c90f4
--- a/USBMSD/USBMSD.cpp Thu May 30 17:16:57 2013 +0100 +++ b/USBMSD/USBMSD.cpp Mon Aug 05 14:13:36 2013 +0300 @@ -192,16 +192,16 @@ sendCSW(); break; - // an error has occured - case ERROR: + // the host has received the CSW -> we wait a CBW + case WAIT_CSW: + stage = READ_CBW; + break; + + // an error has occured + default: stallEndpoint(EPBULK_IN); sendCSW(); break; - - // the host has received the CSW -> we wait a CBW - case WAIT_CSW: - stage = READ_CBW; - break; } return true; } @@ -284,15 +284,15 @@ bool USBMSD::readFormatCapacity() { uint8_t capacity[] = { 0x00, 0x00, 0x00, 0x08, - (BlockCount >> 24) & 0xff, - (BlockCount >> 16) & 0xff, - (BlockCount >> 8) & 0xff, - (BlockCount >> 0) & 0xff, + (uint8_t)((BlockCount >> 24) & 0xff), + (uint8_t)((BlockCount >> 16) & 0xff), + (uint8_t)((BlockCount >> 8) & 0xff), + (uint8_t)((BlockCount >> 0) & 0xff), 0x02, - (BlockSize >> 16) & 0xff, - (BlockSize >> 8) & 0xff, - (BlockSize >> 0) & 0xff, + (uint8_t)((BlockSize >> 16) & 0xff), + (uint8_t)((BlockSize >> 8) & 0xff), + (uint8_t)((BlockSize >> 0) & 0xff), }; if (!write(capacity, sizeof(capacity))) { return false; @@ -303,15 +303,15 @@ bool USBMSD::readCapacity (void) { uint8_t capacity[] = { - ((BlockCount - 1) >> 24) & 0xff, - ((BlockCount - 1) >> 16) & 0xff, - ((BlockCount - 1) >> 8) & 0xff, - ((BlockCount - 1) >> 0) & 0xff, + (uint8_t)(((BlockCount - 1) >> 24) & 0xff), + (uint8_t)(((BlockCount - 1) >> 16) & 0xff), + (uint8_t)(((BlockCount - 1) >> 8) & 0xff), + (uint8_t)(((BlockCount - 1) >> 0) & 0xff), - (BlockSize >> 24) & 0xff, - (BlockSize >> 16) & 0xff, - (BlockSize >> 8) & 0xff, - (BlockSize >> 0) & 0xff, + (uint8_t)((BlockSize >> 24) & 0xff), + (uint8_t)((BlockSize >> 16) & 0xff), + (uint8_t)((BlockSize >> 8) & 0xff), + (uint8_t)((BlockSize >> 0) & 0xff), }; if (!write(capacity, sizeof(capacity))) { return false;