USB-UART: New GUI (#826)

* USB-UART: new gui
* Furi: use furi_console for logging instead of printf.
* CDC: calling open/close callbacks on interface change
* fix vcp_tx block on disconnect
* USB mode set by struct pointer
* FuriHal: proper event sequence on vcp reconnect
* disable debug prints
* HAL: add context to UART IRQ's
* Context usage in UART IRQ and CDC callbacks
* USB-UART: geting rid of baudrate limitations
* FuriHal: remove struct pollutant in usb api.

Co-authored-by: あく <alleteam@gmail.com>
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
This commit is contained in:
Nikolay Minaylov
2021-11-21 18:17:43 +03:00
committed by GitHub
parent a5052a0375
commit efded63bcb
37 changed files with 1444 additions and 961 deletions

View File

@@ -2,16 +2,27 @@
#include "usb.h"
/** USB device modes */
typedef enum {
UsbModeNone,
UsbModeVcpSingle,
UsbModeVcpDual,
UsbModeHid,
UsbModeU2F,
typedef struct UsbInterface UsbInterface;
UsbModesNum,
} UsbMode;
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;
/** USB device low-level initialization
*/
@@ -21,13 +32,13 @@ void furi_hal_usb_init();
*
* @param mode new USB device mode
*/
void furi_hal_usb_set_config(UsbMode mode);
void furi_hal_usb_set_config(UsbInterface* new_if);
/** Get USB device configuration
*
* @return current USB device mode
*/
UsbMode furi_hal_usb_get_config();
UsbInterface* furi_hal_usb_get_config();
/** Disable USB device
*/