mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Merge pull request #10730 from hydra/bf-sdcard-fixes-1
This commit is contained in:
parent
99c243c238
commit
712173f968
3 changed files with 11 additions and 0 deletions
|
@ -168,8 +168,14 @@ void HAL_SD_MspInit(SD_HandleTypeDef* hsd)
|
|||
}
|
||||
|
||||
if (sdioHardware->instance == SDMMC1) {
|
||||
__HAL_RCC_SDMMC1_CLK_DISABLE();
|
||||
__HAL_RCC_SDMMC1_FORCE_RESET();
|
||||
__HAL_RCC_SDMMC1_RELEASE_RESET();
|
||||
__HAL_RCC_SDMMC1_CLK_ENABLE();
|
||||
} else if (sdioHardware->instance == SDMMC2) {
|
||||
__HAL_RCC_SDMMC2_CLK_DISABLE();
|
||||
__HAL_RCC_SDMMC2_FORCE_RESET();
|
||||
__HAL_RCC_SDMMC2_RELEASE_RESET();
|
||||
__HAL_RCC_SDMMC2_CLK_ENABLE();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ typedef enum {
|
|||
FAILURE_SDCARD_READ_FAILED,
|
||||
FAILURE_SDCARD_WRITE_FAILED,
|
||||
FAILURE_SDCARD_INITIALISATION_FAILED,
|
||||
FAILURE_SDCARD_REQUIRED,
|
||||
} failureMode_e;
|
||||
|
||||
#define WARNING_FLASH_DURATION_MS 50
|
||||
|
|
|
@ -378,6 +378,10 @@ void init(void)
|
|||
sdCardAndFSInit();
|
||||
initFlags |= SD_INIT_ATTEMPTED;
|
||||
|
||||
if (!sdcard_isInserted()) {
|
||||
failureMode(FAILURE_SDCARD_REQUIRED);
|
||||
}
|
||||
|
||||
while (afatfs_getFilesystemState() != AFATFS_FILESYSTEM_STATE_READY) {
|
||||
afatfs_poll();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue