2022-08-18 21:41:19 +08:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, sakumisu
|
2022-02-08 11:44:46 +08:00
|
|
|
*
|
2022-08-18 21:41:19 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2022-02-08 11:44:46 +08:00
|
|
|
*/
|
2022-08-18 21:41:19 +08:00
|
|
|
#ifndef USBH_HID_H
|
|
|
|
|
#define USBH_HID_H
|
2022-02-08 11:44:46 +08:00
|
|
|
|
|
|
|
|
#include "usb_hid.h"
|
|
|
|
|
|
|
|
|
|
struct usbh_hid {
|
2022-03-19 11:23:40 +08:00
|
|
|
struct usbh_hubport *hport;
|
2023-11-15 22:08:26 +08:00
|
|
|
struct usb_endpoint_descriptor *intin; /* INTR IN endpoint */
|
|
|
|
|
struct usb_endpoint_descriptor *intout; /* INTR OUT endpoint */
|
|
|
|
|
struct usbh_urb intin_urb; /* INTR IN urb */
|
|
|
|
|
struct usbh_urb intout_urb; /* INTR OUT urb */
|
2022-03-19 11:23:40 +08:00
|
|
|
|
2024-04-24 22:40:55 +08:00
|
|
|
uint8_t report_desc[256];
|
2024-08-18 20:54:39 +08:00
|
|
|
uint16_t report_size;
|
|
|
|
|
|
|
|
|
|
uint8_t protocol;
|
2022-02-08 11:44:46 +08:00
|
|
|
uint8_t intf; /* interface number */
|
|
|
|
|
uint8_t minor;
|
2024-04-24 22:40:55 +08:00
|
|
|
|
|
|
|
|
void *user_data;
|
2022-02-08 11:44:46 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-04-04 15:37:14 +08:00
|
|
|
int usbh_hid_set_idle(struct usbh_hid *hid_class, uint8_t report_id, uint8_t duration);
|
|
|
|
|
int usbh_hid_get_idle(struct usbh_hid *hid_class, uint8_t *buffer);
|
2024-04-23 22:02:16 +08:00
|
|
|
int usbh_hid_set_report(struct usbh_hid *hid_class, uint8_t report_type, uint8_t report_id, uint8_t *buffer, uint32_t buflen);
|
|
|
|
|
int usbh_hid_get_report(struct usbh_hid *hid_class, uint8_t report_type, uint8_t report_id, uint8_t *buffer, uint32_t buflen);
|
2022-04-04 15:37:14 +08:00
|
|
|
|
2022-11-26 23:52:58 +08:00
|
|
|
void usbh_hid_run(struct usbh_hid *hid_class);
|
|
|
|
|
void usbh_hid_stop(struct usbh_hid *hid_class);
|
|
|
|
|
|
2022-02-08 11:44:46 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-08-18 21:41:19 +08:00
|
|
|
#endif /* USBH_HID_H */
|