CDC_Device_Flush(CDCInterfaceInfo);\r
}\r
\r
-void CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, char* const Data, const uint16_t Length)\r
+uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, char* const Data, const uint16_t Length)\r
{\r
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))\r
- return;\r
+ return ENDPOINT_READYWAIT_NoError;\r
\r
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);\r
- Endpoint_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);\r
+ return Endpoint_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);\r
}\r
\r
-void CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, const uint8_t Data)\r
+uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, const uint8_t Data)\r
{\r
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))\r
- return;\r
+ return ENDPOINT_READYWAIT_NoError;\r
\r
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);\r
\r
if (!(Endpoint_IsReadWriteAllowed()))\r
{\r
+ uint8_t ErrorCode;\r
+ \r
Endpoint_ClearIN();\r
- Endpoint_WaitUntilReady();\r
+\r
+ if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)\r
+ return ErrorCode;\r
}\r
\r
- Endpoint_Write_Byte(Data); \r
+ Endpoint_Write_Byte(Data);\r
+ return ENDPOINT_READYWAIT_NoError;\r
}\r
\r
-void CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)\r
+uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)\r
{\r
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))\r
- return;\r
+ return ENDPOINT_READYWAIT_NoError;\r
\r
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);\r
\r
if (Endpoint_BytesInEndpoint())\r
{\r
+ uint8_t ErrorCode;\r
+\r
Endpoint_ClearIN();\r
- Endpoint_WaitUntilReady();\r
+ \r
+ if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)\r
+ return ErrorCode;\r
}\r
\r
Endpoint_ClearIN();\r
- Endpoint_WaitUntilReady(); \r
+ return Endpoint_WaitUntilReady();\r
}\r
\r
uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)\r
\r
uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)\r
{\r
- if (USB_DeviceState != DEVICE_STATE_Configured)\r
+ if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))\r
return 0;\r
\r
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);\r
\r
void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)\r
{\r
- if (USB_DeviceState != DEVICE_STATE_Configured)\r
+ if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))\r
return;\r
\r
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.NotificationEndpointNumber);\r
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.\r
* \param[in] Data Pointer to the string to send to the host\r
* \param[in] Length Size in bytes of the string to send to the host\r
+ *\r
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum\r
*/\r
- void CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, char* const Data, const uint16_t Length);\r
+ uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, char* const Data, const uint16_t Length);\r
\r
/** Sends a given byte to the attached USB host, if connected. If a host is not connected when the function is called, the\r
* byte is discarded.\r
*\r
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.\r
* \param[in] Data Byte of data to send to the host\r
+ *\r
+ * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum\r
*/\r
- void CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, const uint8_t Data);\r
+ uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, const uint8_t Data);\r
\r
/** Determines the number of bytes received by the CDC interface from the host, waiting to be read.\r
*\r
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.\r
*\r
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.\r
+ *\r
+ * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum\r
*/\r
- void CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);\r
+ uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);\r
\r
/** Sends a Serial Control Line State Change notification to the host. This should be called when the virtual serial\r
* control lines (DCD, DSR, etc.) have changed states, or to give BREAK notfications to the host. Line states persist\r
\r
}\r
\r
-void MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, MIDI_EventPacket_t* const Event)\r
+uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, MIDI_EventPacket_t* const Event)\r
{\r
if (USB_DeviceState != DEVICE_STATE_Configured)\r
- return;\r
+ return ENDPOINT_RWSTREAM_NoError;\r
\r
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);\r
\r
if (Endpoint_IsReadWriteAllowed());\r
{\r
- Endpoint_Write_Stream_LE(Event, sizeof(Event), NO_STREAM_CALLBACK);\r
+ uint8_t ErrorCode;\r
+\r
+ if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(Event), NO_STREAM_CALLBACK)) != ENDPOINT_RWSTREAM_NoError)\r
+ return ErrorCode;\r
+\r
Endpoint_ClearIN();\r
}\r
+ \r
+ return ENDPOINT_RWSTREAM_NoError;\r
}\r
\r
bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, MIDI_EventPacket_t* const Event)\r
*\r
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.\r
* \param[in] Event Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send\r
+ *\r
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum \r
*/\r
- void MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, MIDI_EventPacket_t* const Event);\r
+ uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, MIDI_EventPacket_t* const Event);\r
\r
/** Receives a MIDI event packet from the host.\r
*\r
* HID interface within the device, not all HID interfaces\r
* - Added new CDC_Device_Flush() command to the device mode CDC Class driver\r
* - Added explicit attribute masks to the device mode demos' descriptors\r
+ * - Added return values to the CDC and MIDI class driver transmit functions\r
*\r
* <b>Fixed:</b>\r
* - Fixed possible lockup in the CDC device class driver, when the host sends data that is a multiple of the\r
*\r
* <b>Targeted for This Release:</b>\r
* - Host Mode Class Drivers\r
- * -# Make new host class drivers\r
- * -# Document new host class drivers\r
- * -# Convert Host mode demos to class drivers\r
- * -# Re-enable Host mode Class driver builds after completion\r
- * -# Update Host mode Class Driver demo .txt files\r
* - Add overviews of each of the officially supported boards to the manual\r
* - Add hub support to match Atmel's stack\r
*\r