Merge pull request #824 from dhylands/sdcard-power

Fix sdcard_power_on to not do anything if the card is already powered on...
nlr-macros
Damien George 2014-08-26 22:58:54 +01:00
commit f05b87bd63
1 changed files with 7 additions and 1 deletions

View File

@ -90,6 +90,9 @@ bool sdcard_power_on(void) {
if (!sdcard_is_present()) {
return false;
}
if (sd_handle.Instance) {
return true;
}
// SD device interface configuration
sd_handle.Instance = SDIO;
@ -120,7 +123,10 @@ error:
}
void sdcard_power_off(void) {
HAL_SD_DeInit(&sd_handle);
if (!sd_handle.Instance) {
return;
}
HAL_SD_DeInit(&sd_handle);
sd_handle.Instance = NULL;
}