Added new Pipe_BoundEndpointNumber() and Pipe_IsEndpointBound() functions.
[pub/USBasp.git] / Demos / Device / ClassDriver / CDC / CDC.c
index 86d5c36..95e1a69 100644 (file)
  *  passed to all CDC Class driver functions, so that multiple instances of the same class\r
  *  within a device can be differentiated from one another.\r
  */\r
-USB_ClassInfo_CDC_t VirtualSerial_CDC_Interface =\r
+USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =\r
        {\r
-               .ControlInterfaceNumber     = 0,\r
+               .Config =\r
+                       {\r
+                               .ControlInterfaceNumber     = 0,\r
 \r
-               .DataINEndpointNumber       = CDC_TX_EPNUM,\r
-               .DataINEndpointSize         = CDC_TXRX_EPSIZE,\r
+                               .DataINEndpointNumber       = CDC_TX_EPNUM,\r
+                               .DataINEndpointSize         = CDC_TXRX_EPSIZE,\r
 \r
-               .DataOUTEndpointNumber      = CDC_RX_EPNUM,\r
-               .DataOUTEndpointSize        = CDC_TXRX_EPSIZE,\r
+                               .DataOUTEndpointNumber      = CDC_RX_EPNUM,\r
+                               .DataOUTEndpointSize        = CDC_TXRX_EPSIZE,\r
 \r
-               .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,\r
-               .NotificationEndpointSize   = CDC_NOTIFICATION_EPSIZE,\r
+                               .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,\r
+                               .NotificationEndpointSize   = CDC_NOTIFICATION_EPSIZE,\r
+                       },\r
+               \r
+               .State =\r
+                       {\r
+                               // Leave all state values to their defaults\r
+                       }\r
        };\r
 \r
 /** Main program entry point. This routine contains the overall program flow, including initial\r
@@ -67,8 +75,7 @@ int main(void)
        {\r
                CheckJoystickMovement();\r
                \r
-               uint16_t BytesToDiscard = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface);\r
-               while (BytesToDiscard--)\r
+               while (CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface))\r
                  CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);\r
 \r
                CDC_Device_USBTask(&VirtualSerial_CDC_Interface);\r
@@ -99,7 +106,7 @@ void CheckJoystickMovement(void)
        char*       ReportString  = NULL;\r
        static bool ActionSent    = false;\r
        \r
-       char* JoystickStrings[] =\r
+       char* const JoystickStrings[] =\r
                {\r
                        "Joystick Up\r\n",\r
                        "Joystick Down\r\n",\r