未验证 提交 e6a34ead 编写于 作者: lymzzyh's avatar lymzzyh 提交者: GitHub

Merge pull request #1604 from uestczyh222/master

[Components][USB][Device]Support customer HID class|支持自定义HID设备
......@@ -222,26 +222,13 @@ extern "C" {
#define USB_EP_DESC_NUM(addr) (addr & USB_EP_DESC_NUM_MASK)
#define USB_EP_DIR(addr) ((addr & USB_DIR_MASK)>>7)
#ifdef RT_USB_DEVICE_HID
#ifdef RT_USB_DEVICE_HID_KEYBOARD
#define HID_REPORT_ID_KEYBOARD1 1
#if RT_USB_DEVICE_HID_KEYBOARD_NUMBER>1
#define HID_REPORT_ID_KEYBOARD2 2
#if RT_USB_DEVICE_HID_KEYBOARD_NUMBER>2
#define HID_REPORT_ID_KEYBOARD3 3
#endif
#endif
#endif
#ifdef RT_USB_DEVICE_HID_MEDIA
#define HID_REPORT_ID_MEDIA 4
#endif
#ifdef RT_USB_DEVICE_HID_GENERAL
#define HID_REPORT_ID_GENERAL 5
#endif
#ifdef RT_USB_DEVICE_HID_MOUSE
#define HID_REPORT_ID_MOUSE 6
#endif
#endif
#define HID_REPORT_ID_KEYBOARD1 1
#define HID_REPORT_ID_KEYBOARD2 2
#define HID_REPORT_ID_KEYBOARD3 3
#define HID_REPORT_ID_KEYBOARD4 7
#define HID_REPORT_ID_MEDIA 4
#define HID_REPORT_ID_GENERAL 5
#define HID_REPORT_ID_MOUSE 6
#define uswap_32(x) \
((((x) & 0xff000000) >> 24) | \
......@@ -473,7 +460,6 @@ typedef struct usb_os_proerty * usb_os_proerty_t;
#define HID_SUB_DESCRIPTOR_MAX 1
#endif
#ifdef RT_USB_DEVICE_HID
struct uhid_descriptor
{
rt_uint8_t bLength;
......@@ -497,7 +483,7 @@ struct hid_report
};
typedef struct hid_report* hid_report_t;
extern void HID_Report_Received(hid_report_t report);
#endif
struct urequest
{
rt_uint8_t request_type;
......
......@@ -129,6 +129,34 @@ const rt_uint8_t _report_desc[]=
USAGE_MAXIMUM(1), 0x65,
INPUT(1), 0x00,
END_COLLECTION(0),
#if RT_USB_DEVICE_HID_KEYBOARD_NUMBER>3
USAGE_PAGE(1), 0x01,
USAGE(1), 0x06,
COLLECTION(1), 0x01,
REPORT_ID(1), HID_REPORT_ID_KEYBOARD4,
USAGE_PAGE(1), 0x07,
USAGE_MINIMUM(1), 0xE0,
USAGE_MAXIMUM(1), 0xE7,
LOGICAL_MINIMUM(1), 0x00,
LOGICAL_MAXIMUM(1), 0x01,
REPORT_SIZE(1), 0x01,
REPORT_COUNT(1), 0x08,
INPUT(1), 0x02,
REPORT_COUNT(1), 0x01,
REPORT_SIZE(1), 0x08,
INPUT(1), 0x01,
REPORT_COUNT(1), 0x06,
REPORT_SIZE(1), 0x08,
LOGICAL_MINIMUM(1), 0x00,
LOGICAL_MAXIMUM(1), 0x65,
USAGE_PAGE(1), 0x07,
USAGE_MINIMUM(1), 0x00,
USAGE_MAXIMUM(1), 0x65,
INPUT(1), 0x00,
END_COLLECTION(0),
#endif
#endif
#endif
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册