furi_hal_usb.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include "usb.h"
  3. typedef struct UsbInterface UsbInterface;
  4. struct UsbInterface {
  5. void (*init)(usbd_device* dev, UsbInterface* intf);
  6. void (*deinit)(usbd_device* dev);
  7. void (*wakeup)(usbd_device* dev);
  8. void (*suspend)(usbd_device* dev);
  9. struct usb_device_descriptor* dev_descr;
  10. void* str_manuf_descr;
  11. void* str_prod_descr;
  12. void* str_serial_descr;
  13. void* cfg_descr;
  14. };
  15. /** USB device interface modes */
  16. extern UsbInterface usb_cdc_single;
  17. extern UsbInterface usb_cdc_dual;
  18. extern UsbInterface usb_hid;
  19. extern UsbInterface usb_hid_u2f;
  20. /** USB device low-level initialization
  21. */
  22. void furi_hal_usb_init();
  23. /** Set USB device configuration
  24. *
  25. * @param mode new USB device mode
  26. */
  27. void furi_hal_usb_set_config(UsbInterface* new_if);
  28. /** Get USB device configuration
  29. *
  30. * @return current USB device mode
  31. */
  32. UsbInterface* furi_hal_usb_get_config();
  33. /** Disable USB device
  34. */
  35. void furi_hal_usb_disable();
  36. /** Enable USB device
  37. */
  38. void furi_hal_usb_enable();