mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-21 02:03:18 +00:00
917410a0a8
* fbt: reworking targets & assets handling WIP * fbt: dist fixes * fbt: moved SD card resources to owning apps * unit_tests: moved resources to app folder * github: updated unit_tests paths * github: packaging fixes * unit_tests: fixes * fbt: assets: internal cleanup * fbt: reworked assets handling * github: unit_tests: reintroducing fixes * minor cleanup * fbt: naming changes to reflect private nature of scons tools * fbt: resources: fixed dist archive paths * docs: updated paths * docs: updated more paths * docs: included "resources" parameter in app manifest docs; updated assets readme * updated gitignore for assets * github: updated action versions * unit_tests: restored timeout; scripts: assets: logging changes * gh: don't upload desktop animations for unit test run Co-authored-by: あく <alleteam@gmail.com>
92 lines
2 KiB
C
92 lines
2 KiB
C
#pragma once
|
|
|
|
#include "usb.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct FuriHalUsbInterface FuriHalUsbInterface;
|
|
|
|
struct FuriHalUsbInterface {
|
|
void (*init)(usbd_device* dev, FuriHalUsbInterface* intf, void* ctx);
|
|
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 FuriHalUsbInterface usb_cdc_single;
|
|
extern FuriHalUsbInterface usb_cdc_dual;
|
|
extern FuriHalUsbInterface usb_hid;
|
|
extern FuriHalUsbInterface usb_hid_u2f;
|
|
extern FuriHalUsbInterface usb_ccid;
|
|
|
|
typedef enum {
|
|
FuriHalUsbStateEventReset,
|
|
FuriHalUsbStateEventWakeup,
|
|
FuriHalUsbStateEventSuspend,
|
|
FuriHalUsbStateEventDescriptorRequest,
|
|
} FuriHalUsbStateEvent;
|
|
|
|
typedef void (*FuriHalUsbStateCallback)(FuriHalUsbStateEvent state, void* context);
|
|
|
|
/** USB device low-level initialization
|
|
*/
|
|
void furi_hal_usb_init();
|
|
|
|
/** Set USB device configuration
|
|
*
|
|
* @param mode new USB device mode
|
|
* @param ctx context passed to device mode init function
|
|
* @return true - mode switch started, false - mode switch is locked
|
|
*/
|
|
bool furi_hal_usb_set_config(FuriHalUsbInterface* new_if, void* ctx);
|
|
|
|
/** Get USB device configuration
|
|
*
|
|
* @return current USB device mode
|
|
*/
|
|
FuriHalUsbInterface* furi_hal_usb_get_config();
|
|
|
|
/** Lock USB device mode switch
|
|
*/
|
|
void furi_hal_usb_lock();
|
|
|
|
/** Unlock USB device mode switch
|
|
*/
|
|
void furi_hal_usb_unlock();
|
|
|
|
/** Check if USB device mode switch locked
|
|
*
|
|
* @return lock state
|
|
*/
|
|
bool furi_hal_usb_is_locked();
|
|
|
|
/** Disable USB device
|
|
*/
|
|
void furi_hal_usb_disable();
|
|
|
|
/** Enable USB device
|
|
*/
|
|
void furi_hal_usb_enable();
|
|
|
|
/** Set USB state callback
|
|
*/
|
|
void furi_hal_usb_set_state_callback(FuriHalUsbStateCallback cb, void* ctx);
|
|
|
|
/** Restart USB device
|
|
*/
|
|
void furi_hal_usb_reinit();
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|