Added new RNDISHost Host LowLevel demo. Fixed misnamed Pipe_SetPipeToken() macro...
[pub/USBasp.git] / Demos / Device / ClassDriver / DualCDC / DualCDC.c
index 82bfdc8..000d18b 100644 (file)
@@ -45,22 +45,20 @@ USB_ClassInfo_CDC_Device_t VirtualSerial1_CDC_Interface =
        {\r
                .Config =\r
                        {\r
-                               .ControlInterfaceNumber     = 0,\r
+                               .ControlInterfaceNumber           = 0,\r
 \r
-                               .DataINEndpointNumber       = CDC1_TX_EPNUM,\r
-                               .DataINEndpointSize         = CDC_TXRX_EPSIZE,\r
+                               .DataINEndpointNumber             = CDC1_TX_EPNUM,\r
+                               .DataINEndpointSize               = CDC_TXRX_EPSIZE,\r
+                               .DataINEndpointDoubleBank         = false,\r
 \r
-                               .DataOUTEndpointNumber      = CDC1_RX_EPNUM,\r
-                               .DataOUTEndpointSize        = CDC_TXRX_EPSIZE,\r
+                               .DataOUTEndpointNumber            = CDC1_RX_EPNUM,\r
+                               .DataOUTEndpointSize              = CDC_TXRX_EPSIZE,\r
+                               .DataOUTEndpointDoubleBank        = false,\r
 \r
-                               .NotificationEndpointNumber = CDC1_NOTIFICATION_EPNUM,\r
-                               .NotificationEndpointSize   = CDC_NOTIFICATION_EPSIZE,\r
+                               .NotificationEndpointNumber       = CDC1_NOTIFICATION_EPNUM,\r
+                               .NotificationEndpointSize         = CDC_NOTIFICATION_EPSIZE,\r
+                               .NotificationEndpointDoubleBank   = false,\r
                        },\r
-               \r
-               .State =\r
-                       {\r
-                               // Leave all state values to their defaults\r
-                       }\r
        };\r
 \r
 /** LUFA CDC Class driver interface configuration and state information. This structure is\r
@@ -72,22 +70,20 @@ USB_ClassInfo_CDC_Device_t VirtualSerial2_CDC_Interface =
        {\r
                .Config =\r
                        {\r
-                               .ControlInterfaceNumber     = 2,\r
+                               .ControlInterfaceNumber           = 2,\r
 \r
-                               .DataINEndpointNumber       = CDC2_TX_EPNUM,\r
-                               .DataINEndpointSize         = CDC_TXRX_EPSIZE,\r
+                               .DataINEndpointNumber             = CDC2_TX_EPNUM,\r
+                               .DataINEndpointSize               = CDC_TXRX_EPSIZE,\r
+                               .DataINEndpointDoubleBank         = false,\r
 \r
-                               .DataOUTEndpointNumber      = CDC2_RX_EPNUM,\r
-                               .DataOUTEndpointSize        = CDC_TXRX_EPSIZE,\r
+                               .DataOUTEndpointNumber            = CDC2_RX_EPNUM,\r
+                               .DataOUTEndpointSize              = CDC_TXRX_EPSIZE,\r
+                               .DataOUTEndpointDoubleBank        = false,\r
 \r
-                               .NotificationEndpointNumber = CDC2_NOTIFICATION_EPNUM,\r
-                               .NotificationEndpointSize   = CDC_NOTIFICATION_EPSIZE,\r
+                               .NotificationEndpointNumber       = CDC2_NOTIFICATION_EPNUM,\r
+                               .NotificationEndpointSize         = CDC_NOTIFICATION_EPSIZE,\r
+                               .NotificationEndpointDoubleBank   = false,\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
@@ -104,13 +100,11 @@ int main(void)
                CheckJoystickMovement();\r
 \r
                /* Discard all received data on the first CDC interface */\r
-               uint16_t BytesToDiscard = CDC_Device_BytesReceived(&VirtualSerial1_CDC_Interface);\r
-               while (BytesToDiscard--)\r
+               while (CDC_Device_BytesReceived(&VirtualSerial1_CDC_Interface))\r
                  CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface);\r
 \r
                /* Echo all received data on the second CDC interface */\r
-               uint16_t BytesToEcho = CDC_Device_BytesReceived(&VirtualSerial2_CDC_Interface);\r
-               while (BytesToEcho--)\r
+               while (CDC_Device_BytesReceived(&VirtualSerial2_CDC_Interface))\r
                  CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface));\r
                  \r
                CDC_Device_USBTask(&VirtualSerial1_CDC_Interface);\r
@@ -144,25 +138,16 @@ void CheckJoystickMovement(void)
        char*       ReportString  = NULL;\r
        static bool ActionSent = false;\r
 \r
-       char* JoystickStrings[] =\r
-               {\r
-                       "Joystick Up\r\n",\r
-                       "Joystick Down\r\n",\r
-                       "Joystick Left\r\n",\r
-                       "Joystick Right\r\n",\r
-                       "Joystick Pressed\r\n",\r
-               };\r
-\r
        if (JoyStatus_LCL & JOY_UP)\r
-         ReportString = JoystickStrings[0];\r
+         ReportString = "Joystick Up\r\n";\r
        else if (JoyStatus_LCL & JOY_DOWN)\r
-         ReportString = JoystickStrings[1];\r
+         ReportString = "Joystick Down\r\n";\r
        else if (JoyStatus_LCL & JOY_LEFT)\r
-         ReportString = JoystickStrings[2];\r
+         ReportString = "Joystick Left\r\n";\r
        else if (JoyStatus_LCL & JOY_RIGHT)\r
-         ReportString = JoystickStrings[3];\r
+         ReportString = "Joystick Right\r\n";\r
        else if (JoyStatus_LCL & JOY_PRESS)\r
-         ReportString = JoystickStrings[4];\r
+         ReportString = "Joystick Pressed\r\n";\r
        else\r
          ActionSent = false;\r
          \r
@@ -175,19 +160,19 @@ void CheckJoystickMovement(void)
 }\r
 \r
 /** Event handler for the library USB Connection event. */\r
-void EVENT_USB_Connect(void)\r
+void EVENT_USB_Device_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
 /** Event handler for the library USB Disconnection event. */\r
-void EVENT_USB_Disconnect(void)\r
+void EVENT_USB_Device_Disconnect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
 /** Event handler for the library USB Configuration Changed event. */\r
-void EVENT_USB_ConfigurationChanged(void)\r
+void EVENT_USB_Device_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
 \r
@@ -198,9 +183,9 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
-/** Event handler for the library USB Unhandled Control Packet event. */\r
-void EVENT_USB_UnhandledControlPacket(void)\r
+/** Event handler for the library USB Unhandled Control Request event. */\r
+void EVENT_USB_Device_UnhandledControlRequest(void)\r
 {\r
-       CDC_Device_ProcessControlPacket(&VirtualSerial1_CDC_Interface);\r
-       CDC_Device_ProcessControlPacket(&VirtualSerial2_CDC_Interface);\r
+       CDC_Device_ProcessControlRequest(&VirtualSerial1_CDC_Interface);\r
+       CDC_Device_ProcessControlRequest(&VirtualSerial2_CDC_Interface);\r
 }\r