1
0

usbh_hid.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2022, sakumisu
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef USBH_HID_H
  7. #define USBH_HID_H
  8. #include "usb_hid.h"
  9. struct usbh_hid {
  10. struct usbh_hubport *hport;
  11. struct usb_endpoint_descriptor *intin; /* INTR IN endpoint */
  12. struct usb_endpoint_descriptor *intout; /* INTR OUT endpoint */
  13. struct usbh_urb intin_urb; /* INTR IN urb */
  14. struct usbh_urb intout_urb; /* INTR OUT urb */
  15. uint16_t report_size;
  16. uint8_t protocol;
  17. uint8_t intf; /* interface number */
  18. uint8_t minor;
  19. void *user_data;
  20. };
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. int usbh_hid_get_report_descriptor(struct usbh_hid *hid_class, uint8_t *buffer, uint32_t buflen);
  25. int usbh_hid_set_idle(struct usbh_hid *hid_class, uint8_t report_id, uint8_t duration);
  26. int usbh_hid_get_idle(struct usbh_hid *hid_class, uint8_t *buffer);
  27. int usbh_hid_set_protocol(struct usbh_hid *hid_class, uint8_t protocol);
  28. int usbh_hid_get_protocol(struct usbh_hid *hid_class, uint8_t *protocol);
  29. int usbh_hid_set_report(struct usbh_hid *hid_class, uint8_t report_type, uint8_t report_id, uint8_t *buffer, uint32_t buflen);
  30. int usbh_hid_get_report(struct usbh_hid *hid_class, uint8_t report_type, uint8_t report_id, uint8_t *buffer, uint32_t buflen);
  31. void usbh_hid_run(struct usbh_hid *hid_class);
  32. void usbh_hid_stop(struct usbh_hid *hid_class);
  33. #ifdef __cplusplus
  34. }
  35. #endif
  36. #endif /* USBH_HID_H */