usbh_hid.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. uint8_t report_desc[256];
  16. uint8_t intf; /* interface number */
  17. uint8_t minor;
  18. void *user_data;
  19. };
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. int usbh_hid_set_idle(struct usbh_hid *hid_class, uint8_t report_id, uint8_t duration);
  24. int usbh_hid_get_idle(struct usbh_hid *hid_class, uint8_t *buffer);
  25. int usbh_hid_set_report(struct usbh_hid *hid_class, uint8_t report_type, uint8_t report_id, uint8_t *buffer, uint32_t buflen);
  26. int usbh_hid_get_report(struct usbh_hid *hid_class, uint8_t report_type, uint8_t report_id, uint8_t *buffer, uint32_t buflen);
  27. void usbh_hid_run(struct usbh_hid *hid_class);
  28. void usbh_hid_stop(struct usbh_hid *hid_class);
  29. #ifdef __cplusplus
  30. }
  31. #endif
  32. #endif /* USBH_HID_H */