\r
#include "CDC.h"\r
\r
-/* Project Tags, for reading out using the ButtLoad project */\r
-BUTTLOADTAG(ProjName, "LUFA CDC App");\r
-BUTTLOADTAG(BuildTime, __TIME__);\r
-BUTTLOADTAG(BuildDate, __DATE__);\r
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);\r
-\r
/* Scheduler Task List */\r
TASK_LIST\r
{\r
*\r
* These values are set by the host via a class-specific request, however they are not required to be used accurately.\r
* It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical\r
- * serial link characteristics and instead sends and recieves data in endpoint streams.\r
+ * serial link characteristics and instead sends and receives data in endpoint streams.\r
*/\r
CDC_Line_Coding_t LineCoding = { BaudRateBPS: 9600,\r
CharFormat: OneStopBit,\r
/** String to print through the virtual serial port when the joystick is pressed upwards. */\r
char JoystickUpString[] = "Joystick Up\r\n";\r
\r
-/** String to print through the virtual serial port when the joystick is pressed downwards. */\r
+/** String to print through the virtual serial port when the joystick is pressed downward. */\r
char JoystickDownString[] = "Joystick Down\r\n";\r
\r
/** String to print through the virtual serial port when the joystick is pressed left. */\r
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
{ \r
/* Acknowledge the SETUP packet, ready for data transfer */\r
- Endpoint_ClearSetupReceived();\r
+ Endpoint_ClearControlSETUP();\r
\r
/* Write the line coding data to the control endpoint */\r
Endpoint_Write_Control_Stream_LE(LineCodingData, sizeof(CDC_Line_Coding_t));\r
\r
/* Finalize the stream transfer to send the last packet or clear the host abort */\r
- Endpoint_ClearSetupOUT();\r
+ Endpoint_ClearControlOUT();\r
}\r
\r
break;\r
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
{\r
/* Acknowledge the SETUP packet, ready for data transfer */\r
- Endpoint_ClearSetupReceived();\r
+ Endpoint_ClearControlSETUP();\r
\r
/* Read the line coding data in from the host into the global struct */\r
Endpoint_Read_Control_Stream_LE(LineCodingData, sizeof(CDC_Line_Coding_t));\r
\r
/* Finalize the stream transfer to clear the last packet from the host */\r
- Endpoint_ClearSetupIN();\r
+ Endpoint_ClearControlIN();\r
}\r
\r
break;\r
#endif\r
\r
/* Acknowledge the SETUP packet, ready for data transfer */\r
- Endpoint_ClearSetupReceived();\r
+ Endpoint_ClearControlSETUP();\r
\r
/* Acknowledge status stage */\r
- while (!(Endpoint_IsSetupINReady()));\r
- Endpoint_ClearSetupIN();\r
+ while (!(Endpoint_IsINReady()));\r
+ Endpoint_ClearControlIN();\r
}\r
\r
break;\r
Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);\r
Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));\r
Endpoint_Write_Stream_LE(&LineStateMask, sizeof(LineStateMask));\r
- Endpoint_ClearCurrentBank();\r
+ Endpoint_ClearIN();\r
#endif\r
\r
/* Determine if a joystick action has occurred */\r
Endpoint_Write_Stream_LE(ReportString, strlen(ReportString));\r
\r
/* Finalize the stream transfer to send the last packet */\r
- Endpoint_ClearCurrentBank();\r
+ Endpoint_ClearIN();\r
+\r
+ /* Wait until the endpoint is ready for another packet */\r
+ while (!(Endpoint_IsINReady()));\r
+ \r
+ /* Send an empty packet to ensure that the host does not buffer data sent to it */\r
+ Endpoint_ClearIN();\r
}\r
\r
/* Select the Serial Rx Endpoint */\r
Endpoint_SelectEndpoint(CDC_RX_EPNUM);\r
\r
/* Throw away any received data from the host */\r
- if (Endpoint_ReadWriteAllowed())\r
- Endpoint_ClearCurrentBank();\r
+ if (Endpoint_IsOUTReceived())\r
+ Endpoint_ClearOUT();\r
}\r