1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 04:15:44 +03:00

Add USB Mass Storage Class support (#5443)

* Add MSC support

* Add support for MSC to WORMFC and SDIO_DMA

* Cleanup in fc_init

* Fix headers
This commit is contained in:
conkerkh 2018-03-21 12:11:34 +01:00 committed by Michael Keller
parent bc283cf5b9
commit 3a917a3755
23 changed files with 3861 additions and 5 deletions

View file

@ -79,6 +79,7 @@ extern uint8_t __config_end;
#include "drivers/light_led.h"
#include "drivers/camera_control.h"
#include "drivers/vtx_common.h"
#include "drivers/usb_msc.h"
#include "fc/config.h"
#include "fc/controlrate_profile.h"
@ -3706,6 +3707,33 @@ static void cliDiff(char *cmdline)
printConfig(cmdline, true);
}
#ifdef USB_MSC
static void cliMsc(char *cmdline)
{
UNUSED(cmdline);
if (sdcard_isFunctional()) {
cliPrintHashLine("restarting in mass storage mode");
cliPrint("\r\nRebooting");
bufWriterFlush(cliWriter);
delay(1000);
waitForSerialPortToFinishTransmitting(cliPort);
stopPwmAllMotors();
if (mpuResetFn) {
mpuResetFn();
}
*((uint32_t *)0x2001FFF0) = 0xDDDD1010; // Same location as bootloader magic but different value
__disable_irq();
NVIC_SystemReset();
} else {
cliPrint("\r\nSD Card not present or failed to initialize!");
bufWriterFlush(cliWriter);
}
}
#endif
typedef struct {
const char *name;
#ifndef MINIMAL_CLI
@ -3825,6 +3853,9 @@ const clicmd_t cmdTable[] = {
#ifdef USE_VTX_CONTROL
CLI_COMMAND_DEF("vtx", "vtx channels on switch", NULL, cliVtx),
#endif
#ifdef USB_MSC
CLI_COMMAND_DEF("msc", "switch into msc mode", NULL, cliMsc),
#endif
};
static void cliHelp(char *cmdline)