aboutsummaryrefslogtreecommitdiffstats
path: root/Demos
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-07-23 09:12:26 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-07-23 09:12:26 +0000
commit3a79548dc2bfd08f13a387b5533d8598ba0078d7 (patch)
treea4de970fd4a5be169509971fac3ae7e47fed0689 /Demos
parenteb8a708b5379755cbcdac900eb32f3c484bde58c (diff)
downloadlufa-3a79548dc2bfd08f13a387b5533d8598ba0078d7.tar.gz
lufa-3a79548dc2bfd08f13a387b5533d8598ba0078d7.tar.bz2
lufa-3a79548dc2bfd08f13a387b5533d8598ba0078d7.zip
Add TMC device capabilities to the incomplete TMC demo.
Diffstat (limited to 'Demos')
-rw-r--r--Demos/Device/Incomplete/Sideshow/Sideshow.c2
-rw-r--r--Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c41
-rw-r--r--Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h26
3 files changed, 67 insertions, 2 deletions
diff --git a/Demos/Device/Incomplete/Sideshow/Sideshow.c b/Demos/Device/Incomplete/Sideshow/Sideshow.c
index 92d2d3c12..e99a26b36 100644
--- a/Demos/Device/Incomplete/Sideshow/Sideshow.c
+++ b/Demos/Device/Incomplete/Sideshow/Sideshow.c
@@ -130,7 +130,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_ClearSETUP();
Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
- Endpoint_ClearOUT();
+ Endpoint_ClearOUT();
}
break;
diff --git a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c
index 6a2cff409..d56a7f7bc 100644
--- a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c
+++ b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c
@@ -30,6 +30,29 @@
#include "TestAndMeasurement.h"
+/** Contains the (usually static) capabilities of the TMC device. This table is requested by the
+ * host upon enumeration to give it information on what features of the Test and Measurement USB
+ * Class the device supports.
+ */
+TMC_Capabilities_t Capabilities =
+ {
+ .Status = TMC_REQUEST_STATUS_SUCCESS,
+ .TMCVersion = VERSION_BCD(1.00),
+
+ .Interface =
+ {
+ .ListenOnly = false,
+ .TalkOnly = false,
+ .PulseIndicateSupported = true,
+ },
+
+ .Device =
+ {
+ .SupportsAbortINOnMatch = false,
+ },
+ };
+
+
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
@@ -141,7 +164,14 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
case Req_GetCapabilities:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
-
+ /* Acknowledge the SETUP packet, ready for data transfer */
+ Endpoint_ClearSETUP();
+
+ /* Write the device capabilities to the control endpoint */
+ Endpoint_Write_Control_Stream_LE(&Capabilities, sizeof(TMC_Capabilities_t));
+
+ /* Finalize the stream transfer to send the last packet or clear the host abort */
+ Endpoint_ClearOUT();
}
break;
@@ -153,4 +183,13 @@ void TMC_Task(void)
/* Device must be connected and configured for the task to run */
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
+
+ Endpoint_SelectEndpoint(TMC_OUT_EPNUM);
+
+ if (Endpoint_IsOUTReceived())
+ {
+ // TEMP - Indicate data received
+ LEDs_SetAllLEDs(LEDS_ALL_LEDS);
+ Endpoint_ClearOUT();
+ }
}
diff --git a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h
index 0a4a629a5..bd9aee689 100644
--- a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h
+++ b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h
@@ -71,6 +71,32 @@
#define TMC_REQUEST_STATUS_NOTRANSFER 0x81
#define TMC_REQUEST_STATUS_NOCHECKINITIATED 0x82
#define TMC_REQUEST_STATUS_CHECKINPROGRESS 0x83
+
+ /* Type Defines */
+ typedef struct
+ {
+ uint8_t Status;
+ uint8_t _RESERVED1;
+
+ uint16_t TMCVersion;
+
+ struct
+ {
+ unsigned char ListenOnly : 1;
+ unsigned char TalkOnly : 1;
+ unsigned char PulseIndicateSupported : 1;
+ unsigned char _RESERVED : 5;
+ } Interface;
+
+ struct
+ {
+ unsigned char SupportsAbortINOnMatch : 1;
+ unsigned char _RESERVED : 7;
+ } Device;
+
+ uint8_t _RESERVED2[6];
+ uint8_t _RESERVED3[12];
+ } TMC_Capabilities_t;
/* Function Prototypes: */
void SetupHardware(void);