unsigned char USBEndpointDescriptor_GetDirection(const USBEndpointDescriptor *endpoint) { if ((endpoint->bEndpointAddress & 0x80) != 0) { return USBEndpointDescriptor_IN; } else { return USBEndpointDescriptor_OUT; } }