/** * @brief DeInitializes the SD card device. * @param SdCard: SD card to be used, that should be SD_CARD1 or SD_CARD2 * @retval SD status */ uint8_t BSP_SD_DeInitEx(uint32_t SdCard) { uint8_t sd_state = MSD_OK; /* Set back Mfx pin to INPUT mode in case it was in exti */ UseExtiModeDetection = 0; if(SdCard == SD_CARD1) { uSdHandle.Instance = SDMMC1; /* HAL SD deinitialization */ if(HAL_SD_DeInit(&uSdHandle) != HAL_OK) { sd_state = MSD_ERROR; } /* Msp SD deinitialization */ BSP_SD_MspDeInit(&uSdHandle, NULL); BSP_IO_ConfigPin(SD1_DETECT_PIN, IO_MODE_INPUT_PU); } else { uSdHandle2.Instance = SDMMC2; BSP_IO_ConfigPin(SD2_DETECT_PIN, IO_MODE_INPUT_PU); /* HAL SD deinitialization */ if(HAL_SD_DeInit(&uSdHandle2) != HAL_OK) { sd_state = MSD_ERROR; } /* Msp SD deinitialization */ BSP_SD_MspDeInit(&uSdHandle2, NULL); } return sd_state; }
/** * @brief DeInitializes the SD card device. * @retval SD status */ uint8_t BSP_SD_DeInit(void) { uint8_t sd_state = MSD_OK; uSdHandle.Instance = SDIO; /* HAL SD deinitialization */ if(HAL_SD_DeInit(&uSdHandle) != HAL_OK) { sd_state = MSD_ERROR; } /* Msp SD deinitialization */ uSdHandle.Instance = SDIO; BSP_SD_MspDeInit(&uSdHandle, NULL); return sd_state; }
/** * @brief DeInitializes the SD card device. * @retval SD status */ uint8_t BSP_SD_DeInit(void) { uint8_t sd_state = MSD_OK; uSdHandle.Instance = SDIO; /* Set back Mfx pin to INPUT mode in case it was in exti */ UseExtiModeDetection = 0; BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_INPUT_PU); /* HAL SD deinitialization */ if(HAL_SD_DeInit(&uSdHandle) != HAL_OK) { sd_state = MSD_ERROR; } /* Msp SD deinitialization */ uSdHandle.Instance = SDIO; BSP_SD_MspDeInit(&uSdHandle, NULL); return sd_state; }