case HOST_STATE_Ready:\r
/* Select and the data IN pipe */\r
Pipe_SelectPipe(CDC_DATAPIPE_IN);\r
+ Pipe_Unfreeze();\r
\r
/* Check to see if a packet has been received */\r
if (Pipe_IsINReceived())\r
{\r
+ /* Re-freeze IN pipe after the packet has been received */\r
+ Pipe_Freeze();\r
+\r
/* Check if data is in the pipe */\r
if (Pipe_IsReadWriteAllowed())\r
{\r
Pipe_ClearIN();\r
}\r
\r
+ /* Re-freeze IN pipe after use */\r
+ Pipe_Freeze();\r
+\r
/* Select and unfreeze the notification pipe */\r
Pipe_SelectPipe(CDC_NOTIFICATIONPIPE);\r
Pipe_Unfreeze();\r
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
\r
Pipe_SetInfiniteINRequests();\r
- Pipe_Unfreeze();\r
\r
/* Set the flag indicating that the data IN pipe has been found */\r
FoundEndpoints |= (1 << CDC_DATAPIPE_IN);\r
Pipe_ConfigurePipe(CDC_DATAPIPE_OUT, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
\r
- Pipe_Unfreeze();\r
- \r
/* Set the flag indicating that the data OUT pipe has been found */\r
FoundEndpoints |= (1 << CDC_DATAPIPE_OUT);\r
}\r
uint8_t* DataStream = (uint8_t*)Data;\r
uint8_t ErrorCode;\r
\r
+ Pipe_SetToken(PIPE_TOKEN_OUT);\r
+\r
if ((ErrorCode = Pipe_WaitUntilReady()))\r
return ErrorCode;\r
\r
uint8_t* DataStream = (uint8_t*)(Data + Length - 1);\r
uint8_t ErrorCode;\r
\r
+ Pipe_SetToken(PIPE_TOKEN_OUT);\r
+\r
if ((ErrorCode = Pipe_WaitUntilReady()))\r
return ErrorCode;\r
\r
{\r
uint8_t ErrorCode;\r
\r
+ Pipe_SetToken(PIPE_TOKEN_IN);\r
+\r
if ((ErrorCode = Pipe_WaitUntilReady()))\r
return ErrorCode;\r
\r
uint8_t* DataStream = (uint8_t*)Buffer;\r
uint8_t ErrorCode;\r
\r
+ Pipe_SetToken(PIPE_TOKEN_IN);\r
+\r
if ((ErrorCode = Pipe_WaitUntilReady()))\r
return ErrorCode;\r
\r
uint8_t* DataStream = (uint8_t*)(Buffer + Length - 1);\r
uint8_t ErrorCode;\r
\r
+ Pipe_SetToken(PIPE_TOKEN_IN);\r
+\r
if ((ErrorCode = Pipe_WaitUntilReady()))\r
return ErrorCode;\r
\r
*\r
* The banking mode may be either \ref PIPE_BANK_SINGLE or \ref PIPE_BANK_DOUBLE.\r
*\r
- * A newly configured pipe is frozen by default, and must be unfrozen before use via the \ref Pipe_Unfreeze() macro.\r
+ * A newly configured pipe is frozen by default, and must be unfrozen before use via the \ref Pipe_Unfreeze()\r
+ * before being used. Pipes should be kept frozen unless waiting for data from a device while in IN mode, or\r
+ * sending data to the device in OUT mode.\r
*\r
* \note The default control pipe does not have to be manually configured, as it is automatically\r
* configured by the library internally.\r
* If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
* disabled and this function has the Callback parameter omitted.\r
*\r
+ * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without\r
+ * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().\r
+ *\r
* \ingroup Group_PipeRW\r
*\r
* \param Buffer Pointer to the source data buffer to read from.\r
* If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
* disabled and this function has the Callback parameter omitted.\r
*\r
+ * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without\r
+ * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().\r
+ *\r
* \ingroup Group_PipeRW\r
*\r
* \param Buffer Pointer to the source data buffer to read from.\r
* If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
* disabled and this function has the Callback parameter omitted.\r
*\r
+ * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without\r
+ * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().\r
+ *\r
* \ingroup Group_PipeRW\r
*\r
* \param Length Number of bytes to send via the currently selected pipe.\r
* If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
* disabled and this function has the Callback parameter omitted.\r
*\r
+ * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without\r
+ * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().\r
+ *\r
* \ingroup Group_PipeRW\r
*\r
* \param Buffer Pointer to the source data buffer to write to.\r
* If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
* disabled and this function has the Callback parameter omitted.\r
*\r
+ * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without\r
+ * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().\r
+ *\r
* \ingroup Group_PipeRW\r
*\r
* \param Buffer Pointer to the source data buffer to write to.\r