1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

Add USB MSC support for H7

This commit is contained in:
Steve Evans 2020-10-14 21:01:32 +01:00
parent ae62f46958
commit 31b06cd7d2
22 changed files with 204 additions and 52 deletions

View file

@ -337,7 +337,6 @@ void init(void)
};
uint8_t initFlags = 0;
#ifdef CONFIG_IN_SDCARD
//
@ -445,6 +444,16 @@ void init(void)
systemState |= SYSTEM_STATE_CONFIG_LOADED;
#ifdef USE_SDCARD
// Ensure the SD card is initialised before the USB MSC starts to avoid a race condition
#if !defined(CONFIG_IN_SDCARD) && defined(STM32H7) && defined(USE_SDCARD_SDIO) // H7 only for now, likely should be applied to F4/F7 too
sdioPinConfigure();
SDIO_GPIO_Init();
initFlags |= SD_INIT_ATTEMPTED;
sdCardAndFSInit();
#endif
#endif
#ifdef USE_BRUSHED_ESC_AUTODETECT
// Now detect again with the actually configured pin for motor 1, if it is not the default pin.
ioTag_t configuredMotorIoTag = motorConfig()->dev.ioTags[0];
@ -635,7 +644,7 @@ void init(void)
/* MSC mode will start after init, but will not allow scheduler to run,
* so there is no bottleneck in reading and writing data */
mscInit();
if (mscCheckBoot() || mscCheckButton()) {
if (mscCheckBootAndReset() || mscCheckButton()) {
ledInit(statusLedConfig());
#if defined(USE_FLASHFS)
@ -686,14 +695,6 @@ void init(void)
updateHardwareRevision();
#endif
#if defined(STM32H7) && defined(USE_SDCARD_SDIO) // H7 only for now, likely should be applied to F4/F7 too
if (!(initFlags & SD_INIT_ATTEMPTED)) {
sdioPinConfigure();
SDIO_GPIO_Init();
}
#endif
#ifdef USE_VTX_RTC6705
bool useRTC6705 = rtc6705IOInit(vtxIOConfig());
#endif