furi-hal-usb.h 991 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. /** USB device low-level initialization
  20. */
  21. void furi_hal_usb_init();
  22. /** Set USB device configuration
  23. *
  24. * @param mode new USB device mode
  25. */
  26. void furi_hal_usb_set_config(UsbInterface* new_if);
  27. /** Get USB device configuration
  28. *
  29. * @return current USB device mode
  30. */
  31. UsbInterface* furi_hal_usb_get_config();
  32. /** Disable USB device
  33. */
  34. void furi_hal_usb_disable();
  35. /** Enable USB device
  36. */
  37. void furi_hal_usb_enable();