xref: /nrf52832-nimble/rt-thread/components/drivers/usb/usbhost/class/hid.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2011-12-12     Yi Qiu      first version
9  */
10 
11 #ifndef __HID_H__
12 #define __HID_H__
13 
14 #include <rtthread.h>
15 
16 struct uhid
17 {
18     upipe_t pipe_in;
19     rt_uint8_t buffer[8];
20     uprotocal_t protocal;
21 };
22 typedef struct uhid uhid_t;
23 
24 #define USB_REQ_GET_REPORT      0x01
25 #define USB_REQ_GET_IDLE        0x02
26 #define USB_REQ_GET_PROTOCOL    0x03
27 #define USB_REQ_SET_REPORT      0x09
28 #define USB_REQ_SET_IDLE        0x0a
29 #define USB_REQ_SET_PROTOCOL    0x0b
30 
31 #define USB_HID_KEYBOARD        1
32 #define USB_HID_MOUSE            2
33 
34 rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id);
35 rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, rt_uint8_t id, rt_uint8_t *buffer, rt_size_t size);
36 rt_err_t rt_usbh_hid_set_report(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size);
37 rt_err_t rt_usbh_hid_set_protocal(struct uintf* intf, int protocol);
38 rt_err_t rt_usbh_hid_get_report_descriptor(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size);
39 rt_err_t rt_usbh_hid_protocal_register(uprotocal_t protocal);
40 
41 #endif
42