summaryrefslogtreecommitdiff
path: root/demos/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-05-23 13:22:46 +0700
committerhathach <[email protected]>2013-05-23 13:22:46 +0700
commit8cb7818bcc048a69b9e2b0a4607c8f75bc35c359 (patch)
tree6307b044a94f013c7ec74b1462318484b30c1a76 /demos/device
parentd7ae21203c1a7915c397157a9d231264ff0e66fc (diff)
- move CMSIS & driver lib for lpc13u to codebase bsp/lpc13xx
- change descriptor.c/h able to build device example
Diffstat (limited to 'demos/device')
-rw-r--r--demos/device/keyboard/.cproject15
-rw-r--r--demos/device/keyboard/descriptors.c272
-rw-r--r--demos/device/keyboard/descriptors.h34
-rw-r--r--demos/device/keyboard/tusb_config.h51
4 files changed, 211 insertions, 161 deletions
diff --git a/demos/device/keyboard/.cproject b/demos/device/keyboard/.cproject
index be3fa9e00..68a384b0d 100644
--- a/demos/device/keyboard/.cproject
+++ b/demos/device/keyboard/.cproject
@@ -41,7 +41,8 @@
</option>
<option id="gnu.c.compiler.option.misc.other.204394496" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
<option id="gnu.c.compiler.option.include.paths.1207481236" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/CMSISv2p10_LPC13Uxx/inc}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/bsp/lpc13uxx/CMSISv2p10_LPC13Uxx/inc}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/bsp/lpc13uxx/LPC13Uxx_DriverLib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/bsp}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/tinyusb}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
@@ -69,12 +70,8 @@
<listOptionValue builtIn="false" value="-Map=&quot;${BuildArtifactFileBaseName}.map&quot;"/>
<listOptionValue builtIn="false" value="--gc-sections"/>
</option>
- <option id="gnu.c.link.option.paths.1465143173" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/CMSISv2p10_LPC13Uxx/Debug}&quot;"/>
- </option>
- <option id="gnu.c.link.option.libs.447978281" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
- <listOptionValue builtIn="false" value="CMSISv2p10_LPC13Uxx"/>
- </option>
+ <option id="gnu.c.link.option.paths.1465143173" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths"/>
+ <option id="gnu.c.link.option.libs.447978281" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs"/>
<option id="com.crt.advproject.link.gcc.hdrlib.1111642583" name="Use C library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1234316494" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
@@ -84,7 +81,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
- <entry excluding="bsp/lpc43xx|bsp/lpc11uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry excluding="bsp/boards/embedded_artists/oem_base_board|bsp/lpc43xx|bsp/lpc11uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@@ -739,7 +736,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
- <entry excluding="bsp/lpc43xx|bsp/lpc13uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry excluding="bsp/boards/embedded_artists/oem_base_board|bsp/lpc43xx|bsp/lpc13uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
diff --git a/demos/device/keyboard/descriptors.c b/demos/device/keyboard/descriptors.c
index 585f537a2..91b2a900e 100644
--- a/demos/device/keyboard/descriptors.c
+++ b/demos/device/keyboard/descriptors.c
@@ -37,130 +37,121 @@
#include "descriptors.h"
-#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) const uint8_t HID_KeyboardReportDescriptor[] = {
- HID_UsagePage ( HID_USAGE_PAGE_GENERIC ),
- HID_Usage ( HID_USAGE_GENERIC_KEYBOARD ),
- HID_Collection ( HID_Application ),
- HID_UsagePage (HID_USAGE_PAGE_KEYBOARD),
- HID_UsageMin (224 ),
- HID_UsageMax (231 ),
- HID_LogicalMin ( 0 ),
- HID_LogicalMax ( 1 ),
+#if TUSB_CFG_DEVICE_HID_KEYBOARD
+TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4)
+const uint8_t keyboard_report_descriptor[] = {
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
+ HID_USAGE ( HID_USAGE_DESKTOP_KEYBOARD ),
+ HID_COLLECTION ( HID_COLLECTION_APPLICATION ),
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_KEYBOARD ),
+ HID_USAGE_MIN ( 224 ),
+ HID_USAGE_MAX ( 231 ),
+ HID_LOGICAL_MIN ( 0 ),
+ HID_LOGICAL_MAX ( 1 ),
- HID_ReportCount ( 8 ), /* 8 bits */
- HID_ReportSize ( 1 ),
- HID_Input ( HID_Data | HID_Variable | HID_Absolute ), /* maskable modifier key */
+ HID_REPORT_COUNT ( 8 ), /* 8 bits */
+ HID_REPORT_SIZE ( 1 ),
+ HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ), /* maskable modifier key */
- HID_ReportCount ( 1 ),
- HID_ReportSize (8 ),
- HID_Input (HID_Constant ), /* reserved */
+ HID_REPORT_COUNT ( 1 ),
+ HID_REPORT_SIZE ( 8 ),
+ HID_INPUT ( HID_CONSTANT ), /* reserved */
- HID_UsagePage ( HID_USAGE_PAGE_LED ),
- HID_UsageMin (1 ),
- HID_UsageMax (5 ),
- HID_ReportCount (5 ),
- HID_ReportSize (1 ),
- HID_Output ( HID_Data | HID_Variable | HID_Absolute ), /* 5-bit Led report */
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_LED ),
+ HID_USAGE_MIN ( 1 ),
+ HID_USAGE_MAX ( 5 ),
+ HID_REPORT_COUNT ( 5 ),
+ HID_REPORT_SIZE ( 1 ),
+ HID_OUTPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ), /* 5-bit Led report */
- HID_ReportCount ( 1 ),
- HID_ReportSize (3 ), /* led padding */
- HID_Output (HID_Constant ),
+ HID_REPORT_COUNT ( 1 ),
+ HID_REPORT_SIZE ( 3 ), /* led padding */
+ HID_OUTPUT ( HID_CONSTANT ),
- HID_UsagePage (HID_USAGE_PAGE_KEYBOARD),
- HID_UsageMin (0 ),
- HID_UsageMax (101 ),
- HID_LogicalMin (0 ),
- HID_LogicalMax (101 ),
+ HID_USAGE_PAGE (HID_USAGE_PAGE_KEYBOARD),
+ HID_USAGE_MIN ( 0 ),
+ HID_USAGE_MAX ( 101 ),
+ HID_LOGICAL_MIN ( 0 ),
+ HID_LOGICAL_MAX ( 101 ),
- HID_ReportCount (6 ),
- HID_ReportSize (8 ),
- HID_Input (HID_Data | HID_Array | HID_Absolute ), /* keycodes array 6 items */
- HID_EndCollection,
+ HID_REPORT_COUNT ( 6 ),
+ HID_REPORT_SIZE ( 8 ),
+ HID_INPUT ( HID_DATA | HID_ARRAY | HID_ABSOLUTE ), /* keycodes array 6 items */
+ HID_COLLECTION_END
};
#endif
-#ifdef TUSB_CFG_DEVICE_HID_MOUSE
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) const uint8_t HID_MouseReportDescriptor[] = {
- HID_UsagePage ( HID_USAGE_PAGE_GENERIC ),
- HID_Usage ( HID_USAGE_GENERIC_MOUSE ),
- HID_Collection ( HID_Application ),
- HID_Usage (HID_USAGE_GENERIC_POINTER),
+#if TUSB_CFG_DEVICE_HID_MOUSE
+TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4)
+const uint8_t mouse_report_descriptor[] = {
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
+ HID_USAGE ( HID_USAGE_DESKTOP_MOUSE ),
+ HID_COLLECTION ( HID_COLLECTION_APPLICATION ),
+ HID_USAGE (HID_USAGE_DESKTOP_POINTER),
- HID_Collection ( HID_Physical ),
- HID_UsagePage ( HID_USAGE_PAGE_BUTTON ),
- HID_UsageMin ( 1 ),
- HID_UsageMax ( 3 ),
- HID_LogicalMin ( 0 ),
- HID_LogicalMax ( 1 ),
+ HID_COLLECTION ( HID_COLLECTION_PHYSICAL ),
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_BUTTON ),
+ HID_USAGE_MIN ( 1 ),
+ HID_USAGE_MAX ( 3 ),
+ HID_LOGICAL_MIN ( 0 ),
+ HID_LOGICAL_MAX ( 1 ),
- HID_ReportCount ( 3 ), /* Left, Right and Middle mouse*/
- HID_ReportSize ( 1 ),
- HID_Input ( HID_Data | HID_Variable | HID_Absolute ),
+ HID_REPORT_COUNT ( 3 ), /* Left, Right and Middle mouse*/
+ HID_REPORT_SIZE ( 1 ),
+ HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ),
- HID_ReportCount ( 1 ),
- HID_ReportSize ( 5 ),
- HID_Input (HID_Constant ), /* reserved */
+ HID_REPORT_COUNT ( 1 ),
+ HID_REPORT_SIZE ( 5 ),
+ HID_INPUT ( HID_CONSTANT ), /* reserved */
- HID_UsagePage ( HID_USAGE_PAGE_GENERIC ),
- HID_Usage ( HID_USAGE_GENERIC_X ),
- HID_Usage ( HID_USAGE_GENERIC_Y ),
- HID_LogicalMin ( 0x81 ), /* -127 */
- HID_LogicalMax ( 0x7f ), /* 127 */
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
+ HID_USAGE ( HID_USAGE_DESKTOP_X ),
+ HID_USAGE ( HID_USAGE_DESKTOP_Y ),
+ HID_LOGICAL_MIN ( 0x81 ), /* -127 */
+ HID_LOGICAL_MAX ( 0x7f ), /* 127 */
- HID_ReportCount ( 2 ), /* X, Y position */
- HID_ReportSize ( 8 ),
- HID_Input ( HID_Data | HID_Variable | HID_Relative ), /* relative values */
+ HID_REPORT_COUNT ( 2 ), /* X, Y position */
+ HID_REPORT_SIZE ( 8 ),
+ HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ), /* relative values */
+ HID_COLLECTION_END,
- HID_EndCollection,
-
- HID_EndCollection,
+ HID_COLLECTION_END
};
#endif
-/* USB Standard Device Descriptor */
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) const USB_DEVICE_DESCRIPTOR USB_DeviceDescriptor =
+TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4)
+tusb_descriptor_device_t const desc_device =
{
- .bLength = sizeof(USB_DEVICE_DESCRIPTOR),
- .bDescriptorType = USB_DEVICE_DESCRIPTOR_TYPE,
- .bcdUSB = 0x0200,
-
- #if IAD_DESC_REQUIRED
- /* Multiple Interfaces Using Interface Association Descriptor (IAD) */
- .bDeviceClass = USB_DEVICE_CLASS_IAD,
- .bDeviceSubClass = USB_DEVICE_SUBCLASS_IAD,
- .bDeviceProtocol = USB_DEVICE_PROTOCOL_IAD,
- #elif defined TUSB_CFG_DEVICE_CDC
- .bDeviceClass = CDC_COMMUNICATION_INTERFACE_CLASS,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
- #else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
- #endif
+ .bLength = sizeof(tusb_descriptor_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
- .bMaxPacketSize0 = USB_MAX_PACKET0,
+ .bMaxPacketSize0 = USB_MAX_PACKET0,
- .idVendor = CFG_USB_VENDORID,
- .idProduct = USB_PRODUCT_ID,
- .bcdDevice = 0x0100,
+ .idVendor = CFG_USB_VENDORID,
+ .idProduct = USB_PRODUCT_ID,
+ .bcdDevice = 0x0100,
- .iManufacturer = 0x01,
- .iProduct = 0x02,
- .iSerialNumber = 0x03,
+ .iManufacturer = 0x01,
+ .iProduct = 0x02,
+ .iSerialNumber = 0x03,
- .bNumConfigurations = 0x01
+ .bNumConfigurations = 0x01 // TODO configuration number
};
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) const USB_FS_CONFIGURATION_DESCRIPTOR USB_FsConfigDescriptor =
+
+TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4)
+const app_configuration_desc_t desc_configuration =
{
- .Config =
+ .configuration =
{
.bLength = sizeof(tusb_descriptor_configuration_t),
.bDescriptorType = TUSB_DESC_CONFIGURATION,
- .wTotalLength = sizeof(USB_FS_CONFIGURATION_DESCRIPTOR) - 1, // exclude termination
+ .wTotalLength = sizeof(app_configuration_desc_t) - 1, // exclude termination
.bNumInterfaces = TOTAL_INTEFACES,
.bConfigurationValue = 1,
@@ -276,47 +267,45 @@ TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) const USB_FS_CONFIGURATION_DESCRIPTOR USB_F
},
#endif
- #ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
- ///// USB HID Keyboard interface
- .HID_KeyboardInterface =
+ //------------- HID Keyboard -------------//
+ #if TUSB_CFG_DEVICE_HID_KEYBOARD
+ .keyboard_interface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE,
- .bInterfaceNumber = INTERFACE_INDEX_HID_KEYBOARD,
+ .bInterfaceNumber = 1,
.bAlternateSetting = 0x00,
.bNumEndpoints = 1,
.bInterfaceClass = TUSB_CLASS_HID,
- .bInterfaceSubClass = TUSB_HID_SUBCLASS_BOOT,
- .bInterfaceProtocol = TUSB_HID_PROTOCOL_KEYBOARD,
+ .bInterfaceSubClass = HID_SUBCLASS_BOOT,
+ .bInterfaceProtocol = HID_PROTOCOL_KEYBOARD,
.iInterface = 0x00
},
- .HID_KeyboardHID =
+ .keyboard_hid =
{
- .bLength = sizeof(HID_DESCRIPTOR),
- .bDescriptorType = HID_HID_DESCRIPTOR_TYPE,
+ .bLength = sizeof(tusb_hid_descriptor_hid_t),
+ .bDescriptorType = HID_DESC_HID,
.bcdHID = 0x0111,
.bCountryCode = HID_Local_NotSupported,
.bNumDescriptors = 1,
- .DescriptorList[0] =
- {
- .bDescriptorType = HID_REPORT_DESCRIPTOR_TYPE,
- .wDescriptorLength = sizeof(HID_KeyboardReportDescriptor)
- },
+ .bReportType = HID_DESC_REPORT,
+ .wReportLength = sizeof(keyboard_report_descriptor)
},
- .HID_KeyboardEndpoint =
+ .keyboard_endpoint =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
- .bEndpointAddress = HID_KEYBOARD_EP_IN,
- .bmAttributes = USB_ENDPOINT_TYPE_INTERRUPT,
- .wMaxPacketSize = 0x08,
+ .bEndpointAddress = 0x81,
+ .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
+ .wMaxPacketSize = { .size = 0x08 },
.bInterval = 0x0A
},
#endif
- #ifdef TUSB_CFG_DEVICE_HID_MOUSE
+ //------------- HID Mouse -------------//
+ #if TUSB_CFG_DEVICE_HID_MOUSE
.HID_MouseInterface =
{
.bLength = sizeof(tusb_descriptor_interface_t),
@@ -330,32 +319,65 @@ TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) const USB_FS_CONFIGURATION_DESCRIPTOR USB_F
.iInterface = 0x00
},
- .HID_MouseHID =
+ .mouse_hid =
{
- .bLength = sizeof(HID_DESCRIPTOR),
- .bDescriptorType = HID_HID_DESCRIPTOR_TYPE,
+ .bLength = sizeof(tusb_hid_descriptor_hid_t),
+ .bDescriptorType = HID_DESC_HID,
.bcdHID = 0x0111,
.bCountryCode = HID_Local_NotSupported,
.bNumDescriptors = 1,
- .DescriptorList[0] =
- {
- .bDescriptorType = HID_REPORT_DESCRIPTOR_TYPE,
- .wDescriptorLength = sizeof(HID_MouseReportDescriptor)
- },
+ .bReportType = HID_DESC_REPORT,
+ .wReportLength = sizeof(mouse_report_descriptor)
},
- .HID_MouseEndpoint =
+ .mouse_endpoint =
{
.bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT,
- .bEndpointAddress = HID_MOUSE_EP_IN,
- .bmAttributes = USB_ENDPOINT_TYPE_INTERRUPT,
+ .bEndpointAddress = 0x82,
+ .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
.wMaxPacketSize = 0x08,
.bInterval = 0x0A
},
#endif
- .ConfigDescTermination = 0,
+ //------------- Mass Storage -------------//
+ #if TUSB_CFG_DEVICE_MSC
+ .msc_interface =
+ {
+ .bLength = sizeof(tusb_descriptor_interface_t),
+ .bDescriptorType = TUSB_DESC_INTERFACE,
+ .bInterfaceNumber = 3,
+ .bAlternateSetting = 0x00,
+ .bNumEndpoints = 2,
+ .bInterfaceClass = TUSB_CLASS_MSC,
+ .bInterfaceSubClass = MSC_SUBCLASS_SCSI,
+ .bInterfaceProtocol = MSC_PROTOCOL_BOT,
+ .iInterface = 0x00
+ },
+
+ .msc_endpoint_in =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_ENDPOINT,
+ .bEndpointAddress = 0x83,
+ .bmAttributes = { .xfer = TUSB_XFER_BULK },
+ .wMaxPacketSize = 512,
+ .bInterval = 1
+ },
+
+ .msc_endpoint_out =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_ENDPOINT,
+ .bEndpointAddress = 0x03,
+ .bmAttributes = { .xfer = TUSB_XFER_BULK },
+ .wMaxPacketSize = 512,
+ .bInterval = 1
+ },
+ #endif
+
+ .null_termination = 0,
};
TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) const USB_STR_DESCRIPTOR USB_StringDescriptor =
diff --git a/demos/device/keyboard/descriptors.h b/demos/device/keyboard/descriptors.h
index 8e6b62510..0c89ba4bd 100644
--- a/demos/device/keyboard/descriptors.h
+++ b/demos/device/keyboard/descriptors.h
@@ -115,13 +115,13 @@ typedef ATTR_PREPACKED struct ATTR_PACKED _USB_STR_DESCRIPTOR
///////////////////////////////////////////////////////////////////////
typedef struct
{
- tusb_descriptor_configuration_t Config;
+ tusb_descriptor_configuration_t configuration;
#if IAD_DESC_REQUIRED
tusb_descriptor_interface_association_t CDC_IAD;
#endif
-#ifdef TUSB_CFG_DEVICE_CDC
+#if TUSB_CFG_DEVICE_CDC
//CDC - Serial
//CDC Control Interface
tusb_descriptor_interface_t CDC_CCI_Interface;
@@ -136,28 +136,28 @@ typedef struct
tusb_descriptor_endpoint_t CDC_DataInEndpoint;
#endif
-#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
- //Keyboard HID Interface
- tusb_descriptor_interface_t HID_KeyboardInterface;
- HID_DESCRIPTOR HID_KeyboardHID;
- tusb_descriptor_endpoint_t HID_KeyboardEndpoint;
+ //------------- HID Keyboard -------------//
+#if TUSB_CFG_DEVICE_HID_KEYBOARD
+ tusb_descriptor_interface_t keyboard_interface;
+ tusb_hid_descriptor_hid_t keyboard_hid;
+ tusb_descriptor_endpoint_t keyboard_endpoint;
#endif
-#ifdef TUSB_CFG_DEVICE_HID_MOUSE
- //Mouse HID Interface
- tusb_descriptor_interface_t HID_MouseInterface;
- HID_DESCRIPTOR HID_MouseHID;
- tusb_descriptor_endpoint_t HID_MouseEndpoint;
+//------------- HID Mouse -------------//
+#if TUSB_CFG_DEVICE_HID_MOUSE
+ tusb_descriptor_interface_t mouse_interface;
+ tusb_hid_descriptor_hid_t mouse_hid;
+ tusb_descriptor_endpoint_t mouse_endpoint;
#endif
- unsigned char ConfigDescTermination;
-} USB_FS_CONFIGURATION_DESCRIPTOR;
+ uint8_t null_termination;
+} app_configuration_desc_t;
-extern const USB_DEVICE_DESCRIPTOR USB_DeviceDescriptor;
-extern const USB_FS_CONFIGURATION_DESCRIPTOR USB_FsConfigDescriptor;
+extern const tusb_descriptor_device_t desc_device;
+extern const app_configuration_desc_t desc_configuration;
extern const USB_STR_DESCRIPTOR USB_StringDescriptor;
-extern const uint8_t HID_KeyboardReportDescriptor[];
+extern const uint8_t keyboard_report_descriptor[];
extern const uint8_t HID_MouseReportDescriptor[];
#endif
diff --git a/demos/device/keyboard/tusb_config.h b/demos/device/keyboard/tusb_config.h
index 453bc3a2a..8ca515033 100644
--- a/demos/device/keyboard/tusb_config.h
+++ b/demos/device/keyboard/tusb_config.h
@@ -56,22 +56,49 @@
extern "C" {
#endif
-#define TUSB_CFG_CONFIGURATION_MAX 1
+//--------------------------------------------------------------------+
+// CONTROLLER CONFIGURATION
+//--------------------------------------------------------------------+
+#define TUSB_CFG_CONTROLLER0_MODE (TUSB_MODE_DEVICE)
+#define TUSB_CFG_CONTROLLER1_MODE (TUSB_MODE_NONE)
-/// Enable Device Support
-#define TUSB_CFG_DEVICE
+//--------------------------------------------------------------------+
+// HOST CONFIGURATION
+//--------------------------------------------------------------------+
+#define TUSB_CFG_HOST_DEVICE_MAX 2
+#define TUSB_CFG_CONFIGURATION_MAX 1
-/// Enable CDC Support
+//------------- USBD -------------//
+#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 256
+
+//------------- CLASS -------------//
+#define TUSB_CFG_HOST_HUB 0
+#define TUSB_CFG_HOST_HID_KEYBOARD 1
+#define TUSB_CFG_HOST_HID_MOUSE 1
+#define TUSB_CFG_HOST_HID_GENERIC 0
+#define TUSB_CFG_HOST_MSC 0
+
+//--------------------------------------------------------------------+
+// DEVICE CONFIGURATION
+//--------------------------------------------------------------------+
+
+//------------- CORE/CONTROLLER -------------//
+
+//------------- CLASS -------------//
+#define TUSB_CFG_DEVICE_HID_KEYBOARD 1
+#define TUSB_CFG_DEVICE_HID_MOUSE 0
+#define TUSB_CFG_DEVICE_MSC 0
//#define TUSB_CFG_DEVICE_CDC
-/// Enable HID Keyboard support
-#define TUSB_CFG_DEVICE_HID_KEYBOARD
+//--------------------------------------------------------------------+
+// COMMON CONFIGURATION
+//--------------------------------------------------------------------+
-/// Enable HID Mouse support
-//#define TUSB_CFG_DEVICE_HID_MOUSE
+#define TUSB_CFG_DEBUG 3
-#define TUSB_CFG_DEBUG 3
-#define TUSB_CFG_OS TUSB_OS_NONE
+#define TUSB_CFG_OS TUSB_OS_NONE // defined using eclipse build
+//#define TUSB_CFG_OS_TASK_PRIO
+#define TUSB_CFG_OS_TICKS_PER_SECOND 1000
#ifdef __CODE_RED // make use of code red's support for ram region macros
#if (MCU == MCU_LPC11UXX) || (MCU == MCU_LPC13UXX)
@@ -81,6 +108,10 @@
#endif
#define TUSB_CFG_ATTR_USBRAM __attribute__ ((section(TUSB_RAM_SECTION)))
+#elif defined __CC_ARM // Compiled with Keil armcc
+ #define TUSB_CFG_ATTR_USBRAM
+#else
+ #error compiler not specified
#endif