Merge pull request #824 from dhylands/sdcard-power
Fix sdcard_power_on to not do anything if the card is already powered on...
This commit is contained in:
commit
f05b87bd63
@ -90,6 +90,9 @@ bool sdcard_power_on(void) {
|
|||||||
if (!sdcard_is_present()) {
|
if (!sdcard_is_present()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (sd_handle.Instance) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// SD device interface configuration
|
// SD device interface configuration
|
||||||
sd_handle.Instance = SDIO;
|
sd_handle.Instance = SDIO;
|
||||||
@ -120,6 +123,9 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sdcard_power_off(void) {
|
void sdcard_power_off(void) {
|
||||||
|
if (!sd_handle.Instance) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
HAL_SD_DeInit(&sd_handle);
|
HAL_SD_DeInit(&sd_handle);
|
||||||
sd_handle.Instance = NULL;
|
sd_handle.Instance = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user