remove IAD_DESC_REQUIRED
add compiler guard for exceeding number of endpoints for lpc11/13u
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define TUSB_CFG_DEVICE_HID_KEYBOARD 1
|
||||
#define TUSB_CFG_DEVICE_HID_MOUSE 1
|
||||
#define TUSB_CFG_DEVICE_HID_MOUSE 0
|
||||
#define TUSB_CFG_DEVICE_HID_GENERIC 0 // not supported yet
|
||||
#define TUSB_CFG_DEVICE_MSC 1
|
||||
#define TUSB_CFG_DEVICE_CDC 1
|
||||
|
||||
@@ -143,8 +143,8 @@ tusb_descriptor_device_t desc_device =
|
||||
.bLength = sizeof(tusb_descriptor_device_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_DEVICE,
|
||||
.bcdUSB = 0x0200,
|
||||
#if IAD_DESC_REQUIRED
|
||||
// Multiple Interfaces Using Interface Association Descriptor (IAD)
|
||||
#if TUSB_CFG_DEVICE_CDC
|
||||
// Use Interface Association Descriptor (IAD) for CDC
|
||||
// As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
|
||||
.bDeviceClass = TUSB_CLASS_MISC,
|
||||
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
|
||||
@@ -188,7 +188,7 @@ app_descriptor_configuration_t desc_configuration =
|
||||
.bMaxPower = TUSB_DESC_CONFIG_POWER_MA(100)
|
||||
},
|
||||
|
||||
#if IAD_DESC_REQUIRED
|
||||
#if TUSB_CFG_DEVICE_CDC
|
||||
// IAD points to CDC Interfaces
|
||||
.cdc_iad =
|
||||
{
|
||||
@@ -203,9 +203,7 @@ app_descriptor_configuration_t desc_configuration =
|
||||
.bFunctionProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
|
||||
.iFunction = 0
|
||||
},
|
||||
#endif
|
||||
|
||||
#if TUSB_CFG_DEVICE_CDC
|
||||
//------------- CDC Communication Interface -------------//
|
||||
.cdc_comm_interface =
|
||||
{
|
||||
|
||||
@@ -57,16 +57,17 @@
|
||||
#endif
|
||||
|
||||
#define INTERFACE_NO_CDC 0
|
||||
#define INTERFACE_NO_HID_KEYBOARD (INTERFACE_NO_CDC + 2*TUSB_CFG_DEVICE_CDC )
|
||||
#define INTERFACE_NO_HID_MOUSE (INTERFACE_NO_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_KEYBOARD )
|
||||
#define INTERFACE_NO_HID_GENERIC (INTERFACE_NO_HID_MOUSE + TUSB_CFG_DEVICE_HID_MOUSE )
|
||||
#define INTERFACE_NO_MSC (INTERFACE_NO_HID_GENERIC + TUSB_CFG_DEVICE_HID_GENERIC )
|
||||
#define INTERFACE_NO_HID_KEYBOARD (INTERFACE_NO_CDC + 2*(TUSB_CFG_DEVICE_CDC ? 1 : 0) )
|
||||
#define INTERFACE_NO_HID_MOUSE (INTERFACE_NO_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_KEYBOARD )
|
||||
#define INTERFACE_NO_HID_GENERIC (INTERFACE_NO_HID_MOUSE + TUSB_CFG_DEVICE_HID_MOUSE )
|
||||
#define INTERFACE_NO_MSC (INTERFACE_NO_HID_GENERIC + TUSB_CFG_DEVICE_HID_GENERIC )
|
||||
|
||||
#define TOTAL_INTEFACES (2*TUSB_CFG_DEVICE_CDC + TUSB_CFG_DEVICE_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_MOUSE + \
|
||||
TUSB_CFG_DEVICE_HID_GENERIC + TUSB_CFG_DEVICE_MSC)
|
||||
|
||||
// Interface Assosication Descriptor is required when enable CDC
|
||||
#define IAD_DESC_REQUIRED ( TUSB_CFG_DEVICE_CDC )
|
||||
#if (TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX) && (TOTAL_INTEFACES > 4)
|
||||
#error These MCUs do not have enough number of endpoints for the current configuration
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Endpoints Address & Max Packet Size
|
||||
@@ -136,9 +137,7 @@ typedef ATTR_PACKED_STRUCT(struct)
|
||||
|
||||
//------------- CDC -------------//
|
||||
#if TUSB_CFG_DEVICE_CDC
|
||||
#if IAD_DESC_REQUIRED
|
||||
tusb_descriptor_interface_association_t cdc_iad;
|
||||
#endif
|
||||
|
||||
//CDC Control Interface
|
||||
tusb_descriptor_interface_t cdc_comm_interface;
|
||||
|
||||
Reference in New Issue
Block a user