diff options
| author | hathach <[email protected]> | 2019-05-02 14:30:49 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-05-02 14:30:49 +0700 |
| commit | f9d9eebfe1dbf462a69e7d3a967b2ad103ae2277 (patch) | |
| tree | 4f5850e95b0912f39f72dfc142ccf7076c164012 /src/device | |
| parent | 45b856e03bbf7cb02540b9e57c775a619d3f07b3 (diff) | |
support hid generic inout #58
- add report descriptor template TUD_HID_REPORT_DESC_GENERIC_INOUT
- add TUD_HID_INOUT_DESCRIPTOR & TUD_HID_INOUT_DESC_LEN
- add hid_generic_inout example
Diffstat (limited to 'src/device')
| -rw-r--r-- | src/device/usbd.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/device/usbd.h b/src/device/usbd.h index de59731a2..8debbf535 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -107,7 +107,7 @@ ATTR_WEAK void tud_resume_cb(void); #define TUD_CDC_DESC_LEN (8+9+5+5+4+5+7+9+7+7)
// CDC Descriptor Template
-// interface number, string index, EP notification address and size, EP data address (out,in) and size.
+// Interface number, string index, EP notification address and size, EP data address (out, in) and size.
#define TUD_CDC_DESCRIPTOR(_itfnum, _stridx, _ep_notif, _ep_notif_size, _epout, _epin, _epsize) \
/* Interface Associate */\
8, TUSB_DESC_INTERFACE_ASSOCIATION, _itfnum, 2, TUSB_CLASS_CDC, CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL, CDC_COMM_PROTOCOL_ATCOMMAND, 0,\
@@ -149,15 +149,31 @@ ATTR_WEAK void tud_resume_cb(void); // Length of template descriptor: 25 bytes
#define TUD_HID_DESC_LEN (9 + 9 + 7)
+// HID Input only descriptor
// Interface number, string index, protocol, report descriptor len, EP In address, size & polling interval
#define TUD_HID_DESCRIPTOR(_itfnum, _stridx, _boot_protocol, _report_desc_len, _epin, _epsize, _ep_interval) \
/* Interface */\
9, TUSB_DESC_INTERFACE, _itfnum, 0, 1, TUSB_CLASS_HID, (_boot_protocol) ? HID_SUBCLASS_BOOT : 0, _boot_protocol, _stridx,\
/* HID descriptor */\
9, HID_DESC_TYPE_HID, U16_TO_U8S_LE(0x0111), 0, 1, HID_DESC_TYPE_REPORT, U16_TO_U8S_LE(_report_desc_len),\
- /* Endpoint descriptor */\
+ /* Endpoint In */\
7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval
+// Length of template descriptor: 32 bytes
+#define TUD_HID_INOUT_DESC_LEN (9 + 9 + 7 + 7)
+
+// HID Input & Output descriptor
+// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
+#define TUD_HID_INOUT_DESCRIPTOR(_itfnum, _stridx, _boot_protocol, _report_desc_len, _epin, _epout, _epsize, _ep_interval) \
+ /* Interface */\
+ 9, TUSB_DESC_INTERFACE, _itfnum, 0, 2, TUSB_CLASS_HID, (_boot_protocol) ? HID_SUBCLASS_BOOT : 0, _boot_protocol, _stridx,\
+ /* HID descriptor */\
+ 9, HID_DESC_TYPE_HID, U16_TO_U8S_LE(0x0111), 0, 1, HID_DESC_TYPE_REPORT, U16_TO_U8S_LE(_report_desc_len),\
+ /* Endpoint In */\
+ 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval,\
+ /* Endpoint Out */\
+ 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval
+
#ifdef __cplusplus
}
#endif
|
