Add TMC device capabilities to the incomplete TMC demo.
authorDean Camera <dean@fourwalledcubicle.com>
Fri, 23 Jul 2010 09:12:26 +0000 (09:12 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Fri, 23 Jul 2010 09:12:26 +0000 (09:12 +0000)
Demos/Device/Incomplete/Sideshow/Sideshow.c
Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c
Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h
LUFA/ManPages/MigrationInformation.txt

index 92d2d3c..e99a26b 100644 (file)
@@ -130,7 +130,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
                                Endpoint_ClearSETUP();
                                
                                Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
-                               Endpoint_ClearOUT();                            
+                               Endpoint_ClearOUT();
                        }
 
                        break;
index 6a2cff4..d56a7f7 100644 (file)
 \r
 #include "TestAndMeasurement.h"\r
 \r
+/** Contains the (usually static) capabilities of the TMC device. This table is requested by the\r
+ *  host upon enumeration to give it information on what features of the Test and Measurement USB\r
+ *  Class the device supports.\r
+ */\r
+TMC_Capabilities_t Capabilities =\r
+       {\r
+               .Status     = TMC_REQUEST_STATUS_SUCCESS,\r
+               .TMCVersion = VERSION_BCD(1.00),\r
+               \r
+               .Interface  =\r
+                       {\r
+                               .ListenOnly             = false,\r
+                               .TalkOnly               = false,\r
+                               .PulseIndicateSupported = true,\r
+                       },\r
+\r
+               .Device     =\r
+                       {\r
+                               .SupportsAbortINOnMatch = false,\r
+                       },\r
+       };\r
+\r
+\r
 /** Main program entry point. This routine contains the overall program flow, including initial\r
  *  setup of all components and the main program loop.\r
  */\r
@@ -141,7 +164,14 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
                case Req_GetCapabilities:\r
                        if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
-                       \r
+                               /* Acknowledge the SETUP packet, ready for data transfer */\r
+                               Endpoint_ClearSETUP();\r
+                                       \r
+                               /* Write the device capabilities to the control endpoint */\r
+                               Endpoint_Write_Control_Stream_LE(&Capabilities, sizeof(TMC_Capabilities_t));\r
+                               \r
+                               /* Finalize the stream transfer to send the last packet or clear the host abort */\r
+                               Endpoint_ClearOUT();\r
                        }\r
                        \r
                        break;\r
@@ -153,4 +183,13 @@ void TMC_Task(void)
        /* Device must be connected and configured for the task to run */\r
        if (USB_DeviceState != DEVICE_STATE_Configured)\r
          return;\r
+         \r
+       Endpoint_SelectEndpoint(TMC_OUT_EPNUM);\r
+       \r
+       if (Endpoint_IsOUTReceived())\r
+       {\r
+               // TEMP - Indicate data received\r
+               LEDs_SetAllLEDs(LEDS_ALL_LEDS);\r
+               Endpoint_ClearOUT();\r
+       }\r
 }\r
index 0a4a629..bd9aee6 100644 (file)
                #define TMC_REQUEST_STATUS_NOTRANSFER         0x81\r
                #define TMC_REQUEST_STATUS_NOCHECKINITIATED   0x82\r
                #define TMC_REQUEST_STATUS_CHECKINPROGRESS    0x83\r
+\r
+       /* Type Defines */\r
+               typedef struct\r
+               {\r
+                       uint8_t  Status;\r
+                       uint8_t  _RESERVED1;\r
+\r
+                       uint16_t TMCVersion;\r
+                       \r
+                       struct\r
+                       {\r
+                               unsigned char ListenOnly             : 1;\r
+                               unsigned char TalkOnly               : 1;\r
+                               unsigned char PulseIndicateSupported : 1;\r
+                               unsigned char _RESERVED              : 5;\r
+                       } Interface;\r
+                       \r
+                       struct\r
+                       {\r
+                               unsigned char SupportsAbortINOnMatch : 1;\r
+                               unsigned char _RESERVED              : 7;\r
+                       } Device;\r
+                       \r
+                       uint8_t _RESERVED2[6];\r
+                       uint8_t _RESERVED3[12];                 \r
+               } TMC_Capabilities_t;\r
                \r
        /* Function Prototypes: */\r
                void SetupHardware(void);\r
index 95c9674..d345332 100644 (file)
@@ -10,7 +10,7 @@
  *  to the next version released. It does not indicate all new additions to the library in each version change, only
  *  areas relevant to making older projects compatible with the API changes of each new release.
  *
- * \section Sec_Migration100513 Migrating from 100513 to XXXXXX
+ * \section Sec_MigrationXXXXXX Migrating from 100513 to XXXXXX
  *
  *  <b>Non-USB Library Components</b>
  *    - The Dataflash board driver stub file has changed, as dataflash functions previously located in the internal