Added new HOST_STATE_WaitForDeviceRemoval host state machine state for non-blocking disabling of device communications until the device has been removed (for use when an error occurs or communications with the device have completed). Changed over all host mode demos to use the new state.
Added verbose documentation for each of the USB Host state machine states.
This commit is contained in:
parent
a54ed0085b
commit
0fcbe22c9e
18 changed files with 172 additions and 82 deletions
|
@ -34,28 +34,15 @@ uint8_t ProcessDeviceDescriptor(void)
|
|||
{
|
||||
USB_Descriptor_Device_t DeviceDescriptor;
|
||||
|
||||
/* Standard request to get the device descriptor */
|
||||
USB_ControlRequest = (USB_Request_Header_t)
|
||||
{
|
||||
bmRequestType: (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE),
|
||||
bRequest: REQ_GetDescriptor,
|
||||
wValue: (DTYPE_Device << 8),
|
||||
wIndex: 0,
|
||||
wLength: sizeof(USB_Descriptor_Device_t),
|
||||
};
|
||||
|
||||
/* Select the control pipe for the request transfer */
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
/* Send the request to retrieve the device descriptor */
|
||||
if (USB_Host_SendControlRequest((void*)&DeviceDescriptor) != HOST_SENDCONTROL_Successful)
|
||||
if (USB_Host_GetDeviceDescriptor(&DeviceDescriptor) != HOST_SENDCONTROL_Successful)
|
||||
return ControlErrorDuringDeviceRead;
|
||||
|
||||
/* Validate returned data - ensure the returned data is a device descriptor */
|
||||
if (DeviceDescriptor.Header.Type != DTYPE_Device)
|
||||
return InvalidDeviceDataReturned;
|
||||
|
||||
if ((DeviceDescriptor.Class != BLUETOOTH_DEVICE_CLASS) ||
|
||||
if ((DeviceDescriptor.Class != BLUETOOTH_DEVICE_CLASS) ||
|
||||
(DeviceDescriptor.SubClass != BLUETOOTH_DEVICE_SUBCLASS) ||
|
||||
(DeviceDescriptor.Protocol != BLUETOOTH_DEVICE_PROTOCOL))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue