[FL-1506, FL-2197] Power, USB, LED driver improvements (#966)

* Power, USB, LED driver improvements
* u2f hid descriptor fix
* variable_item_list: value alignment fix
* InputTypeRepeat handling in menu/submenu/var_item_list
* lp5562: fix bugs on 400khz i2c
* Scripts: lint in parallel.
* FuriHal: rename some USB structure to match naming convention. Drivers: update magic values in LP5562.

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Nikolay Minaylov
2022-01-21 19:55:44 +03:00
committed by GitHub
parent d4d87aa6a8
commit d4787e859e
35 changed files with 968 additions and 182 deletions

View File

@@ -2,10 +2,10 @@
#include "usb.h"
typedef struct UsbInterface UsbInterface;
typedef struct FuriHalUsbInterface FuriHalUsbInterface;
struct UsbInterface {
void (*init)(usbd_device* dev, UsbInterface* intf);
struct FuriHalUsbInterface {
void (*init)(usbd_device* dev, FuriHalUsbInterface* intf);
void (*deinit)(usbd_device* dev);
void (*wakeup)(usbd_device* dev);
void (*suspend)(usbd_device* dev);
@@ -20,10 +20,19 @@ struct UsbInterface {
};
/** USB device interface modes */
extern UsbInterface usb_cdc_single;
extern UsbInterface usb_cdc_dual;
extern UsbInterface usb_hid;
extern UsbInterface usb_hid_u2f;
extern FuriHalUsbInterface usb_cdc_single;
extern FuriHalUsbInterface usb_cdc_dual;
extern FuriHalUsbInterface usb_hid;
extern FuriHalUsbInterface usb_hid_u2f;
typedef enum {
FuriHalUsbStateEventReset,
FuriHalUsbStateEventWakeup,
FuriHalUsbStateEventSuspend,
FuriHalUsbStateEventDescriptorRequest,
} FuriHalUsbStateEvent;
typedef void (*FuriHalUsbStateCallback)(FuriHalUsbStateEvent state, void* context);
/** USB device low-level initialization
*/
@@ -33,13 +42,13 @@ void furi_hal_usb_init();
*
* @param mode new USB device mode
*/
void furi_hal_usb_set_config(UsbInterface* new_if);
void furi_hal_usb_set_config(FuriHalUsbInterface* new_if);
/** Get USB device configuration
*
* @return current USB device mode
*/
UsbInterface* furi_hal_usb_get_config();
FuriHalUsbInterface* furi_hal_usb_get_config();
/** Disable USB device
*/
@@ -48,3 +57,11 @@ 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();