mirror of
https://github.com/zsa/qmk_firmware.git
synced 2026-05-04 06:33:03 +00:00
Seperated out parts of the PrinterHost incomplete demo into a seperate Lib subdirectory.
Fixed Host mode to Device mode UID change not causing a USB Disconnect event when a device was connected.
This commit is contained in:
@@ -243,8 +243,8 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
||||
{
|
||||
if (USB_CurrentMode == USB_MODE_HOST)
|
||||
EVENT_USB_DeviceUnattached();
|
||||
else
|
||||
EVENT_USB_Disconnect();
|
||||
|
||||
EVENT_USB_Disconnect();
|
||||
}
|
||||
|
||||
EVENT_USB_UIDChange();
|
||||
|
||||
@@ -39,7 +39,7 @@ volatile bool USB_IsInitialized;
|
||||
USB_Request_Header_t USB_ControlRequest;
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
volatile uint8_t USB_HostState;
|
||||
volatile uint8_t USB_HostState;
|
||||
#endif
|
||||
|
||||
void USB_USBTask(void)
|
||||
|
||||
@@ -58,7 +58,7 @@ uint8_t USB_Host_SendControlRequest(void* BufferPtr)
|
||||
|
||||
Pipe_ClearSETUP();
|
||||
|
||||
if ((ReturnStatus = USB_Host_Wait_For_Setup_IOS(USB_HOST_WAITFOR_SetupSent)))
|
||||
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_SetupSent)))
|
||||
goto End_Of_Control_Send;
|
||||
|
||||
Pipe_Freeze();
|
||||
@@ -76,7 +76,7 @@ uint8_t USB_Host_SendControlRequest(void* BufferPtr)
|
||||
{
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if ((ReturnStatus = USB_Host_Wait_For_Setup_IOS(USB_HOST_WAITFOR_InReceived)))
|
||||
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)))
|
||||
goto End_Of_Control_Send;
|
||||
|
||||
if (!(Pipe_BytesInPipe()))
|
||||
@@ -96,12 +96,12 @@ uint8_t USB_Host_SendControlRequest(void* BufferPtr)
|
||||
Pipe_SetToken(PIPE_TOKEN_OUT);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if ((ReturnStatus = USB_Host_Wait_For_Setup_IOS(USB_HOST_WAITFOR_OutReady)))
|
||||
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)))
|
||||
goto End_Of_Control_Send;
|
||||
|
||||
Pipe_ClearOUT();
|
||||
|
||||
if ((ReturnStatus = USB_Host_Wait_For_Setup_IOS(USB_HOST_WAITFOR_OutReady)))
|
||||
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)))
|
||||
goto End_Of_Control_Send;
|
||||
}
|
||||
else
|
||||
@@ -113,7 +113,7 @@ uint8_t USB_Host_SendControlRequest(void* BufferPtr)
|
||||
|
||||
while (DataLen)
|
||||
{
|
||||
if ((ReturnStatus = USB_Host_Wait_For_Setup_IOS(USB_HOST_WAITFOR_OutReady)))
|
||||
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)))
|
||||
goto End_Of_Control_Send;
|
||||
|
||||
while (DataLen && (Pipe_BytesInPipe() < USB_ControlPipeSize))
|
||||
@@ -125,7 +125,7 @@ uint8_t USB_Host_SendControlRequest(void* BufferPtr)
|
||||
Pipe_ClearOUT();
|
||||
}
|
||||
|
||||
if ((ReturnStatus = USB_Host_Wait_For_Setup_IOS(USB_HOST_WAITFOR_OutReady)))
|
||||
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)))
|
||||
goto End_Of_Control_Send;
|
||||
|
||||
Pipe_Freeze();
|
||||
@@ -134,7 +134,7 @@ uint8_t USB_Host_SendControlRequest(void* BufferPtr)
|
||||
Pipe_SetToken(PIPE_TOKEN_IN);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if ((ReturnStatus = USB_Host_Wait_For_Setup_IOS(USB_HOST_WAITFOR_InReceived)))
|
||||
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)))
|
||||
goto End_Of_Control_Send;
|
||||
|
||||
Pipe_ClearIN();
|
||||
@@ -151,7 +151,7 @@ End_Of_Control_Send:
|
||||
return ReturnStatus;
|
||||
}
|
||||
|
||||
static uint8_t USB_Host_Wait_For_Setup_IOS(const uint8_t WaitType)
|
||||
static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType)
|
||||
{
|
||||
#if (USB_HOST_TIMEOUT_MS < 0xFF)
|
||||
uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(INCLUDE_FROM_HOSTCHAPTER9_C)
|
||||
static uint8_t USB_Host_Wait_For_Setup_IOS(const uint8_t WaitType);
|
||||
static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user