usbh_hid.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_report(struct usbh_hid *hid_class, uint8_t report_type, uint8_t report_id, uint8_t *buffer, uint32_t buflen);
  28. int usbh_hid_get_report(struct usbh_hid *hid_class, uint8_t report_type, uint8_t report_id, uint8_t *buffer, uint32_t buflen);
  29. void usbh_hid_run(struct usbh_hid *hid_class);
  30. void usbh_hid_stop(struct usbh_hid *hid_class);
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif /* USBH_HID_H */