2021-10-06 09:24:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "usb.h"
|
|
|
|
|
2021-11-21 15:17:43 +00:00
|
|
|
typedef struct UsbInterface UsbInterface;
|
2021-10-06 09:24:09 +00:00
|
|
|
|
2021-11-21 15:17:43 +00:00
|
|
|
struct UsbInterface {
|
|
|
|
void (*init)(usbd_device *dev, UsbInterface* intf);
|
|
|
|
void (*deinit)(usbd_device *dev);
|
|
|
|
void (*wakeup)(usbd_device *dev);
|
|
|
|
void (*suspend)(usbd_device *dev);
|
|
|
|
|
|
|
|
struct usb_device_descriptor* dev_descr;
|
|
|
|
|
|
|
|
void* str_manuf_descr;
|
|
|
|
void* str_prod_descr;
|
|
|
|
void* str_serial_descr;
|
|
|
|
|
|
|
|
void* cfg_descr;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** USB device interface modes */
|
|
|
|
extern UsbInterface usb_cdc_single;
|
|
|
|
extern UsbInterface usb_cdc_dual;
|
|
|
|
extern UsbInterface usb_hid;
|
2021-12-22 20:04:08 +00:00
|
|
|
extern UsbInterface usb_hid_u2f;
|
2021-10-06 09:24:09 +00:00
|
|
|
|
2021-10-13 16:38:24 +00:00
|
|
|
/** USB device low-level initialization
|
|
|
|
*/
|
2021-10-06 09:24:09 +00:00
|
|
|
void furi_hal_usb_init();
|
|
|
|
|
2021-10-13 16:38:24 +00:00
|
|
|
/** Set USB device configuration
|
|
|
|
*
|
|
|
|
* @param mode new USB device mode
|
|
|
|
*/
|
2021-11-21 15:17:43 +00:00
|
|
|
void furi_hal_usb_set_config(UsbInterface* new_if);
|
2021-10-06 09:24:09 +00:00
|
|
|
|
2021-10-13 16:38:24 +00:00
|
|
|
/** Get USB device configuration
|
|
|
|
*
|
|
|
|
* @return current USB device mode
|
|
|
|
*/
|
2021-11-21 15:17:43 +00:00
|
|
|
UsbInterface* furi_hal_usb_get_config();
|
2021-10-13 16:38:24 +00:00
|
|
|
|
|
|
|
/** Disable USB device
|
|
|
|
*/
|
2021-10-06 09:24:09 +00:00
|
|
|
void furi_hal_usb_disable();
|
|
|
|
|
2021-10-13 16:38:24 +00:00
|
|
|
/** Enable USB device
|
|
|
|
*/
|
2021-10-06 09:24:09 +00:00
|
|
|
void furi_hal_usb_enable();
|