2018.07.26
Dependencies: FATFileSystem2 mbed-rtos
Fork of USBHost by
Diff: USBHost/USBHost.cpp
- Revision:
- 13:b58a2204422f
- Parent:
- 10:0c11cf1cc218
- Child:
- 14:80c2d927b9b5
--- a/USBHost/USBHost.cpp Tue Aug 13 09:42:31 2013 +0000 +++ b/USBHost/USBHost.cpp Mon Sep 16 15:36:24 2013 +0100 @@ -96,7 +96,6 @@ if (i == MAX_DEVICE_CONNECTED) { USB_ERR("Too many device connected!!\r\n"); - deviceInited[i] = false; usb_mutex.unlock(); continue; } @@ -287,7 +286,7 @@ { uint8_t state; - if(addr == NULL) + if(addr == 0) return; volatile HCTD* tdList = NULL; @@ -482,6 +481,8 @@ case INTERRUPT_ENDPOINT: tailInterruptEndpoint = prec; break; + default: + break; } } current->setState(USB_TYPE_FREE); @@ -1152,13 +1153,12 @@ void USBHost::fillControlBuf(uint8_t requestType, uint8_t request, uint16_t value, uint16_t index, int len) { -#ifdef __BIG_ENDIAN -#error "Must implement BE to LE conv here" -#endif setupPacket[0] = requestType; setupPacket[1] = request; - //We are in LE so it's fine - *((uint16_t*)&setupPacket[2]) = value; - *((uint16_t*)&setupPacket[4]) = index; - *((uint16_t*)&setupPacket[6]) = (uint32_t) len; + setupPacket[2] = (uint8_t) value; + setupPacket[3] = (uint8_t) (value >> 8); + setupPacket[4] = (uint8_t) index; + setupPacket[5] = (uint8_t) (index >> 8); + setupPacket[6] = (uint8_t) len; + setupPacket[7] = (uint8_t) (len >> 8); }