2017-11-11 10:51:47 +08:00
|
|
|
/*
|
2023-04-18 10:26:23 +08:00
|
|
|
* Copyright (c) 2006-2023, RT-Thread Development Team
|
2017-11-11 10:51:47 +08:00
|
|
|
*
|
2018-10-14 19:37:18 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2017-11-11 10:51:47 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2011-12-12 Yi Qiu first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __HID_H__
|
|
|
|
#define __HID_H__
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
|
|
|
struct uhid
|
|
|
|
{
|
|
|
|
upipe_t pipe_in;
|
|
|
|
rt_uint8_t buffer[8];
|
|
|
|
uprotocal_t protocal;
|
2021-03-08 18:19:04 +08:00
|
|
|
};
|
2017-11-11 10:51:47 +08:00
|
|
|
typedef struct uhid uhid_t;
|
|
|
|
|
|
|
|
#define USB_REQ_GET_REPORT 0x01
|
|
|
|
#define USB_REQ_GET_IDLE 0x02
|
|
|
|
#define USB_REQ_GET_PROTOCOL 0x03
|
|
|
|
#define USB_REQ_SET_REPORT 0x09
|
|
|
|
#define USB_REQ_SET_IDLE 0x0a
|
|
|
|
#define USB_REQ_SET_PROTOCOL 0x0b
|
|
|
|
|
2021-03-08 18:19:04 +08:00
|
|
|
#define USB_HID_KEYBOARD 1
|
2017-11-11 10:51:47 +08:00
|
|
|
#define USB_HID_MOUSE 2
|
|
|
|
|
2021-02-23 13:42:19 +08:00
|
|
|
rt_err_t rt_usbh_hid_set_idle(struct uhintf* intf, int duration, int report_id);
|
|
|
|
rt_err_t rt_usbh_hid_get_report(struct uhintf* intf, rt_uint8_t type, rt_uint8_t id, rt_uint8_t *buffer, rt_size_t size);
|
|
|
|
rt_err_t rt_usbh_hid_set_report(struct uhintf* intf, rt_uint8_t *buffer, rt_size_t size);
|
|
|
|
rt_err_t rt_usbh_hid_set_protocal(struct uhintf* intf, int protocol);
|
|
|
|
rt_err_t rt_usbh_hid_get_report_descriptor(struct uhintf* intf, rt_uint8_t *buffer, rt_size_t size);
|
2017-11-11 10:51:47 +08:00
|
|
|
rt_err_t rt_usbh_hid_protocal_register(uprotocal_t protocal);
|
|
|
|
|
2021-03-08 18:19:04 +08:00
|
|
|
#endif
|